summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-05-16 15:53:06 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 11:54:52 +0100
commitcd6ce1cc3b62fecf55f621f4ec339a266c9b606e (patch)
treeac2c0a722ccd7bc2adc550747d21c42a389c1170 /rules.js
parenta986a12e7cb871364249da871bb55640c171e2f6 (diff)
downloadwilderness-war-cd6ce1cc3b62fecf55f621f4ec339a266c9b606e.tar.gz
Fix bug with automatically evading auxiliaries.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/rules.js b/rules.js
index 5c7a8e9..4504f18 100644
--- a/rules.js
+++ b/rules.js
@@ -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 {