fvtt-pegasus-rpg/modules/pegasus-combat.js
2021-12-02 07:38:59 +01:00

21 lines
701 B
JavaScript

import { PegasusUtility } from "./pegasus-utility.js";
/* -------------------------------------------- */
export class PegasusCombat extends Combat {
/* -------------------------------------------- */
async rollInitiative(ids, formula = undefined, messageOptions = {} ) {
console.log("Initiative is requested !!!");
ids = typeof ids === "string" ? [ids] : ids;
const currentId = this.combatant._id;
for (let cId = 0; cId < ids.length; cId++) {
const c = this.getCombatant(ids[cId]);
let initBonus = c.actor ? c.actor.getInitiativeScore() : 0;
await this.updateEmbeddedEntity("Combatant", { _id: c._id, initiative: initBonus });
}
return this;
}
}