foundryvtt-wh4-lang-fr-fr/scripts/V1D2Uo3WDKYQePU3.js

15 lines
620 B
JavaScript
Raw Normal View History

2024-05-16 17:57:51 +02:00
let damage = this.effect.sourceTest.result.damage;
let loc = "head"
let APatLoc = this.actor.system.status.armour[loc];
let metalAP = APatLoc.layers.reduce((metal, layer) => metal += (layer.metal ? 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 += ` (ignored ${metalAP} metal AP on ${game.wfrp4e.config.locations[loc]})`
this.script.scriptMessage(msg)