@gamepark/mythologies 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/Memory.d.ts +3 -1
  2. package/dist/Memory.js +2 -0
  3. package/dist/MythologiesRules.d.ts +11 -0
  4. package/dist/MythologiesRules.js +11 -0
  5. package/dist/material/Destiny.d.ts +1 -0
  6. package/dist/material/Destiny.js +10 -6
  7. package/dist/material/Entity.d.ts +5 -1
  8. package/dist/material/Entity.js +1 -1
  9. package/dist/material/Mythology.js +1 -1
  10. package/dist/material/Pantheon.d.ts +11 -7
  11. package/dist/material/Pantheon.js +98 -54
  12. package/dist/material/entity/Effect.d.ts +29 -14
  13. package/dist/material/entity/Effect.js +7 -2
  14. package/dist/material/entity/EntityDescription.d.ts +2 -0
  15. package/dist/material/entity/EntityDescription.js +6 -3
  16. package/dist/material/entity/MoveEffectRule.js +29 -1
  17. package/dist/material/entity/SacrificeEffectRule.d.ts +1 -0
  18. package/dist/material/entity/SacrificeEffectRule.js +13 -36
  19. package/dist/material/entity/SimultaneousMoveEffectRule.js +9 -5
  20. package/dist/material/entity/SimultaneousSacrificeEffectRule.d.ts +1 -0
  21. package/dist/material/entity/SimultaneousSacrificeEffectRule.js +12 -35
  22. package/dist/material/entity/celtic/Banshee.js +33 -1
  23. package/dist/material/entity/celtic/Brigid.js +34 -1
  24. package/dist/material/entity/celtic/Cernunnos.js +37 -1
  25. package/dist/material/entity/celtic/Dagda.js +43 -1
  26. package/dist/material/entity/celtic/Fairy.d.ts +2 -0
  27. package/dist/material/entity/celtic/Fairy.js +12 -0
  28. package/dist/material/entity/celtic/Kelpie.js +33 -1
  29. package/dist/material/entity/celtic/Morrigan.js +6 -1
  30. package/dist/material/entity/chinese/SunWukong.js +1 -1
  31. package/dist/material/entity/egyptian/Beetle.js +19 -13
  32. package/dist/material/entity/hindu/Naga.js +36 -30
  33. package/dist/material/entity/hindu/Vishnu.js +2 -6
  34. package/dist/material/entity/norse/Troll.js +4 -1
  35. package/dist/material/entity/zulu/Idlozi.js +7 -1
  36. package/dist/material/entity/zulu/Impundulu.js +7 -1
  37. package/dist/material/entity/zulu/Inkanyamba.js +33 -1
  38. package/dist/material/entity/zulu/Inkosazana.js +7 -1
  39. package/dist/material/entity/zulu/Shembe.js +38 -1
  40. package/dist/material/entity/zulu/Tokoloshe.js +41 -1
  41. package/dist/material/entity/zulu/Umvelinqangi.js +39 -1
  42. package/dist/material/entity/zulu/Unkulunkulu.js +37 -1
  43. package/dist/material/entity/zulu/Unwabu.js +43 -1
  44. package/dist/material/entity/zulu/Werehyena.js +7 -1
  45. package/dist/rules/DrawDestinyCardRule.js +3 -4
  46. package/dist/rules/PlaceCardsRule.js +4 -2
  47. package/dist/rules/RuleId.d.ts +7 -1
  48. package/dist/rules/RuleId.js +6 -0
  49. package/dist/rules/effects/AthenaEffectRule.js +29 -1
  50. package/dist/rules/effects/CentaurEffectRule.js +29 -1
  51. package/dist/rules/effects/FairyEffectRule.d.ts +10 -0
  52. package/dist/rules/effects/FairyEffectRule.js +55 -0
  53. package/dist/rules/effects/IdloziEffectRule.d.ts +9 -0
  54. package/dist/rules/effects/IdloziEffectRule.js +43 -0
  55. package/dist/rules/effects/ImpunduluEffectRule.d.ts +7 -0
  56. package/dist/rules/effects/ImpunduluEffectRule.js +47 -0
  57. package/dist/rules/effects/InkosazanaEffectRule.d.ts +7 -0
  58. package/dist/rules/effects/InkosazanaEffectRule.js +46 -0
  59. package/dist/rules/effects/JiangshiEffectRule.js +5 -2
  60. package/dist/rules/effects/PermanentEffectsRule.d.ts +7 -0
  61. package/dist/rules/effects/PermanentEffectsRule.js +54 -0
  62. package/dist/rules/effects/QilinEffectRule.js +6 -5
  63. package/dist/rules/effects/ResolveEffectsRule.js +1 -1
  64. package/dist/rules/effects/ShivaEffectRule.d.ts +1 -1
  65. package/dist/rules/effects/ShivaEffectRule.js +14 -10
  66. package/dist/rules/effects/TriggerEffectsRule.d.ts +1 -1
  67. package/dist/rules/effects/TriggerEffectsRule.js +36 -18
  68. package/dist/rules/effects/WerehyenaEffectRule.d.ts +11 -0
  69. package/dist/rules/effects/WerehyenaEffectRule.js +54 -0
  70. package/package.json +2 -2
@@ -27,42 +27,48 @@ var __values = (this && this.__values) || function(o) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.Naga = void 0;
30
+ var rules_api_1 = require("@gamepark/rules-api");
30
31
  var LocationType_1 = require("../../LocationType");
31
32
  var MaterialType_1 = require("../../MaterialType");
32
33
  var Effect_1 = require("../Effect");
33
34
  exports.Naga = {
34
35
  invoke: [{}, { gem: 2 }, { gem: 1 }],
35
- effect: {
36
- trigger: Effect_1.isCrushed,
37
- rule: (function (_super) {
38
- __extends(NagaEffectRule, _super);
39
- function NagaEffectRule() {
40
- return _super !== null && _super.apply(this, arguments) || this;
41
- }
42
- NagaEffectRule.prototype.playEffect = function () {
43
- var e_1, _a;
44
- var _this = this;
45
- var moves = [];
46
- var opponents = this.game.players.filter(function (player) { return player !== _this.player; });
47
- try {
48
- for (var opponents_1 = __values(opponents), opponents_1_1 = opponents_1.next(); !opponents_1_1.done; opponents_1_1 = opponents_1.next()) {
49
- var opponent = opponents_1_1.value;
50
- var favor = this.material(MaterialType_1.MaterialType.FavorToken).location(LocationType_1.LocationType.PlayerFavor).player(opponent);
51
- if (favor.getQuantity()) {
52
- moves.push(favor.deleteItem(1));
53
- }
54
- }
36
+ effects: [
37
+ {
38
+ preventMove: function (card, naga) { return naga.location.player === card.location.player && (0, rules_api_1.areAdjacentSquares)(naga.location, card.location); }
39
+ },
40
+ {
41
+ trigger: Effect_1.isCrushed,
42
+ rule: (function (_super) {
43
+ __extends(NagaEffectRule, _super);
44
+ function NagaEffectRule() {
45
+ return _super !== null && _super.apply(this, arguments) || this;
55
46
  }
56
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
57
- finally {
47
+ NagaEffectRule.prototype.playEffect = function () {
48
+ var e_1, _a;
49
+ var _this = this;
50
+ var moves = [];
51
+ var opponents = this.game.players.filter(function (player) { return player !== _this.player; });
58
52
  try {
59
- if (opponents_1_1 && !opponents_1_1.done && (_a = opponents_1.return)) _a.call(opponents_1);
53
+ for (var opponents_1 = __values(opponents), opponents_1_1 = opponents_1.next(); !opponents_1_1.done; opponents_1_1 = opponents_1.next()) {
54
+ var opponent = opponents_1_1.value;
55
+ var favor = this.material(MaterialType_1.MaterialType.FavorToken).location(LocationType_1.LocationType.PlayerFavor).player(opponent);
56
+ if (favor.getQuantity()) {
57
+ moves.push(favor.deleteItem(1));
58
+ }
59
+ }
60
60
  }
61
- finally { if (e_1) throw e_1.error; }
62
- }
63
- return moves;
64
- };
65
- return NagaEffectRule;
66
- }(Effect_1.PlayerEffectRule))
67
- }
61
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
62
+ finally {
63
+ try {
64
+ if (opponents_1_1 && !opponents_1_1.done && (_a = opponents_1.return)) _a.call(opponents_1);
65
+ }
66
+ finally { if (e_1) throw e_1.error; }
67
+ }
68
+ return moves;
69
+ };
70
+ return NagaEffectRule;
71
+ }(Effect_1.PlayerEffectRule))
72
+ }
73
+ ]
68
74
  };
@@ -41,8 +41,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
41
41
  };
42
42
  Object.defineProperty(exports, "__esModule", { value: true });
43
43
  exports.Vishnu = void 0;
44
+ var Destiny_1 = require("../../Destiny");
44
45
  var LocationType_1 = require("../../LocationType");
45
- var MaterialType_1 = require("../../MaterialType");
46
46
  var Pantheon_1 = require("../../Pantheon");
47
47
  var Effect_1 = require("../Effect");
48
48
  exports.Vishnu = {
@@ -55,11 +55,7 @@ exports.Vishnu = {
55
55
  return _super !== null && _super.apply(this, arguments) || this;
56
56
  }
57
57
  VishnuEffectRule.prototype.playEffect = function () {
58
- var tokensOnCards = this.material(MaterialType_1.MaterialType.DraftToken).location(LocationType_1.LocationType.OnEntityCard).getItems();
59
- var cardsWithToken = tokensOnCards.map(function (item) { return item.location.parent; });
60
- var godsToExile = this.material(MaterialType_1.MaterialType.EntityCard)
61
- .location(LocationType_1.LocationType.SanctuaryGodSpot)
62
- .index(function (index) { return !cardsWithToken.includes(index); });
58
+ var godsToExile = new Destiny_1.Destiny(this.game).cardsWithoutToken.location(LocationType_1.LocationType.SanctuaryGodSpot);
63
59
  if (!godsToExile.length)
64
60
  return [];
65
61
  var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
@@ -2,5 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Troll = void 0;
4
4
  exports.Troll = {
5
- invoke: [{}, { gem: 1 }, { favor: 1 }]
5
+ invoke: [{}, { gem: 1 }, { favor: 1 }],
6
+ effect: {
7
+ favorTax: function (space, troll) { return (space.x === troll.location.x && space.y === troll.location.y ? 1 : 0); }
8
+ }
6
9
  };
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Idlozi = void 0;
4
+ var IdloziEffectRule_1 = require("../../../rules/effects/IdloziEffectRule");
5
+ var Effect_1 = require("../Effect");
4
6
  exports.Idlozi = {
5
- invoke: [{ gem: 1 }, {}, { gem: 1 }]
7
+ invoke: [{ gem: 1 }, {}, { gem: 1 }],
8
+ effect: {
9
+ trigger: Effect_1.isPlaced,
10
+ rule: IdloziEffectRule_1.IdloziEffectRule
11
+ }
6
12
  };
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Impundulu = void 0;
4
+ var ImpunduluEffectRule_1 = require("../../../rules/effects/ImpunduluEffectRule");
5
+ var Effect_1 = require("../Effect");
4
6
  exports.Impundulu = {
5
- invoke: [{ favor: 1 }, {}, {}]
7
+ invoke: [{ favor: 1 }, {}, {}],
8
+ effect: {
9
+ trigger: Effect_1.isPlaced,
10
+ rule: ImpunduluEffectRule_1.ImpunduluEffectRule
11
+ }
6
12
  };
@@ -1,6 +1,38 @@
1
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
+ })();
2
17
  Object.defineProperty(exports, "__esModule", { value: true });
3
18
  exports.Inkanyamba = void 0;
19
+ var Pantheon_1 = require("../../Pantheon");
20
+ var Effect_1 = require("../Effect");
4
21
  exports.Inkanyamba = {
5
- invoke: [{}, { favor: 1 }, { gem: 1 }]
22
+ invoke: [{}, { favor: 1 }, { gem: 1 }],
23
+ effect: {
24
+ trigger: function (effect, card) { return effect.type === Effect_1.TriggerEventType.EntitiesMoved && effect.entities.includes(card.getIndex()); },
25
+ rule: (function (_super) {
26
+ __extends(InkanyambaEffectRule, _super);
27
+ function InkanyambaEffectRule() {
28
+ return _super !== null && _super.apply(this, arguments) || this;
29
+ }
30
+ InkanyambaEffectRule.prototype.playEffect = function () {
31
+ var player = this.card.location.player;
32
+ return [new Pantheon_1.Pantheon(this.game, player).gainGems(1)];
33
+ };
34
+ return InkanyambaEffectRule;
35
+ }(Effect_1.AutoEffectRule)),
36
+ auto: true
37
+ }
6
38
  };
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Inkosazana = void 0;
4
+ var InkosazanaEffectRule_1 = require("../../../rules/effects/InkosazanaEffectRule");
5
+ var Effect_1 = require("../Effect");
4
6
  exports.Inkosazana = {
5
- invoke: [{}, { gem: 1, favor: 1 }, { favor: 1 }]
7
+ invoke: [{}, { gem: 1, favor: 1 }, { favor: 1 }],
8
+ effect: {
9
+ trigger: Effect_1.isPlaced,
10
+ rule: InkosazanaEffectRule_1.InkosazanaEffectRule
11
+ }
6
12
  };
@@ -1,6 +1,43 @@
1
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
+ })();
2
17
  Object.defineProperty(exports, "__esModule", { value: true });
3
18
  exports.Shembe = void 0;
19
+ var lodash_1 = require("lodash");
20
+ var Entity_1 = require("../../Entity");
21
+ var Mythology_1 = require("../../Mythology");
22
+ var Pantheon_1 = require("../../Pantheon");
23
+ var Effect_1 = require("../Effect");
4
24
  exports.Shembe = {
5
- invoke: [{ gem: 1 }, { gem: 2 }, {}]
25
+ invoke: [{ gem: 1 }, { gem: 2 }, {}],
26
+ effect: {
27
+ trigger: Effect_1.isEndOfGame,
28
+ rule: (function (_super) {
29
+ __extends(ShembeEffectRule, _super);
30
+ function ShembeEffectRule() {
31
+ return _super !== null && _super.apply(this, arguments) || this;
32
+ }
33
+ ShembeEffectRule.prototype.playEffect = function () {
34
+ var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
35
+ var creatures = pantheon.visibleEntities.id(function (id) { return (0, Entity_1.isCreature)(id.front) && (0, Entity_1.entityMythology)(id.front) !== Mythology_1.Mythology.Zulu; });
36
+ var groups = (0, lodash_1.groupBy)(creatures.getItems(), function (creature) { return (0, Entity_1.entityMythology)(creature.id.front); });
37
+ var pairs = (0, lodash_1.sumBy)((0, lodash_1.values)(groups), function (group) { return Math.floor(group.length / 2); });
38
+ return pairs > 0 ? [pantheon.gainFavor(pairs * 2)] : [];
39
+ };
40
+ return ShembeEffectRule;
41
+ }(Effect_1.PlayerEffectRule))
42
+ }
6
43
  };
@@ -1,6 +1,46 @@
1
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
+ })();
2
17
  Object.defineProperty(exports, "__esModule", { value: true });
3
18
  exports.Tokoloshe = void 0;
19
+ var Entity_1 = require("../../Entity");
20
+ var Pantheon_1 = require("../../Pantheon");
21
+ var Effect_1 = require("../Effect");
4
22
  exports.Tokoloshe = {
5
- invoke: [{}, { gem: 3 }, { favor: 2 }]
23
+ invoke: [{}, { gem: 3 }, { favor: 2 }],
24
+ effects: [
25
+ {
26
+ trigger: Effect_1.isEndOfMyTurn,
27
+ rule: (function (_super) {
28
+ __extends(TokolosheEffectRule, _super);
29
+ function TokolosheEffectRule() {
30
+ return _super !== null && _super.apply(this, arguments) || this;
31
+ }
32
+ TokolosheEffectRule.prototype.playEffect = function () {
33
+ var _a = this.card.location, x = _a.x, y = _a.y, player = _a.player;
34
+ var pantheon = new Pantheon_1.Pantheon(this.game, player);
35
+ var creatures = pantheon.visibleEntities.location(function (l) { return l.y === y && l.x !== x; }).id(function (id) { return (0, Entity_1.isCreature)(id.front); });
36
+ var loss = Math.min(pantheon.favor, creatures.length);
37
+ return loss ? [pantheon.loseFavor(loss)] : [];
38
+ };
39
+ return TokolosheEffectRule;
40
+ }(Effect_1.AutoEffectRule))
41
+ },
42
+ {
43
+ preventCrush: function (card) { return card.id.front === Entity_1.Entity.Tokoloshe; }
44
+ }
45
+ ]
6
46
  };
@@ -1,6 +1,44 @@
1
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
+ })();
2
17
  Object.defineProperty(exports, "__esModule", { value: true });
3
18
  exports.Umvelinqangi = void 0;
19
+ var lodash_1 = require("lodash");
20
+ var Entity_1 = require("../../Entity");
21
+ var Mythology_1 = require("../../Mythology");
22
+ var Pantheon_1 = require("../../Pantheon");
23
+ var Effect_1 = require("../Effect");
4
24
  exports.Umvelinqangi = {
5
- invoke: [{ gem: 1, favor: 1 }, { gem: 1 }, {}]
25
+ invoke: [{ gem: 1, favor: 1 }, { gem: 1 }, {}],
26
+ effect: {
27
+ trigger: Effect_1.isEndOfGame,
28
+ rule: (function (_super) {
29
+ __extends(UmvelinqangiEffectRule, _super);
30
+ function UmvelinqangiEffectRule() {
31
+ return _super !== null && _super.apply(this, arguments) || this;
32
+ }
33
+ UmvelinqangiEffectRule.prototype.playEffect = function () {
34
+ var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
35
+ var _a = this.card.location, x = _a.x, y = _a.y;
36
+ var covered = pantheon.coveredEntities.location(function (l) { return l.x === x && l.y === y; }).getItems();
37
+ var mythologies = (0, lodash_1.uniq)(covered.map(function (card) { return (0, Entity_1.entityMythology)(card.id.front); })).filter(function (mythology) { return mythology !== Mythology_1.Mythology.Zulu; });
38
+ var gain = mythologies.length === 3 ? 5 : mythologies.length;
39
+ return gain > 0 ? [pantheon.gainFavor(gain)] : [];
40
+ };
41
+ return UmvelinqangiEffectRule;
42
+ }(Effect_1.PlayerEffectRule))
43
+ }
6
44
  };
@@ -1,6 +1,42 @@
1
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
+ })();
2
17
  Object.defineProperty(exports, "__esModule", { value: true });
3
18
  exports.Unkulunkulu = void 0;
19
+ var lodash_1 = require("lodash");
20
+ var Pantheon_1 = require("../../Pantheon");
21
+ var Effect_1 = require("../Effect");
22
+ var EntityDescription_1 = require("../EntityDescription");
4
23
  exports.Unkulunkulu = {
5
- invoke: [{ favor: 1 }, { favor: 2 }, {}]
24
+ invoke: [{ favor: 1 }, { favor: 2 }, {}],
25
+ effect: {
26
+ trigger: Effect_1.isEndOfGame,
27
+ rule: (function (_super) {
28
+ __extends(UnkulunkuluEffectRule, _super);
29
+ function UnkulunkuluEffectRule() {
30
+ return _super !== null && _super.apply(this, arguments) || this;
31
+ }
32
+ UnkulunkuluEffectRule.prototype.playEffect = function () {
33
+ var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
34
+ var _a = this.card.location, x = _a.x, y = _a.y;
35
+ var cards = pantheon.visibleEntities.location(function (l) { return (l.x === x && l.y !== y) || (l.y === y && l.x !== x); }).getItems();
36
+ var gain = (0, lodash_1.sumBy)(cards, function (card) { var _a; return (_a = EntityDescription_1.entities[card.id.front].invoke[card.location.y].favor) !== null && _a !== void 0 ? _a : 0; });
37
+ return gain > 0 ? [pantheon.gainFavor(gain)] : [];
38
+ };
39
+ return UnkulunkuluEffectRule;
40
+ }(Effect_1.PlayerEffectRule))
41
+ }
6
42
  };
@@ -1,6 +1,48 @@
1
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
+ })();
2
17
  Object.defineProperty(exports, "__esModule", { value: true });
3
18
  exports.Unwabu = void 0;
19
+ var Entity_1 = require("../../Entity");
20
+ var MaterialType_1 = require("../../MaterialType");
21
+ var Pantheon_1 = require("../../Pantheon");
22
+ var Effect_1 = require("../Effect");
4
23
  exports.Unwabu = {
5
- invoke: [{ gem: 2 }, { favor: 1 }, {}]
24
+ invoke: [{ gem: 2 }, { favor: 1 }, {}],
25
+ effect: {
26
+ trigger: Effect_1.oncePerTurn,
27
+ rule: (function (_super) {
28
+ __extends(UnwabuEffectRule, _super);
29
+ function UnwabuEffectRule() {
30
+ return _super !== null && _super.apply(this, arguments) || this;
31
+ }
32
+ UnwabuEffectRule.prototype.canPlayEffect = function (cardIndex) {
33
+ return this.getGain(cardIndex) > 0;
34
+ };
35
+ UnwabuEffectRule.prototype.getGain = function (cardIndex) {
36
+ if (cardIndex === void 0) { cardIndex = this.getEffect().cardIndex; }
37
+ var _a = this.material(MaterialType_1.MaterialType.EntityCard).getItem(cardIndex).location, y = _a.y, player = _a.player;
38
+ var pantheon = new Pantheon_1.Pantheon(this.game, player);
39
+ return pantheon.visibleEntities.location(function (l) { return l.y === y; }).id(function (id) { return (0, Entity_1.isGod)(id.front); }).length;
40
+ };
41
+ UnwabuEffectRule.prototype.playEffect = function () {
42
+ var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
43
+ return [pantheon.gainGems(this.getGain())];
44
+ };
45
+ return UnwabuEffectRule;
46
+ }(Effect_1.PlayerEffectRule))
47
+ }
6
48
  };
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Werehyena = void 0;
4
+ var WerehyenaEffectRule_1 = require("../../../rules/effects/WerehyenaEffectRule");
5
+ var Effect_1 = require("../Effect");
4
6
  exports.Werehyena = {
5
- invoke: [{}, { gem: 1 }, { gem: 2 }]
7
+ invoke: [{}, { gem: 1 }, { gem: 2 }],
8
+ effect: {
9
+ trigger: Effect_1.isPlaced,
10
+ rule: WerehyenaEffectRule_1.WerehyenaEffectRule
11
+ }
6
12
  };
@@ -83,11 +83,10 @@ var DrawDestinyCardRule = (function (_super) {
83
83
  DrawDestinyCardRule.prototype.exileCards = function () {
84
84
  var e_1, _a;
85
85
  var moves = [];
86
- var boards = new Destiny_1.Destiny(this.game).getBoardsWithoutPlayer();
86
+ var destiny = new Destiny_1.Destiny(this.game);
87
+ var boards = destiny.getBoardsWithoutPlayer();
87
88
  var count = this.material(MaterialType_1.MaterialType.DestinyCard).location(LocationType_1.LocationType.CurrentDestiny).length;
88
- var tokensOnCards = this.material(MaterialType_1.MaterialType.DraftToken).location(LocationType_1.LocationType.OnEntityCard).getItems();
89
- var cardsWithToken = tokensOnCards.map(function (item) { return item.location.parent; });
90
- var entities = this.material(MaterialType_1.MaterialType.EntityCard).index(function (index) { return !cardsWithToken.includes(index); });
89
+ var entities = destiny.cardsWithoutToken;
91
90
  var creatures = entities.location(LocationType_1.LocationType.SanctuaryCreatureSpot);
92
91
  var gods = entities.location(LocationType_1.LocationType.SanctuaryGodSpot);
93
92
  try {
@@ -110,8 +110,9 @@ var PlaceCardsRule = (function (_super) {
110
110
  var pendingEffect = new TriggerEffectsRule_1.TriggerEffectsRule(this.game).getPlayerEffects(this.player, { type: Effect_1.TriggerEventType.Infinite });
111
111
  return pendingEffect.filter(function (pendingEffect) {
112
112
  var card = _this.material(MaterialType_1.MaterialType.EntityCard).getItem(pendingEffect.cardIndex);
113
- var effect = EntityDescription_1.entities[card.id.front].effect;
114
- return _this.isOncePerTurnAvailable(pendingEffect.cardIndex) && new effect.rule(_this.game).canPlayEffect(pendingEffect.cardIndex);
113
+ var effect = (0, EntityDescription_1.getEffects)(card.id.front)[pendingEffect.effectIndex];
114
+ var canPlayEffect = (0, Effect_1.isTriggeredEffect)(effect) && new effect.rule(_this.game).canPlayEffect(pendingEffect.cardIndex);
115
+ return canPlayEffect && _this.isOncePerTurnAvailable(pendingEffect.cardIndex);
115
116
  });
116
117
  },
117
118
  enumerable: false,
@@ -173,6 +174,7 @@ var PlaceCardsRule = (function (_super) {
173
174
  return [];
174
175
  };
175
176
  PlaceCardsRule.prototype.onPass = function () {
177
+ new TriggerEffectsRule_1.TriggerEffectsRule(this.game).triggerEffects({ type: Effect_1.TriggerEventType.EndOfTurn, player: this.player });
176
178
  return __spreadArray(__spreadArray([], __read(new Trial_1.Trial(this.game).passTrials(this.player)), false), [this.nextRule], false);
177
179
  };
178
180
  Object.defineProperty(PlaceCardsRule.prototype, "nextRule", {
@@ -47,5 +47,11 @@ export declare enum RuleId {
47
47
  TianlongOpponentsEffect = 49,
48
48
  QilinEffect = 50,
49
49
  FenghuangEffect = 51,
50
- JiangshiEffect = 52
50
+ JiangshiEffect = 52,
51
+ InkosazanaEffect = 53,
52
+ ImpunduluEffect = 54,
53
+ WerehyenaEffect = 55,
54
+ WerehyenaCallEffect = 56,
55
+ IdloziEffect = 57,
56
+ FairyEffect = 58
51
57
  }
@@ -52,4 +52,10 @@ var RuleId;
52
52
  RuleId[RuleId["QilinEffect"] = 50] = "QilinEffect";
53
53
  RuleId[RuleId["FenghuangEffect"] = 51] = "FenghuangEffect";
54
54
  RuleId[RuleId["JiangshiEffect"] = 52] = "JiangshiEffect";
55
+ RuleId[RuleId["InkosazanaEffect"] = 53] = "InkosazanaEffect";
56
+ RuleId[RuleId["ImpunduluEffect"] = 54] = "ImpunduluEffect";
57
+ RuleId[RuleId["WerehyenaEffect"] = 55] = "WerehyenaEffect";
58
+ RuleId[RuleId["WerehyenaCallEffect"] = 56] = "WerehyenaCallEffect";
59
+ RuleId[RuleId["IdloziEffect"] = 57] = "IdloziEffect";
60
+ RuleId[RuleId["FairyEffect"] = 58] = "FairyEffect";
55
61
  })(RuleId = exports.RuleId || (exports.RuleId = {}));
@@ -25,6 +25,31 @@ var __values = (this && this.__values) || function(o) {
25
25
  };
26
26
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
27
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
+ };
28
53
  Object.defineProperty(exports, "__esModule", { value: true });
29
54
  exports.AthenaEffectRule = void 0;
30
55
  var CustomMoveType_1 = require("../../CustomMoveType");
@@ -33,6 +58,7 @@ var LocationType_1 = require("../../material/LocationType");
33
58
  var MaterialType_1 = require("../../material/MaterialType");
34
59
  var Pantheon_1 = require("../../material/Pantheon");
35
60
  var RuleId_1 = require("../RuleId");
61
+ var TriggerEffectsRule_1 = require("./TriggerEffectsRule");
36
62
  var AthenaEffectRule = (function (_super) {
37
63
  __extends(AthenaEffectRule, _super);
38
64
  function AthenaEffectRule() {
@@ -93,9 +119,11 @@ var AthenaEffectRule = (function (_super) {
93
119
  return piles;
94
120
  };
95
121
  AthenaEffectRule.prototype.onCustomMove = function (move) {
122
+ var _a;
96
123
  if (move.type === CustomMoveType_1.CustomMoveType.EndEffect) {
97
124
  var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
98
- return pantheon.updateGrid();
125
+ (_a = new TriggerEffectsRule_1.TriggerEffectsRule(this.game)).triggerEffects.apply(_a, __spreadArray([], __read(pantheon.updateGrid()), false));
126
+ return pantheon.gainBonus();
99
127
  }
100
128
  return [];
101
129
  };
@@ -14,6 +14,31 @@ var __extends = (this && this.__extends) || (function () {
14
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
15
  };
16
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
+ };
17
42
  Object.defineProperty(exports, "__esModule", { value: true });
18
43
  exports.CentaurEffectSacrificeRule = exports.CentaurEffectRule = void 0;
19
44
  var rules_api_1 = require("@gamepark/rules-api");
@@ -24,6 +49,7 @@ var MaterialType_1 = require("../../material/MaterialType");
24
49
  var Pantheon_1 = require("../../material/Pantheon");
25
50
  var Memory_1 = require("../../Memory");
26
51
  var RuleId_1 = require("../RuleId");
52
+ var TriggerEffectsRule_1 = require("./TriggerEffectsRule");
27
53
  var CentaurEffectRule = (function (_super) {
28
54
  __extends(CentaurEffectRule, _super);
29
55
  function CentaurEffectRule() {
@@ -39,10 +65,12 @@ var CentaurEffectRule = (function (_super) {
39
65
  return (0, rules_api_1.areAdjacentSquares)(space, cardLocation);
40
66
  };
41
67
  CentaurEffectRule.prototype.endEffect = function () {
68
+ var _a;
42
69
  var players = this.playersHavingToSacrifice;
43
70
  if (players.length) {
44
71
  var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
45
- return pantheon.updateGrid().concat(this.startSimultaneousRule(RuleId_1.RuleId.CentaurEffectSacrifice, players));
72
+ (_a = new TriggerEffectsRule_1.TriggerEffectsRule(this.game)).triggerEffects.apply(_a, __spreadArray([], __read(pantheon.updateGrid()), false));
73
+ return pantheon.gainBonus().concat(this.startSimultaneousRule(RuleId_1.RuleId.CentaurEffectSacrifice, players));
46
74
  }
47
75
  else {
48
76
  return _super.prototype.endEffect.call(this);
@@ -0,0 +1,10 @@
1
+ import { MaterialMove } from '@gamepark/rules-api';
2
+ import { SacrificeEffectRule } from '../../material/entity/SacrificeEffectRule';
3
+ import { RuleId } from '../RuleId';
4
+ export declare class FairyEffectRule extends SacrificeEffectRule {
5
+ ruleId: RuleId;
6
+ playEffect(): MaterialMove[];
7
+ getCardsToSacrifice(): import("@gamepark/rules-api").Material<number, number, number>;
8
+ onSacrifice(): MaterialMove<number, number, number, number>[];
9
+ onRuleEnd(): never[];
10
+ }