Fix initiative pour les creatures/entites
This commit is contained in:
parent
970cbc0f7b
commit
78b4eef453
@ -44,18 +44,26 @@ const _patch_initiative = () => {
|
||||
const c = this.getCombatant( ids[cId] );
|
||||
//if (!c) return results;
|
||||
|
||||
let armeCombat;
|
||||
for (const item of c.actor.data.items) {
|
||||
if (item.type == "arme" && item.data.equipe) {
|
||||
armeCombat = duplicate(item);
|
||||
let armeCombat, rollFormula, competence;
|
||||
if ( c.actor.data.type == 'creature' || c.actor.data.type == 'entite') {
|
||||
for (const competenceItem of c.actor.data.items) {
|
||||
if ( competenceItem.data.iscombat) {
|
||||
competence = duplicate(competenceItem);
|
||||
}
|
||||
}
|
||||
rollFormula = "1d6+" + competence.data.niveau + "+" + Math.ceil(competence.data.carac_value / 2);
|
||||
} else {
|
||||
for (const item of c.actor.data.items) {
|
||||
if (item.type == "arme" && item.data.equipe) {
|
||||
armeCombat = duplicate(item);
|
||||
}
|
||||
}
|
||||
let compName = ( armeCombat == undefined ) ? "Corps à corps" : armeCombat.data.competence;
|
||||
competence = RdDUtility.findCompetence( c.actor.data.items, compName );
|
||||
rollFormula = "1d6+" + competence.data.niveau + "+" + Math.ceil(c.actor.data.data.carac[competence.data.defaut_carac].value/2);
|
||||
}
|
||||
|
||||
//console.log("Combatat", c);
|
||||
let compName = ( armeCombat == undefined ) ? "Corps à corps" : armeCombat.data.competence;
|
||||
let competence = RdDUtility.findCompetence( c.actor.data.items, compName );
|
||||
//const cf = formula || this._getInitiativeFormula(c);
|
||||
let rollFormula = "1d6+" + competence.data.niveau + "+" + Math.ceil(c.actor.data.data.carac[competence.data.defaut_carac].value/2);
|
||||
const roll = this._getInitiativeRoll(c, rollFormula);
|
||||
//console.log("Compute init for", armeCombat, competence, rollFormula, roll.total);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user