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