Modifier la loc pour les créatures

This commit is contained in:
sladecraven 2021-02-08 16:14:43 +01:00
parent 54a937c620
commit 375d452e7e
2 changed files with 16 additions and 11 deletions

View File

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

View File

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