From e8f69b74c771282bd674e432e29d86c68225c01a Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 6 Dec 2020 21:31:41 +0100 Subject: [PATCH] Perte d'endurance max La perte maximale est l'endurance disponible --- module/actor.js | 1 + module/rdd-utility.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/module/actor.js b/module/actor.js index 5be795d4..4ff88bf6 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1631,6 +1631,7 @@ export class RdDActor extends Actor { let degatsReel = attackerRoll.degats - armure; let result = RdDUtility.computeBlessuresSante(degatsReel, attackerRoll.mortalite); + result.endurance = Math.max(result.endurance, -Number(this.data.data.sante.endurance.value)); await this.santeIncDec("vie", result.vie); await this.santeIncDec("endurance", result.endurance, (result.critiques > 0)); result.locName = (attackerRoll.loc) ? attackerRoll.loc.label : "Corps"; diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 2273ce66..0c216f6b 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -569,9 +569,9 @@ export class RdDUtility { /* -------------------------------------------- */ static computeBlessuresSante( degats, mortalite="mortel" ) { let encaissement = RdDUtility.selectEncaissement(degats, mortalite) - let over20 = degats > 20 ? degats - 20 : 0 - encaissement.endurance = - RdDUtility._evaluatePerte(encaissement.endurance, over20) - encaissement.vie = - RdDUtility._evaluatePerte(encaissement.vie, over20) + let over20 = Math.max(degats - 20, 0); + encaissement.endurance = - RdDUtility._evaluatePerte(encaissement.endurance, over20); + encaissement.vie = - RdDUtility._evaluatePerte(encaissement.vie, over20); return encaissement; }