@gamepark/mythologies 1.0.5 → 1.0.7
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.
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uniq } from 'es-toolkit';
|
|
2
2
|
import { entityMythology } from '../../Entity';
|
|
3
3
|
import { Mythology } from '../../Mythology';
|
|
4
4
|
import { Pantheon } from '../../Pantheon';
|
|
@@ -13,10 +13,8 @@ export const Osiris = {
|
|
|
13
13
|
const pantheon = new Pantheon(this.game, this.player);
|
|
14
14
|
const grid = pantheon.grid;
|
|
15
15
|
const mythologiesPerLine = grid.map((line) => line.filter((space) => space !== undefined).map(entityMythology));
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
return mythologies.filter((mythology) => mythology !== Mythology.Egyptian).length;
|
|
19
|
-
}));
|
|
16
|
+
const allMythologies = uniq(mythologiesPerLine.flat()).filter((m) => m !== Mythology.Egyptian);
|
|
17
|
+
const otherMythologies = allMythologies.filter((m) => mythologiesPerLine.filter((line) => line.includes(m)).length >= 2).length;
|
|
20
18
|
return otherMythologies > 0 ? [pantheon.gainFavor(otherMythologies * 2)] : [];
|
|
21
19
|
}
|
|
22
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamepark/mythologies",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
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": "206c518eab1522346aa611cf57e3333f42aae2a7"
|
|
32
32
|
}
|