summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-04-01 16:49:01 +0200
committerTor Andersson <tor@ccxvii.net>2024-04-01 16:49:01 +0200
commitf64f766b57aead5844db2b66b5a2006d04a09923 (patch)
treec031af0a2f2a054f98ce910030f478ffa185a40d /rules.js
parent745ffb9cfdcbfc975bafcf21c6d6da8d2bcdca54 (diff)
downloadmaria-f64f766b57aead5844db2b66b5a2006d04a09923.tar.gz
setup
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js104
1 files changed, 101 insertions, 3 deletions
diff --git a/rules.js b/rules.js
index bd95570..bad1211 100644
--- a/rules.js
+++ b/rules.js
@@ -1,19 +1,117 @@
+"use strict"
+
+var game, view
+
+// piece list:
+// generals, trains, and hussars - have location (loc)
+// generals - have strength (str)
+
+// space list:
+// objective/fortress have control (0 or power)
+
exports.roles = [ "Maria Theresa", "Frederick", "Louis XV" ]
exports.scenarios = [ "Standard", "Introductory" ]
+const P_AUSTRIA = 0
+const P_PRUSSIA = 1
+const P_SAXONY = 2
+const P_PRAGMATIC = 3
+const P_FRANCE = 4
+const P_BAVARIA = 5
+
+const PLAYERS = {
+ "Maria Theresa": [ P_AUSTRIA ],
+ "Frederick": [ P_PRUSSIA, P_SAXONY, P_PRAGMATIC ],
+ "Louis XV": [ P_FRANCE, P_BAVARIA ],
+}
+
+const MAJOR_POWERS = [ P_AUSTRIA, P_PRUSSIA, P_FRANCE, P_PRAGMATIC ]
+
+const MINOR_POWERS = [ P_BAVARIA, P_SAXONY ]
+
+const ALLIED = [
+ [ P_FRANCE, P_BAVARIA, P_PRUSSIA, P_SAXONY ],
+ [ P_AUSTRIA, P_PRAGMATIC ],
+]
+
+const COOPERATE = [
+ [ P_FRANCE, P_BAVARIA ],
+ [ P_PRUSSIA, P_SAXONY ],
+ [ P_AUSTRIA, P_PRAGMATIC ],
+]
+
exports.setup = function (seed, scenario, options) {
- return {
+ game = {
seed: seed,
log: [],
undo: [],
active: 0, // player
power: 0, // power
state: "setup",
+
+ turn: 1,
+ ctl: [],
+ loc: [],
+ str: [],
}
+
+ /* SETUP
+
+ Austria 6 Malmedy
+ Austria T Geel
+
+ Austria 1 Austerlitz
+ Austria 2 Steinamanger
+ Austria 3 Stuhlweißenburg
+ Austria 4 Stuhlweißenburg
+ Austria 5 Trübau
+ Austria T Hlinsko
+ Austria T Bruck
+ Austria H1 Off-map
+ Austria H2 Off-map
+
+ Prussia 1 Steinau
+ Prussia 2 Steinau
+ Prussia 3 Sprottau
+ Prussia 4 Ostpreussen Box
+ Prussia T Grünberg
+ Prussia T Silesia Box
+
+ Saxony 1 Radeberg
+ Saxony T Meißen
+
+ Bavaria 1 Ergoldsbach
+ Bavaria T Falkenstein
+
+ France 1 Beaune
+ France T Bar-le-Duc
+ France 5 Sarreguemines
+ France 4 Créspy-en-V.
+
+ France 2 Schwandorf
+ France 3 Ergoldsbach
+ France T Regensburg
+
+ Pragmatic T Tilburg
+ Pragmatic 3 Dordecht
+ Pragmatic 1 Delfzijl
+ Pragmatic 2 Delfzijl
+
+ */
+
+ return game
}
+
exports.view = function (state) {
- return {
- log: state.log
+ game = state
+ view = {
+ log: game.log
+ power: game.power
+ turn: game.turn,
+ ctl: game.ctl,
+ loc: game.loc,
+ str: game.str, // TODO: redact!
}
+ return view
}