export class PrismRPGCombat extends Combat { async rollInitiative(ids, options) { console.log("%%%%%%%%% Roll Initiative", ids, options); ids = typeof ids === "string" ? [ids] : ids; let messages = []; let rollMode = game.settings.get("core", "rollMode"); let updates = []; for (let cId of ids) { const c = this.combatants.get(cId); let user = game.users.find(u => u.active && u.character && u.character.id === c.actor.id); if (user?.hasPlayerOwner) { console.log("Rolling initiative for", c.actor.name); game.socket.emit(`system.${SYSTEM.id}`, { type: "rollInitiative", actorId: c.actor.id, combatId: this.id, combatantId: c.id }); } else { user = game.users.find(u => u.active && u.isGM); c.actor.system.rollInitiative(this.id, c.id); } } return this; } }