summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-11-20 19:30:42 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 13:02:37 +0100
commitd0dcf88e44304d666840423afdf392b9a8818d7b (patch)
tree875bc4d282dccb25eaec848aac0277cd0040ec3a
parent198c29765d32d4c6e21dc46b37821118771817f1 (diff)
downloadnevsky-d0dcf88e44304d666840423afdf392b9a8818d7b.tar.gz
Only roll to muster lords that have free seats.
-rw-r--r--rules.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/rules.js b/rules.js
index f8b94fb..76517ea 100644
--- a/rules.js
+++ b/rules.js
@@ -440,6 +440,13 @@ function is_lord_at_friendly_locale(lord) {
return is_friendly_locale(loc)
}
+function has_free_seat(lord) {
+ for (let loc of data.lords[lord].seats)
+ if (is_friendly_locale(loc))
+ return true
+ return false
+}
+
function has_enemy_lord(loc) {
for (let lord = first_enemy_lord; lord <= last_enemy_lord; ++lord)
if (get_lord_locale(lord) === loc)
@@ -737,7 +744,7 @@ function setup_peipus() {
game.veche_vp = 4
game.veche_coin = 3
- set_add(game.p1_castles, LOC_KOPORYE)
+ set_add(game.p2_castles, LOC_KOPORYE)
set_add(game.conquered, LOC_IZBORSK)
set_add(game.conquered, LOC_PSKOV)
set_add(game.ravaged, LOC_VOD)
@@ -1158,8 +1165,7 @@ states.levy_muster_lord = {
continue
if (lord === LORD_ANDREY && game.who !== LORD_ALEKSANDR)
continue
- if (is_lord_ready(lord))
- // TODO: has available seat
+ if (is_lord_ready(lord) && has_free_seat(lord))
gen_action_lord(lord)
}