powergrid-engine 1.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +31 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +17 -0
- package/dist/src/available-moves.d.ts +24 -0
- package/dist/src/available-moves.js +363 -0
- package/dist/src/engine.d.ts +20 -0
- package/dist/src/engine.js +1937 -0
- package/dist/src/gamestate.d.ts +135 -0
- package/dist/src/gamestate.js +30 -0
- package/dist/src/log.d.ts +14 -0
- package/dist/src/log.js +2 -0
- package/dist/src/maps/america.d.ts +55 -0
- package/dist/src/maps/america.js +411 -0
- package/dist/src/maps/australia.d.ts +46 -0
- package/dist/src/maps/australia.js +138 -0
- package/dist/src/maps/badenwurttemberg.d.ts +46 -0
- package/dist/src/maps/badenwurttemberg.js +163 -0
- package/dist/src/maps/benelux.d.ts +46 -0
- package/dist/src/maps/benelux.js +210 -0
- package/dist/src/maps/brazil.d.ts +54 -0
- package/dist/src/maps/brazil.js +292 -0
- package/dist/src/maps/centraleurope.d.ts +54 -0
- package/dist/src/maps/centraleurope.js +236 -0
- package/dist/src/maps/china.d.ts +54 -0
- package/dist/src/maps/china.js +262 -0
- package/dist/src/maps/france.d.ts +54 -0
- package/dist/src/maps/france.js +290 -0
- package/dist/src/maps/germany.d.ts +57 -0
- package/dist/src/maps/germany.js +328 -0
- package/dist/src/maps/indian.d.ts +54 -0
- package/dist/src/maps/indian.js +283 -0
- package/dist/src/maps/italy.d.ts +54 -0
- package/dist/src/maps/italy.js +190 -0
- package/dist/src/maps/japan.d.ts +46 -0
- package/dist/src/maps/japan.js +144 -0
- package/dist/src/maps/korea.d.ts +54 -0
- package/dist/src/maps/korea.js +186 -0
- package/dist/src/maps/middleeast.d.ts +54 -0
- package/dist/src/maps/middleeast.js +225 -0
- package/dist/src/maps/northerneurope.d.ts +54 -0
- package/dist/src/maps/northerneurope.js +197 -0
- package/dist/src/maps/quebec.d.ts +54 -0
- package/dist/src/maps/quebec.js +283 -0
- package/dist/src/maps/russia.d.ts +54 -0
- package/dist/src/maps/russia.js +286 -0
- package/dist/src/maps/southafrica.d.ts +46 -0
- package/dist/src/maps/southafrica.js +152 -0
- package/dist/src/maps/spainportugal.d.ts +54 -0
- package/dist/src/maps/spainportugal.js +289 -0
- package/dist/src/maps/ukireland.d.ts +52 -0
- package/dist/src/maps/ukireland.js +176 -0
- package/dist/src/maps.d.ts +50 -0
- package/dist/src/maps.js +61 -0
- package/dist/src/move.d.ts +63 -0
- package/dist/src/move.js +15 -0
- package/dist/src/powerPlants.d.ts +4 -0
- package/dist/src/powerPlants.js +60 -0
- package/dist/src/prices.d.ts +7 -0
- package/dist/src/prices.js +10 -0
- package/dist/src/randomizeMap.d.ts +3 -0
- package/dist/src/randomizeMap.js +244 -0
- package/dist/src/utils.d.ts +2 -0
- package/dist/src/utils.js +24 -0
- package/dist/wrapper.d.ts +30 -0
- package/dist/wrapper.js +127 -0
- package/index.ts +6 -0
- package/package.json +51 -0
- package/src/available-moves.ts +450 -0
- package/src/engine.spec.ts +163 -0
- package/src/engine.ts +2270 -0
- package/src/fixtures/GermanyRecharged.json +6627 -0
- package/src/fixtures/USAOriginal.json +5216 -0
- package/src/fixtures/supply.json +5792 -0
- package/src/fixtures/undo.json +4102 -0
- package/src/gamestate.ts +164 -0
- package/src/log.ts +17 -0
- package/src/maps/america.ts +411 -0
- package/src/maps/australia.ts +137 -0
- package/src/maps/badenwurttemberg.ts +162 -0
- package/src/maps/benelux.ts +210 -0
- package/src/maps/brazil.ts +306 -0
- package/src/maps/centraleurope.ts +235 -0
- package/src/maps/china.ts +268 -0
- package/src/maps/france.ts +295 -0
- package/src/maps/germany.ts +328 -0
- package/src/maps/indian.ts +289 -0
- package/src/maps/italy.ts +189 -0
- package/src/maps/japan.ts +143 -0
- package/src/maps/korea.ts +185 -0
- package/src/maps/middleeast.ts +225 -0
- package/src/maps/northerneurope.ts +196 -0
- package/src/maps/quebec.ts +304 -0
- package/src/maps/russia.ts +292 -0
- package/src/maps/southafrica.ts +151 -0
- package/src/maps/spainportugal.ts +295 -0
- package/src/maps/ukireland.ts +175 -0
- package/src/maps.ts +123 -0
- package/src/move.ts +83 -0
- package/src/powerPlants.ts +59 -0
- package/src/prices.ts +10 -0
- package/src/randomizeMap.ts +288 -0
- package/src/rankings.spec.ts +18 -0
- package/src/utils.spec.ts +13 -0
- package/src/utils.ts +23 -0
- package/tsconfig.json +17 -0
- package/wrapper.ts +126 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { cloneDeep } from 'lodash';
|
|
2
|
+
import { getPowerPlant } from '../engine';
|
|
3
|
+
import { PowerPlant, PowerPlantType } from '../gamestate';
|
|
4
|
+
import { powerPlants } from '../powerPlants';
|
|
5
|
+
import { shuffle } from '../utils';
|
|
6
|
+
import { GameMap } from './../maps';
|
|
7
|
+
|
|
8
|
+
export enum Regions {
|
|
9
|
+
Green = 'green',
|
|
10
|
+
Brown = 'brown',
|
|
11
|
+
Pink = 'pink',
|
|
12
|
+
Red = 'red',
|
|
13
|
+
Yellow = 'yellow',
|
|
14
|
+
Purple = 'purple',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export enum Cities {
|
|
18
|
+
Septiles = 'Sept-Iles',
|
|
19
|
+
Portcartier = 'Port-Cartier',
|
|
20
|
+
Baiecomeau = 'Baie-Comeau',
|
|
21
|
+
Chicoutimi = 'Chicoutimi',
|
|
22
|
+
Alma = 'Alma',
|
|
23
|
+
Roberval = 'Roberval',
|
|
24
|
+
Jonquiere = 'Jonquiere',
|
|
25
|
+
Gaspe = 'Gaspe',
|
|
26
|
+
Steannedesmonts = 'Ste-Anne-Des-Monts',
|
|
27
|
+
Matane = 'Matane',
|
|
28
|
+
Rimouski = 'Rimouski',
|
|
29
|
+
Pointealacroix = 'Pointe-A-La-Croix',
|
|
30
|
+
Riviereduloup = 'Riviere-Du-Loup',
|
|
31
|
+
Montmagny = 'Montmagny',
|
|
32
|
+
Stgeorges = 'St-Georges',
|
|
33
|
+
Sherbrooke = 'Sherbrooke',
|
|
34
|
+
Victoriaville = 'Victoriaville',
|
|
35
|
+
Stsimeon = 'St-Simeon',
|
|
36
|
+
Charlesbourg = 'Charlesbourg',
|
|
37
|
+
Quebec = 'Quebec',
|
|
38
|
+
Beauport = 'Beauport',
|
|
39
|
+
Granby = 'Granby',
|
|
40
|
+
Sthyacinthe = 'St-Hyacinthe',
|
|
41
|
+
Brossard = 'Brossard',
|
|
42
|
+
Valleyfield = 'Valleyfield',
|
|
43
|
+
Vaudreuildorion = 'Vaudreuil-Dorion',
|
|
44
|
+
Montreal = 'Montreal',
|
|
45
|
+
Pointeclaire = 'Pointe-Claire',
|
|
46
|
+
Shawinigan = 'Shawinigan',
|
|
47
|
+
Troisrivieres = 'Trois-Rivieres',
|
|
48
|
+
Drummondville = 'Drummond-Ville',
|
|
49
|
+
Repentigny = 'Repentigny',
|
|
50
|
+
Longueuil = 'Longueuil',
|
|
51
|
+
Laval = 'Laval',
|
|
52
|
+
Lachute = 'Lachute',
|
|
53
|
+
Amos = 'Amos',
|
|
54
|
+
Valdor = 'Val-Dor',
|
|
55
|
+
Rouynnoranda = 'Rouyn-Noranda',
|
|
56
|
+
Montlaurier = 'Mont-Laurier',
|
|
57
|
+
Maniwaki = 'Maniwaki',
|
|
58
|
+
Gatineau = 'Gatineau',
|
|
59
|
+
Hull = 'Hull',
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const map: GameMap = {
|
|
63
|
+
name: 'Quebec',
|
|
64
|
+
cities: [
|
|
65
|
+
{ name: Cities.Septiles, region: Regions.Green, x: 3524, y: 228 },
|
|
66
|
+
{ name: Cities.Portcartier, region: Regions.Green, x: 3328, y: 370 },
|
|
67
|
+
{ name: Cities.Baiecomeau, region: Regions.Green, x: 3066, y: 630 },
|
|
68
|
+
{ name: Cities.Chicoutimi, region: Regions.Green, x: 2392, y: 898 },
|
|
69
|
+
{ name: Cities.Alma, region: Regions.Green, x: 2172, y: 844 },
|
|
70
|
+
{ name: Cities.Roberval, region: Regions.Green, x: 1944, y: 950 },
|
|
71
|
+
{ name: Cities.Jonquiere, region: Regions.Green, x: 2240, y: 1052 },
|
|
72
|
+
{ name: Cities.Gaspe, region: Regions.Brown, x: 4014, y: 808 },
|
|
73
|
+
{ name: Cities.Steannedesmonts, region: Regions.Brown, x: 3512, y: 708 },
|
|
74
|
+
{ name: Cities.Matane, region: Regions.Brown, x: 3244, y: 808 },
|
|
75
|
+
{ name: Cities.Rimouski, region: Regions.Brown, x: 2990, y: 946 },
|
|
76
|
+
{ name: Cities.Pointealacroix, region: Regions.Brown, x: 3492, y: 1094 },
|
|
77
|
+
{ name: Cities.Riviereduloup, region: Regions.Brown, x: 2780, y: 1208 },
|
|
78
|
+
{ name: Cities.Montmagny, region: Regions.Brown, x: 2522, y: 1534 },
|
|
79
|
+
{ name: Cities.Stgeorges, region: Regions.Pink, x: 2506, y: 1836 },
|
|
80
|
+
{ name: Cities.Sherbrooke, region: Regions.Pink, x: 2242, y: 2128 },
|
|
81
|
+
{ name: Cities.Victoriaville, region: Regions.Pink, x: 2178, y: 1822 },
|
|
82
|
+
{ name: Cities.Stsimeon, region: Regions.Pink, x: 2576, y: 1146 },
|
|
83
|
+
{ name: Cities.Charlesbourg, region: Regions.Pink, x: 2246, y: 1434 },
|
|
84
|
+
{ name: Cities.Quebec, region: Regions.Pink, x: 2302, y: 1536 },
|
|
85
|
+
{ name: Cities.Beauport, region: Regions.Pink, x: 2196, y: 1524 },
|
|
86
|
+
{ name: Cities.Granby, region: Regions.Red, x: 1974, y: 2160 },
|
|
87
|
+
{ name: Cities.Sthyacinthe, region: Regions.Red, x: 1796, y: 2038 },
|
|
88
|
+
{ name: Cities.Brossard, region: Regions.Red, x: 1790, y: 2296 },
|
|
89
|
+
{ name: Cities.Valleyfield, region: Regions.Red, x: 1576, y: 2306 },
|
|
90
|
+
{ name: Cities.Vaudreuildorion, region: Regions.Red, x: 1414, y: 2186 },
|
|
91
|
+
{ name: Cities.Montreal, region: Regions.Red, x: 1624, y: 2052 },
|
|
92
|
+
{ name: Cities.Pointeclaire, region: Regions.Red, x: 1510, y: 2060 },
|
|
93
|
+
{ name: Cities.Shawinigan, region: Regions.Yellow, x: 1864, y: 1448 },
|
|
94
|
+
{ name: Cities.Troisrivieres, region: Regions.Yellow, x: 1918, y: 1650 },
|
|
95
|
+
{ name: Cities.Drummondville, region: Regions.Yellow, x: 1984, y: 1886 },
|
|
96
|
+
{ name: Cities.Repentigny, region: Regions.Yellow, x: 1696, y: 1820 },
|
|
97
|
+
{ name: Cities.Longueuil, region: Regions.Yellow, x: 1598, y: 1964 },
|
|
98
|
+
{ name: Cities.Laval, region: Regions.Yellow, x: 1512, y: 1990 },
|
|
99
|
+
{ name: Cities.Lachute, region: Regions.Yellow, x: 1364, y: 1944 },
|
|
100
|
+
{ name: Cities.Amos, region: Regions.Purple, x: 492, y: 868 },
|
|
101
|
+
{ name: Cities.Valdor, region: Regions.Purple, x: 570, y: 1098 },
|
|
102
|
+
{ name: Cities.Rouynnoranda, region: Regions.Purple, x: 236, y: 1028 },
|
|
103
|
+
{ name: Cities.Montlaurier, region: Regions.Purple, x: 1180, y: 1630 },
|
|
104
|
+
{ name: Cities.Maniwaki, region: Regions.Purple, x: 964, y: 1760 },
|
|
105
|
+
{ name: Cities.Gatineau, region: Regions.Purple, x: 1076, y: 2096 },
|
|
106
|
+
{ name: Cities.Hull, region: Regions.Purple, x: 862, y: 2104 },
|
|
107
|
+
],
|
|
108
|
+
connections: [
|
|
109
|
+
{ nodes: [Cities.Maniwaki, Cities.Montlaurier], cost: 5 },
|
|
110
|
+
{ nodes: [Cities.Maniwaki, Cities.Valdor], cost: 24 },
|
|
111
|
+
{ nodes: [Cities.Valdor, Cities.Amos], cost: 8 },
|
|
112
|
+
{ nodes: [Cities.Amos, Cities.Rouynnoranda], cost: 9 },
|
|
113
|
+
{ nodes: [Cities.Rouynnoranda, Cities.Valdor], cost: 12 },
|
|
114
|
+
{ nodes: [Cities.Hull, Cities.Maniwaki], cost: 15 },
|
|
115
|
+
{ nodes: [Cities.Hull, Cities.Gatineau], cost: 0 },
|
|
116
|
+
{ nodes: [Cities.Gatineau, Cities.Montlaurier], cost: 16 },
|
|
117
|
+
{ nodes: [Cities.Montlaurier, Cities.Lachute], cost: 18 },
|
|
118
|
+
{ nodes: [Cities.Shawinigan, Cities.Troisrivieres], cost: 3 },
|
|
119
|
+
{ nodes: [Cities.Troisrivieres, Cities.Drummondville], cost: 9 },
|
|
120
|
+
{ nodes: [Cities.Drummondville, Cities.Victoriaville], cost: 6 },
|
|
121
|
+
{ nodes: [Cities.Victoriaville, Cities.Stgeorges], cost: 10 },
|
|
122
|
+
{ nodes: [Cities.Stgeorges, Cities.Sherbrooke], cost: 15 },
|
|
123
|
+
{ nodes: [Cities.Sherbrooke, Cities.Granby], cost: 8 },
|
|
124
|
+
{ nodes: [Cities.Granby, Cities.Sthyacinthe], cost: 4 },
|
|
125
|
+
{ nodes: [Cities.Sthyacinthe, Cities.Drummondville], cost: 6 },
|
|
126
|
+
{ nodes: [Cities.Troisrivieres, Cities.Victoriaville], cost: 9 },
|
|
127
|
+
{ nodes: [Cities.Victoriaville, Cities.Sherbrooke], cost: 9 },
|
|
128
|
+
{ nodes: [Cities.Sherbrooke, Cities.Drummondville], cost: 9 },
|
|
129
|
+
{ nodes: [Cities.Sthyacinthe, Cities.Repentigny], cost: 7 },
|
|
130
|
+
{ nodes: [Cities.Sthyacinthe, Cities.Brossard], cost: 5 },
|
|
131
|
+
{ nodes: [Cities.Brossard, Cities.Valleyfield], cost: 8 },
|
|
132
|
+
{ nodes: [Cities.Valleyfield, Cities.Vaudreuildorion], cost: 4 },
|
|
133
|
+
{ nodes: [Cities.Gatineau, Cities.Lachute], cost: 14 },
|
|
134
|
+
{ nodes: [Cities.Montlaurier, Cities.Shawinigan], cost: 28 },
|
|
135
|
+
{ nodes: [Cities.Shawinigan, Cities.Beauport], cost: 14 },
|
|
136
|
+
{ nodes: [Cities.Beauport, Cities.Troisrivieres], cost: 15 },
|
|
137
|
+
{ nodes: [Cities.Troisrivieres, Cities.Repentigny], cost: 13 },
|
|
138
|
+
{ nodes: [Cities.Repentigny, Cities.Longueuil], cost: 3 },
|
|
139
|
+
{ nodes: [Cities.Laval, Cities.Lachute], cost: 6 },
|
|
140
|
+
{ nodes: [Cities.Vaudreuildorion, Cities.Pointeclaire], cost: 3 },
|
|
141
|
+
{ nodes: [Cities.Montreal, Cities.Brossard], cost: 4 },
|
|
142
|
+
{ nodes: [Cities.Laval, Cities.Longueuil], cost: 0 },
|
|
143
|
+
{ nodes: [Cities.Pointeclaire, Cities.Montreal], cost: 0 },
|
|
144
|
+
{ nodes: [Cities.Montreal, Cities.Longueuil], cost: 0 },
|
|
145
|
+
{ nodes: [Cities.Pointeclaire, Cities.Laval], cost: 0 },
|
|
146
|
+
{ nodes: [Cities.Beauport, Cities.Charlesbourg], cost: 0 },
|
|
147
|
+
{ nodes: [Cities.Charlesbourg, Cities.Quebec], cost: 0 },
|
|
148
|
+
{ nodes: [Cities.Quebec, Cities.Beauport], cost: 0 },
|
|
149
|
+
{ nodes: [Cities.Victoriaville, Cities.Beauport], cost: 12 },
|
|
150
|
+
{ nodes: [Cities.Quebec, Cities.Stgeorges], cost: 12 },
|
|
151
|
+
{ nodes: [Cities.Stgeorges, Cities.Montmagny], cost: 12 },
|
|
152
|
+
{ nodes: [Cities.Montmagny, Cities.Riviereduloup], cost: 16 },
|
|
153
|
+
{ nodes: [Cities.Jonquiere, Cities.Charlesbourg], cost: 21 },
|
|
154
|
+
{ nodes: [Cities.Montmagny, Cities.Quebec], cost: 5 },
|
|
155
|
+
{ nodes: [Cities.Stsimeon, Cities.Charlesbourg], cost: 18 },
|
|
156
|
+
{ nodes: [Cities.Drummondville, Cities.Granby], cost: 4 },
|
|
157
|
+
{ nodes: [Cities.Roberval, Cities.Shawinigan], cost: 25 },
|
|
158
|
+
{ nodes: [Cities.Jonquiere, Cities.Stsimeon], cost: 16 },
|
|
159
|
+
{ nodes: [Cities.Roberval, Cities.Jonquiere], cost: 10 },
|
|
160
|
+
{ nodes: [Cities.Jonquiere, Cities.Alma], cost: 4 },
|
|
161
|
+
{ nodes: [Cities.Alma, Cities.Chicoutimi], cost: 4 },
|
|
162
|
+
{ nodes: [Cities.Jonquiere, Cities.Chicoutimi], cost: 0 },
|
|
163
|
+
{ nodes: [Cities.Chicoutimi, Cities.Baiecomeau], cost: 23 },
|
|
164
|
+
{ nodes: [Cities.Stsimeon, Cities.Baiecomeau], cost: 23 },
|
|
165
|
+
{ nodes: [Cities.Baiecomeau, Cities.Portcartier], cost: 16 },
|
|
166
|
+
{ nodes: [Cities.Septiles, Cities.Portcartier], cost: 6 },
|
|
167
|
+
{ nodes: [Cities.Riviereduloup, Cities.Rimouski], cost: 12 },
|
|
168
|
+
{ nodes: [Cities.Rimouski, Cities.Matane], cost: 11 },
|
|
169
|
+
{ nodes: [Cities.Matane, Cities.Pointealacroix], cost: 15 },
|
|
170
|
+
{ nodes: [Cities.Matane, Cities.Steannedesmonts], cost: 10 },
|
|
171
|
+
{ nodes: [Cities.Pointealacroix, Cities.Steannedesmonts], cost: 16 },
|
|
172
|
+
{ nodes: [Cities.Steannedesmonts, Cities.Gaspe], cost: 21 },
|
|
173
|
+
{ nodes: [Cities.Gaspe, Cities.Pointealacroix], cost: 25 },
|
|
174
|
+
],
|
|
175
|
+
layout: 'Portrait',
|
|
176
|
+
adjustRatio: [0.25, 0.35],
|
|
177
|
+
mapPosition: [-20, 75],
|
|
178
|
+
resupply: [
|
|
179
|
+
[
|
|
180
|
+
[3, 3, 3],
|
|
181
|
+
[4, 4, 3],
|
|
182
|
+
[5, 4, 4],
|
|
183
|
+
[5, 5, 5],
|
|
184
|
+
[7, 6, 6],
|
|
185
|
+
],
|
|
186
|
+
[
|
|
187
|
+
[2, 2, 3],
|
|
188
|
+
[2, 3, 3],
|
|
189
|
+
[3, 4, 4],
|
|
190
|
+
[4, 5, 4],
|
|
191
|
+
[5, 6, 5],
|
|
192
|
+
],
|
|
193
|
+
[
|
|
194
|
+
[1, 2, 3],
|
|
195
|
+
[1, 2, 3],
|
|
196
|
+
[2, 3, 4],
|
|
197
|
+
[3, 3, 5],
|
|
198
|
+
[3, 5, 6],
|
|
199
|
+
],
|
|
200
|
+
[
|
|
201
|
+
[1, 1, 1],
|
|
202
|
+
[1, 1, 1],
|
|
203
|
+
[1, 2, 2],
|
|
204
|
+
[2, 3, 2],
|
|
205
|
+
[2, 3, 3],
|
|
206
|
+
],
|
|
207
|
+
],
|
|
208
|
+
startingResources: [21, 21, 6, 2],
|
|
209
|
+
setupDeck(numPlayers: number, variant: string, rng: seedrandom.prng) {
|
|
210
|
+
let powerPlantsDeck = cloneDeep(powerPlants);
|
|
211
|
+
let actualMarket: PowerPlant[];
|
|
212
|
+
let futureMarket: PowerPlant[];
|
|
213
|
+
|
|
214
|
+
if (variant == 'original') {
|
|
215
|
+
// No ecological plants will be discarded.
|
|
216
|
+
// 13, 18, 22 will be set aside and placed on top of the deck.
|
|
217
|
+
const setAsidePlants = powerPlantsDeck.filter((pp) => [13, 18, 22].includes(pp.number));
|
|
218
|
+
const otherEcoPlants = powerPlantsDeck.filter(
|
|
219
|
+
(pp) =>
|
|
220
|
+
(pp.type == PowerPlantType.Wind || pp.type == PowerPlantType.Nuclear) &&
|
|
221
|
+
![13, 18, 22].includes(pp.number)
|
|
222
|
+
);
|
|
223
|
+
const nonEcoPlantsDeck = powerPlantsDeck.filter(
|
|
224
|
+
(pp) => pp.type != PowerPlantType.Wind && pp.type != PowerPlantType.Nuclear
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
// Remove first eight plants for actual and future market.
|
|
228
|
+
powerPlantsDeck = nonEcoPlantsDeck.slice(8);
|
|
229
|
+
actualMarket = [getPowerPlant(3), getPowerPlant(4), getPowerPlant(5), getPowerPlant(6)];
|
|
230
|
+
futureMarket = [getPowerPlant(7), getPowerPlant(8), getPowerPlant(9), getPowerPlant(10)];
|
|
231
|
+
|
|
232
|
+
// Set aside Step 3 card.
|
|
233
|
+
const step3 = powerPlantsDeck.pop()!;
|
|
234
|
+
|
|
235
|
+
// Remove random plants - this does not include any ecological plants.
|
|
236
|
+
powerPlantsDeck = shuffle(powerPlantsDeck, rng() + '');
|
|
237
|
+
if (numPlayers == 2 || numPlayers == 3) {
|
|
238
|
+
powerPlantsDeck = powerPlantsDeck.slice(8);
|
|
239
|
+
} else if (numPlayers == 4) {
|
|
240
|
+
powerPlantsDeck = powerPlantsDeck.slice(4);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Put back ecological plants and shuffle again.
|
|
244
|
+
powerPlantsDeck = powerPlantsDeck.concat(otherEcoPlants);
|
|
245
|
+
powerPlantsDeck = shuffle(powerPlantsDeck, rng() + '');
|
|
246
|
+
|
|
247
|
+
// Put 13, 18, 22 on top of deck.
|
|
248
|
+
powerPlantsDeck = setAsidePlants.concat(powerPlantsDeck);
|
|
249
|
+
|
|
250
|
+
// Put Step 3 card on the bottom.
|
|
251
|
+
powerPlantsDeck.push(step3);
|
|
252
|
+
} else {
|
|
253
|
+
// No ecological plants will be discarded.
|
|
254
|
+
// For recharged 2 player, remove a random 1 from 3-15 and random 5 from 16-50.
|
|
255
|
+
// For recharged 3 player, remove a random 2 from 3-15 and random 6 from 16-50.
|
|
256
|
+
// For recharged 4 player, remove a random 1 from 3-15 and random 3 from 16-50.
|
|
257
|
+
// Once you have the deck, for recharged the starting 8 are a random 8 from 3-15 (including 13),
|
|
258
|
+
// then a random one from 3-15 on top, then 18, then 22, then the rest of the deck.
|
|
259
|
+
const step3 = powerPlantsDeck.pop()!;
|
|
260
|
+
const powerPlantsDeckLow = powerPlantsDeck.filter((pp) => pp.number >= 3 && pp.number <= 10);
|
|
261
|
+
const plant13 = powerPlantsDeck.filter((pp) => pp.number == 13);
|
|
262
|
+
const otherInitialEcoPlants = powerPlantsDeck.filter((pp) => pp.number == 18 || pp.number == 22);
|
|
263
|
+
const otherEcoPlants = powerPlantsDeck.filter(
|
|
264
|
+
(pp) =>
|
|
265
|
+
![13, 18, 22].includes(pp.number) &&
|
|
266
|
+
(pp.type == PowerPlantType.Wind || pp.type == PowerPlantType.Nuclear)
|
|
267
|
+
);
|
|
268
|
+
let otherPlants1 = powerPlantsDeck.filter(
|
|
269
|
+
(pp) => pp.type != PowerPlantType.Wind && pp.number >= 11 && pp.number <= 15
|
|
270
|
+
);
|
|
271
|
+
let otherPlants2 = powerPlantsDeck.filter(
|
|
272
|
+
(pp) => pp.type != PowerPlantType.Wind && pp.type != PowerPlantType.Nuclear && pp.number >= 16
|
|
273
|
+
);
|
|
274
|
+
if (numPlayers == 2) {
|
|
275
|
+
otherPlants1 = shuffle(otherPlants1, rng() + '').slice(1);
|
|
276
|
+
otherPlants2 = shuffle(otherPlants2, rng() + '').slice(5);
|
|
277
|
+
} else if (numPlayers == 3) {
|
|
278
|
+
otherPlants1 = shuffle(otherPlants1, rng() + '').slice(2);
|
|
279
|
+
otherPlants2 = shuffle(otherPlants2, rng() + '').slice(6);
|
|
280
|
+
} else if (numPlayers == 4) {
|
|
281
|
+
otherPlants1 = shuffle(otherPlants1, rng() + '').slice(1);
|
|
282
|
+
otherPlants2 = shuffle(otherPlants2, rng() + '').slice(3);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const initialPowerPlantOptions = shuffle(
|
|
286
|
+
powerPlantsDeckLow.concat(plant13).concat(otherPlants1),
|
|
287
|
+
rng() + ''
|
|
288
|
+
);
|
|
289
|
+
let initialPlantMarket = initialPowerPlantOptions.splice(0, 8);
|
|
290
|
+
initialPlantMarket = initialPlantMarket.sort((a, b) => a.number - b.number);
|
|
291
|
+
actualMarket = initialPlantMarket.splice(0, 4);
|
|
292
|
+
futureMarket = initialPlantMarket;
|
|
293
|
+
|
|
294
|
+
const topOfDeck = initialPowerPlantOptions.splice(0, 1);
|
|
295
|
+
powerPlantsDeck = initialPowerPlantOptions.concat(otherEcoPlants).concat(otherPlants2);
|
|
296
|
+
powerPlantsDeck = shuffle(powerPlantsDeck, rng() + '');
|
|
297
|
+
powerPlantsDeck = topOfDeck.concat(otherInitialEcoPlants).concat(powerPlantsDeck).concat([step3]);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return { actualMarket, futureMarket, powerPlantsDeck };
|
|
301
|
+
},
|
|
302
|
+
mapSpecificRules:
|
|
303
|
+
'Put power plants 13, 18, 22 on top of the deck. Ecological power plants will never be put on the bottom of the deck.',
|
|
304
|
+
};
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { cloneDeep } from 'lodash';
|
|
2
|
+
import { getPowerPlant } from '../engine';
|
|
3
|
+
import { PowerPlant } from '../gamestate';
|
|
4
|
+
import { powerPlants } from '../powerPlants';
|
|
5
|
+
import { shuffle } from '../utils';
|
|
6
|
+
import { GameMap } from './../maps';
|
|
7
|
+
|
|
8
|
+
export enum Regions {
|
|
9
|
+
Green = 'green',
|
|
10
|
+
Pink = 'pink',
|
|
11
|
+
Red = 'red',
|
|
12
|
+
Yellow = 'yellow',
|
|
13
|
+
Purple = 'purple',
|
|
14
|
+
Brown = 'brown',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export enum Cities {
|
|
18
|
+
Murmansk = 'Murmansk',
|
|
19
|
+
Arkhangelsk = 'Arkhangelsk',
|
|
20
|
+
Syktyvkar = 'Syktyvkar',
|
|
21
|
+
Kirov = 'Kirov',
|
|
22
|
+
Kazan = 'Kazan',
|
|
23
|
+
Cheboksary = 'Cheboksary',
|
|
24
|
+
Ulyanovsk = 'Ulyanovsk',
|
|
25
|
+
Tula = 'Tula',
|
|
26
|
+
Kaliningrad = 'Kaliningrad',
|
|
27
|
+
Ryazan = 'Ryazan',
|
|
28
|
+
Nizhnynovgorod = 'Nizhny Novgorod',
|
|
29
|
+
Moscow = 'Moscow',
|
|
30
|
+
Stpetersburg = 'St Petersburg',
|
|
31
|
+
Yaroslavl = 'Yaroslavl',
|
|
32
|
+
Chita = 'Chita',
|
|
33
|
+
Bratsk = 'Bratsk',
|
|
34
|
+
Krasnoyarsk = 'Krasnoyarsk',
|
|
35
|
+
Kemerovd = 'Kemerovd',
|
|
36
|
+
Novokuznetsk = 'Novokuznetsk',
|
|
37
|
+
Irkutsk = 'Irkutsk',
|
|
38
|
+
Ulanude = 'Ulan Ude',
|
|
39
|
+
Norilsk = 'Norilsk',
|
|
40
|
+
Surgut = 'Surgut',
|
|
41
|
+
Tyumen = 'Tyumen',
|
|
42
|
+
Tomsk = 'Tomsk',
|
|
43
|
+
Novosibirsk = 'Novosibirsk',
|
|
44
|
+
Barnaul = 'Barnaul',
|
|
45
|
+
Omsk = 'Omsk',
|
|
46
|
+
Chelyabinsk = 'Chelyabinsk',
|
|
47
|
+
Ufa = 'Ufa',
|
|
48
|
+
Perm = 'Perm',
|
|
49
|
+
Yekaterinburg = 'Yekaterinburg',
|
|
50
|
+
Orenburg = 'Orenburg',
|
|
51
|
+
Naberezhnyechelny = 'Naberezhnye Chelny',
|
|
52
|
+
Samara = 'Samara',
|
|
53
|
+
Astrakhan = 'Astrakhan',
|
|
54
|
+
Makhachkala = 'Makhachkala',
|
|
55
|
+
Saratov = 'Saratov',
|
|
56
|
+
Volgograd = 'Volgograd',
|
|
57
|
+
Krasnodar = 'Krasnodar',
|
|
58
|
+
Rostov = 'Rostov',
|
|
59
|
+
Voronezh = 'Voronezh',
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const map: GameMap = {
|
|
63
|
+
name: 'Russia',
|
|
64
|
+
cities: [
|
|
65
|
+
{ name: Cities.Murmansk, region: Regions.Green, x: 1574, y: 351 },
|
|
66
|
+
{ name: Cities.Arkhangelsk, region: Regions.Green, x: 1456, y: 695 },
|
|
67
|
+
{ name: Cities.Syktyvkar, region: Regions.Green, x: 1669, y: 1005 },
|
|
68
|
+
{ name: Cities.Kirov, region: Regions.Green, x: 1457, y: 1172 },
|
|
69
|
+
{ name: Cities.Kazan, region: Regions.Green, x: 1378, y: 1478 },
|
|
70
|
+
{ name: Cities.Cheboksary, region: Regions.Green, x: 1200, y: 1328 },
|
|
71
|
+
{ name: Cities.Ulyanovsk, region: Regions.Green, x: 884, y: 1448 },
|
|
72
|
+
{ name: Cities.Tula, region: Regions.Pink, x: 485, y: 1077 },
|
|
73
|
+
{ name: Cities.Kaliningrad, region: Regions.Pink, x: 394, y: 606 },
|
|
74
|
+
{ name: Cities.Ryazan, region: Regions.Pink, x: 793, y: 1193 },
|
|
75
|
+
{ name: Cities.Nizhnynovgorod, region: Regions.Pink, x: 1129, y: 1116 },
|
|
76
|
+
{ name: Cities.Moscow, region: Regions.Pink, x: 763, y: 961 },
|
|
77
|
+
{ name: Cities.Stpetersburg, region: Regions.Pink, x: 883, y: 597 },
|
|
78
|
+
{ name: Cities.Yaroslavl, region: Regions.Pink, x: 1018, y: 915 },
|
|
79
|
+
{ name: Cities.Chita, region: Regions.Red, x: 4168, y: 2048 },
|
|
80
|
+
{ name: Cities.Bratsk, region: Regions.Red, x: 3599, y: 1808 },
|
|
81
|
+
{ name: Cities.Krasnoyarsk, region: Regions.Red, x: 3230, y: 1930 },
|
|
82
|
+
{ name: Cities.Kemerovd, region: Regions.Red, x: 2953, y: 1987 },
|
|
83
|
+
{ name: Cities.Novokuznetsk, region: Regions.Red, x: 3041, y: 2159 },
|
|
84
|
+
{ name: Cities.Irkutsk, region: Regions.Red, x: 3721, y: 2162 },
|
|
85
|
+
{ name: Cities.Ulanude, region: Regions.Red, x: 4030, y: 2228 },
|
|
86
|
+
{ name: Cities.Norilsk, region: Regions.Yellow, x: 3001, y: 856 },
|
|
87
|
+
{ name: Cities.Surgut, region: Regions.Yellow, x: 2348, y: 1411 },
|
|
88
|
+
{ name: Cities.Tyumen, region: Regions.Yellow, x: 2060, y: 1627 },
|
|
89
|
+
{ name: Cities.Tomsk, region: Regions.Yellow, x: 2773, y: 1835 },
|
|
90
|
+
{ name: Cities.Novosibirsk, region: Regions.Yellow, x: 2647, y: 2005 },
|
|
91
|
+
{ name: Cities.Barnaul, region: Regions.Yellow, x: 2662, y: 2191 },
|
|
92
|
+
{ name: Cities.Omsk, region: Regions.Yellow, x: 2195, y: 1957 },
|
|
93
|
+
{ name: Cities.Chelyabinsk, region: Regions.Purple, x: 1768, y: 1865 },
|
|
94
|
+
{ name: Cities.Ufa, region: Regions.Purple, x: 1472, y: 1907 },
|
|
95
|
+
{ name: Cities.Perm, region: Regions.Purple, x: 1688, y: 1388 },
|
|
96
|
+
{ name: Cities.Yekaterinburg, region: Regions.Purple, x: 1757, y: 1620 },
|
|
97
|
+
{ name: Cities.Orenburg, region: Regions.Purple, x: 1250, y: 1997 },
|
|
98
|
+
{ name: Cities.Naberezhnyechelny, region: Regions.Purple, x: 1427, y: 1709 },
|
|
99
|
+
{ name: Cities.Samara, region: Regions.Purple, x: 1132, y: 1701 },
|
|
100
|
+
{ name: Cities.Astrakhan, region: Regions.Brown, x: 619, y: 2092 },
|
|
101
|
+
{ name: Cities.Makhachkala, region: Regions.Brown, x: 317, y: 2262 },
|
|
102
|
+
{ name: Cities.Saratov, region: Regions.Brown, x: 808, y: 1661 },
|
|
103
|
+
{ name: Cities.Volgograd, region: Regions.Brown, x: 589, y: 1795 },
|
|
104
|
+
{ name: Cities.Krasnodar, region: Regions.Brown, x: 260, y: 1865 },
|
|
105
|
+
{ name: Cities.Rostov, region: Regions.Brown, x: 311, y: 1658 },
|
|
106
|
+
{ name: Cities.Voronezh, region: Regions.Brown, x: 485, y: 1409 },
|
|
107
|
+
],
|
|
108
|
+
connections: [
|
|
109
|
+
{ nodes: [Cities.Kaliningrad, Cities.Stpetersburg], cost: 15 },
|
|
110
|
+
{ nodes: [Cities.Stpetersburg, Cities.Murmansk], cost: 19 },
|
|
111
|
+
{ nodes: [Cities.Murmansk, Cities.Arkhangelsk], cost: 15 },
|
|
112
|
+
{ nodes: [Cities.Arkhangelsk, Cities.Stpetersburg], cost: 14 },
|
|
113
|
+
{ nodes: [Cities.Tula, Cities.Kaliningrad], cost: 20 },
|
|
114
|
+
{ nodes: [Cities.Tula, Cities.Moscow], cost: 3 },
|
|
115
|
+
{ nodes: [Cities.Moscow, Cities.Ryazan], cost: 3 },
|
|
116
|
+
{ nodes: [Cities.Ryazan, Cities.Voronezh], cost: 5 },
|
|
117
|
+
{ nodes: [Cities.Voronezh, Cities.Tula], cost: 5 },
|
|
118
|
+
{ nodes: [Cities.Tula, Cities.Stpetersburg], cost: 13 },
|
|
119
|
+
{ nodes: [Cities.Tula, Cities.Ryazan], cost: 0 },
|
|
120
|
+
{ nodes: [Cities.Stpetersburg, Cities.Moscow], cost: 10 },
|
|
121
|
+
{ nodes: [Cities.Moscow, Cities.Yaroslavl], cost: 3 },
|
|
122
|
+
{ nodes: [Cities.Yaroslavl, Cities.Nizhnynovgorod], cost: 4 },
|
|
123
|
+
{ nodes: [Cities.Nizhnynovgorod, Cities.Moscow], cost: 7 },
|
|
124
|
+
{ nodes: [Cities.Yaroslavl, Cities.Stpetersburg], cost: 9 },
|
|
125
|
+
{ nodes: [Cities.Yaroslavl, Cities.Arkhangelsk], cost: 12 },
|
|
126
|
+
{ nodes: [Cities.Arkhangelsk, Cities.Syktyvkar], cost: 10 },
|
|
127
|
+
{ nodes: [Cities.Syktyvkar, Cities.Surgut], cost: 21 },
|
|
128
|
+
{ nodes: [Cities.Perm, Cities.Syktyvkar], cost: 8 },
|
|
129
|
+
{ nodes: [Cities.Syktyvkar, Cities.Kirov], cost: 6 },
|
|
130
|
+
{ nodes: [Cities.Syktyvkar, Cities.Nizhnynovgorod], cost: 11 },
|
|
131
|
+
{ nodes: [Cities.Nizhnynovgorod, Cities.Arkhangelsk], cost: 15 },
|
|
132
|
+
{ nodes: [Cities.Nizhnynovgorod, Cities.Cheboksary], cost: 3 },
|
|
133
|
+
{ nodes: [Cities.Cheboksary, Cities.Ulyanovsk], cost: 4 },
|
|
134
|
+
{ nodes: [Cities.Ulyanovsk, Cities.Voronezh], cost: 11 },
|
|
135
|
+
{ nodes: [Cities.Voronezh, Cities.Volgograd], cost: 8 },
|
|
136
|
+
{ nodes: [Cities.Volgograd, Cities.Saratov], cost: 6 },
|
|
137
|
+
{ nodes: [Cities.Saratov, Cities.Samara], cost: 5 },
|
|
138
|
+
{ nodes: [Cities.Samara, Cities.Ulyanovsk], cost: 3 },
|
|
139
|
+
{ nodes: [Cities.Ulyanovsk, Cities.Kazan], cost: 3 },
|
|
140
|
+
{ nodes: [Cities.Kazan, Cities.Samara], cost: 4 },
|
|
141
|
+
{ nodes: [Cities.Samara, Cities.Naberezhnyechelny], cost: 5 },
|
|
142
|
+
{ nodes: [Cities.Cheboksary, Cities.Kazan], cost: 2 },
|
|
143
|
+
{ nodes: [Cities.Cheboksary, Cities.Kirov], cost: 5 },
|
|
144
|
+
{ nodes: [Cities.Kirov, Cities.Kazan], cost: 5 },
|
|
145
|
+
{ nodes: [Cities.Kazan, Cities.Perm], cost: 8 },
|
|
146
|
+
{ nodes: [Cities.Kazan, Cities.Naberezhnyechelny], cost: 3 },
|
|
147
|
+
{ nodes: [Cities.Naberezhnyechelny, Cities.Ufa], cost: 4 },
|
|
148
|
+
{ nodes: [Cities.Ufa, Cities.Orenburg], cost: 6 },
|
|
149
|
+
{ nodes: [Cities.Orenburg, Cities.Samara], cost: 6 },
|
|
150
|
+
{ nodes: [Cities.Orenburg, Cities.Naberezhnyechelny], cost: 7 },
|
|
151
|
+
{ nodes: [Cities.Ufa, Cities.Chelyabinsk], cost: 8 },
|
|
152
|
+
{ nodes: [Cities.Chelyabinsk, Cities.Yekaterinburg], cost: 3 },
|
|
153
|
+
{ nodes: [Cities.Yekaterinburg, Cities.Perm], cost: 5 },
|
|
154
|
+
{ nodes: [Cities.Perm, Cities.Kirov], cost: 6 },
|
|
155
|
+
{ nodes: [Cities.Chelyabinsk, Cities.Tyumen], cost: 5 },
|
|
156
|
+
{ nodes: [Cities.Tyumen, Cities.Surgut], cost: 10 },
|
|
157
|
+
{ nodes: [Cities.Syktyvkar, Cities.Tyumen], cost: 17 },
|
|
158
|
+
{ nodes: [Cities.Tyumen, Cities.Yekaterinburg], cost: 5 },
|
|
159
|
+
{ nodes: [Cities.Chelyabinsk, Cities.Omsk], cost: 13 },
|
|
160
|
+
{ nodes: [Cities.Omsk, Cities.Tyumen], cost: 9 },
|
|
161
|
+
{ nodes: [Cities.Tyumen, Cities.Tomsk], cost: 19 },
|
|
162
|
+
{ nodes: [Cities.Tomsk, Cities.Surgut], cost: 15 },
|
|
163
|
+
{ nodes: [Cities.Tomsk, Cities.Novosibirsk], cost: 4 },
|
|
164
|
+
{ nodes: [Cities.Novosibirsk, Cities.Barnaul], cost: 4 },
|
|
165
|
+
{ nodes: [Cities.Barnaul, Cities.Omsk], cost: 11 },
|
|
166
|
+
{ nodes: [Cities.Omsk, Cities.Novosibirsk], cost: 10 },
|
|
167
|
+
{ nodes: [Cities.Omsk, Cities.Tomsk], cost: 12 },
|
|
168
|
+
{ nodes: [Cities.Rostov, Cities.Krasnodar], cost: 4 },
|
|
169
|
+
{ nodes: [Cities.Krasnodar, Cities.Volgograd], cost: 9 },
|
|
170
|
+
{ nodes: [Cities.Volgograd, Cities.Astrakhan], cost: 6 },
|
|
171
|
+
{ nodes: [Cities.Krasnodar, Cities.Makhachkala], cost: 14 },
|
|
172
|
+
{ nodes: [Cities.Makhachkala, Cities.Astrakhan], cost: 8 },
|
|
173
|
+
{ nodes: [Cities.Makhachkala, Cities.Volgograd], cost: 11 },
|
|
174
|
+
{ nodes: [Cities.Rostov, Cities.Volgograd], cost: 7 },
|
|
175
|
+
{ nodes: [Cities.Ryazan, Cities.Ulyanovsk], cost: 9 },
|
|
176
|
+
{ nodes: [Cities.Ulyanovsk, Cities.Saratov], cost: 6 },
|
|
177
|
+
{ nodes: [Cities.Saratov, Cities.Voronezh], cost: 8 },
|
|
178
|
+
{ nodes: [Cities.Rostov, Cities.Voronezh], cost: 9 },
|
|
179
|
+
{ nodes: [Cities.Naberezhnyechelny, Cities.Perm], cost: 6 },
|
|
180
|
+
{ nodes: [Cities.Naberezhnyechelny, Cities.Yekaterinburg], cost: 8 },
|
|
181
|
+
{ nodes: [Cities.Ufa, Cities.Yekaterinburg], cost: 6 },
|
|
182
|
+
{ nodes: [Cities.Chita, Cities.Ulanude], cost: 6 },
|
|
183
|
+
{ nodes: [Cities.Ulanude, Cities.Irkutsk], cost: 6 },
|
|
184
|
+
{ nodes: [Cities.Irkutsk, Cities.Novokuznetsk], cost: 21 },
|
|
185
|
+
{ nodes: [Cities.Novokuznetsk, Cities.Kemerovd], cost: 3 },
|
|
186
|
+
{ nodes: [Cities.Kemerovd, Cities.Tomsk], cost: 3 },
|
|
187
|
+
{ nodes: [Cities.Novosibirsk, Cities.Novokuznetsk], cost: 5 },
|
|
188
|
+
{ nodes: [Cities.Novosibirsk, Cities.Kemerovd], cost: 4 },
|
|
189
|
+
{ nodes: [Cities.Novokuznetsk, Cities.Barnaul], cost: 6 },
|
|
190
|
+
{ nodes: [Cities.Kemerovd, Cities.Krasnoyarsk], cost: 7 },
|
|
191
|
+
{ nodes: [Cities.Krasnoyarsk, Cities.Novokuznetsk], cost: 7 },
|
|
192
|
+
{ nodes: [Cities.Krasnoyarsk, Cities.Irkutsk], cost: 17 },
|
|
193
|
+
{ nodes: [Cities.Krasnoyarsk, Cities.Bratsk], cost: 10 },
|
|
194
|
+
{ nodes: [Cities.Bratsk, Cities.Tomsk], cost: 17 },
|
|
195
|
+
{ nodes: [Cities.Bratsk, Cities.Irkutsk], cost: 10 },
|
|
196
|
+
{ nodes: [Cities.Bratsk, Cities.Ulanude], cost: 14 },
|
|
197
|
+
{ nodes: [Cities.Tomsk, Cities.Norilsk], cost: 24 },
|
|
198
|
+
{ nodes: [Cities.Norilsk, Cities.Bratsk], cost: 29 },
|
|
199
|
+
{ nodes: [Cities.Norilsk, Cities.Surgut], cost: 19 },
|
|
200
|
+
],
|
|
201
|
+
adjustRatio: [0.25, 0.25],
|
|
202
|
+
resupply: [
|
|
203
|
+
[
|
|
204
|
+
[2, 2, 4],
|
|
205
|
+
[2, 3, 4],
|
|
206
|
+
[3, 4, 5],
|
|
207
|
+
[4, 5, 6],
|
|
208
|
+
[5, 6, 7],
|
|
209
|
+
],
|
|
210
|
+
[
|
|
211
|
+
[3, 4, 3],
|
|
212
|
+
[3, 4, 3],
|
|
213
|
+
[5, 6, 4],
|
|
214
|
+
[5, 7, 5],
|
|
215
|
+
[7, 9, 6],
|
|
216
|
+
],
|
|
217
|
+
[
|
|
218
|
+
[2, 2, 3],
|
|
219
|
+
[2, 2, 3],
|
|
220
|
+
[3, 3, 4],
|
|
221
|
+
[4, 3, 5],
|
|
222
|
+
[4, 5, 6],
|
|
223
|
+
],
|
|
224
|
+
[
|
|
225
|
+
[1, 1, 1],
|
|
226
|
+
[1, 1, 1],
|
|
227
|
+
[1, 2, 2],
|
|
228
|
+
[2, 3, 2],
|
|
229
|
+
[2, 3, 3],
|
|
230
|
+
],
|
|
231
|
+
],
|
|
232
|
+
startingResources: [18, 24, 0, 7],
|
|
233
|
+
setupDeck(numPlayers: number, variant: string, rng: seedrandom.prng) {
|
|
234
|
+
let powerPlantsDeck = cloneDeep(powerPlants);
|
|
235
|
+
let actualMarket: PowerPlant[] = [];
|
|
236
|
+
let futureMarket: PowerPlant[] = [];
|
|
237
|
+
const step3 = powerPlantsDeck.pop()!;
|
|
238
|
+
|
|
239
|
+
if (variant == 'original') {
|
|
240
|
+
// Set actual and future markets (plant 6 is skipped).
|
|
241
|
+
actualMarket = powerPlantsDeck.filter((p: PowerPlant) => p.number >= 3 && p.number <= 5);
|
|
242
|
+
futureMarket = powerPlantsDeck.filter((p: PowerPlant) => p.number >= 7 && p.number <= 9);
|
|
243
|
+
|
|
244
|
+
// Set aside plants 10, 11, 13.
|
|
245
|
+
const plant10 = getPowerPlant(10);
|
|
246
|
+
const plant11 = getPowerPlant(11);
|
|
247
|
+
const plant13 = getPowerPlant(13);
|
|
248
|
+
|
|
249
|
+
// Shuffle rest of plants (skipping plant 14).
|
|
250
|
+
const mainPlants = powerPlantsDeck.filter((p: PowerPlant) => p.number == 12 || p.number >= 15);
|
|
251
|
+
let mainPlantsShuffled = shuffle(mainPlants, rng() + '');
|
|
252
|
+
|
|
253
|
+
// Remove random set of plants based on number of players.
|
|
254
|
+
if (numPlayers == 2 || numPlayers == 3) {
|
|
255
|
+
mainPlantsShuffled = mainPlantsShuffled.slice(8);
|
|
256
|
+
} else if (numPlayers == 4) {
|
|
257
|
+
mainPlantsShuffled = mainPlantsShuffled.slice(4);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Shuffle top 3 plants from main deck with plants 10 and 11, and place on top of deck.
|
|
261
|
+
let topPlants = mainPlantsShuffled.slice(0, 3).concat(plant10, plant11);
|
|
262
|
+
topPlants = shuffle(topPlants, rng() + '');
|
|
263
|
+
|
|
264
|
+
// Place plant 13 on top of deck, shuffled cards with 10 and 11 next, then the rest of the deck, then the step 3 card.
|
|
265
|
+
powerPlantsDeck = [plant13].concat(topPlants, mainPlantsShuffled.slice(3), step3);
|
|
266
|
+
} else {
|
|
267
|
+
const initialPlants = powerPlantsDeck.filter((p) => p.number <= 15 && p.number != 6 && p.number != 14);
|
|
268
|
+
const initialPlantsShuffled = shuffle(initialPlants, rng() + '');
|
|
269
|
+
|
|
270
|
+
const mainPlants = powerPlantsDeck.filter((p) => p.number >= 16);
|
|
271
|
+
let mainPlantsShuffled = shuffle(mainPlants, rng() + '');
|
|
272
|
+
|
|
273
|
+
if (numPlayers == 2) {
|
|
274
|
+
mainPlantsShuffled = mainPlantsShuffled.slice(6);
|
|
275
|
+
} else if (numPlayers == 3) {
|
|
276
|
+
mainPlantsShuffled = mainPlantsShuffled.slice(8);
|
|
277
|
+
} else if (numPlayers == 4) {
|
|
278
|
+
mainPlantsShuffled = mainPlantsShuffled.slice(4);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
let initialPlantMarket = initialPlantsShuffled.slice(0, 6);
|
|
282
|
+
const otherInitialPlants = initialPlantsShuffled.slice(6);
|
|
283
|
+
initialPlantMarket = initialPlantMarket.sort((a, b) => a.number - b.number);
|
|
284
|
+
actualMarket = initialPlantMarket.slice(0, 3);
|
|
285
|
+
futureMarket = initialPlantMarket.slice(3);
|
|
286
|
+
powerPlantsDeck = otherInitialPlants.concat(mainPlantsShuffled, step3);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return { actualMarket, futureMarket, powerPlantsDeck };
|
|
290
|
+
},
|
|
291
|
+
mapSpecificRules: 'The power plant market is restricted, and the rules for removing old plants are changed.',
|
|
292
|
+
};
|