@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,147 +1,81 @@
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.PlayCardRule = 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 TeamColor_1 = require("../TeamColor");
49
- var CreditHelper_1 = require("./helper/CreditHelper");
50
- var EffectHelper_1 = require("./helper/EffectHelper");
51
- var InfluenceHelper_1 = require("./helper/InfluenceHelper");
52
- var PlayerHelper_1 = require("./helper/PlayerHelper");
53
- var Memory_1 = require("./Memory");
54
- var RuleId_1 = require("./RuleId");
55
- var PlayCardRule = (function (_super) {
56
- __extends(PlayCardRule, _super);
57
- function PlayCardRule() {
58
- return _super !== null && _super.apply(this, arguments) || this;
59
- }
60
- PlayCardRule.prototype.onRuleStart = function () {
61
- this.forget(Memory_1.Memory.DiscardFaction);
62
- this.forget(Memory_1.Memory.LastPlanetsMoved);
1
+ import { isMoveItemType, isStartPlayerTurn, isStartRule, PlayerTurnRule } from '@gamepark/rules-api';
2
+ import { Agents } from '../material/Agents';
3
+ import { LocationType } from '../material/LocationType';
4
+ import { MaterialType } from '../material/MaterialType';
5
+ import { getTeamColor } from '../TeamColor';
6
+ import { CreditHelper } from './helper/CreditHelper';
7
+ import { EffectHelper } from './helper/EffectHelper';
8
+ import { InfluenceHelper } from './helper/InfluenceHelper';
9
+ import { PlayerHelper } from './helper/PlayerHelper';
10
+ import { Memory } from './Memory';
11
+ import { RuleId } from './RuleId';
12
+ export class PlayCardRule extends PlayerTurnRule {
13
+ onRuleStart() {
14
+ this.forget(Memory.DiscardFaction);
15
+ this.forget(Memory.LastPlanetsMoved);
63
16
  return [];
64
- };
65
- PlayCardRule.prototype.getPlayerMoves = function () {
66
- var moves = [];
67
- var hand = this.hand;
68
- moves.push.apply(moves, __spreadArray([], __read(this.discardAgents(hand)), false));
69
- moves.push.apply(moves, __spreadArray([], __read(this.placeInInfluence(hand)), false));
17
+ }
18
+ getPlayerMoves() {
19
+ const moves = [];
20
+ const hand = this.hand;
21
+ moves.push(...this.discardAgents(hand));
22
+ moves.push(...this.placeInInfluence(hand));
70
23
  return moves;
71
- };
72
- PlayCardRule.prototype.placeInInfluence = function (cards) {
73
- var _this = this;
74
- var influenceHelper = this.influenceHelper;
75
- var playerHelper = this.playerHelper;
24
+ }
25
+ placeInInfluence(cards) {
26
+ const influenceHelper = this.influenceHelper;
27
+ const playerHelper = this.playerHelper;
76
28
  return cards
77
- .filter(function (item) { return influenceHelper.getCost(item) <= playerHelper.credits; })
78
- .moveItems(function (item) { return ({
79
- type: LocationType_1.LocationType.Influence,
80
- id: Agents_1.Agents[item.id].influence,
81
- player: (0, TeamColor_1.getTeamColor)(_this.player)
82
- }); });
83
- };
84
- PlayCardRule.prototype.discardAgents = function (cards) {
29
+ .filter((item) => influenceHelper.getCost(item) <= playerHelper.credits)
30
+ .moveItems((item) => ({
31
+ type: LocationType.Influence,
32
+ id: Agents[item.id].influence,
33
+ player: getTeamColor(this.player)
34
+ }));
35
+ }
36
+ discardAgents(cards) {
85
37
  return cards.moveItems({
86
- type: LocationType_1.LocationType.AgentDiscard
38
+ type: LocationType.AgentDiscard
87
39
  });
88
- };
89
- Object.defineProperty(PlayCardRule.prototype, "creditHelper", {
90
- get: function () {
91
- return new CreditHelper_1.CreditHelper(this.game, this.player);
92
- },
93
- enumerable: false,
94
- configurable: true
95
- });
96
- PlayCardRule.prototype.afterItemMove = function (move) {
97
- if (!(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.AgentCard)(move))
40
+ }
41
+ get creditHelper() {
42
+ return new CreditHelper(this.game, this.player);
43
+ }
44
+ afterItemMove(move) {
45
+ if (!isMoveItemType(MaterialType.AgentCard)(move))
98
46
  return [];
99
- if (move.location.type === LocationType_1.LocationType.AgentDiscard) {
100
- var item = this.material(MaterialType_1.MaterialType.AgentCard).getItem(move.itemIndex);
101
- var agent = Agents_1.Agents[item.id];
102
- this.memorize(Memory_1.Memory.DiscardFaction, agent.faction);
103
- return [this.startRule(RuleId_1.RuleId.DiscardAction)];
47
+ if (move.location.type === LocationType.AgentDiscard) {
48
+ const item = this.material(MaterialType.AgentCard).getItem(move.itemIndex);
49
+ const agent = Agents[item.id];
50
+ this.memorize(Memory.DiscardFaction, agent.faction);
51
+ return [this.startRule(RuleId.DiscardAction)];
104
52
  }
105
- var moves = [];
106
- if (move.location.type === LocationType_1.LocationType.Influence) {
107
- var influenceHelper = this.influenceHelper;
108
- var item = this.material(MaterialType_1.MaterialType.AgentCard).getItem(move.itemIndex);
109
- this.memorize(Memory_1.Memory.CardPlayed, item.id);
110
- var cost = influenceHelper.getCost(item, 1);
53
+ const moves = [];
54
+ if (move.location.type === LocationType.Influence) {
55
+ const influenceHelper = this.influenceHelper;
56
+ const item = this.material(MaterialType.AgentCard).getItem(move.itemIndex);
57
+ this.memorize(Memory.CardPlayed, item.id);
58
+ const cost = influenceHelper.getCost(item, 1);
111
59
  if (cost > 0) {
112
- moves.push.apply(moves, __spreadArray([], __read(this.creditHelper.spendCredit(cost)), false));
60
+ moves.push(...this.creditHelper.spendCredit(cost));
113
61
  }
114
- var helper = new EffectHelper_1.EffectHelper(this.game, this.player);
115
- var effectMoves = helper.applyCard(item);
116
- if (effectMoves.some(function (move) { return (0, rules_api_1.isStartRule)(move) || (0, rules_api_1.isStartPlayerTurn)(move); })) {
117
- moves.push.apply(moves, __spreadArray([], __read(effectMoves), false));
62
+ const helper = new EffectHelper(this.game, this.player);
63
+ const effectMoves = helper.applyCard(item);
64
+ if (effectMoves.some((move) => isStartRule(move) || isStartPlayerTurn(move))) {
65
+ moves.push(...effectMoves);
118
66
  return moves;
119
67
  }
120
- moves.push(this.startRule(RuleId_1.RuleId.Refill));
68
+ moves.push(this.startRule(RuleId.Refill));
121
69
  }
122
70
  return moves;
123
- };
124
- Object.defineProperty(PlayCardRule.prototype, "influenceHelper", {
125
- get: function () {
126
- return new InfluenceHelper_1.InfluenceHelper(this.game, (0, TeamColor_1.getTeamColor)(this.player));
127
- },
128
- enumerable: false,
129
- configurable: true
130
- });
131
- Object.defineProperty(PlayCardRule.prototype, "playerHelper", {
132
- get: function () {
133
- return new PlayerHelper_1.PlayerHelper(this.game, this.player);
134
- },
135
- enumerable: false,
136
- configurable: true
137
- });
138
- Object.defineProperty(PlayCardRule.prototype, "hand", {
139
- get: function () {
140
- return this.material(MaterialType_1.MaterialType.AgentCard).location(LocationType_1.LocationType.PlayerHand).player(this.player);
141
- },
142
- enumerable: false,
143
- configurable: true
144
- });
145
- return PlayCardRule;
146
- }(rules_api_1.PlayerTurnRule));
147
- exports.PlayCardRule = PlayCardRule;
71
+ }
72
+ get influenceHelper() {
73
+ return new InfluenceHelper(this.game, getTeamColor(this.player));
74
+ }
75
+ get playerHelper() {
76
+ return new PlayerHelper(this.game, this.player);
77
+ }
78
+ get hand() {
79
+ return this.material(MaterialType.AgentCard).location(LocationType.PlayerHand).player(this.player);
80
+ }
81
+ }
@@ -1,211 +1,104 @@
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 __values = (this && this.__values) || function(o) {
18
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
19
- if (m) return m.call(o);
20
- if (o && typeof o.length === "number") return {
21
- next: function () {
22
- if (o && i >= o.length) o = void 0;
23
- return { value: o && o[i++], done: !o };
1
+ import { isMoveItemTypeAtOnce, isShuffleItemType, PlayerTurnRule } from '@gamepark/rules-api';
2
+ import { influences } from '../material/Influence';
3
+ import { LocationType } from '../material/LocationType';
4
+ import { MaterialType } from '../material/MaterialType';
5
+ import { PlayerHelper } from './helper/PlayerHelper';
6
+ import { Memory } from './Memory';
7
+ import { RuleId } from './RuleId';
8
+ export class RefillRule extends PlayerTurnRule {
9
+ onRuleStart() {
10
+ this.memorize(Memory.AlreadyPlayedPlayers, (p = []) => p.concat(this.player));
11
+ const moves = [];
12
+ for (const influence of influences) {
13
+ const planet = this.material(MaterialType.InfluenceDisc).location(LocationType.PlanetBoardInfluenceDiscSpace).locationId(influence);
14
+ if (planet.length)
15
+ continue;
16
+ moves.push(this.getNewInfluenceDisc(influence).moveItem({
17
+ type: LocationType.PlanetBoardInfluenceDiscSpace,
18
+ id: influence,
19
+ x: 0
20
+ }));
24
21
  }
25
- };
26
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
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);
22
+ const maxSize = this.handSize;
23
+ moves.push(...this.refillHand(maxSize));
24
+ if (moves.some((move) => isMoveItemTypeAtOnce(MaterialType.AgentCard)(move) && move.location.type === LocationType.AgentDeck)) {
25
+ return moves;
39
26
  }
40
- finally { if (e) throw e.error; }
27
+ moves.push(...this.endRuleMoves);
28
+ return moves;
41
29
  }
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];
30
+ getNewInfluenceDisc(influence) {
31
+ return this.material(MaterialType.InfluenceDisc)
32
+ .location(LocationType.InfluenceDiscStock)
33
+ .locationId(influence)
34
+ .maxBy((item) => item.location.x);
35
+ }
36
+ get endRuleMoves() {
37
+ const isTurnEnded = this.remind(Memory.AlreadyPlayedPlayers).length === this.game.players.length;
38
+ if (isTurnEnded) {
39
+ this.forget(Memory.AlreadyPlayedPlayers);
40
+ return [this.startPlayerTurn(RuleId.PlayCard, this.turnOrder[0])];
41
+ }
42
+ else {
43
+ return [this.startPlayerTurn(RuleId.PlayCard, this.nextPlayer)];
49
44
  }
50
45
  }
51
- return to.concat(ar || Array.prototype.slice.call(from));
52
- };
53
- Object.defineProperty(exports, "__esModule", { value: true });
54
- exports.RefillRule = void 0;
55
- var rules_api_1 = require("@gamepark/rules-api");
56
- var Influence_1 = require("../material/Influence");
57
- var LocationType_1 = require("../material/LocationType");
58
- var MaterialType_1 = require("../material/MaterialType");
59
- var PlayerHelper_1 = require("./helper/PlayerHelper");
60
- var Memory_1 = require("./Memory");
61
- var RuleId_1 = require("./RuleId");
62
- var RefillRule = (function (_super) {
63
- __extends(RefillRule, _super);
64
- function RefillRule() {
65
- return _super !== null && _super.apply(this, arguments) || this;
46
+ get turnOrder() {
47
+ return this.remind(Memory.TurnOrder);
66
48
  }
67
- RefillRule.prototype.onRuleStart = function () {
68
- var e_1, _a;
69
- var _this = this;
70
- this.memorize(Memory_1.Memory.AlreadyPlayedPlayers, function (p) {
71
- if (p === void 0) { p = []; }
72
- return p.concat(_this.player);
73
- });
74
- var moves = [];
75
- try {
76
- for (var influences_1 = __values(Influence_1.influences), influences_1_1 = influences_1.next(); !influences_1_1.done; influences_1_1 = influences_1.next()) {
77
- var influence = influences_1_1.value;
78
- var planet = this.material(MaterialType_1.MaterialType.InfluenceDisc).location(LocationType_1.LocationType.PlanetBoardInfluenceDiscSpace).locationId(influence);
79
- if (planet.length)
80
- continue;
81
- moves.push(this.getNewInfluenceDisc(influence).moveItem({
82
- type: LocationType_1.LocationType.PlanetBoardInfluenceDiscSpace,
83
- id: influence,
84
- x: 0
85
- }));
86
- }
49
+ get nextPlayer() {
50
+ const players = this.turnOrder;
51
+ return players[(players.indexOf(this.player) + 1) % players.length];
52
+ }
53
+ get handSize() {
54
+ const leaderBadge = this.leaderBadge;
55
+ if (!leaderBadge.length) {
56
+ return 4;
87
57
  }
88
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
89
- finally {
90
- try {
91
- if (influences_1_1 && !influences_1_1.done && (_a = influences_1.return)) _a.call(influences_1);
92
- }
93
- finally { if (e_1) throw e_1.error; }
94
- }
95
- var maxSize = this.handSize;
96
- moves.push.apply(moves, __spreadArray([], __read(this.refillHand(maxSize)), false));
97
- if (moves.some(function (move) { return (0, rules_api_1.isMoveItemTypeAtOnce)(MaterialType_1.MaterialType.AgentCard)(move) && move.location.type === LocationType_1.LocationType.AgentDeck; })) {
98
- return moves;
99
- }
100
- moves.push.apply(moves, __spreadArray([], __read(this.endRuleMoves), false));
101
- return moves;
102
- };
103
- RefillRule.prototype.getNewInfluenceDisc = function (influence) {
104
- return this.material(MaterialType_1.MaterialType.InfluenceDisc)
105
- .location(LocationType_1.LocationType.InfluenceDiscStock)
106
- .locationId(influence)
107
- .maxBy(function (item) { return item.location.x; });
108
- };
109
- Object.defineProperty(RefillRule.prototype, "endRuleMoves", {
110
- get: function () {
111
- var isTurnEnded = this.remind(Memory_1.Memory.AlreadyPlayedPlayers).length === this.game.players.length;
112
- if (isTurnEnded) {
113
- this.forget(Memory_1.Memory.AlreadyPlayedPlayers);
114
- return [this.startPlayerTurn(RuleId_1.RuleId.PlayCard, this.turnOrder[0])];
115
- }
116
- else {
117
- return [this.startPlayerTurn(RuleId_1.RuleId.PlayCard, this.nextPlayer)];
118
- }
119
- },
120
- enumerable: false,
121
- configurable: true
122
- });
123
- Object.defineProperty(RefillRule.prototype, "turnOrder", {
124
- get: function () {
125
- return this.remind(Memory_1.Memory.TurnOrder);
126
- },
127
- enumerable: false,
128
- configurable: true
129
- });
130
- Object.defineProperty(RefillRule.prototype, "nextPlayer", {
131
- get: function () {
132
- var players = this.turnOrder;
133
- return players[(players.indexOf(this.player) + 1) % players.length];
134
- },
135
- enumerable: false,
136
- configurable: true
137
- });
138
- Object.defineProperty(RefillRule.prototype, "handSize", {
139
- get: function () {
140
- var leaderBadge = this.leaderBadge;
141
- if (!leaderBadge.length) {
142
- return 4;
58
+ else {
59
+ const item = leaderBadge.getItem();
60
+ if (!item.location.rotation) {
61
+ return 5;
143
62
  }
144
63
  else {
145
- var item = leaderBadge.getItem();
146
- if (!item.location.rotation) {
147
- return 5;
148
- }
149
- else {
150
- return 6;
151
- }
64
+ return 6;
152
65
  }
153
- },
154
- enumerable: false,
155
- configurable: true
156
- });
157
- RefillRule.prototype.refillHand = function (maxCount) {
158
- var deck = this.deck;
159
- var quantity = Math.max(0, maxCount - this.hand.length);
66
+ }
67
+ }
68
+ refillHand(maxCount) {
69
+ const deck = this.deck;
70
+ const quantity = Math.max(0, maxCount - this.hand.length);
160
71
  if (!quantity)
161
72
  return [];
162
- var moves = deck.deal({
163
- type: LocationType_1.LocationType.PlayerHand,
73
+ const moves = deck.deal({
74
+ type: LocationType.PlayerHand,
164
75
  player: this.player
165
76
  }, quantity);
166
- var remaining = quantity - moves.length;
77
+ const remaining = quantity - moves.length;
167
78
  if (!remaining)
168
79
  return moves;
169
- moves.push(this.discard.moveItemsAtOnce({ type: LocationType_1.LocationType.AgentDeck }));
80
+ moves.push(this.discard.moveItemsAtOnce({ type: LocationType.AgentDeck }));
170
81
  return moves;
171
- };
172
- Object.defineProperty(RefillRule.prototype, "discard", {
173
- get: function () {
174
- return this.material(MaterialType_1.MaterialType.AgentCard).location(LocationType_1.LocationType.AgentDiscard);
175
- },
176
- enumerable: false,
177
- configurable: true
178
- });
179
- RefillRule.prototype.afterItemMove = function (move) {
180
- if ((0, rules_api_1.isShuffleItemType)(MaterialType_1.MaterialType.AgentCard)(move)) {
181
- return __spreadArray(__spreadArray([], __read(this.refillHand(this.handSize)), false), __read(this.endRuleMoves), false);
82
+ }
83
+ get discard() {
84
+ return this.material(MaterialType.AgentCard).location(LocationType.AgentDiscard);
85
+ }
86
+ afterItemMove(move) {
87
+ if (isShuffleItemType(MaterialType.AgentCard)(move)) {
88
+ return [...this.refillHand(this.handSize), ...this.endRuleMoves];
182
89
  }
183
- if ((0, rules_api_1.isMoveItemTypeAtOnce)(MaterialType_1.MaterialType.AgentCard)(move) && move.location.type === LocationType_1.LocationType.AgentDeck) {
90
+ if (isMoveItemTypeAtOnce(MaterialType.AgentCard)(move) && move.location.type === LocationType.AgentDeck) {
184
91
  return [this.deck.shuffle()];
185
92
  }
186
93
  return [];
187
- };
188
- Object.defineProperty(RefillRule.prototype, "hand", {
189
- get: function () {
190
- return this.material(MaterialType_1.MaterialType.AgentCard).location(LocationType_1.LocationType.PlayerHand).player(this.player);
191
- },
192
- enumerable: false,
193
- configurable: true
194
- });
195
- Object.defineProperty(RefillRule.prototype, "deck", {
196
- get: function () {
197
- return this.material(MaterialType_1.MaterialType.AgentCard).location(LocationType_1.LocationType.AgentDeck).deck();
198
- },
199
- enumerable: false,
200
- configurable: true
201
- });
202
- Object.defineProperty(RefillRule.prototype, "leaderBadge", {
203
- get: function () {
204
- return this.material(MaterialType_1.MaterialType.LeaderBadgeToken).player(new PlayerHelper_1.PlayerHelper(this.game, this.player).team);
205
- },
206
- enumerable: false,
207
- configurable: true
208
- });
209
- return RefillRule;
210
- }(rules_api_1.PlayerTurnRule));
211
- exports.RefillRule = RefillRule;
94
+ }
95
+ get hand() {
96
+ return this.material(MaterialType.AgentCard).location(LocationType.PlayerHand).player(this.player);
97
+ }
98
+ get deck() {
99
+ return this.material(MaterialType.AgentCard).location(LocationType.AgentDeck).deck();
100
+ }
101
+ get leaderBadge() {
102
+ return this.material(MaterialType.LeaderBadgeToken).player(new PlayerHelper(this.game, this.player).team);
103
+ }
104
+ }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RuleId = void 0;
4
- var RuleId;
1
+ export var RuleId;
5
2
  (function (RuleId) {
6
3
  RuleId[RuleId["Muligan"] = 1] = "Muligan";
7
4
  RuleId[RuleId["PlayCard"] = 2] = "PlayCard";
@@ -28,4 +25,4 @@ var RuleId;
28
25
  RuleId[RuleId["StealCredit"] = 23] = "StealCredit";
29
26
  RuleId[RuleId["SpendZenithium"] = 24] = "SpendZenithium";
30
27
  RuleId[RuleId["TakeTechnologyBonusToken"] = 25] = "TakeTechnologyBonusToken";
31
- })(RuleId || (exports.RuleId = RuleId = {}));
28
+ })(RuleId || (RuleId = {}));
@@ -1,39 +1,34 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getDiplomacyActions = void 0;
5
- var EffectType_1 = require("../../material/effect/EffectType");
6
- var Faction_1 = require("../../material/Faction");
7
- var getDiplomacyActions = function (_players) {
1
+ import { EffectType } from '../../material/effect/EffectType';
2
+ import { Faction } from '../../material/Faction';
3
+ export const getDiplomacyActions = (_players) => {
8
4
  return TwoPlayerDiplomacyActions;
9
5
  };
10
- exports.getDiplomacyActions = getDiplomacyActions;
11
- var TwoPlayerDiplomacyActions = (_a = {},
12
- _a[Faction_1.Faction.Robot] = [
6
+ const TwoPlayerDiplomacyActions = {
7
+ [Faction.Robot]: [
13
8
  {
14
- type: EffectType_1.EffectType.TakeLeaderBadge
9
+ type: EffectType.TakeLeaderBadge
15
10
  },
16
11
  {
17
- type: EffectType_1.EffectType.WinZenithium,
12
+ type: EffectType.WinZenithium,
18
13
  quantity: 1
19
14
  }
20
15
  ],
21
- _a[Faction_1.Faction.Human] = [
16
+ [Faction.Human]: [
22
17
  {
23
- type: EffectType_1.EffectType.TakeLeaderBadge
18
+ type: EffectType.TakeLeaderBadge
24
19
  },
25
20
  {
26
- type: EffectType_1.EffectType.WinCredit,
21
+ type: EffectType.WinCredit,
27
22
  quantity: 3
28
23
  }
29
24
  ],
30
- _a[Faction_1.Faction.Animod] = [
25
+ [Faction.Animod]: [
31
26
  {
32
- type: EffectType_1.EffectType.TakeLeaderBadge
27
+ type: EffectType.TakeLeaderBadge
33
28
  },
34
29
  {
35
- type: EffectType_1.EffectType.Mobilize,
30
+ type: EffectType.Mobilize,
36
31
  quantity: 2
37
32
  }
38
- ],
39
- _a);
33
+ ]
34
+ };