@gamepark/zenith 0.0.1
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.d.ts +1 -0
- package/dist/PlayerId.js +2 -0
- package/dist/TeamColor.d.ts +9 -0
- package/dist/TeamColor.js +16 -0
- package/dist/ZenithOptions.d.ts +5 -0
- package/dist/ZenithOptions.js +4 -0
- package/dist/ZenithRules.d.ts +68 -0
- package/dist/ZenithRules.js +128 -0
- package/dist/ZenithSetup.d.ts +24 -0
- package/dist/ZenithSetup.js +316 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +9 -0
- package/dist/material/Agent.d.ts +93 -0
- package/dist/material/Agent.js +98 -0
- package/dist/material/Agents.d.ts +102 -0
- package/dist/material/Agents.js +2305 -0
- package/dist/material/Bonus.d.ts +12 -0
- package/dist/material/Bonus.js +34 -0
- package/dist/material/Bonuses.d.ts +14 -0
- package/dist/material/Bonuses.js +63 -0
- package/dist/material/Credit.d.ts +6 -0
- package/dist/material/Credit.js +11 -0
- package/dist/material/Faction.d.ts +6 -0
- package/dist/material/Faction.js +11 -0
- package/dist/material/Influence.d.ts +8 -0
- package/dist/material/Influence.js +13 -0
- package/dist/material/LocationType.d.ts +23 -0
- package/dist/material/LocationType.js +27 -0
- package/dist/material/MaterialType.d.ts +12 -0
- package/dist/material/MaterialType.js +16 -0
- package/dist/material/effect/Effect.d.ts +144 -0
- package/dist/material/effect/Effect.js +14 -0
- package/dist/material/effect/EffectType.d.ts +23 -0
- package/dist/material/effect/EffectType.js +27 -0
- package/dist/rules/CustomMoveType.d.ts +8 -0
- package/dist/rules/CustomMoveType.js +12 -0
- package/dist/rules/DiscardActionRule.d.ts +8 -0
- package/dist/rules/DiscardActionRule.js +84 -0
- package/dist/rules/Memory.d.ts +25 -0
- package/dist/rules/Memory.js +19 -0
- package/dist/rules/MulliganRule.d.ts +12 -0
- package/dist/rules/MulliganRule.js +138 -0
- package/dist/rules/PlayCardRule.d.ts +15 -0
- package/dist/rules/PlayCardRule.js +147 -0
- package/dist/rules/RefillRule.d.ts +17 -0
- package/dist/rules/RefillRule.js +211 -0
- package/dist/rules/RuleId.d.ts +27 -0
- package/dist/rules/RuleId.js +31 -0
- package/dist/rules/discard-action/DiplomacyActions.d.ts +3 -0
- package/dist/rules/discard-action/DiplomacyActions.js +39 -0
- package/dist/rules/discard-action/DiplomacyBoardRule.d.ts +9 -0
- package/dist/rules/discard-action/DiplomacyBoardRule.js +68 -0
- package/dist/rules/discard-action/TechnologyActions.d.ts +3 -0
- package/dist/rules/discard-action/TechnologyActions.js +187 -0
- package/dist/rules/discard-action/TechnologyBoardRule.d.ts +8 -0
- package/dist/rules/discard-action/TechnologyBoardRule.js +109 -0
- package/dist/rules/effect/ChoiceRule.d.ts +12 -0
- package/dist/rules/effect/ChoiceRule.js +91 -0
- package/dist/rules/effect/ConditionalRule.d.ts +17 -0
- package/dist/rules/effect/ConditionalRule.js +197 -0
- package/dist/rules/effect/DevelopTechnologyRule.d.ts +11 -0
- package/dist/rules/effect/DevelopTechnologyRule.js +133 -0
- package/dist/rules/effect/DiscardRule.d.ts +18 -0
- package/dist/rules/effect/DiscardRule.js +107 -0
- package/dist/rules/effect/EffectRule.d.ts +27 -0
- package/dist/rules/effect/EffectRule.js +161 -0
- package/dist/rules/effect/ExileRule.d.ts +22 -0
- package/dist/rules/effect/ExileRule.js +182 -0
- package/dist/rules/effect/GiveCreditRule.d.ts +13 -0
- package/dist/rules/effect/GiveCreditRule.js +79 -0
- package/dist/rules/effect/GiveInfluenceRule.d.ts +10 -0
- package/dist/rules/effect/GiveInfluenceRule.js +119 -0
- package/dist/rules/effect/GiveLeaderBadgeRule.d.ts +9 -0
- package/dist/rules/effect/GiveLeaderBadgeRule.js +54 -0
- package/dist/rules/effect/GiveZenithiumRule.d.ts +9 -0
- package/dist/rules/effect/GiveZenithiumRule.js +85 -0
- package/dist/rules/effect/MobilizeRule.d.ts +18 -0
- package/dist/rules/effect/MobilizeRule.js +117 -0
- package/dist/rules/effect/ResetInfluenceRule.d.ts +9 -0
- package/dist/rules/effect/ResetInfluenceRule.js +63 -0
- package/dist/rules/effect/SpendCreditRule.d.ts +16 -0
- package/dist/rules/effect/SpendCreditRule.js +109 -0
- package/dist/rules/effect/SpendZenithiumRule.d.ts +17 -0
- package/dist/rules/effect/SpendZenithiumRule.js +116 -0
- package/dist/rules/effect/StealCreditRule.d.ts +7 -0
- package/dist/rules/effect/StealCreditRule.js +67 -0
- package/dist/rules/effect/TakeBonusRule.d.ts +11 -0
- package/dist/rules/effect/TakeBonusRule.js +98 -0
- package/dist/rules/effect/TakeLeaderBadgeRule.d.ts +9 -0
- package/dist/rules/effect/TakeLeaderBadgeRule.js +102 -0
- package/dist/rules/effect/TakeTechnologyBonusTokenRule.d.ts +11 -0
- package/dist/rules/effect/TakeTechnologyBonusTokenRule.js +122 -0
- package/dist/rules/effect/TransferRule.d.ts +19 -0
- package/dist/rules/effect/TransferRule.js +104 -0
- package/dist/rules/effect/WinCreditRule.d.ts +13 -0
- package/dist/rules/effect/WinCreditRule.js +142 -0
- package/dist/rules/effect/WinInfluenceRule.d.ts +23 -0
- package/dist/rules/effect/WinInfluenceRule.js +328 -0
- package/dist/rules/effect/WinZenithiumRule.d.ts +9 -0
- package/dist/rules/effect/WinZenithiumRule.js +92 -0
- package/dist/rules/effect/index.d.ts +19 -0
- package/dist/rules/effect/index.js +35 -0
- package/dist/rules/helper/BonusHelper.d.ts +15 -0
- package/dist/rules/helper/BonusHelper.js +86 -0
- package/dist/rules/helper/CreditHelper.d.ts +9 -0
- package/dist/rules/helper/CreditHelper.js +45 -0
- package/dist/rules/helper/EffectHelper.d.ts +16 -0
- package/dist/rules/helper/EffectHelper.js +133 -0
- package/dist/rules/helper/EffectRuleIds.d.ts +3 -0
- package/dist/rules/helper/EffectRuleIds.js +29 -0
- package/dist/rules/helper/EndGameHelper.d.ts +13 -0
- package/dist/rules/helper/EndGameHelper.js +70 -0
- package/dist/rules/helper/InfluenceHelper.d.ts +13 -0
- package/dist/rules/helper/InfluenceHelper.js +47 -0
- package/dist/rules/helper/MobilizeHelper.d.ts +10 -0
- package/dist/rules/helper/MobilizeHelper.js +56 -0
- package/dist/rules/helper/PlanetHelper.d.ts +19 -0
- package/dist/rules/helper/PlanetHelper.js +104 -0
- package/dist/rules/helper/PlayerHelper.d.ts +12 -0
- package/dist/rules/helper/PlayerHelper.js +61 -0
- package/dist/rules/helper/TechnologyHelper.d.ts +4 -0
- package/dist/rules/helper/TechnologyHelper.js +96 -0
- package/dist/rules/helper/ZenithiumHelper.d.ts +10 -0
- package/dist/rules/helper/ZenithiumHelper.js +59 -0
- package/package.json +33 -0
|
@@ -0,0 +1,182 @@
|
|
|
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 __values = (this && this.__values) || function(o) {
|
|
18
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
19
|
+
if (m) return m.call(o);
|
|
20
|
+
if (o && typeof o.length === "number") return {
|
|
21
|
+
next: function () {
|
|
22
|
+
if (o && i >= o.length) o = void 0;
|
|
23
|
+
return { value: o && o[i++], done: !o };
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.ExileRule = void 0;
|
|
55
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
56
|
+
var Agents_1 = require("../../material/Agents");
|
|
57
|
+
var EffectType_1 = require("../../material/effect/EffectType");
|
|
58
|
+
var Influence_1 = require("../../material/Influence");
|
|
59
|
+
var LocationType_1 = require("../../material/LocationType");
|
|
60
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
61
|
+
var index_1 = require("./index");
|
|
62
|
+
var ExileRule = (function (_super) {
|
|
63
|
+
__extends(ExileRule, _super);
|
|
64
|
+
function ExileRule() {
|
|
65
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
66
|
+
}
|
|
67
|
+
ExileRule.prototype.isPossible = function () {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
if (((_a = this.firstEffect) === null || _a === void 0 ? void 0 : _a.type) === EffectType_1.EffectType.Conditional && !this.effect.quantities) {
|
|
70
|
+
return this.getPlayerMoves().length >= ((_b = this.effect.quantity) !== null && _b !== void 0 ? _b : 1);
|
|
71
|
+
}
|
|
72
|
+
return this.getPlayerMoves().length > 0;
|
|
73
|
+
};
|
|
74
|
+
ExileRule.prototype.getPlayerMoves = function () {
|
|
75
|
+
if (this.effect.quantities) {
|
|
76
|
+
return this.exileMultipleCards();
|
|
77
|
+
}
|
|
78
|
+
return this.exileOneCard();
|
|
79
|
+
};
|
|
80
|
+
ExileRule.prototype.decrement = function (move) {
|
|
81
|
+
if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.AgentCard)(move) && move.location.type === LocationType_1.LocationType.AgentDiscard) {
|
|
82
|
+
if (this.effect.quantity) {
|
|
83
|
+
this.effect.quantity--;
|
|
84
|
+
return this.effect.quantity === 0 || !this.isPossible();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
};
|
|
89
|
+
ExileRule.prototype.afterItemMove = function (move) {
|
|
90
|
+
if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.AgentCard)(move) && move.location.type === LocationType_1.LocationType.AgentDiscard) {
|
|
91
|
+
if (this.effect.quantity) {
|
|
92
|
+
this.effect.quantity--;
|
|
93
|
+
}
|
|
94
|
+
if (!this.effect.quantity || !this.isPossible()) {
|
|
95
|
+
this.removeFirstEffect();
|
|
96
|
+
return this.afterEffectPlayed();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return [];
|
|
100
|
+
};
|
|
101
|
+
ExileRule.prototype.getExtraDataFromMove = function (move) {
|
|
102
|
+
if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.AgentCard)(move) && move.location.type === LocationType_1.LocationType.AgentDiscard) {
|
|
103
|
+
var card = this.material(MaterialType_1.MaterialType.AgentCard).getItem(move.itemIndex);
|
|
104
|
+
var agent = Agents_1.Agents[card.id];
|
|
105
|
+
return { quantity: agent.cost, influence: agent.influence };
|
|
106
|
+
}
|
|
107
|
+
if ((0, rules_api_1.isMoveItemTypeAtOnce)(MaterialType_1.MaterialType.AgentCard)(move) && move.location.type === LocationType_1.LocationType.AgentDiscard) {
|
|
108
|
+
if (this.effect.quantities && this.effect.factors) {
|
|
109
|
+
var index = this.effect.quantities.indexOf(move.indexes.length);
|
|
110
|
+
return { quantity: this.effect.factors[index] };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return {};
|
|
114
|
+
};
|
|
115
|
+
ExileRule.prototype.exileOneCard = function () {
|
|
116
|
+
var e_1, _a;
|
|
117
|
+
var allInfluences = Influence_1.influences;
|
|
118
|
+
var allCards = this.cards;
|
|
119
|
+
var indexes = [];
|
|
120
|
+
try {
|
|
121
|
+
for (var allInfluences_1 = __values(allInfluences), allInfluences_1_1 = allInfluences_1.next(); !allInfluences_1_1.done; allInfluences_1_1 = allInfluences_1.next()) {
|
|
122
|
+
var influence = allInfluences_1_1.value;
|
|
123
|
+
var influenceCards = allCards.locationId(influence);
|
|
124
|
+
indexes.push.apply(indexes, __spreadArray([], __read(influenceCards.maxBy(function (item) { return item.location.x; }).getIndexes()), false));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
128
|
+
finally {
|
|
129
|
+
try {
|
|
130
|
+
if (allInfluences_1_1 && !allInfluences_1_1.done && (_a = allInfluences_1.return)) _a.call(allInfluences_1);
|
|
131
|
+
}
|
|
132
|
+
finally { if (e_1) throw e_1.error; }
|
|
133
|
+
}
|
|
134
|
+
return allCards.index(indexes).moveItems({
|
|
135
|
+
type: LocationType_1.LocationType.AgentDiscard
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
ExileRule.prototype.exileMultipleCards = function () {
|
|
139
|
+
var e_2, _a;
|
|
140
|
+
if (!this.effect.quantities)
|
|
141
|
+
return [];
|
|
142
|
+
var allCards = this.cards;
|
|
143
|
+
var moves = [];
|
|
144
|
+
try {
|
|
145
|
+
for (var _b = __values(this.effect.quantities), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
146
|
+
var quantity = _c.value;
|
|
147
|
+
if (allCards.length < quantity)
|
|
148
|
+
continue;
|
|
149
|
+
moves.push(allCards.limit(quantity).moveItemsAtOnce({ type: LocationType_1.LocationType.AgentDiscard }));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
153
|
+
finally {
|
|
154
|
+
try {
|
|
155
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
156
|
+
}
|
|
157
|
+
finally { if (e_2) throw e_2.error; }
|
|
158
|
+
}
|
|
159
|
+
return moves;
|
|
160
|
+
};
|
|
161
|
+
Object.defineProperty(ExileRule.prototype, "cards", {
|
|
162
|
+
get: function () {
|
|
163
|
+
var _this = this;
|
|
164
|
+
var team = this.effect.opponent ? this.opponentTeam : this.playerHelper.team;
|
|
165
|
+
return this.material(MaterialType_1.MaterialType.AgentCard)
|
|
166
|
+
.location(LocationType_1.LocationType.Influence)
|
|
167
|
+
.filter(function (item) {
|
|
168
|
+
if (_this.effect.except && _this.effect.except === item.location.id)
|
|
169
|
+
return false;
|
|
170
|
+
if (_this.effect.influence && _this.effect.influence !== item.location.id)
|
|
171
|
+
return false;
|
|
172
|
+
return true;
|
|
173
|
+
})
|
|
174
|
+
.player(team)
|
|
175
|
+
.sort(function (item) { return -item.location.x; });
|
|
176
|
+
},
|
|
177
|
+
enumerable: false,
|
|
178
|
+
configurable: true
|
|
179
|
+
});
|
|
180
|
+
return ExileRule;
|
|
181
|
+
}(index_1.EffectRule));
|
|
182
|
+
exports.ExileRule = ExileRule;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CustomMove, ItemMove, MaterialMove } from '@gamepark/rules-api';
|
|
2
|
+
import { GiveCreditEffect } from '../../material/effect/Effect';
|
|
3
|
+
import { EffectRule } from './index';
|
|
4
|
+
export declare class GiveCreditRule extends EffectRule<GiveCreditEffect> {
|
|
5
|
+
onRuleStart(): MaterialMove[];
|
|
6
|
+
getExtraDataFromMove(move: ItemMove | CustomMove): {
|
|
7
|
+
quantity?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
quantity: number;
|
|
10
|
+
};
|
|
11
|
+
isPossible(): boolean;
|
|
12
|
+
onRuleEnd(): never[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
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.GiveCreditRule = void 0;
|
|
44
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
45
|
+
var LocationType_1 = require("../../material/LocationType");
|
|
46
|
+
var CustomMoveType_1 = require("../CustomMoveType");
|
|
47
|
+
var Memory_1 = require("../Memory");
|
|
48
|
+
var index_1 = require("./index");
|
|
49
|
+
var GiveCreditRule = (function (_super) {
|
|
50
|
+
__extends(GiveCreditRule, _super);
|
|
51
|
+
function GiveCreditRule() {
|
|
52
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
53
|
+
}
|
|
54
|
+
GiveCreditRule.prototype.onRuleStart = function () {
|
|
55
|
+
var moves = [];
|
|
56
|
+
var money = this.creditMoney;
|
|
57
|
+
this.memorize(Memory_1.Memory.CurrentEffect, JSON.parse(JSON.stringify(this.effect)));
|
|
58
|
+
this.memorize(Memory_1.Memory.Credit, this.effect.quantity);
|
|
59
|
+
moves.push.apply(moves, __spreadArray([], __read(money.moveMoney({ type: LocationType_1.LocationType.TeamCredit, player: this.playerHelper.team }, { type: LocationType_1.LocationType.TeamCredit, player: this.opponentTeam }, this.effect.quantity)), false));
|
|
60
|
+
this.removeFirstEffect();
|
|
61
|
+
moves.push.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
|
|
62
|
+
return moves;
|
|
63
|
+
};
|
|
64
|
+
GiveCreditRule.prototype.getExtraDataFromMove = function (move) {
|
|
65
|
+
if (!(0, rules_api_1.isCustomMoveType)(CustomMoveType_1.CustomMoveType.DoCondition)(move))
|
|
66
|
+
return {};
|
|
67
|
+
return { quantity: move.data };
|
|
68
|
+
};
|
|
69
|
+
GiveCreditRule.prototype.isPossible = function () {
|
|
70
|
+
return this.playerHelper.credits >= this.effect.quantity;
|
|
71
|
+
};
|
|
72
|
+
GiveCreditRule.prototype.onRuleEnd = function () {
|
|
73
|
+
this.forget(Memory_1.Memory.CurrentEffect);
|
|
74
|
+
this.forget(Memory_1.Memory.Credit);
|
|
75
|
+
return [];
|
|
76
|
+
};
|
|
77
|
+
return GiveCreditRule;
|
|
78
|
+
}(index_1.EffectRule));
|
|
79
|
+
exports.GiveCreditRule = GiveCreditRule;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Material, MaterialItem, MaterialMove } from '@gamepark/rules-api';
|
|
2
|
+
import { GiveInfluenceEffect } from '../../material/effect/Effect';
|
|
3
|
+
import { EffectRule } from './index';
|
|
4
|
+
export declare class GiveInfluenceRule extends EffectRule<GiveInfluenceEffect> {
|
|
5
|
+
getPlayerMoves(): MaterialMove[];
|
|
6
|
+
get planets(): Material;
|
|
7
|
+
isPossible(): boolean;
|
|
8
|
+
getPositionAfterPush(item: MaterialItem): number;
|
|
9
|
+
afterItemMove(move: MaterialMove): MaterialMove[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.GiveInfluenceRule = void 0;
|
|
55
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
56
|
+
var LocationType_1 = require("../../material/LocationType");
|
|
57
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
58
|
+
var TeamColor_1 = require("../../TeamColor");
|
|
59
|
+
var BonusHelper_1 = require("../helper/BonusHelper");
|
|
60
|
+
var EndGameHelper_1 = require("../helper/EndGameHelper");
|
|
61
|
+
var index_1 = require("./index");
|
|
62
|
+
var GiveInfluenceRule = (function (_super) {
|
|
63
|
+
__extends(GiveInfluenceRule, _super);
|
|
64
|
+
function GiveInfluenceRule() {
|
|
65
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
66
|
+
}
|
|
67
|
+
GiveInfluenceRule.prototype.getPlayerMoves = function () {
|
|
68
|
+
var _this = this;
|
|
69
|
+
var moves = [];
|
|
70
|
+
var planets = this.planets;
|
|
71
|
+
moves.push.apply(moves, __spreadArray([], __read(planets.moveItems(function (item) { return (__assign(__assign({}, item.location), { x: _this.getPositionAfterPush(item) })); })), false));
|
|
72
|
+
return moves;
|
|
73
|
+
};
|
|
74
|
+
Object.defineProperty(GiveInfluenceRule.prototype, "planets", {
|
|
75
|
+
get: function () {
|
|
76
|
+
var _this = this;
|
|
77
|
+
var planets = this.material(MaterialType_1.MaterialType.InfluenceDisc).location(LocationType_1.LocationType.PlanetBoardInfluenceDiscSpace);
|
|
78
|
+
if (this.effect.except)
|
|
79
|
+
return planets.filter(function (item) { return item.id !== _this.effect.except; });
|
|
80
|
+
return planets;
|
|
81
|
+
},
|
|
82
|
+
enumerable: false,
|
|
83
|
+
configurable: true
|
|
84
|
+
});
|
|
85
|
+
GiveInfluenceRule.prototype.isPossible = function () {
|
|
86
|
+
return this.getPlayerMoves().length > 0;
|
|
87
|
+
};
|
|
88
|
+
GiveInfluenceRule.prototype.getPositionAfterPush = function (item) {
|
|
89
|
+
if (this.player === TeamColor_1.TeamColor.White) {
|
|
90
|
+
return Math.min(4, item.location.x + 1);
|
|
91
|
+
}
|
|
92
|
+
return Math.max(-4, item.location.x - 1);
|
|
93
|
+
};
|
|
94
|
+
GiveInfluenceRule.prototype.afterItemMove = function (move) {
|
|
95
|
+
if (!(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.InfluenceDisc)(move))
|
|
96
|
+
return [];
|
|
97
|
+
if (Math.abs(move.location.x) === 4) {
|
|
98
|
+
var planet = this.material(MaterialType_1.MaterialType.InfluenceDisc).index(move.itemIndex);
|
|
99
|
+
var helper = new EndGameHelper_1.EndGameHelper(this.game);
|
|
100
|
+
var moves = [];
|
|
101
|
+
moves.push.apply(moves, __spreadArray([], __read(planet.moveItems({
|
|
102
|
+
type: LocationType_1.LocationType.TeamPlanets,
|
|
103
|
+
player: this.playerHelper.team
|
|
104
|
+
})), false));
|
|
105
|
+
if (helper.willEnd(this.playerHelper.team)) {
|
|
106
|
+
moves.push(this.endGame());
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
var item = planet.getItem();
|
|
110
|
+
moves.push.apply(moves, __spreadArray([], __read(new BonusHelper_1.BonusHelper(this.game).applyInfluenceBonus(item.id)), false));
|
|
111
|
+
}
|
|
112
|
+
return moves;
|
|
113
|
+
}
|
|
114
|
+
this.removeFirstEffect();
|
|
115
|
+
return this.afterEffectPlayed();
|
|
116
|
+
};
|
|
117
|
+
return GiveInfluenceRule;
|
|
118
|
+
}(index_1.EffectRule));
|
|
119
|
+
exports.GiveInfluenceRule = GiveInfluenceRule;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MaterialMove } from '@gamepark/rules-api';
|
|
2
|
+
import { GiveLeaderBadgeEffect } from '../../material/effect/Effect';
|
|
3
|
+
import { EffectRule } from './index';
|
|
4
|
+
export declare class GiveLeaderBadgeRule extends EffectRule<GiveLeaderBadgeEffect> {
|
|
5
|
+
getPlayerMoves(): MaterialMove[];
|
|
6
|
+
get leaderBadge(): import("@gamepark/rules-api").Material<number, number, number>;
|
|
7
|
+
isPossible(): boolean;
|
|
8
|
+
afterItemMove(move: MaterialMove): MaterialMove[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.GiveLeaderBadgeRule = void 0;
|
|
19
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
20
|
+
var LocationType_1 = require("../../material/LocationType");
|
|
21
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
22
|
+
var index_1 = require("./index");
|
|
23
|
+
var GiveLeaderBadgeRule = (function (_super) {
|
|
24
|
+
__extends(GiveLeaderBadgeRule, _super);
|
|
25
|
+
function GiveLeaderBadgeRule() {
|
|
26
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
27
|
+
}
|
|
28
|
+
GiveLeaderBadgeRule.prototype.getPlayerMoves = function () {
|
|
29
|
+
var moves = [];
|
|
30
|
+
moves.push(this.leaderBadge.moveItem({
|
|
31
|
+
type: LocationType_1.LocationType.TeamLeaderBadge,
|
|
32
|
+
player: this.opponentTeam
|
|
33
|
+
}));
|
|
34
|
+
return moves;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(GiveLeaderBadgeRule.prototype, "leaderBadge", {
|
|
37
|
+
get: function () {
|
|
38
|
+
return this.material(MaterialType_1.MaterialType.LeaderBadgeToken);
|
|
39
|
+
},
|
|
40
|
+
enumerable: false,
|
|
41
|
+
configurable: true
|
|
42
|
+
});
|
|
43
|
+
GiveLeaderBadgeRule.prototype.isPossible = function () {
|
|
44
|
+
return this.playerHelper.isLeader;
|
|
45
|
+
};
|
|
46
|
+
GiveLeaderBadgeRule.prototype.afterItemMove = function (move) {
|
|
47
|
+
if (!(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.InfluenceDisc)(move))
|
|
48
|
+
return [];
|
|
49
|
+
this.removeFirstEffect();
|
|
50
|
+
return this.afterEffectPlayed();
|
|
51
|
+
};
|
|
52
|
+
return GiveLeaderBadgeRule;
|
|
53
|
+
}(index_1.EffectRule));
|
|
54
|
+
exports.GiveLeaderBadgeRule = GiveLeaderBadgeRule;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MaterialMove } from '@gamepark/rules-api';
|
|
2
|
+
import { GiveZenithiumEffect } from '../../material/effect/Effect';
|
|
3
|
+
import { EffectRule } from './index';
|
|
4
|
+
export declare class GiveZenithiumRule extends EffectRule<GiveZenithiumEffect> {
|
|
5
|
+
onRuleStart(): MaterialMove[];
|
|
6
|
+
get zenithium(): import("@gamepark/rules-api").Material<number, number, number>;
|
|
7
|
+
isPossible(): boolean;
|
|
8
|
+
onRuleEnd(): never[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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.GiveZenithiumRule = 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 GiveZenithiumRule = (function (_super) {
|
|
49
|
+
__extends(GiveZenithiumRule, _super);
|
|
50
|
+
function GiveZenithiumRule() {
|
|
51
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
52
|
+
}
|
|
53
|
+
GiveZenithiumRule.prototype.onRuleStart = function () {
|
|
54
|
+
var moves = _super.prototype.onRuleStart.call(this);
|
|
55
|
+
if (moves.length > 0)
|
|
56
|
+
return moves;
|
|
57
|
+
this.memorize(Memory_1.Memory.CurrentEffect, JSON.parse(JSON.stringify(this.effect)));
|
|
58
|
+
this.memorize(Memory_1.Memory.Zenithium, this.effect.quantity);
|
|
59
|
+
moves.push.apply(moves, __spreadArray([], __read(this.zenithium.moveItems({
|
|
60
|
+
type: LocationType_1.LocationType.TeamZenithium,
|
|
61
|
+
player: this.opponentTeam
|
|
62
|
+
}, this.effect.quantity)), false));
|
|
63
|
+
this.removeFirstEffect();
|
|
64
|
+
moves.push.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
|
|
65
|
+
return moves;
|
|
66
|
+
};
|
|
67
|
+
Object.defineProperty(GiveZenithiumRule.prototype, "zenithium", {
|
|
68
|
+
get: function () {
|
|
69
|
+
return this.material(MaterialType_1.MaterialType.ZenithiumToken).location(LocationType_1.LocationType.TeamZenithium).player(this.playerHelper.team);
|
|
70
|
+
},
|
|
71
|
+
enumerable: false,
|
|
72
|
+
configurable: true
|
|
73
|
+
});
|
|
74
|
+
GiveZenithiumRule.prototype.isPossible = function () {
|
|
75
|
+
var _a;
|
|
76
|
+
return this.zenithium.getQuantity() >= ((_a = this.effect.quantity) !== null && _a !== void 0 ? _a : 1);
|
|
77
|
+
};
|
|
78
|
+
GiveZenithiumRule.prototype.onRuleEnd = function () {
|
|
79
|
+
this.forget(Memory_1.Memory.CurrentEffect);
|
|
80
|
+
this.forget(Memory_1.Memory.Zenithium);
|
|
81
|
+
return [];
|
|
82
|
+
};
|
|
83
|
+
return GiveZenithiumRule;
|
|
84
|
+
}(index_1.EffectRule));
|
|
85
|
+
exports.GiveZenithiumRule = GiveZenithiumRule;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ItemMove, MaterialMove } from '@gamepark/rules-api';
|
|
2
|
+
import { MobilizeEffect } from '../../material/effect/Effect';
|
|
3
|
+
import { EffectRule } from './index';
|
|
4
|
+
export declare class MobilizeRule extends EffectRule<MobilizeEffect> {
|
|
5
|
+
onRuleStart(): MaterialMove[];
|
|
6
|
+
getAutomaticEffectMoves(): MaterialMove[];
|
|
7
|
+
decrement(move: ItemMove): boolean;
|
|
8
|
+
afterItemMove(move: ItemMove): MaterialMove[];
|
|
9
|
+
getExtraDataFromMove(move: ItemMove): {
|
|
10
|
+
quantity: number;
|
|
11
|
+
influence: import("../../material/Influence").Influence;
|
|
12
|
+
} | {
|
|
13
|
+
quantity?: undefined;
|
|
14
|
+
influence?: undefined;
|
|
15
|
+
};
|
|
16
|
+
isPossible(): boolean;
|
|
17
|
+
get deck(): import("@gamepark/rules-api").MaterialDeck<number, number, number>;
|
|
18
|
+
}
|