Feature/253 weapon attack action (#290)

* Step #1

* Add Attack to Weapon & Override settings to Roll
This commit is contained in:
Dapoulp 2025-07-07 20:50:48 +02:00 committed by GitHub
parent 52be430eff
commit 7d7fb88035
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 168 additions and 91 deletions

View file

@ -4,20 +4,20 @@
Damage
{{#unless (eq path 'system.attack.')}}<a><i class="fa-solid fa-plus icon-button" data-action="addDamage"></i></a>{{/unless}}
</legend>
{{#unless @root.isNPC}}
{{#unless (or @root.isNPC path)}}
{{#if @root.hasBaseDamage}}
{{formField @root.fields.damage.fields.includeBase value=@root.source.damage.includeBase label="Include Item Damage" name="damage.includeBase" classes="checkbox" }}
{{/if}}
{{/unless}}
{{#each source.parts as |dmg index|}}
{{#if @root.isNPC}}
{{#if (or @root.isNPC ../path)}}
{{formField ../fields.value.fields.custom.fields.enabled value=dmg.value.custom.enabled name=(concat ../path "damage.parts." index ".value.custom.enabled") classes="checkbox"}}
<input type="hidden" name="{{../path}}damage.parts.{{index}}.value.multiplier" value="{{dmg.value.multiplier}}">
{{#if dmg.value.custom.enabled}}
{{formField ../fields.value.fields.custom.fields.formula value=dmg.value.custom.formula name=(concat ../path "damage.parts." index ".value.custom.formula") localize=true}}
{{else}}
<div class="nest-inputs">
{{formField ../fields.value.fields.flatMultiplier value=dmg.value.flatMultiplier name=(concat ../path "damage.parts." index ".value.flatMultiplier") label="Multiplier" classes="inline-child" }}
{{#if @root.isNPC}}{{formField ../fields.value.fields.flatMultiplier value=dmg.value.flatMultiplier name=(concat ../path "damage.parts." index ".value.flatMultiplier") label="Multiplier" classes="inline-child" }}{{/if}}
{{formField ../fields.value.fields.dice value=dmg.value.dice name=(concat ../path "damage.parts." index ".value.dice") classes="inline-child"}}
{{formField ../fields.value.fields.bonus value=dmg.value.bonus name=(concat ../path "damage.parts." index ".value.bonus") localize=true classes="inline-child"}}
</div>

View file

@ -1,5 +1,8 @@
<fieldset class="one-column">
<legend>Roll</legend>
<fieldset class="one-column{{#if source.useDefault}} child-disabled{{/if}}">
<legend>
Roll
{{#if @root.hasBaseDamage}}{{formInput fields.useDefault name="roll.useDefault" value=source.useDefault dataset=(object tooltip="Use default Item values" tooltipDirection="UP")}}{{/if}}
</legend>
{{#if @root.isNPC}}
{{formField fields.bonus label="Bonus" name="roll.bonus" value=source.bonus}}
{{formField fields.advState label= "Advantage State" name="roll.advState" value=source.advState localize=true}}

View file

@ -11,21 +11,28 @@
{{#if isSidebar}}
<div class="item-labels">
<div class="label">
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.trait '.name')}}
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.range '.name')}}
{{!-- {{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.short')}} --}}
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.short')}}
<span> - </span>
{{item.system.damage.value}}
({{localize (concat 'DAGGERHEART.CONFIG.DamageType.' item.system.damage.type '.abbreviation')}})
{{item.system.attack.damage.parts.0.value.dice}}{{#if item.system.attack.damage.parts.0.value.bonus}} + {{item.system.attack.damage.parts.0.value.bonus}}{{/if}}
{{!-- ({{localize (concat 'DAGGERHEART.CONFIG.DamageType.' item.system.attack.damage.parts.0.type '.abbreviation')}}) --}}
{{#with (lookup @root.config.GENERAL.damageTypes item.system.attack.damage.parts.0.type)}}
{{#each icon}}
<i class="fa-solid {{this}}"></i>
{{/each}}
{{/with}}
</div>
</div>
{{else}}
<div class="tag">
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.trait '.name')}}
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.range '.name')}}
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.name')}}
</div>
<div class="tag">
{{item.system.damage.value}}
({{localize (concat 'DAGGERHEART.CONFIG.DamageType.' item.system.damage.type '.abbreviation')}})
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.name')}}
</div>
<div class="tag">
{{item.system.attack.damage.parts.0.value.dice}}{{#if item.system.attack.damage.parts.0.value.bonus}} + {{item.system.attack.damage.parts.0.value.bonus}}{{/if}}
({{localize (concat 'DAGGERHEART.CONFIG.DamageType.' item.system.attack.damage.parts.0.type '.abbreviation')}})
</div>
<div class="tag">
{{localize (concat 'DAGGERHEART.CONFIG.Burden.' item.system.burden)}}

View file

@ -10,13 +10,12 @@
<h3>{{localize "DAGGERHEART.ITEMS.Weapon.primaryWeapon"}}</h3>
{{/if}}
<h3>
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' source.system.trait '.short')}}
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' source.system.attack.roll.trait '.short')}}
<span>-</span>
{{localize (concat 'DAGGERHEART.CONFIG.Range.' source.system.range '.name')}}
{{localize (concat 'DAGGERHEART.CONFIG.Range.' source.system.attack.range '.name')}}
<span>-</span>
{{log this}}
{{source.system.damage.dice}} + {{source.system.damage.bonus}}
({{localize (concat 'DAGGERHEART.CONFIG.DamageType.' source.system.damage.type '.abbreviation')}})
{{source.system.attack.damage.parts.0.value.dice}}{{#if source.system.attack.damage.parts.0.value.bonus}} + {{source.system.attack.damage.parts.0.value.bonus}}{{/if}}
({{localize (concat 'DAGGERHEART.CONFIG.DamageType.' source.system.attack.damage.parts.0.type '.abbreviation')}})
<span>-</span>
{{localize (concat 'DAGGERHEART.CONFIG.Burden.' source.system.burden)}}
</h3>

View file

@ -10,21 +10,26 @@
<span>{{localize "DAGGERHEART.ITEMS.Weapon.secondaryWeapon"}}</span>
{{formField systemFields.secondary value=source.system.secondary}}
<span>{{localize "DAGGERHEART.GENERAL.Trait.single"}}</span>
{{formField systemFields.trait value=source.system.trait localize=true}}
{{formInput systemFields.attack.fields.roll.fields.trait value=document.system.attack.roll.trait name="system.attack.roll.trait" label="DAGGERHEART.GENERAL.Trait.single" localize=true}}
<span>{{localize "DAGGERHEART.GENERAL.range"}}</span>
{{formField systemFields.range value=source.system.range localize=true}}
{{formInput systemFields.attack.fields.range value=document.system.attack.range label="Range" name="system.attack.range" localize=true}}
<span>{{localize "DAGGERHEART.GENERAL.burden"}}</span>
{{formField systemFields.burden value=source.system.burden localize=true}}
</fieldset>
<fieldset class="two-columns">
<legend>{{localize "DAGGERHEART.GENERAL.title"}}</legend>
<span>{{localize "DAGGERHEART.GENERAL.Dice.single"}}</span>
{{formGroup systemFields.damage.fields.dice value=source.system.damage.dice}}
<span>{{localize "DAGGERHEART.GENERAL.bonus"}}</span>
{{formGroup systemFields.damage.fields.bonus value=source.system.damage.bonus}}
<span>{{localize "DAGGERHEART.GENERAL.type"}}</span>
{{formGroup systemFields.damage.fields.type value=source.system.damage.type localize=true}}
{{#with systemFields.attack.fields.damage.fields.parts.element.fields as | fields | }}
{{#with (lookup ../document.system.attack.damage.parts 0) as | source | }}
<legend>{{localize "DAGGERHEART.GENERAL.title"}}</legend>
<span>{{localize "DAGGERHEART.GENERAL.Dice.single"}}</span>
{{formInput fields.value.fields.dice value=source.value.dice name="system.attack.damage.parts.0.value.dice"}}
<span>{{localize "DAGGERHEART.GENERAL.bonus"}}</span>
{{formInput fields.value.fields.bonus value=source.value.bonus name="system.attack.damage.parts.0.value.bonus" localize=true}}
<span>{{localize "DAGGERHEART.GENERAL.type"}}</span>
{{formInput fields.type value=source.type name="system.attack.damage.parts.0.type" localize=true}}
<input type="hidden" name="system.attack.damage.parts.0.value.multiplier" value="{{source.value.multiplier}}">
{{/with}}
{{/with}}
</fieldset>
<fieldset class="two-columns">
<legend>{{localize "TYPES.Item.feature"}}</legend>

View file

@ -4,7 +4,7 @@
<div class="dice-result">
<div class="dice-actions">
<button class="damage-button" data-target-hit="true" {{#if (eq targets.length 0)}}disabled{{/if}}>{{localize "DAGGERHEART.UI.Chat.damageRoll.dealDamageToTargets"}}</button>
<button class="damage-button">{{localize "DAGGERHEART.Chat.DamageRoll.DealDamage"}}</button>
<button class="damage-button">{{localize "DAGGERHEART.UI.Chat.damageRoll.dealDamage"}}</button>
</div>
</div>
</div>