@gamepark/mythologies 0.4.0 → 0.5.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 (89) hide show
  1. package/dist/Memory.d.ts +9 -6
  2. package/dist/Memory.js +9 -6
  3. package/dist/MythologiesRules.d.ts +42 -32
  4. package/dist/MythologiesRules.js +10 -0
  5. package/dist/MythologiesSetup.js +1 -1
  6. package/dist/material/Entity.d.ts +5 -1
  7. package/dist/material/Entity.js +1 -1
  8. package/dist/material/Mythology.d.ts +0 -1
  9. package/dist/material/Mythology.js +1 -3
  10. package/dist/material/Pantheon.d.ts +11 -6
  11. package/dist/material/Pantheon.js +97 -48
  12. package/dist/material/entity/Effect.d.ts +20 -12
  13. package/dist/material/entity/Effect.js +4 -5
  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.d.ts +4 -1
  17. package/dist/material/entity/MoveEffectRule.js +53 -6
  18. package/dist/material/entity/PlaceCardEffectRule.js +4 -27
  19. package/dist/material/entity/SacrificeEffectRule.d.ts +2 -1
  20. package/dist/material/entity/SacrificeEffectRule.js +15 -37
  21. package/dist/material/entity/SimultaneousMoveEffectRule.d.ts +8 -2
  22. package/dist/material/entity/SimultaneousMoveEffectRule.js +43 -11
  23. package/dist/material/entity/SimultaneousSacrificeEffectRule.d.ts +1 -0
  24. package/dist/material/entity/SimultaneousSacrificeEffectRule.js +12 -35
  25. package/dist/material/entity/celtic/Banshee.js +33 -1
  26. package/dist/material/entity/celtic/Brigid.js +34 -1
  27. package/dist/material/entity/celtic/Cernunnos.js +37 -1
  28. package/dist/material/entity/celtic/Dagda.js +43 -1
  29. package/dist/material/entity/celtic/Dullahan.js +7 -1
  30. package/dist/material/entity/celtic/Fairy.d.ts +2 -0
  31. package/dist/material/entity/celtic/Fairy.js +12 -0
  32. package/dist/material/entity/celtic/Kelpie.js +33 -1
  33. package/dist/material/entity/celtic/Leprechaun.js +7 -1
  34. package/dist/material/entity/celtic/Morrigan.js +6 -1
  35. package/dist/material/entity/celtic/Selkie.js +12 -1
  36. package/dist/material/entity/egyptian/Beetle.js +19 -13
  37. package/dist/material/entity/hindu/Naga.js +36 -30
  38. package/dist/material/entity/norse/Troll.js +4 -1
  39. package/dist/material/entity/zulu/Tokoloshe.js +22 -17
  40. package/dist/rules/PlaceCardsRule.js +3 -2
  41. package/dist/rules/RuleId.d.ts +37 -32
  42. package/dist/rules/RuleId.js +37 -32
  43. package/dist/rules/effects/AthenaEffectRule.js +29 -1
  44. package/dist/rules/effects/CentaurEffectRule.d.ts +5 -3
  45. package/dist/rules/effects/CentaurEffectRule.js +90 -14
  46. package/dist/rules/effects/CondorEffectRule.d.ts +1 -1
  47. package/dist/rules/effects/CondorEffectRule.js +5 -1
  48. package/dist/rules/effects/DullahanEffectRule.d.ts +11 -0
  49. package/dist/rules/effects/DullahanEffectRule.js +73 -0
  50. package/dist/rules/effects/FairyEffectRule.d.ts +10 -0
  51. package/dist/rules/effects/FairyEffectRule.js +55 -0
  52. package/dist/rules/effects/FenrirEffectRule.js +2 -1
  53. package/dist/rules/effects/GarudaEffectRule.d.ts +1 -1
  54. package/dist/rules/effects/GarudaEffectRule.js +3 -2
  55. package/dist/rules/effects/GorgonEffectRule.d.ts +1 -1
  56. package/dist/rules/effects/GorgonEffectRule.js +2 -26
  57. package/dist/rules/effects/HadesEffectRule.d.ts +8 -4
  58. package/dist/rules/effects/HadesEffectRule.js +12 -50
  59. package/dist/rules/effects/IdloziEffectRule.d.ts +2 -2
  60. package/dist/rules/effects/IdloziEffectRule.js +4 -1
  61. package/dist/rules/effects/IllapaEffectRule.d.ts +1 -1
  62. package/dist/rules/effects/IllapaEffectRule.js +1 -1
  63. package/dist/rules/effects/JiangshiEffectRule.d.ts +1 -1
  64. package/dist/rules/effects/JiangshiEffectRule.js +6 -27
  65. package/dist/rules/effects/LeprechaunEffectRule.d.ts +9 -0
  66. package/dist/rules/effects/LeprechaunEffectRule.js +49 -0
  67. package/dist/rules/effects/MultipleSimultaneousMoveEffectRule.d.ts +13 -0
  68. package/dist/rules/effects/MultipleSimultaneousMoveEffectRule.js +160 -0
  69. package/dist/rules/effects/PermanentEffectsRule.d.ts +7 -0
  70. package/dist/rules/effects/PermanentEffectsRule.js +54 -0
  71. package/dist/rules/effects/QilinEffectRule.js +6 -5
  72. package/dist/rules/effects/RaEffectRule.d.ts +8 -4
  73. package/dist/rules/effects/RaEffectRule.js +12 -50
  74. package/dist/rules/effects/ResolveEffectsRule.js +1 -1
  75. package/dist/rules/effects/SelkieEffectRule.d.ts +8 -0
  76. package/dist/rules/effects/SelkieEffectRule.js +44 -0
  77. package/dist/rules/effects/ShivaEffectRule.d.ts +2 -2
  78. package/dist/rules/effects/ShivaEffectRule.js +16 -36
  79. package/dist/rules/effects/SphinxEffectRule.d.ts +2 -2
  80. package/dist/rules/effects/SphinxEffectRule.js +4 -1
  81. package/dist/rules/effects/TianlongEffectRule.d.ts +2 -3
  82. package/dist/rules/effects/TianlongEffectRule.js +33 -39
  83. package/dist/rules/effects/TriggerEffectsRule.d.ts +1 -1
  84. package/dist/rules/effects/TriggerEffectsRule.js +36 -18
  85. package/dist/rules/effects/VetalaEffectRule.d.ts +3 -2
  86. package/dist/rules/effects/VetalaEffectRule.js +10 -5
  87. package/dist/rules/effects/ViracochaEffectRule.d.ts +1 -1
  88. package/dist/rules/effects/ViracochaEffectRule.js +2 -26
  89. package/package.json +2 -2
@@ -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.Banshee = void 0;
19
+ var Pantheon_1 = require("../../Pantheon");
20
+ var Effect_1 = require("../Effect");
4
21
  exports.Banshee = {
5
- invoke: [{ gem: 1 }, {}, { favor: 1 }]
22
+ invoke: [{ gem: 1 }, {}, { favor: 1 }],
23
+ effect: {
24
+ trigger: Effect_1.isPlaced,
25
+ rule: (function (_super) {
26
+ __extends(BansheeEffectRule, _super);
27
+ function BansheeEffectRule() {
28
+ return _super !== null && _super.apply(this, arguments) || this;
29
+ }
30
+ BansheeEffectRule.prototype.playEffect = function () {
31
+ var _a = this.card.location, x = _a.x, y = _a.y, player = _a.player;
32
+ var pantheon = new Pantheon_1.Pantheon(this.game, player);
33
+ return pantheon.grid[y].every(function (entity, column) { return column !== x || !entity; }) ? [pantheon.gainFavor(1)] : [];
34
+ };
35
+ return BansheeEffectRule;
36
+ }(Effect_1.AutoEffectRule))
37
+ }
6
38
  };
@@ -1,6 +1,39 @@
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.Brigid = void 0;
19
+ var Entity_1 = require("../../Entity");
20
+ var Pantheon_1 = require("../../Pantheon");
21
+ var Effect_1 = require("../Effect");
4
22
  exports.Brigid = {
5
- invoke: [{ favor: 2 }, { gem: 2 }, {}]
23
+ invoke: [{ favor: 2 }, { gem: 2 }, {}],
24
+ effect: {
25
+ trigger: Effect_1.isPlaced,
26
+ rule: (function (_super) {
27
+ __extends(BrigidEffectRule, _super);
28
+ function BrigidEffectRule() {
29
+ return _super !== null && _super.apply(this, arguments) || this;
30
+ }
31
+ BrigidEffectRule.prototype.playEffect = function () {
32
+ var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
33
+ var gain = pantheon.visibleEntities.id(function (id) { return (0, Entity_1.isCreature)(id.front); }).length;
34
+ return gain ? [pantheon.gainGems(gain)] : [];
35
+ };
36
+ return BrigidEffectRule;
37
+ }(Effect_1.PlayerEffectRule))
38
+ }
6
39
  };
@@ -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.Cernunnos = void 0;
19
+ var Pantheon_1 = require("../../Pantheon");
20
+ var Effect_1 = require("../Effect");
4
21
  exports.Cernunnos = {
5
- invoke: [{}, { favor: 1 }, { gem: 2 }]
22
+ invoke: [{}, { favor: 1 }, { gem: 2 }],
23
+ effect: {
24
+ trigger: Effect_1.isEndOfGame,
25
+ rule: (function (_super) {
26
+ __extends(CernunnosEffectRule, _super);
27
+ function CernunnosEffectRule() {
28
+ return _super !== null && _super.apply(this, arguments) || this;
29
+ }
30
+ CernunnosEffectRule.prototype.playEffect = function () {
31
+ var _this = this;
32
+ var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
33
+ var gems = pantheon.gems;
34
+ var opponents = this.game.players.filter(function (player) { return player !== _this.player; });
35
+ var beatenOpponents = opponents.filter(function (opponent) { return new Pantheon_1.Pantheon(_this.game, opponent).gems < gems; });
36
+ var gain = beatenOpponents.length === opponents.length ? opponents.length + 2 : beatenOpponents.length;
37
+ return gain ? [pantheon.gainFavor(gain)] : [];
38
+ };
39
+ return CernunnosEffectRule;
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.Dagda = void 0;
19
+ var Pantheon_1 = require("../../Pantheon");
20
+ var Effect_1 = require("../Effect");
4
21
  exports.Dagda = {
5
- invoke: [{ gem: 2, favor: 1 }, { favor: 2 }, {}]
22
+ invoke: [{ gem: 2, favor: 1 }, { favor: 2 }, {}],
23
+ effect: {
24
+ trigger: function (event, dagda, game) {
25
+ var player = dagda.getItem().location.player;
26
+ switch (event.type) {
27
+ case Effect_1.TriggerEventType.EntitySacrificed:
28
+ case Effect_1.TriggerEventType.EntityCrushed:
29
+ return event.card.location.player === player && new Pantheon_1.Pantheon(game, player).isOpponentOngoingEffect();
30
+ case Effect_1.TriggerEventType.EntitiesMoved:
31
+ return event.player === player && new Pantheon_1.Pantheon(game, player).isOpponentOngoingEffect();
32
+ default:
33
+ return false;
34
+ }
35
+ },
36
+ rule: (function (_super) {
37
+ __extends(DagdaEffectRule, _super);
38
+ function DagdaEffectRule() {
39
+ return _super !== null && _super.apply(this, arguments) || this;
40
+ }
41
+ DagdaEffectRule.prototype.playEffect = function () {
42
+ var player = this.card.location.player;
43
+ return [new Pantheon_1.Pantheon(this.game, player).gainFavor(1)];
44
+ };
45
+ return DagdaEffectRule;
46
+ }(Effect_1.AutoEffectRule))
47
+ }
6
48
  };
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Dullahan = void 0;
4
+ var DullahanEffectRule_1 = require("../../../rules/effects/DullahanEffectRule");
5
+ var Effect_1 = require("../Effect");
4
6
  exports.Dullahan = {
5
- invoke: [{ gem: 1 }, {}, { gem: 1, favor: 1 }]
7
+ invoke: [{ gem: 1 }, {}, { gem: 1, favor: 1 }],
8
+ effect: {
9
+ trigger: Effect_1.isPlaced,
10
+ rule: DullahanEffectRule_1.DullahanEffectRule
11
+ }
6
12
  };
@@ -0,0 +1,2 @@
1
+ import { EntityDescription } from '../EntityDescription';
2
+ export declare const Fairy: EntityDescription;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Fairy = void 0;
4
+ var FairyEffectRule_1 = require("../../../rules/effects/FairyEffectRule");
5
+ var Effect_1 = require("../Effect");
6
+ exports.Fairy = {
7
+ invoke: [{ favor: 1 }, { gem: 1 }, {}],
8
+ effect: {
9
+ trigger: Effect_1.isPlaced,
10
+ rule: FairyEffectRule_1.FairyEffectRule
11
+ }
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.Kelpie = void 0;
19
+ var Pantheon_1 = require("../../Pantheon");
20
+ var Effect_1 = require("../Effect");
4
21
  exports.Kelpie = {
5
- invoke: [{}, { gem: 1, favor: 1 }, { favor: 1 }]
22
+ invoke: [{}, { gem: 1, favor: 1 }, { favor: 1 }],
23
+ effect: {
24
+ trigger: Effect_1.isPlaced,
25
+ rule: (function (_super) {
26
+ __extends(KelpieEffectRule, _super);
27
+ function KelpieEffectRule() {
28
+ return _super !== null && _super.apply(this, arguments) || this;
29
+ }
30
+ KelpieEffectRule.prototype.playEffect = function () {
31
+ var _a = this.card.location, x = _a.x, player = _a.player;
32
+ var pantheon = new Pantheon_1.Pantheon(this.game, player);
33
+ return pantheon.grid.every(function (line) { return line[x] !== undefined; }) ? [pantheon.gainGems(2)] : [];
34
+ };
35
+ return KelpieEffectRule;
36
+ }(Effect_1.AutoEffectRule))
37
+ }
6
38
  };
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Leprechaun = void 0;
4
+ var LeprechaunEffectRule_1 = require("../../../rules/effects/LeprechaunEffectRule");
5
+ var Effect_1 = require("../Effect");
4
6
  exports.Leprechaun = {
5
- invoke: [{}, { favor: 1 }, {}]
7
+ invoke: [{}, { favor: 1 }, {}],
8
+ effect: {
9
+ trigger: Effect_1.oncePerTurn,
10
+ rule: LeprechaunEffectRule_1.LeprechaunEffectRule
11
+ }
6
12
  };
@@ -2,5 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Morrigan = void 0;
4
4
  exports.Morrigan = {
5
- invoke: [{ favor: 1 }, {}, { favor: 2 }]
5
+ invoke: [{ favor: 1 }, {}, { favor: 2 }],
6
+ effect: {
7
+ preventSacrifice: function (card, effectCard) { return card.location.y === effectCard.location.y; },
8
+ preventMove: function (card, effectCard) { return card.location.y === effectCard.location.y; },
9
+ preventCrush: function (card, effectCard) { return card.location.y === effectCard.location.y; }
10
+ }
6
11
  };
@@ -1,6 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Selkie = void 0;
4
+ var SelkieEffectRule_1 = require("../../../rules/effects/SelkieEffectRule");
5
+ var Effect_1 = require("../Effect");
4
6
  exports.Selkie = {
5
- invoke: [{}, { gem: 2 }, { gem: 1 }]
7
+ invoke: [{}, { gem: 2 }, { gem: 1 }],
8
+ effects: [
9
+ {
10
+ sacrificeInsteadOfMove: true
11
+ },
12
+ {
13
+ trigger: Effect_1.isSacrificed,
14
+ rule: SelkieEffectRule_1.SelkieEffectRule
15
+ }
16
+ ]
6
17
  };
@@ -16,21 +16,27 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.Beetle = void 0;
19
+ var Entity_1 = require("../../Entity");
19
20
  var Pantheon_1 = require("../../Pantheon");
20
21
  var Effect_1 = require("../Effect");
21
22
  exports.Beetle = {
22
23
  invoke: [{ favor: 1 }, { gem: 1 }, {}],
23
- effect: {
24
- trigger: Effect_1.isSacrificed,
25
- rule: (function (_super) {
26
- __extends(BeetleEffectRule, _super);
27
- function BeetleEffectRule() {
28
- return _super !== null && _super.apply(this, arguments) || this;
29
- }
30
- BeetleEffectRule.prototype.playEffect = function () {
31
- return [new Pantheon_1.Pantheon(this.game, this.player).gainGems(2)];
32
- };
33
- return BeetleEffectRule;
34
- }(Effect_1.PlayerEffectRule))
35
- }
24
+ effects: [
25
+ {
26
+ replaceSacrifice: function (card) { return (0, Entity_1.isCreature)(card.id.front); }
27
+ },
28
+ {
29
+ trigger: Effect_1.isSacrificed,
30
+ rule: (function (_super) {
31
+ __extends(BeetleEffectRule, _super);
32
+ function BeetleEffectRule() {
33
+ return _super !== null && _super.apply(this, arguments) || this;
34
+ }
35
+ BeetleEffectRule.prototype.playEffect = function () {
36
+ return [new Pantheon_1.Pantheon(this.game, this.player).gainGems(2)];
37
+ };
38
+ return BeetleEffectRule;
39
+ }(Effect_1.PlayerEffectRule))
40
+ }
41
+ ]
36
42
  };
@@ -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
  };
@@ -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
  };
@@ -21,21 +21,26 @@ var Pantheon_1 = require("../../Pantheon");
21
21
  var Effect_1 = require("../Effect");
22
22
  exports.Tokoloshe = {
23
23
  invoke: [{}, { gem: 3 }, { favor: 2 }],
24
- effect: {
25
- trigger: Effect_1.isEndOfMyTurn,
26
- rule: (function (_super) {
27
- __extends(TokolosheEffectRule, _super);
28
- function TokolosheEffectRule() {
29
- return _super !== null && _super.apply(this, arguments) || this;
30
- }
31
- TokolosheEffectRule.prototype.playEffect = function () {
32
- var _a = this.card.location, x = _a.x, y = _a.y, player = _a.player;
33
- var pantheon = new Pantheon_1.Pantheon(this.game, player);
34
- var creatures = pantheon.visibleEntities.location(function (l) { return l.y === y && l.x !== x; }).id(function (id) { return (0, Entity_1.isCreature)(id.front); });
35
- var loss = Math.min(pantheon.favor, creatures.length);
36
- return loss ? [pantheon.loseFavor(loss)] : [];
37
- };
38
- return TokolosheEffectRule;
39
- }(Effect_1.AutoEffectRule))
40
- }
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
+ ]
41
46
  };
@@ -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,
@@ -21,36 +21,41 @@ export declare enum RuleId {
21
21
  FenrirChoice = 23,
22
22
  FenrirEffect = 24,
23
23
  AlfEffect = 25,
24
- AnubisEffect = 26,
25
- SphinxEffect = 27,
26
- CobraEffect = 28,
27
- CobraInvokeEffect = 29,
28
- BabaiEffect = 30,
29
- BennuEffect = 31,
30
- ShivaEffect = 32,
31
- RakshasaEffect = 33,
32
- GarudaEffect = 34,
33
- VetalaEffect = 35,
34
- KinnaraEffect = 36,
35
- KinnaraPlaceEffect = 37,
36
- ViracochaEffect = 38,
37
- IllapaEffect = 39,
38
- IllapaSacrifice = 40,
39
- CaimanEffect = 41,
40
- CondorEffect = 42,
41
- SupayEffect = 43,
42
- UkukuEffect = 44,
43
- UkukuPlaceEffect = 45,
44
- YanluoWangEffect = 46,
45
- NuwaEffect = 47,
46
- TianlongEffect = 48,
47
- TianlongOpponentsEffect = 49,
48
- QilinEffect = 50,
49
- FenghuangEffect = 51,
50
- JiangshiEffect = 52,
51
- InkosazanaEffect = 53,
52
- ImpunduluEffect = 54,
53
- WerehyenaEffect = 55,
54
- WerehyenaCallEffect = 56,
55
- IdloziEffect = 57
24
+ RaEffect = 26,
25
+ AnubisEffect = 27,
26
+ SphinxEffect = 28,
27
+ CobraEffect = 29,
28
+ CobraInvokeEffect = 30,
29
+ BabaiEffect = 31,
30
+ BennuEffect = 32,
31
+ ShivaEffect = 33,
32
+ RakshasaEffect = 34,
33
+ GarudaEffect = 35,
34
+ VetalaEffect = 36,
35
+ KinnaraEffect = 37,
36
+ KinnaraPlaceEffect = 38,
37
+ ViracochaEffect = 39,
38
+ IllapaEffect = 40,
39
+ IllapaSacrifice = 41,
40
+ CaimanEffect = 42,
41
+ CondorEffect = 43,
42
+ SupayEffect = 44,
43
+ UkukuEffect = 45,
44
+ UkukuPlaceEffect = 46,
45
+ YanluoWangEffect = 47,
46
+ NuwaEffect = 48,
47
+ TianlongEffect = 49,
48
+ TianlongOpponentsEffect = 50,
49
+ QilinEffect = 51,
50
+ FenghuangEffect = 52,
51
+ JiangshiEffect = 53,
52
+ InkosazanaEffect = 54,
53
+ ImpunduluEffect = 55,
54
+ WerehyenaEffect = 56,
55
+ WerehyenaCallEffect = 57,
56
+ IdloziEffect = 58,
57
+ FairyEffect = 59,
58
+ LeprechaunEffect = 60,
59
+ SelkieEffect = 61,
60
+ DullahanEffect = 62
56
61
  }
@@ -25,36 +25,41 @@ var RuleId;
25
25
  RuleId[RuleId["FenrirChoice"] = 23] = "FenrirChoice";
26
26
  RuleId[RuleId["FenrirEffect"] = 24] = "FenrirEffect";
27
27
  RuleId[RuleId["AlfEffect"] = 25] = "AlfEffect";
28
- RuleId[RuleId["AnubisEffect"] = 26] = "AnubisEffect";
29
- RuleId[RuleId["SphinxEffect"] = 27] = "SphinxEffect";
30
- RuleId[RuleId["CobraEffect"] = 28] = "CobraEffect";
31
- RuleId[RuleId["CobraInvokeEffect"] = 29] = "CobraInvokeEffect";
32
- RuleId[RuleId["BabaiEffect"] = 30] = "BabaiEffect";
33
- RuleId[RuleId["BennuEffect"] = 31] = "BennuEffect";
34
- RuleId[RuleId["ShivaEffect"] = 32] = "ShivaEffect";
35
- RuleId[RuleId["RakshasaEffect"] = 33] = "RakshasaEffect";
36
- RuleId[RuleId["GarudaEffect"] = 34] = "GarudaEffect";
37
- RuleId[RuleId["VetalaEffect"] = 35] = "VetalaEffect";
38
- RuleId[RuleId["KinnaraEffect"] = 36] = "KinnaraEffect";
39
- RuleId[RuleId["KinnaraPlaceEffect"] = 37] = "KinnaraPlaceEffect";
40
- RuleId[RuleId["ViracochaEffect"] = 38] = "ViracochaEffect";
41
- RuleId[RuleId["IllapaEffect"] = 39] = "IllapaEffect";
42
- RuleId[RuleId["IllapaSacrifice"] = 40] = "IllapaSacrifice";
43
- RuleId[RuleId["CaimanEffect"] = 41] = "CaimanEffect";
44
- RuleId[RuleId["CondorEffect"] = 42] = "CondorEffect";
45
- RuleId[RuleId["SupayEffect"] = 43] = "SupayEffect";
46
- RuleId[RuleId["UkukuEffect"] = 44] = "UkukuEffect";
47
- RuleId[RuleId["UkukuPlaceEffect"] = 45] = "UkukuPlaceEffect";
48
- RuleId[RuleId["YanluoWangEffect"] = 46] = "YanluoWangEffect";
49
- RuleId[RuleId["NuwaEffect"] = 47] = "NuwaEffect";
50
- RuleId[RuleId["TianlongEffect"] = 48] = "TianlongEffect";
51
- RuleId[RuleId["TianlongOpponentsEffect"] = 49] = "TianlongOpponentsEffect";
52
- RuleId[RuleId["QilinEffect"] = 50] = "QilinEffect";
53
- RuleId[RuleId["FenghuangEffect"] = 51] = "FenghuangEffect";
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";
28
+ RuleId[RuleId["RaEffect"] = 26] = "RaEffect";
29
+ RuleId[RuleId["AnubisEffect"] = 27] = "AnubisEffect";
30
+ RuleId[RuleId["SphinxEffect"] = 28] = "SphinxEffect";
31
+ RuleId[RuleId["CobraEffect"] = 29] = "CobraEffect";
32
+ RuleId[RuleId["CobraInvokeEffect"] = 30] = "CobraInvokeEffect";
33
+ RuleId[RuleId["BabaiEffect"] = 31] = "BabaiEffect";
34
+ RuleId[RuleId["BennuEffect"] = 32] = "BennuEffect";
35
+ RuleId[RuleId["ShivaEffect"] = 33] = "ShivaEffect";
36
+ RuleId[RuleId["RakshasaEffect"] = 34] = "RakshasaEffect";
37
+ RuleId[RuleId["GarudaEffect"] = 35] = "GarudaEffect";
38
+ RuleId[RuleId["VetalaEffect"] = 36] = "VetalaEffect";
39
+ RuleId[RuleId["KinnaraEffect"] = 37] = "KinnaraEffect";
40
+ RuleId[RuleId["KinnaraPlaceEffect"] = 38] = "KinnaraPlaceEffect";
41
+ RuleId[RuleId["ViracochaEffect"] = 39] = "ViracochaEffect";
42
+ RuleId[RuleId["IllapaEffect"] = 40] = "IllapaEffect";
43
+ RuleId[RuleId["IllapaSacrifice"] = 41] = "IllapaSacrifice";
44
+ RuleId[RuleId["CaimanEffect"] = 42] = "CaimanEffect";
45
+ RuleId[RuleId["CondorEffect"] = 43] = "CondorEffect";
46
+ RuleId[RuleId["SupayEffect"] = 44] = "SupayEffect";
47
+ RuleId[RuleId["UkukuEffect"] = 45] = "UkukuEffect";
48
+ RuleId[RuleId["UkukuPlaceEffect"] = 46] = "UkukuPlaceEffect";
49
+ RuleId[RuleId["YanluoWangEffect"] = 47] = "YanluoWangEffect";
50
+ RuleId[RuleId["NuwaEffect"] = 48] = "NuwaEffect";
51
+ RuleId[RuleId["TianlongEffect"] = 49] = "TianlongEffect";
52
+ RuleId[RuleId["TianlongOpponentsEffect"] = 50] = "TianlongOpponentsEffect";
53
+ RuleId[RuleId["QilinEffect"] = 51] = "QilinEffect";
54
+ RuleId[RuleId["FenghuangEffect"] = 52] = "FenghuangEffect";
55
+ RuleId[RuleId["JiangshiEffect"] = 53] = "JiangshiEffect";
56
+ RuleId[RuleId["InkosazanaEffect"] = 54] = "InkosazanaEffect";
57
+ RuleId[RuleId["ImpunduluEffect"] = 55] = "ImpunduluEffect";
58
+ RuleId[RuleId["WerehyenaEffect"] = 56] = "WerehyenaEffect";
59
+ RuleId[RuleId["WerehyenaCallEffect"] = 57] = "WerehyenaCallEffect";
60
+ RuleId[RuleId["IdloziEffect"] = 58] = "IdloziEffect";
61
+ RuleId[RuleId["FairyEffect"] = 59] = "FairyEffect";
62
+ RuleId[RuleId["LeprechaunEffect"] = 60] = "LeprechaunEffect";
63
+ RuleId[RuleId["SelkieEffect"] = 61] = "SelkieEffect";
64
+ RuleId[RuleId["DullahanEffect"] = 62] = "DullahanEffect";
60
65
  })(RuleId = exports.RuleId || (exports.RuleId = {}));