summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-11-07 18:47:37 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:42:59 +0100
commit9e4f832ab8a64bf6b0f8d23ceff7577f5074f071 (patch)
tree361cd2547709a92c8b9315b6905a177ca3a2991e
parent61cb34aa0b74f67a5b3cc325e02fcbedde9add58 (diff)
download300-earth-and-water-9e4f832ab8a64bf6b0f8d23ceff7577f5074f071.tar.gz
Add options to game setup.
-rw-r--r--create.html13
-rw-r--r--rules.js12
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 @@
-<dl>
-<dt>
-Cheap Fleets (optional rule):
-<dd>
-Each Persian fleet costs only 1 talent.
-</dl>
+<p>
+Optional rules:
+<p>
+<label>
+<input type="checkbox" name="cheap_fleets" value="true">
+Each fleet costs only 1 talent.
+</label>
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: [],