Perte d'endurance max

La perte maximale est l'endurance disponible
This commit is contained in:
Vincent Vandemeulebrouck 2020-12-06 21:31:41 +01:00
parent f4bb541bb7
commit e8f69b74c7
2 changed files with 4 additions and 3 deletions

View File

@ -1631,6 +1631,7 @@ export class RdDActor extends Actor {
let degatsReel = attackerRoll.degats - armure; let degatsReel = attackerRoll.degats - armure;
let result = RdDUtility.computeBlessuresSante(degatsReel, attackerRoll.mortalite); 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("vie", result.vie);
await this.santeIncDec("endurance", result.endurance, (result.critiques > 0)); await this.santeIncDec("endurance", result.endurance, (result.critiques > 0));
result.locName = (attackerRoll.loc) ? attackerRoll.loc.label : "Corps"; result.locName = (attackerRoll.loc) ? attackerRoll.loc.label : "Corps";

View File

@ -569,9 +569,9 @@ export class RdDUtility {
/* -------------------------------------------- */ /* -------------------------------------------- */
static computeBlessuresSante( degats, mortalite="mortel" ) { static computeBlessuresSante( degats, mortalite="mortel" ) {
let encaissement = RdDUtility.selectEncaissement(degats, mortalite) let encaissement = RdDUtility.selectEncaissement(degats, mortalite)
let over20 = degats > 20 ? degats - 20 : 0 let over20 = Math.max(degats - 20, 0);
encaissement.endurance = - RdDUtility._evaluatePerte(encaissement.endurance, over20) encaissement.endurance = - RdDUtility._evaluatePerte(encaissement.endurance, over20);
encaissement.vie = - RdDUtility._evaluatePerte(encaissement.vie, over20) encaissement.vie = - RdDUtility._evaluatePerte(encaissement.vie, over20);
return encaissement; return encaissement;
} }