wfrp4e-unofficial-grimoire/main.mjs

63 lines
2.5 KiB
JavaScript
Raw Normal View History

Hooks.on("init", () => {
const config = {
magicLores: {
waaagh: "Da Big Waaagh!"
},
magicWind: {
waaagh: "Da Big Waaagh!"
},
loreEffectDescriptions: {
waaagh: "Waaagh! Gorka Morka!"
},
loreEffects: {
waaagh: {
name: "Da Big Waaagh!",
icon: "modules/wfrp4e-unofficial-grimoire/icons/spell_waaaaaagh!.jpg",
transfer: true,
flags: {
wfrp4e: {
lore: true,
applicationData: {
type: "target"
},
scriptData: [
{
trigger: "immediate",
label : "@effect.name",
script : `
if (game.settings.get("wfrp4e","useGroupAdvantage")) {
let advantage = game.settings.get("wfrp4e", "groupAdvantageValues")
let playersAdvantage = advantage["players"];
let enemiesAdvantage = advantage["enemies"];
if (playersAdvantage > 0) {
playersAdvantage -= 1;
enemiesAdvantage += 1;
ChatMessage.create({ content: "Gorka Morka takes your advantages!" });
await game.wfrp4e.utility.updateGroupAdvantage({"players" : playersAdvantage, "enemies" : enemiesAdvantage});
}
} else {
ChatMessage.create({ content: "Gorka Morka takes your advantages!" });
this.actor.update({ "system.status.advantage.value": Math.max(this.actor.status.advantage.value -1, 0) }, {skipGroupAdvantage: true});
this.effect.sourceTest.actor.update({ "system.status.advantage.value": this.effect.sourceTest.actor.status.advantage.value + 1}, {skipGroupAdvantage: true});
}
`,
options : {
immediate : {
deleteEffect : true
}
}
}
]
},
}
}
}
}
foundry.utils.mergeObject(game.wfrp4e.config, config);
});