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] );
|
const c = this.getCombatant( ids[cId] );
|
||||||
//if (!c) return results;
|
//if (!c) return results;
|
||||||
|
|
||||||
let armeCombat;
|
let armeCombat, rollFormula, competence;
|
||||||
for (const item of c.actor.data.items) {
|
if ( c.actor.data.type == 'creature' || c.actor.data.type == 'entite') {
|
||||||
if (item.type == "arme" && item.data.equipe) {
|
for (const competenceItem of c.actor.data.items) {
|
||||||
armeCombat = duplicate(item);
|
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);
|
//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);
|
const roll = this._getInitiativeRoll(c, rollFormula);
|
||||||
//console.log("Compute init for", armeCombat, competence, rollFormula, roll.total);
|
//console.log("Compute init for", armeCombat, competence, rollFormula, roll.total);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user