subtract ap when casting spell

Changes:
 + subtract AP when casting a spell
This commit is contained in:
Byroks 2023-11-26 13:13:13 +01:00
parent 7bf0fd90b0
commit db21ca93b0
2 changed files with 7 additions and 0 deletions

View File

@ -215,6 +215,12 @@ export class M5Item extends Item {
} }
}); });
if (item.type === "spell" || item.type === "kampfkunst") {
if (this.actor["system"].ap.value >= item.system.ap) {
this.actor["system"].ap.value -= item.system.ap;
}
}
const roll = new M5Roll(rollData, this.actor, item.name); const roll = new M5Roll(rollData, this.actor, item.name);
return roll.toMessage(); return roll.toMessage();
} else { } else {

View File

@ -160,6 +160,7 @@ export default class M5CharacterSheet extends ActorSheet {
const context = this.actor as any; const context = this.actor as any;
const item = context.items.get(itemId) as M5Item; const item = context.items.get(itemId) as M5Item;
await item.roll(); await item.roll();
this.render();
}); });
html.find(".roll-brawl-button").on("click", async (event) => { html.find(".roll-brawl-button").on("click", async (event) => {