Merged with v14-Dev

This commit is contained in:
WBHarry 2026-03-14 00:31:12 +01:00
commit 4332a1ba7a
613 changed files with 4618 additions and 2996 deletions

View file

@ -197,7 +197,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
async executeWorkflow(config) {
for (const [key, part] of this.workflow) {
if (Hooks.call(`${CONFIG.DH.id}.pre${key.capitalize()}Action`, this, config) === false) return;
if ((await part.execute(config)) === false) return;
if ((await part.execute(config)) === false) return false;
if (Hooks.call(`${CONFIG.DH.id}.post${key.capitalize()}Action`, this, config) === false) return;
}
}
@ -224,7 +224,9 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
}
// Execute the Action Worflow in order based of schema fields
await this.executeWorkflow(config);
const result = await this.executeWorkflow(config);
if (result === false) return;
await config.resourceUpdates.updateResources();
if (Hooks.call(`${CONFIG.DH.id}.postUseAction`, this, config) === false) return;
@ -354,11 +356,11 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
}
get hasDamage() {
return this.damage?.parts?.length && this.type !== 'healing';
return !foundry.utils.isEmpty(this.damage?.parts) && this.type !== 'healing';
}
get hasHealing() {
return this.damage?.parts?.length && this.type === 'healing';
return !foundry.utils.isEmpty(this.damage?.parts) && this.type === 'healing';
}
get hasSave() {
@ -378,6 +380,15 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
return tags;
}
static migrateData(source) {
if (source.damage?.parts && Array.isArray(source.damage.parts)) {
source.damage.parts = source.damage.parts.reduce((acc, part) => {
acc[part.applyTo] = part;
return acc;
}, {});
}
}
}
export class ResourceUpdateMap extends Map {