summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-06-22 14:24:23 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-16 19:19:38 +0100
commit822e4c4932ea93e031fc031618e895eef6bbbd01 (patch)
tree34e9a6d4ca1d17eb70c17a377f42facea5e08395 /rules.js
parent3320cc77f28d56c33f7af492f87b4f06012937e3 (diff)
downloadcrusader-rex-822e4c4932ea93e031fc031618e895eef6bbbd01.tar.gz
crusader: End storming when all withdraw.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index a476fe1..02f4398 100644
--- a/rules.js
+++ b/rules.js
@@ -1600,7 +1600,8 @@ states.combat_phase = {
},
town: function (where) {
remove_from_array(game.combat_list, where);
- if (game.attacker[where] == game.jihad) {
+ let attacker = game.attacker[where] || besieging_player(where);
+ if (attacker == game.jihad) {
game.active = game.attacker[where];
game.state = 'use_jihad_event';
game.where = where;
@@ -2225,6 +2226,13 @@ function resume_storm_battle() {
return next_combat_round();
}
+ if (game.storming.length == 0) {
+ console.log("STORM BATTLE WON BY DEFENDER", ENEMY[game.active]);
+ game.halfhit = null;
+ log("Storming repulsed.");
+ return next_combat_round();
+ }
+
game.state = 'storm_battle';
pump_battle_step(is_storm_attacker, is_storm_defender);
}