Fix AP Abzug bei Zauber

und ein bisschen linter
This commit is contained in:
Byroks 2024-05-06 14:12:17 +02:00
parent 6978a4df86
commit 83014281a5
2 changed files with 18 additions and 19 deletions

View File

@ -341,20 +341,20 @@ export class M5Item extends Item {
} }
}); });
if (item.type === "spell" || item.type === "kampfkunst") { const roll = new M5Roll(rollData, this.actor, item.name, item.id);
if (this.actor["system"].ap.value >= item.system.ap) { if (await roll.toMessage(toggleAutomatedRoll)) {
this.actor["update"]({ if (item.type === "spell" || item.type === "kampfkunst") {
data: { if (this.actor["system"].ap.value >= item.system.ap) {
ap: { this.actor["update"]({
value: this.actor["system"].ap.value - item.system.ap, 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 { } else {
ChatMessage.create({ ChatMessage.create({
speaker: speaker, speaker: speaker,

View File

@ -148,13 +148,13 @@ export class M5Roll {
const rMode = (game as Game).settings.get("core", "rollMode"); const rMode = (game as Game).settings.get("core", "rollMode");
if (!automatedRoll) { if (!automatedRoll) {
let checkOptions = await this.popUp({ isPW: this.data.rolls[0].label === (game as Game).i18n.localize("midgard5.pw") }); let checkOptions = await this.popUp({ isPW: this.data.rolls[0].label === (game as Game).i18n.localize("midgard5.pw") });
if (checkOptions["cancelled"]) { if (checkOptions["cancelled"]) {
return; return;
} else { } else {
const rMode = checkOptions["rollMode"]; const rMode = checkOptions["rollMode"];
this.data.b = checkOptions; this.data.b = checkOptions;
} }
} else { } else {
this.data.b = { difficulty: 20, modifier: 0 }; this.data.b = { difficulty: 20, modifier: 0 };
} }
@ -162,7 +162,6 @@ export class M5Roll {
if (!this._evaluated) await this.evaluate(); if (!this._evaluated) await this.evaluate();
const faces = this.pool.dice.map((x) => x.faces); const faces = this.pool.dice.map((x) => x.faces);
const chatData = { const chatData = {
type: CONST.CHAT_MESSAGE_TYPES.ROLL, type: CONST.CHAT_MESSAGE_TYPES.ROLL,
content: await this.render(), content: await this.render(),