@gamepark/zenith 0.0.1 → 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,161 +1,83 @@
|
|
|
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
|
-
}
|
|
1
|
+
import { isStartPlayerTurn, isStartRule, PlayerTurnRule } from '@gamepark/rules-api';
|
|
2
|
+
import { credits } from '../../material/Credit';
|
|
3
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
4
|
+
import { TeamColor } from '../../TeamColor';
|
|
5
|
+
import { getEffectRule } from '../helper/EffectHelper';
|
|
6
|
+
import { EffectRuleIds } from '../helper/EffectRuleIds';
|
|
7
|
+
import { PlayerHelper } from '../helper/PlayerHelper';
|
|
8
|
+
import { Memory } from '../Memory';
|
|
9
|
+
import { RuleId } from '../RuleId';
|
|
10
|
+
export class EffectRule extends PlayerTurnRule {
|
|
11
|
+
effect;
|
|
12
|
+
constructor(game, effect) {
|
|
13
|
+
super(game);
|
|
14
|
+
this.effect = (effect ?? this.firstEffect);
|
|
50
15
|
}
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.EffectRule = void 0;
|
|
55
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
56
|
-
var Credit_1 = require("../../material/Credit");
|
|
57
|
-
var MaterialType_1 = require("../../material/MaterialType");
|
|
58
|
-
var TeamColor_1 = require("../../TeamColor");
|
|
59
|
-
var EffectHelper_1 = require("../helper/EffectHelper");
|
|
60
|
-
var EffectRuleIds_1 = require("../helper/EffectRuleIds");
|
|
61
|
-
var PlayerHelper_1 = require("../helper/PlayerHelper");
|
|
62
|
-
var Memory_1 = require("../Memory");
|
|
63
|
-
var RuleId_1 = require("../RuleId");
|
|
64
|
-
var EffectRule = (function (_super) {
|
|
65
|
-
__extends(EffectRule, _super);
|
|
66
|
-
function EffectRule(game, effect) {
|
|
67
|
-
var _this = _super.call(this, game) || this;
|
|
68
|
-
_this.effect = (effect !== null && effect !== void 0 ? effect : _this.firstEffect);
|
|
69
|
-
return _this;
|
|
70
|
-
}
|
|
71
|
-
EffectRule.prototype.onRuleStart = function (_move, _previousRule, _context) {
|
|
16
|
+
onRuleStart(_move, _previousRule, _context) {
|
|
72
17
|
if (!this.isPossible()) {
|
|
73
18
|
this.removeFirstEffect();
|
|
74
19
|
return this.afterEffectPlayed();
|
|
75
20
|
}
|
|
76
21
|
return [];
|
|
77
|
-
}
|
|
78
|
-
|
|
22
|
+
}
|
|
23
|
+
getAutomaticEffectMoves() {
|
|
79
24
|
return [];
|
|
80
|
-
}
|
|
81
|
-
|
|
25
|
+
}
|
|
26
|
+
isPossible() {
|
|
82
27
|
return true;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
configurable: true
|
|
90
|
-
});
|
|
91
|
-
EffectRule.prototype.setExtraData = function (_extraData) { };
|
|
92
|
-
EffectRule.prototype.decrement = function (_move) {
|
|
28
|
+
}
|
|
29
|
+
get creditMoney() {
|
|
30
|
+
return this.material(MaterialType.CreditToken).money(credits);
|
|
31
|
+
}
|
|
32
|
+
setExtraData(_extraData) { }
|
|
33
|
+
decrement(_move) {
|
|
93
34
|
return true;
|
|
94
|
-
}
|
|
95
|
-
|
|
35
|
+
}
|
|
36
|
+
getExtraDataFromMove(_move) {
|
|
96
37
|
return {
|
|
97
38
|
quantity: 1
|
|
98
39
|
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
enumerable: false,
|
|
112
|
-
configurable: true
|
|
113
|
-
});
|
|
114
|
-
Object.defineProperty(EffectRule.prototype, "playerHelper", {
|
|
115
|
-
get: function () {
|
|
116
|
-
return new PlayerHelper_1.PlayerHelper(this.game, this.player);
|
|
117
|
-
},
|
|
118
|
-
enumerable: false,
|
|
119
|
-
configurable: true
|
|
120
|
-
});
|
|
121
|
-
EffectRule.prototype.removeFirstEffect = function () {
|
|
122
|
-
this.memorize(Memory_1.Memory.Effects, function (effects) {
|
|
40
|
+
}
|
|
41
|
+
get effects() {
|
|
42
|
+
return this.remind(Memory.Effects);
|
|
43
|
+
}
|
|
44
|
+
get firstEffect() {
|
|
45
|
+
return this.effects[0];
|
|
46
|
+
}
|
|
47
|
+
get playerHelper() {
|
|
48
|
+
return new PlayerHelper(this.game, this.player);
|
|
49
|
+
}
|
|
50
|
+
removeFirstEffect() {
|
|
51
|
+
this.memorize(Memory.Effects, (effects) => {
|
|
123
52
|
effects.shift();
|
|
124
53
|
return effects;
|
|
125
54
|
});
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
55
|
+
}
|
|
56
|
+
applyFirstEffect() {
|
|
57
|
+
const effect = this.firstEffect;
|
|
129
58
|
if (!effect) {
|
|
130
59
|
return [];
|
|
131
60
|
}
|
|
132
|
-
return [this.startRule(
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (!moves.some(
|
|
137
|
-
moves.push(this.startRule(
|
|
61
|
+
return [this.startRule(EffectRuleIds[effect.type])];
|
|
62
|
+
}
|
|
63
|
+
afterEffectPlayed() {
|
|
64
|
+
const moves = this.applyFirstEffect();
|
|
65
|
+
if (!moves.some((move) => isStartRule(move) || isStartPlayerTurn(move)) && !this.effects.length) {
|
|
66
|
+
moves.push(this.startRule(RuleId.Refill));
|
|
138
67
|
}
|
|
139
68
|
return moves;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
EffectRule.prototype.removeCondition = function (extraData) {
|
|
149
|
-
var _this = this;
|
|
150
|
-
this.memorize(Memory_1.Memory.Effects, function (effects) {
|
|
151
|
-
var firstEffect = effects[0];
|
|
152
|
-
var effect = firstEffect.effect;
|
|
69
|
+
}
|
|
70
|
+
get opponentTeam() {
|
|
71
|
+
return this.playerHelper.team === TeamColor.White ? TeamColor.Black : TeamColor.White;
|
|
72
|
+
}
|
|
73
|
+
removeCondition(extraData) {
|
|
74
|
+
this.memorize(Memory.Effects, (effects) => {
|
|
75
|
+
const firstEffect = effects[0];
|
|
76
|
+
const { effect } = firstEffect;
|
|
153
77
|
if (extraData) {
|
|
154
|
-
|
|
78
|
+
getEffectRule(this.game, effect).setExtraData(extraData);
|
|
155
79
|
}
|
|
156
|
-
return
|
|
80
|
+
return [{ ...effect, effectSource: firstEffect.effectSource }, ...effects.slice(1)];
|
|
157
81
|
});
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
}(rules_api_1.PlayerTurnRule));
|
|
161
|
-
exports.EffectRule = EffectRule;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -1,93 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (
|
|
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 __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);
|
|
1
|
+
import { isMoveItemType, isMoveItemTypeAtOnce } from '@gamepark/rules-api';
|
|
2
|
+
import { Agents } from '../../material/Agents';
|
|
3
|
+
import { EffectType } from '../../material/effect/EffectType';
|
|
4
|
+
import { influences } from '../../material/Influence';
|
|
5
|
+
import { LocationType } from '../../material/LocationType';
|
|
6
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
7
|
+
import { EffectRule } from './index';
|
|
8
|
+
export class ExileRule extends EffectRule {
|
|
9
|
+
isPossible() {
|
|
10
|
+
if (this.firstEffect?.type === EffectType.Conditional && !this.effect.quantities) {
|
|
11
|
+
return this.getPlayerMoves().length >= (this.effect.quantity ?? 1);
|
|
71
12
|
}
|
|
72
13
|
return this.getPlayerMoves().length > 0;
|
|
73
|
-
}
|
|
74
|
-
|
|
14
|
+
}
|
|
15
|
+
getPlayerMoves() {
|
|
75
16
|
if (this.effect.quantities) {
|
|
76
17
|
return this.exileMultipleCards();
|
|
77
18
|
}
|
|
78
19
|
return this.exileOneCard();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (
|
|
20
|
+
}
|
|
21
|
+
decrement(move) {
|
|
22
|
+
if (isMoveItemType(MaterialType.AgentCard)(move) && move.location.type === LocationType.AgentDiscard) {
|
|
82
23
|
if (this.effect.quantity) {
|
|
83
24
|
this.effect.quantity--;
|
|
84
25
|
return this.effect.quantity === 0 || !this.isPossible();
|
|
85
26
|
}
|
|
86
27
|
}
|
|
87
28
|
return true;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (
|
|
29
|
+
}
|
|
30
|
+
afterItemMove(move) {
|
|
31
|
+
if (isMoveItemType(MaterialType.AgentCard)(move) && move.location.type === LocationType.AgentDiscard) {
|
|
91
32
|
if (this.effect.quantity) {
|
|
92
33
|
this.effect.quantity--;
|
|
93
34
|
}
|
|
@@ -97,86 +38,60 @@ var ExileRule = (function (_super) {
|
|
|
97
38
|
}
|
|
98
39
|
}
|
|
99
40
|
return [];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
41
|
+
}
|
|
42
|
+
getExtraDataFromMove(move) {
|
|
43
|
+
if (isMoveItemType(MaterialType.AgentCard)(move) && move.location.type === LocationType.AgentDiscard) {
|
|
44
|
+
const card = this.material(MaterialType.AgentCard).getItem(move.itemIndex);
|
|
45
|
+
const agent = Agents[card.id];
|
|
105
46
|
return { quantity: agent.cost, influence: agent.influence };
|
|
106
47
|
}
|
|
107
|
-
if (
|
|
48
|
+
if (isMoveItemTypeAtOnce(MaterialType.AgentCard)(move) && move.location.type === LocationType.AgentDiscard) {
|
|
108
49
|
if (this.effect.quantities && this.effect.factors) {
|
|
109
|
-
|
|
50
|
+
const index = this.effect.quantities.indexOf(move.indexes.length);
|
|
110
51
|
return { quantity: this.effect.factors[index] };
|
|
111
52
|
}
|
|
112
53
|
}
|
|
113
54
|
return {};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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; }
|
|
55
|
+
}
|
|
56
|
+
exileOneCard() {
|
|
57
|
+
const allInfluences = influences;
|
|
58
|
+
const allCards = this.cards;
|
|
59
|
+
const indexes = [];
|
|
60
|
+
for (const influence of allInfluences) {
|
|
61
|
+
const influenceCards = allCards.locationId(influence);
|
|
62
|
+
indexes.push(...influenceCards.maxBy((item) => item.location.x).getIndexes());
|
|
133
63
|
}
|
|
134
64
|
return allCards.index(indexes).moveItems({
|
|
135
|
-
type:
|
|
65
|
+
type: LocationType.AgentDiscard
|
|
136
66
|
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
var e_2, _a;
|
|
67
|
+
}
|
|
68
|
+
exileMultipleCards() {
|
|
140
69
|
if (!this.effect.quantities)
|
|
141
70
|
return [];
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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; }
|
|
71
|
+
const allCards = this.cards;
|
|
72
|
+
const moves = [];
|
|
73
|
+
for (const quantity of this.effect.quantities) {
|
|
74
|
+
if (allCards.length < quantity)
|
|
75
|
+
continue;
|
|
76
|
+
moves.push(allCards
|
|
77
|
+
.limit(quantity)
|
|
78
|
+
.sort((item) => item.location.x)
|
|
79
|
+
.moveItemsAtOnce({ type: LocationType.AgentDiscard }));
|
|
158
80
|
}
|
|
159
81
|
return moves;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
},
|
|
177
|
-
enumerable: false,
|
|
178
|
-
configurable: true
|
|
179
|
-
});
|
|
180
|
-
return ExileRule;
|
|
181
|
-
}(index_1.EffectRule));
|
|
182
|
-
exports.ExileRule = ExileRule;
|
|
82
|
+
}
|
|
83
|
+
get cards() {
|
|
84
|
+
const team = this.effect.opponent ? this.opponentTeam : this.playerHelper.team;
|
|
85
|
+
return this.material(MaterialType.AgentCard)
|
|
86
|
+
.location(LocationType.Influence)
|
|
87
|
+
.filter((item) => {
|
|
88
|
+
if (this.effect.except && this.effect.except === item.location.id)
|
|
89
|
+
return false;
|
|
90
|
+
if (this.effect.influence && this.effect.influence !== item.location.id)
|
|
91
|
+
return false;
|
|
92
|
+
return true;
|
|
93
|
+
})
|
|
94
|
+
.player(team)
|
|
95
|
+
.sort((item) => -item.location.x);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -1,79 +1,30 @@
|
|
|
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 __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));
|
|
1
|
+
import { isCustomMoveType } from '@gamepark/rules-api';
|
|
2
|
+
import { LocationType } from '../../material/LocationType';
|
|
3
|
+
import { CustomMoveType } from '../CustomMoveType';
|
|
4
|
+
import { Memory } from '../Memory';
|
|
5
|
+
import { EffectRule } from './index';
|
|
6
|
+
export class GiveCreditRule extends EffectRule {
|
|
7
|
+
onRuleStart() {
|
|
8
|
+
const moves = [];
|
|
9
|
+
const money = this.creditMoney;
|
|
10
|
+
this.memorize(Memory.CurrentEffect, JSON.parse(JSON.stringify(this.effect)));
|
|
11
|
+
this.memorize(Memory.Credit, this.effect.quantity);
|
|
12
|
+
moves.push(...money.moveMoney({ type: LocationType.TeamCredit, player: this.playerHelper.team }, { type: LocationType.TeamCredit, player: this.opponentTeam }, this.effect.quantity));
|
|
60
13
|
this.removeFirstEffect();
|
|
61
|
-
moves.push
|
|
14
|
+
moves.push(...this.afterEffectPlayed());
|
|
62
15
|
return moves;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (!
|
|
16
|
+
}
|
|
17
|
+
getExtraDataFromMove(move) {
|
|
18
|
+
if (!isCustomMoveType(CustomMoveType.DoCondition)(move))
|
|
66
19
|
return {};
|
|
67
20
|
return { quantity: move.data };
|
|
68
|
-
}
|
|
69
|
-
|
|
21
|
+
}
|
|
22
|
+
isPossible() {
|
|
70
23
|
return this.playerHelper.credits >= this.effect.quantity;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
this.forget(
|
|
74
|
-
this.forget(
|
|
24
|
+
}
|
|
25
|
+
onRuleEnd() {
|
|
26
|
+
this.forget(Memory.CurrentEffect);
|
|
27
|
+
this.forget(Memory.Credit);
|
|
75
28
|
return [];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}(index_1.EffectRule));
|
|
79
|
-
exports.GiveCreditRule = GiveCreditRule;
|
|
29
|
+
}
|
|
30
|
+
}
|