fvtt-hawkmoon-cyd/modules/hawkmoon-combat.js

26 lines
805 B
JavaScript

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 = 0; cId < ids.length; cId++) {
const c = this.combatants.get(ids[cId]);
let id = c._id || c.id;
let initValue = c.actor ? c.actor.getInitiativeScore() : 0
//console.log("Init bonus", initBonus, roll.total)
await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: initValue } ]);
}
return this;
}
/* -------------------------------------------- */
_onUpdate(changed, options, userId) {
}
}