From 6e74a1972577380144bff54312e3d281a4922d29 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Tue, 1 Dec 2020 00:06:55 +0100 Subject: [PATCH] Minor fixes --- module/actor.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/actor.js b/module/actor.js index f0c1dcc3..a088133d 100644 --- a/module/actor.js +++ b/module/actor.js @@ -890,7 +890,7 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ - async santeIncDec(name, inc ) { + async santeIncDec(name, inc, isCritique = false ) { const sante = duplicate(this.data.data.sante); let data = sante[name]; let minValue = 0; @@ -903,7 +903,7 @@ export class RdDActor extends Actor { if ( sante.fatigue && inc < 0 ) { // Each endurance lost -> fatigue lost sante.fatigue.value = sante.fatigue.value - inc } - if ( newValue == 0 && inc < 0) { // perte endurance et endurance devient 0 -> -1 vie + if ( !isCritique && newValue == 0 && inc < 0) { // perte endurance et endurance devient 0 -> -1 vie sauf si coup critique sante.vie.value = sante.vie.value - 1; } newValue = Math.max(0, newValue); @@ -1299,8 +1299,8 @@ export class RdDActor extends Actor { let result = RdDUtility.computeBlessuresSante(degatsReel, attackerRoll.mortalite); if ( this.data.type != 'entite') // Pas de PV chez les entités - await this.santeIncDec("vie", result.vie); - await this.santeIncDec("endurance", result.endurance); + await this.santeIncDec("vie", result.vie, (result.critiques > 0) ); + await this.santeIncDec("endurance", result.endurance, (result.critiques > 0) ); result.locName = (attackerRoll.loc) ? attackerRoll.loc.label : "Corps"; this.manageBlessures(result); // Will upate the result table