summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.js14
-rw-r--r--rules.js305
2 files changed, 318 insertions, 1 deletions
diff --git a/play.js b/play.js
index d1a3339..7ad7fbe 100644
--- a/play.js
+++ b/play.js
@@ -473,6 +473,20 @@ function on_update() { // eslint-disable-line no-unused-vars
action_button("change_division_mode", "Change Division Mode")
action_button("end_deployment", "End deployment")
+ action_button("propaganda", "Propaganda")
+ action_button("strike", "Strike")
+ action_button("move", "Move")
+ action_button("raid", "Raid")
+ action_button("harass", "Harass")
+
+ action_button("flush", "Flush")
+ action_button("intelligence", "Intelligence")
+ action_button("civil_affairs", "Civil Affairs")
+ action_button("suppression", "Suppression")
+ action_button("population_resettlement", "Population Resettlement")
+
+ action_button("gov_mission", "Government Mission")
+ action_button("pass", "Pass")
action_button("done", "Done")
action_button("undo", "Undo")
diff --git a/rules.js b/rules.js
index c1305d4..44b9d96 100644
--- a/rules.js
+++ b/rules.js
@@ -722,6 +722,7 @@ exports.setup = function (seed, scenario, options) {
scenario: null,
turn: 0,
+ passes: 0,
// game board state
fln_ap: 0,
@@ -1821,11 +1822,313 @@ states.fln_deployment = {
}
},
end_deployment() {
+ end_deployment()
+ }
+}
+
+function end_deployment() {
+ goto_operations_phase()
+}
+
+function goto_operations_phase() {
+ game.passes = 0
+ goto_fln_operations_phase()
+}
+
+function goto_fln_operations_phase() {
+ game.phasing = FLN_NAME
+ set_active_player()
+ log_h2(`${game.active} Operations`)
+ game.state = "fln_operations"
+}
+
+states.fln_operations = {
+ inactive: "to do operations",
+ prompt() {
+ view.prompt = "Operations: Perform a mission, let Government perform a mission, or Pass"
+
+ gen_action("propaganda")
+ gen_action("strike")
+ gen_action("move")
+ gen_action("raid")
+ gen_action("harass")
+ gen_action("gov_mission")
+ gen_action("pass")
+ },
+ propaganda() {
+ goto_fln_propaganda_mission()
+
+ },
+ strike() {
+ goto_fln_strike_mission()
+ },
+ move() {
+ goto_fln_move_mission()
+ },
+ raid() {
+ goto_fln_raid_mission()
+ },
+ harass() {
+ goto_fln_harass_mission()
+ },
+ gov_mission() {
+ game.passes = 0
+ goto_gov_operations_phase()
+ },
+ pass() {
+ log("FLN Passes")
+ game.passes += 1
+ if (game.passes >= 2) {
+ end_operations_phase()
+ } else {
+ goto_gov_operations_phase()
+ }
+ }
+}
+
+function goto_fln_propaganda_mission() {
+ push_undo()
+ game.passes = 0
+ log_h3(`Propaganda Mission`)
+ game.state = "fln_propaganda"
+}
+
+states.fln_propaganda = {
+ inactive: "to do Propaganda mission",
+ prompt() {
+ view.prompt = "Propaganda: TODO"
+ gen_action("reset")
+ },
+ reset() {
+ // XXX debug
+ game.state = "fln_operations"
+ }
+}
+
+function goto_fln_strike_mission() {
+ push_undo()
+ game.passes = 0
+ log_h3(`Strike Mission`)
+ game.state = "fln_strike"
+}
+
+states.fln_strike = {
+ inactive: "to do Strike mission",
+ prompt() {
+ view.prompt = "Strike: TODO"
+ gen_action("reset")
+ },
+ reset() {
+ // XXX debug
+ game.state = "fln_operations"
+ }
+}
+
+function goto_fln_move_mission() {
+ push_undo()
+ game.passes = 0
+ log_h3(`Move Mission`)
+ game.state = "fln_move"
+}
+
+states.fln_move = {
+ inactive: "to do Move mission",
+ prompt() {
+ view.prompt = "Move: TODO"
+ gen_action("reset")
+ },
+ reset() {
// XXX debug
- goto_next_turn()
+ game.state = "fln_operations"
}
}
+function goto_fln_raid_mission() {
+ push_undo()
+ game.passes = 0
+ log_h3(`Raid Mission`)
+ game.state = "fln_raid"
+}
+
+states.fln_raid = {
+ inactive: "to do Raid mission",
+ prompt() {
+ view.prompt = "Raid: TODO"
+ gen_action("reset")
+ },
+ reset() {
+ // XXX debug
+ game.state = "fln_operations"
+ }
+}
+
+function goto_fln_harass_mission() {
+ push_undo()
+ game.passes = 0
+ log_h3(`Harass Mission`)
+ game.state = "fln_harass"
+}
+
+states.fln_harass = {
+ inactive: "to do Harass mission",
+ prompt() {
+ view.prompt = "Harass: TODO"
+ gen_action("reset")
+ },
+ reset() {
+ // XXX debug
+ game.state = "fln_operations"
+ }
+}
+
+function goto_gov_operations_phase() {
+ game.phasing = GOV_NAME
+ set_active_player()
+ log_h2(`${game.active} Operations`)
+ game.state = "gov_operations"
+}
+
+states.gov_operations = {
+ inactive: "to do operations",
+ prompt() {
+ view.prompt = "Operations: Perform a mission, or Pass."
+
+ gen_action("flush")
+ gen_action("intelligence")
+ gen_action("civil_affairs")
+ gen_action("suppression")
+ gen_action("population_resettlement")
+ gen_action("pass")
+ },
+ flush() {
+ goto_gov_flush_mission()
+ },
+ intelligence() {
+ goto_gov_intelligence_mission()
+ },
+ civil_affairs() {
+ goto_gov_civil_affairs_mission()
+ },
+ suppression() {
+ goto_gov_suppression_mission()
+ },
+ population_resettlement() {
+ goto_gov_population_resettlement_mission()
+ },
+ pass() {
+ log("Government Passes")
+ game.passes += 1
+ console.log("PASSES", game.passes)
+ if (game.passes >= 2) {
+ end_operations_phase()
+ } else {
+ goto_fln_operations_phase()
+ }
+ }
+}
+
+function goto_gov_flush_mission() {
+ push_undo()
+ game.passes = 0
+ log_h3(`Flush Mission`)
+ game.state = "gov_flush"
+}
+
+states.gov_flush = {
+ inactive: "to do Flush mission",
+ prompt() {
+ view.prompt = "Flush: TODO"
+ gen_action("reset")
+ },
+ reset() {
+ // XXX debug
+ game.state = "gov_operations"
+ }
+}
+
+function goto_gov_intelligence_mission() {
+ push_undo()
+ game.passes = 0
+ log_h3(`Intelligence Mission`)
+ game.state = "gov_intelligence"
+}
+
+states.gov_intelligence = {
+ inactive: "to do Intelligence mission",
+ prompt() {
+ view.prompt = "Intelligence: TODO"
+ gen_action("reset")
+ },
+ reset() {
+ // XXX debug
+ game.state = "gov_operations"
+ }
+}
+
+function goto_gov_civil_affairs_mission() {
+ push_undo()
+ game.passes = 0
+ log_h3(`Civil Affairs Mission`)
+ game.state = "gov_civil_affairs"
+}
+
+states.gov_civil_affairs = {
+ inactive: "to do Civil Affairs mission",
+ prompt() {
+ view.prompt = "Civil Affairs: TODO"
+ gen_action("reset")
+ },
+ reset() {
+ // XXX debug
+ game.state = "gov_operations"
+ }
+}
+
+function goto_gov_suppression_mission() {
+ push_undo()
+ game.passes = 0
+ log_h3(`Suppression Mission`)
+ game.state = "gov_suppression"
+}
+
+states.gov_suppression = {
+ inactive: "to do Suppression mission",
+ prompt() {
+ view.prompt = "Suppression: TODO"
+ gen_action("reset")
+ },
+ reset() {
+ // XXX debug
+ game.state = "gov_operations"
+ }
+}
+
+function goto_gov_population_resettlement_mission() {
+ push_undo()
+ game.passes = 0
+ log_h3(`Population Resettlement Mission`)
+ game.state = "gov_population_resettlement"
+}
+
+states.gov_population_resettlement = {
+ inactive: "to do Population Resettlement mission",
+ prompt() {
+ view.prompt = "Population Resettlement: TODO"
+ gen_action("reset")
+ },
+ reset() {
+ // XXX debug
+ game.state = "gov_operations"
+ }
+}
+
+function end_operations_phase() {
+ game.passes = 0
+ // XXX
+ log("End Operations Phase")
+ goto_next_turn()
+}
+
function goto_next_turn() {
game.turn += 1