diff --git a/source/module/items/M5Item.ts b/source/module/items/M5Item.ts index 02b4dfe..183e70d 100644 --- a/source/module/items/M5Item.ts +++ b/source/module/items/M5Item.ts @@ -341,20 +341,20 @@ export class M5Item extends Item { } }); - if (item.type === "spell" || item.type === "kampfkunst") { - if (this.actor["system"].ap.value >= item.system.ap) { - this.actor["update"]({ - data: { - ap: { - value: this.actor["system"].ap.value - item.system.ap, + const roll = new M5Roll(rollData, this.actor, item.name, item.id); + if (await roll.toMessage(toggleAutomatedRoll)) { + if (item.type === "spell" || item.type === "kampfkunst") { + if (this.actor["system"].ap.value >= item.system.ap) { + this.actor["update"]({ + data: { + ap: { + value: this.actor["system"].ap.value - item.system.ap, + }, }, - }, - }); + }); + } } } - - const roll = new M5Roll(rollData, this.actor, item.name, item.id); - return roll.toMessage(toggleAutomatedRoll); } else { ChatMessage.create({ speaker: speaker, diff --git a/source/module/rolls/M5Roll.ts b/source/module/rolls/M5Roll.ts index a473906..d47b4f4 100644 --- a/source/module/rolls/M5Roll.ts +++ b/source/module/rolls/M5Roll.ts @@ -148,13 +148,13 @@ export class M5Roll { const rMode = (game as Game).settings.get("core", "rollMode"); if (!automatedRoll) { - let checkOptions = await this.popUp({ isPW: this.data.rolls[0].label === (game as Game).i18n.localize("midgard5.pw") }); - if (checkOptions["cancelled"]) { - return; - } else { - const rMode = checkOptions["rollMode"]; - this.data.b = checkOptions; - } + let checkOptions = await this.popUp({ isPW: this.data.rolls[0].label === (game as Game).i18n.localize("midgard5.pw") }); + if (checkOptions["cancelled"]) { + return; + } else { + const rMode = checkOptions["rollMode"]; + this.data.b = checkOptions; + } } else { this.data.b = { difficulty: 20, modifier: 0 }; } @@ -162,7 +162,6 @@ export class M5Roll { if (!this._evaluated) await this.evaluate(); const faces = this.pool.dice.map((x) => x.faces); - const chatData = { type: CONST.CHAT_MESSAGE_TYPES.ROLL, content: await this.render(),