diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-12-16 00:44:59 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-16 19:19:39 +0100 |
commit | 697e5d2bca776817d5116db727164d1ed5cc6692 (patch) | |
tree | 8cf4d7a4c86ca82cdf47d797a337aa36619b6a65 | |
parent | 66888ec763698f5621860596876ff20c99b796dc (diff) | |
download | crusader-rex-697e5d2bca776817d5116db727164d1ed5cc6692.tar.gz |
crusader: Fix bug where storming units eliminate defending force.
The castle should swap hands and the storming should be canceled.
-rw-r--r-- | rules.js | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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."); |