Files
foundryvtt-wh4-lang-fr-fr/scripts/64aJznxPMUHAuf7F.js

17 lines
772 B
JavaScript

if (this.item.flags.runeOfLuck || this.actor.type != "character") return
const currentFortune = this.actor.status.fortune.value
const runesOfLuck = this.item.effects.contents.filter(e => e.name == this.effect.name)
const runeFortune = parseInt(runesOfLuck.length)
if (args.equipped) {
this.item.flags.runeOfLuck = true
await this.actor.update({"system.status.fortune.value" : runeFortune + currentFortune})
this.script.message(`Points de Chance augmentés de ${currentFortune} à ${runeFortune + currentFortune}.`)
}
else
{
this.item.flags.runeOfLuck = true
await this.actor.update({"system.status.fortune.value" : Math.max(0, currentFortune - runeFortune)})
this.script.message(`Points de Chance réduits à ${Math.max(0, currentFortune - runeFortune)}.`)
}