From 5f49956026a55bd736db909b9c1d2c432896e28f Mon Sep 17 00:00:00 2001 From: Vlyan Date: Tue, 28 Dec 2021 15:04:12 +0100 Subject: [PATCH 1/2] fixed some missing await on roll() fixed army in combat tracker --- system/scripts/combat.js | 13 +++++++++++-- system/scripts/dice/roll.js | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) 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 From bd5393fb0a0e2f8404efca70361e31af303594c9 Mon Sep 17 00:00:00 2001 From: Vlyan Date: Tue, 4 Jan 2022 12:23:52 +0100 Subject: [PATCH 2/2] forgot to update the readme oops :d --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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.