@gamepark/mythologies 0.9.3 → 0.10.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.
@@ -11,8 +11,8 @@ export declare enum Entity {
11
11
  Centaur = 6,
12
12
  Gorgon = 7,
13
13
  Cyclops = 8,
14
- Griffin = 9,
15
- Chimera = 10,
14
+ Chimera = 9,
15
+ Griffin = 10,
16
16
  Odin = 11,
17
17
  Thor = 12,
18
18
  Loki = 13,
@@ -11,8 +11,8 @@ var Entity;
11
11
  Entity[Entity["Centaur"] = 6] = "Centaur";
12
12
  Entity[Entity["Gorgon"] = 7] = "Gorgon";
13
13
  Entity[Entity["Cyclops"] = 8] = "Cyclops";
14
- Entity[Entity["Griffin"] = 9] = "Griffin";
15
- Entity[Entity["Chimera"] = 10] = "Chimera";
14
+ Entity[Entity["Chimera"] = 9] = "Chimera";
15
+ Entity[Entity["Griffin"] = 10] = "Griffin";
16
16
  Entity[Entity["Odin"] = 11] = "Odin";
17
17
  Entity[Entity["Thor"] = 12] = "Thor";
18
18
  Entity[Entity["Loki"] = 13] = "Loki";
@@ -1,4 +1,4 @@
1
- import { Material, MaterialGame, MaterialItem, MaterialMove, MaterialRulesPart, MoveItem, XYCoordinates } from '@gamepark/rules-api';
1
+ import { Material, MaterialGame, MaterialMove, MaterialRulesPart, MoveItem, XYCoordinates } from '@gamepark/rules-api';
2
2
  import { PlayerColor } from '../PlayerColor';
3
3
  import { Entity, EntityItem } from './Entity';
4
4
  import { TriggerEvent } from './entity/Effect';
@@ -29,7 +29,7 @@ export declare class Pantheon extends MaterialRulesPart {
29
29
  updateGrid(gridAfter?: (number | null)[][]): TriggerEvent[];
30
30
  private getEntitiesMoved;
31
31
  private getEntitiesCrushed;
32
- gainBonus(grid?: (number | null)[][]): MaterialMove<number, number, number, number>[];
32
+ gainBonus(grid?: (number | null)[][]): MoveItem<number, number, number>[];
33
33
  gainLineBonus(y: number): MoveItem<number, number, number>[];
34
34
  gainColumnBonus(x: number): MoveItem<number, number, number>[];
35
35
  getBonusGem(y: number): Material<number, number, number>;
@@ -44,7 +44,6 @@ export declare class Pantheon extends MaterialRulesPart {
44
44
  get mythologies(): import("./Mythology").Mythology[];
45
45
  get missingMythologies(): import("./Mythology").Mythology[];
46
46
  onEntitySacrificed(cardIndex: number): void;
47
- hasCrushed(card: MaterialItem): boolean;
48
47
  isOpponentOngoingEffect(): boolean;
49
48
  replaceSacrifice(cards: EntityItem[]): Material<number, number, number>;
50
49
  sacrificeToPreventMove(): MoveItem<number, number, number>[];
@@ -212,10 +212,11 @@ var Pantheon = (function (_super) {
212
212
  moves.push(this.spendGems(4));
213
213
  }
214
214
  var grid = this.indexGrid;
215
+ var crush = grid[move.location.y][move.location.x] !== null;
215
216
  grid[move.location.y][move.location.x] = move.itemIndex;
216
217
  moves.push.apply(moves, __spreadArray([], __read(this.gainBonus(grid)), false));
217
218
  var triggerEffectsRule = new TriggerEffectsRule_1.TriggerEffectsRule(this.game);
218
- triggerEffectsRule.triggerCardEffect(move.itemIndex, location, { type: Effect_1.TriggerEventType.SelfPlaced });
219
+ triggerEffectsRule.triggerCardEffect(move.itemIndex, location, { type: Effect_1.TriggerEventType.SelfPlaced, crush: crush });
219
220
  var triggerEvents = this.updateGrid(grid);
220
221
  var invoked = this.isInvoke;
221
222
  if (invoked) {
@@ -461,9 +462,6 @@ var Pantheon = (function (_super) {
461
462
  new TriggerEffectsRule_1.TriggerEffectsRule(this.game).triggerEffects({ type: Effect_1.TriggerEventType.EntitySacrificed, card: card, cardIndex: cardIndex });
462
463
  }
463
464
  };
464
- Pantheon.prototype.hasCrushed = function (card) {
465
- return this.allCards.location(function (l) { return l.x === card.location.x && l.y === card.location.y && l.z < card.location.z; }).length > 0;
466
- };
467
465
  Pantheon.prototype.isOpponentOngoingEffect = function () {
468
466
  var ongoingEffect = this.remind(Memory_1.Memory.OngoingEffect);
469
467
  if (!ongoingEffect)
@@ -40,6 +40,7 @@ export declare enum TriggerEventType {
40
40
  }
41
41
  export type SelfPlaced = {
42
42
  type: TriggerEventType.SelfPlaced;
43
+ crush: boolean;
43
44
  };
44
45
  export type EndOfGameEvent = {
45
46
  type: TriggerEventType.EndOfGame;
@@ -53,6 +54,7 @@ export type EntityPlaced = {
53
54
  invoked: boolean;
54
55
  };
55
56
  export declare const isPlaced: (event: TriggerEvent) => event is SelfPlaced;
57
+ export declare const isPlacedCrush: (event: TriggerEvent) => event is SelfPlaced;
56
58
  export declare enum LineEventType {
57
59
  BonusGain = 1,
58
60
  Completed = 2
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isEndOfMyTurn = exports.isSacrificed = exports.isCrushed = exports.oncePerTurn = exports.LineEventType = exports.isPlaced = exports.isEndOfGame = exports.TriggerEventType = exports.isTriggeredEffect = void 0;
3
+ exports.isEndOfMyTurn = exports.isSacrificed = exports.isCrushed = exports.oncePerTurn = exports.LineEventType = exports.isPlacedCrush = exports.isPlaced = exports.isEndOfGame = exports.TriggerEventType = exports.isTriggeredEffect = void 0;
4
4
  var isTriggeredEffect = function (effect) { return typeof effect.trigger === 'function'; };
5
5
  exports.isTriggeredEffect = isTriggeredEffect;
6
6
  var TriggerEventType;
@@ -20,6 +20,8 @@ var isEndOfGame = function (event) { return event.type === TriggerEventType.EndO
20
20
  exports.isEndOfGame = isEndOfGame;
21
21
  var isPlaced = function (event) { return event.type === TriggerEventType.SelfPlaced; };
22
22
  exports.isPlaced = isPlaced;
23
+ var isPlacedCrush = function (event) { return (0, exports.isPlaced)(event) && event.crush; };
24
+ exports.isPlacedCrush = isPlacedCrush;
23
25
  var LineEventType;
24
26
  (function (LineEventType) {
25
27
  LineEventType[LineEventType["BonusGain"] = 1] = "BonusGain";
@@ -14,5 +14,5 @@ export declare abstract class MoveEffectRule extends PlayerEffectRule {
14
14
  onCardMoved(_move: MoveItem): MaterialMove[];
15
15
  onCardSacrificed(move: MoveItem): MaterialMove[];
16
16
  onEndEffect(): MaterialMove<number, number, number, number>[];
17
- updateGridAfterMoves(): MaterialMove<number, number, number, number>[];
17
+ updateGridAfterMoves(): MoveItem<number, number, number>[];
18
18
  }
@@ -116,7 +116,7 @@ var MoveEffectRule = (function (_super) {
116
116
  return [];
117
117
  };
118
118
  MoveEffectRule.prototype.onEndEffect = function () {
119
- return this.updateGridAfterMoves().concat(_super.prototype.onEndEffect.call(this));
119
+ return __spreadArray(__spreadArray([], __read(this.updateGridAfterMoves()), false), __read(_super.prototype.onEndEffect.call(this)), false);
120
120
  };
121
121
  MoveEffectRule.prototype.updateGridAfterMoves = function () {
122
122
  var _a;
@@ -13,5 +13,5 @@ export declare abstract class SimultaneousMoveEffectRule extends SimultaneousEff
13
13
  onCardMoved(move: MoveItem): MaterialMove[];
14
14
  onCardSacrificed(move: MoveItem): MaterialMove[];
15
15
  getMovesAfterPlayersDone(): MaterialMove[];
16
- updatePlayersGrids(): MaterialMove[];
16
+ updatePlayersGrids(): MoveItem[];
17
17
  }
@@ -14,17 +14,6 @@ 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
  var __read = (this && this.__read) || function (o, n) {
29
18
  var m = typeof Symbol === "function" && o[Symbol.iterator];
30
19
  if (!m) return o;
@@ -50,6 +39,17 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
50
39
  }
51
40
  return to.concat(ar || Array.prototype.slice.call(from));
52
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
+ };
53
53
  Object.defineProperty(exports, "__esModule", { value: true });
54
54
  exports.SimultaneousMoveEffectRule = void 0;
55
55
  var rules_api_1 = require("@gamepark/rules-api");
@@ -112,7 +112,7 @@ var SimultaneousMoveEffectRule = (function (_super) {
112
112
  return [this.endPlayerTurn(move.location.player)];
113
113
  };
114
114
  SimultaneousMoveEffectRule.prototype.getMovesAfterPlayersDone = function () {
115
- return this.updatePlayersGrids().concat(_super.prototype.getMovesAfterPlayersDone.call(this));
115
+ return __spreadArray(__spreadArray([], __read(this.updatePlayersGrids()), false), __read(_super.prototype.getMovesAfterPlayersDone.call(this)), false);
116
116
  };
117
117
  SimultaneousMoveEffectRule.prototype.updatePlayersGrids = function () {
118
118
  var e_1, _a, _b;
@@ -6,7 +6,7 @@ var Effect_1 = require("../Effect");
6
6
  exports.Chimera = {
7
7
  invoke: [{ gem: 1 }, { gem: 1 }, { gem: 1 }],
8
8
  effect: {
9
- trigger: Effect_1.isPlaced,
9
+ trigger: Effect_1.isPlacedCrush,
10
10
  rule: ChimeraEffectRule_1.ChimeraEffectRule
11
11
  }
12
12
  };
@@ -6,7 +6,7 @@ var Effect_1 = require("../Effect");
6
6
  exports.Draugr = {
7
7
  invoke: [{}, { gem: 1 }, { favor: 1 }],
8
8
  effect: {
9
- trigger: Effect_1.isPlaced,
9
+ trigger: Effect_1.isPlacedCrush,
10
10
  rule: DraugrEffectRule_1.DraugrEffectRule
11
11
  }
12
12
  };
@@ -22,7 +22,7 @@ var PlayerEffectRule_1 = require("../PlayerEffectRule");
22
22
  exports.Jotunn = {
23
23
  invoke: [{ gem: 1 }, { gem: 1 }, {}],
24
24
  effect: {
25
- trigger: Effect_1.isPlaced,
25
+ trigger: Effect_1.isPlacedCrush,
26
26
  rule: (function (_super) {
27
27
  __extends(JotunnEffectRule, _super);
28
28
  function JotunnEffectRule() {
@@ -30,7 +30,7 @@ exports.Jotunn = {
30
30
  }
31
31
  JotunnEffectRule.prototype.playEffect = function () {
32
32
  var player = this.card.location.player;
33
- return new Pantheon_1.Pantheon(this.game, player).hasCrushed(this.card) ? [new Pantheon_1.Pantheon(this.game, this.player).gainGems(2)] : [];
33
+ return [new Pantheon_1.Pantheon(this.game, player).gainGems(2)];
34
34
  };
35
35
  return JotunnEffectRule;
36
36
  }(PlayerEffectRule_1.PlayerEffectRule))
@@ -6,7 +6,7 @@ var Effect_1 = require("../Effect");
6
6
  exports.Impundulu = {
7
7
  invoke: [{ favor: 1 }, {}, {}],
8
8
  effect: {
9
- trigger: Effect_1.isPlaced,
9
+ trigger: Effect_1.isPlacedCrush,
10
10
  rule: ImpunduluEffectRule_1.ImpunduluEffectRule
11
11
  }
12
12
  };
@@ -139,7 +139,7 @@ var AthenaEffectRule = (function (_super) {
139
139
  var _a;
140
140
  var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
141
141
  (_a = new TriggerEffectsRule_1.TriggerEffectsRule(this.game)).triggerEffects.apply(_a, __spreadArray([], __read(pantheon.updateGrid()), false));
142
- return pantheon.gainBonus().concat(_super.prototype.onEndEffect.call(this));
142
+ return __spreadArray(__spreadArray([], __read(pantheon.gainBonus()), false), __read(_super.prototype.onEndEffect.call(this)), false);
143
143
  };
144
144
  AthenaEffectRule.prototype.onRuleEnd = function () {
145
145
  this.forget(Memory_1.Memory.TargetLocations);
@@ -3,7 +3,6 @@ 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>[];
7
6
  getCardsToPlace(): import("@gamepark/rules-api").Material<number, number, number>;
8
7
  getAvailableDestinations(): XYCoordinates[];
9
8
  }
@@ -27,10 +27,6 @@ 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
- };
34
30
  ChimeraEffectRule.prototype.getCardsToPlace = function () {
35
31
  return new Destiny_1.Destiny(this.game).creaturesOnTopOfDecks;
36
32
  };
@@ -4,7 +4,6 @@ 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>[];
8
7
  getAffectedPlayers(): number[];
9
8
  getActivePlayerLegalMoves(player: PlayerColor): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
10
9
  getCardsToSacrifice(player: PlayerColor): Material;
@@ -21,7 +21,6 @@ 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");
25
24
  var RuleId_1 = require("../RuleId");
26
25
  var DraugrEffectRule = (function (_super) {
27
26
  __extends(DraugrEffectRule, _super);
@@ -30,10 +29,6 @@ var DraugrEffectRule = (function (_super) {
30
29
  _this.ruleId = RuleId_1.RuleId.DraugrEffect;
31
30
  return _this;
32
31
  }
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
- };
37
32
  DraugrEffectRule.prototype.getAffectedPlayers = function () {
38
33
  var _this = this;
39
34
  return this.game.players.filter(function (player) { return _this.isOpponent(player); });
@@ -2,7 +2,6 @@ import { InvokeEffectRule } from '../../material/entity/PlaceCardEffectRule';
2
2
  import { RuleId } from '../RuleId';
3
3
  export declare class ImpunduluEffectRule extends InvokeEffectRule {
4
4
  ruleId: RuleId;
5
- playEffect(): import("@gamepark/rules-api").StartRule<RuleId>[];
6
5
  onRuleStart(): import("@gamepark/rules-api").MoveItem<number, number, number>[];
7
6
  getCardsToPlace(): import("@gamepark/rules-api").Material<number, number, number>;
8
7
  get availableSanctuaryCards(): import("@gamepark/rules-api").Material<number, number, number>;
@@ -30,10 +30,6 @@ var ImpunduluEffectRule = (function (_super) {
30
30
  _this.ruleId = RuleId_1.RuleId.ImpunduluEffect;
31
31
  return _this;
32
32
  }
33
- ImpunduluEffectRule.prototype.playEffect = function () {
34
- var player = this.card.location.player;
35
- return new Pantheon_1.Pantheon(this.game, player).hasCrushed(this.card) ? [this.startRule(this.ruleId)] : [];
36
- };
37
33
  ImpunduluEffectRule.prototype.onRuleStart = function () {
38
34
  if (this.availableSanctuaryCards.length === 0) {
39
35
  return [this.topCreaturesDeckCard.rotateItem(true)];
@@ -10,4 +10,5 @@ export declare abstract class MultipleSimultaneousMoveEffectRule extends Simulta
10
10
  onCardMoved(move: MoveItem): import("@gamepark/rules-api").EndPlayerTurn<number>[];
11
11
  onCardSacrificed(move: MoveItem): MaterialMove[];
12
12
  onRuleEnd(): never[];
13
+ updatePlayersGrids(): MoveItem[];
13
14
  }
@@ -120,6 +120,25 @@ var MultipleSimultaneousMoveEffectRule = (function (_super) {
120
120
  this.forget(Memory_1.Memory.EffectCount);
121
121
  return [];
122
122
  };
123
+ MultipleSimultaneousMoveEffectRule.prototype.updatePlayersGrids = function () {
124
+ var e_3, _a;
125
+ var gainBonusMoves = _super.prototype.updatePlayersGrids.call(this);
126
+ var cardOwner = this.card.location.player;
127
+ try {
128
+ for (var gainBonusMoves_1 = __values(gainBonusMoves), gainBonusMoves_1_1 = gainBonusMoves_1.next(); !gainBonusMoves_1_1.done; gainBonusMoves_1_1 = gainBonusMoves_1.next()) {
129
+ var gainBonusMove = gainBonusMoves_1_1.value;
130
+ gainBonusMove.location.player = cardOwner;
131
+ }
132
+ }
133
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
134
+ finally {
135
+ try {
136
+ if (gainBonusMoves_1_1 && !gainBonusMoves_1_1.done && (_a = gainBonusMoves_1.return)) _a.call(gainBonusMoves_1);
137
+ }
138
+ finally { if (e_3) throw e_3.error; }
139
+ }
140
+ return gainBonusMoves;
141
+ };
123
142
  return MultipleSimultaneousMoveEffectRule;
124
143
  }(SimultaneousMoveEffectRule_1.SimultaneousMoveEffectRule));
125
144
  exports.MultipleSimultaneousMoveEffectRule = MultipleSimultaneousMoveEffectRule;
@@ -6,5 +6,5 @@ export declare class SphinxEffectRule extends MoveEffectRule {
6
6
  getMovingCards(): Material;
7
7
  isLegalDestination(space: XYCoordinates, cardLocation: Location): boolean;
8
8
  onCardMoved(move: MoveItem): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
9
- updateGridAfterMoves(): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
9
+ updateGridAfterMoves(): MoveItem<number, number, number>[];
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamepark/mythologies",
3
- "version": "0.9.3",
3
+ "version": "0.10.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": "7c778cb2470a469d0d8cbec9baf0ef3e79a3b7d9"
32
+ "gitHead": "cd62f129beedd2f9880e5ae0e19381655bde15b5"
33
33
  }