@gamepark/mythologies 0.2.1 → 0.3.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 (72) hide show
  1. package/dist/CustomMoveType.d.ts +2 -1
  2. package/dist/CustomMoveType.js +1 -0
  3. package/dist/Memory.d.ts +9 -8
  4. package/dist/Memory.js +8 -7
  5. package/dist/MythologiesRules.d.ts +17 -6
  6. package/dist/MythologiesRules.js +43 -34
  7. package/dist/material/Mythology.js +1 -1
  8. package/dist/material/Pantheon.d.ts +6 -1
  9. package/dist/material/Pantheon.js +59 -24
  10. package/dist/material/entity/Effect.d.ts +21 -8
  11. package/dist/material/entity/Effect.js +34 -3
  12. package/dist/material/entity/EntityDescription.d.ts +0 -2
  13. package/dist/material/entity/EntityDescription.js +1 -7
  14. package/dist/material/entity/MoveEffectRule.d.ts +2 -2
  15. package/dist/material/entity/MoveEffectRule.js +7 -3
  16. package/dist/material/entity/PlaceCardEffectRule.d.ts +2 -2
  17. package/dist/material/entity/PlaceCardEffectRule.js +29 -3
  18. package/dist/material/entity/SacrificeEffectRule.d.ts +1 -1
  19. package/dist/material/entity/SacrificeEffectRule.js +29 -2
  20. package/dist/material/entity/SimultaneousSacrificeEffectRule.d.ts +1 -1
  21. package/dist/material/entity/SimultaneousSacrificeEffectRule.js +29 -2
  22. package/dist/material/entity/chinese/ChangE.js +39 -1
  23. package/dist/material/entity/chinese/Fenghuang.js +8 -1
  24. package/dist/material/entity/chinese/Jiangshi.js +7 -1
  25. package/dist/material/entity/chinese/Mogwai.js +38 -1
  26. package/dist/material/entity/chinese/Nian.js +36 -1
  27. package/dist/material/entity/chinese/Nuwa.js +7 -1
  28. package/dist/material/entity/chinese/Qilin.js +7 -1
  29. package/dist/material/entity/chinese/SunWukong.js +36 -1
  30. package/dist/material/entity/chinese/Tianlong.js +7 -1
  31. package/dist/material/entity/egyptian/Beetle.js +1 -1
  32. package/dist/material/entity/egyptian/Sphinx.js +1 -1
  33. package/dist/material/entity/greek/Chimera.js +1 -1
  34. package/dist/material/entity/greek/Poseidon.js +3 -3
  35. package/dist/material/entity/norse/Draugr.js +1 -1
  36. package/dist/material/entity/norse/Jotunn.js +3 -2
  37. package/dist/rules/ChooseDraftTokenRule.js +1 -1
  38. package/dist/rules/PlaceCardsRule.d.ts +3 -1
  39. package/dist/rules/PlaceCardsRule.js +18 -8
  40. package/dist/rules/PlaceTokenRule.d.ts +0 -1
  41. package/dist/rules/PlaceTokenRule.js +1 -6
  42. package/dist/rules/RuleId.d.ts +7 -1
  43. package/dist/rules/RuleId.js +6 -0
  44. package/dist/rules/effects/AlfEffectRule.js +1 -1
  45. package/dist/rules/effects/ChimeraEffectRule.d.ts +1 -0
  46. package/dist/rules/effects/ChimeraEffectRule.js +4 -0
  47. package/dist/rules/effects/CondorEffectRule.d.ts +2 -2
  48. package/dist/rules/effects/CondorEffectRule.js +3 -7
  49. package/dist/rules/effects/DraugrEffectRule.d.ts +2 -1
  50. package/dist/rules/effects/DraugrEffectRule.js +8 -1
  51. package/dist/rules/effects/FenghuangEffectRule.d.ts +8 -0
  52. package/dist/rules/effects/FenghuangEffectRule.js +48 -0
  53. package/dist/rules/effects/JiangshiEffectRule.d.ts +8 -0
  54. package/dist/rules/effects/JiangshiEffectRule.js +76 -0
  55. package/dist/rules/effects/KinnaraEffectRule.js +7 -2
  56. package/dist/rules/effects/NuwaEffectRule.d.ts +12 -0
  57. package/dist/rules/effects/NuwaEffectRule.js +97 -0
  58. package/dist/rules/effects/QilinEffectRule.d.ts +8 -0
  59. package/dist/rules/effects/QilinEffectRule.js +113 -0
  60. package/dist/rules/effects/ResolveEffectsRule.d.ts +2 -0
  61. package/dist/rules/effects/ResolveEffectsRule.js +17 -14
  62. package/dist/rules/effects/ShivaEffectRule.d.ts +1 -1
  63. package/dist/rules/effects/ShivaEffectRule.js +5 -2
  64. package/dist/rules/effects/SphinxEffectRule.js +2 -6
  65. package/dist/rules/effects/SupayEffectRule.d.ts +1 -0
  66. package/dist/rules/effects/SupayEffectRule.js +3 -0
  67. package/dist/rules/effects/ThorEffectRule.d.ts +1 -1
  68. package/dist/rules/effects/ThorEffectRule.js +3 -1
  69. package/dist/rules/effects/TianlongEffectRule.d.ts +17 -0
  70. package/dist/rules/effects/TianlongEffectRule.js +148 -0
  71. package/dist/rules/effects/TriggerEffectsRule.js +4 -5
  72. package/package.json +2 -2
@@ -103,21 +103,25 @@ var PlaceCardsRule = (function (_super) {
103
103
  Object.defineProperty(PlaceCardsRule.prototype, "infiniteEffects", {
104
104
  get: function () {
105
105
  var _this = this;
106
- var _a, _b;
106
+ var _a;
107
107
  var pendingRule = (_a = this.remind(Memory_1.Memory.PendingRule)) !== null && _a !== void 0 ? _a : this.game.rule;
108
108
  if ((pendingRule === null || pendingRule === void 0 ? void 0 : pendingRule.id) !== RuleId_1.RuleId.PlaceCards || pendingRule.player !== this.player)
109
109
  return [];
110
110
  var pendingEffect = new TriggerEffectsRule_1.TriggerEffectsRule(this.game).getPlayerEffects(this.player, { type: Effect_1.TriggerEventType.Infinite });
111
- var oncePerTurnUsed = (_b = this.remind(Memory_1.Memory.OncePerTurn)) !== null && _b !== void 0 ? _b : [];
112
111
  return pendingEffect.filter(function (pendingEffect) {
113
112
  var card = _this.material(MaterialType_1.MaterialType.EntityCard).getItem(pendingEffect.cardIndex);
114
- var effect = (0, EntityDescription_1.getEffects)(card.id.front)[pendingEffect.effectIndex];
115
- return !oncePerTurnUsed.includes(pendingEffect.cardIndex) && new effect.rule(_this.game).canPlayEffect(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);
116
115
  });
117
116
  },
118
117
  enumerable: false,
119
118
  configurable: true
120
119
  });
120
+ PlaceCardsRule.prototype.isOncePerTurnAvailable = function (cardIndex) {
121
+ var _a;
122
+ var oncePerTurnUsed = (_a = this.remind(Memory_1.Memory.OncePerTurn)) !== null && _a !== void 0 ? _a : [];
123
+ return !oncePerTurnUsed.includes(cardIndex);
124
+ };
121
125
  Object.defineProperty(PlaceCardsRule.prototype, "tokens", {
122
126
  get: function () {
123
127
  var _this = this;
@@ -128,7 +132,7 @@ var PlaceCardsRule = (function (_super) {
128
132
  enumerable: false,
129
133
  configurable: true
130
134
  });
131
- PlaceCardsRule.prototype.afterItemMove = function (move) {
135
+ PlaceCardsRule.prototype.beforeItemMove = function (move) {
132
136
  var moves = [];
133
137
  if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.EntityCard)(move)) {
134
138
  var token = this.tokens.parent(move.itemIndex);
@@ -138,13 +142,19 @@ var PlaceCardsRule = (function (_super) {
138
142
  if (move.location.type === LocationType_1.LocationType.PlayerDiscard) {
139
143
  moves.push(pantheon.gainGems(2));
140
144
  }
145
+ else if (move.location.type === LocationType_1.LocationType.Pantheon) {
146
+ moves.push.apply(moves, __spreadArray([], __read(pantheon.onCardPlaced(move)), false));
147
+ }
141
148
  }
142
149
  }
143
- else if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.DraftToken)(move) && this.tokens.length === 0) {
144
- moves.push(this.material(MaterialType_1.MaterialType.DraftToken).location(LocationType_1.LocationType.PlayerHand).player(this.player).shuffle());
145
- }
146
150
  return moves;
147
151
  };
152
+ PlaceCardsRule.prototype.afterItemMove = function (move) {
153
+ if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.DraftToken)(move) && this.tokens.length === 0) {
154
+ return [this.material(MaterialType_1.MaterialType.DraftToken).location(LocationType_1.LocationType.PlayerHand).player(this.player).shuffle()];
155
+ }
156
+ return [];
157
+ };
148
158
  PlaceCardsRule.prototype.onCustomMove = function (move) {
149
159
  if (move.type === CustomMoveType_1.CustomMoveType.Pass) {
150
160
  return this.onPass();
@@ -9,5 +9,4 @@ export declare class PlaceTokenRule extends SimultaneousRule {
9
9
  getTopDeckCreature(mythology: Mythology): number;
10
10
  afterItemMove(move: ItemMove): import("@gamepark/rules-api").EndPlayerTurn<PlayerColor>[];
11
11
  getMovesAfterPlayersDone(): import("@gamepark/rules-api").StartRule<RuleId.DrawDestinyCard>[] | (import("@gamepark/rules-api").MoveItem<number, number, number> | import("@gamepark/rules-api").StartPlayerTurn<number, RuleId.PlaceCards>)[];
12
- onRuleEnd(): never[];
13
12
  }
@@ -110,9 +110,8 @@ var PlaceTokenRule = (function (_super) {
110
110
  return this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.CreaturesDeck).locationId(mythology).deck().getIndex();
111
111
  };
112
112
  PlaceTokenRule.prototype.afterItemMove = function (move) {
113
- if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.DraftToken)(move)) {
113
+ if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.DraftToken)(move) && move.location.type === LocationType_1.LocationType.OnEntityCard) {
114
114
  var player = this.material(MaterialType_1.MaterialType.DraftToken).getItem(move.itemIndex).id.back;
115
- this.memorize(Memory_1.Memory.KeepTokenPlaceSecret, true, player);
116
115
  return [this.endPlayerTurn(player)];
117
116
  }
118
117
  return [];
@@ -130,10 +129,6 @@ var PlaceTokenRule = (function (_super) {
130
129
  ], false);
131
130
  }
132
131
  };
133
- PlaceTokenRule.prototype.onRuleEnd = function () {
134
- this.forget(Memory_1.Memory.KeepTokenPlaceSecret);
135
- return [];
136
- };
137
132
  return PlaceTokenRule;
138
133
  }(rules_api_1.SimultaneousRule));
139
134
  exports.PlaceTokenRule = PlaceTokenRule;
@@ -41,5 +41,11 @@ export declare enum RuleId {
41
41
  SupayEffect = 43,
42
42
  UkukuEffect = 44,
43
43
  UkukuPlaceEffect = 45,
44
- YanluoWangEffect = 46
44
+ YanluoWangEffect = 46,
45
+ NuwaEffect = 47,
46
+ TianlongEffect = 48,
47
+ TianlongOpponentsEffect = 49,
48
+ QilinEffect = 50,
49
+ FenghuangEffect = 51,
50
+ JiangshiEffect = 52
45
51
  }
@@ -46,4 +46,10 @@ var RuleId;
46
46
  RuleId[RuleId["UkukuEffect"] = 44] = "UkukuEffect";
47
47
  RuleId[RuleId["UkukuPlaceEffect"] = 45] = "UkukuPlaceEffect";
48
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";
49
55
  })(RuleId = exports.RuleId || (exports.RuleId = {}));
@@ -47,7 +47,7 @@ var AlfEffectRule = (function (_super) {
47
47
  var alf = this.material(MaterialType_1.MaterialType.EntityCard).getItem(alfIndex).location;
48
48
  for (var y = 0; y < 3; y++) {
49
49
  for (var x = 0; x < 3; x++) {
50
- if (!grid[y][x] && Math.abs(alf.x - x) === 1 && Math.abs(alf.y - y) === 1) {
50
+ if (!grid[y][x] && Math.abs(alf.x - x) === Math.abs(alf.y - y)) {
51
51
  freeDiagonals.push({ x: x, y: y });
52
52
  }
53
53
  }
@@ -3,6 +3,7 @@ import { InvokeEffectRule } from '../../material/entity/PlaceCardEffectRule';
3
3
  import { RuleId } from '../RuleId';
4
4
  export declare class ChimeraEffectRule extends InvokeEffectRule {
5
5
  ruleId: RuleId;
6
+ playEffect(): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
6
7
  getCardsToPlace(): import("@gamepark/rules-api").Material<number, number, number>;
7
8
  getAvailableDestinations(): XYCoordinates[];
8
9
  }
@@ -27,6 +27,10 @@ var ChimeraEffectRule = (function (_super) {
27
27
  _this.ruleId = RuleId_1.RuleId.ChimeraEffect;
28
28
  return _this;
29
29
  }
30
+ ChimeraEffectRule.prototype.playEffect = function () {
31
+ var player = this.card.location.player;
32
+ return new Pantheon_1.Pantheon(this.game, player).hasCrushed(this.card) ? _super.prototype.playEffect.call(this) : [];
33
+ };
30
34
  ChimeraEffectRule.prototype.getCardsToPlace = function () {
31
35
  return new Destiny_1.Destiny(this.game).creaturesOnTopOfDecks;
32
36
  };
@@ -1,8 +1,8 @@
1
- import { ItemMove, MaterialMove } from '@gamepark/rules-api';
1
+ import { MaterialMove, MoveItem } from '@gamepark/rules-api';
2
2
  import { SacrificeEffectRule } from '../../material/entity/SacrificeEffectRule';
3
3
  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
- beforeItemMove(move: ItemMove): MaterialMove[];
7
+ onSacrifice(move: MoveItem): MaterialMove[];
8
8
  }
@@ -18,7 +18,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.CondorEffectRule = void 0;
19
19
  var rules_api_1 = require("@gamepark/rules-api");
20
20
  var SacrificeEffectRule_1 = require("../../material/entity/SacrificeEffectRule");
21
- var LocationType_1 = require("../../material/LocationType");
22
21
  var MaterialType_1 = require("../../material/MaterialType");
23
22
  var Pantheon_1 = require("../../material/Pantheon");
24
23
  var RuleId_1 = require("../RuleId");
@@ -33,12 +32,9 @@ var CondorEffectRule = (function (_super) {
33
32
  var location = this.card.location;
34
33
  return _super.prototype.getCardsToSacrifice.call(this).location(function (l) { return (0, rules_api_1.areAdjacentSquares)(l, location); });
35
34
  };
36
- CondorEffectRule.prototype.beforeItemMove = function (move) {
37
- if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.EntityCard)(move) && move.location.type === LocationType_1.LocationType.PlayerDiscard) {
38
- var entity = this.material(MaterialType_1.MaterialType.EntityCard).getItem(move.itemIndex);
39
- return new Pantheon_1.Pantheon(this.game, this.player).getInvokeGains(entity.id.front, entity.location.y);
40
- }
41
- return [];
35
+ CondorEffectRule.prototype.onSacrifice = function (move) {
36
+ 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());
42
38
  };
43
39
  return CondorEffectRule;
44
40
  }(SacrificeEffectRule_1.SacrificeEffectRule));
@@ -4,8 +4,9 @@ import { PlayerColor } from '../../PlayerColor';
4
4
  import { RuleId } from '../RuleId';
5
5
  export declare class DraugrEffectRule extends SimultaneousSacrificeEffectRule {
6
6
  ruleId: RuleId;
7
+ playEffect(): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
7
8
  getAffectedPlayers(): PlayerColor[];
8
9
  getActivePlayerLegalMoves(player: PlayerColor): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
9
10
  getCardsToSacrifice(player: PlayerColor): Material;
10
- beforeItemMove(move: ItemMove): import("@gamepark/rules-api").EndPlayerTurn<number>[];
11
+ beforeItemMove(move: ItemMove): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
11
12
  }
@@ -21,6 +21,7 @@ var Entity_1 = require("../../material/Entity");
21
21
  var SimultaneousSacrificeEffectRule_1 = require("../../material/entity/SimultaneousSacrificeEffectRule");
22
22
  var LocationType_1 = require("../../material/LocationType");
23
23
  var MaterialType_1 = require("../../material/MaterialType");
24
+ var Pantheon_1 = require("../../material/Pantheon");
24
25
  var RuleId_1 = require("../RuleId");
25
26
  var DraugrEffectRule = (function (_super) {
26
27
  __extends(DraugrEffectRule, _super);
@@ -29,6 +30,10 @@ var DraugrEffectRule = (function (_super) {
29
30
  _this.ruleId = RuleId_1.RuleId.DraugrEffect;
30
31
  return _this;
31
32
  }
33
+ DraugrEffectRule.prototype.playEffect = function () {
34
+ var player = this.card.location.player;
35
+ return new Pantheon_1.Pantheon(this.game, player).hasCrushed(this.card) ? _super.prototype.playEffect.call(this) : [];
36
+ };
32
37
  DraugrEffectRule.prototype.getAffectedPlayers = function () {
33
38
  var _this = this;
34
39
  return _super.prototype.getAffectedPlayers.call(this).filter(function (player) { return _this.isOpponent(player); });
@@ -49,7 +54,9 @@ var DraugrEffectRule = (function (_super) {
49
54
  if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.GemToken)(move)) {
50
55
  return [this.endPlayerTurn(this.material(MaterialType_1.MaterialType.GemToken).getItem(move.itemIndex).location.player)];
51
56
  }
52
- return [];
57
+ else {
58
+ return _super.prototype.beforeItemMove.call(this, move);
59
+ }
53
60
  };
54
61
  return DraugrEffectRule;
55
62
  }(SimultaneousSacrificeEffectRule_1.SimultaneousSacrificeEffectRule));
@@ -0,0 +1,8 @@
1
+ import { PlaceCardEffectRule } from '../../material/entity/PlaceCardEffectRule';
2
+ import { RuleId } from '../RuleId';
3
+ export declare class FenghuangEffectRule extends PlaceCardEffectRule {
4
+ ruleId: RuleId;
5
+ onRuleStart(): never[];
6
+ getPlayerMoves(cardIndex?: number): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
7
+ getCardsToPlace(): import("@gamepark/rules-api").Material<number, number, number>;
8
+ }
@@ -0,0 +1,48 @@
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.FenghuangEffectRule = void 0;
19
+ var CustomMoveType_1 = require("../../CustomMoveType");
20
+ var PlaceCardEffectRule_1 = require("../../material/entity/PlaceCardEffectRule");
21
+ var MaterialType_1 = require("../../material/MaterialType");
22
+ var Memory_1 = require("../../Memory");
23
+ var RuleId_1 = require("../RuleId");
24
+ var FenghuangEffectRule = (function (_super) {
25
+ __extends(FenghuangEffectRule, _super);
26
+ function FenghuangEffectRule() {
27
+ var _this = _super !== null && _super.apply(this, arguments) || this;
28
+ _this.ruleId = RuleId_1.RuleId.FenghuangEffect;
29
+ return _this;
30
+ }
31
+ FenghuangEffectRule.prototype.onRuleStart = function () {
32
+ var _this = this;
33
+ this.memorize(Memory_1.Memory.OncePerTurn, function (indexes) {
34
+ if (indexes === void 0) { indexes = []; }
35
+ return indexes.concat(_this.getEffect().cardIndex);
36
+ });
37
+ return [];
38
+ };
39
+ FenghuangEffectRule.prototype.getPlayerMoves = function (cardIndex) {
40
+ if (cardIndex === void 0) { cardIndex = this.getEffect().cardIndex; }
41
+ return _super.prototype.getPlayerMoves.call(this, cardIndex).concat(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
42
+ };
43
+ FenghuangEffectRule.prototype.getCardsToPlace = function () {
44
+ return this.material(MaterialType_1.MaterialType.EntityCard).index(this.getEffect().cardIndex);
45
+ };
46
+ return FenghuangEffectRule;
47
+ }(PlaceCardEffectRule_1.PlaceCardEffectRule));
48
+ exports.FenghuangEffectRule = FenghuangEffectRule;
@@ -0,0 +1,8 @@
1
+ import { ItemMove, MaterialMove } from '@gamepark/rules-api';
2
+ import { PlayerEffectRule } from '../../material/entity/Effect';
3
+ import { RuleId } from '../RuleId';
4
+ export declare class JiangshiEffectRule extends PlayerEffectRule {
5
+ ruleId: RuleId;
6
+ getPlayerMoves(): MaterialMove[];
7
+ beforeItemMove(move: ItemMove): MaterialMove<number, number, number, number>[];
8
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __read = (this && this.__read) || function (o, n) {
18
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
19
+ if (!m) return o;
20
+ var i = m.call(o), r, ar = [], e;
21
+ try {
22
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
23
+ }
24
+ catch (error) { e = { error: error }; }
25
+ finally {
26
+ try {
27
+ if (r && !r.done && (m = i["return"])) m.call(i);
28
+ }
29
+ finally { if (e) throw e.error; }
30
+ }
31
+ return ar;
32
+ };
33
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
34
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
35
+ if (ar || !(i in from)) {
36
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
37
+ ar[i] = from[i];
38
+ }
39
+ }
40
+ return to.concat(ar || Array.prototype.slice.call(from));
41
+ };
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.JiangshiEffectRule = void 0;
44
+ var rules_api_1 = require("@gamepark/rules-api");
45
+ var Effect_1 = require("../../material/entity/Effect");
46
+ var LocationType_1 = require("../../material/LocationType");
47
+ var MaterialType_1 = require("../../material/MaterialType");
48
+ var Pantheon_1 = require("../../material/Pantheon");
49
+ var RuleId_1 = require("../RuleId");
50
+ var JiangshiEffectRule = (function (_super) {
51
+ __extends(JiangshiEffectRule, _super);
52
+ function JiangshiEffectRule() {
53
+ var _this = _super !== null && _super.apply(this, arguments) || this;
54
+ _this.ruleId = RuleId_1.RuleId.JiangshiEffect;
55
+ return _this;
56
+ }
57
+ JiangshiEffectRule.prototype.getPlayerMoves = function () {
58
+ var _this = this;
59
+ var location = this.card.location;
60
+ var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
61
+ var piles = pantheon.getPiles(function (space) { return space.y === location.y; });
62
+ return piles.map(function (pile) { return pile.moveItemsAtOnce({ type: LocationType_1.LocationType.PlayerDiscard, player: _this.player }); });
63
+ };
64
+ JiangshiEffectRule.prototype.beforeItemMove = function (move) {
65
+ if ((0, rules_api_1.isMoveItemTypeAtOnce)(MaterialType_1.MaterialType.EntityCard)(move) && move.location.type === LocationType_1.LocationType.PlayerDiscard) {
66
+ var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
67
+ var topCard = this.material(MaterialType_1.MaterialType.EntityCard)
68
+ .index(move.indexes)
69
+ .maxBy(function (item) { return item.location.z; });
70
+ return __spreadArray(__spreadArray([pantheon.gainGems(2)], __read(pantheon.onEntitySacrificed(topCard)), false), __read(this.endEffect()), false);
71
+ }
72
+ return [];
73
+ };
74
+ return JiangshiEffectRule;
75
+ }(Effect_1.PlayerEffectRule));
76
+ exports.JiangshiEffectRule = JiangshiEffectRule;
@@ -44,13 +44,18 @@ var KinnaraEffectRule = (function (_super) {
44
44
  KinnaraEffectRule.prototype.getPlayerMoves = function () {
45
45
  var e_1, _a;
46
46
  var moves = [];
47
- var mythologies = new Pantheon_1.Pantheon(this.game, this.player).missingMythologies;
47
+ var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
48
+ var mythologies = pantheon.missingMythologies;
48
49
  var creaturesDecks = this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.CreaturesDeck);
49
50
  var godsDecks = this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.GodsDeck);
51
+ var gems = pantheon.gems;
50
52
  try {
51
53
  for (var mythologies_1 = __values(mythologies), mythologies_1_1 = mythologies_1.next(); !mythologies_1_1.done; mythologies_1_1 = mythologies_1.next()) {
52
54
  var mythology = mythologies_1_1.value;
53
- moves.push(creaturesDecks.locationId(mythology).deck().moveItem({ type: LocationType_1.LocationType.PlayerBufferArea, player: this.player }), godsDecks.locationId(mythology).deck().moveItem({ type: LocationType_1.LocationType.PlayerBufferArea, player: this.player }));
55
+ moves.push(creaturesDecks.locationId(mythology).deck().moveItem({ type: LocationType_1.LocationType.PlayerBufferArea, player: this.player }));
56
+ if (gems >= 4) {
57
+ godsDecks.locationId(mythology).deck().moveItem({ type: LocationType_1.LocationType.PlayerBufferArea, player: this.player });
58
+ }
54
59
  }
55
60
  }
56
61
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -0,0 +1,12 @@
1
+ import { ItemMove, Material, MoveItem } from '@gamepark/rules-api';
2
+ import { SimultaneousSacrificeEffectRule } from '../../material/entity/SimultaneousSacrificeEffectRule';
3
+ import { PlayerColor } from '../../PlayerColor';
4
+ import { RuleId } from '../RuleId';
5
+ export declare class NuwaEffectRule extends SimultaneousSacrificeEffectRule {
6
+ ruleId: RuleId;
7
+ getAffectedPlayers(): PlayerColor[];
8
+ getActivePlayerLegalMoves(player: PlayerColor): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
9
+ getCardsToSacrifice(player: PlayerColor): Material;
10
+ onSacrifice(move: MoveItem): import("@gamepark/rules-api").EndPlayerTurn<number>[];
11
+ beforeItemMove(move: ItemMove): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
12
+ }
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __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
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.NuwaEffectRule = void 0;
30
+ var rules_api_1 = require("@gamepark/rules-api");
31
+ var Entity_1 = require("../../material/Entity");
32
+ var SimultaneousSacrificeEffectRule_1 = require("../../material/entity/SimultaneousSacrificeEffectRule");
33
+ var LocationType_1 = require("../../material/LocationType");
34
+ var MaterialType_1 = require("../../material/MaterialType");
35
+ var Pantheon_1 = require("../../material/Pantheon");
36
+ var Memory_1 = require("../../Memory");
37
+ var RuleId_1 = require("../RuleId");
38
+ var NuwaEffectRule = (function (_super) {
39
+ __extends(NuwaEffectRule, _super);
40
+ function NuwaEffectRule() {
41
+ var _this = _super !== null && _super.apply(this, arguments) || this;
42
+ _this.ruleId = RuleId_1.RuleId.NuwaEffect;
43
+ return _this;
44
+ }
45
+ NuwaEffectRule.prototype.getAffectedPlayers = function () {
46
+ var e_1, _a;
47
+ var players = [];
48
+ try {
49
+ for (var _b = __values(this.game.players), _c = _b.next(); !_c.done; _c = _b.next()) {
50
+ var player = _c.value;
51
+ if (this.isOpponent(player)) {
52
+ var creatures = new Pantheon_1.Pantheon(this.game, player).visibleEntities.id(function (id) { return (0, Entity_1.isCreature)(id.front); }).getIndexes();
53
+ if (creatures.length > 0) {
54
+ this.memorize(Memory_1.Memory.NuwaPlayerCreatures, creatures, player);
55
+ players.push(player);
56
+ }
57
+ }
58
+ }
59
+ }
60
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
61
+ finally {
62
+ try {
63
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
64
+ }
65
+ finally { if (e_1) throw e_1.error; }
66
+ }
67
+ return players;
68
+ };
69
+ NuwaEffectRule.prototype.getActivePlayerLegalMoves = function (player) {
70
+ var moves = _super.prototype.getActivePlayerLegalMoves.call(this, player);
71
+ var gems = this.material(MaterialType_1.MaterialType.GemToken).location(LocationType_1.LocationType.PlayerGems).player(player);
72
+ var creatures = this.remind(Memory_1.Memory.NuwaPlayerCreatures, player);
73
+ if (gems.getQuantity() >= creatures.length) {
74
+ moves.push(gems.moveItem({ type: LocationType_1.LocationType.PlayerGems, player: this.card.location.player }, creatures.length));
75
+ }
76
+ return moves;
77
+ };
78
+ NuwaEffectRule.prototype.getCardsToSacrifice = function (player) {
79
+ return _super.prototype.getCardsToSacrifice.call(this, player).index(this.remind(Memory_1.Memory.NuwaPlayerCreatures, player));
80
+ };
81
+ NuwaEffectRule.prototype.onSacrifice = function (move) {
82
+ var player = move.location.player;
83
+ var creaturesLeft = this.memorize(Memory_1.Memory.NuwaPlayerCreatures, function (creatures) { return creatures.filter(function (c) { return c !== move.itemIndex; }); }, player);
84
+ return creaturesLeft.length ? [] : [this.endPlayerTurn(player)];
85
+ };
86
+ NuwaEffectRule.prototype.beforeItemMove = function (move) {
87
+ if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.GemToken)(move)) {
88
+ var player = this.material(MaterialType_1.MaterialType.GemToken).getItem(move.itemIndex).location.player;
89
+ return [this.endPlayerTurn(player)];
90
+ }
91
+ else {
92
+ return _super.prototype.beforeItemMove.call(this, move);
93
+ }
94
+ };
95
+ return NuwaEffectRule;
96
+ }(SimultaneousSacrificeEffectRule_1.SimultaneousSacrificeEffectRule));
97
+ exports.NuwaEffectRule = NuwaEffectRule;
@@ -0,0 +1,8 @@
1
+ import { CustomMove } from '@gamepark/rules-api';
2
+ import { PlayerEffectRule } from '../../material/entity/Effect';
3
+ import { RuleId } from '../RuleId';
4
+ export declare class QilinEffectRule extends PlayerEffectRule {
5
+ ruleId: RuleId;
6
+ getPlayerMoves(): CustomMove<number>[];
7
+ onCustomMove(move: CustomMove): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
8
+ }
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __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
+ var __read = (this && this.__read) || function (o, n) {
29
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
30
+ if (!m) return o;
31
+ var i = m.call(o), r, ar = [], e;
32
+ try {
33
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
34
+ }
35
+ catch (error) { e = { error: error }; }
36
+ finally {
37
+ try {
38
+ if (r && !r.done && (m = i["return"])) m.call(i);
39
+ }
40
+ finally { if (e) throw e.error; }
41
+ }
42
+ return ar;
43
+ };
44
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
45
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
46
+ if (ar || !(i in from)) {
47
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
48
+ ar[i] = from[i];
49
+ }
50
+ }
51
+ return to.concat(ar || Array.prototype.slice.call(from));
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.QilinEffectRule = void 0;
55
+ var rules_api_1 = require("@gamepark/rules-api");
56
+ var CustomMoveType_1 = require("../../CustomMoveType");
57
+ var Entity_1 = require("../../material/Entity");
58
+ var Effect_1 = require("../../material/entity/Effect");
59
+ var EntityDescription_1 = require("../../material/entity/EntityDescription");
60
+ var MaterialType_1 = require("../../material/MaterialType");
61
+ var Pantheon_1 = require("../../material/Pantheon");
62
+ var RuleId_1 = require("../RuleId");
63
+ var QilinEffectRule = (function (_super) {
64
+ __extends(QilinEffectRule, _super);
65
+ function QilinEffectRule() {
66
+ var _this = _super !== null && _super.apply(this, arguments) || this;
67
+ _this.ruleId = RuleId_1.RuleId.QilinEffect;
68
+ return _this;
69
+ }
70
+ QilinEffectRule.prototype.getPlayerMoves = function () {
71
+ var e_1, _a;
72
+ var _this = this;
73
+ var cardsToCopy = [];
74
+ try {
75
+ for (var _b = __values(this.game.players), _c = _b.next(); !_c.done; _c = _b.next()) {
76
+ var player = _c.value;
77
+ if (player !== this.player) {
78
+ cardsToCopy.push.apply(cardsToCopy, __spreadArray([], __read(new Pantheon_1.Pantheon(this.game, player).visibleEntities
79
+ .location(function (l) { return l.x === _this.card.location.x; })
80
+ .id(function (id) {
81
+ var _a;
82
+ var entity = id.front;
83
+ var trigger = (_a = EntityDescription_1.entities[entity].effect) === null || _a === void 0 ? void 0 : _a.trigger;
84
+ return (0, Entity_1.isCreature)(entity) && trigger === Effect_1.isPlaced;
85
+ })
86
+ .getIndexes()), false));
87
+ }
88
+ }
89
+ }
90
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
91
+ finally {
92
+ try {
93
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
94
+ }
95
+ finally { if (e_1) throw e_1.error; }
96
+ }
97
+ return cardsToCopy.map(function (index) { return _this.customMove(CustomMoveType_1.CustomMoveType.ChooseEntityCard, index); });
98
+ };
99
+ QilinEffectRule.prototype.onCustomMove = function (move) {
100
+ if (move.type === CustomMoveType_1.CustomMoveType.ChooseEntityCard) {
101
+ var card = this.material(MaterialType_1.MaterialType.EntityCard).getItem(move.data);
102
+ var effect = EntityDescription_1.entities[card.id.front].effect;
103
+ var moves = new effect.rule(this.game).playEffect();
104
+ if (!moves.some(function (move) { return move.kind === rules_api_1.MoveKind.RulesMove; })) {
105
+ moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
106
+ }
107
+ return moves;
108
+ }
109
+ return [];
110
+ };
111
+ return QilinEffectRule;
112
+ }(Effect_1.PlayerEffectRule));
113
+ exports.QilinEffectRule = QilinEffectRule;
@@ -1,6 +1,8 @@
1
1
  import { CustomMove, PlayerTurnRule, RuleMove, RuleStep } from '@gamepark/rules-api';
2
+ import { PendingEffect } from '../../material/entity/Effect';
2
3
  export declare class ResolveEffectsRule extends PlayerTurnRule {
3
4
  onRuleStart(_move: RuleMove, previousRule: RuleStep): CustomMove<number>[];
4
5
  getPlayerMoves(): CustomMove<number>[];
5
6
  onCustomMove(move: CustomMove): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
7
+ playEffect(pendingEffect: PendingEffect): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
6
8
  }