summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js30
1 files changed, 29 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index f8cb0b9..d179869 100644
--- a/rules.js
+++ b/rules.js
@@ -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