mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
BeastformAction now respects and handles costs (#484)
This commit is contained in:
parent
23b8363dd2
commit
bb9036ee7a
3 changed files with 14 additions and 3 deletions
|
|
@ -2225,7 +2225,8 @@
|
|||
"beastformToManyAdvantages": "You cannot select any more advantages.",
|
||||
"beastformToManyFeatures": "You cannot select any more features.",
|
||||
"beastformEquipWeapon": "You cannot use weapons while in a Beastform.",
|
||||
"loadoutMaxReached": "You already have {max} cards in your loadout. Move atleast one to your vault before adding a new one."
|
||||
"loadoutMaxReached": "You already have {max} cards in your loadout. Move atleast one to your vault before adding a new one.",
|
||||
"insufficientResources": "You have insufficient resources"
|
||||
},
|
||||
"Tooltip": {
|
||||
"disableEffect": "Disable Effect",
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
keyIsID: resource.keyIsID
|
||||
};
|
||||
});
|
||||
console.log(resources);
|
||||
|
||||
await this.actor.modifyResource(resources);
|
||||
if (config.uses?.enabled) this.update({ 'uses.value': this.uses.value + 1 });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue