@gamepark/zenith 0.0.2 → 0.1.2

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 (265) hide show
  1. package/dist/PlayerId.d.ts +1 -0
  2. package/dist/PlayerId.d.ts.map +1 -0
  3. package/dist/PlayerId.js +2 -2
  4. package/dist/PlayerId.js.map +1 -0
  5. package/dist/TeamColor.d.ts +10 -0
  6. package/dist/TeamColor.d.ts.map +1 -0
  7. package/dist/TeamColor.js +18 -13
  8. package/dist/TeamColor.js.map +1 -0
  9. package/dist/ZenithOptions.d.ts +1 -0
  10. package/dist/ZenithOptions.d.ts.map +1 -0
  11. package/dist/ZenithOptions.js +2 -4
  12. package/dist/ZenithOptions.js.map +1 -0
  13. package/dist/ZenithRules.d.ts +5 -1
  14. package/dist/ZenithRules.d.ts.map +1 -0
  15. package/dist/ZenithRules.js +80 -123
  16. package/dist/ZenithRules.js.map +1 -0
  17. package/dist/ZenithSetup.d.ts +4 -1
  18. package/dist/ZenithSetup.d.ts.map +1 -0
  19. package/dist/ZenithSetup.js +143 -265
  20. package/dist/ZenithSetup.js.map +1 -0
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +4 -9
  24. package/dist/index.js.map +1 -0
  25. package/dist/material/Agent.d.ts +1 -0
  26. package/dist/material/Agent.d.ts.map +1 -0
  27. package/dist/material/Agent.js +5 -7
  28. package/dist/material/Agent.js.map +1 -0
  29. package/dist/material/Agents.d.ts +1 -0
  30. package/dist/material/Agents.d.ts.map +1 -0
  31. package/dist/material/Agents.js +922 -924
  32. package/dist/material/Agents.js.map +1 -0
  33. package/dist/material/Bonus.d.ts +1 -0
  34. package/dist/material/Bonus.d.ts.map +1 -0
  35. package/dist/material/Bonus.js +6 -8
  36. package/dist/material/Bonus.js.map +1 -0
  37. package/dist/material/Bonuses.d.ts +1 -0
  38. package/dist/material/Bonuses.d.ts.map +1 -0
  39. package/dist/material/Bonuses.js +30 -33
  40. package/dist/material/Bonuses.js.map +1 -0
  41. package/dist/material/Credit.d.ts +1 -0
  42. package/dist/material/Credit.d.ts.map +1 -0
  43. package/dist/material/Credit.js +5 -7
  44. package/dist/material/Credit.js.map +1 -0
  45. package/dist/material/Faction.d.ts +1 -0
  46. package/dist/material/Faction.d.ts.map +1 -0
  47. package/dist/material/Faction.js +5 -7
  48. package/dist/material/Faction.js.map +1 -0
  49. package/dist/material/Influence.d.ts +1 -0
  50. package/dist/material/Influence.d.ts.map +1 -0
  51. package/dist/material/Influence.js +5 -7
  52. package/dist/material/Influence.js.map +1 -0
  53. package/dist/material/LocationType.d.ts +4 -1
  54. package/dist/material/LocationType.d.ts.map +1 -0
  55. package/dist/material/LocationType.js +5 -5
  56. package/dist/material/LocationType.js.map +1 -0
  57. package/dist/material/MaterialType.d.ts +1 -0
  58. package/dist/material/MaterialType.d.ts.map +1 -0
  59. package/dist/material/MaterialType.js +3 -5
  60. package/dist/material/MaterialType.js.map +1 -0
  61. package/dist/material/effect/Effect.d.ts +6 -1
  62. package/dist/material/effect/Effect.d.ts.map +1 -0
  63. package/dist/material/effect/Effect.js +6 -10
  64. package/dist/material/effect/Effect.js.map +1 -0
  65. package/dist/material/effect/EffectType.d.ts +3 -1
  66. package/dist/material/effect/EffectType.d.ts.map +1 -0
  67. package/dist/material/effect/EffectType.js +4 -5
  68. package/dist/material/effect/EffectType.js.map +1 -0
  69. package/dist/rules/CustomMoveType.d.ts +6 -1
  70. package/dist/rules/CustomMoveType.d.ts.map +1 -0
  71. package/dist/rules/CustomMoveType.js +7 -5
  72. package/dist/rules/CustomMoveType.js.map +1 -0
  73. package/dist/rules/DiscardActionRule.d.ts +1 -0
  74. package/dist/rules/DiscardActionRule.d.ts.map +1 -0
  75. package/dist/rules/DiscardActionRule.js +27 -75
  76. package/dist/rules/DiscardActionRule.js.map +1 -0
  77. package/dist/rules/Memory.d.ts +5 -1
  78. package/dist/rules/Memory.d.ts.map +1 -0
  79. package/dist/rules/Memory.js +6 -5
  80. package/dist/rules/Memory.js.map +1 -0
  81. package/dist/rules/MulliganRule.d.ts +1 -0
  82. package/dist/rules/MulliganRule.d.ts.map +1 -0
  83. package/dist/rules/MulliganRule.js +53 -125
  84. package/dist/rules/MulliganRule.js.map +1 -0
  85. package/dist/rules/PickOrderRule.d.ts +10 -0
  86. package/dist/rules/PickOrderRule.d.ts.map +1 -0
  87. package/dist/rules/PickOrderRule.js +36 -0
  88. package/dist/rules/PickOrderRule.js.map +1 -0
  89. package/dist/rules/PlayCardRule.d.ts +1 -0
  90. package/dist/rules/PlayCardRule.d.ts.map +1 -0
  91. package/dist/rules/PlayCardRule.js +81 -134
  92. package/dist/rules/PlayCardRule.js.map +1 -0
  93. package/dist/rules/RefillRule.d.ts +4 -1
  94. package/dist/rules/RefillRule.d.ts.map +1 -0
  95. package/dist/rules/RefillRule.js +99 -189
  96. package/dist/rules/RefillRule.js.map +1 -0
  97. package/dist/rules/RuleId.d.ts +4 -1
  98. package/dist/rules/RuleId.d.ts.map +1 -0
  99. package/dist/rules/RuleId.js +5 -5
  100. package/dist/rules/RuleId.js.map +1 -0
  101. package/dist/rules/discard-action/DiplomacyActions.d.ts +2 -1
  102. package/dist/rules/discard-action/DiplomacyActions.d.ts.map +1 -0
  103. package/dist/rules/discard-action/DiplomacyActions.js +57 -20
  104. package/dist/rules/discard-action/DiplomacyActions.js.map +1 -0
  105. package/dist/rules/discard-action/DiplomacyBoardRule.d.ts +1 -0
  106. package/dist/rules/discard-action/DiplomacyBoardRule.d.ts.map +1 -0
  107. package/dist/rules/discard-action/DiplomacyBoardRule.js +28 -64
  108. package/dist/rules/discard-action/DiplomacyBoardRule.js.map +1 -0
  109. package/dist/rules/discard-action/TechnologyActions.d.ts +1 -0
  110. package/dist/rules/discard-action/TechnologyActions.d.ts.map +1 -0
  111. package/dist/rules/discard-action/TechnologyActions.js +45 -48
  112. package/dist/rules/discard-action/TechnologyActions.js.map +1 -0
  113. package/dist/rules/discard-action/TechnologyBoardRule.d.ts +1 -0
  114. package/dist/rules/discard-action/TechnologyBoardRule.d.ts.map +1 -0
  115. package/dist/rules/discard-action/TechnologyBoardRule.js +35 -102
  116. package/dist/rules/discard-action/TechnologyBoardRule.js.map +1 -0
  117. package/dist/rules/effect/ChoiceRule.d.ts +1 -0
  118. package/dist/rules/effect/ChoiceRule.d.ts.map +1 -0
  119. package/dist/rules/effect/ChoiceRule.js +21 -81
  120. package/dist/rules/effect/ChoiceRule.js.map +1 -0
  121. package/dist/rules/effect/ConditionalRule.d.ts +1 -0
  122. package/dist/rules/effect/ConditionalRule.d.ts.map +1 -0
  123. package/dist/rules/effect/ConditionalRule.js +78 -141
  124. package/dist/rules/effect/ConditionalRule.js.map +1 -0
  125. package/dist/rules/effect/DevelopTechnologyRule.d.ts +1 -0
  126. package/dist/rules/effect/DevelopTechnologyRule.d.ts.map +1 -0
  127. package/dist/rules/effect/DevelopTechnologyRule.js +54 -119
  128. package/dist/rules/effect/DevelopTechnologyRule.js.map +1 -0
  129. package/dist/rules/effect/DiscardRule.d.ts +1 -0
  130. package/dist/rules/effect/DiscardRule.d.ts.map +1 -0
  131. package/dist/rules/effect/DiscardRule.js +38 -90
  132. package/dist/rules/effect/DiscardRule.js.map +1 -0
  133. package/dist/rules/effect/EffectRule.d.ts +1 -0
  134. package/dist/rules/effect/EffectRule.d.ts.map +1 -0
  135. package/dist/rules/effect/EffectRule.js +61 -138
  136. package/dist/rules/effect/EffectRule.js.map +1 -0
  137. package/dist/rules/effect/ExileRule.d.ts +1 -0
  138. package/dist/rules/effect/ExileRule.d.ts.map +1 -0
  139. package/dist/rules/effect/ExileRule.js +65 -148
  140. package/dist/rules/effect/ExileRule.js.map +1 -0
  141. package/dist/rules/effect/GiveCreditRule.d.ts +1 -0
  142. package/dist/rules/effect/GiveCreditRule.d.ts.map +1 -0
  143. package/dist/rules/effect/GiveCreditRule.js +26 -73
  144. package/dist/rules/effect/GiveCreditRule.js.map +1 -0
  145. package/dist/rules/effect/GiveInfluenceRule.d.ts +1 -0
  146. package/dist/rules/effect/GiveInfluenceRule.d.ts.map +1 -0
  147. package/dist/rules/effect/GiveInfluenceRule.js +43 -103
  148. package/dist/rules/effect/GiveInfluenceRule.js.map +1 -0
  149. package/dist/rules/effect/GiveLeaderBadgeRule.d.ts +1 -0
  150. package/dist/rules/effect/GiveLeaderBadgeRule.d.ts.map +1 -0
  151. package/dist/rules/effect/GiveLeaderBadgeRule.js +19 -46
  152. package/dist/rules/effect/GiveLeaderBadgeRule.js.map +1 -0
  153. package/dist/rules/effect/GiveZenithiumRule.d.ts +1 -0
  154. package/dist/rules/effect/GiveZenithiumRule.d.ts.map +1 -0
  155. package/dist/rules/effect/GiveZenithiumRule.js +28 -79
  156. package/dist/rules/effect/GiveZenithiumRule.js.map +1 -0
  157. package/dist/rules/effect/MobilizeRule.d.ts +1 -0
  158. package/dist/rules/effect/MobilizeRule.d.ts.map +1 -0
  159. package/dist/rules/effect/MobilizeRule.js +39 -93
  160. package/dist/rules/effect/MobilizeRule.js.map +1 -0
  161. package/dist/rules/effect/ResetInfluenceRule.d.ts +1 -0
  162. package/dist/rules/effect/ResetInfluenceRule.d.ts.map +1 -0
  163. package/dist/rules/effect/ResetInfluenceRule.js +22 -58
  164. package/dist/rules/effect/ResetInfluenceRule.js.map +1 -0
  165. package/dist/rules/effect/ShareCardRule.d.ts +21 -0
  166. package/dist/rules/effect/ShareCardRule.d.ts.map +1 -0
  167. package/dist/rules/effect/ShareCardRule.js +68 -0
  168. package/dist/rules/effect/ShareCardRule.js.map +1 -0
  169. package/dist/rules/effect/SpendCreditRule.d.ts +1 -0
  170. package/dist/rules/effect/SpendCreditRule.d.ts.map +1 -0
  171. package/dist/rules/effect/SpendCreditRule.js +30 -102
  172. package/dist/rules/effect/SpendCreditRule.js.map +1 -0
  173. package/dist/rules/effect/SpendZenithiumRule.d.ts +1 -0
  174. package/dist/rules/effect/SpendZenithiumRule.d.ts.map +1 -0
  175. package/dist/rules/effect/SpendZenithiumRule.js +33 -109
  176. package/dist/rules/effect/SpendZenithiumRule.js.map +1 -0
  177. package/dist/rules/effect/StealCreditRule.d.ts +1 -0
  178. package/dist/rules/effect/StealCreditRule.d.ts.map +1 -0
  179. package/dist/rules/effect/StealCreditRule.js +18 -64
  180. package/dist/rules/effect/StealCreditRule.js.map +1 -0
  181. package/dist/rules/effect/TakeBonusRule.d.ts +1 -0
  182. package/dist/rules/effect/TakeBonusRule.d.ts.map +1 -0
  183. package/dist/rules/effect/TakeBonusRule.js +31 -91
  184. package/dist/rules/effect/TakeBonusRule.js.map +1 -0
  185. package/dist/rules/effect/TakeLeaderBadgeRule.d.ts +1 -0
  186. package/dist/rules/effect/TakeLeaderBadgeRule.d.ts.map +1 -0
  187. package/dist/rules/effect/TakeLeaderBadgeRule.js +32 -88
  188. package/dist/rules/effect/TakeLeaderBadgeRule.js.map +1 -0
  189. package/dist/rules/effect/TakeTechnologyBonusTokenRule.d.ts +1 -0
  190. package/dist/rules/effect/TakeTechnologyBonusTokenRule.d.ts.map +1 -0
  191. package/dist/rules/effect/TakeTechnologyBonusTokenRule.js +46 -112
  192. package/dist/rules/effect/TakeTechnologyBonusTokenRule.js.map +1 -0
  193. package/dist/rules/effect/TransferRule.d.ts +1 -0
  194. package/dist/rules/effect/TransferRule.d.ts.map +1 -0
  195. package/dist/rules/effect/TransferRule.js +48 -81
  196. package/dist/rules/effect/TransferRule.js.map +1 -0
  197. package/dist/rules/effect/WinCreditRule.d.ts +1 -0
  198. package/dist/rules/effect/WinCreditRule.d.ts.map +1 -0
  199. package/dist/rules/effect/WinCreditRule.js +61 -130
  200. package/dist/rules/effect/WinCreditRule.js.map +1 -0
  201. package/dist/rules/effect/WinInfluenceRule.d.ts +1 -0
  202. package/dist/rules/effect/WinInfluenceRule.d.ts.map +1 -0
  203. package/dist/rules/effect/WinInfluenceRule.js +129 -248
  204. package/dist/rules/effect/WinInfluenceRule.js.map +1 -0
  205. package/dist/rules/effect/WinZenithiumRule.d.ts +4 -0
  206. package/dist/rules/effect/WinZenithiumRule.d.ts.map +1 -0
  207. package/dist/rules/effect/WinZenithiumRule.js +43 -80
  208. package/dist/rules/effect/WinZenithiumRule.js.map +1 -0
  209. package/dist/rules/effect/index.d.ts +5 -0
  210. package/dist/rules/effect/index.d.ts.map +1 -0
  211. package/dist/rules/effect/index.js +24 -35
  212. package/dist/rules/effect/index.js.map +1 -0
  213. package/dist/rules/helper/BonusHelper.d.ts +1 -0
  214. package/dist/rules/helper/BonusHelper.d.ts.map +1 -0
  215. package/dist/rules/helper/BonusHelper.js +33 -64
  216. package/dist/rules/helper/BonusHelper.js.map +1 -0
  217. package/dist/rules/helper/CreditHelper.d.ts +1 -0
  218. package/dist/rules/helper/CreditHelper.d.ts.map +1 -0
  219. package/dist/rules/helper/CreditHelper.js +20 -44
  220. package/dist/rules/helper/CreditHelper.js.map +1 -0
  221. package/dist/rules/helper/EffectHelper.d.ts +1 -0
  222. package/dist/rules/helper/EffectHelper.d.ts.map +1 -0
  223. package/dist/rules/helper/EffectHelper.js +85 -123
  224. package/dist/rules/helper/EffectHelper.js.map +1 -0
  225. package/dist/rules/helper/EffectRuleIds.d.ts +1 -0
  226. package/dist/rules/helper/EffectRuleIds.d.ts.map +1 -0
  227. package/dist/rules/helper/EffectRuleIds.js +27 -29
  228. package/dist/rules/helper/EffectRuleIds.js.map +1 -0
  229. package/dist/rules/helper/EndGameHelper.d.ts +1 -0
  230. package/dist/rules/helper/EndGameHelper.d.ts.map +1 -0
  231. package/dist/rules/helper/EndGameHelper.js +24 -57
  232. package/dist/rules/helper/EndGameHelper.js.map +1 -0
  233. package/dist/rules/helper/InfluenceHelper.d.ts +1 -0
  234. package/dist/rules/helper/InfluenceHelper.d.ts.map +1 -0
  235. package/dist/rules/helper/InfluenceHelper.js +19 -44
  236. package/dist/rules/helper/InfluenceHelper.js.map +1 -0
  237. package/dist/rules/helper/MobilizeHelper.d.ts +1 -0
  238. package/dist/rules/helper/MobilizeHelper.d.ts.map +1 -0
  239. package/dist/rules/helper/MobilizeHelper.js +28 -53
  240. package/dist/rules/helper/MobilizeHelper.js.map +1 -0
  241. package/dist/rules/helper/PlanetHelper.d.ts +1 -0
  242. package/dist/rules/helper/PlanetHelper.d.ts.map +1 -0
  243. package/dist/rules/helper/PlanetHelper.js +46 -78
  244. package/dist/rules/helper/PlanetHelper.js.map +1 -0
  245. package/dist/rules/helper/PlayerHelper.d.ts +1 -0
  246. package/dist/rules/helper/PlayerHelper.d.ts.map +1 -0
  247. package/dist/rules/helper/PlayerHelper.js +25 -60
  248. package/dist/rules/helper/PlayerHelper.js.map +1 -0
  249. package/dist/rules/helper/TechnologyHelper.d.ts +1 -0
  250. package/dist/rules/helper/TechnologyHelper.d.ts.map +1 -0
  251. package/dist/rules/helper/TechnologyHelper.js +32 -87
  252. package/dist/rules/helper/TechnologyHelper.js.map +1 -0
  253. package/dist/rules/helper/ZenithiumHelper.d.ts +1 -0
  254. package/dist/rules/helper/ZenithiumHelper.d.ts.map +1 -0
  255. package/dist/rules/helper/ZenithiumHelper.js +26 -48
  256. package/dist/rules/helper/ZenithiumHelper.js.map +1 -0
  257. package/dist/tutorial/TutorialSetup.d.ts +18 -0
  258. package/dist/tutorial/TutorialSetup.d.ts.map +1 -0
  259. package/dist/tutorial/TutorialSetup.js +145 -0
  260. package/dist/tutorial/TutorialSetup.js.map +1 -0
  261. package/dist/tutorial/TutorialSetup.spec.d.ts +2 -0
  262. package/dist/tutorial/TutorialSetup.spec.d.ts.map +1 -0
  263. package/dist/tutorial/TutorialSetup.spec.js +183 -0
  264. package/dist/tutorial/TutorialSetup.spec.js.map +1 -0
  265. package/package.json +9 -8
@@ -1,91 +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 __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.ChoiceRule = exports.Choice = void 0;
55
- var rules_api_1 = require("@gamepark/rules-api");
56
- var MaterialType_1 = require("../../material/MaterialType");
57
- var CustomMoveType_1 = require("../CustomMoveType");
58
- var Memory_1 = require("../Memory");
59
- var index_1 = require("./index");
60
- var Choice;
1
+ import { isCustomMoveType } from '@gamepark/rules-api';
2
+ import { CustomMoveType } from '../CustomMoveType';
3
+ import { Memory } from '../Memory';
4
+ import { EffectRule } from './index';
5
+ export var Choice;
61
6
  (function (Choice) {
62
7
  Choice[Choice["LEFT"] = 1] = "LEFT";
63
8
  Choice[Choice["RIGHT"] = 2] = "RIGHT";
64
- })(Choice || (exports.Choice = Choice = {}));
65
- var ChoiceRule = (function (_super) {
66
- __extends(ChoiceRule, _super);
67
- function ChoiceRule() {
68
- return _super !== null && _super.apply(this, arguments) || this;
9
+ })(Choice || (Choice = {}));
10
+ export class ChoiceRule extends EffectRule {
11
+ getPlayerMoves() {
12
+ return [this.customMove(CustomMoveType.Choice, Choice.LEFT), this.customMove(CustomMoveType.Choice, Choice.RIGHT)];
69
13
  }
70
- ChoiceRule.prototype.getPlayerMoves = function () {
71
- return [this.customMove(CustomMoveType_1.CustomMoveType.Choice, Choice.LEFT), this.customMove(CustomMoveType_1.CustomMoveType.Choice, Choice.RIGHT)];
72
- };
73
- ChoiceRule.prototype.onCustomMove = function (move) {
74
- if (!(0, rules_api_1.isCustomMoveType)(MaterialType_1.MaterialType.InfluenceDisc)(move))
14
+ onCustomMove(move) {
15
+ if (!isCustomMoveType(CustomMoveType.Choice)(move))
75
16
  return [];
76
17
  this.choice(move.data);
77
18
  return this.applyFirstEffect();
78
- };
79
- ChoiceRule.prototype.choice = function (choice) {
80
- this.memorize(Memory_1.Memory.Effects, function (effects) {
81
- var firstEffect = effects[0];
82
- var left = firstEffect.left, right = firstEffect.right;
19
+ }
20
+ choice(choice) {
21
+ this.memorize(Memory.Effects, (effects) => {
22
+ const firstEffect = effects[0];
23
+ const { left, right } = firstEffect;
83
24
  if (choice === Choice.LEFT) {
84
- return __spreadArray([__assign(__assign({}, left), { effectSource: firstEffect.effectSource })], __read(effects.slice(1)), false);
25
+ return [{ ...left, effectSource: firstEffect.effectSource }, ...effects.slice(1)];
85
26
  }
86
- return __spreadArray([__assign(__assign({}, right), { effectSource: firstEffect.effectSource })], __read(effects.slice(1)), false);
27
+ return [{ ...right, effectSource: firstEffect.effectSource }, ...effects.slice(1)];
87
28
  });
88
- };
89
- return ChoiceRule;
90
- }(index_1.EffectRule));
91
- exports.ChoiceRule = ChoiceRule;
29
+ }
30
+ }
31
+ //# sourceMappingURL=ChoiceRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChoiceRule.js","sourceRoot":"","sources":["../../../src/rules/effect/ChoiceRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,MAAM,CAAN,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,mCAAQ,CAAA;IACR,qCAAK,CAAA;AACP,CAAC,EAHW,MAAM,KAAN,MAAM,QAGjB;AACD,MAAM,OAAO,UAAW,SAAQ,UAAwB;IACtD,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IACpH,CAAC;IAED,YAAY,CAAC,IAAgB;QAC3B,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;YAAE,OAAO,EAAE,CAAA;QAC7D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAc,CAAC,CAAA;QAChC,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAA;IAChC,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,OAAyB,EAAE,EAAE;YAC1D,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAiC,CAAA;YAC9D,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,WAAW,CAAA;YAEnC,IAAI,MAAM,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC3B,OAAO,CAAC,EAAE,GAAG,IAAI,EAAE,YAAY,EAAE,WAAW,CAAC,YAAY,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YACnF,CAAC;YAED,OAAO,CAAC,EAAE,GAAG,KAAK,EAAE,YAAY,EAAE,WAAW,CAAC,YAAY,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QACpF,CAAC,CAAC,CAAA;IACJ,CAAC;CACF"}
@@ -15,3 +15,4 @@ export declare class ConditionalRule extends EffectRule<ConditionalEffect> {
15
15
  addEffectAndRemoveCondition(extraData?: Record<string, unknown>): void;
16
16
  onRuleEnd(): never[];
17
17
  }
18
+ //# sourceMappingURL=ConditionalRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConditionalRule.d.ts","sourceRoot":"","sources":["../../../src/rules/effect/ConditionalRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoB,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EACL,SAAS,EACT,iBAAiB,EAEjB,iBAAiB,EAEjB,oBAAoB,EACpB,eAAe,EAChB,MAAM,8BAA8B,CAAA;AAKrC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,qBAAa,eAAgB,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IAChE,WAAW;IAkBX,cAAc;IAgBd,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,EAAE;IA2B9C,aAAa,CAAC,IAAI,EAAE,QAAQ;IAS5B,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU;IAkB1C,IAAI,iBAAiB,YAIpB;IAED,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,IAAI,iBAAiB;IAInE,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,IAAI,eAAe;IAIrE,qBAAqB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,IAAI,oBAAoB;IAI9E,UAAU;IAmBV,2BAA2B,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAiB/D,SAAS;CAIV"}
@@ -1,76 +1,18 @@
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.ConditionalRule = void 0;
55
- var rules_api_1 = require("@gamepark/rules-api");
56
- var Effect_1 = require("../../material/effect/Effect");
57
- var EffectType_1 = require("../../material/effect/EffectType");
58
- var CustomMoveType_1 = require("../CustomMoveType");
59
- var EffectHelper_1 = require("../helper/EffectHelper");
60
- var Memory_1 = require("../Memory");
61
- var index_1 = require("./index");
62
- var ConditionalRule = (function (_super) {
63
- __extends(ConditionalRule, _super);
64
- function ConditionalRule() {
65
- return _super !== null && _super.apply(this, arguments) || this;
66
- }
67
- ConditionalRule.prototype.onRuleStart = function () {
68
- var condition = this.effect.condition;
69
- var moves = _super.prototype.onRuleStart.call(this);
1
+ import { isCustomMoveType } from '@gamepark/rules-api';
2
+ import { ConditionType } from '../../material/effect/Effect';
3
+ import { EffectType } from '../../material/effect/EffectType';
4
+ import { CustomMoveType } from '../CustomMoveType';
5
+ import { getEffectRule } from '../helper/EffectHelper';
6
+ import { Memory } from '../Memory';
7
+ import { EffectRule } from './index';
8
+ export class ConditionalRule extends EffectRule {
9
+ onRuleStart() {
10
+ const condition = this.effect.condition;
11
+ const moves = super.onRuleStart();
70
12
  if (moves.length > 0)
71
13
  return moves;
72
14
  if (this.isDoCondition(condition) && this.effect.mandatory) {
73
- moves.push.apply(moves, __spreadArray([], __read((0, EffectHelper_1.getEffectRule)(this.game, condition.effect).getAutomaticEffectMoves()), false));
15
+ moves.push(...getEffectRule(this.game, condition.effect).getAutomaticEffectMoves());
74
16
  return moves;
75
17
  }
76
18
  if (this.isLeaderCondition(condition) || this.isHaveCreditCondition(condition)) {
@@ -78,93 +20,89 @@ var ConditionalRule = (function (_super) {
78
20
  return this.afterEffectPlayed();
79
21
  }
80
22
  return [];
81
- };
82
- ConditionalRule.prototype.getPlayerMoves = function () {
83
- var condition = this.effect.condition;
23
+ }
24
+ getPlayerMoves() {
25
+ const condition = this.effect.condition;
84
26
  if (this.isDoCondition(condition)) {
85
27
  if (!this.isAutomaticEffect) {
86
- var moves = [];
87
- if (!this.effect.mandatory && !this.remind(Memory_1.Memory.CantPass))
88
- moves.push(this.customMove(CustomMoveType_1.CustomMoveType.Pass));
89
- moves.push.apply(moves, __spreadArray([], __read((0, EffectHelper_1.getEffectRule)(this.game, condition.effect).getPlayerMoves()), false));
28
+ const moves = [];
29
+ if (!this.effect.mandatory && !this.remind(Memory.CantPass))
30
+ moves.push(this.customMove(CustomMoveType.Pass));
31
+ moves.push(...getEffectRule(this.game, condition.effect).getPlayerMoves());
90
32
  return moves;
91
33
  }
92
- return [this.customMove(CustomMoveType_1.CustomMoveType.Pass), this.customMove(CustomMoveType_1.CustomMoveType.DoCondition)];
34
+ return [this.customMove(CustomMoveType.Pass), this.customMove(CustomMoveType.DoCondition)];
93
35
  }
94
36
  return [];
95
- };
96
- ConditionalRule.prototype.onCustomMove = function (move) {
97
- if ((0, rules_api_1.isCustomMoveType)(CustomMoveType_1.CustomMoveType.Pass)(move)) {
37
+ }
38
+ onCustomMove(move) {
39
+ if (isCustomMoveType(CustomMoveType.Pass)(move)) {
98
40
  this.removeFirstEffect();
99
41
  return this.afterEffectPlayed();
100
42
  }
101
- if ((0, rules_api_1.isCustomMoveType)(CustomMoveType_1.CustomMoveType.DoCondition)(move)) {
102
- var condition_1 = this.effect.condition;
103
- if (!this.isDoCondition(condition_1))
43
+ if (isCustomMoveType(CustomMoveType.DoCondition)(move)) {
44
+ const condition = this.effect.condition;
45
+ if (!this.isDoCondition(condition))
104
46
  return [];
105
- var conditionEffect = (0, EffectHelper_1.getEffectRule)(this.game, condition_1.effect);
106
- var extraData = conditionEffect.getExtraDataFromMove(move);
47
+ const conditionEffect = getEffectRule(this.game, condition.effect);
48
+ const extraData = conditionEffect.getExtraDataFromMove(move);
107
49
  this.addEffectAndRemoveCondition(extraData);
108
50
  return this.afterEffectPlayed();
109
51
  }
110
52
  this.onEffectPlayed(move);
111
- var condition = this.effect.condition;
53
+ const condition = this.effect.condition;
112
54
  if (this.isDoCondition(condition)) {
113
- var moves = (0, EffectHelper_1.getEffectRule)(this.game, condition.effect).onCustomMove(move);
114
- moves.push.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
55
+ const moves = getEffectRule(this.game, condition.effect).onCustomMove(move);
56
+ moves.push(...this.afterEffectPlayed());
115
57
  return moves;
116
58
  }
117
59
  return [];
118
- };
119
- ConditionalRule.prototype.afterItemMove = function (move) {
120
- var done = this.onEffectPlayed(move);
60
+ }
61
+ afterItemMove(move) {
62
+ const done = this.onEffectPlayed(move);
121
63
  if (done) {
122
64
  return this.afterEffectPlayed();
123
65
  }
124
66
  return [];
125
- };
126
- ConditionalRule.prototype.onEffectPlayed = function (move) {
127
- var condition = this.effect.condition;
67
+ }
68
+ onEffectPlayed(move) {
69
+ const condition = this.effect.condition;
128
70
  if (this.isDoCondition(condition)) {
129
71
  if (this.isAutomaticEffect)
130
72
  return;
131
- var conditionEffect = (0, EffectHelper_1.getEffectRule)(this.game, condition.effect);
132
- var done = conditionEffect.decrement(move);
73
+ const conditionEffect = getEffectRule(this.game, condition.effect);
74
+ const done = conditionEffect.decrement(move);
133
75
  if (done) {
134
- var extraData = conditionEffect.getExtraDataFromMove(move);
76
+ const extraData = conditionEffect.getExtraDataFromMove(move);
135
77
  this.removeCondition(extraData);
136
78
  }
137
79
  else {
138
- this.memorize(Memory_1.Memory.CantPass, true);
80
+ this.memorize(Memory.CantPass, true);
139
81
  }
140
82
  return done;
141
83
  }
142
84
  return true;
143
- };
144
- Object.defineProperty(ConditionalRule.prototype, "isAutomaticEffect", {
145
- get: function () {
146
- var condition = this.effect.condition;
147
- if (!this.isDoCondition(condition))
148
- return false;
149
- return condition.effect.type === EffectType_1.EffectType.GiveCredit || condition.effect.type === EffectType_1.EffectType.GiveZenithium;
150
- },
151
- enumerable: false,
152
- configurable: true
153
- });
154
- ConditionalRule.prototype.isDoCondition = function (condition) {
155
- return condition.type === Effect_1.ConditionType.DoEffect;
156
- };
157
- ConditionalRule.prototype.isLeaderCondition = function (condition) {
158
- return condition.type === Effect_1.ConditionType.Leader;
159
- };
160
- ConditionalRule.prototype.isHaveCreditCondition = function (condition) {
161
- return condition.type === Effect_1.ConditionType.HaveCredits;
162
- };
163
- ConditionalRule.prototype.isPossible = function () {
164
- var condition = this.effect.condition;
85
+ }
86
+ get isAutomaticEffect() {
87
+ const condition = this.effect.condition;
88
+ if (!this.isDoCondition(condition))
89
+ return false;
90
+ return condition.effect.type === EffectType.GiveCredit || condition.effect.type === EffectType.GiveZenithium;
91
+ }
92
+ isDoCondition(condition) {
93
+ return condition.type === ConditionType.DoEffect;
94
+ }
95
+ isLeaderCondition(condition) {
96
+ return condition.type === ConditionType.Leader;
97
+ }
98
+ isHaveCreditCondition(condition) {
99
+ return condition.type === ConditionType.HaveCredits;
100
+ }
101
+ isPossible() {
102
+ const condition = this.effect.condition;
165
103
  if (this.isDoCondition(condition)) {
166
- var conditionEffect = (0, EffectHelper_1.getEffectRule)(this.game, condition.effect);
167
- return conditionEffect.isPossible() && (0, EffectHelper_1.getEffectRule)(this.game, this.effect.effect).isPossible();
104
+ const conditionEffect = getEffectRule(this.game, condition.effect);
105
+ return conditionEffect.isPossible() && getEffectRule(this.game, this.effect.effect).isPossible();
168
106
  }
169
107
  if (this.isLeaderCondition(condition)) {
170
108
  return this.playerHelper.isLeader;
@@ -173,25 +111,24 @@ var ConditionalRule = (function (_super) {
173
111
  return this.playerHelper.credits >= condition.min;
174
112
  }
175
113
  return false;
176
- };
177
- ConditionalRule.prototype.addEffectAndRemoveCondition = function (extraData) {
178
- var _this = this;
179
- this.memorize(Memory_1.Memory.Effects, function (effects) {
180
- var firstEffect = effects[0];
181
- var condition = firstEffect.condition, effect = firstEffect.effect;
114
+ }
115
+ addEffectAndRemoveCondition(extraData) {
116
+ this.memorize(Memory.Effects, (effects) => {
117
+ const firstEffect = effects[0];
118
+ const { condition, effect } = firstEffect;
182
119
  if (extraData) {
183
- (0, EffectHelper_1.getEffectRule)(_this.game, effect).setExtraData(extraData);
120
+ getEffectRule(this.game, effect).setExtraData(extraData);
184
121
  }
185
- return __spreadArray([
186
- __assign(__assign({}, condition.effect), { effectSource: firstEffect.effectSource }),
187
- __assign(__assign({}, effect), { effectSource: firstEffect.effectSource })
188
- ], __read(effects.slice(1)), false);
122
+ return [
123
+ { ...condition.effect, effectSource: firstEffect.effectSource },
124
+ { ...effect, effectSource: firstEffect.effectSource },
125
+ ...effects.slice(1)
126
+ ];
189
127
  });
190
- };
191
- ConditionalRule.prototype.onRuleEnd = function () {
192
- this.forget(Memory_1.Memory.CantPass);
128
+ }
129
+ onRuleEnd() {
130
+ this.forget(Memory.CantPass);
193
131
  return [];
194
- };
195
- return ConditionalRule;
196
- }(index_1.EffectRule));
197
- exports.ConditionalRule = ConditionalRule;
132
+ }
133
+ }
134
+ //# sourceMappingURL=ConditionalRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConditionalRule.js","sourceRoot":"","sources":["../../../src/rules/effect/ConditionalRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,gBAAgB,EAA0B,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EAGL,aAAa,EAKd,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,MAAM,OAAO,eAAgB,SAAQ,UAA6B;IAChE,WAAW;QACT,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,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AAE,CAAC;gBACd,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAA;YAC1D,CAAC;YAED,OAAO;gBACL,EAAE,GAAI,SAA+B,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,YAAY,EAAE;gBACtF,EAAE,GAAG,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,YAAY,EAAE;gBACrD,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;aACpB,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,SAAS;QACP,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAC5B,OAAO,EAAE,CAAA;IACX,CAAC;CACF"}
@@ -9,3 +9,4 @@ export declare class DevelopTechnologyRule extends EffectRule<DevelopTechnologyE
9
9
  isPossible(): boolean;
10
10
  get technologyTokens(): import("@gamepark/rules-api").Material<number, number, number>;
11
11
  }
12
+ //# sourceMappingURL=DevelopTechnologyRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevelopTechnologyRule.d.ts","sourceRoot":"","sources":["../../../src/rules/effect/DevelopTechnologyRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoC,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAC1G,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AAKtE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,qBAAa,qBAAsB,SAAQ,UAAU,CAAC,uBAAuB,CAAC;IAC5E,cAAc;IAUd,aAAa,CAAC,IAAI,EAAE,QAAQ;IAe5B,YAAY,CAAC,IAAI,EAAE,UAAU;IAM7B,IAAI,YAAY,mEAoBf;IAED,UAAU;IAIV,IAAI,gBAAgB,mEAKnB;CACF"}
@@ -1,133 +1,68 @@
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.DevelopTechnologyRule = void 0;
55
- var rules_api_1 = require("@gamepark/rules-api");
56
- var LocationType_1 = require("../../material/LocationType");
57
- var MaterialType_1 = require("../../material/MaterialType");
58
- var CustomMoveType_1 = require("../CustomMoveType");
59
- var TechnologyHelper_1 = require("../helper/TechnologyHelper");
60
- var index_1 = require("./index");
61
- var DevelopTechnologyRule = (function (_super) {
62
- __extends(DevelopTechnologyRule, _super);
63
- function DevelopTechnologyRule() {
64
- return _super !== null && _super.apply(this, arguments) || this;
1
+ import { isCustomMoveType, isMoveItemType } from '@gamepark/rules-api';
2
+ import { LocationType } from '../../material/LocationType';
3
+ import { MaterialType } from '../../material/MaterialType';
4
+ import { CustomMoveType } from '../CustomMoveType';
5
+ import { TechnologyHelper } from '../helper/TechnologyHelper';
6
+ import { EffectRule } from './index';
7
+ export class DevelopTechnologyRule extends EffectRule {
8
+ getPlayerMoves() {
9
+ return [
10
+ ...this.technologies.moveItems((item) => ({
11
+ ...item.location,
12
+ x: item.location.x + 1
13
+ })),
14
+ this.customMove(CustomMoveType.Pass)
15
+ ];
65
16
  }
66
- DevelopTechnologyRule.prototype.getPlayerMoves = function () {
67
- return __spreadArray(__spreadArray([], __read(this.technologies.moveItems(function (item) { return (__assign(__assign({}, item.location), { x: item.location.x + 1 })); })), false), [
68
- this.customMove(CustomMoveType_1.CustomMoveType.Pass)
69
- ], false);
70
- };
71
- DevelopTechnologyRule.prototype.afterItemMove = function (move) {
72
- var _a;
73
- if (!(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.TechMarker)(move))
17
+ afterItemMove(move) {
18
+ if (!isMoveItemType(MaterialType.TechMarker)(move))
74
19
  return [];
75
- var moves = [];
20
+ const moves = [];
76
21
  if (!this.effect.free) {
77
- var cost = move.location.x - ((_a = this.effect.discount) !== null && _a !== void 0 ? _a : 0);
22
+ const cost = move.location.x - (this.effect.discount ?? 0);
78
23
  if (cost) {
79
24
  moves.push(this.playerHelper.zenithiumMaterial.deleteItem(cost));
80
25
  }
81
26
  }
82
- moves.push.apply(moves, __spreadArray([], __read(new TechnologyHelper_1.TechnologyHelper(this.game).applyTechnology(move)), false));
27
+ moves.push(...new TechnologyHelper(this.game).applyTechnology(move));
83
28
  this.removeFirstEffect();
84
- moves.push.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
29
+ moves.push(...this.afterEffectPlayed());
85
30
  return moves;
86
- };
87
- DevelopTechnologyRule.prototype.onCustomMove = function (move) {
88
- if (!(0, rules_api_1.isCustomMoveType)(CustomMoveType_1.CustomMoveType.Pass)(move))
31
+ }
32
+ onCustomMove(move) {
33
+ if (!isCustomMoveType(CustomMoveType.Pass)(move))
89
34
  return [];
90
35
  this.removeFirstEffect();
91
36
  return this.afterEffectPlayed();
92
- };
93
- Object.defineProperty(DevelopTechnologyRule.prototype, "technologies", {
94
- get: function () {
95
- var _this = this;
96
- var zenithium = this.playerHelper.zenithium;
97
- var techBoard = this.material(MaterialType_1.MaterialType.TechnologyBoard)
98
- .locationId(function (id) { var _a; return id === ((_a = _this.effect.faction) !== null && _a !== void 0 ? _a : id); })
99
- .getIndexes();
100
- var tokens = this.technologyTokens.parent(function (p) { return techBoard.includes(p); });
101
- if (!tokens.length)
102
- return tokens;
103
- if (this.effect.free && this.effect.lowest) {
104
- var lowestX_1 = tokens.minBy(function (item) { return item.location.x; }).getItem().location.x;
105
- return tokens.filter(function (item) { return item.location.x === lowestX_1; });
106
- }
107
- var discount = this.effect.discount;
108
- if (discount !== undefined) {
109
- return tokens.filter(function (item) {
110
- return item.location.x + 1 - discount <= zenithium;
111
- });
112
- }
37
+ }
38
+ get technologies() {
39
+ const zenithium = this.playerHelper.zenithium;
40
+ const techBoard = this.material(MaterialType.TechnologyBoard)
41
+ .locationId((id) => id === (this.effect.faction ?? id))
42
+ .getIndexes();
43
+ const tokens = this.technologyTokens.parent((p) => techBoard.includes(p));
44
+ if (!tokens.length)
113
45
  return tokens;
114
- },
115
- enumerable: false,
116
- configurable: true
117
- });
118
- DevelopTechnologyRule.prototype.isPossible = function () {
46
+ if (this.effect.free && this.effect.lowest) {
47
+ const lowestX = tokens.minBy((item) => item.location.x).getItem().location.x;
48
+ return tokens.filter((item) => item.location.x === lowestX);
49
+ }
50
+ const discount = this.effect.discount;
51
+ if (discount !== undefined) {
52
+ return tokens.filter((item) => {
53
+ return item.location.x + 1 - discount <= zenithium;
54
+ });
55
+ }
56
+ return tokens;
57
+ }
58
+ isPossible() {
119
59
  return this.technologies.length > 0;
120
- };
121
- Object.defineProperty(DevelopTechnologyRule.prototype, "technologyTokens", {
122
- get: function () {
123
- return this.material(MaterialType_1.MaterialType.TechMarker)
124
- .location(LocationType_1.LocationType.TechnologyBoardTokenSpace)
125
- .player(this.playerHelper.team)
126
- .location(function (l) { return l.x < 5; });
127
- },
128
- enumerable: false,
129
- configurable: true
130
- });
131
- return DevelopTechnologyRule;
132
- }(index_1.EffectRule));
133
- exports.DevelopTechnologyRule = DevelopTechnologyRule;
60
+ }
61
+ get technologyTokens() {
62
+ return this.material(MaterialType.TechMarker)
63
+ .location(LocationType.TechnologyBoardTokenSpace)
64
+ .player(this.playerHelper.team)
65
+ .location((l) => l.x < 5);
66
+ }
67
+ }
68
+ //# sourceMappingURL=DevelopTechnologyRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevelopTechnologyRule.js","sourceRoot":"","sources":["../../../src/rules/effect/DevelopTechnologyRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,gBAAgB,EAAE,cAAc,EAA0B,MAAM,qBAAqB,CAAA;AAE1G,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,MAAM,OAAO,qBAAsB,SAAQ,UAAmC;IAC5E,cAAc;QACZ,OAAO;YACL,GAAG,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,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,CAAC,CAAA;IACrC,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC;aAC1C,QAAQ,CAAC,YAAY,CAAC,yBAAyB,CAAC;aAChD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;aAC9B,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAE,GAAG,CAAC,CAAC,CAAA;IAC9B,CAAC;CACF"}
@@ -16,3 +16,4 @@ export declare class DiscardRule extends EffectRule<DiscardEffect> {
16
16
  get hand(): import("@gamepark/rules-api").Material<number, number, number>;
17
17
  onRuleEnd(): never[];
18
18
  }
19
+ //# sourceMappingURL=DiscardRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiscardRule.d.ts","sourceRoot":"","sources":["../../../src/rules/effect/DiscardRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAG5E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAI5D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,qBAAa,WAAY,SAAQ,UAAU,CAAC,aAAa,CAAC;IACxD,WAAW;IAoBX,cAAc;IAWd,oBAAoB,CAAC,IAAI,EAAE,QAAQ;;;;;;;IAUnC,aAAa,CAAC,IAAI,EAAE,QAAQ;IAM5B,UAAU,IAAI,OAAO;IAIrB,IAAI,IAAI,mEAEP;IAED,SAAS;CAIV"}