More work on actionConfig outcomes

This commit is contained in:
WBHarry 2026-05-14 18:51:14 +02:00
parent f260d221a8
commit ec404a61d9
7 changed files with 180 additions and 58 deletions

View file

@ -1275,6 +1275,13 @@
"diceValue": "Dice Value", "diceValue": "Dice Value",
"die": "Die" "die": "Die"
}, },
"OutcomeType": {
"successHope": "Success/ Hope",
"successFear": "Success/ Fear",
"failureHope": "Failure/ Hope",
"failureFear": "Failure/ Fear",
"simpleOutcome": "Outcome"
},
"Range": { "Range": {
"self": { "self": {
"name": "Self", "name": "Self",

View file

@ -10,12 +10,87 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
this.action = action; this.action = action;
this.openSection = null; this.openSection = null;
this.openTrigger = this.action.triggers.length > 0 ? 0 : null; this.openTrigger = this.action.triggers.length > 0 ? 0 : null;
this.outcomeTabs = DHActionBaseConfig.getOutcomeTabs(action);
} }
get title() { get title() {
return `${game.i18n.localize('DAGGERHEART.GENERAL.Tabs.settings')}: ${this.action.name}`; return `${game.i18n.localize('DAGGERHEART.GENERAL.Tabs.settings')}: ${this.action.name}`;
} }
/* Needs to consider effect altOutcomes aswell */
static getOutcomeTabs(action) {
const outcomeKeys = [
'successHope',
...Object.keys(action.damage?.altOutcomes ?? {}).filter(key => action.damage.altOutcomes[key])
];
return outcomeKeys.reduce((acc, key, index) => {
acc[key] = {
active: index === 0,
cssClass: '',
group: 'outcomes',
id: key,
icon: null,
label:
outcomeKeys.length === 1
? game.i18n.localize('DAGGERHEART.CONFIG.OutcomeType.simpleOutcome')
: game.i18n.localize(CONFIG.DH.ACTIONS.outcomeTypes[key].label)
};
return acc;
}, {});
}
/* Needs to consider effect altOutcomes aswell */
static selectOutcome(action, callback) {
const choices = Object.entries(CONFIG.DH.ACTIONS.outcomeTypes).reduce((acc, [key, value]) => {
if (key !== 'successHope' && action.damage.altOutcomes[key] === null)
acc.push({ id: key, label: game.i18n.localize(value.label) });
return acc;
}, []);
const content = new foundry.data.fields.StringField({
label: game.i18n.localize('Outcome'),
choices,
required: true
}).toFormGroup(
{},
{
name: 'outcome',
localize: true,
nameAttr: 'value',
labelAttr: 'label'
}
).outerHTML;
const callbackWrapper = (_, button) => {
const choiceIndex = button.form.elements.outcome.value;
callback(choices[choiceIndex]?.id);
};
const typeDialog = new foundry.applications.api.DialogV2({
buttons: [
foundry.utils.mergeObject(
{
action: 'ok',
label: 'Confirm',
icon: 'fas fa-check',
default: true
},
{ callback: callbackWrapper }
)
],
content: content,
rejectClose: false,
modal: false,
window: {
title: game.i18n.localize('Add Outcome')
},
position: { width: 300 }
});
typeDialog.render(true);
}
static DEFAULT_OPTIONS = { static DEFAULT_OPTIONS = {
tag: 'form', tag: 'form',
classes: ['daggerheart', 'dh-style', 'action-config', 'dialog', 'max-800'], classes: ['daggerheart', 'dh-style', 'action-config', 'dialog', 'max-800'],
@ -31,6 +106,8 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
addElement: this.addElement, addElement: this.addElement,
removeElement: this.removeElement, removeElement: this.removeElement,
removeTransformActor: this.removeTransformActor, removeTransformActor: this.removeTransformActor,
addOutcome: this.addOutcome,
removeOutcome: this.removeOutcome,
editEffect: this.editEffect, editEffect: this.editEffect,
addDamage: this.addDamage, addDamage: this.addDamage,
removeDamage: this.removeDamage, removeDamage: this.removeDamage,
@ -120,25 +197,6 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
} }
}; };
static OUTCOME_TABS = {
successHope: {
active: true,
cssClass: '',
group: 'outcomes',
id: 'successHope',
icon: null,
label: 'Success With Hope'
},
successFear: {
active: false,
cssClass: '',
group: 'outcomes',
id: 'successFear',
icon: null,
label: 'Success With Fear'
},
};
static CLEAN_ARRAYS = ['cost', 'effects', 'summon']; static CLEAN_ARRAYS = ['cost', 'effects', 'summon'];
_getTabs(tabs) { _getTabs(tabs) {
@ -188,7 +246,8 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
context.openSection = this.openSection; context.openSection = this.openSection;
context.tabs = this._getTabs(this.constructor.TABS); context.tabs = this._getTabs(this.constructor.TABS);
context.outcomeTabs = this._getTabs(this.constructor.OUTCOME_TABS); context.outcomeTabs = this._getTabs(this.outcomeTabs);
context.allOutcomesAssigned = Object.keys(this.outcomeTabs).length >= 4;
context.config = CONFIG.DH; context.config = CONFIG.DH;
if (this.action.damage) { if (this.action.damage) {
@ -338,7 +397,11 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
if (!this.action.damage.parts) return; if (!this.action.damage.parts) return;
const outcome = button.dataset.outcome; const outcome = button.dataset.outcome;
const choices = getUnusedDamageTypes(this.action._source.damage.parts); const outcomeParts =
outcome === 'successHope'
? this.action._source.damage.parts
: this.action._source.damage.altOutcomes[outcome].parts;
const choices = getUnusedDamageTypes(outcomeParts);
const content = new foundry.data.fields.StringField({ const content = new foundry.data.fields.StringField({
label: game.i18n.localize('Damage Type'), label: game.i18n.localize('Damage Type'),
choices, choices,
@ -361,8 +424,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
if (type === CONFIG.DH.GENERAL.healingTypes.hitPoints.id) if (type === CONFIG.DH.GENERAL.healingTypes.hitPoints.id)
part.type = this.action.schema.fields.damage.fields.parts.element.fields.type.element.initial; part.type = this.action.schema.fields.damage.fields.parts.element.fields.type.element.initial;
if (outcome === 'successHope') if (outcome === 'successHope') data.damage.parts[type] = part;
data.damage.parts[type] = part;
else { else {
if (!data.damage.altOutcomes[outcome]) { if (!data.damage.altOutcomes[outcome]) {
data.damage.altOutcomes[outcome] = new AltDamageOutcome(); data.damage.altOutcomes[outcome] = new AltDamageOutcome();
@ -401,9 +463,15 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
static removeDamage(_event, button) { static removeDamage(_event, button) {
if (!this.action.damage.parts) return; if (!this.action.damage.parts) return;
const data = this.action.toObject(); const data = this.action.toObject();
const key = button.dataset.key; const { key, outcome } = button.dataset;
if (outcome === 'successHope') {
delete data.damage.parts[key]; delete data.damage.parts[key];
data.damage.parts[`${key}`] = _del; data.damage.parts[`${key}`] = _del;
} else {
delete data.damage.altOutcomes[outcome].parts[key];
data.damage.altOutcomes[outcome].parts[`${key}`] = _del;
}
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) }); this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
} }
@ -494,6 +562,8 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
} }
/** Specific implementation in extending classes **/ /** Specific implementation in extending classes **/
static addOutcome(_event) {}
static removeOutcome(_event) {}
static async addEffect(_event) {} static async addEffect(_event) {}
static removeEffect(_event, _button) {} static removeEffect(_event, _button) {}
static editEffect(_event) {} static editEffect(_event) {}

View file

@ -1,3 +1,4 @@
import { AltDamageOutcome } from '../../data/fields/action/damageField.mjs';
import DHActionBaseConfig from './action-base-config.mjs'; import DHActionBaseConfig from './action-base-config.mjs';
export default class DHActionConfig extends DHActionBaseConfig { export default class DHActionConfig extends DHActionBaseConfig {
@ -5,6 +6,8 @@ export default class DHActionConfig extends DHActionBaseConfig {
...DHActionBaseConfig.DEFAULT_OPTIONS, ...DHActionBaseConfig.DEFAULT_OPTIONS,
actions: { actions: {
...DHActionBaseConfig.DEFAULT_OPTIONS.actions, ...DHActionBaseConfig.DEFAULT_OPTIONS.actions,
addOutcome: this.addOutcome,
removeOutcome: this.removeOutcome,
addEffect: this.addEffect, addEffect: this.addEffect,
removeEffect: this.removeEffect, removeEffect: this.removeEffect,
editEffect: this.editEffect editEffect: this.editEffect
@ -19,6 +22,28 @@ export default class DHActionConfig extends DHActionBaseConfig {
return context; return context;
} }
static addOutcome() {
const data = this.action.toObject();
DHActionBaseConfig.selectOutcome(this.action, key => {
if (!key) return;
data.damage.altOutcomes[key] = new AltDamageOutcome();
this.outcomeTabs = DHActionBaseConfig.getOutcomeTabs(data);
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
});
}
static removeOutcome(_event, button) {
const { outcome } = button.dataset;
const data = this.action.toObject();
data.damage.altOutcomes[outcome] = null;
this.outcomeTabs = DHActionBaseConfig.getOutcomeTabs(data);
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
}
static async addEffect(event) { static async addEffect(event) {
const { areaIndex } = event.target.dataset; const { areaIndex } = event.target.dataset;
if (!this.action.effects) return; if (!this.action.effects) return;

View file

@ -122,3 +122,22 @@ export const areaTypes = {
label: 'Placed Area' label: 'Placed Area'
} }
}; };
export const outcomeTypes = {
successHope: {
key: 'successHope',
label: 'DAGGERHEART.CONFIG.OutcomeType.successHope'
},
successFear: {
key: 'successFear',
label: 'DAGGERHEART.CONFIG.OutcomeType.successFear'
},
failureHope: {
key: 'failureHope',
label: 'DAGGERHEART.CONFIG.OutcomeType.failureHope'
},
failureFear: {
key: 'failureFear',
label: 'DAGGERHEART.CONFIG.OutcomeType.failureFear'
}
};

View file

@ -10,7 +10,7 @@ const getDamageBaseFields = () => ({
initial: false, initial: false,
label: 'DAGGERHEART.ACTIONS.Settings.includeBase.label' label: 'DAGGERHEART.ACTIONS.Settings.includeBase.label'
}), }),
direct: new fields.BooleanField({ initial: false, label: 'DAGGERHEART.CONFIG.DamageType.direct.name' }), direct: new fields.BooleanField({ initial: false, label: 'DAGGERHEART.CONFIG.DamageType.direct.name' })
}); });
export default class DamageField extends fields.SchemaField { export default class DamageField extends fields.SchemaField {
@ -26,8 +26,7 @@ export default class DamageField extends fields.SchemaField {
altOutcomes: new fields.SchemaField({ altOutcomes: new fields.SchemaField({
successFear: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null }), successFear: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null }),
failureHope: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null }), failureHope: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null }),
failureFear: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null }), failureFear: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null })
critical: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null })
}), }),
groupAttack: new fields.StringField({ groupAttack: new fields.StringField({
choices: CONFIG.DH.GENERAL.groupAttackRange, choices: CONFIG.DH.GENERAL.groupAttackRange,
@ -347,14 +346,14 @@ export class AltDamageOutcome extends foundry.abstract.DataModel {
static defineSchema() { static defineSchema() {
return { return {
useStandardHitPointDamage: new fields.BooleanField({ required: true, initial: true }), useStandardHitPointDamage: new fields.BooleanField({ required: true, initial: true }),
...getDamageBaseFields(), ...getDamageBaseFields()
} };
} }
get data() { get data() {
return { return {
...this.parent, ...this.parent,
...this, ...this
} };
} }
} }

View file

@ -10,13 +10,13 @@
</legend> </legend>
<div class="nest-inputs"> <div class="nest-inputs">
{{#if @root.hasBaseDamage}} {{#if @root.hasBaseDamage}}
{{formField @root.fields.damage.fields.includeBase value=@root.source.damage.includeBase name="damage.includeBase" classes="checkbox" localize=true }} {{formField @root.fields.damage.fields.includeBase value=@root.source.damage.includeBase name=(concat basePath ".includeBase") classes="checkbox" localize=true }}
{{/if}} {{/if}}
{{#unless (eq @root.source.type 'healing')}} {{#unless (eq @root.source.type 'healing')}}
{{formField baseFields.direct value=source.direct name=(concat path "damage.direct") localize=true classes="checkbox"}} {{formField baseFields.direct value=source.direct name=(concat path basePath ".direct") localize=true classes="checkbox"}}
{{/unless}} {{/unless}}
{{#if (and @root.isNPC (not (eq path 'system.attack.')))}} {{#if (and @root.isNPC (not (eq path 'system.attack.')))}}
{{formField baseFields.groupAttack value=source.groupAttack name=(concat path "damage.groupAttack") localize=true classes="select"}} {{formField baseFields.groupAttack value=source.groupAttack name=(concat path basePath ".groupAttack") localize=true classes="select"}}
{{/if}} {{/if}}
</div> </div>
@ -27,44 +27,44 @@
<legend class="with-icon"> <legend class="with-icon">
{{localize (concat "DAGGERHEART.CONFIG.HealingType." dmg.applyTo ".name")}} {{localize (concat "DAGGERHEART.CONFIG.HealingType." dmg.applyTo ".name")}}
{{#unless (or dmg.base ../path)}} {{#unless (or dmg.base ../path)}}
<a data-action="removeDamage" data-key="{{dmg.applyTo}}"><i class="fas fa-trash"></i></a> <a data-action="removeDamage" data-key="{{dmg.applyTo}}" data-outcome="{{../outcome}}"><i class="fas fa-trash"></i></a>
{{/unless}} {{/unless}}
</legend> </legend>
{{#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 ../basePath ".parts." dmg.applyTo ".resultBased") localize=true classes="checkbox"}}
{{/if}} {{/if}}
{{#if (and (not @root.isNPC) @root.hasRoll (not dmg.base) dmg.resultBased)}} {{#if (and (not @root.isNPC) @root.hasRoll (not dmg.base) dmg.resultBased)}}
<div class="nest-inputs"> <div class="nest-inputs">
<fieldset class="one-column"> <fieldset class="one-column">
<legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.hope")}}</legend> <legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.hope")}}</legend>
{{> formula fields=../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" key=dmg.applyTo path=../path}} {{> formula fields=../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" key=dmg.applyTo path=../path outcomePath=../outcomePath}}
</fieldset> </fieldset>
<fieldset class="one-column"> <fieldset class="one-column">
<legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}</legend> <legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}</legend>
{{> formula fields=../fields.valueAlt.fields type=../fields.type dmg=dmg source=dmg.valueAlt target="valueAlt" key=dmg.applyTo path=../path}} {{> formula fields=../fields.valueAlt.fields type=../fields.type dmg=dmg source=dmg.valueAlt target="valueAlt" key=dmg.applyTo path=../path outcomePath=../outcomePath}}
</fieldset> </fieldset>
</div> </div>
{{else}} {{else}}
{{> formula fields=../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" key=dmg.applyTo path=../path}} {{> formula fields=../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" key=dmg.applyTo path=../path outcomePath=../outcomePath}}
{{/if}} {{/if}}
{{#if (and (eq dmg.applyTo 'hitPoints') (ne @root.source.type 'healing'))}} {{#if (and (eq dmg.applyTo 'hitPoints') (ne @root.source.type 'healing'))}}
{{formField ../fields.type value=dmg.type name=(concat ../path "damage.parts." dmg.applyTo ".type") localize=true}} {{formField ../fields.type value=dmg.type name=(concat ../path ../basePath ".parts." dmg.applyTo ".type") localize=true}}
{{/if}} {{/if}}
{{#if ../horde}} {{#if ../horde}}
<fieldset class="one-column"> <fieldset class="one-column">
<legend>{{localize "DAGGERHEART.ACTORS.Adversary.hordeDamage"}}</legend> <legend>{{localize "DAGGERHEART.ACTORS.Adversary.hordeDamage"}}</legend>
<div class="nest-inputs"> <div class="nest-inputs">
<input type="hidden" name="{{../path}}damage.parts.{{dmg.applyTo}}.valueAlt.multiplier" value="flat"> <input type="hidden" name="{{../path}}{{../basePath}}.parts.{{dmg.applyTo}}.valueAlt.multiplier" value="flat">
{{formField ../fields.valueAlt.fields.flatMultiplier value=dmg.valueAlt.flatMultiplier name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.flatMultiplier") label="DAGGERHEART.ACTIONS.Settings.multiplier" classes="inline-child" localize=true }} {{formField ../fields.valueAlt.fields.flatMultiplier value=dmg.valueAlt.flatMultiplier name=(concat ../path ../basePath ".parts." dmg.applyTo ".valueAlt.flatMultiplier") label="DAGGERHEART.ACTIONS.Settings.multiplier" classes="inline-child" localize=true }}
{{formField ../fields.valueAlt.fields.dice value=dmg.valueAlt.dice name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.dice") classes="inline-child" localize=true}} {{formField ../fields.valueAlt.fields.dice value=dmg.valueAlt.dice name=(concat ../path ../basePath ".parts." dmg.applyTo ".valueAlt.dice") classes="inline-child" localize=true}}
{{formField ../fields.valueAlt.fields.bonus value=dmg.valueAlt.bonus name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.bonus") localize=true classes="inline-child"}} {{formField ../fields.valueAlt.fields.bonus value=dmg.valueAlt.bonus name=(concat ../path ../basePath ".parts." dmg.applyTo ".valueAlt.bonus") localize=true classes="inline-child"}}
</div> </div>
</fieldset> </fieldset>
{{/if}} {{/if}}
<input type="hidden" name="{{concat ../path "damage.parts." dmg.applyTo ".base"}}" value="{{dmg.base}}"> <input type="hidden" name="{{concat ../path ../basePath ".parts." dmg.applyTo ".base"}}" value="{{dmg.base}}">
</fieldset> </fieldset>
</div> </div>
{{/each}} {{/each}}
@ -72,21 +72,21 @@
{{#*inline "formula"}} {{#*inline "formula"}}
{{#unless dmg.base}} {{#unless dmg.base}}
{{formField fields.custom.fields.enabled value=source.custom.enabled name=(concat path "damage.parts." key "." target ".custom.enabled") classes="checkbox" localize=true}} {{formField fields.custom.fields.enabled value=source.custom.enabled name=(concat path outcomePath ".parts." key "." target ".custom.enabled") classes="checkbox" localize=true}}
{{/unless}} {{/unless}}
{{#if source.custom.enabled}} {{#if source.custom.enabled}}
{{formField fields.custom.fields.formula value=source.custom.formula name=(concat path "damage.parts." key "." target ".custom.formula") localize=true}} {{formField fields.custom.fields.formula value=source.custom.formula name=(concat path outcomePath ".parts." key "." target ".custom.formula") localize=true}}
{{else}} {{else}}
<div class="nest-inputs"> <div class="nest-inputs">
{{#unless @root.isNPC}} {{#unless @root.isNPC}}
{{formField fields.multiplier value=source.multiplier name=(concat path "damage.parts." key "." target ".multiplier") localize=true}} {{formField fields.multiplier value=source.multiplier name=(concat path outcomePath ".parts." key "." target ".multiplier") localize=true}}
{{/unless}} {{/unless}}
{{#if (eq source.multiplier 'flat')}}{{formField fields.flatMultiplier value=source.flatMultiplier name=(concat path "damage.parts." key "." target ".flatMultiplier") localize=true }}{{/if}} {{#if (eq source.multiplier 'flat')}}{{formField fields.flatMultiplier value=source.flatMultiplier name=(concat path outcomePath ".parts." key "." target ".flatMultiplier") localize=true }}{{/if}}
{{formField fields.dice value=source.dice name=(concat path "damage.parts." key "." target ".dice") localize=true}} {{formField fields.dice value=source.dice name=(concat path outcomePath ".parts." key "." target ".dice") localize=true}}
{{formField fields.bonus value=source.bonus name=(concat path "damage.parts." key "." target ".bonus") localize=true}} {{formField fields.bonus value=source.bonus name=(concat path outcomePath ".parts." key "." target ".bonus") localize=true}}
</div> </div>
{{/if}} {{/if}}
{{#if @root.isNPC}} {{#if @root.isNPC}}
<input type="hidden" name="{{path}}damage.parts.{{key}}.{{target}}.multiplier" value="flat"> <input type="hidden" name="{{concat path outcomePath ".parts.{{key}}.{{target}}.multiplier"}}" value="flat">
{{/if}} {{/if}}
{{/inline}} {{/inline}}

View file

@ -9,8 +9,10 @@
<a class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}'> <a class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}'>
{{localize tab.label}} {{localize tab.label}}
</a> </a>
{{#unless (eq tab.id 'successHope')}}<a data-outcome="{{tab.id}}" data-action="removeOutcome"><i class="fa-solid fa-trash"></i></a>{{/unless}}
</div> </div>
{{/each}} {{/each}}
<a data-action="addOutcome" {{#if allOutcomesAssigned}}disabled{{/if}}><i class="fa-solid fa-plus"></i></a>
</nav> </nav>
{{#each outcomeTabs as |tab|}} {{#each outcomeTabs as |tab|}}
@ -20,10 +22,10 @@
data-tab="{{tab.id}}" data-tab="{{tab.id}}"
> >
{{#if (eq tab.id 'successHope')}} {{#if (eq tab.id 'successHope')}}
{{#if ../fields.damage}}{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=../fields.damage.fields.parts.element.fields source=../source.damage baseFields=../fields.damage.fields outcome=tab.id }}{{/if}} {{#if ../fields.damage}}{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=../fields.damage.fields.parts.element.fields source=../source.damage baseFields=../fields.damage.fields outcome=tab.id outcomePath="damage" }}{{/if}}
{{else}} {{else}}
{{#with (lookup ../fields.damage.fields.altOutcomes.fields tab.id) as |field|}} {{#with (lookup ../fields.damage.fields.altOutcomes.fields tab.id) as |field|}}
{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=field.fields.parts.element.fields source=(lookup ../../source.damage.altOutcomes ../id) baseFields=field.fields outcome=../id }} {{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=field.fields.parts.element.fields source=(lookup ../../source.damage.altOutcomes ../id) baseFields=field.fields outcome=../id outcomePath=(concat "damage.altOutcomes." tab.id) }}
{{/with }} {{/with }}
{{/if}} {{/if}}
</section> </section>