diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-04-20 00:45:26 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-05-03 18:48:16 +0200 |
commit | ea0e725f6454beae7f7cd993fce538b80b64459e (patch) | |
tree | 23ffb61cfe410534564535e33a4fe1354113f035 | |
parent | 819e1f195256b1cf5965d037345bec62758ea374 (diff) | |
download | andean-abyss-ea0e725f6454beae7f7cd993fce538b80b64459e.tar.gz |
WIP player count as option instead of scenario
-rw-r--r-- | create.html | 10 | ||||
-rw-r--r-- | play.html | 3 | ||||
-rw-r--r-- | rules.js | 54 |
3 files changed, 35 insertions, 32 deletions
diff --git a/create.html b/create.html index b6ec3f7..58095e1 100644 --- a/create.html +++ b/create.html @@ -1,3 +1,13 @@ <p> +Player count: +<br> +<select name="players"> +<option value="">4 Player</option> +<option value="3">3 Player</option> +<option value="2">2 Player</option> +<option value="1">Solo</option> +</select> + +<p> <label><input type="checkbox" name="seeded" value="true">Seeded Propaganda Option</label> </p> @@ -33,9 +33,6 @@ <div class="debug menu_item" onclick="send_restart('Standard')">⚠ Restart Standard</div> <div class="debug menu_item" onclick="send_restart('Short')">⚠ Restart Short</div> <div class="debug menu_item" onclick="send_restart('Quick')">⚠ Restart Quick</div> - <div class="debug menu_item" onclick="send_restart('3P Quick')">⚠ Restart 3P Quick</div> - <div class="debug menu_item" onclick="send_restart('2P Quick')">⚠ Restart 2P Quick</div> - <div class="debug menu_item" onclick="send_restart('2P Standard')">⚠ Restart 2P Standard</div> <div class="debug menu_item" onclick="send_restart('Test')">⚠ Restart Test</div> </div> </div> @@ -190,12 +190,13 @@ const BEUNAVENTURA_CALI_LOC = data.space_name.indexOf("Buenaventura-Cali LoC") const CARTAGENA_SINCELEJO_LOC = data.space_name.indexOf("Cartagena-Sincelejo LoC") const CARTAGENA_SANTA_MARTA_LOC = data.space_name.indexOf("Cartagena-Santa Marta LoC") -exports.roles = function (scenario) { - if (scenario === "Solo") +exports.roles = function (scenario, options) { + let n = parseInt(options.players) || 4 + if (n === 1) return [ NAME_SOLO ] - if (scenario.startsWith("2P")) + if (n === 2) return [ NAME_GOVT_AUC, NAME_FARC_CARTELS ] - if (scenario.startsWith("3P")) + if (n === 3) return [ NAME_GOVT, NAME_FARC, NAME_AUC_CARTELS ] return [ NAME_GOVT, NAME_FARC, NAME_AUC, NAME_CARTELS ] } @@ -204,13 +205,6 @@ exports.scenarios = [ "Standard", "Short", "Quick", - "3P Standard", - "3P Short", - "3P Quick", - "2P Standard", - "2P Short", - "2P Quick", - "Solo", "Test", ] @@ -291,12 +285,7 @@ exports.setup = function (seed, scenario, options) { // redeploy: -1, } - if (scenario.startsWith("3P")) - game.scenario = 3 - if (scenario.startsWith("2P")) - game.scenario = 2 - if (scenario === "Solo") - game.scenario = 1 + game.scenario = parseInt(options.players) || 4 for_each_piece(FARC, GUERRILLA, set_underground) for_each_piece(AUC, GUERRILLA, set_underground) @@ -304,26 +293,33 @@ exports.setup = function (seed, scenario, options) { setup_standard() - if (scenario.includes("Quick")) { - log_h1("Scenario: Quick") - setup_quick() - setup_deck(2, 6, 6) - } else if (scenario.includes("Short")) { + log_h1("Scenario: " + scenario) + + switch (scenario) { + default: + case "Standard": if (options.seeded) - setup_deck(3, 10, 5) - else - setup_deck(3, 0, 15) - } else { + log("Seeded Deck") if (options.seeded) setup_deck(4, 10, 5) else setup_deck(4, 0, 15) - } - - if (scenario === "Test") { + break + case "Short": + if (options.seeded) + setup_deck(3, 10, 5) + else + setup_deck(3, 0, 15) + break + case "Quick": + setup_quick() + setup_deck(2, 6, 6) + break + case "Test": game.deck = [] for (let i = 1; i < PROPAGANDA; ++i) game.deck.push(i) + break } log("DEBUG DECK " + game.deck.join(", ")) |