summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-10-14 14:53:51 +0200
committerMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-10-14 14:53:51 +0200
commit13e1b989fbf5e070d54b18e7bf2bb3e39975db78 (patch)
tree4ce5acb03046a8412a5e2648391fc2ed714d33fe
parent168146f7295e9904dbb19c1d818183171f9366df (diff)
downloadalgeria-13e1b989fbf5e070d54b18e7bf2bb3e39975db78.tar.gz
UN Debate
-rw-r--r--play.js2
-rw-r--r--rules.js37
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()
}