From 697e5d2bca776817d5116db727164d1ed5cc6692 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 16 Dec 2021 00:44:59 +0100 Subject: crusader: Fix bug where storming units eliminate defending force. The castle should swap hands and the storming should be canceled. --- rules.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rules.js b/rules.js index eadd88b..0e33e12 100644 --- a/rules.js +++ b/rules.js @@ -2877,6 +2877,16 @@ function resume_siege_battle() { return goto_regroup(); } + if (count_blocks_in_castle(game.where) === 0) { + log("Defending main force was eliminated."); + log(game.active + " are now the defender."); + game.attacker[game.where] = enemy(game.active); + // The new defender takes control of the empty castle + game.castle_owner = game.active; + game.storming.length = 0; + return next_combat_round(); + } + if (game.storming.length === 0) { game.halfhit = null; log("Storming repulsed."); -- cgit v1.2.3