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 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";

View File

@ -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;
}