Skip to content

Commit

Permalink
Fix for Corruption test (#2256)
Browse files Browse the repository at this point in the history
* fix for corruption test

* remove pointless 'else'

* one space too much (yes, I am pedantic at this point)
  • Loading branch information
Forien authored Oct 7, 2024
1 parent 33c1c81 commit 2623072
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions modules/actor/actor-wfrp4e.js
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ export default class ActorWFRP4e extends WarhammerActor
}
}
catch (e) { warhammer.utility.log("Sound Context Error: " + e, true) } // Ignore sound errors
let scriptArgs = { actor, attacker, opposedTest, totalWoundLoss, AP, applyAP, applyTB, damageType, updateMsg, modifiers, ward, wardRoll, attacker, extraMessages, abort }
let scriptArgs = { actor, attacker, opposedTest, totalWoundLoss, AP, applyAP, applyTB, damageType, updateMsg, modifiers, ward, wardRoll, extraMessages, abort }
await Promise.all(actor.runScripts("takeDamage", scriptArgs))
await Promise.all(attacker.runScripts("applyDamage", scriptArgs))
await Promise.all(opposedTest.attackerTest.item?.runScripts("applyDamage", scriptArgs))
Expand Down Expand Up @@ -983,38 +983,35 @@ export default class ActorWFRP4e extends WarhammerActor


async corruptionDialog(strength) {
let test;
Dialog.wait({
const test = await Dialog.wait({
title: game.i18n.localize("DIALOG.CorruptionTitle"),
content: `<p>${game.i18n.format("DIALOG.CorruptionContent", { name: this.name })}</p>`,
buttons: {
endurance: {
label: game.i18n.localize("NAME.Endurance"),
callback: async () => {
let skill = this.itemTags["skill"].find(i => i.name == game.i18n.localize("NAME.Endurance"))
if (skill) {
test = await this.setupSkill(skill, { title: game.i18n.format("DIALOG.CorruptionTestTitle", { test: skill.name }), corruption: strength, skipTargets: true })
}
else {
test = await this.setupCharacteristic("t", { title: game.i18n.format("DIALOG.CorruptionTestTitle", { test: game.wfrp4e.config.characteristics["t"] }), corruption: strength, skipTargets : true })
}
if (skill)
return await this.setupSkill(skill, { title: game.i18n.format("DIALOG.CorruptionTestTitle", { test: skill.name }), corruption: strength, skipTargets: true })

return await this.setupCharacteristic("t", { title: game.i18n.format("DIALOG.CorruptionTestTitle", { test: game.wfrp4e.config.characteristics["t"] }), corruption: strength, skipTargets : true })
}
},
cool: {
label: game.i18n.localize("NAME.Cool"),
callback: async () => {
let skill = this.itemTags["skill"].find(i => i.name == game.i18n.localize("NAME.Cool"))
if (skill) {
test = await this.setupSkill(skill, { title: game.i18n.format("DIALOG.CorruptionTestTitle", { test: skill.name }), corruption: strength, skipTargets: true })
}
else {
test = await this.setupCharacteristic("wp", { title: game.i18n.format("DIALOG.CorruptionTestTitle", { test: game.wfrp4e.config.characteristics["wp"] }), corruption: strength, skipTargets : true })
}
if (skill)
return await this.setupSkill(skill, { title: game.i18n.format("DIALOG.CorruptionTestTitle", { test: skill.name }), corruption: strength, skipTargets: true })

return await this.setupCharacteristic("wp", { title: game.i18n.format("DIALOG.CorruptionTestTitle", { test: game.wfrp4e.config.characteristics["wp"] }), corruption: strength, skipTargets : true })
}
}

}
}).render(true)
});

await test.roll();

return test;
}

Expand Down

0 comments on commit 2623072

Please sign in to comment.