@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.
Files changed (63) hide show
  1. package/dist/PlayerId.js +1 -2
  2. package/dist/TeamColor.js +7 -13
  3. package/dist/ZenithOptions.js +1 -4
  4. package/dist/ZenithRules.js +71 -122
  5. package/dist/ZenithSetup.js +123 -266
  6. package/dist/index.js +3 -9
  7. package/dist/material/Agent.js +4 -7
  8. package/dist/material/Agents.js +920 -923
  9. package/dist/material/Bonus.js +5 -8
  10. package/dist/material/Bonuses.js +29 -33
  11. package/dist/material/Credit.js +4 -7
  12. package/dist/material/Faction.js +4 -7
  13. package/dist/material/Influence.js +4 -7
  14. package/dist/material/LocationType.js +2 -5
  15. package/dist/material/MaterialType.js +2 -5
  16. package/dist/material/effect/Effect.js +5 -10
  17. package/dist/material/effect/EffectType.js +2 -5
  18. package/dist/rules/CustomMoveType.js +2 -5
  19. package/dist/rules/DiscardActionRule.js +26 -75
  20. package/dist/rules/Memory.js +2 -5
  21. package/dist/rules/MulliganRule.js +47 -126
  22. package/dist/rules/PlayCardRule.js +68 -134
  23. package/dist/rules/RefillRule.js +83 -190
  24. package/dist/rules/RuleId.js +2 -5
  25. package/dist/rules/discard-action/DiplomacyActions.js +15 -20
  26. package/dist/rules/discard-action/DiplomacyBoardRule.js +27 -64
  27. package/dist/rules/discard-action/TechnologyActions.js +44 -48
  28. package/dist/rules/discard-action/TechnologyBoardRule.js +34 -102
  29. package/dist/rules/effect/ChoiceRule.js +21 -81
  30. package/dist/rules/effect/ConditionalRule.js +77 -141
  31. package/dist/rules/effect/DevelopTechnologyRule.js +53 -119
  32. package/dist/rules/effect/DiscardRule.js +37 -90
  33. package/dist/rules/effect/EffectRule.js +60 -138
  34. package/dist/rules/effect/ExileRule.js +62 -147
  35. package/dist/rules/effect/GiveCreditRule.js +24 -73
  36. package/dist/rules/effect/GiveInfluenceRule.js +38 -101
  37. package/dist/rules/effect/GiveLeaderBadgeRule.js +18 -46
  38. package/dist/rules/effect/GiveZenithiumRule.js +25 -79
  39. package/dist/rules/effect/MobilizeRule.js +38 -93
  40. package/dist/rules/effect/ResetInfluenceRule.js +21 -58
  41. package/dist/rules/effect/SpendCreditRule.js +29 -102
  42. package/dist/rules/effect/SpendZenithiumRule.js +32 -109
  43. package/dist/rules/effect/StealCreditRule.js +15 -64
  44. package/dist/rules/effect/TakeBonusRule.js +30 -91
  45. package/dist/rules/effect/TakeLeaderBadgeRule.js +31 -88
  46. package/dist/rules/effect/TakeTechnologyBonusTokenRule.js +45 -112
  47. package/dist/rules/effect/TransferRule.js +47 -81
  48. package/dist/rules/effect/WinCreditRule.js +60 -130
  49. package/dist/rules/effect/WinInfluenceRule.js +128 -248
  50. package/dist/rules/effect/WinZenithiumRule.js +24 -80
  51. package/dist/rules/effect/index.js +19 -35
  52. package/dist/rules/helper/BonusHelper.js +32 -64
  53. package/dist/rules/helper/CreditHelper.js +19 -44
  54. package/dist/rules/helper/EffectHelper.js +81 -123
  55. package/dist/rules/helper/EffectRuleIds.js +25 -29
  56. package/dist/rules/helper/EndGameHelper.js +24 -57
  57. package/dist/rules/helper/InfluenceHelper.js +18 -44
  58. package/dist/rules/helper/MobilizeHelper.js +27 -53
  59. package/dist/rules/helper/PlanetHelper.js +45 -78
  60. package/dist/rules/helper/PlayerHelper.js +24 -60
  61. package/dist/rules/helper/TechnologyHelper.js +31 -87
  62. package/dist/rules/helper/ZenithiumHelper.js +25 -48
  63. package/package.json +4 -3
@@ -1,109 +1,36 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __read = (this && this.__read) || function (o, n) {
18
- var m = typeof Symbol === "function" && o[Symbol.iterator];
19
- if (!m) return o;
20
- var i = m.call(o), r, ar = [], e;
21
- try {
22
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
23
- }
24
- catch (error) { e = { error: error }; }
25
- finally {
26
- try {
27
- if (r && !r.done && (m = i["return"])) m.call(i);
28
- }
29
- finally { if (e) throw e.error; }
30
- }
31
- return ar;
32
- };
33
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
34
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
35
- if (ar || !(i in from)) {
36
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
37
- ar[i] = from[i];
38
- }
39
- }
40
- return to.concat(ar || Array.prototype.slice.call(from));
41
- };
42
- 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.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
11
+ moves.push(...this.afterEffectPlayed());
70
12
  return moves;
71
- };
72
- SpendCreditRule.prototype.getPlayerMoves = function () {
73
- var e_1, _a;
74
- var credits = this.playerHelper.credits;
75
- var effect = this.effect;
76
- var moves = [];
77
- try {
78
- for (var _b = __values(effect.quantities), _c = _b.next(); !_c.done; _c = _b.next()) {
79
- var quantity = _c.value;
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
- SpendCreditRule.prototype.getExtraDataFromMove = function (move) {
95
- var _a;
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
- var quantity = move.data;
100
- (_a = (_b = this.effect).quantity) !== null && _a !== void 0 ? _a : (_b.quantity = quantity);
101
- var index = this.effect.quantities.indexOf(quantity);
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
- SpendCreditRule.prototype.isPossible = function () {
32
+ }
33
+ isPossible() {
105
34
  return this.getPlayerMoves().length > 0;
106
- };
107
- return SpendCreditRule;
108
- }(index_1.EffectRule));
109
- exports.SpendCreditRule = SpendCreditRule;
35
+ }
36
+ }
@@ -1,116 +1,39 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __read = (this && this.__read) || function (o, n) {
18
- var m = typeof Symbol === "function" && o[Symbol.iterator];
19
- if (!m) return o;
20
- var i = m.call(o), r, ar = [], e;
21
- try {
22
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
23
- }
24
- catch (error) { e = { error: error }; }
25
- finally {
26
- try {
27
- if (r && !r.done && (m = i["return"])) m.call(i);
28
- }
29
- finally { if (e) throw e.error; }
30
- }
31
- return ar;
32
- };
33
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
34
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
35
- if (ar || !(i in from)) {
36
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
37
- ar[i] = from[i];
38
- }
39
- }
40
- return to.concat(ar || Array.prototype.slice.call(from));
41
- };
42
- 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.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
11
+ moves.push(...this.afterEffectPlayed());
70
12
  return moves;
71
- };
72
- SpendZenithiumRule.prototype.getPlayerMoves = function () {
73
- var e_1, _a;
74
- var zenithium = this.playerHelper.zenithium;
75
- var effect = this.effect;
76
- var moves = [];
77
- try {
78
- for (var _b = __values(effect.quantities), _c = _b.next(); !_c.done; _c = _b.next()) {
79
- var quantity = _c.value;
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
- Object.defineProperty(SpendZenithiumRule.prototype, "zenithium", {
95
- get: function () {
96
- return this.material(MaterialType_1.MaterialType.ZenithiumToken).location(LocationType_1.LocationType.TeamZenithium).player(this.playerHelper.team);
97
- },
98
- enumerable: false,
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
- var quantity = move.data;
107
- (_a = (_b = this.effect).quantity) !== null && _a !== void 0 ? _a : (_b.quantity = quantity);
108
- var index = this.effect.quantities.indexOf(quantity);
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
- SpendZenithiumRule.prototype.isPossible = function () {
35
+ }
36
+ isPossible() {
112
37
  return this.getPlayerMoves().length > 0;
113
- };
114
- return SpendZenithiumRule;
115
- }(index_1.EffectRule));
116
- exports.SpendZenithiumRule = SpendZenithiumRule;
38
+ }
39
+ }
@@ -1,67 +1,18 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __read = (this && this.__read) || function (o, n) {
18
- var m = typeof Symbol === "function" && o[Symbol.iterator];
19
- if (!m) return o;
20
- var i = m.call(o), r, ar = [], e;
21
- try {
22
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
23
- }
24
- catch (error) { e = { error: error }; }
25
- finally {
26
- try {
27
- if (r && !r.done && (m = i["return"])) m.call(i);
28
- }
29
- finally { if (e) throw e.error; }
30
- }
31
- return ar;
32
- };
33
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
34
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
35
- if (ar || !(i in from)) {
36
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
37
- ar[i] = from[i];
38
- }
39
- }
40
- return to.concat(ar || Array.prototype.slice.call(from));
41
- };
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.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.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
11
+ moves.push(...this.afterEffectPlayed());
59
12
  return moves;
60
- };
61
- StealCreditRule.prototype.isPossible = function () {
62
- var opponentCredits = this.material(MaterialType_1.MaterialType.CreditToken).money(Credit_1.credits).player(this.opponentTeam).count;
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
- return StealCreditRule;
66
- }(index_1.EffectRule));
67
- exports.StealCreditRule = StealCreditRule;
17
+ }
18
+ }
@@ -1,98 +1,37 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __read = (this && this.__read) || function (o, n) {
18
- var m = typeof Symbol === "function" && o[Symbol.iterator];
19
- if (!m) return o;
20
- var i = m.call(o), r, ar = [], e;
21
- try {
22
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
23
- }
24
- catch (error) { e = { error: error }; }
25
- finally {
26
- try {
27
- if (r && !r.done && (m = i["return"])) m.call(i);
28
- }
29
- finally { if (e) throw e.error; }
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
- 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];
12
+ get bonusTokens() {
13
+ if (this.effect.visible) {
14
+ return this.visibleBonusToken;
38
15
  }
16
+ return this.reserveBonusToken;
39
17
  }
40
- return to.concat(ar || Array.prototype.slice.call(from));
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
- var bonusToken = this.material(MaterialType_1.MaterialType.BonusToken).index(move.itemIndex);
73
- var moves = [];
74
- new BonusHelper_1.BonusHelper(this.game).applyBonusEffect(bonusToken);
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.apply(moves, __spreadArray([], __read(this.applyFirstEffect()), false));
25
+ moves.push(...this.applyFirstEffect());
77
26
  return moves;
78
- };
79
- TakeBonusRule.prototype.isPossible = function () {
27
+ }
28
+ isPossible() {
80
29
  return this.bonusTokens.length > 0;
81
- };
82
- Object.defineProperty(TakeBonusRule.prototype, "visibleBonusToken", {
83
- get: function () {
84
- return this.material(MaterialType_1.MaterialType.BonusToken).location(function (l) { return l.type === LocationType_1.LocationType.PlanetBoardBonusSpace || l.type === LocationType_1.LocationType.TechnologyBoardBonusSpace; });
85
- },
86
- enumerable: false,
87
- configurable: true
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
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __read = (this && this.__read) || function (o, n) {
18
- var m = typeof Symbol === "function" && o[Symbol.iterator];
19
- if (!m) return o;
20
- var i = m.call(o), r, ar = [], e;
21
- try {
22
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
23
- }
24
- catch (error) { e = { error: error }; }
25
- finally {
26
- try {
27
- if (r && !r.done && (m = i["return"])) m.call(i);
28
- }
29
- finally { if (e) throw e.error; }
30
- }
31
- return ar;
32
- };
33
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
34
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
35
- if (ar || !(i in from)) {
36
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
37
- ar[i] = from[i];
38
- }
39
- }
40
- return to.concat(ar || Array.prototype.slice.call(from));
41
- };
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.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(Memory_1.Memory.CurrentEffect, JSON.parse(JSON.stringify(this.effect)));
58
- var leaderBadge = this.leader;
59
- var item = leaderBadge.getItem();
60
- var team = this.playerHelper.team;
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.apply(moves, __spreadArray([], __read(leaderBadge.moveItems({
68
- type: LocationType_1.LocationType.TeamLeaderBadge,
20
+ moves.push(...leaderBadge.moveItems({
21
+ type: LocationType.TeamLeaderBadge,
69
22
  rotation: this.newBadgeRotation,
70
23
  player: team
71
- })), false));
24
+ }));
72
25
  }
73
26
  this.removeFirstEffect();
74
- moves.push.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
27
+ moves.push(...this.afterEffectPlayed());
75
28
  return moves;
76
- };
77
- Object.defineProperty(TakeLeaderBadgeRule.prototype, "newBadgeRotation", {
78
- get: function () {
79
- var leaderBadge = this.leader;
80
- var item = leaderBadge.getItem();
81
- var team = this.playerHelper.team;
82
- if (item.location.player === team && !item.location.rotation)
83
- return true;
84
- return this.effect.gold;
85
- },
86
- enumerable: false,
87
- configurable: true
88
- });
89
- Object.defineProperty(TakeLeaderBadgeRule.prototype, "leader", {
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
- return TakeLeaderBadgeRule;
101
- }(index_1.EffectRule));
102
- exports.TakeLeaderBadgeRule = TakeLeaderBadgeRule;
44
+ }
45
+ }