This repository has been archived on 2023-01-25. You can view files and clone it, but cannot push or open issues or pull requests.
fvtt-avd12/modules/avd12-combat.js

31 lines
928 B
JavaScript
Raw Permalink Normal View History

2022-10-17 15:20:18 +02:00
import { Avd12Utility } from "./avd12-utility.js";
/* -------------------------------------------- */
export class Avd12Combat 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 initBonus = c.actor ? c.actor.getInitiativeScore( this.id, id ) : -1;
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()
}
}
}