Fixed IncludeBaseDamage to be an override

This commit is contained in:
WBHarry 2026-04-20 15:20:35 +02:00
parent 03110377e1
commit c683bc4352
4 changed files with 44 additions and 38 deletions

View file

@ -113,7 +113,9 @@
"deleteTriggerTitle": "Delete Trigger", "deleteTriggerTitle": "Delete Trigger",
"deleteTriggerContent": "Are you sure you want to delete the {trigger} trigger?", "deleteTriggerContent": "Are you sure you want to delete the {trigger} trigger?",
"advantageState": "Advantage State", "advantageState": "Advantage State",
"damageOnSave": "Damage on Save" "damageOnSave": "Damage on Save",
"useDefaultItemValues": "Use default Item values",
"itemDamageIsUsed": "Item Damage Is Used"
}, },
"RollField": { "RollField": {
"diceRolling": { "diceRolling": {
@ -128,7 +130,7 @@
"attackModifier": "Attack Modifier", "attackModifier": "Attack Modifier",
"attackName": "Attack Name", "attackName": "Attack Name",
"criticalThreshold": "Critical Threshold", "criticalThreshold": "Critical Threshold",
"includeBase": { "label": "Include Item Damage" }, "includeBase": { "label": "Use Item Damage" },
"groupAttack": { "label": "Group Attack" }, "groupAttack": { "label": "Group Attack" },
"multiplier": "Multiplier", "multiplier": "Multiplier",
"saveHint": "Set a default Trait to enable Reaction Roll. It can be changed later in Reaction Roll Dialog.", "saveHint": "Set a default Trait to enable Reaction Roll. It can be changed later in Reaction Roll Dialog.",

View file

@ -13,7 +13,7 @@ export default class DHAttackAction extends DHDamageAction {
if (!!this.item?.system?.attack) { if (!!this.item?.system?.attack) {
if (this.damage.includeBase) { if (this.damage.includeBase) {
const baseDamage = this.getParentDamage(); const baseDamage = this.getParentDamage();
this.damage.parts.unshift(new DHDamageData(baseDamage)); this.damage.parts.hitPoints = new DHDamageData(baseDamage);
} }
if (this.roll.useDefault) { if (this.roll.useDefault) {
this.roll.trait = this.item.system.attack.roll.trait; this.roll.trait = this.item.system.attack.roll.trait;

View file

@ -21,7 +21,7 @@
</div> </div>
{{!-- Handlebars uses Symbol.Iterator to produce index|key. This isn't compatible with our parts object, so we instead use applyTo, which is the same value --}} {{!-- Handlebars uses Symbol.Iterator to produce index|key. This isn't compatible with our parts object, so we instead use applyTo, which is the same value --}}
{{#each source.parts as |dmg|}} {{#each source.parts as |dmg key|}}
<div class="nest-inputs"> <div class="nest-inputs">
<fieldset{{#if dmg.base}} disabled{{/if}} class="one-column{{#if ../path}} no-style{{/if}}"> <fieldset{{#if dmg.base}} disabled{{/if}} class="one-column{{#if ../path}} no-style{{/if}}">
<legend class="with-icon"> <legend class="with-icon">
@ -31,6 +31,7 @@
{{/unless}} {{/unless}}
</legend> </legend>
{{#unless (and @root.source.damage.includeBase (eq key 'hitPoints'))}}
{{#if (and (not @root.isNPC) @root.hasRoll (not dmg.base))}} {{#if (and (not @root.isNPC) @root.hasRoll (not dmg.base))}}
{{formField ../fields.resultBased value=dmg.resultBased name=(concat "damage.parts." dmg.applyTo ".resultBased") localize=true classes="checkbox"}} {{formField ../fields.resultBased value=dmg.resultBased name=(concat "damage.parts." dmg.applyTo ".resultBased") localize=true classes="checkbox"}}
{{/if}} {{/if}}
@ -65,6 +66,9 @@
</fieldset> </fieldset>
{{/if}} {{/if}}
<input type="hidden" name="{{concat ../path "damage.parts." dmg.applyTo ".base"}}" value="{{dmg.base}}"> <input type="hidden" name="{{concat ../path "damage.parts." dmg.applyTo ".base"}}" value="{{dmg.base}}">
{{else}}
<span class="hint">{{localize "DAGGERHEART.ACTIONS.Config.itemDamageIsUsed"}}</span>
{{/unless}}
</fieldset> </fieldset>
</div> </div>
{{/each}} {{/each}}

View file

@ -1,7 +1,7 @@
<fieldset class="one-column{{#if source.useDefault}} child-disabled{{/if}}"> <fieldset class="one-column{{#if source.useDefault}} child-disabled{{/if}}">
<legend> <legend>
Roll {{localize "DAGGERHEART.GENERAL.roll"}}
{{#if @root.hasBaseDamage}}{{formInput fields.useDefault name="roll.useDefault" value=source.useDefault dataset=(object tooltip="Use default Item values" tooltipDirection="UP")}}{{/if}} {{#if @root.hasBaseDamage}}{{formInput fields.useDefault name="roll.useDefault" value=source.useDefault dataset=(object tooltip=(localize "DAGGERHEART.ACTIONS.Config.useDefaultItemValues") tooltipDirection="UP")}}{{/if}}
</legend> </legend>
{{formField fields.type label="DAGGERHEART.GENERAL.type" name="roll.type" value=source.type localize=true choices=@root.getRollTypeOptions localize=true}} {{formField fields.type label="DAGGERHEART.GENERAL.type" name="roll.type" value=source.type localize=true choices=@root.getRollTypeOptions localize=true}}