From 9e4f832ab8a64bf6b0f8d23ceff7577f5074f071 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 7 Nov 2021 18:47:37 +0100 Subject: Add options to game setup. --- create.html | 13 +++++++------ rules.js | 12 +++++------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/create.html b/create.html index 891641e..550e74d 100644 --- a/create.html +++ b/create.html @@ -1,6 +1,7 @@ -
-
-Cheap Fleets (optional rule): -
-Each Persian fleet costs only 1 talent. -
+

+Optional rules: +

+ diff --git a/rules.js b/rules.js index d3a6f3b..35664a8 100644 --- a/rules.js +++ b/rules.js @@ -33,11 +33,9 @@ // in any land battle, after persian annihilation: the immortals // in any naval battle, after persian lose 1 fleet: artemisia -const CHEAP_PERSIAN_FLEETS = "Cheap Fleets"; exports.scenarios = [ - "Standard", - CHEAP_PERSIAN_FLEETS, + "Standard" ]; const OBSERVER = "Observer"; @@ -3264,11 +3262,11 @@ states.game_over = { } } -exports.ready = function (scenario, players) { - return (players.length === 2); +exports.ready = function (scenario, options, players) { + return players.length === 2; } -exports.setup = function (seed, scenario) { +exports.setup = function (seed, scenario, options) { game = { seed: seed, @@ -3282,7 +3280,7 @@ exports.setup = function (seed, scenario) { draw: 0, pass: 0, event: 0, - fleet_cost: (scenario === CHEAP_PERSIAN_FLEETS ? 1 : 2), + fleet_cost: options.cheap_fleets ? 1 : 2, }, greek: { hand: [], -- cgit v1.2.3