@gamepark/mythologies 1.0.0 → 1.0.2

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.
@@ -6,7 +6,8 @@ export declare enum CustomMoveType {
6
6
  EndEffect = 5,
7
7
  ChooseMythology = 6,
8
8
  ChoosePlan = 7,
9
- ChooseEntityCard = 8
9
+ ChooseEntityCard = 8,
10
+ EffectTriggered = 9
10
11
  }
11
12
  export type TrialSuccessData = {
12
13
  trial: number;
@@ -8,4 +8,5 @@ export var CustomMoveType;
8
8
  CustomMoveType[CustomMoveType["ChooseMythology"] = 6] = "ChooseMythology";
9
9
  CustomMoveType[CustomMoveType["ChoosePlan"] = 7] = "ChoosePlan";
10
10
  CustomMoveType[CustomMoveType["ChooseEntityCard"] = 8] = "ChooseEntityCard";
11
+ CustomMoveType[CustomMoveType["EffectTriggered"] = 9] = "EffectTriggered";
11
12
  })(CustomMoveType || (CustomMoveType = {}));
@@ -1,4 +1,4 @@
1
- import { FillGapStrategy, hideFront, hideFrontToOthers, hideItemId, isMoveItemType, PositiveSequenceStrategy, SecretMaterialRules, StackingStrategy } from '@gamepark/rules-api';
1
+ import { FillGapStrategy, hideFront, hideFrontToOthers, hideItemId, isMoveItemType, isMoveItemTypeAtOnce, PositiveSequenceStrategy, SecretMaterialRules, StackingStrategy } from '@gamepark/rules-api';
2
2
  import { Destiny } from './material/Destiny';
3
3
  import { isGod } from './material/Entity';
4
4
  import { LineEventType, TriggerEventType } from './material/entity/Effect';
@@ -189,6 +189,12 @@ export class MythologiesRules extends SecretMaterialRules {
189
189
  new Pantheon(this.game, card.location.player).onEntitySacrificed(move.itemIndex);
190
190
  }
191
191
  }
192
+ if (isMoveItemTypeAtOnce(MaterialType.EntityCard)(move) && move.location.type === LocationType.PlayerDiscard) {
193
+ const firstCard = this.material(MaterialType.EntityCard).getItem(move.indexes[0]);
194
+ if (firstCard.location.type === LocationType.Pantheon) {
195
+ new Pantheon(this.game, firstCard.location.player).onPileSacrificed(move.indexes);
196
+ }
197
+ }
192
198
  return super.beforeItemMove(move);
193
199
  }
194
200
  getAutomaticMoves() {
@@ -44,6 +44,7 @@ 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
+ onPileSacrificed(indexes: number[]): void;
47
48
  isOpponentOngoingEffect(): boolean;
48
49
  replaceSacrifice(cards: EntityItem[]): Material<number, number, number>;
49
50
  sacrificeToPreventMove(): MoveItem<number, number, number>[];
@@ -283,6 +283,17 @@ export class Pantheon extends MaterialRulesPart {
283
283
  new TriggerEffectsRule(this.game).triggerEffects({ type: TriggerEventType.EntitySacrificed, card: card, cardIndex });
284
284
  }
285
285
  }
286
+ onPileSacrificed(indexes) {
287
+ const cards = indexes.map((index) => this.material(MaterialType.EntityCard).getItem(index));
288
+ const { x, y } = cards[0].location;
289
+ const grid = this.indexGrid;
290
+ grid[y][x] = null;
291
+ this.memorize(Memory.PlayerGrid, grid, this.player);
292
+ const triggerEffects = new TriggerEffectsRule(this.game);
293
+ for (const cardIndex of indexes) {
294
+ triggerEffects.triggerEffects({ type: TriggerEventType.EntitySacrificed, card: cards[indexes.indexOf(cardIndex)], cardIndex });
295
+ }
296
+ }
286
297
  isOpponentOngoingEffect() {
287
298
  const ongoingEffect = this.remind(Memory.OngoingEffect);
288
299
  if (!ongoingEffect)
@@ -5,9 +5,10 @@ export const Brahma = {
5
5
  summon: [{ gem: 1, favor: 1 }, {}, { gem: 1 }],
6
6
  effect: {
7
7
  trigger: (event) => event.type === TriggerEventType.EntitySacrificed,
8
+ auto: true,
8
9
  rule: class BrahmaEffectRule extends PlayerEffectRule {
9
10
  playEffect() {
10
- return [new Pantheon(this.game, this.player).gainGems(2)];
11
+ return [new Pantheon(this.game, this.card.location.player).gainGems(2)];
11
12
  }
12
13
  }
13
14
  }
@@ -1,3 +1,4 @@
1
+ import { CustomMoveType } from '../../../CustomMoveType';
1
2
  import { Entity, isCreature } from '../../Entity';
2
3
  import { Pantheon } from '../../Pantheon';
3
4
  import { AutoEffectRule } from '../AutoEffectRule';
@@ -9,11 +10,11 @@ export const Tokoloshe = {
9
10
  trigger: isEndOfMyTurn,
10
11
  rule: class TokolosheEffectRule extends AutoEffectRule {
11
12
  playEffect() {
12
- const { x, y, player } = this.card.location;
13
- const pantheon = new Pantheon(this.game, player);
13
+ const { x, y } = this.card.location;
14
+ const pantheon = new Pantheon(this.game, this.player);
14
15
  const creatures = pantheon.visibleEntities.location((l) => l.y === y && l.x !== x).id((id) => isCreature(id.front));
15
16
  const loss = Math.min(pantheon.favor, creatures.length);
16
- return loss ? [pantheon.loseFavor(loss)] : [];
17
+ return loss ? [this.customMove(CustomMoveType.EffectTriggered, this.getEffect()), pantheon.loseFavor(loss)] : [];
17
18
  }
18
19
  }
19
20
  },
@@ -1,4 +1,4 @@
1
- import { Location, Material, XYCoordinates } from '@gamepark/rules-api';
1
+ import { Location, Material, MoveItem, XYCoordinates } from '@gamepark/rules-api';
2
2
  import { MoveEffectRule } from '../../material/entity/MoveEffectRule';
3
3
  import { SimultaneousSacrificeEffectRule } from '../../material/entity/SimultaneousSacrificeEffectRule';
4
4
  import { PlayerColor } from '../../PlayerColor';
@@ -8,6 +8,8 @@ export declare class CentaurEffectRule extends MoveEffectRule {
8
8
  getMovingCards(effectCardIndex?: number): Material;
9
9
  isLegalDestination(space: XYCoordinates, cardLocation: Location): boolean;
10
10
  onEndEffect(): import("@gamepark/rules-api").MaterialMove[];
11
+ onCardSacrificed(move: MoveItem): import("@gamepark/rules-api").MaterialMove[];
12
+ onRuleEnd(): never[];
11
13
  }
12
14
  export declare class CentaurEffectSacrificeRule extends SimultaneousSacrificeEffectRule {
13
15
  ruleId: RuleId;
@@ -3,6 +3,7 @@ import { isCreature } from '../../material/Entity';
3
3
  import { MoveEffectRule } from '../../material/entity/MoveEffectRule';
4
4
  import { SimultaneousSacrificeEffectRule } from '../../material/entity/SimultaneousSacrificeEffectRule';
5
5
  import { MaterialType } from '../../material/MaterialType';
6
+ import { Memory } from '../../Memory';
6
7
  import { RuleId } from '../RuleId';
7
8
  export class CentaurEffectRule extends MoveEffectRule {
8
9
  ruleId = RuleId.CentaurEffect;
@@ -13,9 +14,20 @@ export class CentaurEffectRule extends MoveEffectRule {
13
14
  return areAdjacentSquares(space, cardLocation);
14
15
  }
15
16
  onEndEffect() {
17
+ this.memorize(Memory.EntityMoved, true);
16
18
  this.updateGridAfterMoves();
17
19
  return new CentaurEffectSacrificeRule(this.game).playEffect();
18
20
  }
21
+ onCardSacrificed(move) {
22
+ if (this.remind(Memory.EntityMoved)) {
23
+ return [];
24
+ }
25
+ return super.onCardSacrificed(move);
26
+ }
27
+ onRuleEnd() {
28
+ this.forget(Memory.EntityMoved);
29
+ return [];
30
+ }
19
31
  }
20
32
  export class CentaurEffectSacrificeRule extends SimultaneousSacrificeEffectRule {
21
33
  ruleId = RuleId.CentaurEffectSacrifice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamepark/mythologies",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "The rules of Mythologies adapted for Game Park",
5
5
  "sideEffects": false,
6
6
  "type": "module",