import { HawkmoonUtility } from "./hawkmoon-utility.js"; /* -------------------------------------------- */ export class HawkmoonCombat extends Combat { /* -------------------------------------------- */ async rollInitiative(ids, formula = undefined, messageOptions = {} ) { ids = typeof ids === "string" ? [ids] : ids; for (let cId of ids) { const c = this.combatants.get(cId); console.log("Init for combattant", c, ids) let id = c._id || c.id let initValue = 0 if (c.actor) { const combat = c.actor.getCombatValues() const roll = await new Roll(`1d10 + ${combat.initTotal}`).roll() await HawkmoonUtility.showDiceSoNice(roll, game.settings.get("core", "rollMode")) initValue = roll.total await c.actor.setFlag("world", "last-initiative", initValue) } await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: initValue } ]); } return this; } /* -------------------------------------------- */ _onUpdate(changed, options, userId) { } }