@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 @@
1
+ export type PlayerId = number;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import { PlayerId } from './PlayerId';
2
+ export declare enum TeamColor {
3
+ Black = 1,
4
+ White = 2
5
+ }
6
+ export declare const teamColors: TeamColor[];
7
+ export declare const isWhite: (playerId: TeamColor) => playerId is TeamColor.White;
8
+ export declare const isBlack: (playerId: TeamColor) => playerId is TeamColor.Black;
9
+ export declare const getTeamColor: (playerId: PlayerId) => TeamColor;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTeamColor = exports.isBlack = exports.isWhite = exports.teamColors = exports.TeamColor = void 0;
4
+ var rules_api_1 = require("@gamepark/rules-api");
5
+ var TeamColor;
6
+ (function (TeamColor) {
7
+ TeamColor[TeamColor["Black"] = 1] = "Black";
8
+ TeamColor[TeamColor["White"] = 2] = "White";
9
+ })(TeamColor || (exports.TeamColor = TeamColor = {}));
10
+ exports.teamColors = (0, rules_api_1.getEnumValues)(TeamColor);
11
+ var isWhite = function (playerId) { return playerId === TeamColor.White; };
12
+ exports.isWhite = isWhite;
13
+ var isBlack = function (playerId) { return playerId === TeamColor.Black; };
14
+ exports.isBlack = isBlack;
15
+ var getTeamColor = function (playerId) { return (playerId === 1 || playerId === 4 ? TeamColor.White : TeamColor.Black); };
16
+ exports.getTeamColor = getTeamColor;
@@ -0,0 +1,5 @@
1
+ import { OptionsSpec } from '@gamepark/rules-api';
2
+ export type ZenithOptions = {
3
+ players: number;
4
+ };
5
+ export declare const ZenithOptionsSpec: OptionsSpec<ZenithOptions>;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZenithOptionsSpec = void 0;
4
+ exports.ZenithOptionsSpec = {};
@@ -0,0 +1,68 @@
1
+ import { CompetitiveRank, MaterialGame, MaterialMove, PositiveSequenceStrategy, SecretMaterialRules, TimeLimit } from '@gamepark/rules-api';
2
+ import { LocationType } from './material/LocationType';
3
+ import { MaterialType } from './material/MaterialType';
4
+ import { PlayerId } from './PlayerId';
5
+ import { DiscardActionRule } from './rules/DiscardActionRule';
6
+ import { ChoiceRule, ConditionalRule, DevelopTechnologyRule, DiscardRule, ExileRule, GiveCreditRule, GiveInfluenceRule, GiveLeaderBadgeRule, GiveZenithiumRule, MobilizeRule, ResetInfluenceRule, SpendCreditRule, TakeBonusRule, TakeLeaderBadgeRule, TransferRule, WinCreditRule, WinInfluenceRule, WinZenithiumRule } from './rules/effect';
7
+ import { SpendZenithiumRule } from './rules/effect/SpendZenithiumRule';
8
+ import { StealCreditRule } from './rules/effect/StealCreditRule';
9
+ import { TakeTechnologyBonusTokenRule } from './rules/effect/TakeTechnologyBonusTokenRule';
10
+ import { MulliganRule } from './rules/MulliganRule';
11
+ import { PlayCardRule } from './rules/PlayCardRule';
12
+ import { RefillRule } from './rules/RefillRule';
13
+ export declare class ZenithRules extends SecretMaterialRules<PlayerId, MaterialType, LocationType> implements CompetitiveRank<MaterialGame<PlayerId, MaterialType, LocationType>, MaterialMove<PlayerId, MaterialType, LocationType>, PlayerId>, TimeLimit<MaterialGame<PlayerId, MaterialType, LocationType>, MaterialMove<PlayerId, MaterialType, LocationType>> {
14
+ rules: {
15
+ 1: typeof MulliganRule;
16
+ 2: typeof PlayCardRule;
17
+ 3: typeof DiscardActionRule;
18
+ 4: typeof TransferRule;
19
+ 5: typeof GiveCreditRule;
20
+ 6: typeof WinCreditRule;
21
+ 7: typeof SpendCreditRule;
22
+ 8: typeof ConditionalRule;
23
+ 9: typeof WinZenithiumRule;
24
+ 10: typeof GiveZenithiumRule;
25
+ 11: typeof ExileRule;
26
+ 12: typeof WinInfluenceRule;
27
+ 13: typeof GiveInfluenceRule;
28
+ 14: typeof ResetInfluenceRule;
29
+ 15: typeof DevelopTechnologyRule;
30
+ 16: typeof GiveLeaderBadgeRule;
31
+ 17: typeof TakeLeaderBadgeRule;
32
+ 18: typeof DiscardRule;
33
+ 19: typeof MobilizeRule;
34
+ 20: typeof ChoiceRule;
35
+ 21: typeof TakeBonusRule;
36
+ 22: typeof RefillRule;
37
+ 23: typeof StealCreditRule;
38
+ 24: typeof SpendZenithiumRule;
39
+ 25: typeof TakeTechnologyBonusTokenRule;
40
+ };
41
+ locationsStrategies: {
42
+ 1: {
43
+ 7: PositiveSequenceStrategy<number, number, number>;
44
+ 6: PositiveSequenceStrategy<number, number, number>;
45
+ 8: PositiveSequenceStrategy<number, number, number>;
46
+ 10: PositiveSequenceStrategy<number, number, number>;
47
+ };
48
+ 5: {
49
+ 17: PositiveSequenceStrategy<number, number, number>;
50
+ 18: PositiveSequenceStrategy<number, number, number>;
51
+ };
52
+ 9: {
53
+ 21: PositiveSequenceStrategy<number, number, number>;
54
+ 14: PositiveSequenceStrategy<number, number, number>;
55
+ };
56
+ };
57
+ hidingStrategies: {
58
+ 1: {
59
+ 7: <P extends number = number, L extends number = number>(item: import("@gamepark/rules-api").MaterialItem<P, L>, player?: P) => string[];
60
+ 6: import("@gamepark/rules-api").HidingStrategy<number, number>;
61
+ };
62
+ 9: {
63
+ 14: import("@gamepark/rules-api").HidingStrategy<number, number>;
64
+ };
65
+ };
66
+ rankPlayers(_playerA: PlayerId, _playerB: PlayerId): number;
67
+ giveTime(): number;
68
+ }
@@ -0,0 +1,128 @@
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.ZenithRules = 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 DiscardActionRule_1 = require("./rules/DiscardActionRule");
48
+ var effect_1 = require("./rules/effect");
49
+ var SpendZenithiumRule_1 = require("./rules/effect/SpendZenithiumRule");
50
+ var StealCreditRule_1 = require("./rules/effect/StealCreditRule");
51
+ var TakeTechnologyBonusTokenRule_1 = require("./rules/effect/TakeTechnologyBonusTokenRule");
52
+ var EndGameHelper_1 = require("./rules/helper/EndGameHelper");
53
+ var MulliganRule_1 = require("./rules/MulliganRule");
54
+ var PlayCardRule_1 = require("./rules/PlayCardRule");
55
+ var RefillRule_1 = require("./rules/RefillRule");
56
+ var RuleId_1 = require("./rules/RuleId");
57
+ var TeamColor_1 = require("./TeamColor");
58
+ var ZenithRules = (function (_super) {
59
+ __extends(ZenithRules, _super);
60
+ function ZenithRules() {
61
+ var _a, _b, _c, _d, _e, _f, _g, _h;
62
+ var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
63
+ _this.rules = (_a = {},
64
+ _a[RuleId_1.RuleId.Muligan] = MulliganRule_1.MulliganRule,
65
+ _a[RuleId_1.RuleId.PlayCard] = PlayCardRule_1.PlayCardRule,
66
+ _a[RuleId_1.RuleId.DiscardAction] = DiscardActionRule_1.DiscardActionRule,
67
+ _a[RuleId_1.RuleId.Transfer] = effect_1.TransferRule,
68
+ _a[RuleId_1.RuleId.GiveCredit] = effect_1.GiveCreditRule,
69
+ _a[RuleId_1.RuleId.WinCredit] = effect_1.WinCreditRule,
70
+ _a[RuleId_1.RuleId.SpendCredit] = effect_1.SpendCreditRule,
71
+ _a[RuleId_1.RuleId.Conditional] = effect_1.ConditionalRule,
72
+ _a[RuleId_1.RuleId.WinZenithium] = effect_1.WinZenithiumRule,
73
+ _a[RuleId_1.RuleId.GiveZenithium] = effect_1.GiveZenithiumRule,
74
+ _a[RuleId_1.RuleId.Exile] = effect_1.ExileRule,
75
+ _a[RuleId_1.RuleId.WinInfluence] = effect_1.WinInfluenceRule,
76
+ _a[RuleId_1.RuleId.GiveInfluence] = effect_1.GiveInfluenceRule,
77
+ _a[RuleId_1.RuleId.ResetInfluence] = effect_1.ResetInfluenceRule,
78
+ _a[RuleId_1.RuleId.DevelopTechnology] = effect_1.DevelopTechnologyRule,
79
+ _a[RuleId_1.RuleId.GiveLeaderBadge] = effect_1.GiveLeaderBadgeRule,
80
+ _a[RuleId_1.RuleId.TakeLeaderBadge] = effect_1.TakeLeaderBadgeRule,
81
+ _a[RuleId_1.RuleId.Discard] = effect_1.DiscardRule,
82
+ _a[RuleId_1.RuleId.Mobilize] = effect_1.MobilizeRule,
83
+ _a[RuleId_1.RuleId.Choice] = effect_1.ChoiceRule,
84
+ _a[RuleId_1.RuleId.TakeBonus] = effect_1.TakeBonusRule,
85
+ _a[RuleId_1.RuleId.Refill] = RefillRule_1.RefillRule,
86
+ _a[RuleId_1.RuleId.StealCredit] = StealCreditRule_1.StealCreditRule,
87
+ _a[RuleId_1.RuleId.SpendZenithium] = SpendZenithiumRule_1.SpendZenithiumRule,
88
+ _a[RuleId_1.RuleId.TakeTechnologyBonusToken] = TakeTechnologyBonusTokenRule_1.TakeTechnologyBonusTokenRule,
89
+ _a);
90
+ _this.locationsStrategies = (_b = {},
91
+ _b[MaterialType_1.MaterialType.AgentCard] = (_c = {},
92
+ _c[LocationType_1.LocationType.PlayerHand] = new rules_api_1.PositiveSequenceStrategy(),
93
+ _c[LocationType_1.LocationType.AgentDeck] = new rules_api_1.PositiveSequenceStrategy(),
94
+ _c[LocationType_1.LocationType.AgentDiscard] = new rules_api_1.PositiveSequenceStrategy(),
95
+ _c[LocationType_1.LocationType.Influence] = new rules_api_1.PositiveSequenceStrategy(),
96
+ _c),
97
+ _b[MaterialType_1.MaterialType.InfluenceDisc] = (_d = {},
98
+ _d[LocationType_1.LocationType.TeamPlanets] = new rules_api_1.PositiveSequenceStrategy(),
99
+ _d[LocationType_1.LocationType.InfluenceDiscStock] = new rules_api_1.PositiveSequenceStrategy(),
100
+ _d),
101
+ _b[MaterialType_1.MaterialType.BonusToken] = (_e = {},
102
+ _e[LocationType_1.LocationType.BonusDiscard] = new rules_api_1.PositiveSequenceStrategy(),
103
+ _e[LocationType_1.LocationType.BonusTokenStock] = new rules_api_1.PositiveSequenceStrategy(),
104
+ _e),
105
+ _b);
106
+ _this.hidingStrategies = (_f = {},
107
+ _f[MaterialType_1.MaterialType.AgentCard] = (_g = {},
108
+ _g[LocationType_1.LocationType.PlayerHand] = rules_api_1.hideItemIdToOthers,
109
+ _g[LocationType_1.LocationType.AgentDeck] = rules_api_1.hideItemId,
110
+ _g),
111
+ _f[MaterialType_1.MaterialType.BonusToken] = (_h = {},
112
+ _h[LocationType_1.LocationType.BonusTokenStock] = rules_api_1.hideItemId,
113
+ _h),
114
+ _f);
115
+ return _this;
116
+ }
117
+ ZenithRules.prototype.rankPlayers = function (_playerA, _playerB) {
118
+ var winners = new EndGameHelper_1.EndGameHelper(this.game).winningTeam;
119
+ if ((0, TeamColor_1.getTeamColor)(_playerA) === winners)
120
+ return 1;
121
+ return -1;
122
+ };
123
+ ZenithRules.prototype.giveTime = function () {
124
+ return 60;
125
+ };
126
+ return ZenithRules;
127
+ }(rules_api_1.SecretMaterialRules));
128
+ exports.ZenithRules = ZenithRules;
@@ -0,0 +1,24 @@
1
+ import { MaterialDeck, MaterialGameSetup } from '@gamepark/rules-api';
2
+ import { Influence } from './material/Influence';
3
+ import { LocationType } from './material/LocationType';
4
+ import { MaterialType } from './material/MaterialType';
5
+ import { PlayerId } from './PlayerId';
6
+ import { TeamColor } from './TeamColor';
7
+ import { ZenithOptions } from './ZenithOptions';
8
+ import { ZenithRules } from './ZenithRules';
9
+ export declare class ZenithSetup extends MaterialGameSetup<PlayerId, MaterialType, LocationType, ZenithOptions> {
10
+ Rules: typeof ZenithRules;
11
+ setupMaterial(_options: ZenithOptions): void;
12
+ setupBonuses(): void;
13
+ setupInfluenceDisc(): void;
14
+ setupLeaderBadge(): void;
15
+ setupInfluences(): void;
16
+ getPlanetStartPosition(planet: Influence): 0 | -1;
17
+ setupDeck(): void;
18
+ setupPlayers(): void;
19
+ setupTechnologyBoard(): void;
20
+ setupPlayer(deck: MaterialDeck, player: PlayerId): void;
21
+ setupTeams(): void;
22
+ setupTeam(team: TeamColor): void;
23
+ start(): void;
24
+ }
@@ -0,0 +1,316 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
54
+ return (mod && mod.__esModule) ? mod : { "default": mod };
55
+ };
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ exports.ZenithSetup = void 0;
58
+ var rules_api_1 = require("@gamepark/rules-api");
59
+ var lodash_1 = require("lodash");
60
+ var shuffle_1 = __importDefault(require("lodash/shuffle"));
61
+ var Agent_1 = require("./material/Agent");
62
+ var Bonus_1 = require("./material/Bonus");
63
+ var Credit_1 = require("./material/Credit");
64
+ var Faction_1 = require("./material/Faction");
65
+ var Influence_1 = require("./material/Influence");
66
+ var LocationType_1 = require("./material/LocationType");
67
+ var MaterialType_1 = require("./material/MaterialType");
68
+ var Memory_1 = require("./rules/Memory");
69
+ var RuleId_1 = require("./rules/RuleId");
70
+ var TeamColor_1 = require("./TeamColor");
71
+ var ZenithRules_1 = require("./ZenithRules");
72
+ var ZenithSetup = (function (_super) {
73
+ __extends(ZenithSetup, _super);
74
+ function ZenithSetup() {
75
+ var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
76
+ _this.Rules = ZenithRules_1.ZenithRules;
77
+ return _this;
78
+ }
79
+ ZenithSetup.prototype.setupMaterial = function (_options) {
80
+ this.setupDeck();
81
+ this.setupPlayers();
82
+ this.setupInfluences();
83
+ this.setupLeaderBadge();
84
+ this.setupTechnologyBoard();
85
+ this.setupTeams();
86
+ this.setupInfluenceDisc();
87
+ this.setupBonuses();
88
+ };
89
+ ZenithSetup.prototype.setupBonuses = function () {
90
+ var e_1, _a, e_2, _b, e_3, _c;
91
+ var shuffledBonuses = (0, shuffle_1.default)(Bonus_1.allBonuses);
92
+ try {
93
+ for (var influences_1 = __values(Influence_1.influences), influences_1_1 = influences_1.next(); !influences_1_1.done; influences_1_1 = influences_1.next()) {
94
+ var influence = influences_1_1.value;
95
+ var bonus = shuffledBonuses.shift();
96
+ this.material(MaterialType_1.MaterialType.BonusToken).createItem({
97
+ id: bonus,
98
+ location: {
99
+ type: LocationType_1.LocationType.PlanetBoardBonusSpace,
100
+ id: influence
101
+ }
102
+ });
103
+ }
104
+ }
105
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
106
+ finally {
107
+ try {
108
+ if (influences_1_1 && !influences_1_1.done && (_a = influences_1.return)) _a.call(influences_1);
109
+ }
110
+ finally { if (e_1) throw e_1.error; }
111
+ }
112
+ var technologyBoards = this.material(MaterialType_1.MaterialType.TechnologyBoard).getIndexes();
113
+ try {
114
+ for (var technologyBoards_1 = __values(technologyBoards), technologyBoards_1_1 = technologyBoards_1.next(); !technologyBoards_1_1.done; technologyBoards_1_1 = technologyBoards_1.next()) {
115
+ var technologyBoardIndex = technologyBoards_1_1.value;
116
+ this.material(MaterialType_1.MaterialType.BonusToken).createItem({
117
+ id: shuffledBonuses.shift(),
118
+ location: {
119
+ type: LocationType_1.LocationType.TechnologyBoardBonusSpace,
120
+ parent: technologyBoardIndex,
121
+ x: 2
122
+ }
123
+ });
124
+ }
125
+ }
126
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
127
+ finally {
128
+ try {
129
+ if (technologyBoards_1_1 && !technologyBoards_1_1.done && (_b = technologyBoards_1.return)) _b.call(technologyBoards_1);
130
+ }
131
+ finally { if (e_2) throw e_2.error; }
132
+ }
133
+ try {
134
+ for (var shuffledBonuses_1 = __values(shuffledBonuses), shuffledBonuses_1_1 = shuffledBonuses_1.next(); !shuffledBonuses_1_1.done; shuffledBonuses_1_1 = shuffledBonuses_1.next()) {
135
+ var bonus = shuffledBonuses_1_1.value;
136
+ this.material(MaterialType_1.MaterialType.BonusToken).createItem({
137
+ id: bonus,
138
+ location: {
139
+ type: LocationType_1.LocationType.BonusTokenStock
140
+ }
141
+ });
142
+ }
143
+ }
144
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
145
+ finally {
146
+ try {
147
+ if (shuffledBonuses_1_1 && !shuffledBonuses_1_1.done && (_c = shuffledBonuses_1.return)) _c.call(shuffledBonuses_1);
148
+ }
149
+ finally { if (e_3) throw e_3.error; }
150
+ }
151
+ };
152
+ ZenithSetup.prototype.setupInfluenceDisc = function () {
153
+ var e_4, _a;
154
+ var _this = this;
155
+ var _loop_1 = function (influence) {
156
+ (0, lodash_1.times)(3, function () {
157
+ _this.material(MaterialType_1.MaterialType.InfluenceDisc).createItem({
158
+ id: influence,
159
+ location: {
160
+ type: LocationType_1.LocationType.InfluenceDiscStock,
161
+ id: influence
162
+ }
163
+ });
164
+ });
165
+ };
166
+ try {
167
+ for (var influences_2 = __values(Influence_1.influences), influences_2_1 = influences_2.next(); !influences_2_1.done; influences_2_1 = influences_2.next()) {
168
+ var influence = influences_2_1.value;
169
+ _loop_1(influence);
170
+ }
171
+ }
172
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
173
+ finally {
174
+ try {
175
+ if (influences_2_1 && !influences_2_1.done && (_a = influences_2.return)) _a.call(influences_2);
176
+ }
177
+ finally { if (e_4) throw e_4.error; }
178
+ }
179
+ };
180
+ ZenithSetup.prototype.setupLeaderBadge = function () {
181
+ this.material(MaterialType_1.MaterialType.LeaderBadgeToken).createItem({
182
+ location: {
183
+ type: LocationType_1.LocationType.DiplomacyBoardLeaderBadgeSpace
184
+ }
185
+ });
186
+ };
187
+ ZenithSetup.prototype.setupInfluences = function () {
188
+ var e_5, _a;
189
+ try {
190
+ for (var influences_3 = __values(Influence_1.influences), influences_3_1 = influences_3.next(); !influences_3_1.done; influences_3_1 = influences_3.next()) {
191
+ var planet = influences_3_1.value;
192
+ this.material(MaterialType_1.MaterialType.InfluenceDisc).createItem({
193
+ id: planet,
194
+ location: {
195
+ type: LocationType_1.LocationType.PlanetBoardInfluenceDiscSpace,
196
+ id: planet,
197
+ x: this.getPlanetStartPosition(planet)
198
+ }
199
+ });
200
+ }
201
+ }
202
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
203
+ finally {
204
+ try {
205
+ if (influences_3_1 && !influences_3_1.done && (_a = influences_3.return)) _a.call(influences_3);
206
+ }
207
+ finally { if (e_5) throw e_5.error; }
208
+ }
209
+ };
210
+ ZenithSetup.prototype.getPlanetStartPosition = function (planet) {
211
+ if (planet === Influence_1.Influence.Terra)
212
+ return -1;
213
+ return 0;
214
+ };
215
+ ZenithSetup.prototype.setupDeck = function () {
216
+ var shuffledAgents = (0, shuffle_1.default)(Agent_1.agents);
217
+ this.material(MaterialType_1.MaterialType.AgentCard).createItems(shuffledAgents.map(function (agent) { return ({
218
+ id: agent,
219
+ location: {
220
+ type: LocationType_1.LocationType.AgentDeck
221
+ }
222
+ }); }));
223
+ };
224
+ ZenithSetup.prototype.setupPlayers = function () {
225
+ var e_6, _a;
226
+ var deck = this.material(MaterialType_1.MaterialType.AgentCard).location(LocationType_1.LocationType.AgentDeck).deck();
227
+ try {
228
+ for (var _b = __values(this.game.players), _c = _b.next(); !_c.done; _c = _b.next()) {
229
+ var player = _c.value;
230
+ this.setupPlayer(deck, player);
231
+ }
232
+ }
233
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
234
+ finally {
235
+ try {
236
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
237
+ }
238
+ finally { if (e_6) throw e_6.error; }
239
+ }
240
+ };
241
+ ZenithSetup.prototype.setupTechnologyBoard = function () {
242
+ var e_7, _a;
243
+ var boards = ['S', 'U', 'N'];
244
+ for (var i = 0; i < boards.length; i++) {
245
+ var current = boards[i];
246
+ this.material(MaterialType_1.MaterialType.TechnologyBoard).createItem({ id: current, location: { type: LocationType_1.LocationType.TechnologyBoardPlace, id: Faction_1.factions[i] } });
247
+ try {
248
+ for (var teamColors_1 = (e_7 = void 0, __values(TeamColor_1.teamColors)), teamColors_1_1 = teamColors_1.next(); !teamColors_1_1.done; teamColors_1_1 = teamColors_1.next()) {
249
+ var color = teamColors_1_1.value;
250
+ this.material(MaterialType_1.MaterialType.TechMarker).createItem({
251
+ id: color,
252
+ location: {
253
+ type: LocationType_1.LocationType.TechnologyBoardTokenSpace,
254
+ parent: this.material(MaterialType_1.MaterialType.TechnologyBoard).id(current).getIndex(),
255
+ player: color,
256
+ x: 0
257
+ }
258
+ });
259
+ }
260
+ }
261
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
262
+ finally {
263
+ try {
264
+ if (teamColors_1_1 && !teamColors_1_1.done && (_a = teamColors_1.return)) _a.call(teamColors_1);
265
+ }
266
+ finally { if (e_7) throw e_7.error; }
267
+ }
268
+ }
269
+ };
270
+ ZenithSetup.prototype.setupPlayer = function (deck, player) {
271
+ deck.deal({
272
+ type: LocationType_1.LocationType.PlayerHand,
273
+ player: player
274
+ }, 4);
275
+ };
276
+ ZenithSetup.prototype.setupTeams = function () {
277
+ this.setupTeam(TeamColor_1.TeamColor.White);
278
+ this.setupTeam(TeamColor_1.TeamColor.Black);
279
+ };
280
+ ZenithSetup.prototype.setupTeam = function (team) {
281
+ this.material(MaterialType_1.MaterialType.CreditToken).createItem({
282
+ id: Credit_1.Credit.Credit1,
283
+ location: {
284
+ type: LocationType_1.LocationType.TeamCredit,
285
+ player: team
286
+ },
287
+ quantity: 4
288
+ });
289
+ this.material(MaterialType_1.MaterialType.CreditToken).createItem({
290
+ id: Credit_1.Credit.Credit3,
291
+ location: {
292
+ type: LocationType_1.LocationType.TeamCredit,
293
+ player: team
294
+ }
295
+ });
296
+ this.material(MaterialType_1.MaterialType.CreditToken).createItem({
297
+ id: Credit_1.Credit.Credit5,
298
+ location: {
299
+ type: LocationType_1.LocationType.TeamCredit,
300
+ player: team
301
+ }
302
+ });
303
+ this.material(MaterialType_1.MaterialType.ZenithiumToken).createItem({
304
+ location: {
305
+ type: LocationType_1.LocationType.TeamZenithium,
306
+ player: team
307
+ }
308
+ });
309
+ };
310
+ ZenithSetup.prototype.start = function () {
311
+ this.memorize(Memory_1.Memory.TurnOrder, (0, shuffle_1.default)(this.game.players));
312
+ this.startSimultaneousRule(RuleId_1.RuleId.Muligan);
313
+ };
314
+ return ZenithSetup;
315
+ }(rules_api_1.MaterialGameSetup));
316
+ exports.ZenithSetup = ZenithSetup;
@@ -0,0 +1,3 @@
1
+ export { ZenithRules } from './ZenithRules';
2
+ export { ZenithOptionsSpec } from './ZenithOptions';
3
+ export { ZenithSetup } from './ZenithSetup';
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZenithSetup = exports.ZenithOptionsSpec = exports.ZenithRules = void 0;
4
+ var ZenithRules_1 = require("./ZenithRules");
5
+ Object.defineProperty(exports, "ZenithRules", { enumerable: true, get: function () { return ZenithRules_1.ZenithRules; } });
6
+ var ZenithOptions_1 = require("./ZenithOptions");
7
+ Object.defineProperty(exports, "ZenithOptionsSpec", { enumerable: true, get: function () { return ZenithOptions_1.ZenithOptionsSpec; } });
8
+ var ZenithSetup_1 = require("./ZenithSetup");
9
+ Object.defineProperty(exports, "ZenithSetup", { enumerable: true, get: function () { return ZenithSetup_1.ZenithSetup; } });