From febe6f5a96f1d9c05a4d7f4eef75bf6240425ec0 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 10 Apr 2024 11:47:00 +0200 Subject: Skip combat round when relief arrive after main defenders sailed away. --- rules.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 7b5d704..0b68ade 100644 --- a/rules.js +++ b/rules.js @@ -2442,6 +2442,19 @@ function goto_combat_round(new_combat_round) { let was_contested = is_contested_battle_field() + // If a relief force attacks besieging forces outside a castle, + // but the besieged forces sail away and abandon the castle, + // skip the first combat round to let the battle proceed from + // when the reserves arrive. + if (game.combat_round === 1 && !is_under_siege(game.where)) { + if (!was_contested && is_contested_town(game.where)) { + if (count_friendly_in_field_excluding_reserves(game.where) === 0) { + log("Combat round skipped because main attack sailed away.") + game.combat_round = 2 + } + } + } + // If the main attack regroups away from a new siege while reinforcements // are on the way, we need to skip the first combat round. if (game.combat_round === 1 && is_under_siege(game.where)) { -- cgit v1.2.3