This commit is contained in:
WBHarry 2026-06-02 10:31:15 +00:00 committed by GitHub
commit 6bc28bed9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 305 additions and 80 deletions

View file

@ -1281,6 +1281,13 @@
"diceValue": "Dice Value", "diceValue": "Dice Value",
"die": "Die" "die": "Die"
}, },
"OutcomeType": {
"default": "Default Outcome",
"successHope": "Success/ Hope",
"successFear": "Success/ Fear",
"failureHope": "Failure/ Hope",
"failureFear": "Failure/ Fear"
},
"Range": { "Range": {
"self": { "self": {
"name": "Self", "name": "Self",
@ -2353,7 +2360,9 @@
"triggers": "Triggers", "triggers": "Triggers",
"deathMoves": "Deathmoves", "deathMoves": "Deathmoves",
"sources": "Sources", "sources": "Sources",
"packs": "Packs" "packs": "Packs",
"range": "Range",
"outcomes": "Outcomes"
}, },
"Tiers": { "Tiers": {
"singular": "Tier", "singular": "Tier",

View file

@ -1,3 +1,4 @@
import { AltDamageOutcome } from '../../data/fields/action/damageField.mjs';
import { getUnusedDamageTypes } from '../../helpers/utils.mjs'; import { getUnusedDamageTypes } from '../../helpers/utils.mjs';
import DaggerheartSheet from '../sheets/daggerheart-sheet.mjs'; import DaggerheartSheet from '../sheets/daggerheart-sheet.mjs';
@ -9,6 +10,8 @@ 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() {
@ -25,14 +28,11 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
position: { width: 600, height: 'auto' }, position: { width: 600, height: 'auto' },
actions: { actions: {
toggleSection: this.toggleSection, toggleSection: this.toggleSection,
addEffect: this.addEffect,
removeEffect: this.removeEffect,
addElement: this.addElement, addElement: this.addElement,
removeElement: this.removeElement, removeElement: this.removeElement,
removeTransformActor: this.removeTransformActor, removeTransformActor: this.removeTransformActor,
editEffect: this.editEffect, addDamage: this.onAddDamage,
addDamage: this.addDamage, removeDamage: this.onRemoveDamage,
removeDamage: this.removeDamage,
editDoc: this.editDoc, editDoc: this.editDoc,
addTrigger: this.addTrigger, addTrigger: this.addTrigger,
removeTrigger: this.removeTrigger, removeTrigger: this.removeTrigger,
@ -62,9 +62,13 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
id: 'configuration', id: 'configuration',
template: 'systems/daggerheart/templates/sheets-settings/action-settings/configuration.hbs' template: 'systems/daggerheart/templates/sheets-settings/action-settings/configuration.hbs'
}, },
effect: { range: {
id: 'effect', id: 'range',
template: 'systems/daggerheart/templates/sheets-settings/action-settings/effect.hbs' template: 'systems/daggerheart/templates/sheets-settings/action-settings/range.hbs'
},
outcomes: {
id: 'outcomes',
template: 'systems/daggerheart/templates/sheets-settings/action-settings/outcomes.hbs'
}, },
trigger: { trigger: {
id: 'trigger', id: 'trigger',
@ -89,13 +93,21 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
icon: null, icon: null,
label: 'DAGGERHEART.GENERAL.Tabs.configuration' label: 'DAGGERHEART.GENERAL.Tabs.configuration'
}, },
effect: { range: {
active: false, active: false,
cssClass: '', cssClass: '',
group: 'primary', group: 'primary',
id: 'effect', id: 'range',
icon: null, icon: null,
label: 'DAGGERHEART.GENERAL.Tabs.effects' label: 'DAGGERHEART.GENERAL.Tabs.range'
},
outcomes: {
active: false,
cssClass: '',
group: 'primary',
id: 'outcomes',
icon: null,
label: 'DAGGERHEART.GENERAL.Tabs.outcomes'
}, },
trigger: { trigger: {
active: false, active: false,
@ -109,6 +121,75 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
static CLEAN_ARRAYS = ['cost', 'effects', 'summon']; static CLEAN_ARRAYS = ['cost', 'effects', 'summon'];
/* Needs to consider effect altOutcomes aswell */
static getOutcomeTabs(action) {
const outcomeKeys = [
'default',
...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: 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 (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);
}
_getTabs(tabs) { _getTabs(tabs) {
for (const v of Object.values(tabs)) { for (const v of Object.values(tabs)) {
v.active = this.tabGroups[v.group] ? this.tabGroups[v.group] === v.id : v.active; v.active = this.tabGroups[v.group] ? this.tabGroups[v.group] === v.id : v.active;
@ -155,6 +236,10 @@ 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.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) {
context.allDamageTypesUsed = !getUnusedDamageTypes(this.action.damage.parts).length; context.allDamageTypesUsed = !getUnusedDamageTypes(this.action.damage.parts).length;
@ -299,10 +384,13 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) }); this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
} }
static addDamage(_event) { static onAddDamage(_event, button) {
if (!this.action.damage.parts) return; if (!this.action.damage.parts) return;
const choices = getUnusedDamageTypes(this.action._source.damage.parts); const outcome = button.dataset.outcome;
const source = this.action._source;
const outcomeParts = outcome === 'default' ? source.damage.parts : 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,
@ -322,24 +410,23 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
const type = choices[button.form.elements.type.value].value; const type = choices[button.form.elements.type.value].value;
const part = this.action.schema.fields.damage.fields.parts.element.getInitialValue(); const part = this.action.schema.fields.damage.fields.parts.element.getInitialValue();
part.applyTo = type; part.applyTo = type;
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;
}
data.damage.parts[type] = part; if (outcome !== 'default') data.damage.altOutcomes[outcome] ??= new AltDamageOutcome();
(outcome === 'default' ? data.damage : data.damage.altOutcomes[outcome]).parts[type] = part;
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) }); this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
}; };
const typeDialog = new foundry.applications.api.DialogV2({ const typeDialog = new foundry.applications.api.DialogV2({
buttons: [ buttons: [
foundry.utils.mergeObject( {
{ action: 'ok',
action: 'ok', label: 'Confirm',
label: 'Confirm', icon: 'fas fa-check',
icon: 'fas fa-check', default: true,
default: true callback
}, }
{ callback: callback }
)
], ],
content: content, content: content,
rejectClose: false, rejectClose: false,
@ -353,12 +440,12 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
typeDialog.render(true); typeDialog.render(true);
} }
static removeDamage(_event, button) { static onRemoveDamage(_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;
delete data.damage.parts[key]; const parts = outcome === 'default' ? data.damage.parts : data.damage.altOutcomes[outcome].parts;
data.damage.parts[`${key}`] = _del; 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) });
} }
@ -448,11 +535,6 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) }); this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
} }
/** Specific implementation in extending classes **/
static async addEffect(_event) {}
static removeEffect(_event, _button) {}
static editEffect(_event) {}
async close(options) { async close(options) {
this.tabGroups.primary = 'base'; this.tabGroups.primary = 'base';
await super.close(options); await super.close(options);

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.onAddOutcome,
removeOutcome: this.onRemoveOutcome,
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 onAddOutcome() {
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 onRemoveOutcome(_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,26 @@ export const areaTypes = {
label: 'Placed Area' label: 'Placed Area'
} }
}; };
export const outcomeTypes = {
default: {
key: 'default',
label: 'DAGGERHEART.CONFIG.OutcomeType.default'
},
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

@ -4,6 +4,15 @@ import IterableTypedObjectField from '../iterableTypedObjectField.mjs';
const fields = foundry.data.fields; const fields = foundry.data.fields;
const getDamageBaseFields = () => ({
parts: new IterableTypedObjectField(DHDamageData),
includeBase: new fields.BooleanField({
initial: false,
label: 'DAGGERHEART.ACTIONS.Settings.includeBase.label'
}),
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 {
/** /**
* Action Workflow order * Action Workflow order
@ -13,12 +22,13 @@ export default class DamageField extends fields.SchemaField {
/** @inheritDoc */ /** @inheritDoc */
constructor(options, context = {}) { constructor(options, context = {}) {
const damageFields = { const damageFields = {
parts: new IterableTypedObjectField(DHDamageData), ...getDamageBaseFields(),
includeBase: new fields.BooleanField({ altOutcomes: new fields.SchemaField({
initial: false, successHope: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null }),
label: 'DAGGERHEART.ACTIONS.Settings.includeBase.label' successFear: 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 })
}), }),
direct: new fields.BooleanField({ initial: false, label: 'DAGGERHEART.CONFIG.DamageType.direct.name' }),
groupAttack: new fields.StringField({ groupAttack: new fields.StringField({
choices: CONFIG.DH.GENERAL.groupAttackRange, choices: CONFIG.DH.GENERAL.groupAttackRange,
blank: true, blank: true,
@ -28,6 +38,12 @@ export default class DamageField extends fields.SchemaField {
super(damageFields, options, context); super(damageFields, options, context);
} }
getDamageData(outcome) {
if (outcome === 'successHope') return this;
return this.altOutcomes[outcome].data;
}
/** /**
* Roll Damage/Healing Action Workflow part. * Roll Damage/Healing Action Workflow part.
* Must be called within Action context or similar. * Must be called within Action context or similar.
@ -323,3 +339,18 @@ export class DHDamageData extends DHResourceData {
}; };
} }
} }
export class AltDamageOutcome extends foundry.abstract.DataModel {
static defineSchema() {
return {
...getDamageBaseFields()
};
}
get data() {
return {
...this.parent,
...this
};
}
}

View file

@ -153,4 +153,23 @@
align-items: center; align-items: center;
gap: 4px; gap: 4px;
} }
.inner-tabs {
justify-content: left;
.inner-tab {
line-height: 1.5;
border: 1px solid light-dark(@beige, @beige);
border-radius: 6px;
padding: 0 4px;
background: light-dark(@beige, @dark-blue);
color: light-dark(@dark-blue, @beige);
a {
&.active {
}
}
}
}
} }

View file

@ -6,17 +6,17 @@
{{else}} {{else}}
{{localize "DAGGERHEART.GENERAL.damage"}} {{localize "DAGGERHEART.GENERAL.damage"}}
{{/if}} {{/if}}
{{#unless (eq path 'system.attack.')}}<a data-action="addDamage" {{#if @root.allDamageTypesUsed}}disabled{{/if}}><i class="fa-solid fa-plus icon-button"></i></a>{{/unless}} {{#unless (eq path 'system.attack.')}}<a data-action="addDamage" data-outcome="{{outcome}}" {{#if @root.allDamageTypesUsed}}disabled{{/if}}><i class="fa-solid fa-plus icon-button"></i></a>{{/unless}}
</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

@ -3,8 +3,8 @@
data-group="primary" data-group="primary"
data-tab="config" data-tab="config"
> >
{{#if fields.roll}}{{> 'systems/daggerheart/templates/actionTypes/roll.hbs' fields=fields.roll.fields source=source.roll}}{{/if}}
{{#if fields.save}}{{> 'systems/daggerheart/templates/actionTypes/save.hbs' fields=fields.save.fields source=source.save}}{{/if}}
{{> 'systems/daggerheart/templates/actionTypes/uses.hbs' fields=fields.uses.fields source=source.uses}} {{> 'systems/daggerheart/templates/actionTypes/uses.hbs' fields=fields.uses.fields source=source.uses}}
{{> 'systems/daggerheart/templates/actionTypes/cost.hbs' fields=fields.cost.element.fields source=source.cost costOptions=costOptions}} {{> 'systems/daggerheart/templates/actionTypes/cost.hbs' fields=fields.cost.element.fields source=source.cost costOptions=costOptions}}
{{> 'systems/daggerheart/templates/actionTypes/range-target.hbs' fields=(object range=fields.range target=fields.target.fields) source=(object target=source.target range=source.range)}}
{{> 'systems/daggerheart/templates/actionTypes/areas.hbs' fields=fields.areas.element.fields source=source.areas}}
</section> </section>

View file

@ -1,15 +0,0 @@
<section
class="tab {{this.tabs.effect.cssClass}}"
data-group="primary"
data-tab="effect"
>
{{#if fields.roll}}{{> 'systems/daggerheart/templates/actionTypes/roll.hbs' fields=fields.roll.fields source=source.roll}}{{/if}}
{{#if fields.save}}{{> 'systems/daggerheart/templates/actionTypes/save.hbs' fields=fields.save.fields source=source.save}}{{/if}}
{{#if fields.damage}}{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=fields.damage.fields.parts.element.fields source=source.damage baseFields=fields.damage.fields }}{{/if}}
{{#if fields.macro}}{{> 'systems/daggerheart/templates/actionTypes/macro.hbs' fields=fields.macro source=source.macro}}{{/if}}
{{#if fields.effects}}{{> 'systems/daggerheart/templates/actionTypes/effect.hbs' fields=fields.effects.element.fields source=source.effects}}{{/if}}
{{#if fields.beastform}}{{> 'systems/daggerheart/templates/actionTypes/beastform.hbs' fields=fields.beastform.fields source=source.beastform}}{{/if}}
{{#if fields.summon}}{{> 'systems/daggerheart/templates/actionTypes/summon.hbs' fields=fields.summon.element.fields source=source.summon}}{{/if}}
{{#if fields.countdown}}{{> 'systems/daggerheart/templates/actionTypes/countdown.hbs' fields=fields.countdown.element.fields source=source.countdown}}{{/if}}
{{#if fields.transform}}{{> 'systems/daggerheart/templates/actionTypes/transform.hbs' fields=fields.transform.fields source=source.transform}}{{/if}}
</section>

View file

@ -0,0 +1,43 @@
<section
class="tab {{this.tabs.outcomes.cssClass}}"
data-group="primary"
data-tab="outcomes"
>
<nav class='inner-tabs tabs' data-group='outcomes'>
{{#each outcomeTabs as |tab|}}
<div class="inner-tab">
<a class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}'>
{{localize tab.label}}
</a>
{{#unless (eq tab.id 'default')}}<a data-outcome="{{tab.id}}" data-action="removeOutcome"><i class="fa-solid fa-trash"></i></a>{{/unless}}
</div>
{{/each}}
<a data-action="addOutcome" {{#if allOutcomesAssigned}}disabled{{/if}}><i class="fa-solid fa-plus"></i></a>
</nav>
{{#each outcomeTabs as |tab|}}
<section
class="tab {{lookup (lookup ../outcomeTabs tab.id) 'cssClass'}}"
data-group="outcomes"
data-tab="{{tab.id}}"
>
{{#if ../fields.damage}}
{{#if (eq tab.id 'default')}}
{{> '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" isDefaultDamage="true" }}
{{else}}
{{#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 outcomePath=(concat "damage.altOutcomes." tab.id) }}
{{/with }}
{{/if}}
{{/if}}
</section>
{{/each}}
{{#if fields.macro}}{{> 'systems/daggerheart/templates/actionTypes/macro.hbs' fields=fields.macro source=source.macro}}{{/if}}
{{#if fields.effects}}{{> 'systems/daggerheart/templates/actionTypes/effect.hbs' fields=fields.effects.element.fields source=source.effects}}{{/if}}
{{#if fields.beastform}}{{> 'systems/daggerheart/templates/actionTypes/beastform.hbs' fields=fields.beastform.fields source=source.beastform}}{{/if}}
{{#if fields.summon}}{{> 'systems/daggerheart/templates/actionTypes/summon.hbs' fields=fields.summon.element.fields source=source.summon}}{{/if}}
{{#if fields.countdown}}{{> 'systems/daggerheart/templates/actionTypes/countdown.hbs' fields=fields.countdown.element.fields source=source.countdown}}{{/if}}
{{#if fields.transform}}{{> 'systems/daggerheart/templates/actionTypes/transform.hbs' fields=fields.transform.fields source=source.transform}}{{/if}}
</section>

View file

@ -0,0 +1,8 @@
<section
class="tab {{this.tabs.range.cssClass}}"
data-group="primary"
data-tab="range"
>
{{> 'systems/daggerheart/templates/actionTypes/range-target.hbs' fields=(object range=fields.range target=fields.target.fields) source=(object target=source.target range=source.range)}}
{{> 'systems/daggerheart/templates/actionTypes/areas.hbs' fields=fields.areas.element.fields source=source.areas}}
</section>