diff options
-rw-r--r-- | rules.js | 87 |
1 files changed, 73 insertions, 14 deletions
@@ -4102,7 +4102,10 @@ function play_demagogue() { states.demagogue_confirm = { inactive: "Demagogue", prompt() { - prompt("Demagogue: Force all other players to reveal and return a card.") + if (is_classic()) + prompt("Demagogue: Force all other players to reveal and return a card.") + else + prompt("Demagogue: Force all other players to discard a card.") view.actions.confirm = 1 }, confirm() { @@ -4110,11 +4113,32 @@ states.demagogue_confirm = { log_h3("Demagogue.") game.demagogue = new Array(get_player_count()).fill(-1) game.count = game.current - game.state = "demagogue" - game.current = next_player() + if (is_classic()) + game.state = "demagogue" + else + game.state = "demagogue_v2" + goto_next_demagogue() }, } +function goto_next_demagogue() { + game.current = next_player() + if (game.current === game.count) { + goto_demagogue_reveal() + return + } + + if (!is_classic()) { + let limit = 5 + /* TODO: exception for Frumentarii? + if (game.frumentarii & (1 << game.current)) + limit = 3 + */ + if (current_hand().length < limit) + goto_next_demagogue() + } +} + states.demagogue = { inactive: "Demagogue", demagogue: true, @@ -4132,6 +4156,33 @@ states.demagogue = { }, } +states.demagogue_v2 = { + inactive: "Demagogue", + demagogue: true, + prompt() { + prompt("Demagogue: Choose a card to discard (of value 2 or higher if possible).") + let only_ones = true + for (let c of current_hand()) { + if (card_value(c) > 1) { + only_ones = false + gen_action_card(c) + } + } + if (only_ones) { + for (let c of current_hand()) + if (card_value(c) === 1) + gen_action_card(c) + } + }, + card(c) { + push_undo() + set_delete(current_hand(), c) + set_add(current_discard(), c) + game.demagogue[game.current] = c + game.state = "demagogue_done" + }, +} + states.demagogue_done = { inactive: "Demagogue", demagogue: true, @@ -4141,10 +4192,11 @@ states.demagogue_done = { }, done() { clear_undo() - game.state = "demagogue" - game.current = next_player() - if (game.current === game.count) - goto_demagogue_reveal() + if (is_classic()) + game.state = "demagogue" + else + game.state = "demagogue_v2" + goto_next_demagogue() }, } @@ -4153,15 +4205,22 @@ function goto_demagogue_reveal() { for (let p = 0; p < get_player_count(); ++p) { if (p !== game.current) { let c = game.demagogue[p] - log(PLAYER_NAME[p] + " revealed " + card_name(c) + ".") - // TODO: skip players who reveal a 1 but govern no provinces - if (card_value(c) === 1) - mobs = true - else - game.demagogue[p] = -1 + if (c < 0) { + log(PLAYER_NAME[p] + " unaffected.") + } else { + if (is_classic()) + log(PLAYER_NAME[p] + " revealed " + card_name(c) + ".") + else + log(PLAYER_NAME[p] + " discarded " + card_name(c) + ".") + // TODO: skip players who reveal a 1 but govern no provinces + if (card_value(c) === 1) + mobs = true + else + game.demagogue[p] = -1 + } } } - if (mobs) + if (is_classic() && mobs) game.state = "demagogue_mobs" else end_demagogue() |