@gamepark/zenith 0.0.2 → 0.1.0

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.
Files changed (63) hide show
  1. package/dist/PlayerId.js +1 -2
  2. package/dist/TeamColor.js +7 -13
  3. package/dist/ZenithOptions.js +1 -4
  4. package/dist/ZenithRules.js +71 -122
  5. package/dist/ZenithSetup.js +123 -266
  6. package/dist/index.js +3 -9
  7. package/dist/material/Agent.js +4 -7
  8. package/dist/material/Agents.js +920 -923
  9. package/dist/material/Bonus.js +5 -8
  10. package/dist/material/Bonuses.js +29 -33
  11. package/dist/material/Credit.js +4 -7
  12. package/dist/material/Faction.js +4 -7
  13. package/dist/material/Influence.js +4 -7
  14. package/dist/material/LocationType.js +2 -5
  15. package/dist/material/MaterialType.js +2 -5
  16. package/dist/material/effect/Effect.js +5 -10
  17. package/dist/material/effect/EffectType.js +2 -5
  18. package/dist/rules/CustomMoveType.js +2 -5
  19. package/dist/rules/DiscardActionRule.js +26 -75
  20. package/dist/rules/Memory.js +2 -5
  21. package/dist/rules/MulliganRule.js +47 -126
  22. package/dist/rules/PlayCardRule.js +68 -134
  23. package/dist/rules/RefillRule.js +83 -190
  24. package/dist/rules/RuleId.js +2 -5
  25. package/dist/rules/discard-action/DiplomacyActions.js +15 -20
  26. package/dist/rules/discard-action/DiplomacyBoardRule.js +27 -64
  27. package/dist/rules/discard-action/TechnologyActions.js +44 -48
  28. package/dist/rules/discard-action/TechnologyBoardRule.js +34 -102
  29. package/dist/rules/effect/ChoiceRule.js +21 -81
  30. package/dist/rules/effect/ConditionalRule.js +77 -141
  31. package/dist/rules/effect/DevelopTechnologyRule.js +53 -119
  32. package/dist/rules/effect/DiscardRule.js +37 -90
  33. package/dist/rules/effect/EffectRule.js +60 -138
  34. package/dist/rules/effect/ExileRule.js +62 -147
  35. package/dist/rules/effect/GiveCreditRule.js +24 -73
  36. package/dist/rules/effect/GiveInfluenceRule.js +38 -101
  37. package/dist/rules/effect/GiveLeaderBadgeRule.js +18 -46
  38. package/dist/rules/effect/GiveZenithiumRule.js +25 -79
  39. package/dist/rules/effect/MobilizeRule.js +38 -93
  40. package/dist/rules/effect/ResetInfluenceRule.js +21 -58
  41. package/dist/rules/effect/SpendCreditRule.js +29 -102
  42. package/dist/rules/effect/SpendZenithiumRule.js +32 -109
  43. package/dist/rules/effect/StealCreditRule.js +15 -64
  44. package/dist/rules/effect/TakeBonusRule.js +30 -91
  45. package/dist/rules/effect/TakeLeaderBadgeRule.js +31 -88
  46. package/dist/rules/effect/TakeTechnologyBonusTokenRule.js +45 -112
  47. package/dist/rules/effect/TransferRule.js +47 -81
  48. package/dist/rules/effect/WinCreditRule.js +60 -130
  49. package/dist/rules/effect/WinInfluenceRule.js +128 -248
  50. package/dist/rules/effect/WinZenithiumRule.js +24 -80
  51. package/dist/rules/effect/index.js +19 -35
  52. package/dist/rules/helper/BonusHelper.js +32 -64
  53. package/dist/rules/helper/CreditHelper.js +19 -44
  54. package/dist/rules/helper/EffectHelper.js +81 -123
  55. package/dist/rules/helper/EffectRuleIds.js +25 -29
  56. package/dist/rules/helper/EndGameHelper.js +24 -57
  57. package/dist/rules/helper/InfluenceHelper.js +18 -44
  58. package/dist/rules/helper/MobilizeHelper.js +27 -53
  59. package/dist/rules/helper/PlanetHelper.js +45 -78
  60. package/dist/rules/helper/PlayerHelper.js +24 -60
  61. package/dist/rules/helper/TechnologyHelper.js +31 -87
  62. package/dist/rules/helper/ZenithiumHelper.js +25 -48
  63. package/package.json +4 -3
@@ -1,286 +1,175 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- var __read = (this && this.__read) || function (o, n) {
29
- var m = typeof Symbol === "function" && o[Symbol.iterator];
30
- if (!m) return o;
31
- var i = m.call(o), r, ar = [], e;
32
- try {
33
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
34
- }
35
- catch (error) { e = { error: error }; }
36
- finally {
37
- try {
38
- if (r && !r.done && (m = i["return"])) m.call(i);
39
- }
40
- finally { if (e) throw e.error; }
41
- }
42
- return ar;
43
- };
44
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
45
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
46
- if (ar || !(i in from)) {
47
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
48
- ar[i] = from[i];
49
- }
50
- }
51
- return to.concat(ar || Array.prototype.slice.call(from));
52
- };
53
- var __values = (this && this.__values) || function(o) {
54
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
55
- if (m) return m.call(o);
56
- if (o && typeof o.length === "number") return {
57
- next: function () {
58
- if (o && i >= o.length) o = void 0;
59
- return { value: o && o[i++], done: !o };
60
- }
61
- };
62
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
63
- };
64
- Object.defineProperty(exports, "__esModule", { value: true });
65
- exports.WinInfluenceRule = void 0;
66
- var rules_api_1 = require("@gamepark/rules-api");
67
- var Influence_1 = require("../../material/Influence");
68
- var LocationType_1 = require("../../material/LocationType");
69
- var MaterialType_1 = require("../../material/MaterialType");
70
- var TeamColor_1 = require("../../TeamColor");
71
- var BonusHelper_1 = require("../helper/BonusHelper");
72
- var EndGameHelper_1 = require("../helper/EndGameHelper");
73
- var Memory_1 = require("../Memory");
74
- var index_1 = require("./index");
75
- var WinInfluenceRule = (function (_super) {
76
- __extends(WinInfluenceRule, _super);
77
- function WinInfluenceRule() {
78
- return _super !== null && _super.apply(this, arguments) || this;
79
- }
80
- WinInfluenceRule.prototype.onRuleStart = function () {
81
- var moves = _super.prototype.onRuleStart.call(this);
1
+ import { isMoveItemType } from '@gamepark/rules-api';
2
+ import { influences } from '../../material/Influence';
3
+ import { LocationType } from '../../material/LocationType';
4
+ import { MaterialType } from '../../material/MaterialType';
5
+ import { TeamColor } from '../../TeamColor';
6
+ import { BonusHelper } from '../helper/BonusHelper';
7
+ import { EndGameHelper } from '../helper/EndGameHelper';
8
+ import { Memory } from '../Memory';
9
+ import { EffectRule } from './index';
10
+ export class WinInfluenceRule extends EffectRule {
11
+ onRuleStart() {
12
+ const moves = super.onRuleStart();
82
13
  if (moves.length > 0)
83
14
  return moves;
84
15
  if (this.effect.resetDifferentPlanet) {
85
- this.forget(Memory_1.Memory.LastPlanetsMoved);
16
+ this.forget(Memory.LastPlanetsMoved);
86
17
  }
87
18
  if (this.effect.influence) {
88
19
  return this.getPlayerMoves();
89
20
  }
90
21
  return [];
91
- };
92
- Object.defineProperty(WinInfluenceRule.prototype, "planets", {
93
- get: function () {
94
- var _this = this;
95
- var planets = this.material(MaterialType_1.MaterialType.InfluenceDisc)
96
- .location(LocationType_1.LocationType.PlanetBoardInfluenceDiscSpace)
97
- .filter(function (item) {
98
- if (_this.effect.except)
99
- return item.id !== _this.effect.except;
100
- if (_this.effect.differentPlanet)
101
- return !_this.isAlreadyPlayed(item.id);
102
- return true;
103
- });
104
- if (!planets.length)
105
- return planets;
106
- if (this.effect.fromCenter) {
107
- return this.fromCenterPlanets(planets);
108
- }
109
- else if (this.effect.opponentSide) {
110
- return this.opponentSidePlanets(planets);
111
- }
112
- else if (this.effect.influence) {
113
- return this.influencePlanet(planets);
114
- }
22
+ }
23
+ get planets() {
24
+ const planets = this.material(MaterialType.InfluenceDisc)
25
+ .location(LocationType.PlanetBoardInfluenceDiscSpace)
26
+ .filter((item) => {
27
+ if (this.effect.except)
28
+ return item.id !== this.effect.except;
29
+ if (this.effect.differentPlanet)
30
+ return !this.isAlreadyPlayed(item.id);
31
+ return true;
32
+ });
33
+ if (!planets.length)
115
34
  return planets;
116
- },
117
- enumerable: false,
118
- configurable: true
119
- });
120
- WinInfluenceRule.prototype.patternPlanet = function () {
121
- var e_1, _a;
122
- var _this = this;
123
- var _b;
124
- var pattern = this.effect.pattern;
125
- var planets = this.planets;
126
- var movedPlanets = (_b = this.remind(Memory_1.Memory.Pattern)) !== null && _b !== void 0 ? _b : [];
35
+ if (this.effect.fromCenter) {
36
+ return this.fromCenterPlanets(planets);
37
+ }
38
+ else if (this.effect.opponentSide) {
39
+ return this.opponentSidePlanets(planets);
40
+ }
41
+ else if (this.effect.influence) {
42
+ return this.influencePlanet(planets);
43
+ }
44
+ return planets;
45
+ }
46
+ patternPlanet() {
47
+ const pattern = this.effect.pattern;
48
+ const planets = this.planets;
49
+ const movedPlanets = this.remind(Memory.Pattern) ?? [];
127
50
  if (!pattern)
128
51
  return [];
129
- var moves = [];
130
- var possiblePatterns = this.computePossiblePatterns().filter(function (patternType) {
52
+ const moves = [];
53
+ const possiblePatterns = this.computePossiblePatterns().filter((patternType) => {
131
54
  if (!movedPlanets.length)
132
55
  return true;
133
- return movedPlanets.every(function (m) { return patternType.some(function (p) { return p.influence === m.influence && p.count === m.count; }); });
56
+ return movedPlanets.every((m) => patternType.some((p) => p.influence === m.influence && p.count === m.count));
134
57
  });
135
- var _loop_1 = function (planetIndex) {
136
- var material = planets.index(planetIndex);
137
- var item = planets.getItem(planetIndex);
138
- if (movedPlanets.some(function (patternType) { return patternType.influence === item.id; }))
139
- return "continue";
140
- var planetPossiblePatterns = possiblePatterns
141
- .filter(function (patternType) { return patternType.some(function (p) { return p.influence === item.id; }); })
142
- .map(function (patternType) { return patternType.find(function (p) { return p.influence === item.id; }); });
143
- moves.push.apply(moves, __spreadArray([], __read(planetPossiblePatterns.map(function (type) {
144
- return material.moveItem(__assign(__assign({}, item.location), { x: _this.getPositionForQuantity(item, type.count) }));
145
- })), false));
146
- };
147
- try {
148
- for (var _c = __values(planets.getIndexes()), _d = _c.next(); !_d.done; _d = _c.next()) {
149
- var planetIndex = _d.value;
150
- _loop_1(planetIndex);
151
- }
152
- }
153
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
154
- finally {
155
- try {
156
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
157
- }
158
- finally { if (e_1) throw e_1.error; }
58
+ for (const planetIndex of planets.getIndexes()) {
59
+ const material = planets.index(planetIndex);
60
+ const item = planets.getItem(planetIndex);
61
+ if (movedPlanets.some((patternType) => patternType.influence === item.id))
62
+ continue;
63
+ const planetPossiblePatterns = possiblePatterns
64
+ .filter((patternType) => patternType.some((p) => p.influence === item.id))
65
+ .map((patternType) => patternType.find((p) => p.influence === item.id));
66
+ moves.push(...planetPossiblePatterns.map((type) => material.moveItem({
67
+ ...item.location,
68
+ x: this.getPositionForQuantity(item, type.count)
69
+ })));
159
70
  }
160
71
  return moves;
161
- };
162
- WinInfluenceRule.prototype.computePossiblePatterns = function () {
163
- var pattern = this.effect.pattern;
72
+ }
73
+ computePossiblePatterns() {
74
+ const pattern = this.effect.pattern;
164
75
  if (!pattern)
165
76
  return [];
166
- var patterns = [];
167
- for (var i = 1; i <= Influence_1.influences.length - (pattern.length - 1); i++) {
168
- var patternInfluences = Influence_1.influences.slice(i - 1, i + pattern.length - 1);
169
- patterns.push(patternInfluences.map(function (i, index) { return ({ influence: i, count: pattern[index] }); }));
77
+ const patterns = [];
78
+ for (let i = 1; i <= influences.length - (pattern.length - 1); i++) {
79
+ const patternInfluences = influences.slice(i - 1, i + pattern.length - 1);
80
+ patterns.push(patternInfluences.map((i, index) => ({ influence: i, count: pattern[index] })));
170
81
  }
171
82
  return patterns;
172
- };
173
- WinInfluenceRule.prototype.influencePlanet = function (planets) {
83
+ }
84
+ influencePlanet(planets) {
174
85
  return planets.id(this.effect.influence);
175
- };
176
- WinInfluenceRule.prototype.opponentSidePlanets = function (planets) {
177
- var _this = this;
178
- var opponentSidePlanets = planets.filter(function (planet) { return (_this.playerHelper.team === TeamColor_1.TeamColor.White ? planet.location.x < 0 : planet.location.x > 0); });
86
+ }
87
+ opponentSidePlanets(planets) {
88
+ const opponentSidePlanets = planets.filter((planet) => (this.playerHelper.team === TeamColor.White ? planet.location.x < 0 : planet.location.x > 0));
179
89
  if (!opponentSidePlanets.length)
180
90
  return opponentSidePlanets;
181
91
  if (this.effect.influence)
182
92
  return opponentSidePlanets.id(this.effect.influence);
183
93
  return opponentSidePlanets;
184
- };
185
- WinInfluenceRule.prototype.fromCenterPlanets = function (planets) {
186
- var centeredPlanets = planets.filter(function (planet) { return planet.location.x === 0; });
94
+ }
95
+ fromCenterPlanets(planets) {
96
+ const centeredPlanets = planets.filter((planet) => planet.location.x === 0);
187
97
  if (!centeredPlanets.length)
188
98
  return centeredPlanets;
189
99
  if (this.effect.influence)
190
100
  return centeredPlanets.id(this.effect.influence);
191
101
  return centeredPlanets;
192
- };
193
- WinInfluenceRule.prototype.getPositionAfterPull = function (item, effect) {
194
- var _a;
102
+ }
103
+ getPositionAfterPull(item, effect) {
195
104
  if (effect.times) {
196
- var positions = [];
197
- for (var i = 1; i <= effect.times; i++) {
198
- var newPosition = item.location.x + i;
199
- if (this.player === TeamColor_1.TeamColor.Black && newPosition > 4)
105
+ const positions = [];
106
+ for (let i = 1; i <= effect.times; i++) {
107
+ const newPosition = item.location.x + i;
108
+ if (this.player === TeamColor.Black && newPosition > 4)
200
109
  break;
201
- if (this.player === TeamColor_1.TeamColor.White && newPosition < -4)
110
+ if (this.player === TeamColor.White && newPosition < -4)
202
111
  break;
203
112
  positions.push(newPosition);
204
113
  }
205
114
  return positions;
206
115
  }
207
- return [this.getPositionForQuantity(item, (_a = effect.quantity) !== null && _a !== void 0 ? _a : 1)];
208
- };
209
- WinInfluenceRule.prototype.getPositionForQuantity = function (item, quantity) {
210
- if (this.player === TeamColor_1.TeamColor.Black) {
116
+ return [this.getPositionForQuantity(item, effect.quantity ?? 1)];
117
+ }
118
+ getPositionForQuantity(item, quantity) {
119
+ if (this.player === TeamColor.Black) {
211
120
  return Math.min(4, item.location.x + quantity);
212
121
  }
213
122
  return Math.max(-4, item.location.x - quantity);
214
- };
215
- WinInfluenceRule.prototype.getPlayerMoves = function () {
216
- var e_2, _a;
217
- var effect = this.effect;
218
- var planets = this.planets;
123
+ }
124
+ getPlayerMoves() {
125
+ const effect = this.effect;
126
+ const planets = this.planets;
219
127
  if (this.effect.pattern) {
220
128
  return this.patternPlanet();
221
129
  }
222
- var moves = [];
223
- var _loop_2 = function (index) {
224
- var item = planets.getItem(index);
225
- var positions = this_1.getPositionAfterPull(item, effect);
226
- moves.push.apply(moves, __spreadArray([], __read(positions.map(function (x) {
227
- return planets.index(index).moveItem(__assign(__assign({}, item.location), { x: x }));
228
- })), false));
229
- };
230
- var this_1 = this;
231
- try {
232
- for (var _b = __values(planets.getIndexes()), _c = _b.next(); !_c.done; _c = _b.next()) {
233
- var index = _c.value;
234
- _loop_2(index);
235
- }
236
- }
237
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
238
- finally {
239
- try {
240
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
241
- }
242
- finally { if (e_2) throw e_2.error; }
130
+ const moves = [];
131
+ for (const index of planets.getIndexes()) {
132
+ const item = planets.getItem(index);
133
+ const positions = this.getPositionAfterPull(item, effect);
134
+ moves.push(...positions.map((x) => planets.index(index).moveItem({
135
+ ...item.location,
136
+ x: x
137
+ })));
243
138
  }
244
139
  return moves;
245
- };
246
- WinInfluenceRule.prototype.beforeItemMove = function (move) {
247
- if (!(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.InfluenceDisc)(move) || move.location.type !== LocationType_1.LocationType.PlanetBoardInfluenceDiscSpace)
140
+ }
141
+ beforeItemMove(move) {
142
+ if (!isMoveItemType(MaterialType.InfluenceDisc)(move) || move.location.type !== LocationType.PlanetBoardInfluenceDiscSpace)
248
143
  return [];
249
- var planet = this.material(MaterialType_1.MaterialType.InfluenceDisc).index(move.itemIndex);
250
- var item = planet.getItem();
251
- this.memorize(Memory_1.Memory.LastPlanetsMoved, function (planets) {
252
- if (planets === void 0) { planets = []; }
253
- return planets.concat(item.id);
254
- });
255
- var moves = [];
256
- var effect = this.effect;
144
+ const planet = this.material(MaterialType.InfluenceDisc).index(move.itemIndex);
145
+ const item = planet.getItem();
146
+ this.memorize(Memory.LastPlanetsMoved, (planets = []) => planets.concat(item.id));
147
+ const moves = [];
148
+ const effect = this.effect;
257
149
  if (Math.abs(move.location.x) === 4) {
258
- var helper = new EndGameHelper_1.EndGameHelper(this.game);
259
- var planets = this.material(MaterialType_1.MaterialType.InfluenceDisc).index(__spreadArray(__spreadArray([], __read(helper.getTeamPlanet(this.playerHelper.team).getIndexes()), false), [planet.getIndex()], false));
260
- moves.push.apply(moves, __spreadArray([], __read(planet.moveItems({
261
- type: LocationType_1.LocationType.TeamPlanets,
150
+ const helper = new EndGameHelper(this.game);
151
+ const planets = this.material(MaterialType.InfluenceDisc).index([...helper.getTeamPlanet(this.playerHelper.team).getIndexes(), planet.getIndex()]);
152
+ moves.push(...planet.moveItems({
153
+ type: LocationType.TeamPlanets,
262
154
  player: this.playerHelper.team
263
- })), false));
155
+ }));
264
156
  if (helper.willEnd(this.playerHelper.team, planets)) {
265
157
  moves.push(this.endGame());
266
158
  return moves;
267
159
  }
268
160
  else {
269
- moves.push.apply(moves, __spreadArray([], __read(new BonusHelper_1.BonusHelper(this.game).applyInfluenceBonus(item.id)), false));
161
+ moves.push(...new BonusHelper(this.game).applyInfluenceBonus(item.id));
270
162
  }
271
163
  }
272
164
  if (effect.times) {
273
- var consumed = move.location.x - item.location.x;
165
+ const consumed = move.location.x - item.location.x;
274
166
  effect.times -= consumed;
275
167
  if (effect.times > 0)
276
168
  return moves;
277
169
  }
278
170
  else if (effect.pattern) {
279
- this.memorize(Memory_1.Memory.Pattern, function (patternTypes) {
280
- if (patternTypes === void 0) { patternTypes = []; }
281
- return patternTypes.concat({ influence: item.id, count: Math.abs(move.location.x - item.location.x) });
282
- });
283
- var patternMoves = this.patternPlanet();
171
+ this.memorize(Memory.Pattern, (patternTypes = []) => patternTypes.concat({ influence: item.id, count: Math.abs(move.location.x - item.location.x) }));
172
+ const patternMoves = this.patternPlanet();
284
173
  if (patternMoves.length > 0 && patternMoves.length <= effect.pattern.length - 1) {
285
174
  moves.push(this.patternPlanet()[0]);
286
175
  return moves;
@@ -289,40 +178,31 @@ var WinInfluenceRule = (function (_super) {
289
178
  return moves;
290
179
  }
291
180
  this.removeFirstEffect();
292
- moves.push.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
181
+ moves.push(...this.afterEffectPlayed());
293
182
  return moves;
294
- };
295
- WinInfluenceRule.prototype.isAlreadyPlayed = function (influence) {
296
- var _a;
297
- return (_a = this.lastPlanetsMoved) === null || _a === void 0 ? void 0 : _a.includes(influence);
298
- };
299
- WinInfluenceRule.prototype.isPossible = function () {
183
+ }
184
+ isAlreadyPlayed(influence) {
185
+ return this.lastPlanetsMoved?.includes(influence);
186
+ }
187
+ isPossible() {
300
188
  return this.planets.length > 0;
301
- };
302
- Object.defineProperty(WinInfluenceRule.prototype, "lastPlanetsMoved", {
303
- get: function () {
304
- return this.remind(Memory_1.Memory.LastPlanetsMoved);
305
- },
306
- enumerable: false,
307
- configurable: true
308
- });
309
- WinInfluenceRule.prototype.setExtraData = function (_extraData) {
310
- var _a, _b;
311
- var _c, _d;
189
+ }
190
+ get lastPlanetsMoved() {
191
+ return this.remind(Memory.LastPlanetsMoved);
192
+ }
193
+ setExtraData(_extraData) {
312
194
  if (_extraData.quantity) {
313
- (_a = (_c = this.effect).quantity) !== null && _a !== void 0 ? _a : (_c.quantity = _extraData.quantity);
195
+ this.effect.quantity ??= _extraData.quantity;
314
196
  }
315
197
  if (_extraData.factor) {
316
198
  this.effect.times = _extraData.factor;
317
199
  }
318
200
  if (_extraData.influence) {
319
- (_b = (_d = this.effect).influence) !== null && _b !== void 0 ? _b : (_d.influence = _extraData.influence);
201
+ this.effect.influence ??= _extraData.influence;
320
202
  }
321
- };
322
- WinInfluenceRule.prototype.onRuleEnd = function () {
323
- this.forget(Memory_1.Memory.Pattern);
203
+ }
204
+ onRuleEnd() {
205
+ this.forget(Memory.Pattern);
324
206
  return [];
325
- };
326
- return WinInfluenceRule;
327
- }(index_1.EffectRule));
328
- exports.WinInfluenceRule = WinInfluenceRule;
207
+ }
208
+ }
@@ -1,92 +1,36 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __read = (this && this.__read) || function (o, n) {
18
- var m = typeof Symbol === "function" && o[Symbol.iterator];
19
- if (!m) return o;
20
- var i = m.call(o), r, ar = [], e;
21
- try {
22
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
23
- }
24
- catch (error) { e = { error: error }; }
25
- finally {
26
- try {
27
- if (r && !r.done && (m = i["return"])) m.call(i);
28
- }
29
- finally { if (e) throw e.error; }
30
- }
31
- return ar;
32
- };
33
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
34
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
35
- if (ar || !(i in from)) {
36
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
37
- ar[i] = from[i];
38
- }
39
- }
40
- return to.concat(ar || Array.prototype.slice.call(from));
41
- };
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.WinZenithiumRule = void 0;
44
- var LocationType_1 = require("../../material/LocationType");
45
- var MaterialType_1 = require("../../material/MaterialType");
46
- var Memory_1 = require("../Memory");
47
- var index_1 = require("./index");
48
- var WinZenithiumRule = (function (_super) {
49
- __extends(WinZenithiumRule, _super);
50
- function WinZenithiumRule() {
51
- return _super !== null && _super.apply(this, arguments) || this;
52
- }
53
- WinZenithiumRule.prototype.onRuleStart = function () {
54
- var _a, _b;
55
- var moves = _super.prototype.onRuleStart.call(this);
1
+ import { LocationType } from '../../material/LocationType';
2
+ import { MaterialType } from '../../material/MaterialType';
3
+ import { Memory } from '../Memory';
4
+ import { EffectRule } from './index';
5
+ export class WinZenithiumRule extends EffectRule {
6
+ onRuleStart() {
7
+ const moves = super.onRuleStart();
56
8
  if (moves.length > 0)
57
9
  return moves;
58
- this.memorize(Memory_1.Memory.Zenithium, (_a = this.effect.quantity) !== null && _a !== void 0 ? _a : 1);
59
- this.memorize(Memory_1.Memory.CurrentEffect, JSON.parse(JSON.stringify(this.effect)));
10
+ this.memorize(Memory.Zenithium, this.effect.quantity ?? 1);
11
+ this.memorize(Memory.CurrentEffect, JSON.parse(JSON.stringify(this.effect)));
60
12
  moves.push(this.zenithium.createItem({
61
13
  location: {
62
- type: LocationType_1.LocationType.TeamZenithium,
14
+ type: LocationType.TeamZenithium,
63
15
  player: this.effect.opponent ? this.opponentTeam : this.playerHelper.team
64
16
  },
65
- quantity: (_b = this.effect.quantity) !== null && _b !== void 0 ? _b : 1
17
+ quantity: this.effect.quantity ?? 1
66
18
  }));
67
19
  this.removeFirstEffect();
68
- moves.push.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
20
+ moves.push(...this.afterEffectPlayed());
69
21
  return moves;
70
- };
71
- WinZenithiumRule.prototype.setExtraData = function (_extraData) {
72
- var _a;
73
- var _b;
22
+ }
23
+ setExtraData(_extraData) {
74
24
  if (_extraData.quantity) {
75
- (_a = (_b = this.effect).quantity) !== null && _a !== void 0 ? _a : (_b.quantity = _extraData.quantity);
25
+ this.effect.quantity ??= _extraData.quantity;
76
26
  }
77
- };
78
- Object.defineProperty(WinZenithiumRule.prototype, "zenithium", {
79
- get: function () {
80
- return this.material(MaterialType_1.MaterialType.ZenithiumToken).location(LocationType_1.LocationType.TeamZenithium).player(this.playerHelper.team);
81
- },
82
- enumerable: false,
83
- configurable: true
84
- });
85
- WinZenithiumRule.prototype.onRuleEnd = function () {
86
- this.forget(Memory_1.Memory.Zenithium);
87
- this.forget(Memory_1.Memory.CurrentEffect);
27
+ }
28
+ get zenithium() {
29
+ return this.material(MaterialType.ZenithiumToken).location(LocationType.TeamZenithium).player(this.playerHelper.team);
30
+ }
31
+ onRuleEnd() {
32
+ this.forget(Memory.Zenithium);
33
+ this.forget(Memory.CurrentEffect);
88
34
  return [];
89
- };
90
- return WinZenithiumRule;
91
- }(index_1.EffectRule));
92
- exports.WinZenithiumRule = WinZenithiumRule;
35
+ }
36
+ }
@@ -1,35 +1,19 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./EffectRule"), exports);
18
- __exportStar(require("./ChoiceRule"), exports);
19
- __exportStar(require("./ConditionalRule"), exports);
20
- __exportStar(require("./DevelopTechnologyRule"), exports);
21
- __exportStar(require("./DiscardRule"), exports);
22
- __exportStar(require("./ExileRule"), exports);
23
- __exportStar(require("./GiveCreditRule"), exports);
24
- __exportStar(require("./GiveInfluenceRule"), exports);
25
- __exportStar(require("./GiveLeaderBadgeRule"), exports);
26
- __exportStar(require("./GiveZenithiumRule"), exports);
27
- __exportStar(require("./MobilizeRule"), exports);
28
- __exportStar(require("./ResetInfluenceRule"), exports);
29
- __exportStar(require("./SpendCreditRule"), exports);
30
- __exportStar(require("./TakeBonusRule"), exports);
31
- __exportStar(require("./TakeLeaderBadgeRule"), exports);
32
- __exportStar(require("./TransferRule"), exports);
33
- __exportStar(require("./WinCreditRule"), exports);
34
- __exportStar(require("./WinInfluenceRule"), exports);
35
- __exportStar(require("./WinZenithiumRule"), exports);
1
+ export * from './EffectRule';
2
+ export * from './ChoiceRule';
3
+ export * from './ConditionalRule';
4
+ export * from './DevelopTechnologyRule';
5
+ export * from './DiscardRule';
6
+ export * from './ExileRule';
7
+ export * from './GiveCreditRule';
8
+ export * from './GiveInfluenceRule';
9
+ export * from './GiveLeaderBadgeRule';
10
+ export * from './GiveZenithiumRule';
11
+ export * from './MobilizeRule';
12
+ export * from './ResetInfluenceRule';
13
+ export * from './SpendCreditRule';
14
+ export * from './TakeBonusRule';
15
+ export * from './TakeLeaderBadgeRule';
16
+ export * from './TransferRule';
17
+ export * from './WinCreditRule';
18
+ export * from './WinInfluenceRule';
19
+ export * from './WinZenithiumRule';