From c6c098b6353f335b135a4c1da4d8b48d3b75cfa1 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 7 May 2021 02:06:23 +0200 Subject: [PATCH] =?UTF-8?q?Boire=20un=20verre=20ne=20rend=20plus=20sonn?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/module/actor.js b/module/actor.js index c3503f82..3e037ff2 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1474,7 +1474,7 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ - async santeIncDec(name, inc, isCritique = false) { + async santeIncDec(name, inc, options = {isCritique: false, ethylisme: false}) { const sante = duplicate(Misc.templateData(this).sante); let compteur = sante[name]; @@ -1491,7 +1491,7 @@ export class RdDActor extends Actor { //console.log("New value ", inc, minValue, result.newValue); let fatigue = 0; if (name == "endurance" && !this.isEntiteCauchemar()) { - if (result.newValue == 0 && inc < 0 && !isCritique) { // perte endurance et endurance devient 0 (sauf critique) -> -1 vie + if (result.newValue == 0 && inc < 0 && !options.isCritique) { // perte endurance et endurance devient 0 (sauf critique) -> -1 vie sante.vie.value--; } result.newValue = Math.max(0, result.newValue); @@ -1499,7 +1499,7 @@ export class RdDActor extends Actor { result.newValue = Math.min(result.newValue, this._computeEnduranceMax()) } const perte = compteur.value - result.newValue; - if (perte > 1) { + if (perte > 1 && !options.ethylisme) { // Peut-ĂȘtre sonnĂ© si 2 points d'endurance perdus d'un coup const testIsSonne = await this.testSiSonne(sante, result.newValue); result.sonne = testIsSonne.sonne; @@ -1669,7 +1669,7 @@ export class RdDActor extends Actor { let enduranceLost = new Roll("1d6").roll().total; rollDataView.enduranceLost = enduranceLost; - await this.santeIncDec("endurance", -enduranceLost, false); + await this.santeIncDec("endurance", -enduranceLost, {ethylisme:true}); // Qui a bu boira (p 164) let rollVolonte = await RdDResolutionTable.roll(actorData.data.carac.volonte.value, Math.min(ethylisme.value, 0) + actorData.data.compteurs.moral.value); rollDataView.rollVolonteIsSuccess = rollVolonte.isSuccess; @@ -2948,7 +2948,7 @@ export class RdDActor extends Actor { const perteVie = this.isEntiteCauchemar() ? { newValue: 0 } : await this.santeIncDec("vie", - encaissement.vie); - const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, (encaissement.critiques > 0)); + const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, {critiques: encaissement.critiques > 0}); this.computeEtatGeneral(); this.sheet.render(false);