@gamepark/mythologies 0.4.1 → 0.5.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 (71) hide show
  1. package/dist/Memory.d.ts +6 -11
  2. package/dist/Memory.js +6 -11
  3. package/dist/MythologiesRules.d.ts +41 -33
  4. package/dist/MythologiesRules.js +8 -0
  5. package/dist/MythologiesSetup.js +1 -1
  6. package/dist/material/Mythology.d.ts +0 -1
  7. package/dist/material/Mythology.js +1 -3
  8. package/dist/material/Pantheon.d.ts +1 -0
  9. package/dist/material/Pantheon.js +8 -2
  10. package/dist/material/entity/Effect.d.ts +9 -8
  11. package/dist/material/entity/Effect.js +5 -8
  12. package/dist/material/entity/MoveEffectRule.d.ts +4 -1
  13. package/dist/material/entity/MoveEffectRule.js +24 -5
  14. package/dist/material/entity/PlaceCardEffectRule.js +4 -27
  15. package/dist/material/entity/SacrificeEffectRule.d.ts +1 -1
  16. package/dist/material/entity/SacrificeEffectRule.js +2 -1
  17. package/dist/material/entity/SimultaneousMoveEffectRule.d.ts +8 -2
  18. package/dist/material/entity/SimultaneousMoveEffectRule.js +34 -6
  19. package/dist/material/entity/celtic/Dullahan.js +7 -1
  20. package/dist/material/entity/celtic/Leprechaun.js +7 -1
  21. package/dist/material/entity/celtic/Selkie.js +12 -1
  22. package/dist/material/entity/chinese/ChangE.js +5 -4
  23. package/dist/material/entity/greek/Poseidon.js +2 -2
  24. package/dist/rules/PlaceTokenRule.js +1 -1
  25. package/dist/rules/RuleId.d.ts +37 -33
  26. package/dist/rules/RuleId.js +37 -33
  27. package/dist/rules/effects/AnubisEffectRule.js +3 -3
  28. package/dist/rules/effects/CentaurEffectRule.d.ts +5 -3
  29. package/dist/rules/effects/CentaurEffectRule.js +64 -16
  30. package/dist/rules/effects/CondorEffectRule.d.ts +1 -1
  31. package/dist/rules/effects/CondorEffectRule.js +5 -1
  32. package/dist/rules/effects/DullahanEffectRule.d.ts +11 -0
  33. package/dist/rules/effects/DullahanEffectRule.js +73 -0
  34. package/dist/rules/effects/FairyEffectRule.js +4 -4
  35. package/dist/rules/effects/FenrirEffectRule.js +5 -4
  36. package/dist/rules/effects/GarudaEffectRule.d.ts +1 -1
  37. package/dist/rules/effects/GarudaEffectRule.js +6 -5
  38. package/dist/rules/effects/GorgonEffectRule.d.ts +1 -1
  39. package/dist/rules/effects/GorgonEffectRule.js +2 -26
  40. package/dist/rules/effects/HadesEffectRule.d.ts +8 -4
  41. package/dist/rules/effects/HadesEffectRule.js +12 -50
  42. package/dist/rules/effects/IdloziEffectRule.d.ts +2 -2
  43. package/dist/rules/effects/IdloziEffectRule.js +4 -1
  44. package/dist/rules/effects/IllapaEffectRule.d.ts +1 -1
  45. package/dist/rules/effects/IllapaEffectRule.js +3 -3
  46. package/dist/rules/effects/InkosazanaEffectRule.js +3 -3
  47. package/dist/rules/effects/JiangshiEffectRule.d.ts +1 -1
  48. package/dist/rules/effects/JiangshiEffectRule.js +2 -26
  49. package/dist/rules/effects/LeprechaunEffectRule.d.ts +9 -0
  50. package/dist/rules/effects/LeprechaunEffectRule.js +49 -0
  51. package/dist/rules/effects/MultipleSimultaneousMoveEffectRule.d.ts +13 -0
  52. package/dist/rules/effects/MultipleSimultaneousMoveEffectRule.js +160 -0
  53. package/dist/rules/effects/NuwaEffectRule.js +4 -4
  54. package/dist/rules/effects/OdinEffectRule.js +2 -2
  55. package/dist/rules/effects/RaEffectRule.d.ts +8 -4
  56. package/dist/rules/effects/RaEffectRule.js +12 -50
  57. package/dist/rules/effects/SelkieEffectRule.d.ts +8 -0
  58. package/dist/rules/effects/SelkieEffectRule.js +44 -0
  59. package/dist/rules/effects/ShivaEffectRule.d.ts +2 -2
  60. package/dist/rules/effects/ShivaEffectRule.js +8 -32
  61. package/dist/rules/effects/SphinxEffectRule.d.ts +2 -2
  62. package/dist/rules/effects/SphinxEffectRule.js +4 -1
  63. package/dist/rules/effects/TianlongEffectRule.d.ts +2 -3
  64. package/dist/rules/effects/TianlongEffectRule.js +36 -42
  65. package/dist/rules/effects/TriggerEffectsRule.js +3 -0
  66. package/dist/rules/effects/VetalaEffectRule.d.ts +3 -2
  67. package/dist/rules/effects/VetalaEffectRule.js +10 -5
  68. package/dist/rules/effects/ViracochaEffectRule.d.ts +1 -1
  69. package/dist/rules/effects/ViracochaEffectRule.js +2 -26
  70. package/dist/rules/effects/YanluoWangEffectRule.js +3 -3
  71. package/package.json +2 -2
@@ -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
  };
@@ -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
  };
@@ -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
  };
@@ -23,9 +23,10 @@ exports.ChangE = {
23
23
  invoke: [{ gem: 1, favor: 2 }, { gem: 2 }, {}],
24
24
  effect: {
25
25
  trigger: function (event, card) {
26
- return (event.type === Effect_1.TriggerEventType.EntityInvoked &&
27
- card.getItem().location.player !== event.cardLocation.player &&
28
- card.getItem().location.y === event.cardLocation.y);
26
+ return (event.type === Effect_1.TriggerEventType.EntityPlaced &&
27
+ event.invoked &&
28
+ card.getItem().location.player !== event.location.player &&
29
+ card.getItem().location.y === event.location.y);
29
30
  },
30
31
  rule: (function (_super) {
31
32
  __extends(ChangeEEffectRule, _super);
@@ -33,7 +34,7 @@ exports.ChangE = {
33
34
  return _super !== null && _super.apply(this, arguments) || this;
34
35
  }
35
36
  ChangeEEffectRule.prototype.playEffect = function () {
36
- var playerInvoked = this.getEffect().triggerEvent.cardLocation.player;
37
+ var playerInvoked = this.getEffect().triggerEvent.location.player;
37
38
  var gems = this.material(MaterialType_1.MaterialType.GemToken).location(LocationType_1.LocationType.PlayerGems).player(playerInvoked);
38
39
  return gems.getQuantity() > 0 ? [gems.moveItem({ type: LocationType_1.LocationType.PlayerGems, player: this.player }, 1)] : [];
39
40
  };
@@ -25,7 +25,7 @@ exports.Poseidon = {
25
25
  invoke: [{ gem: 1 }, { gem: 2, favor: 1 }, { favor: 1 }],
26
26
  effect: {
27
27
  trigger: function (event, card) {
28
- return event.type === Effect_1.TriggerEventType.EntityInvoked && (0, Entity_1.isGod)(event.entity) && event.cardLocation.player === card.getItem().location.player;
28
+ return event.type === Effect_1.TriggerEventType.EntityPlaced && event.invoked && (0, Entity_1.isGod)(event.entity) && event.location.player === card.getItem().location.player;
29
29
  },
30
30
  rule: (function (_super) {
31
31
  __extends(PoseidonEffectRule, _super);
@@ -33,7 +33,7 @@ exports.Poseidon = {
33
33
  return _super !== null && _super.apply(this, arguments) || this;
34
34
  }
35
35
  PoseidonEffectRule.prototype.playEffect = function () {
36
- var cardLocation = this.remind(Memory_1.Memory.OngoingEffect).triggerEvent.cardLocation;
36
+ var cardLocation = this.remind(Memory_1.Memory.OngoingEffect).triggerEvent.location;
37
37
  var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
38
38
  var gain = pantheon.visibleEntities.location(function (l) { return (0, rules_api_1.areAdjacentSquares)(l, cardLocation); }).length;
39
39
  return gain > 0 ? [pantheon.gainFavor(gain)] : [];
@@ -97,7 +97,7 @@ var PlaceTokenRule = (function (_super) {
97
97
  PlaceTokenRule.prototype.getAvailableCards = function (player) {
98
98
  var destiny = new Destiny_1.Destiny(this.game);
99
99
  var mythology = destiny.getMythology(player);
100
- if (this.remind(Memory_1.Memory.OdinTargetMythology) === mythology && !new Pantheon_1.Pantheon(this.game, player).hasEntity(Entity_1.Entity.Odin)) {
100
+ if (this.remind(Memory_1.Memory.TargetMythology) === mythology && !new Pantheon_1.Pantheon(this.game, player).hasEntity(Entity_1.Entity.Odin)) {
101
101
  return [this.getTopDeckCreature(mythology)];
102
102
  }
103
103
  var entities = destiny.getAvailableEntities(player);
@@ -21,37 +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,
56
- FairyEffect = 58
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
57
61
  }
@@ -25,37 +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";
60
- RuleId[RuleId["FairyEffect"] = 58] = "FairyEffect";
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";
61
65
  })(RuleId = exports.RuleId || (exports.RuleId = {}));
@@ -29,12 +29,12 @@ var AnubisEffectRule = (function (_super) {
29
29
  return _this;
30
30
  }
31
31
  AnubisEffectRule.prototype.onRuleStart = function () {
32
- if (!this.remind(Memory_1.Memory.AnubisInvoke1)) {
32
+ if (!this.remind(Memory_1.Memory.EffectCount)) {
33
33
  this.remind(Memory_1.Memory.PendingEffects).unshift([this.getEffect()]);
34
- this.memorize(Memory_1.Memory.AnubisInvoke1, true);
34
+ this.memorize(Memory_1.Memory.EffectCount, true);
35
35
  }
36
36
  else {
37
- this.forget(Memory_1.Memory.AnubisInvoke1);
37
+ this.forget(Memory_1.Memory.EffectCount);
38
38
  }
39
39
  return _super.prototype.onRuleStart.call(this);
40
40
  };
@@ -1,4 +1,4 @@
1
- import { Location, Material, XYCoordinates } from '@gamepark/rules-api';
1
+ import { ItemMove, Location, Material, MaterialMove, MoveItem, XYCoordinates } from '@gamepark/rules-api';
2
2
  import { MoveEffectRule } from '../../material/entity/MoveEffectRule';
3
3
  import { SimultaneousSacrificeEffectRule } from '../../material/entity/SimultaneousSacrificeEffectRule';
4
4
  import { PlayerColor } from '../../PlayerColor';
@@ -7,8 +7,10 @@ export declare class CentaurEffectRule extends MoveEffectRule {
7
7
  ruleId: RuleId;
8
8
  getMovingCards(effectCardIndex?: number): Material;
9
9
  isLegalDestination(space: XYCoordinates, cardLocation: Location): boolean;
10
- endEffect(): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
11
- get playersHavingToSacrifice(): number[];
10
+ onCardMoved(): never[];
11
+ onCardSacrificed(move: MoveItem): MaterialMove<number, number, number, number>[];
12
+ afterItemMove(move: ItemMove): MaterialMove<number, number, number, number>[];
13
+ startSacrificeEffect(): MaterialMove<number, number, number, number>[];
12
14
  }
13
15
  export declare class CentaurEffectSacrificeRule extends SimultaneousSacrificeEffectRule {
14
16
  getCardsToSacrifice(player: PlayerColor): Material;
@@ -39,12 +39,25 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
39
39
  }
40
40
  return to.concat(ar || Array.prototype.slice.call(from));
41
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
+ };
42
53
  Object.defineProperty(exports, "__esModule", { value: true });
43
54
  exports.CentaurEffectSacrificeRule = exports.CentaurEffectRule = void 0;
44
55
  var rules_api_1 = require("@gamepark/rules-api");
56
+ var CustomMoveType_1 = require("../../CustomMoveType");
45
57
  var Entity_1 = require("../../material/Entity");
46
58
  var MoveEffectRule_1 = require("../../material/entity/MoveEffectRule");
47
59
  var SimultaneousSacrificeEffectRule_1 = require("../../material/entity/SimultaneousSacrificeEffectRule");
60
+ var LocationType_1 = require("../../material/LocationType");
48
61
  var MaterialType_1 = require("../../material/MaterialType");
49
62
  var Pantheon_1 = require("../../material/Pantheon");
50
63
  var Memory_1 = require("../../Memory");
@@ -64,26 +77,61 @@ var CentaurEffectRule = (function (_super) {
64
77
  CentaurEffectRule.prototype.isLegalDestination = function (space, cardLocation) {
65
78
  return (0, rules_api_1.areAdjacentSquares)(space, cardLocation);
66
79
  };
67
- CentaurEffectRule.prototype.endEffect = function () {
68
- var _a;
69
- var players = this.playersHavingToSacrifice;
70
- if (players.length) {
71
- var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
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));
80
+ CentaurEffectRule.prototype.onCardMoved = function () {
81
+ return [];
82
+ };
83
+ CentaurEffectRule.prototype.onCardSacrificed = function (move) {
84
+ _super.prototype.onCardSacrificed.call(this, move);
85
+ if (!this.remind(Memory_1.Memory.EntityMoved, this.player)) {
86
+ this.memorize(Memory_1.Memory.EntityMoved, true, this.player);
87
+ return this.startSacrificeEffect();
88
+ }
89
+ return [];
90
+ };
91
+ CentaurEffectRule.prototype.afterItemMove = function (move) {
92
+ if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.EntityCard)(move) && move.location.type === LocationType_1.LocationType.Pantheon) {
93
+ return this.startSacrificeEffect();
94
+ }
95
+ return [];
96
+ };
97
+ CentaurEffectRule.prototype.startSacrificeEffect = function () {
98
+ var _a, e_1, _b;
99
+ var _this = this;
100
+ var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
101
+ (_a = new TriggerEffectsRule_1.TriggerEffectsRule(this.game)).triggerEffects.apply(_a, __spreadArray([], __read(pantheon.updateGrid()), false));
102
+ var centaur = this.getEffect().cardIndex;
103
+ var centaurLine = this.material(MaterialType_1.MaterialType.EntityCard).getItem(centaur).location.y;
104
+ var moves = pantheon.gainBonus();
105
+ var sacrificingPlayers = this.game.players.filter(function (player) { return new Pantheon_1.Pantheon(_this.game, player).visibleEntities.index(function (index) { return index !== centaur; }).location(function (l) { return l.y === centaurLine; }).length > 0; });
106
+ var playersToActivate = [];
107
+ var sacrificeRule = new CentaurEffectSacrificeRule(this.game);
108
+ try {
109
+ for (var sacrificingPlayers_1 = __values(sacrificingPlayers), sacrificingPlayers_1_1 = sacrificingPlayers_1.next(); !sacrificingPlayers_1_1.done; sacrificingPlayers_1_1 = sacrificingPlayers_1.next()) {
110
+ var player = sacrificingPlayers_1_1.value;
111
+ var legalMoves = sacrificeRule.getActivePlayerLegalMoves(player);
112
+ if (legalMoves.length === 1) {
113
+ moves.push(legalMoves[0]);
114
+ }
115
+ else {
116
+ playersToActivate.push(player);
117
+ }
118
+ }
119
+ }
120
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
121
+ finally {
122
+ try {
123
+ if (sacrificingPlayers_1_1 && !sacrificingPlayers_1_1.done && (_b = sacrificingPlayers_1.return)) _b.call(sacrificingPlayers_1);
124
+ }
125
+ finally { if (e_1) throw e_1.error; }
126
+ }
127
+ if (playersToActivate.length) {
128
+ moves.push(this.startSimultaneousRule(RuleId_1.RuleId.CentaurEffectSacrifice, playersToActivate));
74
129
  }
75
130
  else {
76
- return _super.prototype.endEffect.call(this);
131
+ moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
77
132
  }
133
+ return moves;
78
134
  };
79
- Object.defineProperty(CentaurEffectRule.prototype, "playersHavingToSacrifice", {
80
- get: function () {
81
- var _this = this;
82
- return this.game.players.filter(function (player) { return new Pantheon_1.Pantheon(_this.game, player).grid[_this.card.location.y].filter(Entity_1.isCreature).length > (player === _this.player ? 1 : 0); });
83
- },
84
- enumerable: false,
85
- configurable: true
86
- });
87
135
  return CentaurEffectRule;
88
136
  }(MoveEffectRule_1.MoveEffectRule));
89
137
  exports.CentaurEffectRule = CentaurEffectRule;
@@ -4,5 +4,5 @@ import { RuleId } from '../RuleId';
4
4
  export declare class CondorEffectRule extends SacrificeEffectRule {
5
5
  ruleId: RuleId;
6
6
  getCardsToSacrifice(): import("@gamepark/rules-api").Material<number, number, number>;
7
- onSacrifice(move: MoveItem): MaterialMove[];
7
+ onSacrifice(move: MoveItem): MaterialMove<number, number, number, number>[];
8
8
  }
@@ -17,6 +17,7 @@ var __extends = (this && this.__extends) || (function () {
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.CondorEffectRule = void 0;
19
19
  var rules_api_1 = require("@gamepark/rules-api");
20
+ var CustomMoveType_1 = require("../../CustomMoveType");
20
21
  var SacrificeEffectRule_1 = require("../../material/entity/SacrificeEffectRule");
21
22
  var MaterialType_1 = require("../../material/MaterialType");
22
23
  var Pantheon_1 = require("../../material/Pantheon");
@@ -34,7 +35,10 @@ var CondorEffectRule = (function (_super) {
34
35
  };
35
36
  CondorEffectRule.prototype.onSacrifice = function (move) {
36
37
  var entity = this.material(MaterialType_1.MaterialType.EntityCard).getItem(move.itemIndex);
37
- return new Pantheon_1.Pantheon(this.game, this.player).getInvokeGains(entity.id.front, entity.location.y).concat(this.endEffect());
38
+ var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
39
+ var moves = pantheon.getInvokeGains(entity.id.front, entity.location.y);
40
+ moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
41
+ return moves;
38
42
  };
39
43
  return CondorEffectRule;
40
44
  }(SacrificeEffectRule_1.SacrificeEffectRule));
@@ -0,0 +1,11 @@
1
+ import { Location, MaterialMove, MoveItem, XYCoordinates } from '@gamepark/rules-api';
2
+ import { MoveEffectRule } from '../../material/entity/MoveEffectRule';
3
+ import { RuleId } from '../RuleId';
4
+ export declare class DullahanEffectRule extends MoveEffectRule {
5
+ ruleId: RuleId;
6
+ onRuleStart(): MaterialMove<number, number, number, number>[];
7
+ getTargetEntities(): import("@gamepark/rules-api").Material<number, number, number>;
8
+ isLegalDestination(space: XYCoordinates, cardLocation: Location): boolean;
9
+ onCardMoved(move: MoveItem): MaterialMove<number, number, number, number>[];
10
+ onRuleEnd(): never[];
11
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.DullahanEffectRule = void 0;
19
+ var CustomMoveType_1 = require("../../CustomMoveType");
20
+ var MoveEffectRule_1 = require("../../material/entity/MoveEffectRule");
21
+ var Pantheon_1 = require("../../material/Pantheon");
22
+ var Memory_1 = require("../../Memory");
23
+ var RuleId_1 = require("../RuleId");
24
+ var DullahanEffectRule = (function (_super) {
25
+ __extends(DullahanEffectRule, _super);
26
+ function DullahanEffectRule() {
27
+ var _this = _super !== null && _super.apply(this, arguments) || this;
28
+ _this.ruleId = RuleId_1.RuleId.DullahanEffect;
29
+ return _this;
30
+ }
31
+ DullahanEffectRule.prototype.onRuleStart = function () {
32
+ var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
33
+ var targetEntitiesAbleToMove = this.getTargetEntities()
34
+ .filter(function (item) { return pantheon.isAbleToMove(item); })
35
+ .getIndexes();
36
+ if (targetEntitiesAbleToMove.length === 0) {
37
+ return [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
38
+ }
39
+ this.memorize(Memory_1.Memory.TargetEntities, targetEntitiesAbleToMove);
40
+ this.memorize(Memory_1.Memory.EffectCount, targetEntitiesAbleToMove.length);
41
+ var moves = this.getPlayerMoves();
42
+ if (moves.length === targetEntitiesAbleToMove.length) {
43
+ return moves;
44
+ }
45
+ return [];
46
+ };
47
+ DullahanEffectRule.prototype.getTargetEntities = function () {
48
+ return new Pantheon_1.Pantheon(this.game, this.player).visibleEntities.location(function (l) { return l.y === 1; });
49
+ };
50
+ DullahanEffectRule.prototype.isLegalDestination = function (space, cardLocation) {
51
+ return cardLocation.x === space.x && cardLocation.y === space.y - 1;
52
+ };
53
+ DullahanEffectRule.prototype.onCardMoved = function (move) {
54
+ var moves = [];
55
+ var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
56
+ if (pantheon.visibleEntities.location(function (l) { return l.x === move.location.x && l.y === move.location.y; }).length > 0) {
57
+ moves.push(pantheon.gainGems(1));
58
+ }
59
+ this.memorize(Memory_1.Memory.TargetEntities, function (entities) { return entities.filter(function (index) { return index !== move.itemIndex; }); });
60
+ var count = this.memorize(Memory_1.Memory.EffectCount, function (count) { return count - 1; });
61
+ if (count === 0) {
62
+ moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
63
+ }
64
+ return moves;
65
+ };
66
+ DullahanEffectRule.prototype.onRuleEnd = function () {
67
+ this.forget(Memory_1.Memory.TargetEntities);
68
+ this.forget(Memory_1.Memory.EffectCount);
69
+ return _super.prototype.onRuleEnd.call(this);
70
+ };
71
+ return DullahanEffectRule;
72
+ }(MoveEffectRule_1.MoveEffectRule));
73
+ exports.DullahanEffectRule = DullahanEffectRule;
@@ -32,22 +32,22 @@ var FairyEffectRule = (function (_super) {
32
32
  FairyEffectRule.prototype.playEffect = function () {
33
33
  var _a = this.card.location, x = _a.x, y = _a.y;
34
34
  var targets = new Pantheon_1.Pantheon(this.game, this.player).visibleEntities.location(function (l) { return l.y === y && l.x !== x; }).sort(function (item) { return item.location.x; }).getIndexes();
35
- this.memorize(Memory_1.Memory.FairyTargets, targets);
35
+ this.memorize(Memory_1.Memory.TargetEntities, targets);
36
36
  return _super.prototype.playEffect.call(this);
37
37
  };
38
38
  FairyEffectRule.prototype.getCardsToSacrifice = function () {
39
- return this.material(MaterialType_1.MaterialType.EntityCard).index(this.remind(Memory_1.Memory.FairyTargets)[0]);
39
+ return this.material(MaterialType_1.MaterialType.EntityCard).index(this.remind(Memory_1.Memory.TargetEntities)[0]);
40
40
  };
41
41
  FairyEffectRule.prototype.onSacrifice = function () {
42
42
  var moves = [new Pantheon_1.Pantheon(this.game, this.player).gainGems(2)];
43
- var targets = this.memorize(Memory_1.Memory.FairyTargets, function (targets) { return targets.slice(1); });
43
+ var targets = this.memorize(Memory_1.Memory.TargetEntities, function (targets) { return targets.slice(1); });
44
44
  if (!targets.length) {
45
45
  moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
46
46
  }
47
47
  return moves;
48
48
  };
49
49
  FairyEffectRule.prototype.onRuleEnd = function () {
50
- this.forget(Memory_1.Memory.FairyTargets);
50
+ this.forget(Memory_1.Memory.TargetEntities);
51
51
  return [];
52
52
  };
53
53
  return FairyEffectRule;
@@ -28,6 +28,7 @@ var __values = (this && this.__values) || function(o) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.FenrirEffectRule = exports.FenrirChoiceRule = void 0;
30
30
  var rules_api_1 = require("@gamepark/rules-api");
31
+ var CustomMoveType_1 = require("../../CustomMoveType");
31
32
  var Effect_1 = require("../../material/entity/Effect");
32
33
  var MaterialType_1 = require("../../material/MaterialType");
33
34
  var Pantheon_1 = require("../../material/Pantheon");
@@ -41,7 +42,7 @@ var FenrirChoiceRule = (function (_super) {
41
42
  return _this;
42
43
  }
43
44
  FenrirChoiceRule.prototype.getPlayerMoves = function () {
44
- var moves = this.endEffect();
45
+ var moves = [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
45
46
  var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
46
47
  if (pantheon.gems && this.getAffectedPlayers().length) {
47
48
  moves.push(pantheon.spendGems(1));
@@ -114,8 +115,8 @@ var FenrirEffectRule = (function (_super) {
114
115
  FenrirEffectRule.prototype.beforeItemMove = function (move) {
115
116
  if ((0, rules_api_1.isDeleteItem)(move)) {
116
117
  var player = this.material(move.itemType).getItem(move.itemIndex).location.player;
117
- if (!this.remind(Memory_1.Memory.FenrirPaid1, player)) {
118
- this.memorize(Memory_1.Memory.FenrirPaid1, true, player);
118
+ if (!this.remind(Memory_1.Memory.EffectCount, player)) {
119
+ this.memorize(Memory_1.Memory.EffectCount, true, player);
119
120
  }
120
121
  else {
121
122
  return [this.endPlayerTurn(player)];
@@ -124,7 +125,7 @@ var FenrirEffectRule = (function (_super) {
124
125
  return [];
125
126
  };
126
127
  FenrirEffectRule.prototype.onRuleEnd = function () {
127
- this.forget(Memory_1.Memory.FenrirPaid1);
128
+ this.forget(Memory_1.Memory.EffectCount);
128
129
  return [];
129
130
  };
130
131
  return FenrirEffectRule;
@@ -5,5 +5,5 @@ export declare class GarudaEffectRule extends SacrificeEffectRule {
5
5
  ruleId: RuleId;
6
6
  onRuleStart(): MaterialMove<number, number, number, number>[];
7
7
  getCardsToSacrifice(): import("@gamepark/rules-api").Material<number, number, number>;
8
- onSacrifice(): MaterialMove<number, number, number, number>[];
8
+ onSacrifice(): import("@gamepark/rules-api").CustomMove<number>[];
9
9
  }
@@ -41,6 +41,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
41
41
  };
42
42
  Object.defineProperty(exports, "__esModule", { value: true });
43
43
  exports.GarudaEffectRule = void 0;
44
+ var CustomMoveType_1 = require("../../CustomMoveType");
44
45
  var Entity_1 = require("../../material/Entity");
45
46
  var SacrificeEffectRule_1 = require("../../material/entity/SacrificeEffectRule");
46
47
  var Pantheon_1 = require("../../material/Pantheon");
@@ -56,8 +57,8 @@ var GarudaEffectRule = (function (_super) {
56
57
  GarudaEffectRule.prototype.onRuleStart = function () {
57
58
  var count = this.getCardsToSacrifice().length;
58
59
  if (!count)
59
- return this.endEffect();
60
- this.memorize(Memory_1.Memory.GarudaSacrificeCount, count);
60
+ return [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
61
+ this.memorize(Memory_1.Memory.EffectCount, count);
61
62
  var moves = [new Pantheon_1.Pantheon(this.game, this.player).gainGems(count)];
62
63
  var playerMoves = this.getPlayerMoves();
63
64
  if (playerMoves.length === count) {
@@ -70,13 +71,13 @@ var GarudaEffectRule = (function (_super) {
70
71
  return pantheon.visibleEntities.id(function (id) { return (0, Entity_1.isCreature)(id.front); }).location(function (l) { return l.y === 1; });
71
72
  };
72
73
  GarudaEffectRule.prototype.onSacrifice = function () {
73
- var sacrificeLeft = this.memorize(Memory_1.Memory.GarudaSacrificeCount, function (count) { return count - 1; });
74
+ var sacrificeLeft = this.memorize(Memory_1.Memory.EffectCount, function (count) { return count - 1; });
74
75
  if (sacrificeLeft) {
75
76
  return [];
76
77
  }
77
78
  else {
78
- this.forget(Memory_1.Memory.GarudaSacrificeCount);
79
- return this.endEffect();
79
+ this.forget(Memory_1.Memory.EffectCount);
80
+ return [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
80
81
  }
81
82
  };
82
83
  return GarudaEffectRule;
@@ -3,5 +3,5 @@ import { RuleId } from '../RuleId';
3
3
  export declare class GorgonEffectRule extends SacrificeEffectRule {
4
4
  ruleId: RuleId;
5
5
  getCardsToSacrifice(): import("@gamepark/rules-api").Material<number, number, number>;
6
- onSacrifice(): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
6
+ onSacrifice(): (import("@gamepark/rules-api").CustomMove<number> | import("@gamepark/rules-api").CreateItem<number, number, number>)[];
7
7
  }