From 375d452e7e202858f6df0cec94885f499cd4cb7c Mon Sep 17 00:00:00 2001 From: sladecraven Date: Mon, 8 Feb 2021 16:14:43 +0100 Subject: [PATCH] =?UTF-8?q?Modifier=20la=20loc=20pour=20les=20cr=C3=A9atur?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor.js | 2 +- module/rdd-utility.js | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/module/actor.js b/module/actor.js index 4b7499c4..42b9f87c 100644 --- a/module/actor.js +++ b/module/actor.js @@ -2646,7 +2646,7 @@ export class RdDActor extends Actor { let encaissement = RdDUtility.selectEncaissement(jetTotal, rollData.dmg.mortalite) let over20 = Math.max(jetTotal - 20, 0); encaissement.dmg = rollData.dmg; - encaissement.dmg.loc = rollData.dmg.loc ?? RdDUtility.getLocalisation(); + encaissement.dmg.loc = rollData.dmg.loc ?? RdDUtility.getLocalisation( this.data.type ); encaissement.dmg.loc.label = encaissement.dmg.loc.label ?? 'Corps;' encaissement.roll = roll; encaissement.armure = armure; diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 6fdc870e..086b1519 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -578,18 +578,23 @@ export class RdDUtility { } /* -------------------------------------------- */ - static getLocalisation() { - // TODO: bouger dans une RollTable du compendium et chercher dans les RoolTable puis compendium pour permettre le changement? + static getLocalisation( type = 'personnage' ) { let result = new Roll("1d20").roll().total; let txt = "" - if (result <= 3) txt = "Jambe, genou, pied, jarret"; - else if (result <= 7) txt = "Hanche, cuisse, fesse"; - else if (result <= 9) txt = "Ventre, reins"; - else if (result <= 12) txt = "Poitrine, dos"; - else if (result <= 14) txt = "Avant-bras, main, coude"; - else if (result <= 18) txt = "Epaule, bras, omoplate"; - else if (result == 19) txt = "Tête"; - else if (result == 20) txt = "Tête (visage)"; + if ( type == 'personnage') { + if (result <= 3) txt = "Jambe, genou, pied, jarret"; + else if (result <= 7) txt = "Hanche, cuisse, fesse"; + else if (result <= 9) txt = "Ventre, reins"; + else if (result <= 12) txt = "Poitrine, dos"; + else if (result <= 14) txt = "Avant-bras, main, coude"; + else if (result <= 18) txt = "Epaule, bras, omoplate"; + else if (result == 19) txt = "Tête"; + else if (result == 20) txt = "Tête (visage)"; + } else { + if (result <= 7) txt = "Jambes/Pattes"; + else if (result <= 18) txt = "Corps"; + else if (result <= 20) txt = "Tête"; + } return { result: result, label: txt }; }