summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-06-14 20:34:27 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:31:29 +0100
commit3e8fe76752d0be4d09744dc854bf0144cfc4a9a6 (patch)
tree432fb454f1bb8400dc39403ec3963929b842f63c
parent98e1a9b243b3418a50e0096d29adcadc65b98fe3 (diff)
downloadpax-pamir-3e8fe76752d0be4d09744dc854bf0144cfc4a9a6.tar.gz
Remove exports.ready function.
-rw-r--r--rules.js23
1 files changed, 8 insertions, 15 deletions
diff --git a/rules.js b/rules.js
index 1457abd..f14ba5c 100644
--- a/rules.js
+++ b/rules.js
@@ -49,6 +49,13 @@ const player_names = [
"None"
]
+const player_names_by_scenario = {
+ "2P": player_names.slice(0, 2),
+ "3P": player_names.slice(0, 3),
+ "4P": player_names.slice(0, 4),
+ "5P": player_names.slice(0, 5),
+}
+
const player_index = Object.fromEntries(Object.entries(player_names).map(([k,v])=>[v,k|0]))
const region_names = {
@@ -126,21 +133,7 @@ const scenario_player_count = { "2P": 2, "3P": 3, "4P": 4, "5P": 5 }
exports.scenarios = [ "3P", "4P", "5P", "2P" ]
exports.roles = function (scenario) {
- switch (scenario) {
- case "2P": return player_names.slice(0, 2)
- case "3P": return player_names.slice(0, 3)
- case "4P": return player_names.slice(0, 4)
- case "5P": return player_names.slice(0, 5)
- }
-}
-
-exports.ready = function (scenario, options, players) {
- switch (scenario) {
- case "2P": return players.length === 2
- case "3P": return players.length === 3
- case "4P": return players.length === 4
- case "5P": return players.length === 5
- }
+ return player_names_by_scenario[scenario]
}
function random(n) {