|
|
|
@ -165,6 +165,17 @@ export class Hero6Combat extends Combat {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
nextTurn() {
|
|
|
|
|
let nbC = this.combatants.filter(c => c.initiative > 0).length
|
|
|
|
|
//console.log("Next turn called....", this.turn, nbC)
|
|
|
|
|
if (this.turn < nbC-1) {
|
|
|
|
|
super.nextTurn()
|
|
|
|
|
} else {
|
|
|
|
|
this.nextRound()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async nextRound() {
|
|
|
|
|
let hasCombatants = false
|
|
|
|
@ -173,9 +184,8 @@ export class Hero6Combat extends Combat {
|
|
|
|
|
let turn = this.turn === null ? null : 0; // Preserve the fact that it's no-one's turn currently.
|
|
|
|
|
let turnData = this.getFlag("world", "hero6-turn-data")
|
|
|
|
|
|
|
|
|
|
console.log("Next round called....", nextRound, turnData)
|
|
|
|
|
//console.log("Next round called....", nextRound, turnData)
|
|
|
|
|
while (!hasCombatants) {
|
|
|
|
|
turn = turn; // Preserve the fact that it's no-one's turn currently.
|
|
|
|
|
if (this.settings.skipDefeated && (turn !== null)) {
|
|
|
|
|
turn = this.turns.findIndex(t => !t.isDefeated);
|
|
|
|
|
if (turn === -1) {
|
|
|
|
@ -186,7 +196,7 @@ export class Hero6Combat extends Combat {
|
|
|
|
|
advanceTime = Math.max(this.turns.length - this.turn, 0) * CONFIG.time.turnTime;
|
|
|
|
|
advanceTime += CONFIG.time.roundTime;
|
|
|
|
|
nextRound = nextRound + 1;
|
|
|
|
|
console.log("Next round called....2", nextRound, turnData)
|
|
|
|
|
//console.log("Next round called....2", nextRound, turnData)
|
|
|
|
|
turnData = this.getFlag("world", "hero6-turn-data")
|
|
|
|
|
if (!turnData) {
|
|
|
|
|
turnData = { turnNumber: 0, segmentNumber: 12 }
|
|
|
|
@ -201,11 +211,11 @@ export class Hero6Combat extends Combat {
|
|
|
|
|
await this.setFlag("world", "hero6-turn-data", turnData)
|
|
|
|
|
this.turnNumber = turnData.turnNumber;
|
|
|
|
|
this.segmentNumber = turnData.segmentNumber;
|
|
|
|
|
console.log("Next round called....3", nextRound, turnData)
|
|
|
|
|
//console.log("Next round called....3", nextRound, turnData)
|
|
|
|
|
|
|
|
|
|
// Re-compute init of actors
|
|
|
|
|
hasCombatants = await this.rebuildInitiative()
|
|
|
|
|
console.log("Going round....", nextRound, hasCombatants)
|
|
|
|
|
//console.log("Going round....", nextRound, hasCombatants)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update the document, passing data through a hook first
|
|
|
|
|