@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,109 +1,36 @@
|
|
|
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
|
-
var __values = (this && this.__values) || function(o) {
|
|
43
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
44
|
-
if (m) return m.call(o);
|
|
45
|
-
if (o && typeof o.length === "number") return {
|
|
46
|
-
next: function () {
|
|
47
|
-
if (o && i >= o.length) o = void 0;
|
|
48
|
-
return { value: o && o[i++], done: !o };
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.SpendCreditRule = void 0;
|
|
55
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
56
|
-
var LocationType_1 = require("../../material/LocationType");
|
|
57
|
-
var CustomMoveType_1 = require("../CustomMoveType");
|
|
58
|
-
var index_1 = require("./index");
|
|
59
|
-
var SpendCreditRule = (function (_super) {
|
|
60
|
-
__extends(SpendCreditRule, _super);
|
|
61
|
-
function SpendCreditRule() {
|
|
62
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
63
|
-
}
|
|
64
|
-
SpendCreditRule.prototype.onRuleStart = function (_move, _previousRule, _context) {
|
|
65
|
-
var cost = this.effect.quantity;
|
|
66
|
-
var money = this.creditMoney;
|
|
67
|
-
var moves = money.removeMoney(cost, { type: LocationType_1.LocationType.TeamCredit, player: this.playerHelper.team });
|
|
1
|
+
import { isCustomMoveType } from '@gamepark/rules-api';
|
|
2
|
+
import { LocationType } from '../../material/LocationType';
|
|
3
|
+
import { CustomMoveType } from '../CustomMoveType';
|
|
4
|
+
import { EffectRule } from './index';
|
|
5
|
+
export class SpendCreditRule extends EffectRule {
|
|
6
|
+
onRuleStart(_move, _previousRule, _context) {
|
|
7
|
+
const cost = this.effect.quantity;
|
|
8
|
+
const money = this.creditMoney;
|
|
9
|
+
const moves = money.removeMoney(cost, { type: LocationType.TeamCredit, player: this.playerHelper.team });
|
|
68
10
|
this.removeFirstEffect();
|
|
69
|
-
moves.push
|
|
11
|
+
moves.push(...this.afterEffectPlayed());
|
|
70
12
|
return moves;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (credits < quantity)
|
|
81
|
-
continue;
|
|
82
|
-
moves.push(this.customMove(CustomMoveType_1.CustomMoveType.DoCondition, quantity));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
86
|
-
finally {
|
|
87
|
-
try {
|
|
88
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
89
|
-
}
|
|
90
|
-
finally { if (e_1) throw e_1.error; }
|
|
13
|
+
}
|
|
14
|
+
getPlayerMoves() {
|
|
15
|
+
const credits = this.playerHelper.credits;
|
|
16
|
+
const effect = this.effect;
|
|
17
|
+
const moves = [];
|
|
18
|
+
for (const quantity of effect.quantities) {
|
|
19
|
+
if (credits < quantity)
|
|
20
|
+
continue;
|
|
21
|
+
moves.push(this.customMove(CustomMoveType.DoCondition, quantity));
|
|
91
22
|
}
|
|
92
23
|
return moves;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
var _b;
|
|
97
|
-
if (!(0, rules_api_1.isCustomMoveType)(CustomMoveType_1.CustomMoveType.DoCondition)(move))
|
|
24
|
+
}
|
|
25
|
+
getExtraDataFromMove(move) {
|
|
26
|
+
if (!isCustomMoveType(CustomMoveType.DoCondition)(move))
|
|
98
27
|
return {};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
28
|
+
const quantity = move.data;
|
|
29
|
+
this.effect.quantity ??= quantity;
|
|
30
|
+
const index = this.effect.quantities.indexOf(quantity);
|
|
102
31
|
return { factor: this.effect.factors[index] };
|
|
103
|
-
}
|
|
104
|
-
|
|
32
|
+
}
|
|
33
|
+
isPossible() {
|
|
105
34
|
return this.getPlayerMoves().length > 0;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
}(index_1.EffectRule));
|
|
109
|
-
exports.SpendCreditRule = SpendCreditRule;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,116 +1,39 @@
|
|
|
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
|
-
var __values = (this && this.__values) || function(o) {
|
|
43
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
44
|
-
if (m) return m.call(o);
|
|
45
|
-
if (o && typeof o.length === "number") return {
|
|
46
|
-
next: function () {
|
|
47
|
-
if (o && i >= o.length) o = void 0;
|
|
48
|
-
return { value: o && o[i++], done: !o };
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.SpendZenithiumRule = 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 index_1 = require("./index");
|
|
60
|
-
var SpendZenithiumRule = (function (_super) {
|
|
61
|
-
__extends(SpendZenithiumRule, _super);
|
|
62
|
-
function SpendZenithiumRule() {
|
|
63
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
64
|
-
}
|
|
65
|
-
SpendZenithiumRule.prototype.onRuleStart = function (_move, _previousRule, _context) {
|
|
66
|
-
var cost = this.effect.quantity;
|
|
67
|
-
var moves = [this.zenithium.deleteItem(cost)];
|
|
1
|
+
import { isCustomMoveType } from '@gamepark/rules-api';
|
|
2
|
+
import { LocationType } from '../../material/LocationType';
|
|
3
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
4
|
+
import { CustomMoveType } from '../CustomMoveType';
|
|
5
|
+
import { EffectRule } from './index';
|
|
6
|
+
export class SpendZenithiumRule extends EffectRule {
|
|
7
|
+
onRuleStart(_move, _previousRule, _context) {
|
|
8
|
+
const cost = this.effect.quantity;
|
|
9
|
+
const moves = [this.zenithium.deleteItem(cost)];
|
|
68
10
|
this.removeFirstEffect();
|
|
69
|
-
moves.push
|
|
11
|
+
moves.push(...this.afterEffectPlayed());
|
|
70
12
|
return moves;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (zenithium < quantity)
|
|
81
|
-
continue;
|
|
82
|
-
moves.push(this.customMove(CustomMoveType_1.CustomMoveType.DoCondition, quantity));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
86
|
-
finally {
|
|
87
|
-
try {
|
|
88
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
89
|
-
}
|
|
90
|
-
finally { if (e_1) throw e_1.error; }
|
|
13
|
+
}
|
|
14
|
+
getPlayerMoves() {
|
|
15
|
+
const zenithium = this.playerHelper.zenithium;
|
|
16
|
+
const effect = this.effect;
|
|
17
|
+
const moves = [];
|
|
18
|
+
for (const quantity of effect.quantities) {
|
|
19
|
+
if (zenithium < quantity)
|
|
20
|
+
continue;
|
|
21
|
+
moves.push(this.customMove(CustomMoveType.DoCondition, quantity));
|
|
91
22
|
}
|
|
92
23
|
return moves;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
configurable: true
|
|
100
|
-
});
|
|
101
|
-
SpendZenithiumRule.prototype.getExtraDataFromMove = function (move) {
|
|
102
|
-
var _a;
|
|
103
|
-
var _b;
|
|
104
|
-
if (!(0, rules_api_1.isCustomMoveType)(CustomMoveType_1.CustomMoveType.DoCondition)(move))
|
|
24
|
+
}
|
|
25
|
+
get zenithium() {
|
|
26
|
+
return this.material(MaterialType.ZenithiumToken).location(LocationType.TeamZenithium).player(this.playerHelper.team);
|
|
27
|
+
}
|
|
28
|
+
getExtraDataFromMove(move) {
|
|
29
|
+
if (!isCustomMoveType(CustomMoveType.DoCondition)(move))
|
|
105
30
|
return {};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
31
|
+
const quantity = move.data;
|
|
32
|
+
this.effect.quantity ??= quantity;
|
|
33
|
+
const index = this.effect.quantities.indexOf(quantity);
|
|
109
34
|
return { factor: this.effect.factors[index] };
|
|
110
|
-
}
|
|
111
|
-
|
|
35
|
+
}
|
|
36
|
+
isPossible() {
|
|
112
37
|
return this.getPlayerMoves().length > 0;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
}(index_1.EffectRule));
|
|
116
|
-
exports.SpendZenithiumRule = SpendZenithiumRule;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,67 +1,18 @@
|
|
|
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.StealCreditRule = void 0;
|
|
44
|
-
var Credit_1 = require("../../material/Credit");
|
|
45
|
-
var LocationType_1 = require("../../material/LocationType");
|
|
46
|
-
var MaterialType_1 = require("../../material/MaterialType");
|
|
47
|
-
var index_1 = require("./index");
|
|
48
|
-
var StealCreditRule = (function (_super) {
|
|
49
|
-
__extends(StealCreditRule, _super);
|
|
50
|
-
function StealCreditRule() {
|
|
51
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
52
|
-
}
|
|
53
|
-
StealCreditRule.prototype.onRuleStart = function () {
|
|
54
|
-
var moves = [];
|
|
55
|
-
var money = this.creditMoney;
|
|
56
|
-
moves.push.apply(moves, __spreadArray([], __read(money.moveMoney({ type: LocationType_1.LocationType.TeamCredit, player: this.opponentTeam }, { type: LocationType_1.LocationType.TeamCredit, player: this.playerHelper.team }, this.effect.quantity)), false));
|
|
1
|
+
import { credits } from '../../material/Credit';
|
|
2
|
+
import { LocationType } from '../../material/LocationType';
|
|
3
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
4
|
+
import { EffectRule } from './index';
|
|
5
|
+
export class StealCreditRule extends EffectRule {
|
|
6
|
+
onRuleStart() {
|
|
7
|
+
const moves = [];
|
|
8
|
+
const money = this.creditMoney;
|
|
9
|
+
moves.push(...money.moveMoney({ type: LocationType.TeamCredit, player: this.opponentTeam }, { type: LocationType.TeamCredit, player: this.playerHelper.team }, this.effect.quantity));
|
|
57
10
|
this.removeFirstEffect();
|
|
58
|
-
moves.push
|
|
11
|
+
moves.push(...this.afterEffectPlayed());
|
|
59
12
|
return moves;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
13
|
+
}
|
|
14
|
+
isPossible() {
|
|
15
|
+
const opponentCredits = this.material(MaterialType.CreditToken).money(credits).player(this.opponentTeam).count;
|
|
63
16
|
return opponentCredits >= this.effect.quantity;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
}(index_1.EffectRule));
|
|
67
|
-
exports.StealCreditRule = StealCreditRule;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,98 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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; }
|
|
1
|
+
import { isMoveItemType } from '@gamepark/rules-api';
|
|
2
|
+
import { LocationType } from '../../material/LocationType';
|
|
3
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
4
|
+
import { BonusHelper } from '../helper/BonusHelper';
|
|
5
|
+
import { EffectRule } from './index';
|
|
6
|
+
export class TakeBonusRule extends EffectRule {
|
|
7
|
+
getPlayerMoves() {
|
|
8
|
+
return this.bonusTokens.moveItems({
|
|
9
|
+
type: LocationType.BonusDiscard
|
|
10
|
+
});
|
|
30
11
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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];
|
|
12
|
+
get bonusTokens() {
|
|
13
|
+
if (this.effect.visible) {
|
|
14
|
+
return this.visibleBonusToken;
|
|
38
15
|
}
|
|
16
|
+
return this.reserveBonusToken;
|
|
39
17
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.TakeBonusRule = void 0;
|
|
44
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
45
|
-
var LocationType_1 = require("../../material/LocationType");
|
|
46
|
-
var MaterialType_1 = require("../../material/MaterialType");
|
|
47
|
-
var BonusHelper_1 = require("../helper/BonusHelper");
|
|
48
|
-
var index_1 = require("./index");
|
|
49
|
-
var TakeBonusRule = (function (_super) {
|
|
50
|
-
__extends(TakeBonusRule, _super);
|
|
51
|
-
function TakeBonusRule() {
|
|
52
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
53
|
-
}
|
|
54
|
-
TakeBonusRule.prototype.getPlayerMoves = function () {
|
|
55
|
-
return this.bonusTokens.moveItems({
|
|
56
|
-
type: LocationType_1.LocationType.BonusDiscard
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
Object.defineProperty(TakeBonusRule.prototype, "bonusTokens", {
|
|
60
|
-
get: function () {
|
|
61
|
-
if (this.effect.visible) {
|
|
62
|
-
return this.visibleBonusToken;
|
|
63
|
-
}
|
|
64
|
-
return this.reserveBonusToken;
|
|
65
|
-
},
|
|
66
|
-
enumerable: false,
|
|
67
|
-
configurable: true
|
|
68
|
-
});
|
|
69
|
-
TakeBonusRule.prototype.afterItemMove = function (move) {
|
|
70
|
-
if (!(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.BonusToken)(move) || move.location.type !== LocationType_1.LocationType.BonusDiscard)
|
|
18
|
+
afterItemMove(move) {
|
|
19
|
+
if (!isMoveItemType(MaterialType.BonusToken)(move) || move.location.type !== LocationType.BonusDiscard)
|
|
71
20
|
return [];
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
new
|
|
21
|
+
const bonusToken = this.material(MaterialType.BonusToken).index(move.itemIndex);
|
|
22
|
+
const moves = [];
|
|
23
|
+
new BonusHelper(this.game).applyBonusEffect(bonusToken);
|
|
75
24
|
this.removeFirstEffect();
|
|
76
|
-
moves.push
|
|
25
|
+
moves.push(...this.applyFirstEffect());
|
|
77
26
|
return moves;
|
|
78
|
-
}
|
|
79
|
-
|
|
27
|
+
}
|
|
28
|
+
isPossible() {
|
|
80
29
|
return this.bonusTokens.length > 0;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
Object.defineProperty(TakeBonusRule.prototype, "reserveBonusToken", {
|
|
90
|
-
get: function () {
|
|
91
|
-
return this.material(MaterialType_1.MaterialType.BonusToken).location(LocationType_1.LocationType.BonusTokenStock);
|
|
92
|
-
},
|
|
93
|
-
enumerable: false,
|
|
94
|
-
configurable: true
|
|
95
|
-
});
|
|
96
|
-
return TakeBonusRule;
|
|
97
|
-
}(index_1.EffectRule));
|
|
98
|
-
exports.TakeBonusRule = TakeBonusRule;
|
|
30
|
+
}
|
|
31
|
+
get visibleBonusToken() {
|
|
32
|
+
return this.material(MaterialType.BonusToken).location((l) => l.type === LocationType.PlanetBoardBonusSpace || l.type === LocationType.TechnologyBoardBonusSpace);
|
|
33
|
+
}
|
|
34
|
+
get reserveBonusToken() {
|
|
35
|
+
return this.material(MaterialType.BonusToken).location(LocationType.BonusTokenStock);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -1,102 +1,45 @@
|
|
|
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.TakeLeaderBadgeRule = 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 TakeLeaderBadgeRule = (function (_super) {
|
|
49
|
-
__extends(TakeLeaderBadgeRule, _super);
|
|
50
|
-
function TakeLeaderBadgeRule() {
|
|
51
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
52
|
-
}
|
|
53
|
-
TakeLeaderBadgeRule.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 TakeLeaderBadgeRule extends EffectRule {
|
|
6
|
+
onRuleStart() {
|
|
7
|
+
const moves = super.onRuleStart();
|
|
55
8
|
if (moves.length > 0)
|
|
56
9
|
return moves;
|
|
57
|
-
this.memorize(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
10
|
+
this.memorize(Memory.CurrentEffect, JSON.parse(JSON.stringify(this.effect)));
|
|
11
|
+
const leaderBadge = this.leader;
|
|
12
|
+
const item = leaderBadge.getItem();
|
|
13
|
+
const team = this.playerHelper.team;
|
|
61
14
|
if (item.location.player === team) {
|
|
62
15
|
if (!item.location.rotation) {
|
|
63
16
|
moves.push(leaderBadge.rotateItem(this.newBadgeRotation));
|
|
64
17
|
}
|
|
65
18
|
}
|
|
66
19
|
else {
|
|
67
|
-
moves.push
|
|
68
|
-
type:
|
|
20
|
+
moves.push(...leaderBadge.moveItems({
|
|
21
|
+
type: LocationType.TeamLeaderBadge,
|
|
69
22
|
rotation: this.newBadgeRotation,
|
|
70
23
|
player: team
|
|
71
|
-
}))
|
|
24
|
+
}));
|
|
72
25
|
}
|
|
73
26
|
this.removeFirstEffect();
|
|
74
|
-
moves.push
|
|
27
|
+
moves.push(...this.afterEffectPlayed());
|
|
75
28
|
return moves;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
get: function () {
|
|
91
|
-
return this.material(MaterialType_1.MaterialType.LeaderBadgeToken);
|
|
92
|
-
},
|
|
93
|
-
enumerable: false,
|
|
94
|
-
configurable: true
|
|
95
|
-
});
|
|
96
|
-
TakeLeaderBadgeRule.prototype.onRuleEnd = function () {
|
|
97
|
-
this.forget(Memory_1.Memory.CurrentEffect);
|
|
29
|
+
}
|
|
30
|
+
get newBadgeRotation() {
|
|
31
|
+
const leaderBadge = this.leader;
|
|
32
|
+
const item = leaderBadge.getItem();
|
|
33
|
+
const team = this.playerHelper.team;
|
|
34
|
+
if (item.location.player === team && !item.location.rotation)
|
|
35
|
+
return true;
|
|
36
|
+
return this.effect.gold;
|
|
37
|
+
}
|
|
38
|
+
get leader() {
|
|
39
|
+
return this.material(MaterialType.LeaderBadgeToken);
|
|
40
|
+
}
|
|
41
|
+
onRuleEnd() {
|
|
42
|
+
this.forget(Memory.CurrentEffect);
|
|
98
43
|
return [];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
}(index_1.EffectRule));
|
|
102
|
-
exports.TakeLeaderBadgeRule = TakeLeaderBadgeRule;
|
|
44
|
+
}
|
|
45
|
+
}
|