Combat initiativ

This commit is contained in:
2025-01-18 19:26:14 +01:00
parent 4e673913a1
commit 4198bf82be
28 changed files with 102 additions and 82 deletions

View File

@ -7,6 +7,7 @@ export class LethalFantasyCombatTracker extends CombatTracker {
for (let u of data.turns) {
let c = game.combat.combatants.get(u.id);
u.progressionCount = c.system.progressionCount
u.isMonster = c.actor.type === "monster"
}
console.log("Combat Data", data);
return data;
@ -107,7 +108,19 @@ export class LethalFantasyCombat extends Combat {
let advanceTime = Math.max(this.turns.length - this.turn, 0) * CONFIG.time.turnTime;
advanceTime += CONFIG.time.roundTime;
let nextRound = this.round + 1;
let initOK = true;
for (let c of this.combatants) {
if (c.initiative === null) {
initOK = false;
break;
}
}
if (!initOK) {
ui.notifications.error("All combatants must have initiative rolled before the round can advance.");
return this;
}
for (let c of this.combatants) {
if ( nextRound >= c.initiative) {
c.update({ 'system.progressionCount': c.system.progressionCount + 1 });