From ed5ca25b11e4156c44f796f4f6d2f86e48897192 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 2 Jul 2021 21:10:33 +0200 Subject: crusader: Tweak winter check. --- rules.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index df581e5..c87453d 100644 --- a/rules.js +++ b/rules.js @@ -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); } } -- cgit v1.2.3