Mourblade : add initiative

This commit is contained in:
2022-09-26 13:34:07 +02:00
parent 734945d68e
commit fcec785f00
5 changed files with 66 additions and 77 deletions

View File

@ -9,8 +9,11 @@ export class MournbladeCombat extends Combat {
for (let cId = 0; cId < ids.length; cId++) {
const c = this.combatants.get(ids[cId]);
let id = c._id || c.id;
let initBonus = c.actor ? c.actor.getInitiativeScore( this.id, id ) : -1;
await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: initBonus } ]);
let initBonus = c.actor ? c.actor.getInitiativeScore() : 0
let roll = new Roll("1d10 + "+initBonus).roll({ async: false})
await MournbladeUtility.showDiceSoNice(roll, game.settings.get("core", "rollMode"))
console.log("Init bonus", initBonus, roll.total)
await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: roll.total } ]);
}
return this;