summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/rules.js b/rules.js
index 85496a0..01bd29e 100644
--- a/rules.js
+++ b/rules.js
@@ -6696,11 +6696,10 @@ function start_battle() {
log_h2(`Battle at %${here}`)
- // TODO: array <= 3 attacking lords automatically
-
init_battle(here, 0, 0)
- for (let lord = first_lord; lord <= last_lord; ++lord) {
+ // All attacking lords to reserve
+ for (let lord = first_friendly_lord; lord <= last_friendly_lord; ++lord) {
if (get_lord_locale(lord) === here && !is_lord_besieged(lord)) {
set_lord_moved(lord, 1)
if (lord !== game.command)
@@ -6708,6 +6707,20 @@ function start_battle() {
}
}
+ // Array attacking lords if fewer than 3.
+ if (game.battle.reserves.length === 2)
+ game.battle.array[A3] = game.battle.reserves.pop()
+ if (game.battle.reserves.length === 1)
+ game.battle.array[A1] = game.battle.reserves.pop()
+
+ // All defending lords to reserve
+ for (let lord = first_enemy_lord; lord <= last_enemy_lord; ++lord) {
+ if (get_lord_locale(lord) === here && !is_lord_besieged(lord)) {
+ set_lord_moved(lord, 1)
+ set_add(game.battle.reserves, lord)
+ }
+ }
+
goto_relief_sally()
}