Update Beastform action

This commit is contained in:
Dapoolp 2025-08-22 23:10:45 +02:00
parent 9d9c636dbc
commit cf55659097
15 changed files with 324 additions and 132 deletions

View file

@ -42,7 +42,7 @@ export default class DhAutomationSettings extends HandlebarsApplicationMixin(App
/** @inheritdoc */
static TABS = {
main: {
tabs: [{ id: 'general' }, { id: 'rules' }, { id: 'roll', cssClass: "with-hint" }],
tabs: [{ id: 'general' }, { id: 'rules' }, { id: 'roll' }],
initial: 'general',
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
}

View file

@ -661,31 +661,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
})
});
this.consumeResource(result?.costs);
}
// Remove when Action Refactor part #2 done
async consumeResource(costs) {
if (!costs?.length) return;
const usefulResources = {
...foundry.utils.deepClone(this.actor.system.resources),
fear: {
value: game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear),
max: game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxFear,
reversed: false
}
};
const resources = game.system.api.fields.ActionFields.CostField.getRealCosts(costs).map(c => {
const resource = usefulResources[c.key];
return {
key: c.key,
value: (c.total ?? c.value) * (resource.isReversed ? 1 : -1),
target: resource.target,
keyIsID: resource.keyIsID
};
});
await this.actor.modifyResource(resources);
game.system.api.fields.ActionFields.CostField.execute.call(this, result);
}
//TODO: redo toggleEquipItem method

View file

@ -412,6 +412,16 @@ export default function DHApplicationMixin(Base) {
];
if (usable) {
options.unshift({
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.cancelBeastform',
icon: 'fa-solid fa-ban',
condition: target => {
const doc = getDocFromElementSync(target);
return doc && doc.system?.actions?.some(a => a.type === "beastform");
},
callback: async target => game.system.api.fields.ActionFields.BeastformField.handleActiveTransformations.call(await getDocFromElement(target))
});
options.unshift({
name: 'DAGGERHEART.GENERAL.damage',
icon: 'fa-solid fa-explosion',