diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-08-02 15:41:58 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-08-05 20:46:48 +0200 |
commit | d45d2e652ff802d7fd804a040be817ac1cbce8b6 (patch) | |
tree | ac3b5b32fd44876100e4d32e33c3c73380edde37 /rules.js | |
parent | 98e5efb21035813fe649037b255954fb1790d854 (diff) | |
download | time-of-crisis-d45d2e652ff802d7fd804a040be817ac1cbce8b6.tar.gz |
v2: port
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -608,6 +608,9 @@ function has_militia_force_marched(province) { return game.mbattled & (4096 << p function set_militia_force_marched(province) { game.mbattled |= (4096 << province) } function clear_militia_force_marched(province) { game.mbattled &= ~(4096 << province) } +function has_used_port(province) { return game.uport & (1 << province) } +function set_used_port(province) { game.uport |= (1 << province) } + // === COMPOUND STATE === function get_selected_region() { @@ -1345,6 +1348,10 @@ function goto_start_turn() { game.placed = 0 game.combat_legacy = 0 + if (is_deluxe()) { + game.uport = 0 + } + goto_upkeep() } @@ -3059,6 +3066,18 @@ function create_army(where, capital) { // ACTION: MOVE ARMY +function gen_sail_army(from) { + if (is_own_province(from) && has_port(from) && !has_used_port(from)) { + for (let to = 0; to < 12; ++to) { + if (to !== from) { + gen_action_region(to) + if (can_enter_capital(to)) + gen_action_capital(to) + } + } + } +} + function gen_move_army() { let from = get_general_location(game.selected_general) if (game.mip >= 1) { @@ -3070,6 +3089,8 @@ function gen_move_army() { } else if (game.mip >= 2) gen_action_region(to) } + if (is_deluxe()) + gen_sail_army(from) } } @@ -3101,7 +3122,12 @@ states.move_army_at_sea = { function move_army_to(who, to, to_capital) { let from = get_general_location(who) - log("Move Army from %" + from + " to %" + to + ".") + if (!is_adjacent(from, to)) { + log("Sail Army from %" + from + " to %" + to + ".") + set_used_port(from) + } else { + log("Move Army from %" + from + " to %" + to + ".") + } remove_general_castra(who) @@ -3785,6 +3811,8 @@ states.force_march = { gen_action_capital(to) } } + if (is_deluxe()) + gen_sail_army(where) } // Free Action: Enter/Leave Capital |