diff options
-rw-r--r-- | rules.js | 104 |
1 files changed, 101 insertions, 3 deletions
@@ -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 } |