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