foundryvtt-wh4-lang-fr-fr/scripts/1jQq9v8fXK8zuEBU.js

20 lines
865 B
JavaScript
Raw Permalink Normal View History

2024-06-06 22:07:28 +02:00
let damage = this.effect.sourceActor.hasCondition("fatigued") ? 6 : 10;
let loc = "body"
let APatLoc = this.actor.system.status.armour[loc];
let metalAP = APatLoc.layers.reduce((metal, layer) => metal += ((layer.metal && !layer.magical) ? layer.value : 0), 0)
let APused = Math.max(0, APatLoc.value - metalAP); // remove metal AP at location;
damage -= (APused + this.actor.system.characteristics.t.bonus)
let msg = await this.actor.applyBasicDamage(damage, {suppressMsg : true, damageType : game.wfrp4e.config.DAMAGE_TYPE.IGNORE_ALL});
msg += ` (ignore ${metalAP} PA de métal sur ${game.wfrp4e.config.locations[loc]})`
this.script.scriptMessage(msg)
let test = await this.actor.setupSkill("Résistance", {fields : {difficulty : "difficult"}, appendTitle : ` - ${this.effect.name}`});
await test.roll();
if (test.failed)
this.actor.addCondition("stunned");