@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,96 @@
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
+ }
50
+ }
51
+ return to.concat(ar || Array.prototype.slice.call(from));
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.TechnologyHelper = 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 TechnologyActions_1 = require("../discard-action/TechnologyActions");
59
+ var Memory_1 = require("../Memory");
60
+ var TechnologyHelper = (function (_super) {
61
+ __extends(TechnologyHelper, _super);
62
+ function TechnologyHelper() {
63
+ return _super !== null && _super.apply(this, arguments) || this;
64
+ }
65
+ TechnologyHelper.prototype.applyTechnology = function (move) {
66
+ var board = this.material(MaterialType_1.MaterialType.TechnologyBoard).getItem(move.location.parent);
67
+ var actions = (0, TechnologyActions_1.getTechnologyAction)(board.id);
68
+ this.memorize(Memory_1.Memory.Effects, function (effects) {
69
+ if (effects === void 0) { effects = []; }
70
+ var newEffects = JSON.parse(JSON.stringify(actions.slice(0, move.location.x).reverse()));
71
+ effects.push.apply(effects, __spreadArray([], __read(newEffects.flat().map(function (e) { return (__assign(__assign({}, e), { effectSource: {
72
+ type: MaterialType_1.MaterialType.TechnologyBoard,
73
+ value: board.location.id
74
+ } })); })), false));
75
+ return effects;
76
+ });
77
+ var hasLine = this.material(MaterialType_1.MaterialType.TechMarker)
78
+ .location(LocationType_1.LocationType.TechnologyBoardTokenSpace)
79
+ .player(move.location.player)
80
+ .filter(function (item) { return item.location.x >= move.location.x; }).length === 3;
81
+ if (hasLine && TechnologyActions_1.TechnologyLineBonuses[move.location.x - 1]) {
82
+ this.memorize(Memory_1.Memory.Effects, function (effects) {
83
+ if (effects === void 0) { effects = []; }
84
+ var effect = JSON.parse(JSON.stringify(TechnologyActions_1.TechnologyLineBonuses[move.location.x - 1]));
85
+ effects.push(__assign(__assign({}, effect), { effectSource: {
86
+ type: MaterialType_1.MaterialType.TechnologyBoard,
87
+ value: board.location.id
88
+ } }));
89
+ return effects;
90
+ });
91
+ }
92
+ return [];
93
+ };
94
+ return TechnologyHelper;
95
+ }(rules_api_1.PlayerTurnRule));
96
+ exports.TechnologyHelper = TechnologyHelper;
@@ -0,0 +1,10 @@
1
+ import { MaterialGame, MaterialMove, MaterialRulesPart } from '@gamepark/rules-api';
2
+ import { PlayerId } from '../../PlayerId';
3
+ export declare class ZenithiumHelper extends MaterialRulesPart {
4
+ readonly player: PlayerId;
5
+ private playerHelper;
6
+ constructor(game: MaterialGame, player: PlayerId);
7
+ winZenithium(count?: number): MaterialMove[];
8
+ giveZenithium(to: PlayerId, count?: number): MaterialMove[];
9
+ spendZenithium(count?: number): MaterialMove[];
10
+ }
@@ -0,0 +1,59 @@
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.ZenithiumHelper = 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 PlayerHelper_1 = require("./PlayerHelper");
23
+ var ZenithiumHelper = (function (_super) {
24
+ __extends(ZenithiumHelper, _super);
25
+ function ZenithiumHelper(game, player) {
26
+ var _this = _super.call(this, game) || this;
27
+ _this.player = player;
28
+ _this.playerHelper = new PlayerHelper_1.PlayerHelper(game, player);
29
+ return _this;
30
+ }
31
+ ZenithiumHelper.prototype.winZenithium = function (count) {
32
+ if (count === void 0) { count = 1; }
33
+ return [
34
+ this.material(MaterialType_1.MaterialType.ZenithiumToken).createItem({
35
+ location: {
36
+ type: LocationType_1.LocationType.TeamZenithium,
37
+ player: this.playerHelper.team
38
+ },
39
+ quantity: count
40
+ })
41
+ ];
42
+ };
43
+ ZenithiumHelper.prototype.giveZenithium = function (to, count) {
44
+ if (count === void 0) { count = 1; }
45
+ return this.material(MaterialType_1.MaterialType.ZenithiumToken)
46
+ .location(LocationType_1.LocationType.TeamZenithium)
47
+ .player(this.playerHelper.team)
48
+ .moveItems({
49
+ type: LocationType_1.LocationType.TeamZenithium,
50
+ player: new PlayerHelper_1.PlayerHelper(this.game, to).team
51
+ }, count);
52
+ };
53
+ ZenithiumHelper.prototype.spendZenithium = function (count) {
54
+ if (count === void 0) { count = 1; }
55
+ return this.material(MaterialType_1.MaterialType.ZenithiumToken).location(LocationType_1.LocationType.TeamZenithium).player(this.playerHelper.team).deleteItems(count);
56
+ };
57
+ return ZenithiumHelper;
58
+ }(rules_api_1.MaterialRulesPart));
59
+ exports.ZenithiumHelper = ZenithiumHelper;
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@gamepark/zenith",
3
+ "version": "0.0.1",
4
+ "description": "The rules of Zenith adapted for Game Park",
5
+ "sideEffects": false,
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "author": "Romain Fromi <romain@game-park.com> (https://game-park.com/)",
12
+ "license": "ISC",
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "scripts": {
17
+ "build": "tsc",
18
+ "prepublishOnly": "tsc",
19
+ "publish": "lerna publish",
20
+ "lint": "eslint --fix"
21
+ },
22
+ "peerDependencies": {
23
+ "@gamepark/rules-api": ">=6.33",
24
+ "lodash": ">=4.17"
25
+ },
26
+ "devDependencies": {
27
+ "@gamepark/rules-api": "~6.36.7",
28
+ "@types/lodash": "^4.17.7",
29
+ "i18next": "^22.0.3",
30
+ "lodash": "^4.17.21"
31
+ },
32
+ "gitHead": "2e48797e96fea5d8bd82532fd97ee26242c7246f"
33
+ }