@gamepark/mythologies 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/dist/CustomMoveType.d.ts +13 -0
  2. package/dist/CustomMoveType.js +13 -0
  3. package/dist/Memory.d.ts +13 -0
  4. package/dist/Memory.js +17 -0
  5. package/dist/MythologiesOptions.d.ts +12 -0
  6. package/dist/MythologiesOptions.js +14 -0
  7. package/dist/MythologiesRules.d.ts +111 -0
  8. package/dist/MythologiesRules.js +218 -0
  9. package/dist/MythologiesSetup.d.ts +17 -0
  10. package/dist/MythologiesSetup.js +161 -0
  11. package/dist/PlayerColor.d.ts +10 -0
  12. package/dist/PlayerColor.js +10 -0
  13. package/dist/index.d.ts +3 -0
  14. package/dist/index.js +9 -0
  15. package/dist/material/Destiny.d.ts +9 -0
  16. package/dist/material/Destiny.js +87 -0
  17. package/dist/material/Entity.d.ts +98 -0
  18. package/dist/material/Entity.js +99 -0
  19. package/dist/material/LocationType.d.ts +26 -0
  20. package/dist/material/LocationType.js +31 -0
  21. package/dist/material/MaterialType.d.ts +12 -0
  22. package/dist/material/MaterialType.js +16 -0
  23. package/dist/material/Mythology.d.ts +19 -0
  24. package/dist/material/Mythology.js +21 -0
  25. package/dist/material/Pantheon.d.ts +36 -0
  26. package/dist/material/Pantheon.js +357 -0
  27. package/dist/material/Trial.d.ts +22 -0
  28. package/dist/material/Trial.js +184 -0
  29. package/dist/material/entity/Effect.d.ts +91 -0
  30. package/dist/material/entity/Effect.js +115 -0
  31. package/dist/material/entity/EntityDescription.d.ts +13 -0
  32. package/dist/material/entity/EntityDescription.js +173 -0
  33. package/dist/material/entity/MoveEffectRule.d.ts +15 -0
  34. package/dist/material/entity/MoveEffectRule.js +86 -0
  35. package/dist/material/entity/PlaceCardEffectRule.d.ts +15 -0
  36. package/dist/material/entity/PlaceCardEffectRule.js +75 -0
  37. package/dist/material/entity/SacrificeEffectRule.d.ts +9 -0
  38. package/dist/material/entity/SacrificeEffectRule.js +58 -0
  39. package/dist/material/entity/SimultaneousMoveEffectRule.d.ts +13 -0
  40. package/dist/material/entity/SimultaneousMoveEffectRule.js +124 -0
  41. package/dist/material/entity/SimultaneousSacrificeEffectRule.d.ts +10 -0
  42. package/dist/material/entity/SimultaneousSacrificeEffectRule.js +57 -0
  43. package/dist/material/entity/celtic/Banshee.d.ts +2 -0
  44. package/dist/material/entity/celtic/Banshee.js +6 -0
  45. package/dist/material/entity/celtic/Brigid.d.ts +2 -0
  46. package/dist/material/entity/celtic/Brigid.js +6 -0
  47. package/dist/material/entity/celtic/Cernunnos.d.ts +2 -0
  48. package/dist/material/entity/celtic/Cernunnos.js +6 -0
  49. package/dist/material/entity/celtic/Dagda.d.ts +2 -0
  50. package/dist/material/entity/celtic/Dagda.js +6 -0
  51. package/dist/material/entity/celtic/Dryad.d.ts +2 -0
  52. package/dist/material/entity/celtic/Dryad.js +6 -0
  53. package/dist/material/entity/celtic/Dullahan.d.ts +2 -0
  54. package/dist/material/entity/celtic/Dullahan.js +6 -0
  55. package/dist/material/entity/celtic/Kelpie.d.ts +2 -0
  56. package/dist/material/entity/celtic/Kelpie.js +6 -0
  57. package/dist/material/entity/celtic/Leprechaun.d.ts +2 -0
  58. package/dist/material/entity/celtic/Leprechaun.js +6 -0
  59. package/dist/material/entity/celtic/Morrigan.d.ts +2 -0
  60. package/dist/material/entity/celtic/Morrigan.js +6 -0
  61. package/dist/material/entity/celtic/Selkie.d.ts +2 -0
  62. package/dist/material/entity/celtic/Selkie.js +6 -0
  63. package/dist/material/entity/chinese/ChangE.d.ts +2 -0
  64. package/dist/material/entity/chinese/ChangE.js +6 -0
  65. package/dist/material/entity/chinese/Fenghuang.d.ts +2 -0
  66. package/dist/material/entity/chinese/Fenghuang.js +6 -0
  67. package/dist/material/entity/chinese/Jiangshi.d.ts +2 -0
  68. package/dist/material/entity/chinese/Jiangshi.js +6 -0
  69. package/dist/material/entity/chinese/Mogwai.d.ts +2 -0
  70. package/dist/material/entity/chinese/Mogwai.js +6 -0
  71. package/dist/material/entity/chinese/Nian.d.ts +2 -0
  72. package/dist/material/entity/chinese/Nian.js +6 -0
  73. package/dist/material/entity/chinese/Nuwa.d.ts +2 -0
  74. package/dist/material/entity/chinese/Nuwa.js +6 -0
  75. package/dist/material/entity/chinese/Qilin.d.ts +2 -0
  76. package/dist/material/entity/chinese/Qilin.js +6 -0
  77. package/dist/material/entity/chinese/SunWukong.d.ts +2 -0
  78. package/dist/material/entity/chinese/SunWukong.js +6 -0
  79. package/dist/material/entity/chinese/Tianlong.d.ts +2 -0
  80. package/dist/material/entity/chinese/Tianlong.js +6 -0
  81. package/dist/material/entity/chinese/YanluoWang.d.ts +2 -0
  82. package/dist/material/entity/chinese/YanluoWang.js +6 -0
  83. package/dist/material/entity/egyptian/Anubis.d.ts +2 -0
  84. package/dist/material/entity/egyptian/Anubis.js +12 -0
  85. package/dist/material/entity/egyptian/Babai.d.ts +2 -0
  86. package/dist/material/entity/egyptian/Babai.js +12 -0
  87. package/dist/material/entity/egyptian/Beetle.d.ts +2 -0
  88. package/dist/material/entity/egyptian/Beetle.js +36 -0
  89. package/dist/material/entity/egyptian/Bennu.d.ts +2 -0
  90. package/dist/material/entity/egyptian/Bennu.js +12 -0
  91. package/dist/material/entity/egyptian/Cobra.d.ts +2 -0
  92. package/dist/material/entity/egyptian/Cobra.js +12 -0
  93. package/dist/material/entity/egyptian/Isis.d.ts +2 -0
  94. package/dist/material/entity/egyptian/Isis.js +39 -0
  95. package/dist/material/entity/egyptian/Mummy.d.ts +2 -0
  96. package/dist/material/entity/egyptian/Mummy.js +39 -0
  97. package/dist/material/entity/egyptian/Osiris.d.ts +2 -0
  98. package/dist/material/entity/egyptian/Osiris.js +71 -0
  99. package/dist/material/entity/egyptian/Ra.d.ts +2 -0
  100. package/dist/material/entity/egyptian/Ra.js +12 -0
  101. package/dist/material/entity/egyptian/Sphinx.d.ts +2 -0
  102. package/dist/material/entity/egyptian/Sphinx.js +12 -0
  103. package/dist/material/entity/greek/Athena.d.ts +2 -0
  104. package/dist/material/entity/greek/Athena.js +12 -0
  105. package/dist/material/entity/greek/Centaur.d.ts +2 -0
  106. package/dist/material/entity/greek/Centaur.js +12 -0
  107. package/dist/material/entity/greek/Chimera.d.ts +2 -0
  108. package/dist/material/entity/greek/Chimera.js +12 -0
  109. package/dist/material/entity/greek/Cyclops.d.ts +2 -0
  110. package/dist/material/entity/greek/Cyclops.js +21 -0
  111. package/dist/material/entity/greek/Gorgon.d.ts +2 -0
  112. package/dist/material/entity/greek/Gorgon.js +12 -0
  113. package/dist/material/entity/greek/Griffin.d.ts +2 -0
  114. package/dist/material/entity/greek/Griffin.js +12 -0
  115. package/dist/material/entity/greek/Hades.d.ts +2 -0
  116. package/dist/material/entity/greek/Hades.js +12 -0
  117. package/dist/material/entity/greek/Minotaur.d.ts +2 -0
  118. package/dist/material/entity/greek/Minotaur.js +12 -0
  119. package/dist/material/entity/greek/Poseidon.d.ts +2 -0
  120. package/dist/material/entity/greek/Poseidon.js +44 -0
  121. package/dist/material/entity/greek/Zeus.d.ts +2 -0
  122. package/dist/material/entity/greek/Zeus.js +39 -0
  123. package/dist/material/entity/hindu/Asura.d.ts +2 -0
  124. package/dist/material/entity/hindu/Asura.js +66 -0
  125. package/dist/material/entity/hindu/Brahma.d.ts +2 -0
  126. package/dist/material/entity/hindu/Brahma.js +36 -0
  127. package/dist/material/entity/hindu/Ganesh.d.ts +2 -0
  128. package/dist/material/entity/hindu/Ganesh.js +44 -0
  129. package/dist/material/entity/hindu/Garuda.d.ts +2 -0
  130. package/dist/material/entity/hindu/Garuda.js +12 -0
  131. package/dist/material/entity/hindu/Kinnara.d.ts +2 -0
  132. package/dist/material/entity/hindu/Kinnara.js +12 -0
  133. package/dist/material/entity/hindu/Naga.d.ts +2 -0
  134. package/dist/material/entity/hindu/Naga.js +68 -0
  135. package/dist/material/entity/hindu/Rakshasa.d.ts +2 -0
  136. package/dist/material/entity/hindu/Rakshasa.js +12 -0
  137. package/dist/material/entity/hindu/Shiva.d.ts +2 -0
  138. package/dist/material/entity/hindu/Shiva.js +12 -0
  139. package/dist/material/entity/hindu/Vetala.d.ts +2 -0
  140. package/dist/material/entity/hindu/Vetala.js +12 -0
  141. package/dist/material/entity/hindu/Vishnu.d.ts +2 -0
  142. package/dist/material/entity/hindu/Vishnu.js +71 -0
  143. package/dist/material/entity/inca/Amaru.d.ts +2 -0
  144. package/dist/material/entity/inca/Amaru.js +6 -0
  145. package/dist/material/entity/inca/Caiman.d.ts +2 -0
  146. package/dist/material/entity/inca/Caiman.js +6 -0
  147. package/dist/material/entity/inca/Condor.d.ts +2 -0
  148. package/dist/material/entity/inca/Condor.js +6 -0
  149. package/dist/material/entity/inca/Illapa.d.ts +2 -0
  150. package/dist/material/entity/inca/Illapa.js +6 -0
  151. package/dist/material/entity/inca/Inti.d.ts +2 -0
  152. package/dist/material/entity/inca/Inti.js +6 -0
  153. package/dist/material/entity/inca/MamaQucha.d.ts +2 -0
  154. package/dist/material/entity/inca/MamaQucha.js +6 -0
  155. package/dist/material/entity/inca/Pumapunku.d.ts +2 -0
  156. package/dist/material/entity/inca/Pumapunku.js +6 -0
  157. package/dist/material/entity/inca/Supay.d.ts +2 -0
  158. package/dist/material/entity/inca/Supay.js +6 -0
  159. package/dist/material/entity/inca/Ukuku.d.ts +2 -0
  160. package/dist/material/entity/inca/Ukuku.js +6 -0
  161. package/dist/material/entity/inca/Viracocha.d.ts +2 -0
  162. package/dist/material/entity/inca/Viracocha.js +6 -0
  163. package/dist/material/entity/norse/Alf.d.ts +2 -0
  164. package/dist/material/entity/norse/Alf.js +12 -0
  165. package/dist/material/entity/norse/Draugr.d.ts +2 -0
  166. package/dist/material/entity/norse/Draugr.js +12 -0
  167. package/dist/material/entity/norse/Fenrir.d.ts +2 -0
  168. package/dist/material/entity/norse/Fenrir.js +12 -0
  169. package/dist/material/entity/norse/Freya.d.ts +2 -0
  170. package/dist/material/entity/norse/Freya.js +39 -0
  171. package/dist/material/entity/norse/Jotunn.d.ts +2 -0
  172. package/dist/material/entity/norse/Jotunn.js +36 -0
  173. package/dist/material/entity/norse/Loki.d.ts +2 -0
  174. package/dist/material/entity/norse/Loki.js +36 -0
  175. package/dist/material/entity/norse/Odin.d.ts +2 -0
  176. package/dist/material/entity/norse/Odin.js +6 -0
  177. package/dist/material/entity/norse/Thor.d.ts +2 -0
  178. package/dist/material/entity/norse/Thor.js +12 -0
  179. package/dist/material/entity/norse/Troll.d.ts +2 -0
  180. package/dist/material/entity/norse/Troll.js +6 -0
  181. package/dist/material/entity/norse/Valkyrie.d.ts +2 -0
  182. package/dist/material/entity/norse/Valkyrie.js +72 -0
  183. package/dist/material/entity/zulu/Idlozi.d.ts +2 -0
  184. package/dist/material/entity/zulu/Idlozi.js +6 -0
  185. package/dist/material/entity/zulu/Impundulu.d.ts +2 -0
  186. package/dist/material/entity/zulu/Impundulu.js +6 -0
  187. package/dist/material/entity/zulu/Inkanyamba.d.ts +2 -0
  188. package/dist/material/entity/zulu/Inkanyamba.js +6 -0
  189. package/dist/material/entity/zulu/Inkosazana.d.ts +2 -0
  190. package/dist/material/entity/zulu/Inkosazana.js +6 -0
  191. package/dist/material/entity/zulu/Shembe.d.ts +2 -0
  192. package/dist/material/entity/zulu/Shembe.js +6 -0
  193. package/dist/material/entity/zulu/Tokoloshe.d.ts +2 -0
  194. package/dist/material/entity/zulu/Tokoloshe.js +6 -0
  195. package/dist/material/entity/zulu/Umvelinqangi.d.ts +2 -0
  196. package/dist/material/entity/zulu/Umvelinqangi.js +6 -0
  197. package/dist/material/entity/zulu/Unkulunkulu.d.ts +2 -0
  198. package/dist/material/entity/zulu/Unkulunkulu.js +6 -0
  199. package/dist/material/entity/zulu/Unwabu.d.ts +2 -0
  200. package/dist/material/entity/zulu/Unwabu.js +6 -0
  201. package/dist/material/entity/zulu/Werehyena.d.ts +2 -0
  202. package/dist/material/entity/zulu/Werehyena.js +6 -0
  203. package/dist/rules/ChooseDraftTokenRule.d.ts +15 -0
  204. package/dist/rules/ChooseDraftTokenRule.js +103 -0
  205. package/dist/rules/DrawDestinyCardRule.d.ts +7 -0
  206. package/dist/rules/DrawDestinyCardRule.js +116 -0
  207. package/dist/rules/EndGameRule.d.ts +5 -0
  208. package/dist/rules/EndGameRule.js +44 -0
  209. package/dist/rules/PlaceCardsRule.d.ts +13 -0
  210. package/dist/rules/PlaceCardsRule.js +192 -0
  211. package/dist/rules/PlaceTokenRule.d.ts +13 -0
  212. package/dist/rules/PlaceTokenRule.js +139 -0
  213. package/dist/rules/RuleId.d.ts +36 -0
  214. package/dist/rules/RuleId.js +40 -0
  215. package/dist/rules/UpkeepRule.d.ts +9 -0
  216. package/dist/rules/UpkeepRule.js +140 -0
  217. package/dist/rules/effects/AlfEffectRule.d.ts +10 -0
  218. package/dist/rules/effects/AlfEffectRule.js +59 -0
  219. package/dist/rules/effects/AnubisEffectRule.d.ts +9 -0
  220. package/dist/rules/effects/AnubisEffectRule.js +49 -0
  221. package/dist/rules/effects/AthenaEffectRule.d.ts +9 -0
  222. package/dist/rules/effects/AthenaEffectRule.js +104 -0
  223. package/dist/rules/effects/BabaiEffectRule.d.ts +6 -0
  224. package/dist/rules/effects/BabaiEffectRule.js +40 -0
  225. package/dist/rules/effects/BennuEffectRule.d.ts +6 -0
  226. package/dist/rules/effects/BennuEffectRule.js +35 -0
  227. package/dist/rules/effects/CentaurEffectRule.d.ts +15 -0
  228. package/dist/rules/effects/CentaurEffectRule.js +77 -0
  229. package/dist/rules/effects/ChimeraEffectRule.d.ts +8 -0
  230. package/dist/rules/effects/ChimeraEffectRule.js +51 -0
  231. package/dist/rules/effects/CobraEffectRule.d.ts +12 -0
  232. package/dist/rules/effects/CobraEffectRule.js +55 -0
  233. package/dist/rules/effects/CyclopsEffectRule.d.ts +8 -0
  234. package/dist/rules/effects/CyclopsEffectRule.js +87 -0
  235. package/dist/rules/effects/DraugrEffectRule.d.ts +11 -0
  236. package/dist/rules/effects/DraugrEffectRule.js +56 -0
  237. package/dist/rules/effects/FenrirEffectRule.d.ts +15 -0
  238. package/dist/rules/effects/FenrirEffectRule.js +132 -0
  239. package/dist/rules/effects/GarudaEffectRule.d.ts +9 -0
  240. package/dist/rules/effects/GarudaEffectRule.js +84 -0
  241. package/dist/rules/effects/GorgonEffectRule.d.ts +11 -0
  242. package/dist/rules/effects/GorgonEffectRule.js +78 -0
  243. package/dist/rules/effects/GriffinEffectRule.d.ts +9 -0
  244. package/dist/rules/effects/GriffinEffectRule.js +41 -0
  245. package/dist/rules/effects/HadesEffectRule.d.ts +5 -0
  246. package/dist/rules/effects/HadesEffectRule.js +87 -0
  247. package/dist/rules/effects/KinnaraEffectRule.d.ts +12 -0
  248. package/dist/rules/effects/KinnaraEffectRule.js +84 -0
  249. package/dist/rules/effects/MinotaurEffectRule.d.ts +9 -0
  250. package/dist/rules/effects/MinotaurEffectRule.js +39 -0
  251. package/dist/rules/effects/OdinEffectRule.d.ts +11 -0
  252. package/dist/rules/effects/OdinEffectRule.js +52 -0
  253. package/dist/rules/effects/RaEffectRule.d.ts +5 -0
  254. package/dist/rules/effects/RaEffectRule.js +87 -0
  255. package/dist/rules/effects/RakshasaEffectRule.d.ts +13 -0
  256. package/dist/rules/effects/RakshasaEffectRule.js +48 -0
  257. package/dist/rules/effects/ResolveEffectsRule.d.ts +6 -0
  258. package/dist/rules/effects/ResolveEffectsRule.js +73 -0
  259. package/dist/rules/effects/ShivaEffectRule.d.ts +10 -0
  260. package/dist/rules/effects/ShivaEffectRule.js +82 -0
  261. package/dist/rules/effects/SphinxEffectRule.d.ts +9 -0
  262. package/dist/rules/effects/SphinxEffectRule.js +47 -0
  263. package/dist/rules/effects/ThorEffectRule.d.ts +11 -0
  264. package/dist/rules/effects/ThorEffectRule.js +56 -0
  265. package/dist/rules/effects/TriggerEffectsRule.d.ts +11 -0
  266. package/dist/rules/effects/TriggerEffectsRule.js +159 -0
  267. package/dist/rules/effects/VetalaEffectRule.d.ts +11 -0
  268. package/dist/rules/effects/VetalaEffectRule.js +59 -0
  269. package/package.json +33 -0
@@ -0,0 +1,357 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.Pantheon = void 0;
55
+ var rules_api_1 = require("@gamepark/rules-api");
56
+ var lodash_1 = require("lodash");
57
+ var MythologiesRules_1 = require("../MythologiesRules");
58
+ var TriggerEffectsRule_1 = require("../rules/effects/TriggerEffectsRule");
59
+ var Entity_1 = require("./Entity");
60
+ var Effect_1 = require("./entity/Effect");
61
+ var EntityDescription_1 = require("./entity/EntityDescription");
62
+ var LocationType_1 = require("./LocationType");
63
+ var MaterialType_1 = require("./MaterialType");
64
+ var Pantheon = (function (_super) {
65
+ __extends(Pantheon, _super);
66
+ function Pantheon(game, player) {
67
+ var _this = _super.call(this, game) || this;
68
+ _this.player = player;
69
+ return _this;
70
+ }
71
+ Object.defineProperty(Pantheon.prototype, "allCards", {
72
+ get: function () {
73
+ return this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.Pantheon).player(this.player);
74
+ },
75
+ enumerable: false,
76
+ configurable: true
77
+ });
78
+ Object.defineProperty(Pantheon.prototype, "visibleEntities", {
79
+ get: function () {
80
+ var allCards = this.allCards;
81
+ return allCards.location(function (_a) {
82
+ var x = _a.x, y = _a.y, z = _a.z;
83
+ return z === allCards.location(function (l) { return l.x === x && l.y === y; }).length - 1;
84
+ });
85
+ },
86
+ enumerable: false,
87
+ configurable: true
88
+ });
89
+ Object.defineProperty(Pantheon.prototype, "coveredEntities", {
90
+ get: function () {
91
+ var allCards = this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.Pantheon).player(this.player);
92
+ return allCards.location(function (_a) {
93
+ var x = _a.x, y = _a.y, z = _a.z;
94
+ return z < allCards.location(function (l) { return l.x === x && l.y === y; }).length;
95
+ });
96
+ },
97
+ enumerable: false,
98
+ configurable: true
99
+ });
100
+ Object.defineProperty(Pantheon.prototype, "grid", {
101
+ get: function () {
102
+ var visibleEntities = this.visibleEntities;
103
+ return (0, lodash_1.range)(0, 3).map(function (y) { return (0, lodash_1.range)(0, 3).map(function (x) { var _a; return (_a = visibleEntities.location(function (l) { return l.x === x && l.y === y; }).getItem()) === null || _a === void 0 ? void 0 : _a.id.front; }); });
104
+ },
105
+ enumerable: false,
106
+ configurable: true
107
+ });
108
+ Object.defineProperty(Pantheon.prototype, "legalSpacesToInvoke", {
109
+ get: function () {
110
+ var _this = this;
111
+ return this.legalSpaces.filter(function (space) { return _this.isLegalSpaceToInvoke(space); });
112
+ },
113
+ enumerable: false,
114
+ configurable: true
115
+ });
116
+ Pantheon.prototype.isLegalSpaceToInvoke = function (space) {
117
+ var trollOpponents = this.getOpponentsWithTrollAt(space);
118
+ return !trollOpponents.length || this.favor >= trollOpponents.length;
119
+ };
120
+ Pantheon.prototype.getOpponentsWithTrollAt = function (_a) {
121
+ var _this = this;
122
+ var x = _a.x, y = _a.y;
123
+ return this.game.players.filter(function (player) {
124
+ if (player === _this.player)
125
+ return false;
126
+ return new Pantheon(_this.game, player).grid[y][x] === Entity_1.Entity.Troll;
127
+ });
128
+ };
129
+ Object.defineProperty(Pantheon.prototype, "legalSpaces", {
130
+ get: function () {
131
+ var _this = this;
132
+ var grid = this.grid;
133
+ return (0, lodash_1.range)(0, 3)
134
+ .flatMap(function (y) { return (0, lodash_1.range)(0, 3).map(function (x) { return ({ x: x, y: y }); }); })
135
+ .filter(function (space) { return _this.isLegalSpace(space, grid); });
136
+ },
137
+ enumerable: false,
138
+ configurable: true
139
+ });
140
+ Pantheon.prototype.isLegalSpace = function (_a, grid) {
141
+ var x = _a.x, y = _a.y;
142
+ if (grid === void 0) { grid = this.grid; }
143
+ return !(0, Entity_1.isGod)(grid[y][x]);
144
+ };
145
+ Pantheon.prototype.isFreeSpace = function (_a) {
146
+ var x = _a.x, y = _a.y;
147
+ return this.allCards.location(function (l) { return l.x === x && l.y === y; }).length === 0;
148
+ };
149
+ Pantheon.prototype.gainGems = function (quantity) {
150
+ return this.material(MaterialType_1.MaterialType.GemToken).createItem({ location: { type: LocationType_1.LocationType.PlayerGems, player: this.player }, quantity: quantity });
151
+ };
152
+ Object.defineProperty(Pantheon.prototype, "gemMaterial", {
153
+ get: function () {
154
+ return this.material(MaterialType_1.MaterialType.GemToken).location(LocationType_1.LocationType.PlayerGems).player(this.player);
155
+ },
156
+ enumerable: false,
157
+ configurable: true
158
+ });
159
+ Object.defineProperty(Pantheon.prototype, "gems", {
160
+ get: function () {
161
+ return this.gemMaterial.getQuantity();
162
+ },
163
+ enumerable: false,
164
+ configurable: true
165
+ });
166
+ Pantheon.prototype.spendGems = function (quantity) {
167
+ return this.gemMaterial.deleteItem(quantity);
168
+ };
169
+ Pantheon.prototype.gainFavor = function (quantity) {
170
+ return this.material(MaterialType_1.MaterialType.FavorToken).createItem({ location: { type: LocationType_1.LocationType.PlayerFavor, player: this.player }, quantity: quantity });
171
+ };
172
+ Object.defineProperty(Pantheon.prototype, "favor", {
173
+ get: function () {
174
+ return this.material(MaterialType_1.MaterialType.FavorToken).location(LocationType_1.LocationType.PlayerFavor).player(this.player).getQuantity();
175
+ },
176
+ enumerable: false,
177
+ configurable: true
178
+ });
179
+ Pantheon.prototype.loseFavor = function (quantity) {
180
+ if (quantity === void 0) { quantity = 1; }
181
+ return this.material(MaterialType_1.MaterialType.FavorToken).location(LocationType_1.LocationType.PlayerFavor).player(this.player).deleteItem(quantity);
182
+ };
183
+ Pantheon.prototype.onCardPlaced = function (move) {
184
+ var moves = [];
185
+ var location = move.location;
186
+ var card = this.material(MaterialType_1.MaterialType.EntityCard).index(move.itemIndex);
187
+ var cardItem = card.getItem();
188
+ var entity = cardItem.id.front;
189
+ if ((0, Entity_1.isGod)(entity)) {
190
+ moves.push(this.spendGems(4));
191
+ }
192
+ var grid = this.grid;
193
+ grid[move.location.y][move.location.x] = entity;
194
+ moves.push.apply(moves, __spreadArray([], __read(this.gainBonus(grid)), false));
195
+ var triggerEffectsRule = new TriggerEffectsRule_1.TriggerEffectsRule(this.game);
196
+ var crushed = this.allCards.location(function (l) { return l.x === move.location.x && l.y === move.location.y; }).maxBy(function (item) { return item.location.z; });
197
+ triggerEffectsRule.triggerCardEffect(card, { type: Effect_1.TriggerEventType.SelfPlaced, location: location, crush: crushed.length > 0 });
198
+ var invoke = this.isInvoke;
199
+ if (invoke) {
200
+ moves.push.apply(moves, __spreadArray([], __read(this.onInvoke(move)), false));
201
+ }
202
+ var triggerEvents = [];
203
+ if (invoke) {
204
+ triggerEvents.push({ type: Effect_1.TriggerEventType.EntityInvoked, card: cardItem, cardIndex: move.itemIndex });
205
+ }
206
+ if (crushed.length) {
207
+ triggerEvents.push({ type: Effect_1.TriggerEventType.EntityCrushed, card: crushed.getItem(), cardIndex: crushed.getIndex() });
208
+ }
209
+ if (triggerEvents.length) {
210
+ triggerEffectsRule.triggerEffects.apply(triggerEffectsRule, __spreadArray([], __read(triggerEvents), false));
211
+ }
212
+ return moves;
213
+ };
214
+ Object.defineProperty(Pantheon.prototype, "isInvoke", {
215
+ get: function () {
216
+ return new MythologiesRules_1.MythologiesRules(this.game).delegate().isInvoke;
217
+ },
218
+ enumerable: false,
219
+ configurable: true
220
+ });
221
+ Pantheon.prototype.gainBonus = function (grid) {
222
+ var e_1, _a, e_2, _b;
223
+ if (grid === void 0) { grid = this.grid; }
224
+ var moves = [];
225
+ var fullLines = (0, lodash_1.range)(0, 3).filter(function (y) { return !grid[y].includes(undefined); });
226
+ try {
227
+ for (var fullLines_1 = __values(fullLines), fullLines_1_1 = fullLines_1.next(); !fullLines_1_1.done; fullLines_1_1 = fullLines_1.next()) {
228
+ var y = fullLines_1_1.value;
229
+ var bonusGem = this.getBonusGem(y);
230
+ if (bonusGem.length) {
231
+ moves.push(bonusGem.moveItem({ type: LocationType_1.LocationType.PlayerGems, player: this.player }));
232
+ }
233
+ }
234
+ }
235
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
236
+ finally {
237
+ try {
238
+ if (fullLines_1_1 && !fullLines_1_1.done && (_a = fullLines_1.return)) _a.call(fullLines_1);
239
+ }
240
+ finally { if (e_1) throw e_1.error; }
241
+ }
242
+ var fullColumns = (0, lodash_1.range)(0, 3).filter(function (x) { return grid.every(function (line) { return line[x] !== undefined; }); });
243
+ try {
244
+ for (var fullColumns_1 = __values(fullColumns), fullColumns_1_1 = fullColumns_1.next(); !fullColumns_1_1.done; fullColumns_1_1 = fullColumns_1.next()) {
245
+ var x = fullColumns_1_1.value;
246
+ var bonusFavor = this.getBonusFavor(x);
247
+ if (bonusFavor.length) {
248
+ moves.push(bonusFavor.moveItem({ type: LocationType_1.LocationType.PlayerFavor, player: this.player }));
249
+ }
250
+ }
251
+ }
252
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
253
+ finally {
254
+ try {
255
+ if (fullColumns_1_1 && !fullColumns_1_1.done && (_b = fullColumns_1.return)) _b.call(fullColumns_1);
256
+ }
257
+ finally { if (e_2) throw e_2.error; }
258
+ }
259
+ return moves;
260
+ };
261
+ Pantheon.prototype.getBonusGem = function (y) {
262
+ return this.material(MaterialType_1.MaterialType.GemToken)
263
+ .location(LocationType_1.LocationType.PantheonLineBonus)
264
+ .player(this.player)
265
+ .location(function (l) { return l.y === y; });
266
+ };
267
+ Pantheon.prototype.getBonusFavor = function (x) {
268
+ return this.material(MaterialType_1.MaterialType.FavorToken)
269
+ .location(LocationType_1.LocationType.PantheonColumnBonus)
270
+ .player(this.player)
271
+ .location(function (l) { return l.x === x; });
272
+ };
273
+ Pantheon.prototype.onInvoke = function (move) {
274
+ var e_3, _a;
275
+ var moves = [];
276
+ var card = this.material(MaterialType_1.MaterialType.EntityCard).index(move.itemIndex).getItem();
277
+ var entity = card.id.front;
278
+ if (!entity)
279
+ return [];
280
+ var trollOpponents = this.getOpponentsWithTrollAt(move.location);
281
+ var favor = this.material(MaterialType_1.MaterialType.FavorToken).location(LocationType_1.LocationType.PlayerFavor).player(this.player);
282
+ try {
283
+ for (var trollOpponents_1 = __values(trollOpponents), trollOpponents_1_1 = trollOpponents_1.next(); !trollOpponents_1_1.done; trollOpponents_1_1 = trollOpponents_1.next()) {
284
+ var trollOpponent = trollOpponents_1_1.value;
285
+ moves.push(favor.moveItem({ type: LocationType_1.LocationType.PlayerFavor, player: trollOpponent }));
286
+ }
287
+ }
288
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
289
+ finally {
290
+ try {
291
+ if (trollOpponents_1_1 && !trollOpponents_1_1.done && (_a = trollOpponents_1.return)) _a.call(trollOpponents_1);
292
+ }
293
+ finally { if (e_3) throw e_3.error; }
294
+ }
295
+ moves.push.apply(moves, __spreadArray([], __read(this.getInvokeGains(entity, move.location.y)), false));
296
+ return moves;
297
+ };
298
+ Pantheon.prototype.getInvokeGains = function (entity, line) {
299
+ var moves = [];
300
+ var invokeGain = EntityDescription_1.entities[entity].invoke[line];
301
+ if (invokeGain.gem) {
302
+ moves.push(this.gainGems(invokeGain.gem));
303
+ }
304
+ if (invokeGain.favor) {
305
+ moves.push(this.gainFavor(invokeGain.favor));
306
+ }
307
+ return moves;
308
+ };
309
+ Pantheon.prototype.hasEntity = function (entity) {
310
+ return this.visibleEntities.getItems().some(function (card) { return card.id.front === entity; });
311
+ };
312
+ Pantheon.prototype.getPiles = function (predicate) {
313
+ if (predicate === void 0) { predicate = function () { return true; }; }
314
+ var piles = [];
315
+ var myEntities = this.material(MaterialType_1.MaterialType.EntityCard).player(this.player);
316
+ var fullPantheon = myEntities.location(LocationType_1.LocationType.Pantheon);
317
+ var _loop_1 = function (x) {
318
+ var _loop_2 = function (y) {
319
+ if (predicate({ x: x, y: y })) {
320
+ var pile = fullPantheon.location(function (l) { return l.x === x && l.y === y; }).sort(function (item) { return item.location.z; });
321
+ if (pile.length > 0) {
322
+ piles.push(pile);
323
+ }
324
+ }
325
+ };
326
+ for (var y = 0; y < 3; y++) {
327
+ _loop_2(y);
328
+ }
329
+ };
330
+ for (var x = 0; x < 3; x++) {
331
+ _loop_1(x);
332
+ }
333
+ return piles;
334
+ };
335
+ Pantheon.prototype.isAbleToMove = function (entity) {
336
+ return !this.visibleEntities.getItems().some(function (item) { return item.id.front === Entity_1.Entity.Naga && (0, rules_api_1.areAdjacentSquares)(item.location, entity.location); });
337
+ };
338
+ Object.defineProperty(Pantheon.prototype, "mythologies", {
339
+ get: function () {
340
+ return (0, lodash_1.uniq)(new Pantheon(this.game, this.player).visibleEntities.getItems().map(function (item) { return (0, Entity_1.entityMythology)(item.id.front); }));
341
+ },
342
+ enumerable: false,
343
+ configurable: true
344
+ });
345
+ Object.defineProperty(Pantheon.prototype, "missingMythologies", {
346
+ get: function () {
347
+ var mythologies = this.material(MaterialType_1.MaterialType.MythologyBoard)
348
+ .getItems()
349
+ .map(function (item) { return item.id.mythology; });
350
+ return (0, lodash_1.difference)(mythologies, this.mythologies);
351
+ },
352
+ enumerable: false,
353
+ configurable: true
354
+ });
355
+ return Pantheon;
356
+ }(rules_api_1.MaterialRulesPart));
357
+ exports.Pantheon = Pantheon;
@@ -0,0 +1,22 @@
1
+ import { MaterialMove, MaterialRulesPart, XYCoordinates } from '@gamepark/rules-api';
2
+ import { PlayerColor } from '../PlayerColor';
3
+ import { Mythology } from './Mythology';
4
+ import { Pantheon } from './Pantheon';
5
+ export declare class Trial extends MaterialRulesPart {
6
+ passTrials(player: PlayerColor): MaterialMove<number, number, number, number>[];
7
+ passTrial(player: PlayerColor, [mythology1, mythology2]: Mythology[]): boolean;
8
+ passTrialOnLocation(player: PlayerColor, mythology: Mythology, searchLocation: (location: Partial<XYCoordinates>) => boolean): boolean;
9
+ getPantheon(player: PlayerColor): Pantheon;
10
+ getVisibleEntities(player: PlayerColor, searchLocation?: (location: Partial<XYCoordinates>) => boolean): import("@gamepark/rules-api").Material<number, number, number>;
11
+ haveMoreInvokeFavorThanNeighbor(player: PlayerColor, searchLocation: (location: Partial<XYCoordinates>) => boolean): boolean;
12
+ getInvokeGains(player: PlayerColor, searchLocation: (location: Partial<XYCoordinates>) => boolean): import("./entity/EntityDescription").InvokeGain[];
13
+ getInvokeFavorGain(player: PlayerColor, searchLocation: (location: Partial<XYCoordinates>) => boolean): number;
14
+ getInvokeGemsGain(player: PlayerColor, searchLocation: (location: Partial<XYCoordinates>) => boolean): number;
15
+ noEmptySpace(player: PlayerColor, searchLocation: (location: Partial<XYCoordinates>) => boolean): boolean;
16
+ countGods(player: PlayerColor, searchLocation: (location: Partial<XYCoordinates>) => boolean): number;
17
+ countCreatures(player: PlayerColor, searchLocation: (location: Partial<XYCoordinates>) => boolean): number;
18
+ getMythologies(player: PlayerColor, searchLocation: (location: Partial<XYCoordinates>) => boolean): Mythology[];
19
+ getTrialReward([mythology1, mythology2]: Mythology[]): number;
20
+ getTrialLeftReward(mythology: Mythology): 1 | 2;
21
+ getTrialRightReward(mythology: Mythology): 1 | 2;
22
+ }
@@ -0,0 +1,184 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ exports.Trial = void 0;
35
+ var rules_api_1 = require("@gamepark/rules-api");
36
+ var lodash_1 = require("lodash");
37
+ var CustomMoveType_1 = require("../CustomMoveType");
38
+ var Memory_1 = require("../Memory");
39
+ var Entity_1 = require("./Entity");
40
+ var EntityDescription_1 = require("./entity/EntityDescription");
41
+ var MaterialType_1 = require("./MaterialType");
42
+ var Mythology_1 = require("./Mythology");
43
+ var Pantheon_1 = require("./Pantheon");
44
+ var Trial = (function (_super) {
45
+ __extends(Trial, _super);
46
+ function Trial() {
47
+ return _super !== null && _super.apply(this, arguments) || this;
48
+ }
49
+ Trial.prototype.passTrials = function (player) {
50
+ var moves = [];
51
+ var mythologyBoards = this.material(MaterialType_1.MaterialType.MythologyBoard);
52
+ var round = this.material(MaterialType_1.MaterialType.RoundToken).getItem().location.id;
53
+ if (round === 3 || (round === 4 && this.remind(Memory_1.Memory.TrialFailure, player))) {
54
+ var firstTrialBoards = mythologyBoards.location(function (l) { return l.y === 0; }).sort(function (item) { return item.location.x; });
55
+ var firstTrialMythologies = firstTrialBoards.getItems().map(function (item) { return item.id.mythology; });
56
+ if (this.passTrial(player, firstTrialMythologies)) {
57
+ var reward = this.getTrialReward(firstTrialMythologies);
58
+ moves.push(this.customMove(CustomMoveType_1.CustomMoveType.TrialSuccess, { trial: 1, reward: round === 3 ? reward : reward - 1 }));
59
+ }
60
+ else {
61
+ moves.push(this.customMove(CustomMoveType_1.CustomMoveType.TrialFailure, 1));
62
+ }
63
+ }
64
+ if (round === 4) {
65
+ var secondTrialBoards = mythologyBoards.location(function (l) { return l.y === 1; }).sort(function (item) { return item.location.x; });
66
+ var secondTrialMythologies = secondTrialBoards.getItems().map(function (item) { return item.id.mythology; });
67
+ if (this.passTrial(player, secondTrialMythologies)) {
68
+ var reward = this.getTrialReward(secondTrialMythologies);
69
+ moves.push(this.customMove(CustomMoveType_1.CustomMoveType.TrialSuccess, { trial: 2, reward: reward }));
70
+ }
71
+ else {
72
+ moves.push(this.customMove(CustomMoveType_1.CustomMoveType.TrialFailure, 2));
73
+ }
74
+ }
75
+ return moves;
76
+ };
77
+ Trial.prototype.passTrial = function (player, _a) {
78
+ var _this = this;
79
+ var _b = __read(_a, 2), mythology1 = _b[0], mythology2 = _b[1];
80
+ switch (mythology2) {
81
+ case Mythology_1.Mythology.Greek:
82
+ return this.passTrialOnLocation(player, mythology1, function (location) { return location.y === 0; });
83
+ case Mythology_1.Mythology.Norse:
84
+ return this.passTrialOnLocation(player, mythology1, function (location) { return location.y === 1; });
85
+ case Mythology_1.Mythology.Egyptian:
86
+ return this.passTrialOnLocation(player, mythology1, function (location) { return location.x === 1; });
87
+ case Mythology_1.Mythology.Hindu:
88
+ return this.passTrialOnLocation(player, mythology1, function (location) { return location.y === 2; });
89
+ case Mythology_1.Mythology.Inca:
90
+ return this.passTrialOnLocation(player, mythology1, function (location) { return location.x === 0; });
91
+ case Mythology_1.Mythology.Chinese:
92
+ return (this.passTrialOnLocation(player, mythology1, function (location) { return location.x === location.y; }) ||
93
+ this.passTrialOnLocation(player, mythology1, function (location) { return location.x === 2 - location.y; }));
94
+ case Mythology_1.Mythology.Zulu:
95
+ return this.passTrialOnLocation(player, mythology1, function (location) { return location.x === 2; });
96
+ case Mythology_1.Mythology.Celtic:
97
+ return (0, lodash_1.range)(0, 3).some(function (y) { return _this.passTrialOnLocation(player, mythology1, function (location) { return location.y === y; }); });
98
+ }
99
+ };
100
+ Trial.prototype.passTrialOnLocation = function (player, mythology, searchLocation) {
101
+ switch (mythology) {
102
+ case Mythology_1.Mythology.Greek:
103
+ return this.haveMoreInvokeFavorThanNeighbor(player, searchLocation);
104
+ case Mythology_1.Mythology.Norse:
105
+ return this.noEmptySpace(player, searchLocation) && this.countGods(player, searchLocation) >= 1;
106
+ case Mythology_1.Mythology.Egyptian:
107
+ return this.getPantheon(player).coveredEntities.location(searchLocation).length >= 2;
108
+ case Mythology_1.Mythology.Hindu:
109
+ return this.countGods(player, searchLocation) >= 2;
110
+ case Mythology_1.Mythology.Inca:
111
+ return this.countCreatures(player, searchLocation) === 0;
112
+ case Mythology_1.Mythology.Chinese:
113
+ return this.noEmptySpace(player, searchLocation) && this.getVisibleEntities(player).length <= 6;
114
+ case Mythology_1.Mythology.Zulu:
115
+ return (0, lodash_1.uniq)(this.getMythologies(player, searchLocation)).length >= 3;
116
+ case Mythology_1.Mythology.Celtic:
117
+ return this.getInvokeGemsGain(player, searchLocation) >= 3;
118
+ }
119
+ };
120
+ Trial.prototype.getPantheon = function (player) {
121
+ return new Pantheon_1.Pantheon(this.game, player);
122
+ };
123
+ Trial.prototype.getVisibleEntities = function (player, searchLocation) {
124
+ var visibleEntities = this.getPantheon(player).visibleEntities;
125
+ return searchLocation ? visibleEntities.location(searchLocation) : visibleEntities;
126
+ };
127
+ Trial.prototype.haveMoreInvokeFavorThanNeighbor = function (player, searchLocation) {
128
+ var _this = this;
129
+ var favor = this.getInvokeFavorGain(player, searchLocation);
130
+ return (0, rules_api_1.getNeighbors)(player, this.game.players).some(function (neighbor) { return _this.getInvokeFavorGain(neighbor, searchLocation) < favor; });
131
+ };
132
+ Trial.prototype.getInvokeGains = function (player, searchLocation) {
133
+ return this.getVisibleEntities(player, searchLocation)
134
+ .getItems()
135
+ .map(function (item) { return EntityDescription_1.entities[item.id.front].invoke[item.location.y]; });
136
+ };
137
+ Trial.prototype.getInvokeFavorGain = function (player, searchLocation) {
138
+ return (0, lodash_1.sumBy)(this.getInvokeGains(player, searchLocation), function (gain) { var _a; return (_a = gain.favor) !== null && _a !== void 0 ? _a : 0; });
139
+ };
140
+ Trial.prototype.getInvokeGemsGain = function (player, searchLocation) {
141
+ return (0, lodash_1.sumBy)(this.getInvokeGains(player, searchLocation), function (gain) { var _a; return (_a = gain.gem) !== null && _a !== void 0 ? _a : 0; });
142
+ };
143
+ Trial.prototype.noEmptySpace = function (player, searchLocation) {
144
+ return this.getPantheon(player).grid.every(function (line, y) { return line.every(function (space, x) { return space !== undefined || !searchLocation({ x: x, y: y }); }); });
145
+ };
146
+ Trial.prototype.countGods = function (player, searchLocation) {
147
+ return this.getVisibleEntities(player, searchLocation).id(function (id) { return (0, Entity_1.isGod)(id.front); }).length;
148
+ };
149
+ Trial.prototype.countCreatures = function (player, searchLocation) {
150
+ return this.getVisibleEntities(player, searchLocation).id(function (id) { return (0, Entity_1.isCreature)(id.front); }).length;
151
+ };
152
+ Trial.prototype.getMythologies = function (player, searchLocation) {
153
+ return this.getVisibleEntities(player, searchLocation)
154
+ .getItems()
155
+ .map(function (item) { return (0, Entity_1.entityMythology)(item.id.front); });
156
+ };
157
+ Trial.prototype.getTrialReward = function (_a) {
158
+ var _b = __read(_a, 2), mythology1 = _b[0], mythology2 = _b[1];
159
+ return this.getTrialLeftReward(mythology1) + this.getTrialRightReward(mythology2);
160
+ };
161
+ Trial.prototype.getTrialLeftReward = function (mythology) {
162
+ switch (mythology) {
163
+ case Mythology_1.Mythology.Greek:
164
+ case Mythology_1.Mythology.Norse:
165
+ case Mythology_1.Mythology.Egyptian:
166
+ case Mythology_1.Mythology.Inca:
167
+ return 1;
168
+ default:
169
+ return 2;
170
+ }
171
+ };
172
+ Trial.prototype.getTrialRightReward = function (mythology) {
173
+ switch (mythology) {
174
+ case Mythology_1.Mythology.Chinese:
175
+ case Mythology_1.Mythology.Zulu:
176
+ case Mythology_1.Mythology.Celtic:
177
+ return 1;
178
+ default:
179
+ return 2;
180
+ }
181
+ };
182
+ return Trial;
183
+ }(rules_api_1.MaterialRulesPart));
184
+ exports.Trial = Trial;
@@ -0,0 +1,91 @@
1
+ import { Location, Material, MaterialGame, MaterialItem, MaterialMove, PlayerTurnRule, SimultaneousRule } from '@gamepark/rules-api';
2
+ import { PlayerColor } from '../../PlayerColor';
3
+ import { RuleId } from '../../rules/RuleId';
4
+ import { EntityId } from '../Entity';
5
+ import { LocationType } from '../LocationType';
6
+ import { MaterialType } from '../MaterialType';
7
+ export type Effect = {
8
+ trigger: (event: TriggerEvent, card: Material, game: MaterialGame) => boolean;
9
+ rule: new (game: MaterialGame) => EffectRule;
10
+ };
11
+ interface EffectRule {
12
+ canPlayEffect(cardIndex: number): boolean;
13
+ playEffect(): MaterialMove[];
14
+ }
15
+ export declare abstract class PlayerEffectRule extends PlayerTurnRule implements EffectRule {
16
+ canPlayEffect(_cardIndex: number): boolean;
17
+ ruleId?: RuleId;
18
+ playEffect(): MaterialMove[];
19
+ onRuleStart(): MaterialMove<number, number, number, number>[];
20
+ get card(): MaterialItem<number, number, EntityId>;
21
+ getEffect<Event extends TriggerEvent>(): PendingEffect<Event>;
22
+ endEffect(): MaterialMove[];
23
+ }
24
+ export declare abstract class SimultaneousEffectRule extends SimultaneousRule implements EffectRule {
25
+ canPlayEffect(_cardIndex: number): boolean;
26
+ ruleId?: RuleId;
27
+ playEffect(): MaterialMove[];
28
+ getAffectedPlayers(): PlayerColor[];
29
+ isOpponent(player: PlayerColor): boolean;
30
+ get card(): MaterialItem<number, number, EntityId>;
31
+ getEffect<Event extends TriggerEvent>(): PendingEffect<Event>;
32
+ getMovesAfterPlayersDone(): MaterialMove[];
33
+ }
34
+ export declare enum TriggerEventType {
35
+ EndOfGame = 1,
36
+ SelfPlaced = 2,
37
+ EntityInvoked = 3,
38
+ LineBonusGain = 4,
39
+ ColumnBonusGain = 5,
40
+ Infinite = 6,
41
+ EntityCrushed = 7,
42
+ EntitySacrificed = 8
43
+ }
44
+ export type SelfPlaced = {
45
+ type: TriggerEventType.SelfPlaced;
46
+ location: Location;
47
+ crush: boolean;
48
+ };
49
+ export declare const isPlaced: (event: TriggerEvent) => event is SelfPlaced;
50
+ export type EndOfGameEvent = {
51
+ type: TriggerEventType.EndOfGame;
52
+ };
53
+ export declare const isEndOfGame: (event: TriggerEvent) => event is EndOfGameEvent;
54
+ export type EntityInvoked = {
55
+ type: TriggerEventType.EntityInvoked;
56
+ card: MaterialItem<MaterialType, LocationType, EntityId>;
57
+ cardIndex: number;
58
+ };
59
+ export type LineBonusGained = {
60
+ type: TriggerEventType.LineBonusGain;
61
+ player: PlayerColor;
62
+ y: number;
63
+ };
64
+ export type ColumnBonusGained = {
65
+ type: TriggerEventType.ColumnBonusGain;
66
+ player: PlayerColor;
67
+ x: number;
68
+ };
69
+ export type Infinite = {
70
+ type: TriggerEventType.Infinite;
71
+ };
72
+ export declare const oncePerTurn: (event: TriggerEvent) => event is Infinite;
73
+ export declare const isPlacedCrush: (event: TriggerEvent) => event is SelfPlaced;
74
+ export type EntityCrushed = {
75
+ type: TriggerEventType.EntityCrushed;
76
+ card: MaterialItem<MaterialType, LocationType, EntityId>;
77
+ cardIndex: number;
78
+ };
79
+ export declare const isCrushed: (event: TriggerEvent, card: Material) => event is EntityCrushed;
80
+ export type EntitySacrificed = {
81
+ type: TriggerEventType.EntitySacrificed;
82
+ card: MaterialItem<MaterialType, LocationType, EntityId>;
83
+ cardIndex: number;
84
+ };
85
+ export type TriggerEvent = EndOfGameEvent | SelfPlaced | EntityInvoked | LineBonusGained | ColumnBonusGained | Infinite | EntityCrushed | EntitySacrificed;
86
+ export type PendingEffect<Event extends TriggerEvent = TriggerEvent> = {
87
+ cardIndex: number;
88
+ effectIndex: number;
89
+ triggerEvent: Event;
90
+ };
91
+ export {};