@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,76 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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.ConditionalRule = void 0;
|
|
55
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
56
|
-
var Effect_1 = require("../../material/effect/Effect");
|
|
57
|
-
var EffectType_1 = require("../../material/effect/EffectType");
|
|
58
|
-
var CustomMoveType_1 = require("../CustomMoveType");
|
|
59
|
-
var EffectHelper_1 = require("../helper/EffectHelper");
|
|
60
|
-
var Memory_1 = require("../Memory");
|
|
61
|
-
var index_1 = require("./index");
|
|
62
|
-
var ConditionalRule = (function (_super) {
|
|
63
|
-
__extends(ConditionalRule, _super);
|
|
64
|
-
function ConditionalRule() {
|
|
65
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
66
|
-
}
|
|
67
|
-
ConditionalRule.prototype.onRuleStart = function () {
|
|
68
|
-
var condition = this.effect.condition;
|
|
69
|
-
var moves = _super.prototype.onRuleStart.call(this);
|
|
1
|
+
import { isCustomMoveType } from '@gamepark/rules-api';
|
|
2
|
+
import { ConditionType } from '../../material/effect/Effect';
|
|
3
|
+
import { EffectType } from '../../material/effect/EffectType';
|
|
4
|
+
import { CustomMoveType } from '../CustomMoveType';
|
|
5
|
+
import { getEffectRule } from '../helper/EffectHelper';
|
|
6
|
+
import { Memory } from '../Memory';
|
|
7
|
+
import { EffectRule } from './index';
|
|
8
|
+
export class ConditionalRule extends EffectRule {
|
|
9
|
+
onRuleStart() {
|
|
10
|
+
const condition = this.effect.condition;
|
|
11
|
+
const moves = super.onRuleStart();
|
|
70
12
|
if (moves.length > 0)
|
|
71
13
|
return moves;
|
|
72
14
|
if (this.isDoCondition(condition) && this.effect.mandatory) {
|
|
73
|
-
moves.push
|
|
15
|
+
moves.push(...getEffectRule(this.game, condition.effect).getAutomaticEffectMoves());
|
|
74
16
|
return moves;
|
|
75
17
|
}
|
|
76
18
|
if (this.isLeaderCondition(condition) || this.isHaveCreditCondition(condition)) {
|
|
@@ -78,93 +20,89 @@ var ConditionalRule = (function (_super) {
|
|
|
78
20
|
return this.afterEffectPlayed();
|
|
79
21
|
}
|
|
80
22
|
return [];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
23
|
+
}
|
|
24
|
+
getPlayerMoves() {
|
|
25
|
+
const condition = this.effect.condition;
|
|
84
26
|
if (this.isDoCondition(condition)) {
|
|
85
27
|
if (!this.isAutomaticEffect) {
|
|
86
|
-
|
|
87
|
-
if (!this.effect.mandatory && !this.remind(
|
|
88
|
-
moves.push(this.customMove(
|
|
89
|
-
moves.push
|
|
28
|
+
const moves = [];
|
|
29
|
+
if (!this.effect.mandatory && !this.remind(Memory.CantPass))
|
|
30
|
+
moves.push(this.customMove(CustomMoveType.Pass));
|
|
31
|
+
moves.push(...getEffectRule(this.game, condition.effect).getPlayerMoves());
|
|
90
32
|
return moves;
|
|
91
33
|
}
|
|
92
|
-
return [this.customMove(
|
|
34
|
+
return [this.customMove(CustomMoveType.Pass), this.customMove(CustomMoveType.DoCondition)];
|
|
93
35
|
}
|
|
94
36
|
return [];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (
|
|
37
|
+
}
|
|
38
|
+
onCustomMove(move) {
|
|
39
|
+
if (isCustomMoveType(CustomMoveType.Pass)(move)) {
|
|
98
40
|
this.removeFirstEffect();
|
|
99
41
|
return this.afterEffectPlayed();
|
|
100
42
|
}
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
if (!this.isDoCondition(
|
|
43
|
+
if (isCustomMoveType(CustomMoveType.DoCondition)(move)) {
|
|
44
|
+
const condition = this.effect.condition;
|
|
45
|
+
if (!this.isDoCondition(condition))
|
|
104
46
|
return [];
|
|
105
|
-
|
|
106
|
-
|
|
47
|
+
const conditionEffect = getEffectRule(this.game, condition.effect);
|
|
48
|
+
const extraData = conditionEffect.getExtraDataFromMove(move);
|
|
107
49
|
this.addEffectAndRemoveCondition(extraData);
|
|
108
50
|
return this.afterEffectPlayed();
|
|
109
51
|
}
|
|
110
52
|
this.onEffectPlayed(move);
|
|
111
|
-
|
|
53
|
+
const condition = this.effect.condition;
|
|
112
54
|
if (this.isDoCondition(condition)) {
|
|
113
|
-
|
|
114
|
-
moves.push
|
|
55
|
+
const moves = getEffectRule(this.game, condition.effect).onCustomMove(move);
|
|
56
|
+
moves.push(...this.afterEffectPlayed());
|
|
115
57
|
return moves;
|
|
116
58
|
}
|
|
117
59
|
return [];
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
60
|
+
}
|
|
61
|
+
afterItemMove(move) {
|
|
62
|
+
const done = this.onEffectPlayed(move);
|
|
121
63
|
if (done) {
|
|
122
64
|
return this.afterEffectPlayed();
|
|
123
65
|
}
|
|
124
66
|
return [];
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
67
|
+
}
|
|
68
|
+
onEffectPlayed(move) {
|
|
69
|
+
const condition = this.effect.condition;
|
|
128
70
|
if (this.isDoCondition(condition)) {
|
|
129
71
|
if (this.isAutomaticEffect)
|
|
130
72
|
return;
|
|
131
|
-
|
|
132
|
-
|
|
73
|
+
const conditionEffect = getEffectRule(this.game, condition.effect);
|
|
74
|
+
const done = conditionEffect.decrement(move);
|
|
133
75
|
if (done) {
|
|
134
|
-
|
|
76
|
+
const extraData = conditionEffect.getExtraDataFromMove(move);
|
|
135
77
|
this.removeCondition(extraData);
|
|
136
78
|
}
|
|
137
79
|
else {
|
|
138
|
-
this.memorize(
|
|
80
|
+
this.memorize(Memory.CantPass, true);
|
|
139
81
|
}
|
|
140
82
|
return done;
|
|
141
83
|
}
|
|
142
84
|
return true;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return condition.type === Effect_1.ConditionType.HaveCredits;
|
|
162
|
-
};
|
|
163
|
-
ConditionalRule.prototype.isPossible = function () {
|
|
164
|
-
var condition = this.effect.condition;
|
|
85
|
+
}
|
|
86
|
+
get isAutomaticEffect() {
|
|
87
|
+
const condition = this.effect.condition;
|
|
88
|
+
if (!this.isDoCondition(condition))
|
|
89
|
+
return false;
|
|
90
|
+
return condition.effect.type === EffectType.GiveCredit || condition.effect.type === EffectType.GiveZenithium;
|
|
91
|
+
}
|
|
92
|
+
isDoCondition(condition) {
|
|
93
|
+
return condition.type === ConditionType.DoEffect;
|
|
94
|
+
}
|
|
95
|
+
isLeaderCondition(condition) {
|
|
96
|
+
return condition.type === ConditionType.Leader;
|
|
97
|
+
}
|
|
98
|
+
isHaveCreditCondition(condition) {
|
|
99
|
+
return condition.type === ConditionType.HaveCredits;
|
|
100
|
+
}
|
|
101
|
+
isPossible() {
|
|
102
|
+
const condition = this.effect.condition;
|
|
165
103
|
if (this.isDoCondition(condition)) {
|
|
166
|
-
|
|
167
|
-
return conditionEffect.isPossible() &&
|
|
104
|
+
const conditionEffect = getEffectRule(this.game, condition.effect);
|
|
105
|
+
return conditionEffect.isPossible() && getEffectRule(this.game, this.effect.effect).isPossible();
|
|
168
106
|
}
|
|
169
107
|
if (this.isLeaderCondition(condition)) {
|
|
170
108
|
return this.playerHelper.isLeader;
|
|
@@ -173,25 +111,23 @@ var ConditionalRule = (function (_super) {
|
|
|
173
111
|
return this.playerHelper.credits >= condition.min;
|
|
174
112
|
}
|
|
175
113
|
return false;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
var condition = firstEffect.condition, effect = firstEffect.effect;
|
|
114
|
+
}
|
|
115
|
+
addEffectAndRemoveCondition(extraData) {
|
|
116
|
+
this.memorize(Memory.Effects, (effects) => {
|
|
117
|
+
const firstEffect = effects[0];
|
|
118
|
+
const { condition, effect } = firstEffect;
|
|
182
119
|
if (extraData) {
|
|
183
|
-
|
|
120
|
+
getEffectRule(this.game, effect).setExtraData(extraData);
|
|
184
121
|
}
|
|
185
|
-
return
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
122
|
+
return [
|
|
123
|
+
{ ...condition.effect, effectSource: firstEffect.effectSource },
|
|
124
|
+
{ ...effect, effectSource: firstEffect.effectSource },
|
|
125
|
+
...effects.slice(1)
|
|
126
|
+
];
|
|
189
127
|
});
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
this.forget(
|
|
128
|
+
}
|
|
129
|
+
onRuleEnd() {
|
|
130
|
+
this.forget(Memory.CantPass);
|
|
193
131
|
return [];
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
}(index_1.EffectRule));
|
|
197
|
-
exports.ConditionalRule = ConditionalRule;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -1,133 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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.DevelopTechnologyRule = 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 CustomMoveType_1 = require("../CustomMoveType");
|
|
59
|
-
var TechnologyHelper_1 = require("../helper/TechnologyHelper");
|
|
60
|
-
var index_1 = require("./index");
|
|
61
|
-
var DevelopTechnologyRule = (function (_super) {
|
|
62
|
-
__extends(DevelopTechnologyRule, _super);
|
|
63
|
-
function DevelopTechnologyRule() {
|
|
64
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1
|
+
import { isCustomMoveType, isMoveItemType } from '@gamepark/rules-api';
|
|
2
|
+
import { LocationType } from '../../material/LocationType';
|
|
3
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
4
|
+
import { CustomMoveType } from '../CustomMoveType';
|
|
5
|
+
import { TechnologyHelper } from '../helper/TechnologyHelper';
|
|
6
|
+
import { EffectRule } from './index';
|
|
7
|
+
export class DevelopTechnologyRule extends EffectRule {
|
|
8
|
+
getPlayerMoves() {
|
|
9
|
+
return [
|
|
10
|
+
...this.technologies.moveItems((item) => ({
|
|
11
|
+
...item.location,
|
|
12
|
+
x: item.location.x + 1
|
|
13
|
+
})),
|
|
14
|
+
this.customMove(CustomMoveType.Pass)
|
|
15
|
+
];
|
|
65
16
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.customMove(CustomMoveType_1.CustomMoveType.Pass)
|
|
69
|
-
], false);
|
|
70
|
-
};
|
|
71
|
-
DevelopTechnologyRule.prototype.afterItemMove = function (move) {
|
|
72
|
-
var _a;
|
|
73
|
-
if (!(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.TechMarker)(move))
|
|
17
|
+
afterItemMove(move) {
|
|
18
|
+
if (!isMoveItemType(MaterialType.TechMarker)(move))
|
|
74
19
|
return [];
|
|
75
|
-
|
|
20
|
+
const moves = [];
|
|
76
21
|
if (!this.effect.free) {
|
|
77
|
-
|
|
22
|
+
const cost = move.location.x - (this.effect.discount ?? 0);
|
|
78
23
|
if (cost) {
|
|
79
24
|
moves.push(this.playerHelper.zenithiumMaterial.deleteItem(cost));
|
|
80
25
|
}
|
|
81
26
|
}
|
|
82
|
-
moves.push
|
|
27
|
+
moves.push(...new TechnologyHelper(this.game).applyTechnology(move));
|
|
83
28
|
this.removeFirstEffect();
|
|
84
|
-
moves.push
|
|
29
|
+
moves.push(...this.afterEffectPlayed());
|
|
85
30
|
return moves;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (!
|
|
31
|
+
}
|
|
32
|
+
onCustomMove(move) {
|
|
33
|
+
if (!isCustomMoveType(CustomMoveType.Pass)(move))
|
|
89
34
|
return [];
|
|
90
35
|
this.removeFirstEffect();
|
|
91
36
|
return this.afterEffectPlayed();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
var tokens = this.technologyTokens.parent(function (p) { return techBoard.includes(p); });
|
|
101
|
-
if (!tokens.length)
|
|
102
|
-
return tokens;
|
|
103
|
-
if (this.effect.free && this.effect.lowest) {
|
|
104
|
-
var lowestX_1 = tokens.minBy(function (item) { return item.location.x; }).getItem().location.x;
|
|
105
|
-
return tokens.filter(function (item) { return item.location.x === lowestX_1; });
|
|
106
|
-
}
|
|
107
|
-
var discount = this.effect.discount;
|
|
108
|
-
if (discount !== undefined) {
|
|
109
|
-
return tokens.filter(function (item) {
|
|
110
|
-
return item.location.x + 1 - discount <= zenithium;
|
|
111
|
-
});
|
|
112
|
-
}
|
|
37
|
+
}
|
|
38
|
+
get technologies() {
|
|
39
|
+
const zenithium = this.playerHelper.zenithium;
|
|
40
|
+
const techBoard = this.material(MaterialType.TechnologyBoard)
|
|
41
|
+
.locationId((id) => id === (this.effect.faction ?? id))
|
|
42
|
+
.getIndexes();
|
|
43
|
+
const tokens = this.technologyTokens.parent((p) => techBoard.includes(p));
|
|
44
|
+
if (!tokens.length)
|
|
113
45
|
return tokens;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
46
|
+
if (this.effect.free && this.effect.lowest) {
|
|
47
|
+
const lowestX = tokens.minBy((item) => item.location.x).getItem().location.x;
|
|
48
|
+
return tokens.filter((item) => item.location.x === lowestX);
|
|
49
|
+
}
|
|
50
|
+
const discount = this.effect.discount;
|
|
51
|
+
if (discount !== undefined) {
|
|
52
|
+
return tokens.filter((item) => {
|
|
53
|
+
return item.location.x + 1 - discount <= zenithium;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return tokens;
|
|
57
|
+
}
|
|
58
|
+
isPossible() {
|
|
119
59
|
return this.technologies.length > 0;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
enumerable: false,
|
|
129
|
-
configurable: true
|
|
130
|
-
});
|
|
131
|
-
return DevelopTechnologyRule;
|
|
132
|
-
}(index_1.EffectRule));
|
|
133
|
-
exports.DevelopTechnologyRule = DevelopTechnologyRule;
|
|
60
|
+
}
|
|
61
|
+
get technologyTokens() {
|
|
62
|
+
return this.material(MaterialType.TechMarker)
|
|
63
|
+
.location(LocationType.TechnologyBoardTokenSpace)
|
|
64
|
+
.player(this.playerHelper.team)
|
|
65
|
+
.location((l) => l.x < 5);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -1,107 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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.DiscardRule = void 0;
|
|
44
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
45
|
-
var Agents_1 = require("../../material/Agents");
|
|
46
|
-
var LocationType_1 = require("../../material/LocationType");
|
|
47
|
-
var MaterialType_1 = require("../../material/MaterialType");
|
|
48
|
-
var Memory_1 = require("../Memory");
|
|
49
|
-
var index_1 = require("./index");
|
|
50
|
-
var DiscardRule = (function (_super) {
|
|
51
|
-
__extends(DiscardRule, _super);
|
|
52
|
-
function DiscardRule() {
|
|
53
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
54
|
-
}
|
|
55
|
-
DiscardRule.prototype.onRuleStart = function () {
|
|
56
|
-
var moves = _super.prototype.onRuleStart.call(this);
|
|
1
|
+
import { isMoveItemType } from '@gamepark/rules-api';
|
|
2
|
+
import { Agents } from '../../material/Agents';
|
|
3
|
+
import { LocationType } from '../../material/LocationType';
|
|
4
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
5
|
+
import { Memory } from '../Memory';
|
|
6
|
+
import { EffectRule } from './index';
|
|
7
|
+
export class DiscardRule extends EffectRule {
|
|
8
|
+
onRuleStart() {
|
|
9
|
+
const moves = super.onRuleStart();
|
|
57
10
|
if (moves.length > 0)
|
|
58
11
|
return moves;
|
|
59
|
-
this.memorize(
|
|
60
|
-
|
|
12
|
+
this.memorize(Memory.CurrentEffect, JSON.parse(JSON.stringify(this.effect)));
|
|
13
|
+
const effect = this.effect;
|
|
61
14
|
if (effect.full) {
|
|
62
15
|
moves.push(this.hand.moveItemsAtOnce({
|
|
63
|
-
type:
|
|
16
|
+
type: LocationType.AgentDiscard
|
|
64
17
|
}));
|
|
65
18
|
this.removeFirstEffect();
|
|
66
|
-
moves.push
|
|
19
|
+
moves.push(...this.afterEffectPlayed());
|
|
67
20
|
}
|
|
68
21
|
return moves;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
moves.push
|
|
73
|
-
type:
|
|
74
|
-
}))
|
|
22
|
+
}
|
|
23
|
+
getPlayerMoves() {
|
|
24
|
+
const moves = [];
|
|
25
|
+
moves.push(...this.hand.moveItems({
|
|
26
|
+
type: LocationType.AgentDiscard
|
|
27
|
+
}));
|
|
75
28
|
return moves;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
|
|
29
|
+
}
|
|
30
|
+
getExtraDataFromMove(move) {
|
|
31
|
+
if (isMoveItemType(MaterialType.AgentCard)(move) && move.location.type === LocationType.AgentDiscard) {
|
|
32
|
+
const card = this.material(MaterialType.AgentCard).getItem(move.itemIndex);
|
|
33
|
+
const agent = Agents[card.id];
|
|
81
34
|
return { quantity: agent.cost, influence: agent.influence };
|
|
82
35
|
}
|
|
83
36
|
return {};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (!
|
|
37
|
+
}
|
|
38
|
+
afterItemMove(move) {
|
|
39
|
+
if (!isMoveItemType(MaterialType.AgentCard)(move) || move.location.type !== LocationType.AgentDiscard)
|
|
87
40
|
return [];
|
|
88
41
|
this.removeFirstEffect();
|
|
89
42
|
return this.afterEffectPlayed();
|
|
90
|
-
}
|
|
91
|
-
|
|
43
|
+
}
|
|
44
|
+
isPossible() {
|
|
92
45
|
return this.hand.length > 0;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
configurable: true
|
|
100
|
-
});
|
|
101
|
-
DiscardRule.prototype.onRuleEnd = function () {
|
|
102
|
-
this.forget(Memory_1.Memory.CurrentEffect);
|
|
46
|
+
}
|
|
47
|
+
get hand() {
|
|
48
|
+
return this.material(MaterialType.AgentCard).location(LocationType.PlayerHand).player(this.player);
|
|
49
|
+
}
|
|
50
|
+
onRuleEnd() {
|
|
51
|
+
this.forget(Memory.CurrentEffect);
|
|
103
52
|
return [];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
}(index_1.EffectRule));
|
|
107
|
-
exports.DiscardRule = DiscardRule;
|
|
53
|
+
}
|
|
54
|
+
}
|