@gamepark/mythologies 1.0.14 → 1.0.16

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.
@@ -95,9 +95,10 @@ export class Pantheon extends MaterialRulesPart {
95
95
  moves.push(this.spendGems(4));
96
96
  }
97
97
  const grid = this.indexGrid;
98
- const crush = grid[move.location.y][move.location.x] !== null;
98
+ const crushedIndex = grid[move.location.y][move.location.x];
99
+ const crushed = crushedIndex !== null ? this.material(MaterialType.EntityCard).getItem(crushedIndex).id.front : undefined;
99
100
  grid[move.location.y][move.location.x] = move.itemIndex;
100
- new TriggerEffectsRule(this.game).triggerCardEffect(move.itemIndex, location, { type: TriggerEventType.SelfPlaced, crush }, entity);
101
+ new TriggerEffectsRule(this.game).triggerCardEffect(move.itemIndex, location, { type: TriggerEventType.SelfPlaced, crushed }, entity);
101
102
  const summoned = this.isSummon;
102
103
  if (summoned) {
103
104
  moves.push(...this.onSummon(move));
@@ -40,7 +40,7 @@ export declare enum TriggerEventType {
40
40
  }
41
41
  export type SelfPlaced = {
42
42
  type: TriggerEventType.SelfPlaced;
43
- crush: boolean;
43
+ crushed?: Entity;
44
44
  };
45
45
  export type EndOfGameEvent = {
46
46
  type: TriggerEventType.EndOfGame;
@@ -14,7 +14,7 @@ export var TriggerEventType;
14
14
  })(TriggerEventType || (TriggerEventType = {}));
15
15
  export const isEndOfGame = (event) => event.type === TriggerEventType.EndOfGame;
16
16
  export const isPlaced = (event) => event.type === TriggerEventType.SelfPlaced;
17
- export const isPlacedCrush = (event) => isPlaced(event) && event.crush;
17
+ export const isPlacedCrush = (event) => isPlaced(event) && !!event.crushed;
18
18
  export var LineEventType;
19
19
  (function (LineEventType) {
20
20
  LineEventType[LineEventType["BonusGain"] = 1] = "BonusGain";
@@ -9,7 +9,7 @@ export declare class GarudaEffectRule extends PlayerEffectRule {
9
9
  }
10
10
  export declare class GarudaSacrificeRule extends SacrificeEffectRule {
11
11
  ruleId: RuleId;
12
- onRuleStart(): MaterialMove[];
12
+ onRuleStart(): CustomMove[] | MoveItem<number, number, number>[];
13
13
  getCardsToSacrifice(): import("@gamepark/rules-api").Material<number, number, number>;
14
14
  onSacrifice(move: MoveItem): CustomMove[];
15
15
  onRuleEnd(): never[];
@@ -13,8 +13,22 @@ export class GarudaEffectRule extends PlayerEffectRule {
13
13
  }
14
14
  onCustomMove(move) {
15
15
  if (move.type === CustomMoveType.ChoosePlan) {
16
- this.memorize(Memory.TargetPlane, move.data);
17
- return [this.startRule(RuleId.GarudaSacrifice)];
16
+ const plan = move.data;
17
+ this.memorize(Memory.TargetPlane, plan);
18
+ const pantheon = new Pantheon(this.game, this.player);
19
+ const gemCount = pantheon.visibleEntities.location((l) => l.y === plan).length;
20
+ const creatureCount = pantheon.visibleEntities.id((id) => isCreature(id.front)).location((l) => l.y === plan).length;
21
+ const moves = [];
22
+ if (gemCount) {
23
+ moves.push(pantheon.gainGems(gemCount));
24
+ }
25
+ if (creatureCount) {
26
+ moves.push(this.startRule(RuleId.GarudaSacrifice));
27
+ }
28
+ else {
29
+ moves.push(this.customMove(CustomMoveType.EndEffect));
30
+ }
31
+ return moves;
18
32
  }
19
33
  return super.onCustomMove(move);
20
34
  }
@@ -26,12 +40,11 @@ export class GarudaSacrificeRule extends SacrificeEffectRule {
26
40
  if (!count)
27
41
  return [this.customMove(CustomMoveType.EndEffect)];
28
42
  this.memorize(Memory.EffectCount, count);
29
- const moves = [new Pantheon(this.game, this.player).gainGems(count)];
30
43
  const playerMoves = this.getPlayerMoves();
31
44
  if (playerMoves.length === count) {
32
- moves.push(...playerMoves);
45
+ return playerMoves;
33
46
  }
34
- return moves;
47
+ return [];
35
48
  }
36
49
  getCardsToSacrifice() {
37
50
  const pantheon = new Pantheon(this.game, this.player);
@@ -3,7 +3,6 @@ import { entityMythology } from '../../material/Entity';
3
3
  import { SummonEffectRule } from '../../material/entity/PlaceCardEffectRule';
4
4
  import { LocationType } from '../../material/LocationType';
5
5
  import { MaterialType } from '../../material/MaterialType';
6
- import { Pantheon } from '../../material/Pantheon';
7
6
  import { RuleId } from '../RuleId';
8
7
  export class ImpunduluEffectRule extends SummonEffectRule {
9
8
  ruleId = RuleId.ImpunduluEffect;
@@ -31,9 +30,7 @@ export class ImpunduluEffectRule extends SummonEffectRule {
31
30
  return deck.maxBy((item) => item.location.x);
32
31
  }
33
32
  get mythology() {
34
- const pantheon = new Pantheon(this.game, this.player);
35
- const { x, y } = this.card.location;
36
- const crushed = pantheon.coveredEntities.location((l) => l.x === x && l.y === y).maxBy((item) => item.location.z);
37
- return entityMythology(crushed.getItem().id.front);
33
+ const { triggerEvent } = this.getEffect();
34
+ return entityMythology(triggerEvent.crushed);
38
35
  }
39
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamepark/mythologies",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "The rules of Mythologies adapted for Game Park",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -25,8 +25,8 @@
25
25
  "es-toolkit": "^1.44.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@gamepark/rules-api": "~7.4.0",
28
+ "@gamepark/rules-api": "~7.5.0",
29
29
  "es-toolkit": "^1.44.0"
30
30
  },
31
- "gitHead": "864b4ad85fab38fa2494bfbbe6307ed5b16ae051"
31
+ "gitHead": "e2c4b4d214b3672755fe8340d5393d1c75fae46f"
32
32
  }