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 encaissement = RdDUtility.selectEncaissement(jetTotal, rollData.dmg.mortalite)
let over20 = Math.max(jetTotal - 20, 0); let over20 = Math.max(jetTotal - 20, 0);
encaissement.dmg = rollData.dmg; 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.dmg.loc.label = encaissement.dmg.loc.label ?? 'Corps;'
encaissement.roll = roll; encaissement.roll = roll;
encaissement.armure = armure; encaissement.armure = armure;

View File

@ -578,10 +578,10 @@ export class RdDUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static getLocalisation() { static getLocalisation( type = 'personnage' ) {
// TODO: bouger dans une RollTable du compendium et chercher dans les RoolTable puis compendium pour permettre le changement?
let result = new Roll("1d20").roll().total; let result = new Roll("1d20").roll().total;
let txt = "" let txt = ""
if ( type == 'personnage') {
if (result <= 3) txt = "Jambe, genou, pied, jarret"; if (result <= 3) txt = "Jambe, genou, pied, jarret";
else if (result <= 7) txt = "Hanche, cuisse, fesse"; else if (result <= 7) txt = "Hanche, cuisse, fesse";
else if (result <= 9) txt = "Ventre, reins"; else if (result <= 9) txt = "Ventre, reins";
@ -590,6 +590,11 @@ export class RdDUtility {
else if (result <= 18) txt = "Epaule, bras, omoplate"; else if (result <= 18) txt = "Epaule, bras, omoplate";
else if (result == 19) txt = "Tête"; else if (result == 19) txt = "Tête";
else if (result == 20) txt = "Tête (visage)"; 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 }; return { result: result, label: txt };
} }