From 31eab4a04f4265bae910d9baea13c4644c749755 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 7 Jan 2022 23:12:30 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20erreur=20sur=20entit=C3=A9=20de=20cauchem?= =?UTF-8?q?ar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lié à l'encombrement max, une entité n'en a pas --- module/actor.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/module/actor.js b/module/actor.js index 796d0c1c..3b763ae6 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1288,6 +1288,10 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ computeMalusSurEncombrement() { + switch (this.type) { + case 'entite': case 'vehicule': + return 0; + } return Math.min(0, this.getEncombrementMax() - Math.ceil(Number(this.getEncTotal()))); } getMessageSurEncombrement(){ @@ -1295,9 +1299,14 @@ export class RdDActor extends Actor { } getEncombrementMax() { - return (this.data.type == 'vehicule') - ? Misc.templateData(this).capacite_encombrement - : Misc.templateData(this).attributs.encombrement.value; + switch (this.type){ + case 'vehicule': + return Misc.templateData(this).capacite_encombrement; + case 'entite': + return 0; + default: + return Misc.templateData(this).attributs.encombrement.value; + } } /* -------------------------------------------- */