From 10505553517ee6742014124e79b47b9a552abade Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 21 Jan 2023 19:04:04 +0100 Subject: Array 3 or fewer attacking lords automatically. --- rules.js | 19 ++++++++++++++++--- 1 file 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() } -- cgit v1.2.3