Prevent assigning main damage on healing actions

This commit is contained in:
Carlos Fernandez 2026-07-18 00:16:51 -04:00
parent 23ebe6f6b5
commit 2ef78f2c89
2 changed files with 34 additions and 32 deletions

View file

@ -474,7 +474,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
source.damage.main = null; source.damage.main = null;
source.damage.resources = {}; source.damage.resources = {};
for (const [partKey, part] of Object.entries(source.damage.parts)) { for (const [partKey, part] of Object.entries(source.damage.parts)) {
if (partKey === 'hitPoints') { if (partKey === 'hitPoints' && source.type !== 'healing') {
source.damage.main = { source.damage.main = {
...part, ...part,
includeBase: source.damage.includeBase, includeBase: source.damage.includeBase,

View file

@ -1,10 +1,7 @@
{{#unless (eq @root.source.type 'healing')}}
<fieldset class="one-column"> <fieldset class="one-column">
<legend class="with-icon"> <legend class="with-icon">
{{#if (eq @root.source.type 'healing')}}
{{localize "DAGGERHEART.GENERAL.healing"}}
{{else}}
{{localize "DAGGERHEART.GENERAL.damage"}} {{localize "DAGGERHEART.GENERAL.damage"}}
{{/if}}
{{#if source.main}} {{#if source.main}}
<a data-action="removeDamage"><i class="fa-solid fa-trash icon-button"></i></a> <a data-action="removeDamage"><i class="fa-solid fa-trash icon-button"></i></a>
{{else}} {{else}}
@ -33,12 +30,17 @@
{{/if}} {{/if}}
{{/if}} {{/if}}
</fieldset> </fieldset>
{{/unless}}
{{#unless (eq path 'system.attack.')}} {{#unless (eq path 'system.attack.')}}
{{! In the future, consider allowing this even on NPCs}} {{! In the future, consider allowing this even on NPCs}}
<fieldset class="one-column"> <fieldset class="one-column">
<legend class="with-icon"> <legend class="with-icon">
{{#if (eq @root.source.type 'healing')}}
{{localize "DAGGERHEART.GENERAL.healing"}}
{{else}}
{{localize "DAGGERHEART.GENERAL.Resource.plural"}} {{localize "DAGGERHEART.GENERAL.Resource.plural"}}
{{/if}}
{{#unless @root.allDamageTypesUsed}}<a data-action="addDamageResource"><i class="fa-solid fa-plus icon-button"></i></a>{{/unless}} {{#unless @root.allDamageTypesUsed}}<a data-action="addDamageResource"><i class="fa-solid fa-plus icon-button"></i></a>{{/unless}}
</legend> </legend>
{{#each source.resources as |dmg key|}} {{#each source.resources as |dmg key|}}