@gamepark/mythologies 1.0.14 → 1.0.15

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.
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamepark/mythologies",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
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.4.1",
29
29
  "es-toolkit": "^1.44.0"
30
30
  },
31
- "gitHead": "864b4ad85fab38fa2494bfbbe6307ed5b16ae051"
31
+ "gitHead": "214dbf3d9235eda59b4fbb5912f34cce66a1dca2"
32
32
  }