Gestion écaille sur initiative

This commit is contained in:
sladecraven 2021-01-29 21:14:35 +01:00
parent 7ed05b3722
commit 449ec40f07
2 changed files with 4 additions and 2 deletions

View File

@ -70,7 +70,8 @@ const _patch_initiative = () => {
} }
let compName = (armeCombat == undefined) ? "Corps à corps" : armeCombat.data.competence; let compName = (armeCombat == undefined) ? "Corps à corps" : armeCombat.data.competence;
competence = RdDItemCompetence.findCompetence(c.actor.data.items, compName); competence = RdDItemCompetence.findCompetence(c.actor.data.items, compName);
rollFormula = "2+( ("+RdDUtility.calculInitiative(competence.data.niveau, c.actor.data.data.carac[competence.data.defaut_carac].value) + ")/100)"; let bonusEcaille = (armeCombat && armeCombat.data.magique) ? armeCombat.data.ecaille_efficacite : 0;
rollFormula = "2+( ("+RdDUtility.calculInitiative(competence.data.niveau, c.actor.data.data.carac[competence.data.defaut_carac].value, bonusEcaille) + ")/100)";
} }
} }
//console.log("Combatat", c); //console.log("Combatat", c);

View File

@ -457,8 +457,9 @@ export class RdDUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static calculInitiative(niveau, caracValue) { static calculInitiative(niveau, caracValue, bonusEcaille = 0) {
let base = niveau + Math.floor(caracValue / 2); let base = niveau + Math.floor(caracValue / 2);
base += bonusEcaille;
return "1d6" + (base >= 0 ? "+" : "") + base; return "1d6" + (base >= 0 ? "+" : "") + base;
} }