From 03c4a354b436f134371b9b878a9c212772ee60e2 Mon Sep 17 00:00:00 2001 From: Mischa Untaga <99098079+MischaU8@users.noreply.github.com> Date: Thu, 23 Nov 2023 06:24:05 +0100 Subject: Superior Lobbying --- events.txt | 7 ++++++- rules.js | 37 +++++++++++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/events.txt b/events.txt index 56c7ffb..52fcf8e 100644 --- a/events.txt +++ b/events.txt @@ -578,7 +578,12 @@ CARD 109 - Bellwether State CARD 110 - Superior Lobbying # Roll 4 :d8. For each 6, 7 or 8 rolled, add 1 :congressional_marker to Congress or remove 1 :congressional_marker from Congress. - todo + roll_list 4 D8 + if (game.active === SUF) + add_congress (game.vm.roll.filter(x => x >= 6).length) + else + remove_congress (game.vm.roll.filter(x => x >= 6).length) + endif CARD 111 - The Winning Plan # Draw 6 cards from your Draw Deck. Play 1 card for its event immediately. Place any number of the remaining 5 cards on the top of your Draw Deck and the rest at the bottom of your Draw Deck. diff --git a/rules.js b/rules.js index 1ff165c..12d10bd 100644 --- a/rules.js +++ b/rules.js @@ -1862,8 +1862,8 @@ function vm_replace() { } function vm_add_congress() { - if (!game.nineteenth_amendment) { - game.vm.count = vm_operand(1) + game.vm.count = vm_operand(1) + if (!game.nineteenth_amendment && game.vm.count) { game.state = "vm_add_congress" } else { vm_next() @@ -1871,8 +1871,8 @@ function vm_add_congress() { } function vm_remove_congress() { - if (!game.nineteenth_amendment && game.congress > 0) { - game.vm.count = vm_operand(1) + game.vm.count = vm_operand(1) + if (!game.nineteenth_amendment && game.congress > 0 && game.vm.count) { game.state = "vm_remove_congress" } else { vm_next() @@ -1885,6 +1885,13 @@ function vm_roll() { game.state = "vm_roll" } +function vm_roll_list() { + game.vm.count = vm_operand(1) + game.vm.d = vm_operand(2) + game.vm.roll_list = true + game.state = "vm_roll" +} + function vm_move_each_player_campaigner_free() { if (has_player_active_campaigners()) { game.vm.moved = [] @@ -2450,7 +2457,10 @@ states.vm_roll = { inactive: "roll dice.", prompt() { if (game.vm.roll) { - event_prompt(`You rolled ${game.vm.roll}.`) + if (game.vm.roll_list) + event_prompt(`You rolled ${game.vm.roll.join(", ")}.`) + else + event_prompt(`You rolled ${game.vm.roll}.`) } else if (game.vm.count === 1) { event_prompt("Roll a die.") } else { @@ -2465,11 +2475,17 @@ states.vm_roll = { } }, roll() { - game.vm.roll = roll_ndx(game.vm.count, game.vm.d) + if (game.vm.roll_list) + game.vm.roll = roll_ndx_list(game.vm.count, game.vm.d) + else + game.vm.roll = roll_ndx(game.vm.count, game.vm.d) }, reroll() { decrease_player_buttons(1) - game.vm.roll = roll_ndx(game.vm.count, game.vm.d, "B", "Re-rolled") + if (game.vm.roll_list) + game.vm.roll = roll_ndx_list(game.vm.count, game.vm.d, "B", "Re-rolled") + else + game.vm.roll = roll_ndx(game.vm.count, game.vm.d, "B", "Re-rolled") }, next() { vm_next() @@ -3572,7 +3588,12 @@ CODE[109] = [ // Bellwether State ] CODE[110] = [ // Superior Lobbying - [ vm_todo ], + [ vm_roll_list, 4, D8 ], + [ vm_if, ()=>(game.active === SUF) ], + [ vm_add_congress, ()=>(game.vm.roll.filter(x => x >= 6).length) ], + [ vm_else ], + [ vm_remove_congress, ()=>(game.vm.roll.filter(x => x >= 6).length) ], + [ vm_endif ], [ vm_return ], ] -- cgit v1.2.3