From 0b0e15dc9cd4eb5f4d1edda083bfc01e74d0c191 Mon Sep 17 00:00:00 2001 From: Mischa Untaga <99098079+MischaU8@users.noreply.github.com> Date: Mon, 27 Nov 2023 14:47:51 +0100 Subject: dont reroll when event roll was a success already --- events.txt | 16 ++++++++-------- rules.js | 25 ++++++++++++++++--------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/events.txt b/events.txt index 2dbe9c3..4fca2ec 100644 --- a/events.txt +++ b/events.txt @@ -23,7 +23,7 @@ CARD 4 - A Vindication of the Rights of Woman CARD 5 - Union Victory # Playable if *The Civil War* is in effect. Roll :d6. On a roll of 3-6, receive two :button and move *The Civil War* to the discard pile. requires_persistent REST_OF_TURN find_card("The Civil War") - roll 1 D6 + roll_for_success 1 D6 if (game.vm.roll >= 3) receive_buttons 2 discard_persistent REST_OF_TURN find_card("The Civil War") @@ -32,7 +32,7 @@ CARD 5 - Union Victory CARD 6 - Fifteenth Amendment # Playable if *The Civil War* is not in effect. Roll :d6. On a roll of 3-6, add 2 :congressional_marker in Congress and add 8 :purple_or_yellow_cube anywhere, no more than 2 per state. requires_not_persistent REST_OF_TURN find_card("The Civil War") - roll 1 D6 + roll_for_success 1 D6 if (game.vm.roll >= 3) add_congress 2 add_cubes_limit 8 PURPLE_OR_YELLOW anywhere() 2 @@ -107,7 +107,7 @@ CARD 19 - National American Woman Suffrage Association CARD 20 - Jeannette Rankin # Roll :d6. On a roll of 3-6, add 1 :congressional_marker in Congress and 4 :purple_or_yellow_cube in Montana and 2 :purple_or_yellow_cube in each other state in the Plains region. - roll 1 D6 + roll_for_success 1 D6 if (game.vm.roll >= 3) add_congress 1 add_cubes 4 PURPLE_OR_YELLOW us_states("Montana") @@ -200,7 +200,7 @@ CARD 37 - The Young Woman Citizen CARD 38 - 1918 Midterm Elections # Roll :d6. On a roll of 3-6, add 3 :congressional_marker in Congress. - roll 1 D6 + roll_for_success 1 D6 if (game.vm.roll >= 3) add_congress 3 endif @@ -238,7 +238,7 @@ CARD 45 - Women and World War I CARD 46 - Eighteenth Amendment # Roll :d6. On a roll of 3-6, add 1 congressional_marker in Congress and receive 2 :button. - roll 1 D6 + roll_for_success 1 D6 if (game.vm.roll >= 3) add_congress 1 receive_buttons 2 @@ -301,7 +301,7 @@ CARD 56 - Senator Joseph Brown CARD 57 - Minor v. Happersett # Roll :d6. On a roll of 3-6, remove 1 :congressional_marker and add 2 :red_cube in Missouri. - roll 1 D6 + roll_for_success 1 D6 if (game.vm.roll >= 3) remove_congress 1 add_cubes 2 RED us_states("Missouri") @@ -309,7 +309,7 @@ CARD 57 - Minor v. Happersett CARD 58 - Senate Rejects Suffrage Amendment # Roll :d6. On a roll of 3-6, receive 1 :button and remove 1 :congressional_marker from Congress. - roll 1 D6 + roll_for_success 1 D6 if (game.vm.roll >= 3) receive_buttons 1 remove_congress 1 @@ -317,7 +317,7 @@ CARD 58 - Senate Rejects Suffrage Amendment CARD 59 - South Dakota Rejects Suffrage # Roll :d6. On a roll of 3-6, remove 1 :congressional_marker and add 2 :red_cube in South Dakota. - roll 1 D6 + roll_for_success 1 D6 if (game.vm.roll >= 3) remove_congress 1 add_cubes 2 RED us_states("South Dakota") diff --git a/rules.js b/rules.js index 382d3fb..1e67743 100644 --- a/rules.js +++ b/rules.js @@ -1986,6 +1986,13 @@ function vm_roll() { game.state = "vm_roll" } +function vm_roll_for_success() { + game.vm.count = vm_operand(1) + game.vm.d = vm_operand(2) + game.vm.for_success = true + game.state = "vm_roll" +} + function vm_roll_list() { game.vm.count = vm_operand(1) game.vm.d = vm_operand(2) @@ -2612,7 +2619,7 @@ states.vm_roll = { if (!game.vm.roll) { gen_action("roll") } else { - if (player_buttons() > 0) + if (player_buttons() > 0 && (!game.vm.for_success || game.vm.roll < 3)) gen_action("reroll") gen_action("next") } @@ -3298,7 +3305,7 @@ CODE[4] = [ // A Vindication of the Rights of Woman CODE[5] = [ // Union Victory [ vm_requires_persistent, REST_OF_TURN, find_card("The Civil War") ], - [ vm_roll, 1, D6 ], + [ vm_roll_for_success, 1, D6 ], [ vm_if, ()=>(game.vm.roll >= 3) ], [ vm_receive_buttons, 2 ], [ vm_discard_persistent, REST_OF_TURN, find_card("The Civil War") ], @@ -3308,7 +3315,7 @@ CODE[5] = [ // Union Victory CODE[6] = [ // Fifteenth Amendment [ vm_requires_not_persistent, REST_OF_TURN, find_card("The Civil War") ], - [ vm_roll, 1, D6 ], + [ vm_roll_for_success, 1, D6 ], [ vm_if, ()=>(game.vm.roll >= 3) ], [ vm_add_congress, 2 ], [ vm_add_cubes_limit, 8, PURPLE_OR_YELLOW, anywhere(), 2 ], @@ -3396,7 +3403,7 @@ CODE[19] = [ // National American Woman Suffrage Association ] CODE[20] = [ // Jeannette Rankin - [ vm_roll, 1, D6 ], + [ vm_roll_for_success, 1, D6 ], [ vm_if, ()=>(game.vm.roll >= 3) ], [ vm_add_congress, 1 ], [ vm_add_cubes, 4, PURPLE_OR_YELLOW, us_states("Montana") ], @@ -3507,7 +3514,7 @@ CODE[37] = [ // The Young Woman Citizen ] CODE[38] = [ // 1918 Midterm Elections - [ vm_roll, 1, D6 ], + [ vm_roll_for_success, 1, D6 ], [ vm_if, ()=>(game.vm.roll >= 3) ], [ vm_add_congress, 3 ], [ vm_endif ], @@ -3553,7 +3560,7 @@ CODE[45] = [ // Women and World War I ] CODE[46] = [ // Eighteenth Amendment - [ vm_roll, 1, D6 ], + [ vm_roll_for_success, 1, D6 ], [ vm_if, ()=>(game.vm.roll >= 3) ], [ vm_add_congress, 1 ], [ vm_receive_buttons, 2 ], @@ -3625,7 +3632,7 @@ CODE[56] = [ // Senator Joseph Brown ] CODE[57] = [ // Minor v. Happersett - [ vm_roll, 1, D6 ], + [ vm_roll_for_success, 1, D6 ], [ vm_if, ()=>(game.vm.roll >= 3) ], [ vm_remove_congress, 1 ], [ vm_add_cubes, 2, RED, us_states("Missouri") ], @@ -3634,7 +3641,7 @@ CODE[57] = [ // Minor v. Happersett ] CODE[58] = [ // Senate Rejects Suffrage Amendment - [ vm_roll, 1, D6 ], + [ vm_roll_for_success, 1, D6 ], [ vm_if, ()=>(game.vm.roll >= 3) ], [ vm_receive_buttons, 1 ], [ vm_remove_congress, 1 ], @@ -3643,7 +3650,7 @@ CODE[58] = [ // Senate Rejects Suffrage Amendment ] CODE[59] = [ // South Dakota Rejects Suffrage - [ vm_roll, 1, D6 ], + [ vm_roll_for_success, 1, D6 ], [ vm_if, ()=>(game.vm.roll >= 3) ], [ vm_remove_congress, 1 ], [ vm_add_cubes, 2, RED, us_states("South Dakota") ], -- cgit v1.2.3