@gamepark/mythologies 1.0.1 → 1.0.3
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.
- package/dist/MythologiesRules.js +7 -1
- package/dist/material/Pantheon.d.ts +3 -2
- package/dist/material/Pantheon.js +17 -5
- package/dist/material/entity/PlaceCardEffectRule.d.ts +1 -1
- package/dist/material/entity/PlaceCardEffectRule.js +3 -2
- package/dist/material/entity/hindu/Brahma.js +2 -1
- package/dist/rules/PlaceCardsRule.js +3 -3
- package/dist/rules/effects/AnubisEffectRule.d.ts +1 -1
- package/dist/rules/effects/AnubisEffectRule.js +2 -2
- package/dist/rules/effects/QilinEffectRule.js +10 -6
- package/package.json +2 -2
package/dist/MythologiesRules.js
CHANGED
|
@@ -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() {
|
|
@@ -10,8 +10,8 @@ export declare class Pantheon extends MaterialRulesPart {
|
|
|
10
10
|
get coveredEntities(): Material<number, number, number>;
|
|
11
11
|
get grid(): (Entity | undefined)[][];
|
|
12
12
|
private get indexGrid();
|
|
13
|
-
|
|
14
|
-
isLegalSpaceToSummon(space: XYCoordinates): boolean;
|
|
13
|
+
getLegalSpacesToSummon(entity: Entity): XYCoordinates[];
|
|
14
|
+
isLegalSpaceToSummon(space: XYCoordinates, entity?: Entity): boolean;
|
|
15
15
|
getFavorTax(space: XYCoordinates): number;
|
|
16
16
|
getGemTax(space: XYCoordinates): number;
|
|
17
17
|
get legalSpaces(): XYCoordinates[];
|
|
@@ -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>[];
|
|
@@ -38,14 +38,15 @@ export class Pantheon extends MaterialRulesPart {
|
|
|
38
38
|
return entity.length > 0 ? entity.getIndex() : null;
|
|
39
39
|
}));
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
return this.legalSpaces.filter((space) => this.isLegalSpaceToSummon(space));
|
|
41
|
+
getLegalSpacesToSummon(entity) {
|
|
42
|
+
return this.legalSpaces.filter((space) => this.isLegalSpaceToSummon(space, entity));
|
|
43
43
|
}
|
|
44
|
-
isLegalSpaceToSummon(space) {
|
|
44
|
+
isLegalSpaceToSummon(space, entity) {
|
|
45
45
|
const opponents = this.game.players.filter((player) => player !== this.player);
|
|
46
46
|
const favorTax = sumBy(opponents, (opponent) => new Pantheon(this.game, opponent).getFavorTax(space));
|
|
47
47
|
const gemTax = sumBy(opponents, (opponent) => new Pantheon(this.game, opponent).getGemTax(space));
|
|
48
|
-
|
|
48
|
+
const totalGemCost = gemTax + (isGod(entity) ? 4 : 0);
|
|
49
|
+
return (!favorTax || this.favor >= favorTax) && (!totalGemCost || this.gems >= totalGemCost);
|
|
49
50
|
}
|
|
50
51
|
getFavorTax(space) {
|
|
51
52
|
return sumBy(this.visibleEntities.getItems(), (card) => sumBy(getEffects(card.id.front), (effect) => effect.favorTax?.(space, card) ?? 0));
|
|
@@ -217,7 +218,7 @@ export class Pantheon extends MaterialRulesPart {
|
|
|
217
218
|
const gemTax = new Pantheon(this.game, player).getGemTax(move.location);
|
|
218
219
|
if (gemTax > 0) {
|
|
219
220
|
const gems = this.material(MaterialType.GemToken).location(LocationType.PlayerGems).player(this.player);
|
|
220
|
-
moves.push(gems.moveItem({ type: LocationType.
|
|
221
|
+
moves.push(gems.moveItem({ type: LocationType.PlayerGems, player }, gemTax));
|
|
221
222
|
}
|
|
222
223
|
}
|
|
223
224
|
}
|
|
@@ -283,6 +284,17 @@ export class Pantheon extends MaterialRulesPart {
|
|
|
283
284
|
new TriggerEffectsRule(this.game).triggerEffects({ type: TriggerEventType.EntitySacrificed, card: card, cardIndex });
|
|
284
285
|
}
|
|
285
286
|
}
|
|
287
|
+
onPileSacrificed(indexes) {
|
|
288
|
+
const cards = indexes.map((index) => this.material(MaterialType.EntityCard).getItem(index));
|
|
289
|
+
const { x, y } = cards[0].location;
|
|
290
|
+
const grid = this.indexGrid;
|
|
291
|
+
grid[y][x] = null;
|
|
292
|
+
this.memorize(Memory.PlayerGrid, grid, this.player);
|
|
293
|
+
const triggerEffects = new TriggerEffectsRule(this.game);
|
|
294
|
+
for (const cardIndex of indexes) {
|
|
295
|
+
triggerEffects.triggerEffects({ type: TriggerEventType.EntitySacrificed, card: cards[indexes.indexOf(cardIndex)], cardIndex });
|
|
296
|
+
}
|
|
297
|
+
}
|
|
286
298
|
isOpponentOngoingEffect() {
|
|
287
299
|
const ongoingEffect = this.remind(Memory.OngoingEffect);
|
|
288
300
|
if (!ongoingEffect)
|
|
@@ -13,5 +13,5 @@ export declare abstract class PlaceCardEffectRule extends PlayerEffectRule {
|
|
|
13
13
|
}
|
|
14
14
|
export declare abstract class SummonEffectRule extends PlaceCardEffectRule {
|
|
15
15
|
isSummon: boolean;
|
|
16
|
-
getAvailableDestinations(): XYCoordinates[];
|
|
16
|
+
getAvailableDestinations(cardIndex: number): XYCoordinates[];
|
|
17
17
|
}
|
|
@@ -52,7 +52,8 @@ export class PlaceCardEffectRule extends PlayerEffectRule {
|
|
|
52
52
|
}
|
|
53
53
|
export class SummonEffectRule extends PlaceCardEffectRule {
|
|
54
54
|
isSummon = true;
|
|
55
|
-
getAvailableDestinations() {
|
|
56
|
-
|
|
55
|
+
getAvailableDestinations(cardIndex) {
|
|
56
|
+
const entity = this.material(MaterialType.EntityCard).getItem(cardIndex).id.front;
|
|
57
|
+
return new Pantheon(this.game, this.player).getLegalSpacesToSummon(entity);
|
|
57
58
|
}
|
|
58
59
|
}
|
|
@@ -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,6 +1,5 @@
|
|
|
1
1
|
import { isMoveItemType, PlayerTurnRule } from '@gamepark/rules-api';
|
|
2
2
|
import { CustomMoveType } from '../CustomMoveType';
|
|
3
|
-
import { isGod } from '../material/Entity';
|
|
4
3
|
import { isTriggeredEffect, TriggerEventType } from '../material/entity/Effect';
|
|
5
4
|
import { getEffects } from '../material/entity/EntityDescription';
|
|
6
5
|
import { LocationType } from '../material/LocationType';
|
|
@@ -17,8 +16,9 @@ export class PlaceCardsRule extends PlayerTurnRule {
|
|
|
17
16
|
const moves = this.infiniteEffects.map((effect) => this.customMove(CustomMoveType.PlayEffect, effect));
|
|
18
17
|
const cards = this.material(MaterialType.EntityCard).location(LocationType.PlayerSelectedCards).player(this.player);
|
|
19
18
|
if (cards.length) {
|
|
20
|
-
const
|
|
21
|
-
for (const { x, y } of
|
|
19
|
+
const pantheon = new Pantheon(this.game, this.player);
|
|
20
|
+
for (const { x, y } of pantheon.legalSpaces) {
|
|
21
|
+
const cardsICanSummon = cards.id((id) => pantheon.isLegalSpaceToSummon({ x, y }, id.front));
|
|
22
22
|
moves.push(...cardsICanSummon.moveItems({ type: LocationType.Pantheon, x, y, player: this.player }));
|
|
23
23
|
}
|
|
24
24
|
moves.push(...cards.moveItems({ type: LocationType.PlayerDiscard, player: this.player }));
|
|
@@ -5,5 +5,5 @@ export declare class AnubisEffectRule extends SummonEffectRule {
|
|
|
5
5
|
ruleId: RuleId;
|
|
6
6
|
times: number;
|
|
7
7
|
getCardsToPlace(): Material;
|
|
8
|
-
getAvailableDestinations(): import("@gamepark/rules-api").XYCoordinates[];
|
|
8
|
+
getAvailableDestinations(cardIndex: number): import("@gamepark/rules-api").XYCoordinates[];
|
|
9
9
|
}
|
|
@@ -8,7 +8,7 @@ export class AnubisEffectRule extends SummonEffectRule {
|
|
|
8
8
|
getCardsToPlace() {
|
|
9
9
|
return this.material(MaterialType.EntityCard).location(LocationType.PlayerDiscard);
|
|
10
10
|
}
|
|
11
|
-
getAvailableDestinations() {
|
|
12
|
-
return super.getAvailableDestinations().filter((space) => space.y === 2);
|
|
11
|
+
getAvailableDestinations(cardIndex) {
|
|
12
|
+
return super.getAvailableDestinations(cardIndex).filter((space) => space.y === 2);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MoveKind } from '@gamepark/rules-api';
|
|
2
2
|
import { CustomMoveType } from '../../CustomMoveType';
|
|
3
3
|
import { Entity, isCreature } from '../../material/Entity';
|
|
4
|
-
import {
|
|
4
|
+
import { isTriggeredEffect } from '../../material/entity/Effect';
|
|
5
5
|
import { getEffects } from '../../material/entity/EntityDescription';
|
|
6
6
|
import { PlayerEffectRule } from '../../material/entity/PlayerEffectRule';
|
|
7
7
|
import { MaterialType } from '../../material/MaterialType';
|
|
@@ -10,14 +10,15 @@ import { RuleId } from '../RuleId';
|
|
|
10
10
|
export class QilinEffectRule extends PlayerEffectRule {
|
|
11
11
|
ruleId = RuleId.QilinEffect;
|
|
12
12
|
getPlayerMoves() {
|
|
13
|
+
const { triggerEvent } = this.getEffect();
|
|
13
14
|
const cardsToCopy = [];
|
|
14
15
|
for (const player of this.game.players) {
|
|
15
16
|
if (player !== this.player) {
|
|
16
17
|
cardsToCopy.push(...new Pantheon(this.game, player).visibleEntities
|
|
17
18
|
.location((l) => l.x === this.card.location.x)
|
|
18
|
-
.
|
|
19
|
-
id.front !== Entity.Qilin &&
|
|
20
|
-
getEffects(id.front).some((effect) => isTriggeredEffect(effect) && effect.trigger
|
|
19
|
+
.filter((card, cardIndex) => isCreature(card.id.front) &&
|
|
20
|
+
card.id.front !== Entity.Qilin &&
|
|
21
|
+
getEffects(card.id.front).some((effect) => isTriggeredEffect(effect) && effect.trigger(triggerEvent, { cardIndex, cardLocation: card.location, game: this.game })))
|
|
21
22
|
.getIndexes());
|
|
22
23
|
}
|
|
23
24
|
}
|
|
@@ -25,10 +26,13 @@ export class QilinEffectRule extends PlayerEffectRule {
|
|
|
25
26
|
}
|
|
26
27
|
onCustomMove(move) {
|
|
27
28
|
if (move.type === CustomMoveType.ChooseEntityCard) {
|
|
28
|
-
const
|
|
29
|
+
const { triggerEvent } = this.getEffect();
|
|
30
|
+
const cardIndex = move.data;
|
|
31
|
+
const card = this.material(MaterialType.EntityCard).getItem(cardIndex);
|
|
32
|
+
const context = { cardIndex, cardLocation: card.location, game: this.game };
|
|
29
33
|
const effect = getEffects(card.id.front)
|
|
30
34
|
.filter(isTriggeredEffect)
|
|
31
|
-
.find((effect) => effect.trigger
|
|
35
|
+
.find((effect) => effect.trigger(triggerEvent, context));
|
|
32
36
|
const moves = new effect.rule(this.game).playEffect();
|
|
33
37
|
if (!moves.some((move) => move.kind === MoveKind.RulesMove)) {
|
|
34
38
|
moves.push(this.customMove(CustomMoveType.EndEffect));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamepark/mythologies",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "The rules of Mythologies adapted for Game Park",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"@gamepark/rules-api": "~7.2.0",
|
|
29
29
|
"es-toolkit": "^1.44.0"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "5979bb8560edd48228052e30e8097060c49e6ff8"
|
|
32
32
|
}
|