@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,119 +1,56 @@
|
|
|
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 { isMoveItemType } from '@gamepark/rules-api';
|
|
2
|
+
import { LocationType } from '../../material/LocationType';
|
|
3
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
4
|
+
import { TeamColor } from '../../TeamColor';
|
|
5
|
+
import { BonusHelper } from '../helper/BonusHelper';
|
|
6
|
+
import { EndGameHelper } from '../helper/EndGameHelper';
|
|
7
|
+
import { EffectRule } from './index';
|
|
8
|
+
export class GiveInfluenceRule extends EffectRule {
|
|
9
|
+
getPlayerMoves() {
|
|
10
|
+
const moves = [];
|
|
11
|
+
const planets = this.planets;
|
|
12
|
+
moves.push(...planets.moveItems((item) => ({
|
|
13
|
+
...item.location,
|
|
14
|
+
x: this.getPositionAfterPush(item)
|
|
15
|
+
})));
|
|
16
|
+
return moves;
|
|
50
17
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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;
|
|
18
|
+
get planets() {
|
|
19
|
+
const planets = this.material(MaterialType.InfluenceDisc).location(LocationType.PlanetBoardInfluenceDiscSpace);
|
|
20
|
+
if (this.effect.except)
|
|
21
|
+
return planets.filter((item) => item.id !== this.effect.except);
|
|
22
|
+
return planets;
|
|
66
23
|
}
|
|
67
|
-
|
|
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 () {
|
|
24
|
+
isPossible() {
|
|
86
25
|
return this.getPlayerMoves().length > 0;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (this.player ===
|
|
26
|
+
}
|
|
27
|
+
getPositionAfterPush(item) {
|
|
28
|
+
if (this.player === TeamColor.White) {
|
|
90
29
|
return Math.min(4, item.location.x + 1);
|
|
91
30
|
}
|
|
92
31
|
return Math.max(-4, item.location.x - 1);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (!
|
|
32
|
+
}
|
|
33
|
+
afterItemMove(move) {
|
|
34
|
+
if (!isMoveItemType(MaterialType.InfluenceDisc)(move))
|
|
96
35
|
return [];
|
|
97
36
|
if (Math.abs(move.location.x) === 4) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
moves.push
|
|
102
|
-
type:
|
|
37
|
+
const planet = this.material(MaterialType.InfluenceDisc).index(move.itemIndex);
|
|
38
|
+
const helper = new EndGameHelper(this.game);
|
|
39
|
+
const moves = [];
|
|
40
|
+
moves.push(...planet.moveItems({
|
|
41
|
+
type: LocationType.TeamPlanets,
|
|
103
42
|
player: this.playerHelper.team
|
|
104
|
-
}))
|
|
43
|
+
}));
|
|
105
44
|
if (helper.willEnd(this.playerHelper.team)) {
|
|
106
45
|
moves.push(this.endGame());
|
|
107
46
|
}
|
|
108
47
|
else {
|
|
109
|
-
|
|
110
|
-
moves.push
|
|
48
|
+
const item = planet.getItem();
|
|
49
|
+
moves.push(...new BonusHelper(this.game).applyInfluenceBonus(item.id));
|
|
111
50
|
}
|
|
112
51
|
return moves;
|
|
113
52
|
}
|
|
114
53
|
this.removeFirstEffect();
|
|
115
54
|
return this.afterEffectPlayed();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
}(index_1.EffectRule));
|
|
119
|
-
exports.GiveInfluenceRule = GiveInfluenceRule;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -1,54 +1,26 @@
|
|
|
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
|
-
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 = [];
|
|
1
|
+
import { isMoveItemType } from '@gamepark/rules-api';
|
|
2
|
+
import { LocationType } from '../../material/LocationType';
|
|
3
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
4
|
+
import { EffectRule } from './index';
|
|
5
|
+
export class GiveLeaderBadgeRule extends EffectRule {
|
|
6
|
+
getPlayerMoves() {
|
|
7
|
+
const moves = [];
|
|
30
8
|
moves.push(this.leaderBadge.moveItem({
|
|
31
|
-
type:
|
|
9
|
+
type: LocationType.TeamLeaderBadge,
|
|
32
10
|
player: this.opponentTeam
|
|
33
11
|
}));
|
|
34
12
|
return moves;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
enumerable: false,
|
|
41
|
-
configurable: true
|
|
42
|
-
});
|
|
43
|
-
GiveLeaderBadgeRule.prototype.isPossible = function () {
|
|
13
|
+
}
|
|
14
|
+
get leaderBadge() {
|
|
15
|
+
return this.material(MaterialType.LeaderBadgeToken);
|
|
16
|
+
}
|
|
17
|
+
isPossible() {
|
|
44
18
|
return this.playerHelper.isLeader;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (!
|
|
19
|
+
}
|
|
20
|
+
afterItemMove(move) {
|
|
21
|
+
if (!isMoveItemType(MaterialType.InfluenceDisc)(move))
|
|
48
22
|
return [];
|
|
49
23
|
this.removeFirstEffect();
|
|
50
24
|
return this.afterEffectPlayed();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
}(index_1.EffectRule));
|
|
54
|
-
exports.GiveLeaderBadgeRule = GiveLeaderBadgeRule;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,85 +1,31 @@
|
|
|
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.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);
|
|
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 GiveZenithiumRule extends EffectRule {
|
|
6
|
+
onRuleStart() {
|
|
7
|
+
const moves = super.onRuleStart();
|
|
55
8
|
if (moves.length > 0)
|
|
56
9
|
return moves;
|
|
57
|
-
this.memorize(
|
|
58
|
-
this.memorize(
|
|
59
|
-
moves.push
|
|
60
|
-
type:
|
|
10
|
+
this.memorize(Memory.CurrentEffect, JSON.parse(JSON.stringify(this.effect)));
|
|
11
|
+
this.memorize(Memory.Zenithium, this.effect.quantity);
|
|
12
|
+
moves.push(...this.zenithium.moveItems({
|
|
13
|
+
type: LocationType.TeamZenithium,
|
|
61
14
|
player: this.opponentTeam
|
|
62
|
-
}, this.effect.quantity))
|
|
15
|
+
}, this.effect.quantity));
|
|
63
16
|
this.removeFirstEffect();
|
|
64
|
-
moves.push
|
|
17
|
+
moves.push(...this.afterEffectPlayed());
|
|
65
18
|
return moves;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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);
|
|
19
|
+
}
|
|
20
|
+
get zenithium() {
|
|
21
|
+
return this.material(MaterialType.ZenithiumToken).location(LocationType.TeamZenithium).player(this.playerHelper.team);
|
|
22
|
+
}
|
|
23
|
+
isPossible() {
|
|
24
|
+
return this.zenithium.getQuantity() >= (this.effect.quantity ?? 1);
|
|
25
|
+
}
|
|
26
|
+
onRuleEnd() {
|
|
27
|
+
this.forget(Memory.CurrentEffect);
|
|
28
|
+
this.forget(Memory.Zenithium);
|
|
81
29
|
return [];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
}(index_1.EffectRule));
|
|
85
|
-
exports.GiveZenithiumRule = GiveZenithiumRule;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,90 +1,41 @@
|
|
|
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.MobilizeRule = 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 index_1 = require("./index");
|
|
49
|
-
var MobilizeRule = (function (_super) {
|
|
50
|
-
__extends(MobilizeRule, _super);
|
|
51
|
-
function MobilizeRule() {
|
|
52
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
53
|
-
}
|
|
54
|
-
MobilizeRule.prototype.onRuleStart = function () {
|
|
55
|
-
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 { EffectRule } from './index';
|
|
6
|
+
export class MobilizeRule extends EffectRule {
|
|
7
|
+
onRuleStart() {
|
|
8
|
+
const moves = super.onRuleStart();
|
|
56
9
|
if (moves.length > 0)
|
|
57
10
|
return moves;
|
|
58
11
|
return this.getAutomaticEffectMoves();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var agent = this.material(MaterialType_1.MaterialType.AgentCard)
|
|
65
|
-
.location(LocationType_1.LocationType.AgentDeck)
|
|
12
|
+
}
|
|
13
|
+
getAutomaticEffectMoves() {
|
|
14
|
+
const moves = [];
|
|
15
|
+
const agent = this.material(MaterialType.AgentCard)
|
|
16
|
+
.location(LocationType.AgentDeck)
|
|
66
17
|
.deck()
|
|
67
|
-
.limit(
|
|
68
|
-
if (!agent.length || !
|
|
18
|
+
.limit(this.effect.quantity ?? 1);
|
|
19
|
+
if (!agent.length || !agent.getItem()?.id)
|
|
69
20
|
return [];
|
|
70
|
-
moves.push
|
|
71
|
-
type:
|
|
72
|
-
id:
|
|
73
|
-
player:
|
|
74
|
-
})
|
|
21
|
+
moves.push(...agent.moveItems((item) => ({
|
|
22
|
+
type: LocationType.Influence,
|
|
23
|
+
id: Agents[item.id].influence,
|
|
24
|
+
player: this.playerHelper.team
|
|
25
|
+
})));
|
|
75
26
|
return moves;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (!
|
|
27
|
+
}
|
|
28
|
+
decrement(move) {
|
|
29
|
+
if (!isMoveItemType(MaterialType.AgentCard)(move) || move.location.type !== LocationType.Influence)
|
|
79
30
|
return false;
|
|
80
31
|
if (this.effect.quantity) {
|
|
81
32
|
this.effect.quantity--;
|
|
82
33
|
return this.effect.quantity === 0;
|
|
83
34
|
}
|
|
84
35
|
return true;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (!
|
|
36
|
+
}
|
|
37
|
+
afterItemMove(move) {
|
|
38
|
+
if (!isMoveItemType(MaterialType.AgentCard)(move) || move.location.type !== LocationType.Influence)
|
|
88
39
|
return [];
|
|
89
40
|
if (this.effect.quantity) {
|
|
90
41
|
this.effect.quantity--;
|
|
@@ -94,24 +45,18 @@ var MobilizeRule = (function (_super) {
|
|
|
94
45
|
return this.afterEffectPlayed();
|
|
95
46
|
}
|
|
96
47
|
return [];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
return { quantity:
|
|
48
|
+
}
|
|
49
|
+
getExtraDataFromMove(move) {
|
|
50
|
+
if (isMoveItemType(MaterialType.AgentCard)(move) && move.location.type === LocationType.Influence) {
|
|
51
|
+
const card = this.material(MaterialType.AgentCard).getItem(move.itemIndex);
|
|
52
|
+
return { quantity: Agents[card.id].cost, influence: Agents[card.id].influence };
|
|
102
53
|
}
|
|
103
54
|
return {};
|
|
104
|
-
}
|
|
105
|
-
|
|
55
|
+
}
|
|
56
|
+
isPossible() {
|
|
106
57
|
return this.deck.length > 0;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
enumerable: false,
|
|
113
|
-
configurable: true
|
|
114
|
-
});
|
|
115
|
-
return MobilizeRule;
|
|
116
|
-
}(index_1.EffectRule));
|
|
117
|
-
exports.MobilizeRule = MobilizeRule;
|
|
58
|
+
}
|
|
59
|
+
get deck() {
|
|
60
|
+
return this.material(MaterialType.AgentCard).location(LocationType.AgentDeck).deck();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,63 +1,26 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.ResetInfluenceRule = void 0;
|
|
30
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
31
|
-
var LocationType_1 = require("../../material/LocationType");
|
|
32
|
-
var MaterialType_1 = require("../../material/MaterialType");
|
|
33
|
-
var TeamColor_1 = require("../../TeamColor");
|
|
34
|
-
var index_1 = require("./index");
|
|
35
|
-
var ResetInfluenceRule = (function (_super) {
|
|
36
|
-
__extends(ResetInfluenceRule, _super);
|
|
37
|
-
function ResetInfluenceRule() {
|
|
38
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1
|
+
import { isMoveItemType } from '@gamepark/rules-api';
|
|
2
|
+
import { LocationType } from '../../material/LocationType';
|
|
3
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
4
|
+
import { TeamColor } from '../../TeamColor';
|
|
5
|
+
import { EffectRule } from './index';
|
|
6
|
+
export class ResetInfluenceRule extends EffectRule {
|
|
7
|
+
getPlayerMoves() {
|
|
8
|
+
const planets = this.planets;
|
|
9
|
+
return planets.moveItems((item) => ({
|
|
10
|
+
...item.location,
|
|
11
|
+
x: 0
|
|
12
|
+
}));
|
|
39
13
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return planets.moveItems(function (item) { return (__assign(__assign({}, item.location), { x: 0 })); });
|
|
43
|
-
};
|
|
44
|
-
ResetInfluenceRule.prototype.afterItemMove = function (move) {
|
|
45
|
-
if (!(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.InfluenceDisc)(move) || move.location.x !== 0)
|
|
14
|
+
afterItemMove(move) {
|
|
15
|
+
if (!isMoveItemType(MaterialType.InfluenceDisc)(move) || move.location.x !== 0)
|
|
46
16
|
return [];
|
|
47
17
|
this.removeFirstEffect();
|
|
48
18
|
return this.afterEffectPlayed();
|
|
49
|
-
}
|
|
50
|
-
|
|
19
|
+
}
|
|
20
|
+
isPossible() {
|
|
51
21
|
return this.planets.length > 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
enumerable: false,
|
|
59
|
-
configurable: true
|
|
60
|
-
});
|
|
61
|
-
return ResetInfluenceRule;
|
|
62
|
-
}(index_1.EffectRule));
|
|
63
|
-
exports.ResetInfluenceRule = ResetInfluenceRule;
|
|
22
|
+
}
|
|
23
|
+
get planets() {
|
|
24
|
+
return this.material(MaterialType.InfluenceDisc).location((l) => l.type === LocationType.PlanetBoardInfluenceDiscSpace && (this.playerHelper.team === TeamColor.White ? l.x < 0 : l.x > 0));
|
|
25
|
+
}
|
|
26
|
+
}
|