summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2025-02-11 19:04:34 +0100
committerTor Andersson <tor@ccxvii.net>2025-02-11 19:16:34 +0100
commit715e718765a467674b5a47391435a3267a9891cc (patch)
tree7dd28da965e7b14af0b61b010fabc8be55b4617e
parenta67c99e98883ff4408dbf83ca19d3db7488c5752 (diff)
downloadtime-of-crisis-715e718765a467674b5a47391435a3267a9891cc.tar.gz
v4: demagogue - place mobs and gain legacy
-rw-r--r--play.js4
-rw-r--r--rules.js54
2 files changed, 28 insertions, 30 deletions
diff --git a/play.js b/play.js
index 62fa40f..8d1e9e3 100644
--- a/play.js
+++ b/play.js
@@ -1641,10 +1641,6 @@ function on_update() {
action_button("pip_to_mip", `<img class="market_button" src="images/px.svg"> \u2192 <img class="market_button" src="images/mx.svg">`)
action_button("pip_to_sip", `<img class="market_button" src="images/px.svg"> \u2192 <img class="market_button" src="images/sx.svg">`)
- action_button_with_argument("mobs", 1, "Mob x1")
- action_button_with_argument("mobs", 2, "Mob x2")
- action_button_with_argument("mobs", 3, "Mob x3")
-
action_button("automatic", "Automatic")
action_button("spend_military", "Spend Military")
action_button("spend_senate", "Spend Senate")
diff --git a/rules.js b/rules.js
index 756d217..2b2de8c 100644
--- a/rules.js
+++ b/rules.js
@@ -1370,7 +1370,6 @@ function goto_start_turn() {
game.combat_legacy = 0
if (is_deluxe()) {
- game.demagogue = 0
game.umarket = 0
game.uport = 0
}
@@ -2632,11 +2631,7 @@ function remove_governor(where, verbose) {
remove_quaestor(where)
remove_emperor_token(where)
- // TODO: demagogue v3 + occupy breakaway -- leave mobs
- if (is_deluxe() && (game.demagogue & (1 << where)))
- log(get_mobs(where) + " mobs remain.")
- else
- set_mobs(where, 0)
+ set_mobs(where, 0)
trigger_monument(where)
@@ -2743,11 +2738,6 @@ function calc_extra_votes() {
// Populace Emperor disadvantage votes
if (game.where === ITALIA && is_populace_emperor())
n += 2
- // Demagogue v3 votes from mob
- if (is_deluxe()) {
- if (game.demagogue & (1 << game.where))
- n += get_mobs(game.where)
- }
return n
}
@@ -4139,7 +4129,7 @@ function play_demagogue() {
if (is_classic())
game.state = "demagogue_confirm"
else
- goto_demagogue_v3()
+ goto_demagogue_v4()
}
states.demagogue_confirm = {
@@ -4306,41 +4296,53 @@ function end_demagogue() {
// === DEMAGOGUE (V3) ===
-function goto_demagogue_v3() {
- game.state = "demagogue_v3"
+function goto_demagogue_v4() {
+ game.state = "demagogue_v4"
game.count = 3
}
-states.demagogue_v3 = {
+states.demagogue_v4 = {
inactive: "Demagogue",
prompt() {
- prompt("Demagogue: Place 1-3 mobs in any province.")
+ prompt("Demagogue: Choose a province you govern.")
view.color = POPULACE
for (let where = 0; where < 12; ++where) {
- if (!is_own_province(where))
+ if (is_own_province(where))
gen_action_region(where)
}
},
region(where) {
push_undo()
- game.demagogue |= (1 << where)
+ game.demagogue = 0
game.where = where
- game.state = "demagogue_v3_mobs"
+ game.state = "demagogue_v4_mobs"
},
}
-states.demagogue_v3_mobs = {
+states.demagogue_v4_mobs = {
inactive: "Demagogue",
prompt() {
- prompt("Demagogue: Place 1-3 mobs in " + REGION_NAME[game.where] + ".")
- view.selected_region = game.where
+ prompt("Demagogue: Place mobs in any number of adjacent provinces you do not govern.")
view.color = POPULACE
- view.actions.mobs = [ 1, 2, 3 ]
+ for (let to of PRETENDER_ADJACENT[game.where])
+ if (!is_own_province(to) && !(game.demagogue & (1 << to)))
+ gen_action_region(to)
+ view.actions.done = 1
},
- mobs(n) {
+ region(where) {
push_undo()
- set_mobs(game.where, get_mobs(game.where) + n)
- log("Demagogue " + n + " mobs in %" + game.where + ".")
+ set_mobs(where, get_mobs(where) + 1)
+ log("Placed mob in %" + where + ".")
+ game.demagogue |= (1 << where)
+ },
+ done() {
+ push_undo()
+ let n = 0
+ for (let s = 0; s < 12; ++s)
+ if (game.demagogue & (1 << s))
+ ++n
+ award_legacy(game.current, "Demagogue", n)
+ delete game.demagogue
resume_take_actions()
},
}