summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-07-09 20:58:55 +0200
committerTor Andersson <tor@ccxvii.net>2023-07-09 20:58:55 +0200
commit093a1472f49be6324d36e0af0636c6dba50a1fc0 (patch)
tree27e9da9e2802c63ef34e4ea674c92d6ff8101704
parent49226230915adaa273f85070071f7866143d7851 (diff)
downloadtime-of-crisis-093a1472f49be6324d36e0af0636c6dba50a1fc0.tar.gz
Log grow mobs and place militia.
-rw-r--r--rules.js30
1 files changed, 17 insertions, 13 deletions
diff --git a/rules.js b/rules.js
index d979e74..bfa51a9 100644
--- a/rules.js
+++ b/rules.js
@@ -2095,6 +2095,7 @@ states.take_actions = {
place_militia() {
push_undo()
let where = get_governor_location(game.selected_governor)
+ log("Place Militia in %" + where + ".")
spend_populace(2)
add_militia(where)
resume_take_actions()
@@ -5023,15 +5024,17 @@ function goto_end_of_turn() {
}
function goto_grow_mobs() {
- for (let where = 0; where < 12; ++where) {
- if ((game.count & (1 << where)) === 0) {
- if (is_own_province(where) && get_mobs(where) && !has_amphitheater(where)) {
- game.state = "grow_mobs"
- return
- }
- }
+ game.count = 0
+ for (let where = 0; where < 12; ++where)
+ if ((game.count & (1 << where)) === 0)
+ if (is_own_province(where) && get_mobs(where) && !has_amphitheater(where))
+ game.count |= (1 << where)
+ if (game.count) {
+ game.state = "grow_mobs"
+ log_br()
+ } else {
+ goto_flip_inactive_barbarians()
}
- goto_flip_inactive_barbarians()
}
states.grow_mobs = {
@@ -5040,15 +5043,16 @@ states.grow_mobs = {
prompt("End of Turn: Add a mob in each province you govern with mob and no amphitheater.")
view.color = POPULACE
for (let where = 0; where < 12; ++where)
- if ((game.count & (1 << where)) === 0)
- if (is_own_province(where) && get_mobs(where) && !has_amphitheater(where))
- gen_action_region(where)
+ if (game.count & (1 << where))
+ gen_action_region(where)
},
region(where) {
push_undo()
- game.count |= (1 << where)
+ log("Mob grows in %" + where + ".")
set_mobs(where, get_mobs(where) + 1)
- goto_grow_mobs()
+ game.count &= !(1 << where)
+ if (game.count === 0)
+ goto_flip_inactive_barbarians()
},
}