@gamepark/mythologies 0.8.4 → 0.9.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.
@@ -122,6 +122,7 @@ export declare class MythologiesRules extends SecretMaterialRules<PlayerColor, M
122
122
  6: FillGapStrategy<number, number, number>;
123
123
  19: StackingStrategy;
124
124
  22: PositiveSequenceStrategy<number, number, number>;
125
+ 23: FillGapStrategy<number, number, number>;
125
126
  };
126
127
  4: {
127
128
  5: PositiveSequenceStrategy<number, number, number>;
@@ -134,7 +135,7 @@ export declare class MythologiesRules extends SecretMaterialRules<PlayerColor, M
134
135
  hidingStrategies: {
135
136
  2: {
136
137
  2: import("@gamepark/rules-api").HidingStrategy<number, number>;
137
- 3: (item: MaterialItem) => string[];
138
+ 3: import("@gamepark/rules-api").HidingStrategy<number, number>;
138
139
  7: (item: MaterialItem, player?: PlayerColor) => string[];
139
140
  6: (item: MaterialItem, player?: PlayerColor) => string[];
140
141
  };
@@ -149,6 +149,7 @@ var MythologiesRules = (function (_super) {
149
149
  _c[LocationType_1.LocationType.SanctuaryCreatureSpot] = new rules_api_1.FillGapStrategy(),
150
150
  _c[LocationType_1.LocationType.Pantheon] = new rules_api_1.StackingStrategy(),
151
151
  _c[LocationType_1.LocationType.PlayerDiscard] = new rules_api_1.PositiveSequenceStrategy(),
152
+ _c[LocationType_1.LocationType.PlayerSelectedCards] = new rules_api_1.FillGapStrategy(),
152
153
  _c),
153
154
  _b[MaterialType_1.MaterialType.DraftToken] = (_d = {},
154
155
  _d[LocationType_1.LocationType.PlayerHand] = new rules_api_1.PositiveSequenceStrategy(),
@@ -161,7 +162,7 @@ var MythologiesRules = (function (_super) {
161
162
  _this.hidingStrategies = (_f = {},
162
163
  _f[MaterialType_1.MaterialType.EntityCard] = (_g = {},
163
164
  _g[LocationType_1.LocationType.GodsDeck] = rules_api_1.hideFront,
164
- _g[LocationType_1.LocationType.CreaturesDeck] = function (item) { return (item.location.rotation ? [] : ['id.front']); },
165
+ _g[LocationType_1.LocationType.CreaturesDeck] = rules_api_1.hideFront,
165
166
  _g[LocationType_1.LocationType.SanctuaryGodSpot] = function (item, player) { var _a; return (((_a = item.location.rotation) !== null && _a !== void 0 ? _a : player) === player ? [] : ['id.front']); },
166
167
  _g[LocationType_1.LocationType.SanctuaryCreatureSpot] = function (item, player) { var _a; return (((_a = item.location.rotation) !== null && _a !== void 0 ? _a : player) === player ? [] : ['id.front']); },
167
168
  _g),
@@ -21,7 +21,7 @@ export declare enum LocationType {
21
21
  PlayerGems = 20,
22
22
  PlayerFavor = 21,
23
23
  PlayerDiscard = 22,
24
- PlayerBufferArea = 23,
24
+ PlayerSelectedCards = 23,
25
25
  GameHelpArea = 24,
26
26
  CardsCount = 25
27
27
  }
@@ -25,7 +25,7 @@ var LocationType;
25
25
  LocationType[LocationType["PlayerGems"] = 20] = "PlayerGems";
26
26
  LocationType[LocationType["PlayerFavor"] = 21] = "PlayerFavor";
27
27
  LocationType[LocationType["PlayerDiscard"] = 22] = "PlayerDiscard";
28
- LocationType[LocationType["PlayerBufferArea"] = 23] = "PlayerBufferArea";
28
+ LocationType[LocationType["PlayerSelectedCards"] = 23] = "PlayerSelectedCards";
29
29
  LocationType[LocationType["GameHelpArea"] = 24] = "GameHelpArea";
30
30
  LocationType[LocationType["CardsCount"] = 25] = "CardsCount";
31
31
  })(LocationType = exports.LocationType || (exports.LocationType = {}));
@@ -37,7 +37,7 @@ exports.Poseidon = {
37
37
  PoseidonEffectRule.prototype.playEffect = function () {
38
38
  var cardLocation = this.remind(Memory_1.Memory.OngoingEffect).triggerEvent.location;
39
39
  var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
40
- var gain = pantheon.visibleEntities.location(function (l) { return (0, rules_api_1.areAdjacentSquares)(l, cardLocation); }).length;
40
+ var gain = pantheon.visibleEntities.id(function (id) { return (0, Entity_1.isCreature)(id.front); }).location(function (l) { return (0, rules_api_1.areAdjacentSquares)(l, cardLocation); }).length;
41
41
  return gain > 0 ? [pantheon.gainFavor(gain)] : [];
42
42
  };
43
43
  return PoseidonEffectRule;
@@ -16,7 +16,6 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.Ganesh = void 0;
19
- var Entity_1 = require("../../Entity");
20
19
  var LocationType_1 = require("../../LocationType");
21
20
  var MaterialType_1 = require("../../MaterialType");
22
21
  var Pantheon_1 = require("../../Pantheon");
@@ -32,12 +31,9 @@ exports.Ganesh = {
32
31
  return _super !== null && _super.apply(this, arguments) || this;
33
32
  }
34
33
  GaneshEffectRule.prototype.playEffect = function () {
35
- var creaturesSacrificed = this.material(MaterialType_1.MaterialType.EntityCard)
36
- .location(LocationType_1.LocationType.PlayerDiscard)
37
- .player(this.player)
38
- .id(function (id) { return (0, Entity_1.isCreature)(id.front); }).length;
34
+ var cardsInDiscard = this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.PlayerDiscard).player(this.player).length;
39
35
  var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
40
- return creaturesSacrificed > 0 ? [pantheon.gainFavor(Math.min(creaturesSacrificed, 5))] : [];
36
+ return cardsInDiscard > 0 ? [pantheon.gainFavor(Math.min(cardsInDiscard, 5))] : [];
41
37
  };
42
38
  return GaneshEffectRule;
43
39
  }(PlayerEffectRule_1.PlayerEffectRule))
@@ -1,13 +1,12 @@
1
1
  import { CustomMove, ItemMove, MaterialMove, PlayerTurnRule } from '@gamepark/rules-api';
2
+ import { PendingEffect } from '../material/entity/Effect';
2
3
  import { RuleId } from './RuleId';
3
4
  export declare class PlaceCardsRule extends PlayerTurnRule {
4
5
  isInvoke: boolean;
5
6
  getPlayerMoves(): MaterialMove<number, number, number, number>[];
6
- get infiniteEffects(): import("../material/entity/Effect").PendingEffect<import("../material/entity/Effect").TriggerEvent>[];
7
+ get infiniteEffects(): PendingEffect<import("../material/entity/Effect").TriggerEvent>[];
7
8
  isOncePerTurnAvailable(cardIndex: number): boolean;
8
- get tokens(): import("@gamepark/rules-api").Material<number, number, number>;
9
9
  beforeItemMove(move: ItemMove): MaterialMove<number, number, number, number>[];
10
- afterItemMove(move: ItemMove): import("@gamepark/rules-api").Shuffle<number>[];
11
10
  onCustomMove(move: CustomMove): MaterialMove<number, number, number, number>[];
12
11
  onPass(): MaterialMove<number, number, number, number>[];
13
12
  get nextRule(): import("@gamepark/rules-api").StartPlayerTurn<number, RuleId.PlaceCards> | import("@gamepark/rules-api").StartPlayerTurn<number, RuleId.Upkeep> | import("@gamepark/rules-api").StartPlayerTurn<number, RuleId.EndGame>;
@@ -76,8 +76,7 @@ var PlaceCardsRule = (function (_super) {
76
76
  var e_1, _a;
77
77
  var _this = this;
78
78
  var moves = this.infiniteEffects.map(function (effect) { return _this.customMove(CustomMoveType_1.CustomMoveType.PlayEffect, effect); });
79
- var tokens = this.tokens.getItems();
80
- var cards = this.material(MaterialType_1.MaterialType.EntityCard).index(tokens.map(function (token) { return token.location.parent; }));
79
+ var cards = this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.PlayerSelectedCards).player(this.player);
81
80
  if (cards.length) {
82
81
  var cardsICanInvoke = new Pantheon_1.Pantheon(this.game, this.player).gems < 4 ? cards.id(function (id) { return !(0, Entity_1.isGod)(id.front); }) : cards;
83
82
  try {
@@ -123,22 +122,10 @@ var PlaceCardsRule = (function (_super) {
123
122
  var oncePerTurnUsed = (_a = this.remind(Memory_1.Memory.OncePerTurn)) !== null && _a !== void 0 ? _a : [];
124
123
  return !oncePerTurnUsed.includes(cardIndex);
125
124
  };
126
- Object.defineProperty(PlaceCardsRule.prototype, "tokens", {
127
- get: function () {
128
- var _this = this;
129
- return this.material(MaterialType_1.MaterialType.DraftToken)
130
- .location(LocationType_1.LocationType.OnEntityCard)
131
- .id(function (id) { return id.back === _this.player; });
132
- },
133
- enumerable: false,
134
- configurable: true
135
- });
136
125
  PlaceCardsRule.prototype.beforeItemMove = function (move) {
137
126
  var moves = [];
138
127
  if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.EntityCard)(move)) {
139
- var token = this.tokens.parent(move.itemIndex);
140
- if (token.length) {
141
- moves.push(token.moveItem({ type: LocationType_1.LocationType.PlayerHand, player: this.player }));
128
+ if (this.material(MaterialType_1.MaterialType.EntityCard).getItem(move.itemIndex).location.type === LocationType_1.LocationType.PlayerSelectedCards) {
142
129
  var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
143
130
  if (move.location.type === LocationType_1.LocationType.PlayerDiscard) {
144
131
  moves.push(pantheon.gainGems(2));
@@ -150,12 +137,6 @@ var PlaceCardsRule = (function (_super) {
150
137
  }
151
138
  return moves;
152
139
  };
153
- PlaceCardsRule.prototype.afterItemMove = function (move) {
154
- if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.DraftToken)(move) && this.tokens.length === 0) {
155
- return [this.material(MaterialType_1.MaterialType.DraftToken).location(LocationType_1.LocationType.PlayerHand).player(this.player).shuffle()];
156
- }
157
- return [];
158
- };
159
140
  PlaceCardsRule.prototype.onCustomMove = function (move) {
160
141
  if (move.type === CustomMoveType_1.CustomMoveType.Pass) {
161
142
  return this.onPass();
@@ -169,7 +150,10 @@ var PlaceCardsRule = (function (_super) {
169
150
  }
170
151
  else if (move.type === CustomMoveType_1.CustomMoveType.PlayEffect) {
171
152
  this.memorize(Memory_1.Memory.PendingRule, this.game.rule);
172
- return new ResolveEffectsRule_1.ResolveEffectsRule(this.game).onCustomMove(move);
153
+ return new ResolveEffectsRule_1.ResolveEffectsRule(this.game).onPlayEffect(move.data);
154
+ }
155
+ else if (move.type === CustomMoveType_1.CustomMoveType.EndEffect) {
156
+ return new ResolveEffectsRule_1.ResolveEffectsRule(this.game).onEndEffect();
173
157
  }
174
158
  return [];
175
159
  };
@@ -197,7 +181,7 @@ var PlaceCardsRule = (function (_super) {
197
181
  };
198
182
  Object.defineProperty(PlaceCardsRule.prototype, "nextRule", {
199
183
  get: function () {
200
- if (this.material(MaterialType_1.MaterialType.DraftToken).location(LocationType_1.LocationType.OnEntityCard).length > 0) {
184
+ if (this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.PlayerSelectedCards).length > 0) {
201
185
  return this.startPlayerTurn(RuleId_1.RuleId.PlaceCards, this.nextPlayer);
202
186
  }
203
187
  else if (this.round < 4) {
@@ -1,12 +1,12 @@
1
1
  import { ItemMove, MaterialMove, SimultaneousRule } from '@gamepark/rules-api';
2
2
  import { EntityItem } from '../material/Entity';
3
3
  import { PlayerColor } from '../PlayerColor';
4
- import { RuleId } from './RuleId';
5
4
  export declare class PlaceTokenRule extends SimultaneousRule {
6
5
  onRuleStart(): MaterialMove<number, number, number, number>[];
7
6
  getActivePlayerLegalMoves(player: PlayerColor): import("@gamepark/rules-api").MoveItem<number, number, number>[];
8
7
  getAvailableCards(player: PlayerColor): import("@gamepark/rules-api").Material<number, number, number>;
9
8
  afterItemMove(move: ItemMove): import("@gamepark/rules-api").EndPlayerTurn<PlayerColor>[];
10
- getMovesAfterPlayersDone(): import("@gamepark/rules-api").StartRule<RuleId.DrawDestinyCard>[] | (import("@gamepark/rules-api").MoveItem<number, number, number> | import("@gamepark/rules-api").StartPlayerTurn<number, RuleId.PlaceCards>)[];
9
+ getMovesAfterPlayersDone(): MaterialMove<number, number, number, number>[];
10
+ get playersFromFirstPlayer(): number[];
11
11
  getMythologyBoardIndex(item: EntityItem): number;
12
12
  }
@@ -25,31 +25,6 @@ var __values = (this && this.__values) || function(o) {
25
25
  };
26
26
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
27
27
  };
28
- var __read = (this && this.__read) || function (o, n) {
29
- var m = typeof Symbol === "function" && o[Symbol.iterator];
30
- if (!m) return o;
31
- var i = m.call(o), r, ar = [], e;
32
- try {
33
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
34
- }
35
- catch (error) { e = { error: error }; }
36
- finally {
37
- try {
38
- if (r && !r.done && (m = i["return"])) m.call(i);
39
- }
40
- finally { if (e) throw e.error; }
41
- }
42
- return ar;
43
- };
44
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
45
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
46
- if (ar || !(i in from)) {
47
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
48
- ar[i] = from[i];
49
- }
50
- }
51
- return to.concat(ar || Array.prototype.slice.call(from));
52
- };
53
28
  Object.defineProperty(exports, "__esModule", { value: true });
54
29
  exports.PlaceTokenRule = void 0;
55
30
  var rules_api_1 = require("@gamepark/rules-api");
@@ -114,21 +89,58 @@ var PlaceTokenRule = (function (_super) {
114
89
  return [];
115
90
  };
116
91
  PlaceTokenRule.prototype.getMovesAfterPlayersDone = function () {
117
- var _this = this;
92
+ var e_2, _a;
118
93
  var tokensPlaced = this.material(MaterialType_1.MaterialType.DraftToken).location(LocationType_1.LocationType.OnEntityCard);
119
94
  if (tokensPlaced.length < this.game.players.length * 2) {
120
95
  return [this.startRule(RuleId_1.RuleId.DrawDestinyCard)];
121
96
  }
122
97
  else {
123
- var selectedCardsIndexes = tokensPlaced.getItems().map(function (item) { return item.location.parent; });
124
- var selectedCards = this.material(MaterialType_1.MaterialType.EntityCard).index(selectedCardsIndexes);
125
- var deckCardsToReveal = selectedCards.location(LocationType_1.LocationType.CreaturesDeck);
126
- var sanctuaryCardsToReveal = selectedCards.location(function (l) { return (l.type === LocationType_1.LocationType.SanctuaryCreatureSpot || l.type === LocationType_1.LocationType.CreaturesDeck) && l.rotation !== undefined; });
127
- return __spreadArray(__spreadArray(__spreadArray([], __read(deckCardsToReveal.moveItems(function (item) { return ({ type: LocationType_1.LocationType.SanctuaryCreatureSpot, parent: _this.getMythologyBoardIndex(item) }); })), false), __read(sanctuaryCardsToReveal.rotateItems(undefined)), false), [
128
- this.startPlayerTurn(RuleId_1.RuleId.PlaceCards, this.material(MaterialType_1.MaterialType.FirstPlayerToken).getItem().location.player)
129
- ], false);
98
+ var moves = [];
99
+ var _loop_1 = function (player) {
100
+ var e_3, _d;
101
+ var playerTokens = tokensPlaced.id(function (id) { return id.back === player; });
102
+ try {
103
+ for (var _e = (e_3 = void 0, __values(playerTokens.getIndexes())), _f = _e.next(); !_f.done; _f = _e.next()) {
104
+ var index = _f.value;
105
+ var tokenParent = playerTokens.getItem(index).location.parent;
106
+ moves.push(playerTokens.index(index).moveItem({ type: LocationType_1.LocationType.PlayerHand, player: player }), this_1.material(MaterialType_1.MaterialType.EntityCard).index(tokenParent).moveItem({ type: LocationType_1.LocationType.PlayerSelectedCards, player: player }));
107
+ }
108
+ }
109
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
110
+ finally {
111
+ try {
112
+ if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
113
+ }
114
+ finally { if (e_3) throw e_3.error; }
115
+ }
116
+ };
117
+ var this_1 = this;
118
+ try {
119
+ for (var _b = __values(this.playersFromFirstPlayer), _c = _b.next(); !_c.done; _c = _b.next()) {
120
+ var player = _c.value;
121
+ _loop_1(player);
122
+ }
123
+ }
124
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
125
+ finally {
126
+ try {
127
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
128
+ }
129
+ finally { if (e_2) throw e_2.error; }
130
+ }
131
+ moves.push(this.startPlayerTurn(RuleId_1.RuleId.PlaceCards, this.material(MaterialType_1.MaterialType.FirstPlayerToken).getItem().location.player));
132
+ return moves;
130
133
  }
131
134
  };
135
+ Object.defineProperty(PlaceTokenRule.prototype, "playersFromFirstPlayer", {
136
+ get: function () {
137
+ var firstPlayer = this.material(MaterialType_1.MaterialType.FirstPlayerToken).getItem().location.player;
138
+ var index = this.game.players.indexOf(firstPlayer);
139
+ return this.game.players.slice(index).concat(this.game.players.slice(0, index));
140
+ },
141
+ enumerable: false,
142
+ configurable: true
143
+ });
132
144
  PlaceTokenRule.prototype.getMythologyBoardIndex = function (item) {
133
145
  return this.material(MaterialType_1.MaterialType.MythologyBoard)
134
146
  .id(function (id) { return id.mythology === item.id.back.mythology; })
@@ -76,18 +76,32 @@ var UpkeepRule = (function (_super) {
76
76
  return _super !== null && _super.apply(this, arguments) || this;
77
77
  }
78
78
  UpkeepRule.prototype.onRuleStart = function () {
79
+ var e_1, _a;
79
80
  this.forget(Memory_1.Memory.OncePerTurn);
80
81
  var moves = [
81
82
  this.material(MaterialType_1.MaterialType.RoundToken).moveItem(function (item) { return (__assign(__assign({}, item.location), { id: item.location.id + 1 })); }),
82
83
  this.material(MaterialType_1.MaterialType.FirstPlayerToken).moveItem({ type: LocationType_1.LocationType.FirstPlayerTokenSpot, player: this.nextPlayer })
83
84
  ];
84
85
  moves.push.apply(moves, __spreadArray([], __read(this.completeSanctuary()), false));
86
+ try {
87
+ for (var _b = __values(this.game.players), _c = _b.next(); !_c.done; _c = _b.next()) {
88
+ var player = _c.value;
89
+ moves.push(this.material(MaterialType_1.MaterialType.DraftToken).location(LocationType_1.LocationType.PlayerHand).player(player).shuffle());
90
+ }
91
+ }
92
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
93
+ finally {
94
+ try {
95
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
96
+ }
97
+ finally { if (e_1) throw e_1.error; }
98
+ }
85
99
  moves.push(this.material(MaterialType_1.MaterialType.DestinyCard).location(LocationType_1.LocationType.CurrentDestiny).moveItemsAtOnce({ type: LocationType_1.LocationType.DestinyDeck }));
86
100
  moves.push(this.nextRule);
87
101
  return moves;
88
102
  };
89
103
  UpkeepRule.prototype.completeSanctuary = function (loki) {
90
- var e_1, _a;
104
+ var e_2, _a;
91
105
  var moves = [];
92
106
  var mythologyBoards = this.material(MaterialType_1.MaterialType.MythologyBoard);
93
107
  try {
@@ -106,12 +120,12 @@ var UpkeepRule = (function (_super) {
106
120
  }
107
121
  }
108
122
  }
109
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
123
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
110
124
  finally {
111
125
  try {
112
126
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
113
127
  }
114
- finally { if (e_1) throw e_1.error; }
128
+ finally { if (e_2) throw e_2.error; }
115
129
  }
116
130
  return moves;
117
131
  };
@@ -1,11 +1,10 @@
1
- import { Material, MaterialMove } from '@gamepark/rules-api';
1
+ import { MaterialMove } from '@gamepark/rules-api';
2
2
  import { PlayerEffectRule } from '../../material/entity/PlayerEffectRule';
3
3
  import { RuleId } from '../RuleId';
4
4
  export declare class AthenaEffectRule extends PlayerEffectRule {
5
5
  ruleId: RuleId;
6
6
  onRuleStart(): MaterialMove<number, number, number, number>[];
7
7
  getPlayerMoves(): MaterialMove[];
8
- getPiles(): Material<number, number, number>[];
9
8
  onEndEffect(): MaterialMove<number, number, number, number>[];
10
9
  onRuleEnd(): never[];
11
10
  }
@@ -55,7 +55,6 @@ exports.AthenaEffectRule = void 0;
55
55
  var CustomMoveType_1 = require("../../CustomMoveType");
56
56
  var PlayerEffectRule_1 = require("../../material/entity/PlayerEffectRule");
57
57
  var LocationType_1 = require("../../material/LocationType");
58
- var MaterialType_1 = require("../../material/MaterialType");
59
58
  var Pantheon_1 = require("../../material/Pantheon");
60
59
  var Memory_1 = require("../../Memory");
61
60
  var RuleId_1 = require("../RuleId");
@@ -93,7 +92,7 @@ var AthenaEffectRule = (function (_super) {
93
92
  var e_2, _a;
94
93
  var moves = [];
95
94
  var legalSpaces = new Pantheon_1.Pantheon(this.game, this.player).legalSpaces;
96
- var piles = this.getPiles();
95
+ var piles = new Pantheon_1.Pantheon(this.game, this.player).getPiles();
97
96
  var lockedLocations = this.remind(Memory_1.Memory.TargetLocations);
98
97
  var _loop_1 = function (pile) {
99
98
  var e_3, _b;
@@ -117,9 +116,6 @@ var AthenaEffectRule = (function (_super) {
117
116
  }
118
117
  finally { if (e_3) throw e_3.error; }
119
118
  }
120
- if (location.type !== LocationType_1.LocationType.PlayerBufferArea) {
121
- moves.push(pile.moveItemsAtOnce({ type: LocationType_1.LocationType.PlayerBufferArea, player: this_1.player }));
122
- }
123
119
  }
124
120
  };
125
121
  var this_1 = this;
@@ -136,22 +132,9 @@ var AthenaEffectRule = (function (_super) {
136
132
  }
137
133
  finally { if (e_2) throw e_2.error; }
138
134
  }
139
- if (!piles.some(function (pile) { var _a; return ((_a = pile.getItem()) === null || _a === void 0 ? void 0 : _a.location.type) === LocationType_1.LocationType.PlayerBufferArea; })) {
140
- moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
141
- }
135
+ moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
142
136
  return moves;
143
137
  };
144
- AthenaEffectRule.prototype.getPiles = function () {
145
- var piles = new Pantheon_1.Pantheon(this.game, this.player).getPiles();
146
- var bufferAreaPile = this.material(MaterialType_1.MaterialType.EntityCard)
147
- .player(this.player)
148
- .location(LocationType_1.LocationType.PlayerBufferArea)
149
- .sort(function (item) { return item.location.z; });
150
- if (bufferAreaPile.length > 0) {
151
- piles.push(bufferAreaPile);
152
- }
153
- return piles;
154
- };
155
138
  AthenaEffectRule.prototype.onEndEffect = function () {
156
139
  var _a;
157
140
  var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
@@ -3,6 +3,5 @@ import { SacrificeEffectRule } from '../../material/entity/SacrificeEffectRule';
3
3
  import { RuleId } from '../RuleId';
4
4
  export declare class CaimanEffectRule extends SacrificeEffectRule {
5
5
  ruleId: RuleId;
6
- getCardsToSacrifice(): import("@gamepark/rules-api").Material<number, number, number>;
7
6
  onSacrifice(move: MoveItem): (import("@gamepark/rules-api").CustomMove<number> | import("@gamepark/rules-api").CreateItem<number, number, number> | MoveItem<number, number, number>)[];
8
7
  }
@@ -46,7 +46,6 @@ var Entity_1 = require("../../material/Entity");
46
46
  var SacrificeEffectRule_1 = require("../../material/entity/SacrificeEffectRule");
47
47
  var LocationType_1 = require("../../material/LocationType");
48
48
  var MaterialType_1 = require("../../material/MaterialType");
49
- var Mythology_1 = require("../../material/Mythology");
50
49
  var Pantheon_1 = require("../../material/Pantheon");
51
50
  var RuleId_1 = require("../RuleId");
52
51
  var CaimanEffectRule = (function (_super) {
@@ -56,9 +55,6 @@ var CaimanEffectRule = (function (_super) {
56
55
  _this.ruleId = RuleId_1.RuleId.CaimanEffect;
57
56
  return _this;
58
57
  }
59
- CaimanEffectRule.prototype.getCardsToSacrifice = function () {
60
- return _super.prototype.getCardsToSacrifice.call(this).id(function (id) { return (0, Entity_1.entityMythology)(id.front) !== Mythology_1.Mythology.Inca; });
61
- };
62
58
  CaimanEffectRule.prototype.onSacrifice = function (move) {
63
59
  var card = this.material(MaterialType_1.MaterialType.EntityCard).getItem(move.itemIndex);
64
60
  var mythology = (0, Entity_1.entityMythology)(card.id.front);
@@ -21,6 +21,7 @@ var PlaceCardEffectRule_1 = require("../../material/entity/PlaceCardEffectRule")
21
21
  var SacrificeEffectRule_1 = require("../../material/entity/SacrificeEffectRule");
22
22
  var LocationType_1 = require("../../material/LocationType");
23
23
  var MaterialType_1 = require("../../material/MaterialType");
24
+ var Memory_1 = require("../../Memory");
24
25
  var RuleId_1 = require("../RuleId");
25
26
  var CobraEffectRule = (function (_super) {
26
27
  __extends(CobraEffectRule, _super);
@@ -36,8 +37,9 @@ var CobraEffectRule = (function (_super) {
36
37
  CobraEffectRule.prototype.onSacrifice = function (move) {
37
38
  var cards = this.material(MaterialType_1.MaterialType.EntityCard);
38
39
  var mythology = (0, Entity_1.entityMythology)(cards.getItem(move.itemIndex).id.front);
39
- var creaturesDeck = cards.location(LocationType_1.LocationType.CreaturesDeck).locationId(mythology);
40
- return [creaturesDeck.maxBy(function (item) { return item.location.x; }).rotateItem(true), this.startRule(RuleId_1.RuleId.CobraInvokeEffect)];
40
+ var creaturesDeck = cards.location(LocationType_1.LocationType.CreaturesDeck).locationId(mythology).deck();
41
+ this.memorize(Memory_1.Memory.TargetEntities, creaturesDeck.getIndex());
42
+ return [creaturesDeck.dealOne({ type: LocationType_1.LocationType.PlayerSelectedCards, player: this.player }), this.startRule(RuleId_1.RuleId.CobraInvokeEffect)];
41
43
  };
42
44
  return CobraEffectRule;
43
45
  }(SacrificeEffectRule_1.SacrificeEffectRule));
@@ -48,7 +50,7 @@ var CobraInvokeEffect = (function (_super) {
48
50
  return _super !== null && _super.apply(this, arguments) || this;
49
51
  }
50
52
  CobraInvokeEffect.prototype.getCardsToPlace = function () {
51
- return this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.CreaturesDeck).rotation(true);
53
+ return this.material(MaterialType_1.MaterialType.EntityCard).index(this.remind(Memory_1.Memory.TargetEntities));
52
54
  };
53
55
  return CobraInvokeEffect;
54
56
  }(PlaceCardEffectRule_1.InvokeEffectRule));
@@ -33,6 +33,7 @@ var PlayerEffectRule_1 = require("../../material/entity/PlayerEffectRule");
33
33
  var LocationType_1 = require("../../material/LocationType");
34
34
  var MaterialType_1 = require("../../material/MaterialType");
35
35
  var Pantheon_1 = require("../../material/Pantheon");
36
+ var Memory_1 = require("../../Memory");
36
37
  var RuleId_1 = require("../RuleId");
37
38
  var KinnaraEffectRule = (function (_super) {
38
39
  __extends(KinnaraEffectRule, _super);
@@ -52,9 +53,9 @@ var KinnaraEffectRule = (function (_super) {
52
53
  try {
53
54
  for (var mythologies_1 = __values(mythologies), mythologies_1_1 = mythologies_1.next(); !mythologies_1_1.done; mythologies_1_1 = mythologies_1.next()) {
54
55
  var mythology = mythologies_1_1.value;
55
- moves.push(creaturesDecks.locationId(mythology).deck().moveItem({ type: LocationType_1.LocationType.PlayerBufferArea, player: this.player }));
56
+ moves.push(creaturesDecks.locationId(mythology).deck().moveItem({ type: LocationType_1.LocationType.PlayerSelectedCards, player: this.player }));
56
57
  if (gems >= 4) {
57
- moves.push(godsDecks.locationId(mythology).deck().moveItem({ type: LocationType_1.LocationType.PlayerBufferArea, player: this.player }));
58
+ moves.push(godsDecks.locationId(mythology).deck().moveItem({ type: LocationType_1.LocationType.PlayerSelectedCards, player: this.player }));
58
59
  }
59
60
  }
60
61
  }
@@ -68,7 +69,8 @@ var KinnaraEffectRule = (function (_super) {
68
69
  return moves;
69
70
  };
70
71
  KinnaraEffectRule.prototype.afterItemMove = function (move) {
71
- if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.EntityCard)(move) && move.location.type === LocationType_1.LocationType.PlayerBufferArea) {
72
+ if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.EntityCard)(move) && move.location.type === LocationType_1.LocationType.PlayerSelectedCards) {
73
+ this.memorize(Memory_1.Memory.TargetEntities, move.itemIndex);
72
74
  return [this.startRule(RuleId_1.RuleId.KinnaraPlaceEffect)];
73
75
  }
74
76
  return [];
@@ -82,7 +84,7 @@ var KinnaraPlaceEffectRule = (function (_super) {
82
84
  return _super !== null && _super.apply(this, arguments) || this;
83
85
  }
84
86
  KinnaraPlaceEffectRule.prototype.getCardsToPlace = function () {
85
- return this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.PlayerBufferArea).player(this.player);
87
+ return this.material(MaterialType_1.MaterialType.EntityCard).index(this.remind(Memory_1.Memory.TargetEntities));
86
88
  };
87
89
  return KinnaraPlaceEffectRule;
88
90
  }(PlaceCardEffectRule_1.PlaceCardEffectRule));
@@ -6,6 +6,7 @@ export declare class ResolveEffectsRule extends PlayerTurnRule {
6
6
  onRuleStart(_move: RuleMove, previousRule: RuleStep): CustomMove<number>[];
7
7
  getPlayerMoves(): CustomMove<number>[];
8
8
  onCustomMove(move: CustomMove): MaterialMove<number, number, number, number>[];
9
+ onPlayEffect(pendingEffect: PendingEffect): MaterialMove<number, number, number, number>[];
9
10
  playEffect(pendingEffect: PendingEffect): MaterialMove<number, number, number, number>[];
10
11
  onEndEffect(): MaterialMove<number, number, number, number>[];
11
12
  }
@@ -83,21 +83,23 @@ var ResolveEffectsRule = (function (_super) {
83
83
  };
84
84
  ResolveEffectsRule.prototype.onCustomMove = function (move) {
85
85
  if (move.type === CustomMoveType_1.CustomMoveType.PlayEffect) {
86
- var pendingEffect_1 = move.data;
87
- var pendingEffects = this.remind(Memory_1.Memory.PendingEffects);
88
- if (pendingEffects.length) {
89
- pendingEffects[0] = pendingEffects[0].filter(function (effect) { return !(0, lodash_1.isEqual)(effect, pendingEffect_1); });
90
- if (pendingEffects[0].length === 0) {
91
- pendingEffects.splice(0, 1);
92
- }
93
- }
94
- return this.playEffect(pendingEffect_1);
86
+ return this.onPlayEffect(move.data);
95
87
  }
96
88
  else if (move.type === CustomMoveType_1.CustomMoveType.EndEffect) {
97
89
  return this.onEndEffect();
98
90
  }
99
91
  return [];
100
92
  };
93
+ ResolveEffectsRule.prototype.onPlayEffect = function (pendingEffect) {
94
+ var pendingEffects = this.remind(Memory_1.Memory.PendingEffects);
95
+ if (pendingEffects.length) {
96
+ pendingEffects[0] = pendingEffects[0].filter(function (effect) { return !(0, lodash_1.isEqual)(effect, pendingEffect); });
97
+ if (pendingEffects[0].length === 0) {
98
+ pendingEffects.splice(0, 1);
99
+ }
100
+ }
101
+ return this.playEffect(pendingEffect);
102
+ };
101
103
  ResolveEffectsRule.prototype.playEffect = function (pendingEffect) {
102
104
  this.memorize(Memory_1.Memory.OngoingEffect, pendingEffect);
103
105
  var card = this.material(MaterialType_1.MaterialType.EntityCard).getItem(pendingEffect.cardIndex);
@@ -23,6 +23,7 @@ var PlayerEffectRule_1 = require("../../material/entity/PlayerEffectRule");
23
23
  var LocationType_1 = require("../../material/LocationType");
24
24
  var MaterialType_1 = require("../../material/MaterialType");
25
25
  var Pantheon_1 = require("../../material/Pantheon");
26
+ var Memory_1 = require("../../Memory");
26
27
  var RuleId_1 = require("../RuleId");
27
28
  var UkukuEffectRule = (function (_super) {
28
29
  __extends(UkukuEffectRule, _super);
@@ -32,10 +33,11 @@ var UkukuEffectRule = (function (_super) {
32
33
  return _this;
33
34
  }
34
35
  UkukuEffectRule.prototype.getPlayerMoves = function () {
35
- return new Destiny_1.Destiny(this.game).creaturesOnTopOfDecks.moveItems({ type: LocationType_1.LocationType.PlayerBufferArea, player: this.player });
36
+ return new Destiny_1.Destiny(this.game).creaturesOnTopOfDecks.moveItems({ type: LocationType_1.LocationType.PlayerSelectedCards, player: this.player });
36
37
  };
37
38
  UkukuEffectRule.prototype.afterItemMove = function (move) {
38
- if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.EntityCard)(move) && move.location.type === LocationType_1.LocationType.PlayerBufferArea) {
39
+ if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.EntityCard)(move) && move.location.type === LocationType_1.LocationType.PlayerSelectedCards) {
40
+ this.memorize(Memory_1.Memory.TargetEntities, move.itemIndex);
39
41
  return [this.startRule(RuleId_1.RuleId.UkukuPlaceEffect)];
40
42
  }
41
43
  return [];
@@ -49,7 +51,7 @@ var UkukuPlaceEffectRule = (function (_super) {
49
51
  return _super !== null && _super.apply(this, arguments) || this;
50
52
  }
51
53
  UkukuPlaceEffectRule.prototype.getCardsToPlace = function () {
52
- return this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.PlayerBufferArea).player(this.player);
54
+ return this.material(MaterialType_1.MaterialType.EntityCard).index(this.remind(Memory_1.Memory.TargetEntities));
53
55
  };
54
56
  UkukuPlaceEffectRule.prototype.getAvailableDestinations = function (cardIndex) {
55
57
  var ukuku = this.material(MaterialType_1.MaterialType.EntityCard).getItem(cardIndex);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamepark/mythologies",
3
- "version": "0.8.4",
3
+ "version": "0.9.0",
4
4
  "description": "The rules of Mythologies adapted for Game Park",
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.js",
@@ -29,5 +29,5 @@
29
29
  "i18next": "^22.0.3",
30
30
  "lodash": "^4.17.21"
31
31
  },
32
- "gitHead": "bbddb0783a945a0bd7de6614b87b9896047f228c"
32
+ "gitHead": "3773b3c774a617c76ae1c6e93e48cbac8b41d0e7"
33
33
  }