summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-31 13:09:37 +0100
committerTor Andersson <tor@ccxvii.net>2024-10-31 13:09:37 +0100
commit71314ef6b543041439c5352a751f268600b8bd5e (patch)
tree7ce2e55fb8c43f95e01897f27382ddc27ae70a1c
parentaca5c93a8bb86fd0b8e4d063b614d1e807aff564 (diff)
downloadmaria-71314ef6b543041439c5352a751f268600b8bd5e.tar.gz
misc fixes
-rw-r--r--rules.js29
1 files changed, 24 insertions, 5 deletions
diff --git a/rules.js b/rules.js
index 8b4303e..06c6446 100644
--- a/rules.js
+++ b/rules.js
@@ -3,7 +3,7 @@
/*
TODO: confirm stacking when re-entering Arenberg on Flanders map?
-TODO: stacking order (supreme) when re-entering genarals.
+TODO: stacking order (supreme) when re-entering generals.
OPTIMIZE: fewer/smarter/smaller lists, smarter power control checks
OPTIMIZE: range checks instead of set checks
@@ -2225,8 +2225,10 @@ states.movement_flanders_next = {
}
function has_moved_any_pieces() {
- if (game.power === P_AUSTRIA && !(game.flags & F_MOVE_FLANDERS))
- return has_moved_any_bohemia_pieces()
+ if (!is_two_player()) {
+ if (game.power === P_AUSTRIA && !(game.flags & F_MOVE_FLANDERS))
+ return has_moved_any_bohemia_pieces()
+ }
for (let p of all_controlled_generals(game.power))
if (set_has(game.moved, p))
return true
@@ -2522,6 +2524,13 @@ states.move_supply_train = {
},
}
+function can_force_march(who, here) {
+ for (let next of data.cities.main_roads[here])
+ if (can_move_general_to(who, here, next))
+ return true
+ return false
+}
+
states.move_general = {
inactive: "move",
prompt() {
@@ -2532,7 +2541,7 @@ states.move_general = {
let here = game.pos[who]
if (game.count === 0) {
- if (data.cities.main_roads[here].length > 0)
+ if (can_force_march(who, here))
view.actions.force_march = 1
let s_take = count_stacked_take()
@@ -5667,6 +5676,15 @@ function may_cancel_subsidy() {
return result
}
+function may_create_subsidy() {
+ if (is_two_player()) {
+ let major = coop_major_power(game.power)
+ if (major === P_PRAGMATIC || major === P_AUSTRIA)
+ return is_saxony_austrian()
+ }
+ return true
+}
+
function goto_cancel_subsidy() {
game.proposal = { save_power: game.power, save_state: game.state, from: -1, to: -1 }
game.state = "cancel_subsidy_from"
@@ -6242,7 +6260,8 @@ exports.view = function (state, player) {
if (!game.proposal && !is_intro()) {
if (may_cancel_subsidy())
view.actions.cancel_subsidy = 1
- view.actions.propose_subsidy = 1
+ if (may_create_subsidy())
+ view.actions.propose_subsidy = 1
}
}