From 13e1b989fbf5e070d54b18e7bf2bb3e39975db78 Mon Sep 17 00:00:00 2001 From: Mischa Untaga <99098079+MischaU8@users.noreply.github.com> Date: Sat, 14 Oct 2023 14:53:51 +0200 Subject: UN Debate --- play.js | 2 ++ rules.js | 37 ++++++++++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/play.js b/play.js index 2834d3c..33e81c8 100644 --- a/play.js +++ b/play.js @@ -517,6 +517,8 @@ function on_update() { // eslint-disable-line no-unused-vars action_button("quick_setup", "Quick Setup") action_button("end_deployment", "End deployment") action_button("roll", "Roll") + action_button("raise_fln_psl_1d6", "+1d6 FLN PSL") + action_button("lower_gov_psl_1d6", "-1d6 Government PSL") // gov reinforcement action_button("mobilization", "Mobilization") diff --git a/rules.js b/rules.js index 4cc9e00..cb81ff1 100644 --- a/rules.js +++ b/rules.js @@ -62,7 +62,6 @@ function player_name(player) { } } - function set_next_player() { if (game.phasing === GOV_NAME) game.phasing = FLN_NAME @@ -1358,8 +1357,13 @@ states.random_event = { inactive: "to do random event", prompt() { view.prompt = "Roll for a random event." + // gen_action("reset") // XXX debug gen_action("roll") }, + reset() { + // XXX DEBUG + // goto_un_debate() + }, roll() { let rnd = 10 * roll_d6() + roll_d6() log(">Rolled " + rnd) @@ -1424,9 +1428,35 @@ function goto_elections_in_france() { } function goto_un_debate() { - log_h3("UN debates Algerian Independence. TODO") + log_h3("UN debates Algerian Independence.") // Player with higher PSL raises FLN or lowers Government PSL by 1d6. - end_random_event() + + if (game.gov_psl <= game.fln_psl) { + game.phasing = FLN_NAME + } else { + game.phasing = GOV_NAME + } + set_active_player() + game.state = "random_event_un_debate" +} + +states.random_event_un_debate = { + inactive: "to do UN debate", + prompt() { + view.prompt = "Random Event: UN Debate" + gen_action("raise_fln_psl_1d6") + gen_action("lower_gov_psl_1d6") + }, + raise_fln_psl_1d6() { + let roll = roll_1d6() + raise_fln_psl(roll) + end_random_event() + }, + lower_gov_psl_1d6() { + let roll = roll_1d6() + lower_gov_psl(roll) + end_random_event() + } } function goto_fln_factional_purge() { @@ -1512,6 +1542,7 @@ function end_random_event() { // See who controls OAS if (game.oas) { + log_br() log("OAS Active") roll_oas_control() } -- cgit v1.2.3