diff --git a/CHANGELOG.md b/CHANGELOG.md index 60f58e9..b24a41c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # Changelog ## 1.5.0 - FoundryVTT v9 Compatibility -- Updated the System to FoundryVTT v9 +- Updated the System to FoundryVTT v9. +- Fixed armies in combat tracker. ## 1.4.0 - Armies & French PoW - Added Army (Actor), Cohort (Item) and Fortification (Item) sheets. diff --git a/system/scripts/combat.js b/system/scripts/combat.js index 47aeeb8..452e193 100644 --- a/system/scripts/combat.js +++ b/system/scripts/combat.js @@ -41,10 +41,14 @@ export class CombatL5r5e extends Combat { // Skip non character types (army) if (!["character", "npc"].includes(combatant.actor.data.type)) { + updatedCombatants.push({ + _id: combatant.id, + initiative: 0, + }); continue; } - // Skip if combatant already have a initiative value + // Skip if combatant already have an initiative value if (!messageOptions.rerollInitiative && (!combatant || !combatant.actor)) { return; } @@ -103,7 +107,7 @@ export class CombatL5r5e extends Combat { roll.l5r5e.voidPointUsed = !!messageOptions.useVoidPoint; roll.l5r5e.skillAssistance = messageOptions.skillAssistance || 0; - roll.roll(); + await roll.roll(); rnkMessage = await roll.toMessage({ flavor }); } @@ -140,6 +144,11 @@ export class CombatL5r5e extends Combat { _sortCombatants(a, b) { // if tie, sort by honor, less honorable first if (a.initiative === b.initiative) { + // skip if armies + if (a.actor.data.type === "army" || b.actor.data.type === "army") { + return 0; + } + // if tie, Character > Adversary > Minion if (a.actor.data.data.social.honor === b.actor.data.data.social.honor) { return ( diff --git a/system/scripts/dice/roll.js b/system/scripts/dice/roll.js index a37993a..5aa75e3 100644 --- a/system/scripts/dice/roll.js +++ b/system/scripts/dice/roll.js @@ -248,7 +248,7 @@ export class RollL5r5e extends Roll { // Execute the roll, if needed if (!this._evaluated) { - this.roll(); + await this.roll(); } // Define chat data