diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-27 08:07:11 +0000 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-27 08:07:11 +0000 |
commit | c371a5aacf4d80da8b2dfe37b7e08777ab042cfc (patch) | |
tree | 939dc47957110b74158a93374af9780c83597a49 | |
parent | 787185d7899e2a3eb9d34a50df56b2769bc0c62f (diff) | |
download | 1989-dawn-of-freedom-c371a5aacf4d80da8b2dfe37b7e08777ab042cfc.tar.gz |
Add alternative setups
-rw-r--r-- | create.html | 9 | ||||
-rw-r--r-- | rules.js | 33 |
2 files changed, 37 insertions, 5 deletions
diff --git a/create.html b/create.html index 0cc91ee..9c3f991 100644 --- a/create.html +++ b/create.html @@ -1 +1,8 @@ -<p>Notice:</p>
\ No newline at end of file +<dl> + <dt>Standard</dt> + <dd>This is the standard set up.</dd> + <dt>Democrat +1 SP</dt> + <dd>This set up offers the Democrat player one additional SP during set up.</dd> + <dt>Democrat +2 SP</dt> + <dd>This set up offers the Democrat player two additional SP during set up.</dd> +</dl>
\ No newline at end of file @@ -239,7 +239,11 @@ const S_HUNGARY = [37,38,39,40,41,42,43,44,45,46,47,48] const S_ROMANIA = [49,50,51,52,53,54,55,56,57,58,59,60,61,62] const S_BULGARIA = [63,64,65,66,67,68,69,70,71,72,73,74] -exports.scenarios = [ "Standard" ] +exports.scenarios = [ + "Standard", + "Democrat +1 SP", + "Democrat +2 SP" + ] exports.roles = [ DEM, COM ] @@ -302,6 +306,14 @@ exports.setup = function (seed, scenario, options) { log_h1("1989 Dawn of Freedom") game.active = COM + if (scenario === "Standard") + standard_setup() + else if (scenario === "Democrat +1 SP") + democrat_setup_1() + else if (scenario === "Democrat +2 SP") + democrat_setup_2() + else + throw new Error("Unknown scenario:", scenario) start_game() return game } @@ -317,7 +329,7 @@ function start_game() { }) //Set starting placement ops - game.starting_infl = [2, 3, 3, 4, 2] + game.temp = 0 // Set variable event cards where event is playable at start of game @@ -332,6 +344,18 @@ function start_game() { log_side() } +function standard_setup() { + game.starting_infl = [2, 3, 3, 4, 2] +} + +function democrat_setup_1() { + game.starting_infl = [2, 3, 3, 4, 2, 1] +} + +function democrat_setup_2() { + game.starting_infl = [2, 3, 3, 4, 2, 2] +} + exports.view = function(state, player) { game = state @@ -484,14 +508,15 @@ exports.action = function (state, player, action, arg) { states.place_starting_infl = { inactive: 'place starting SPs.', prompt() { - if (game.temp === 4 && game.available_ops === 0 ) { + console.log('game.temp', game.temp, 'game.starting_infl.length', game.starting_infl.length, 'game.available_ops', game.available_ops) + if (game.temp === (game.starting_infl.length - 1) && game.available_ops === 0 ) { view.prompt = 'Place starting SPs: done. Start Turn 1.'; gen_action("start"); } else if (game.available_ops === 0) { view.prompt = 'Place starting SPs: done.'; gen_action("done"); return; - } else if (game.temp > 2) { + } else if ((game.starting_infl.length === 5 && game.temp > 2) || game.temp > 3) { view.prompt = `Place your last ${pluralize(game.available_ops,'starting SP')}.` } else { view.prompt = `Place ${pluralize(game.available_ops,'starting SP')}.` |