diff --git a/modules/hero6-combat.js b/modules/hero6-combat.js index 48e2da4..96c9e7d 100644 --- a/modules/hero6-combat.js +++ b/modules/hero6-combat.js @@ -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 diff --git a/system.json b/system.json index d76e1e3..f3a53f2 100644 --- a/system.json +++ b/system.json @@ -91,14 +91,14 @@ "styles": [ "styles/simple.css" ], - "version": "10.0.47", + "version": "10.0.48", "compatibility": { "minimum": "10", "verified": "11" }, "title": "Hero System v6 for FoundrtVTT (Official)", "manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/raw/branch/main/system.json", - "download": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/archive/fvtt-hero-system-6-v10.0.47.zip", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/archive/fvtt-hero-system-6-v10.0.48.zip", "url": "https://www.uberwald.me/gitea/uberwald/", "background": "images/ui/hero6_welcome_page.webp", "id": "fvtt-hero-system-6"