@gamepark/zenith 0.0.1

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 (125) hide show
  1. package/dist/PlayerId.d.ts +1 -0
  2. package/dist/PlayerId.js +2 -0
  3. package/dist/TeamColor.d.ts +9 -0
  4. package/dist/TeamColor.js +16 -0
  5. package/dist/ZenithOptions.d.ts +5 -0
  6. package/dist/ZenithOptions.js +4 -0
  7. package/dist/ZenithRules.d.ts +68 -0
  8. package/dist/ZenithRules.js +128 -0
  9. package/dist/ZenithSetup.d.ts +24 -0
  10. package/dist/ZenithSetup.js +316 -0
  11. package/dist/index.d.ts +3 -0
  12. package/dist/index.js +9 -0
  13. package/dist/material/Agent.d.ts +93 -0
  14. package/dist/material/Agent.js +98 -0
  15. package/dist/material/Agents.d.ts +102 -0
  16. package/dist/material/Agents.js +2305 -0
  17. package/dist/material/Bonus.d.ts +12 -0
  18. package/dist/material/Bonus.js +34 -0
  19. package/dist/material/Bonuses.d.ts +14 -0
  20. package/dist/material/Bonuses.js +63 -0
  21. package/dist/material/Credit.d.ts +6 -0
  22. package/dist/material/Credit.js +11 -0
  23. package/dist/material/Faction.d.ts +6 -0
  24. package/dist/material/Faction.js +11 -0
  25. package/dist/material/Influence.d.ts +8 -0
  26. package/dist/material/Influence.js +13 -0
  27. package/dist/material/LocationType.d.ts +23 -0
  28. package/dist/material/LocationType.js +27 -0
  29. package/dist/material/MaterialType.d.ts +12 -0
  30. package/dist/material/MaterialType.js +16 -0
  31. package/dist/material/effect/Effect.d.ts +144 -0
  32. package/dist/material/effect/Effect.js +14 -0
  33. package/dist/material/effect/EffectType.d.ts +23 -0
  34. package/dist/material/effect/EffectType.js +27 -0
  35. package/dist/rules/CustomMoveType.d.ts +8 -0
  36. package/dist/rules/CustomMoveType.js +12 -0
  37. package/dist/rules/DiscardActionRule.d.ts +8 -0
  38. package/dist/rules/DiscardActionRule.js +84 -0
  39. package/dist/rules/Memory.d.ts +25 -0
  40. package/dist/rules/Memory.js +19 -0
  41. package/dist/rules/MulliganRule.d.ts +12 -0
  42. package/dist/rules/MulliganRule.js +138 -0
  43. package/dist/rules/PlayCardRule.d.ts +15 -0
  44. package/dist/rules/PlayCardRule.js +147 -0
  45. package/dist/rules/RefillRule.d.ts +17 -0
  46. package/dist/rules/RefillRule.js +211 -0
  47. package/dist/rules/RuleId.d.ts +27 -0
  48. package/dist/rules/RuleId.js +31 -0
  49. package/dist/rules/discard-action/DiplomacyActions.d.ts +3 -0
  50. package/dist/rules/discard-action/DiplomacyActions.js +39 -0
  51. package/dist/rules/discard-action/DiplomacyBoardRule.d.ts +9 -0
  52. package/dist/rules/discard-action/DiplomacyBoardRule.js +68 -0
  53. package/dist/rules/discard-action/TechnologyActions.d.ts +3 -0
  54. package/dist/rules/discard-action/TechnologyActions.js +187 -0
  55. package/dist/rules/discard-action/TechnologyBoardRule.d.ts +8 -0
  56. package/dist/rules/discard-action/TechnologyBoardRule.js +109 -0
  57. package/dist/rules/effect/ChoiceRule.d.ts +12 -0
  58. package/dist/rules/effect/ChoiceRule.js +91 -0
  59. package/dist/rules/effect/ConditionalRule.d.ts +17 -0
  60. package/dist/rules/effect/ConditionalRule.js +197 -0
  61. package/dist/rules/effect/DevelopTechnologyRule.d.ts +11 -0
  62. package/dist/rules/effect/DevelopTechnologyRule.js +133 -0
  63. package/dist/rules/effect/DiscardRule.d.ts +18 -0
  64. package/dist/rules/effect/DiscardRule.js +107 -0
  65. package/dist/rules/effect/EffectRule.d.ts +27 -0
  66. package/dist/rules/effect/EffectRule.js +161 -0
  67. package/dist/rules/effect/ExileRule.d.ts +22 -0
  68. package/dist/rules/effect/ExileRule.js +182 -0
  69. package/dist/rules/effect/GiveCreditRule.d.ts +13 -0
  70. package/dist/rules/effect/GiveCreditRule.js +79 -0
  71. package/dist/rules/effect/GiveInfluenceRule.d.ts +10 -0
  72. package/dist/rules/effect/GiveInfluenceRule.js +119 -0
  73. package/dist/rules/effect/GiveLeaderBadgeRule.d.ts +9 -0
  74. package/dist/rules/effect/GiveLeaderBadgeRule.js +54 -0
  75. package/dist/rules/effect/GiveZenithiumRule.d.ts +9 -0
  76. package/dist/rules/effect/GiveZenithiumRule.js +85 -0
  77. package/dist/rules/effect/MobilizeRule.d.ts +18 -0
  78. package/dist/rules/effect/MobilizeRule.js +117 -0
  79. package/dist/rules/effect/ResetInfluenceRule.d.ts +9 -0
  80. package/dist/rules/effect/ResetInfluenceRule.js +63 -0
  81. package/dist/rules/effect/SpendCreditRule.d.ts +16 -0
  82. package/dist/rules/effect/SpendCreditRule.js +109 -0
  83. package/dist/rules/effect/SpendZenithiumRule.d.ts +17 -0
  84. package/dist/rules/effect/SpendZenithiumRule.js +116 -0
  85. package/dist/rules/effect/StealCreditRule.d.ts +7 -0
  86. package/dist/rules/effect/StealCreditRule.js +67 -0
  87. package/dist/rules/effect/TakeBonusRule.d.ts +11 -0
  88. package/dist/rules/effect/TakeBonusRule.js +98 -0
  89. package/dist/rules/effect/TakeLeaderBadgeRule.d.ts +9 -0
  90. package/dist/rules/effect/TakeLeaderBadgeRule.js +102 -0
  91. package/dist/rules/effect/TakeTechnologyBonusTokenRule.d.ts +11 -0
  92. package/dist/rules/effect/TakeTechnologyBonusTokenRule.js +122 -0
  93. package/dist/rules/effect/TransferRule.d.ts +19 -0
  94. package/dist/rules/effect/TransferRule.js +104 -0
  95. package/dist/rules/effect/WinCreditRule.d.ts +13 -0
  96. package/dist/rules/effect/WinCreditRule.js +142 -0
  97. package/dist/rules/effect/WinInfluenceRule.d.ts +23 -0
  98. package/dist/rules/effect/WinInfluenceRule.js +328 -0
  99. package/dist/rules/effect/WinZenithiumRule.d.ts +9 -0
  100. package/dist/rules/effect/WinZenithiumRule.js +92 -0
  101. package/dist/rules/effect/index.d.ts +19 -0
  102. package/dist/rules/effect/index.js +35 -0
  103. package/dist/rules/helper/BonusHelper.d.ts +15 -0
  104. package/dist/rules/helper/BonusHelper.js +86 -0
  105. package/dist/rules/helper/CreditHelper.d.ts +9 -0
  106. package/dist/rules/helper/CreditHelper.js +45 -0
  107. package/dist/rules/helper/EffectHelper.d.ts +16 -0
  108. package/dist/rules/helper/EffectHelper.js +133 -0
  109. package/dist/rules/helper/EffectRuleIds.d.ts +3 -0
  110. package/dist/rules/helper/EffectRuleIds.js +29 -0
  111. package/dist/rules/helper/EndGameHelper.d.ts +13 -0
  112. package/dist/rules/helper/EndGameHelper.js +70 -0
  113. package/dist/rules/helper/InfluenceHelper.d.ts +13 -0
  114. package/dist/rules/helper/InfluenceHelper.js +47 -0
  115. package/dist/rules/helper/MobilizeHelper.d.ts +10 -0
  116. package/dist/rules/helper/MobilizeHelper.js +56 -0
  117. package/dist/rules/helper/PlanetHelper.d.ts +19 -0
  118. package/dist/rules/helper/PlanetHelper.js +104 -0
  119. package/dist/rules/helper/PlayerHelper.d.ts +12 -0
  120. package/dist/rules/helper/PlayerHelper.js +61 -0
  121. package/dist/rules/helper/TechnologyHelper.d.ts +4 -0
  122. package/dist/rules/helper/TechnologyHelper.js +96 -0
  123. package/dist/rules/helper/ZenithiumHelper.d.ts +10 -0
  124. package/dist/rules/helper/ZenithiumHelper.js +59 -0
  125. package/package.json +33 -0
@@ -0,0 +1,117 @@
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.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);
56
+ if (moves.length > 0)
57
+ return moves;
58
+ return this.getAutomaticEffectMoves();
59
+ };
60
+ MobilizeRule.prototype.getAutomaticEffectMoves = function () {
61
+ var _this = this;
62
+ var _a, _b;
63
+ var moves = [];
64
+ var agent = this.material(MaterialType_1.MaterialType.AgentCard)
65
+ .location(LocationType_1.LocationType.AgentDeck)
66
+ .deck()
67
+ .limit((_a = this.effect.quantity) !== null && _a !== void 0 ? _a : 1);
68
+ if (!agent.length || !((_b = agent.getItem()) === null || _b === void 0 ? void 0 : _b.id))
69
+ return [];
70
+ moves.push.apply(moves, __spreadArray([], __read(agent.moveItems(function (item) { return ({
71
+ type: LocationType_1.LocationType.Influence,
72
+ id: Agents_1.Agents[item.id].influence,
73
+ player: _this.playerHelper.team
74
+ }); })), false));
75
+ return moves;
76
+ };
77
+ MobilizeRule.prototype.decrement = function (move) {
78
+ if (!(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.AgentCard)(move) || move.location.type !== LocationType_1.LocationType.Influence)
79
+ return false;
80
+ if (this.effect.quantity) {
81
+ this.effect.quantity--;
82
+ return this.effect.quantity === 0;
83
+ }
84
+ return true;
85
+ };
86
+ MobilizeRule.prototype.afterItemMove = function (move) {
87
+ if (!(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.AgentCard)(move) || move.location.type !== LocationType_1.LocationType.Influence)
88
+ return [];
89
+ if (this.effect.quantity) {
90
+ this.effect.quantity--;
91
+ }
92
+ if (!this.effect.quantity) {
93
+ this.removeFirstEffect();
94
+ return this.afterEffectPlayed();
95
+ }
96
+ return [];
97
+ };
98
+ MobilizeRule.prototype.getExtraDataFromMove = function (move) {
99
+ if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.AgentCard)(move) && move.location.type === LocationType_1.LocationType.Influence) {
100
+ var card = this.material(MaterialType_1.MaterialType.AgentCard).getItem(move.itemIndex);
101
+ return { quantity: Agents_1.Agents[card.id].cost, influence: Agents_1.Agents[card.id].influence };
102
+ }
103
+ return {};
104
+ };
105
+ MobilizeRule.prototype.isPossible = function () {
106
+ return this.deck.length > 0;
107
+ };
108
+ Object.defineProperty(MobilizeRule.prototype, "deck", {
109
+ get: function () {
110
+ return this.material(MaterialType_1.MaterialType.AgentCard).location(LocationType_1.LocationType.AgentDeck).deck();
111
+ },
112
+ enumerable: false,
113
+ configurable: true
114
+ });
115
+ return MobilizeRule;
116
+ }(index_1.EffectRule));
117
+ exports.MobilizeRule = MobilizeRule;
@@ -0,0 +1,9 @@
1
+ import { ItemMove } from '@gamepark/rules-api';
2
+ import { ResetInfluenceEffect } from '../../material/effect/Effect';
3
+ import { EffectRule } from './index';
4
+ export declare class ResetInfluenceRule extends EffectRule<ResetInfluenceEffect> {
5
+ getPlayerMoves(): import("@gamepark/rules-api").MoveItem<number, number, number>[];
6
+ afterItemMove(move: ItemMove): import("@gamepark/rules-api").MaterialMove[];
7
+ isPossible(): boolean;
8
+ get planets(): import("@gamepark/rules-api").Material<number, number, number>;
9
+ }
@@ -0,0 +1,63 @@
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 __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;
39
+ }
40
+ ResetInfluenceRule.prototype.getPlayerMoves = function () {
41
+ var planets = this.planets;
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)
46
+ return [];
47
+ this.removeFirstEffect();
48
+ return this.afterEffectPlayed();
49
+ };
50
+ ResetInfluenceRule.prototype.isPossible = function () {
51
+ return this.planets.length > 0;
52
+ };
53
+ Object.defineProperty(ResetInfluenceRule.prototype, "planets", {
54
+ get: function () {
55
+ var _this = this;
56
+ return this.material(MaterialType_1.MaterialType.InfluenceDisc).location(function (l) { return l.type === LocationType_1.LocationType.PlanetBoardInfluenceDiscSpace && (_this.playerHelper.team === TeamColor_1.TeamColor.White ? l.x < 0 : l.x > 0); });
57
+ },
58
+ enumerable: false,
59
+ configurable: true
60
+ });
61
+ return ResetInfluenceRule;
62
+ }(index_1.EffectRule));
63
+ exports.ResetInfluenceRule = ResetInfluenceRule;
@@ -0,0 +1,16 @@
1
+ import { CustomMove, ItemMove, MaterialMove } from '@gamepark/rules-api';
2
+ import { RuleMove } from '@gamepark/rules-api/dist/material/moves';
3
+ import { RuleStep } from '@gamepark/rules-api/dist/material/rules/RuleStep';
4
+ import { PlayMoveContext } from '@gamepark/rules-api/dist/Rules';
5
+ import { SpendCreditEffect } from '../../material/effect/Effect';
6
+ import { EffectRule } from './index';
7
+ export declare class SpendCreditRule extends EffectRule<SpendCreditEffect> {
8
+ onRuleStart(_move: RuleMove, _previousRule?: RuleStep, _context?: PlayMoveContext): MaterialMove[];
9
+ getPlayerMoves(): MaterialMove[];
10
+ getExtraDataFromMove(move: ItemMove | CustomMove): {
11
+ factor?: undefined;
12
+ } | {
13
+ factor: number;
14
+ };
15
+ isPossible(): boolean;
16
+ }
@@ -0,0 +1,109 @@
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 });
68
+ this.removeFirstEffect();
69
+ moves.push.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
70
+ 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; }
91
+ }
92
+ 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))
98
+ 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);
102
+ return { factor: this.effect.factors[index] };
103
+ };
104
+ SpendCreditRule.prototype.isPossible = function () {
105
+ return this.getPlayerMoves().length > 0;
106
+ };
107
+ return SpendCreditRule;
108
+ }(index_1.EffectRule));
109
+ exports.SpendCreditRule = SpendCreditRule;
@@ -0,0 +1,17 @@
1
+ import { CustomMove, ItemMove, MaterialMove } from '@gamepark/rules-api';
2
+ import { RuleMove } from '@gamepark/rules-api/dist/material/moves';
3
+ import { RuleStep } from '@gamepark/rules-api/dist/material/rules/RuleStep';
4
+ import { PlayMoveContext } from '@gamepark/rules-api/dist/Rules';
5
+ import { SpendZenithiumEffect } from '../../material/effect/Effect';
6
+ import { EffectRule } from './index';
7
+ export declare class SpendZenithiumRule extends EffectRule<SpendZenithiumEffect> {
8
+ onRuleStart(_move: RuleMove, _previousRule?: RuleStep, _context?: PlayMoveContext): MaterialMove[];
9
+ getPlayerMoves(): MaterialMove[];
10
+ get zenithium(): import("@gamepark/rules-api").Material<number, number, number>;
11
+ getExtraDataFromMove(move: ItemMove | CustomMove): {
12
+ factor?: undefined;
13
+ } | {
14
+ factor: number;
15
+ };
16
+ isPossible(): boolean;
17
+ }
@@ -0,0 +1,116 @@
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)];
68
+ this.removeFirstEffect();
69
+ moves.push.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
70
+ 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; }
91
+ }
92
+ 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))
105
+ 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);
109
+ return { factor: this.effect.factors[index] };
110
+ };
111
+ SpendZenithiumRule.prototype.isPossible = function () {
112
+ return this.getPlayerMoves().length > 0;
113
+ };
114
+ return SpendZenithiumRule;
115
+ }(index_1.EffectRule));
116
+ exports.SpendZenithiumRule = SpendZenithiumRule;
@@ -0,0 +1,7 @@
1
+ import { MaterialMove } from '@gamepark/rules-api';
2
+ import { StealCreditEffect } from '../../material/effect/Effect';
3
+ import { EffectRule } from './index';
4
+ export declare class StealCreditRule extends EffectRule<StealCreditEffect> {
5
+ onRuleStart(): MaterialMove[];
6
+ isPossible(): boolean;
7
+ }
@@ -0,0 +1,67 @@
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));
57
+ this.removeFirstEffect();
58
+ moves.push.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
59
+ 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;
63
+ return opponentCredits >= this.effect.quantity;
64
+ };
65
+ return StealCreditRule;
66
+ }(index_1.EffectRule));
67
+ exports.StealCreditRule = StealCreditRule;
@@ -0,0 +1,11 @@
1
+ import { ItemMove, MaterialMove } from '@gamepark/rules-api';
2
+ import { TakeBonusEffect } from '../../material/effect/Effect';
3
+ import { EffectRule } from './index';
4
+ export declare class TakeBonusRule extends EffectRule<TakeBonusEffect> {
5
+ getPlayerMoves(): import("@gamepark/rules-api").MoveItem<number, number, number>[];
6
+ get bonusTokens(): import("@gamepark/rules-api").Material<number, number, number>;
7
+ afterItemMove(move: ItemMove): MaterialMove[];
8
+ isPossible(): boolean;
9
+ get visibleBonusToken(): import("@gamepark/rules-api").Material<number, number, number>;
10
+ get reserveBonusToken(): import("@gamepark/rules-api").Material<number, number, number>;
11
+ }
@@ -0,0 +1,98 @@
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.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)
71
+ 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);
75
+ this.removeFirstEffect();
76
+ moves.push.apply(moves, __spreadArray([], __read(this.applyFirstEffect()), false));
77
+ return moves;
78
+ };
79
+ TakeBonusRule.prototype.isPossible = function () {
80
+ 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;
@@ -0,0 +1,9 @@
1
+ import { MaterialMove } from '@gamepark/rules-api';
2
+ import { TakeLeaderBadgeEffect } from '../../material/effect/Effect';
3
+ import { EffectRule } from './index';
4
+ export declare class TakeLeaderBadgeRule extends EffectRule<TakeLeaderBadgeEffect> {
5
+ onRuleStart(): MaterialMove[];
6
+ get newBadgeRotation(): boolean | undefined;
7
+ get leader(): import("@gamepark/rules-api").Material<number, number, number>;
8
+ onRuleEnd(): never[];
9
+ }