diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-07-02 21:10:33 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-16 19:19:39 +0100 |
commit | ed5ca25b11e4156c44f796f4f6d2f86e48897192 (patch) | |
tree | 09882ce9134a5e46e18ff35f0528ba20607a648f /rules.js | |
parent | 4d83f7151b4bbf1cfe93e39a04900a362c091737 (diff) | |
download | crusader-rex-ed5ca25b11e4156c44f796f4f6d2f86e48897192.tar.gz |
crusader: Tweak winter check.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -673,11 +673,20 @@ function can_block_use_road(from, to) { } function can_block_land_move_to(who, from, to) { - // TODO: check winter if (can_block_use_road(from, to)) { if (count_pinning(from) > 0) if (road_was_last_used_by_enemy(from, to)) return false; + + // cannot start or reinforce battles in winter + if (is_winter() && is_enemy_occupied_town(to)) { + // but can move through friendly sieges + if (!is_friendly_field(to)) + return false; + if (game.distance + 1 >= block_move(game.who)) + return false; + } + return true; } return false; @@ -1713,14 +1722,6 @@ states.group_move_to = { } for (let to of TOWNS[from].exits) { if (to != game.last_from && can_block_land_move_to(game.who, from, to)) { - // cannot start or reinforce battles in winter - if (is_winter() && is_enemy_occupied_town(to)) { - // but can move through friendly sieges - if (!is_friendly_field(to)) - continue; - if (game.distance + 1 >= block_move(game.who)) - continue; - } gen_action(view, 'town', to); } } |