@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.
- package/dist/PlayerId.js +1 -2
- package/dist/TeamColor.js +7 -13
- package/dist/ZenithOptions.js +1 -4
- package/dist/ZenithRules.js +71 -122
- package/dist/ZenithSetup.js +123 -266
- package/dist/index.js +3 -9
- package/dist/material/Agent.js +4 -7
- package/dist/material/Agents.js +920 -923
- package/dist/material/Bonus.js +5 -8
- package/dist/material/Bonuses.js +29 -33
- package/dist/material/Credit.js +4 -7
- package/dist/material/Faction.js +4 -7
- package/dist/material/Influence.js +4 -7
- package/dist/material/LocationType.js +2 -5
- package/dist/material/MaterialType.js +2 -5
- package/dist/material/effect/Effect.js +5 -10
- package/dist/material/effect/EffectType.js +2 -5
- package/dist/rules/CustomMoveType.js +2 -5
- package/dist/rules/DiscardActionRule.js +26 -75
- package/dist/rules/Memory.js +2 -5
- package/dist/rules/MulliganRule.js +47 -126
- package/dist/rules/PlayCardRule.js +68 -134
- package/dist/rules/RefillRule.js +83 -190
- package/dist/rules/RuleId.js +2 -5
- package/dist/rules/discard-action/DiplomacyActions.js +15 -20
- package/dist/rules/discard-action/DiplomacyBoardRule.js +27 -64
- package/dist/rules/discard-action/TechnologyActions.js +44 -48
- package/dist/rules/discard-action/TechnologyBoardRule.js +34 -102
- package/dist/rules/effect/ChoiceRule.js +21 -81
- package/dist/rules/effect/ConditionalRule.js +77 -141
- package/dist/rules/effect/DevelopTechnologyRule.js +53 -119
- package/dist/rules/effect/DiscardRule.js +37 -90
- package/dist/rules/effect/EffectRule.js +60 -138
- package/dist/rules/effect/ExileRule.js +62 -147
- package/dist/rules/effect/GiveCreditRule.js +24 -73
- package/dist/rules/effect/GiveInfluenceRule.js +38 -101
- package/dist/rules/effect/GiveLeaderBadgeRule.js +18 -46
- package/dist/rules/effect/GiveZenithiumRule.js +25 -79
- package/dist/rules/effect/MobilizeRule.js +38 -93
- package/dist/rules/effect/ResetInfluenceRule.js +21 -58
- package/dist/rules/effect/SpendCreditRule.js +29 -102
- package/dist/rules/effect/SpendZenithiumRule.js +32 -109
- package/dist/rules/effect/StealCreditRule.js +15 -64
- package/dist/rules/effect/TakeBonusRule.js +30 -91
- package/dist/rules/effect/TakeLeaderBadgeRule.js +31 -88
- package/dist/rules/effect/TakeTechnologyBonusTokenRule.js +45 -112
- package/dist/rules/effect/TransferRule.js +47 -81
- package/dist/rules/effect/WinCreditRule.js +60 -130
- package/dist/rules/effect/WinInfluenceRule.js +128 -248
- package/dist/rules/effect/WinZenithiumRule.js +24 -80
- package/dist/rules/effect/index.js +19 -35
- package/dist/rules/helper/BonusHelper.js +32 -64
- package/dist/rules/helper/CreditHelper.js +19 -44
- package/dist/rules/helper/EffectHelper.js +81 -123
- package/dist/rules/helper/EffectRuleIds.js +25 -29
- package/dist/rules/helper/EndGameHelper.js +24 -57
- package/dist/rules/helper/InfluenceHelper.js +18 -44
- package/dist/rules/helper/MobilizeHelper.js +27 -53
- package/dist/rules/helper/PlanetHelper.js +45 -78
- package/dist/rules/helper/PlayerHelper.js +24 -60
- package/dist/rules/helper/TechnologyHelper.js +31 -87
- package/dist/rules/helper/ZenithiumHelper.js +25 -48
- package/package.json +4 -3
|
@@ -1,286 +1,175 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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(
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
|
|
130
|
-
|
|
52
|
+
const moves = [];
|
|
53
|
+
const possiblePatterns = this.computePossiblePatterns().filter((patternType) => {
|
|
131
54
|
if (!movedPlanets.length)
|
|
132
55
|
return true;
|
|
133
|
-
return movedPlanets.every(
|
|
56
|
+
return movedPlanets.every((m) => patternType.some((p) => p.influence === m.influence && p.count === m.count));
|
|
134
57
|
});
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (movedPlanets.some(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
.filter(
|
|
142
|
-
.map(
|
|
143
|
-
moves.push
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
|
|
163
|
-
|
|
72
|
+
}
|
|
73
|
+
computePossiblePatterns() {
|
|
74
|
+
const pattern = this.effect.pattern;
|
|
164
75
|
if (!pattern)
|
|
165
76
|
return [];
|
|
166
|
-
|
|
167
|
-
for (
|
|
168
|
-
|
|
169
|
-
patterns.push(patternInfluences.map(
|
|
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
|
-
|
|
83
|
+
}
|
|
84
|
+
influencePlanet(planets) {
|
|
174
85
|
return planets.id(this.effect.influence);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
|
|
186
|
-
|
|
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
|
-
|
|
194
|
-
var _a;
|
|
102
|
+
}
|
|
103
|
+
getPositionAfterPull(item, effect) {
|
|
195
104
|
if (effect.times) {
|
|
196
|
-
|
|
197
|
-
for (
|
|
198
|
-
|
|
199
|
-
if (this.player ===
|
|
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 ===
|
|
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,
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (this.player ===
|
|
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
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
moves.push
|
|
227
|
-
|
|
228
|
-
|
|
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
|
-
|
|
247
|
-
if (!
|
|
140
|
+
}
|
|
141
|
+
beforeItemMove(move) {
|
|
142
|
+
if (!isMoveItemType(MaterialType.InfluenceDisc)(move) || move.location.type !== LocationType.PlanetBoardInfluenceDiscSpace)
|
|
248
143
|
return [];
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
this.memorize(
|
|
252
|
-
|
|
253
|
-
|
|
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
|
-
|
|
259
|
-
|
|
260
|
-
moves.push
|
|
261
|
-
type:
|
|
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
|
-
}))
|
|
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
|
|
161
|
+
moves.push(...new BonusHelper(this.game).applyInfluenceBonus(item.id));
|
|
270
162
|
}
|
|
271
163
|
}
|
|
272
164
|
if (effect.times) {
|
|
273
|
-
|
|
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(
|
|
280
|
-
|
|
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
|
|
181
|
+
moves.push(...this.afterEffectPlayed());
|
|
293
182
|
return moves;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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
|
-
|
|
303
|
-
|
|
304
|
-
|
|
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
|
-
|
|
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
|
-
|
|
201
|
+
this.effect.influence ??= _extraData.influence;
|
|
320
202
|
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
this.forget(
|
|
203
|
+
}
|
|
204
|
+
onRuleEnd() {
|
|
205
|
+
this.forget(Memory.Pattern);
|
|
324
206
|
return [];
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
}(index_1.EffectRule));
|
|
328
|
-
exports.WinInfluenceRule = WinInfluenceRule;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
@@ -1,92 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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(
|
|
59
|
-
this.memorize(
|
|
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:
|
|
14
|
+
type: LocationType.TeamZenithium,
|
|
63
15
|
player: this.effect.opponent ? this.opponentTeam : this.playerHelper.team
|
|
64
16
|
},
|
|
65
|
-
quantity:
|
|
17
|
+
quantity: this.effect.quantity ?? 1
|
|
66
18
|
}));
|
|
67
19
|
this.removeFirstEffect();
|
|
68
|
-
moves.push
|
|
20
|
+
moves.push(...this.afterEffectPlayed());
|
|
69
21
|
return moves;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
var _a;
|
|
73
|
-
var _b;
|
|
22
|
+
}
|
|
23
|
+
setExtraData(_extraData) {
|
|
74
24
|
if (_extraData.quantity) {
|
|
75
|
-
|
|
25
|
+
this.effect.quantity ??= _extraData.quantity;
|
|
76
26
|
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
91
|
-
}(index_1.EffectRule));
|
|
92
|
-
exports.WinZenithiumRule = WinZenithiumRule;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,35 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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';
|