@gamepark/mythologies 1.0.4 → 1.0.6
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.d.ts +3 -2
- package/dist/MythologiesRules.js +12 -2
- package/dist/material/Pantheon.d.ts +1 -2
- package/dist/material/Pantheon.js +7 -5
- package/dist/material/entity/greek/Cyclops.js +4 -2
- package/dist/rules/RuleId.d.ts +2 -1
- package/dist/rules/RuleId.js +1 -0
- package/dist/rules/effects/CaimanEffectRule.d.ts +11 -3
- package/dist/rules/effects/CaimanEffectRule.js +43 -17
- package/dist/rules/effects/ResolveEffectsRule.js +3 -3
- package/package.json +2 -3
|
@@ -9,7 +9,7 @@ import { AmmoutEffectRule } from './rules/effects/AmmoutEffectRule';
|
|
|
9
9
|
import { AnubisEffectRule } from './rules/effects/AnubisEffectRule';
|
|
10
10
|
import { AthenaEffectRule } from './rules/effects/AthenaEffectRule';
|
|
11
11
|
import { BennuEffectRule } from './rules/effects/BennuEffectRule';
|
|
12
|
-
import { CaimanEffectRule } from './rules/effects/CaimanEffectRule';
|
|
12
|
+
import { CaimanEffectRule, CaimanSacrificeEffectRule } from './rules/effects/CaimanEffectRule';
|
|
13
13
|
import { CentaurEffectRule, CentaurEffectSacrificeRule } from './rules/effects/CentaurEffectRule';
|
|
14
14
|
import { ChimeraEffectRule } from './rules/effects/ChimeraEffectRule';
|
|
15
15
|
import { CobraEffectRule, CobraSummonEffect } from './rules/effects/CobraEffectRule';
|
|
@@ -98,6 +98,7 @@ export declare class MythologiesRules extends SecretMaterialRules<PlayerColor, M
|
|
|
98
98
|
41: typeof IllapaEffectRule;
|
|
99
99
|
42: typeof IllapaSacrificeRule;
|
|
100
100
|
43: typeof CaimanEffectRule;
|
|
101
|
+
64: typeof CaimanSacrificeEffectRule;
|
|
101
102
|
44: typeof CondorEffectRule;
|
|
102
103
|
45: typeof SupayEffectRule;
|
|
103
104
|
46: typeof UkukuEffectRule;
|
|
@@ -143,7 +144,7 @@ export declare class MythologiesRules extends SecretMaterialRules<PlayerColor, M
|
|
|
143
144
|
6: (item: MaterialItem, player?: PlayerColor) => string[];
|
|
144
145
|
};
|
|
145
146
|
4: {
|
|
146
|
-
5: import("@gamepark/rules-api").HidingStrategy
|
|
147
|
+
5: import("@gamepark/rules-api").HidingStrategy;
|
|
147
148
|
17: (item: MaterialItem) => string[];
|
|
148
149
|
};
|
|
149
150
|
10: {
|
package/dist/MythologiesRules.js
CHANGED
|
@@ -13,7 +13,7 @@ import { AmmoutEffectRule } from './rules/effects/AmmoutEffectRule';
|
|
|
13
13
|
import { AnubisEffectRule } from './rules/effects/AnubisEffectRule';
|
|
14
14
|
import { AthenaEffectRule } from './rules/effects/AthenaEffectRule';
|
|
15
15
|
import { BennuEffectRule } from './rules/effects/BennuEffectRule';
|
|
16
|
-
import { CaimanEffectRule } from './rules/effects/CaimanEffectRule';
|
|
16
|
+
import { CaimanEffectRule, CaimanSacrificeEffectRule } from './rules/effects/CaimanEffectRule';
|
|
17
17
|
import { CentaurEffectRule, CentaurEffectSacrificeRule } from './rules/effects/CentaurEffectRule';
|
|
18
18
|
import { ChimeraEffectRule } from './rules/effects/ChimeraEffectRule';
|
|
19
19
|
import { CobraEffectRule, CobraSummonEffect } from './rules/effects/CobraEffectRule';
|
|
@@ -103,6 +103,7 @@ export class MythologiesRules extends SecretMaterialRules {
|
|
|
103
103
|
[RuleId.IllapaEffect]: IllapaEffectRule,
|
|
104
104
|
[RuleId.IllapaSacrifice]: IllapaSacrificeRule,
|
|
105
105
|
[RuleId.CaimanEffect]: CaimanEffectRule,
|
|
106
|
+
[RuleId.CaimanSacrificeEffect]: CaimanSacrificeEffectRule,
|
|
106
107
|
[RuleId.CondorEffect]: CondorEffectRule,
|
|
107
108
|
[RuleId.SupayEffect]: SupayEffectRule,
|
|
108
109
|
[RuleId.UkukuEffect]: UkukuEffectRule,
|
|
@@ -169,18 +170,27 @@ export class MythologiesRules extends SecretMaterialRules {
|
|
|
169
170
|
beforeItemMove(move) {
|
|
170
171
|
if (!this.game.rule)
|
|
171
172
|
return [];
|
|
173
|
+
const consequences = super.beforeItemMove(move);
|
|
172
174
|
if (isMoveItemType(MaterialType.GemToken)(move) && move.location.type === LocationType.PlayerGems) {
|
|
173
175
|
const gem = this.material(MaterialType.GemToken).getItem(move.itemIndex).location;
|
|
174
176
|
const player = gem.player;
|
|
175
177
|
if (gem.type === LocationType.PantheonLineBonus && player === move.location.player) {
|
|
178
|
+
const firstEffect = this.remind(Memory.PendingEffects)[0];
|
|
176
179
|
new TriggerEffectsRule(this.game).triggerEffects({ type: TriggerEventType.LineEvent, eventType: LineEventType.BonusGain, player, y: gem.y });
|
|
180
|
+
if (this.remind(Memory.PendingEffects)[0] !== firstEffect) {
|
|
181
|
+
consequences.push(...new ResolveEffectsRule(this.game).startEffectsResolution());
|
|
182
|
+
}
|
|
177
183
|
}
|
|
178
184
|
}
|
|
179
185
|
if (isMoveItemType(MaterialType.FavorToken)(move) && move.location.type === LocationType.PlayerFavor) {
|
|
180
186
|
const favor = this.material(MaterialType.FavorToken).getItem(move.itemIndex).location;
|
|
181
187
|
const player = favor.player;
|
|
182
188
|
if (favor.type === LocationType.PantheonColumnBonus && player === move.location.player) {
|
|
189
|
+
const firstEffect = this.remind(Memory.PendingEffects)[0];
|
|
183
190
|
new TriggerEffectsRule(this.game).triggerEffects({ type: TriggerEventType.ColumnEvent, eventType: LineEventType.BonusGain, player, x: favor.x });
|
|
191
|
+
if (this.remind(Memory.PendingEffects)[0] !== firstEffect) {
|
|
192
|
+
consequences.push(...new ResolveEffectsRule(this.game).startEffectsResolution());
|
|
193
|
+
}
|
|
184
194
|
}
|
|
185
195
|
}
|
|
186
196
|
if (isMoveItemType(MaterialType.EntityCard)(move) && move.location.type === LocationType.PlayerDiscard) {
|
|
@@ -195,7 +205,7 @@ export class MythologiesRules extends SecretMaterialRules {
|
|
|
195
205
|
new Pantheon(this.game, firstCard.location.player).onPileSacrificed(move.indexes);
|
|
196
206
|
}
|
|
197
207
|
}
|
|
198
|
-
return
|
|
208
|
+
return consequences;
|
|
199
209
|
}
|
|
200
210
|
getAutomaticMoves() {
|
|
201
211
|
if (!this.remind(Memory.OngoingEffect) &&
|
|
@@ -10,7 +10,6 @@ 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
|
-
getLegalSpacesToSummon(entity: Entity): XYCoordinates[];
|
|
14
13
|
isLegalSpaceToSummon(space: XYCoordinates, entity?: Entity): boolean;
|
|
15
14
|
getFavorTax(space: XYCoordinates): number;
|
|
16
15
|
getGemTax(space: XYCoordinates): number;
|
|
@@ -29,7 +28,7 @@ export declare class Pantheon extends MaterialRulesPart {
|
|
|
29
28
|
updateGrid(gridAfter?: (number | null)[][]): TriggerEvent[];
|
|
30
29
|
private getEntitiesMoved;
|
|
31
30
|
private getEntitiesCrushed;
|
|
32
|
-
triggerBonusGains(grid?: (number | null)[][]): void;
|
|
31
|
+
triggerBonusGains(grid?: (number | null)[][], gridBefore?: (number | null)[][] | null): void;
|
|
33
32
|
gainLineBonus(y: number): MoveItem<number, number, number>[];
|
|
34
33
|
gainColumnBonus(x: number): MoveItem<number, number, number>[];
|
|
35
34
|
getBonusGem(y: number): Material<number, number, number>;
|
|
@@ -38,9 +38,6 @@ export class Pantheon extends MaterialRulesPart {
|
|
|
38
38
|
return entity.length > 0 ? entity.getIndex() : null;
|
|
39
39
|
}));
|
|
40
40
|
}
|
|
41
|
-
getLegalSpacesToSummon(entity) {
|
|
42
|
-
return this.legalSpaces.filter((space) => this.isLegalSpaceToSummon(space, entity));
|
|
43
|
-
}
|
|
44
41
|
isLegalSpaceToSummon(space, entity) {
|
|
45
42
|
const opponents = this.game.players.filter((player) => player !== this.player);
|
|
46
43
|
const favorTax = sumBy(opponents, (opponent) => new Pantheon(this.game, opponent).getFavorTax(space));
|
|
@@ -106,18 +103,19 @@ export class Pantheon extends MaterialRulesPart {
|
|
|
106
103
|
if (summoned) {
|
|
107
104
|
moves.push(...this.onSummon(move));
|
|
108
105
|
}
|
|
106
|
+
const gridBefore = this.remind(Memory.PlayerGrid, this.player);
|
|
109
107
|
const triggerEvents = this.updateGrid(grid);
|
|
110
108
|
triggerEvents.push({ type: TriggerEventType.EntityPlaced, cardIndex: move.itemIndex, entity, location, summoned: summoned });
|
|
111
109
|
if (triggerEvents.length) {
|
|
112
110
|
triggerEffectsRule.triggerEffects(...triggerEvents);
|
|
113
111
|
}
|
|
112
|
+
this.triggerBonusGains(grid, gridBefore);
|
|
114
113
|
return moves;
|
|
115
114
|
}
|
|
116
115
|
get isSummon() {
|
|
117
116
|
return new MythologiesRules(this.game).delegate().isSummon;
|
|
118
117
|
}
|
|
119
118
|
updateGrid(gridAfter = this.indexGrid) {
|
|
120
|
-
this.triggerBonusGains(gridAfter);
|
|
121
119
|
const gridBefore = this.remind(Memory.PlayerGrid, this.player) ?? this.indexGrid;
|
|
122
120
|
this.memorize(Memory.PlayerGrid, gridAfter, this.player);
|
|
123
121
|
const triggerEvents = [];
|
|
@@ -166,16 +164,20 @@ export class Pantheon extends MaterialRulesPart {
|
|
|
166
164
|
}
|
|
167
165
|
return entities;
|
|
168
166
|
}
|
|
169
|
-
triggerBonusGains(grid = this.indexGrid) {
|
|
167
|
+
triggerBonusGains(grid = this.indexGrid, gridBefore) {
|
|
170
168
|
const effect = { type: PendingEffectsType.BonusGains, player: this.player, lines: [], columns: [] };
|
|
171
169
|
const fullLines = range(0, 3).filter((y) => !grid[y].includes(null));
|
|
172
170
|
for (const y of fullLines) {
|
|
171
|
+
if (gridBefore && gridBefore[y].every((item) => item !== null))
|
|
172
|
+
continue;
|
|
173
173
|
if (this.getBonusGem(y).length) {
|
|
174
174
|
effect.lines.push(y);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
const fullColumns = range(0, 3).filter((x) => grid.every((line) => line[x] !== null));
|
|
178
178
|
for (const x of fullColumns) {
|
|
179
|
+
if (gridBefore && gridBefore.every((line) => line[x] !== null))
|
|
180
|
+
continue;
|
|
179
181
|
if (this.getBonusFavor(x).length) {
|
|
180
182
|
effect.columns.push(x);
|
|
181
183
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { CyclopsEffectRule } from '../../../rules/effects/CyclopsEffectRule';
|
|
2
|
+
import { PlaceCardsRule } from '../../../rules/PlaceCardsRule';
|
|
2
3
|
import { LineEventType, TriggerEventType } from '../Effect';
|
|
3
4
|
export const Cyclops = {
|
|
4
5
|
summon: [{ favor: 1 }, { gem: 1 }, {}],
|
|
5
6
|
effect: {
|
|
6
|
-
trigger: (event, { cardLocation, game }) => {
|
|
7
|
+
trigger: (event, { cardLocation, game, cardIndex }) => {
|
|
7
8
|
const { x, y, player } = cardLocation;
|
|
8
9
|
return (((event.type === TriggerEventType.ColumnEvent && event.x === x) || (event.type === TriggerEventType.LineEvent && event.y === y)) &&
|
|
9
10
|
event.eventType === LineEventType.BonusGain &&
|
|
10
11
|
event.player === player &&
|
|
11
|
-
new CyclopsEffectRule(game).getBonus(event).length > 0
|
|
12
|
+
new CyclopsEffectRule(game).getBonus(event).length > 0 &&
|
|
13
|
+
new PlaceCardsRule(game).isOncePerTurnAvailable(cardIndex));
|
|
12
14
|
},
|
|
13
15
|
rule: CyclopsEffectRule
|
|
14
16
|
}
|
package/dist/rules/RuleId.d.ts
CHANGED
package/dist/rules/RuleId.js
CHANGED
|
@@ -60,4 +60,5 @@ export var RuleId;
|
|
|
60
60
|
RuleId[RuleId["SelkieEffect"] = 61] = "SelkieEffect";
|
|
61
61
|
RuleId[RuleId["DullahanEffect"] = 62] = "DullahanEffect";
|
|
62
62
|
RuleId[RuleId["GarudaSacrifice"] = 63] = "GarudaSacrifice";
|
|
63
|
+
RuleId[RuleId["CaimanSacrificeEffect"] = 64] = "CaimanSacrificeEffect";
|
|
63
64
|
})(RuleId || (RuleId = {}));
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CustomMove, MaterialMove } from '@gamepark/rules-api';
|
|
2
|
+
import { PlayerEffectRule } from '../../material/entity/PlayerEffectRule';
|
|
2
3
|
import { SacrificeEffectRule } from '../../material/entity/SacrificeEffectRule';
|
|
3
4
|
import { RuleId } from '../RuleId';
|
|
4
|
-
export declare class CaimanEffectRule extends
|
|
5
|
+
export declare class CaimanEffectRule extends PlayerEffectRule {
|
|
5
6
|
ruleId: RuleId;
|
|
6
|
-
|
|
7
|
+
getPlayerMoves(): CustomMove[];
|
|
8
|
+
onCustomMove(move: CustomMove): MaterialMove[];
|
|
9
|
+
}
|
|
10
|
+
export declare class CaimanSacrificeEffectRule extends SacrificeEffectRule {
|
|
11
|
+
ruleId: RuleId;
|
|
12
|
+
onRuleStart(): CustomMove[] | import("@gamepark/rules-api").MoveItem<number, number, number>[];
|
|
13
|
+
getCardsToSacrifice(): import("@gamepark/rules-api").Material<number, number, number>;
|
|
14
|
+
onSacrifice(): MaterialMove[];
|
|
7
15
|
onRuleEnd(): never[];
|
|
8
16
|
}
|
|
@@ -1,32 +1,58 @@
|
|
|
1
1
|
import { CustomMoveType } from '../../CustomMoveType';
|
|
2
2
|
import { entityMythology } from '../../material/Entity';
|
|
3
|
+
import { PlayerEffectRule } from '../../material/entity/PlayerEffectRule';
|
|
3
4
|
import { SacrificeEffectRule } from '../../material/entity/SacrificeEffectRule';
|
|
4
|
-
import { LocationType } from '../../material/LocationType';
|
|
5
5
|
import { MaterialType } from '../../material/MaterialType';
|
|
6
6
|
import { Pantheon } from '../../material/Pantheon';
|
|
7
7
|
import { Memory } from '../../Memory';
|
|
8
8
|
import { RuleId } from '../RuleId';
|
|
9
|
-
export class CaimanEffectRule extends
|
|
9
|
+
export class CaimanEffectRule extends PlayerEffectRule {
|
|
10
10
|
ruleId = RuleId.CaimanEffect;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
getPlayerMoves() {
|
|
12
|
+
return this.material(MaterialType.MythologyBoard)
|
|
13
|
+
.getItems()
|
|
14
|
+
.map((item) => this.customMove(CustomMoveType.ChooseMythology, item.id.mythology));
|
|
15
|
+
}
|
|
16
|
+
onCustomMove(move) {
|
|
17
|
+
if (move.type === CustomMoveType.ChooseMythology) {
|
|
18
|
+
this.memorize(Memory.TargetMythology, move.data);
|
|
19
|
+
return [this.startRule(RuleId.CaimanSacrificeEffect)];
|
|
20
|
+
}
|
|
21
|
+
return super.onCustomMove(move);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class CaimanSacrificeEffectRule extends SacrificeEffectRule {
|
|
25
|
+
ruleId = RuleId.CaimanSacrificeEffect;
|
|
26
|
+
onRuleStart() {
|
|
27
|
+
const mythology = this.remind(Memory.TargetMythology);
|
|
28
|
+
const indexes = new Pantheon(this.game, this.player).visibleEntities.id((id) => entityMythology(id.front) === mythology).getIndexes();
|
|
29
|
+
if (!indexes.length)
|
|
30
|
+
return [this.customMove(CustomMoveType.EndEffect)];
|
|
31
|
+
this.memorize(Memory.TargetEntities, indexes);
|
|
32
|
+
this.memorize(Memory.EffectCount, indexes.length);
|
|
33
|
+
const moves = this.getPlayerMoves();
|
|
34
|
+
if (moves.length === indexes.length) {
|
|
35
|
+
return moves;
|
|
36
|
+
}
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
getCardsToSacrifice() {
|
|
40
|
+
const indexes = this.remind(Memory.TargetEntities);
|
|
41
|
+
return this.material(MaterialType.EntityCard).index(indexes);
|
|
42
|
+
}
|
|
43
|
+
onSacrifice() {
|
|
44
|
+
const moves = [];
|
|
45
|
+
moves.push(new Pantheon(this.game, this.player).gainGems(1));
|
|
46
|
+
const remaining = this.memorize(Memory.EffectCount, (count) => count - 1);
|
|
47
|
+
if (!remaining) {
|
|
48
|
+
moves.push(this.customMove(CustomMoveType.EndEffect));
|
|
14
49
|
}
|
|
15
|
-
|
|
16
|
-
const mythology = entityMythology(card.id.front);
|
|
17
|
-
const pantheon = new Pantheon(this.game, this.player);
|
|
18
|
-
const others = pantheon.visibleEntities
|
|
19
|
-
.location((l) => l.x !== card.location.x || l.y !== card.location.y)
|
|
20
|
-
.id((id) => entityMythology(id.front) === mythology);
|
|
21
|
-
this.memorize(Memory.EffectCount, 1 + others.length);
|
|
22
|
-
return [
|
|
23
|
-
...others.moveItems({ type: LocationType.PlayerDiscard, player: this.player }),
|
|
24
|
-
pantheon.gainGems(1 + others.length),
|
|
25
|
-
this.customMove(CustomMoveType.EndEffect)
|
|
26
|
-
];
|
|
50
|
+
return moves;
|
|
27
51
|
}
|
|
28
52
|
onRuleEnd() {
|
|
53
|
+
this.forget(Memory.TargetEntities);
|
|
29
54
|
this.forget(Memory.EffectCount);
|
|
55
|
+
this.forget(Memory.TargetMythology);
|
|
30
56
|
return [];
|
|
31
57
|
}
|
|
32
58
|
}
|
|
@@ -39,6 +39,7 @@ export class ResolveEffectsRule extends PlayerTurnRule {
|
|
|
39
39
|
throw new Error('Unexpected state: start ResolveEffectsRule without pending effects');
|
|
40
40
|
}
|
|
41
41
|
if (pendingEffects.type === PendingEffectsType.SummonGain) {
|
|
42
|
+
this.memorize(Memory.PendingEffects, (effects) => effects.slice(1));
|
|
42
43
|
return [...new Pantheon(this.game, this.player).getSummonGains(pendingEffects.entity, pendingEffects.line), this.customMove(CustomMoveType.EndEffect)];
|
|
43
44
|
}
|
|
44
45
|
const moves = this.getPlayerMoves();
|
|
@@ -46,6 +47,7 @@ export class ResolveEffectsRule extends PlayerTurnRule {
|
|
|
46
47
|
return moves;
|
|
47
48
|
}
|
|
48
49
|
else if (moves.length === 0) {
|
|
50
|
+
this.memorize(Memory.PendingEffects, (effects) => effects.slice(1));
|
|
49
51
|
return [this.customMove(CustomMoveType.EndEffect)];
|
|
50
52
|
}
|
|
51
53
|
return [];
|
|
@@ -93,6 +95,7 @@ export class ResolveEffectsRule extends PlayerTurnRule {
|
|
|
93
95
|
pendingEffects.lines = pendingEffects.lines.filter((line) => line !== item.location.y);
|
|
94
96
|
}
|
|
95
97
|
if (this.getPlayerMoves().length === 0) {
|
|
98
|
+
this.memorize(Memory.PendingEffects, (effects) => effects.slice(1));
|
|
96
99
|
return [this.customMove(CustomMoveType.EndEffect)];
|
|
97
100
|
}
|
|
98
101
|
}
|
|
@@ -136,9 +139,6 @@ export class ResolveEffectsRule extends PlayerTurnRule {
|
|
|
136
139
|
if (this.remind(Memory.OngoingEffect) !== undefined) {
|
|
137
140
|
this.forget(Memory.OngoingEffect);
|
|
138
141
|
}
|
|
139
|
-
else {
|
|
140
|
-
this.memorize(Memory.PendingEffects, (effects) => effects.slice(1));
|
|
141
|
-
}
|
|
142
142
|
if (this.remind(Memory.PendingEffects).length) {
|
|
143
143
|
moves.push(...this.startEffectsResolution());
|
|
144
144
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamepark/mythologies",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "The rules of Mythologies adapted for Game Park",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -27,6 +27,5 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@gamepark/rules-api": "~7.2.0",
|
|
29
29
|
"es-toolkit": "^1.44.0"
|
|
30
|
-
}
|
|
31
|
-
"gitHead": "6333853529378cbbf1535c58e13a015919adf186"
|
|
30
|
+
}
|
|
32
31
|
}
|