fvtt-pegasus-rpg/modules/pegasus-combat.js

31 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-12-02 07:38:59 +01:00
import { PegasusUtility } from "./pegasus-utility.js";
/* -------------------------------------------- */
export class PegasusCombat extends Combat {
/* -------------------------------------------- */
async rollInitiative(ids, formula = undefined, messageOptions = {} ) {
ids = typeof ids === "string" ? [ids] : ids;
for (let cId = 0; cId < ids.length; cId++) {
2021-12-20 11:54:19 +01:00
const c = this.combatants.get(ids[cId]);
let id = c._id || c.id;
2022-01-28 10:05:54 +01:00
let initBonus = c.actor ? c.actor.getInitiativeScore( this.id, id ) : -1;
await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: initBonus } ]);
2021-12-02 07:38:59 +01:00
}
return this;
}
2022-01-28 10:05:54 +01:00
/* -------------------------------------------- */
_onUpdate(changed, options, userId) {
}
/* -------------------------------------------- */
static decInitBy10( combatantId, value) {
const combatant = game.combat.combatants.get(combatantId)
let initValue = combatant.initiative + value
game.combat.setInitiative(combatantId, initValue)
}
2021-12-02 07:38:59 +01:00
}