Minor fixes

This commit is contained in:
sladecraven 2020-12-01 00:06:55 +01:00
parent fad02f45e1
commit 6e74a19725

View File

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