This repository has been archived on 2024-05-29. You can view files and clone it, but cannot push or open issues or pull requests.
fvtt-warhero/modules/warhero-combat.js

31 lines
940 B
JavaScript
Raw Permalink Normal View History

2023-01-04 22:09:09 +01:00
import { WarheroUtility } from "./warhero-utility.js";
2023-01-04 21:24:56 +01:00
/* -------------------------------------------- */
2023-01-04 22:09:09 +01:00
export class WarheroCombat extends Combat {
2023-01-04 21:24:56 +01:00
/* -------------------------------------------- */
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;
2023-02-20 10:16:17 +01:00
let initBonus = c.actor ? await c.actor.getInitiativeScore( this.id, id ) : -1;
2023-01-04 21:24:56 +01:00
await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: initBonus } ]);
}
return this;
}
/* -------------------------------------------- */
_onUpdate(changed, options, userId) {
}
/* -------------------------------------------- */
static async checkTurnPosition() {
while (game.combat.turn > 0) {
await game.combat.previousTurn()
}
}
}