@gamepark/mythologies 0.4.1 → 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 (61) hide show
  1. package/dist/Memory.d.ts +9 -7
  2. package/dist/Memory.js +9 -7
  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 +5 -0
  10. package/dist/material/entity/Effect.d.ts +2 -2
  11. package/dist/material/entity/Effect.js +1 -4
  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/rules/RuleId.d.ts +37 -33
  23. package/dist/rules/RuleId.js +37 -33
  24. package/dist/rules/effects/CentaurEffectRule.d.ts +5 -3
  25. package/dist/rules/effects/CentaurEffectRule.js +64 -16
  26. package/dist/rules/effects/CondorEffectRule.d.ts +1 -1
  27. package/dist/rules/effects/CondorEffectRule.js +5 -1
  28. package/dist/rules/effects/DullahanEffectRule.d.ts +11 -0
  29. package/dist/rules/effects/DullahanEffectRule.js +73 -0
  30. package/dist/rules/effects/FenrirEffectRule.js +2 -1
  31. package/dist/rules/effects/GarudaEffectRule.d.ts +1 -1
  32. package/dist/rules/effects/GarudaEffectRule.js +3 -2
  33. package/dist/rules/effects/GorgonEffectRule.d.ts +1 -1
  34. package/dist/rules/effects/GorgonEffectRule.js +2 -26
  35. package/dist/rules/effects/HadesEffectRule.d.ts +8 -4
  36. package/dist/rules/effects/HadesEffectRule.js +12 -50
  37. package/dist/rules/effects/IdloziEffectRule.d.ts +2 -2
  38. package/dist/rules/effects/IdloziEffectRule.js +4 -1
  39. package/dist/rules/effects/IllapaEffectRule.d.ts +1 -1
  40. package/dist/rules/effects/IllapaEffectRule.js +1 -1
  41. package/dist/rules/effects/JiangshiEffectRule.d.ts +1 -1
  42. package/dist/rules/effects/JiangshiEffectRule.js +2 -26
  43. package/dist/rules/effects/LeprechaunEffectRule.d.ts +9 -0
  44. package/dist/rules/effects/LeprechaunEffectRule.js +49 -0
  45. package/dist/rules/effects/MultipleSimultaneousMoveEffectRule.d.ts +13 -0
  46. package/dist/rules/effects/MultipleSimultaneousMoveEffectRule.js +160 -0
  47. package/dist/rules/effects/RaEffectRule.d.ts +8 -4
  48. package/dist/rules/effects/RaEffectRule.js +12 -50
  49. package/dist/rules/effects/SelkieEffectRule.d.ts +8 -0
  50. package/dist/rules/effects/SelkieEffectRule.js +44 -0
  51. package/dist/rules/effects/ShivaEffectRule.d.ts +2 -2
  52. package/dist/rules/effects/ShivaEffectRule.js +8 -32
  53. package/dist/rules/effects/SphinxEffectRule.d.ts +2 -2
  54. package/dist/rules/effects/SphinxEffectRule.js +4 -1
  55. package/dist/rules/effects/TianlongEffectRule.d.ts +2 -3
  56. package/dist/rules/effects/TianlongEffectRule.js +33 -39
  57. package/dist/rules/effects/VetalaEffectRule.d.ts +3 -2
  58. package/dist/rules/effects/VetalaEffectRule.js +10 -5
  59. package/dist/rules/effects/ViracochaEffectRule.d.ts +1 -1
  60. package/dist/rules/effects/ViracochaEffectRule.js +2 -26
  61. package/package.json +2 -2
@@ -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 = {}));
@@ -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;
@@ -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));
@@ -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,7 +57,7 @@ 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
+ return [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
60
61
  this.memorize(Memory_1.Memory.GarudaSacrificeCount, count);
61
62
  var moves = [new Pantheon_1.Pantheon(this.game, this.player).gainGems(count)];
62
63
  var playerMoves = this.getPlayerMoves();
@@ -76,7 +77,7 @@ var GarudaEffectRule = (function (_super) {
76
77
  }
77
78
  else {
78
79
  this.forget(Memory_1.Memory.GarudaSacrificeCount);
79
- return this.endEffect();
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
  }
@@ -14,33 +14,9 @@ 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
- };
42
17
  Object.defineProperty(exports, "__esModule", { value: true });
43
18
  exports.GorgonEffectRule = void 0;
19
+ var CustomMoveType_1 = require("../../CustomMoveType");
44
20
  var SacrificeEffectRule_1 = require("../../material/entity/SacrificeEffectRule");
45
21
  var Pantheon_1 = require("../../material/Pantheon");
46
22
  var RuleId_1 = require("../RuleId");
@@ -57,7 +33,7 @@ var GorgonEffectRule = (function (_super) {
57
33
  };
58
34
  GorgonEffectRule.prototype.onSacrifice = function () {
59
35
  var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
60
- return __spreadArray([pantheon.gainGems(2)], __read(this.endEffect()), false);
36
+ return [pantheon.gainGems(2), this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
61
37
  };
62
38
  return GorgonEffectRule;
63
39
  }(SacrificeEffectRule_1.SacrificeEffectRule));
@@ -1,5 +1,9 @@
1
- import { MaterialMove } from '@gamepark/rules-api';
2
- import { SimultaneousMoveEffectRule } from '../../material/entity/SimultaneousMoveEffectRule';
3
- export declare class HadesEffectRule extends SimultaneousMoveEffectRule {
4
- playEffect(): MaterialMove[];
1
+ import { Location, XYCoordinates } from '@gamepark/rules-api';
2
+ import { PlayerColor } from '../../PlayerColor';
3
+ import { RuleId } from '../RuleId';
4
+ import { MultipleSimultaneousMoveEffectRule } from './MultipleSimultaneousMoveEffectRule';
5
+ export declare class HadesEffectRule extends MultipleSimultaneousMoveEffectRule {
6
+ ruleId: RuleId;
7
+ getTargetEntities(player: PlayerColor): import("@gamepark/rules-api").Material<number, number, number>;
8
+ isLegalDestination(space: XYCoordinates, cardLocation: Location): boolean;
5
9
  }
@@ -14,64 +14,26 @@ 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 __values = (this && this.__values) || function(o) {
18
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
19
- if (m) return m.call(o);
20
- if (o && typeof o.length === "number") return {
21
- next: function () {
22
- if (o && i >= o.length) o = void 0;
23
- return { value: o && o[i++], done: !o };
24
- }
25
- };
26
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
27
- };
28
17
  Object.defineProperty(exports, "__esModule", { value: true });
29
18
  exports.HadesEffectRule = void 0;
30
19
  var Entity_1 = require("../../material/Entity");
31
- var SimultaneousMoveEffectRule_1 = require("../../material/entity/SimultaneousMoveEffectRule");
32
- var LocationType_1 = require("../../material/LocationType");
33
20
  var Pantheon_1 = require("../../material/Pantheon");
21
+ var RuleId_1 = require("../RuleId");
22
+ var MultipleSimultaneousMoveEffectRule_1 = require("./MultipleSimultaneousMoveEffectRule");
34
23
  var HadesEffectRule = (function (_super) {
35
24
  __extends(HadesEffectRule, _super);
36
25
  function HadesEffectRule() {
37
- return _super !== null && _super.apply(this, arguments) || this;
26
+ var _this = _super !== null && _super.apply(this, arguments) || this;
27
+ _this.ruleId = RuleId_1.RuleId.HadesEffect;
28
+ return _this;
38
29
  }
39
- HadesEffectRule.prototype.playEffect = function () {
40
- var e_1, _a, e_2, _b;
41
- var moves = [];
42
- try {
43
- for (var _c = __values(this.game.players), _d = _c.next(); !_d.done; _d = _c.next()) {
44
- var player = _d.value;
45
- var pantheon = new Pantheon_1.Pantheon(this.game, player);
46
- var entities = pantheon.visibleEntities;
47
- try {
48
- for (var _e = (e_2 = void 0, __values(entities.getIndexes())), _f = _e.next(); !_f.done; _f = _e.next()) {
49
- var index = _f.value;
50
- var entity = entities.getItem(index);
51
- var _g = entity.location, x = _g.x, y = _g.y;
52
- if (y !== 2 && !(0, Entity_1.isGod)(entity.id.front) && pantheon.isFreeSpace({ x: x, y: y + 1 })) {
53
- moves.push(entities.index(index).moveItem({ type: LocationType_1.LocationType.Pantheon, player: player, x: x, y: y + 1 }));
54
- }
55
- }
56
- }
57
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
58
- finally {
59
- try {
60
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
61
- }
62
- finally { if (e_2) throw e_2.error; }
63
- }
64
- }
65
- }
66
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
67
- finally {
68
- try {
69
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
70
- }
71
- finally { if (e_1) throw e_1.error; }
72
- }
73
- return moves;
30
+ HadesEffectRule.prototype.getTargetEntities = function (player) {
31
+ var pantheon = new Pantheon_1.Pantheon(this.game, player);
32
+ return pantheon.visibleEntities.id(function (id) { return !(0, Entity_1.isGod)(id.front); }).location(function (l) { return l.y < 2 && pantheon.isFreeSpace({ x: l.x, y: l.y + 1 }); });
33
+ };
34
+ HadesEffectRule.prototype.isLegalDestination = function (space, cardLocation) {
35
+ return cardLocation.x === space.x && cardLocation.y === space.y - 1;
74
36
  };
75
37
  return HadesEffectRule;
76
- }(SimultaneousMoveEffectRule_1.SimultaneousMoveEffectRule));
38
+ }(MultipleSimultaneousMoveEffectRule_1.MultipleSimultaneousMoveEffectRule));
77
39
  exports.HadesEffectRule = HadesEffectRule;
@@ -1,9 +1,9 @@
1
- import { Location, Material, MaterialMove, MoveItem, XYCoordinates } from '@gamepark/rules-api';
1
+ import { Location, Material, MoveItem, XYCoordinates } from '@gamepark/rules-api';
2
2
  import { MoveEffectRule } from '../../material/entity/MoveEffectRule';
3
3
  import { RuleId } from '../RuleId';
4
4
  export declare class IdloziEffectRule extends MoveEffectRule {
5
5
  ruleId: RuleId;
6
6
  getMovingCards(effectCardIndex: number): Material;
7
7
  isLegalDestination(space: XYCoordinates, cardLocation: Location): boolean;
8
- onCardMoved(move: MoveItem): MaterialMove[];
8
+ onCardMoved(move: MoveItem): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
9
9
  }
@@ -16,6 +16,7 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.IdloziEffectRule = void 0;
19
+ var CustomMoveType_1 = require("../../CustomMoveType");
19
20
  var Entity_1 = require("../../material/Entity");
20
21
  var MoveEffectRule_1 = require("../../material/entity/MoveEffectRule");
21
22
  var MaterialType_1 = require("../../material/MaterialType");
@@ -36,7 +37,9 @@ var IdloziEffectRule = (function (_super) {
36
37
  };
37
38
  IdloziEffectRule.prototype.onCardMoved = function (move) {
38
39
  var entity = this.material(MaterialType_1.MaterialType.EntityCard).getItem(move.itemIndex).id.front;
39
- return new Pantheon_1.Pantheon(this.game, this.player).getInvokeGains(entity, move.location.y).concat(this.endEffect());
40
+ var moves = new Pantheon_1.Pantheon(this.game, this.player).getInvokeGains(entity, move.location.y);
41
+ moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
42
+ return moves;
40
43
  };
41
44
  return IdloziEffectRule;
42
45
  }(MoveEffectRule_1.MoveEffectRule));
@@ -6,7 +6,7 @@ import { RuleId } from '../RuleId';
6
6
  export declare class IllapaEffectRule extends PlayerEffectRule {
7
7
  ruleId: RuleId;
8
8
  getPlayerMoves(): CustomMove<number>[];
9
- onCustomMove(move: CustomMove): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
9
+ onCustomMove(move: CustomMove): CustomMove<number>[] | import("@gamepark/rules-api").StartSimultaneousRule<number, RuleId.IllapaSacrifice>[];
10
10
  getPlayersHavingToSacrifice(line: number): number[];
11
11
  }
12
12
  export declare class IllapaSacrificeRule extends SimultaneousSacrificeEffectRule {