diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-05-16 15:53:06 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 11:54:52 +0100 |
commit | cd6ce1cc3b62fecf55f621f4ec339a266c9b606e (patch) | |
tree | ac2c0a722ccd7bc2adc550747d21c42a389c1170 /rules.js | |
parent | a986a12e7cb871364249da871bb55640c171e2f6 (diff) | |
download | wilderness-war-cd6ce1cc3b62fecf55f621f4ec339a266c9b606e.tar.gz |
Fix bug with automatically evading auxiliaries.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -3938,19 +3938,20 @@ states.avoid_who = { } function attempt_avoid_battle() { + let avoiding = avoiding_piece(); + let moving = moving_piece(); let from = moving_piece_space(); - let who = avoiding_piece(); // 6.8 Exception: Auxiliary and all-Auxiliary forces automatically succeed. - if (is_wilderness_or_mountain(from) && force_has_only_auxiliary_units(who)) { - log("Auxiliaries avoided battle\n" + describe_force(who, false) + "."); + if (is_wilderness_or_mountain(from) && force_has_only_auxiliary_units(avoiding) && !force_has_auxiliary(moving)) { + log("Auxiliaries avoided battle\n" + describe_force(avoiding, false) + "."); game.state = 'avoid_to'; return; } - let die = roll_die("to avoid battle\n" + describe_force(who, false)); - if (is_leader(who)) - die = modify(die, leader_tactics(who), "leader tactics"); + let die = roll_die("to avoid battle\n" + describe_force(avoiding, false)); + if (is_leader(avoiding)) + die = modify(die, leader_tactics(avoiding), "leader tactics"); if (die >= 4) { game.state = 'avoid_to'; } else { |