BeastformAction now respects and handles costs (#484)

This commit is contained in:
WBHarry 2025-07-31 03:25:09 +02:00 committed by GitHub
parent 23b8363dd2
commit bb9036ee7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 3 deletions

View file

@ -4,15 +4,25 @@ import DHBaseAction from './baseAction.mjs';
export default class DhBeastformAction extends DHBaseAction {
static extraSchemas = [...super.extraSchemas, 'beastform'];
async use(_event, ...args) {
async use(event, ...args) {
const beastformConfig = this.prepareBeastformConfig();
const abort = await this.handleActiveTransformations();
if (abort) return;
const calcCosts = game.system.api.fields.ActionFields.CostField.calcCosts.call(this, this.cost);
const hasCost = game.system.api.fields.ActionFields.CostField.hasCost.call(this, calcCosts);
if (!hasCost) {
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.insufficientResources'));
return;
}
const { selected, evolved, hybrid } = await BeastformDialog.configure(beastformConfig, this.item);
if (!selected) return;
const result = await super.use(event, args);
if (!result) return;
await this.transform(selected, evolved, hybrid);
}