From a13b9f9c56745cda0e8dd6fe888dcbe309e7a0d9 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 11 Apr 2021 23:01:57 +0200 Subject: [PATCH] Fix encombrement herbes --- module/item.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/module/item.js b/module/item.js index 190483c8..38b04f82 100644 --- a/module/item.js +++ b/module/item.js @@ -3,6 +3,7 @@ import { RdDUtility } from "./rdd-utility.js"; const typesObjetsEquipement = ["objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "nourritureboisson", "monnaie"]; const typesObjetsOeuvres = ["oeuvre", "recettecuisine", "musique", "chant", "danse", "jeu"]; +const encBrin = 0.00005; /* -------------------------------------------- */ export class RdDItem extends Item { @@ -24,14 +25,24 @@ export class RdDItem extends Item { _calculsEquipement() { const tplData = Misc.templateData(this); const quantite = Misc.data(this).type == 'conteneur' ? 1 : (tplData.quantite ?? 0); - if (tplData.encombrement != undefined) { - tplData.encTotal = Math.max(tplData.encombrement, 0) * quantite; + const enc = this.getEnc(); + if (enc != undefined) { + tplData.encTotal = Math.max(enc, 0) * quantite; } if (tplData.cout != undefined) { tplData.prixTotal = Math.max(tplData.cout, 0) * quantite; } } + getEnc() { + const itemData = Misc.data(this); + switch (itemData.type) + { + case 'herbe': + return encBrin; + } + return itemData.data.encombrement + } isConsommable(options = { warnIfNot: true }) { const itemData = Misc.data(this);