@gamepark/mythologies 0.7.0 → 0.7.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.
- package/dist/CustomMoveType.d.ts +3 -4
- package/dist/CustomMoveType.js +3 -4
- package/dist/MythologiesRules.d.ts +1 -1
- package/dist/MythologiesRules.js +33 -9
- package/dist/material/Destiny.d.ts +1 -0
- package/dist/material/Destiny.js +9 -0
- package/dist/material/Entity.d.ts +2 -2
- package/dist/material/Entity.js +2 -2
- package/dist/material/LocationType.d.ts +3 -1
- package/dist/material/LocationType.js +2 -0
- package/dist/material/MaterialType.d.ts +2 -1
- package/dist/material/MaterialType.js +1 -0
- package/dist/material/Pantheon.d.ts +1 -0
- package/dist/material/Pantheon.js +18 -16
- package/dist/material/entity/Effect.d.ts +10 -6
- package/dist/material/entity/Effect.js +48 -9
- package/dist/material/entity/SimultaneousMoveEffectRule.d.ts +0 -1
- package/dist/material/entity/SimultaneousMoveEffectRule.js +0 -4
- package/dist/material/entity/SimultaneousSacrificeEffectRule.d.ts +0 -1
- package/dist/material/entity/SimultaneousSacrificeEffectRule.js +0 -4
- package/dist/material/entity/celtic/Banshee.js +2 -2
- package/dist/material/entity/celtic/Dagda.js +3 -2
- package/dist/material/entity/chinese/ChangE.js +3 -5
- package/dist/material/entity/chinese/Fenghuang.js +3 -1
- package/dist/material/entity/chinese/Mogwai.js +4 -4
- package/dist/material/entity/chinese/SunWukong.js +3 -2
- package/dist/material/entity/egyptian/Isis.js +3 -2
- package/dist/material/entity/greek/Cyclops.js +7 -12
- package/dist/material/entity/greek/Poseidon.js +3 -2
- package/dist/material/entity/inca/Puma.js +4 -1
- package/dist/material/entity/inca/Ukuku.js +4 -4
- package/dist/material/entity/zulu/Inkanyamba.js +4 -1
- package/dist/rules/PlaceTokenRule.js +5 -3
- package/dist/rules/RuleId.d.ts +4 -1
- package/dist/rules/RuleId.js +3 -0
- package/dist/rules/effects/CentaurEffectRule.d.ts +1 -0
- package/dist/rules/effects/CentaurEffectRule.js +8 -44
- package/dist/rules/effects/CyclopsEffectRule.d.ts +5 -4
- package/dist/rules/effects/CyclopsEffectRule.js +58 -49
- package/dist/rules/effects/DraugrEffectRule.d.ts +1 -1
- package/dist/rules/effects/DraugrEffectRule.js +1 -1
- package/dist/rules/effects/FenrirEffectRule.js +6 -1
- package/dist/rules/effects/IllapaEffectRule.d.ts +4 -2
- package/dist/rules/effects/IllapaEffectRule.js +17 -12
- package/dist/rules/effects/MinotaurEffectRule.d.ts +2 -0
- package/dist/rules/effects/MinotaurEffectRule.js +11 -1
- package/dist/rules/effects/NuwaEffectRule.d.ts +3 -1
- package/dist/rules/effects/NuwaEffectRule.js +20 -12
- package/dist/rules/effects/ThorEffectRule.js +1 -1
- package/dist/rules/effects/TianlongEffectRule.d.ts +1 -0
- package/dist/rules/effects/TianlongEffectRule.js +19 -48
- package/dist/rules/effects/TriggerEffectsRule.d.ts +3 -3
- package/dist/rules/effects/TriggerEffectsRule.js +22 -18
- package/package.json +4 -4
package/dist/CustomMoveType.d.ts
CHANGED
|
@@ -4,10 +4,9 @@ export declare enum CustomMoveType {
|
|
|
4
4
|
TrialFailure = 3,
|
|
5
5
|
PlayEffect = 4,
|
|
6
6
|
EndEffect = 5,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
ChooseEntityCard = 9
|
|
7
|
+
ChooseMythology = 6,
|
|
8
|
+
ChooseLine = 7,
|
|
9
|
+
ChooseEntityCard = 8
|
|
11
10
|
}
|
|
12
11
|
export type TrialSuccessData = {
|
|
13
12
|
trial: number;
|
package/dist/CustomMoveType.js
CHANGED
|
@@ -8,8 +8,7 @@ var CustomMoveType;
|
|
|
8
8
|
CustomMoveType[CustomMoveType["TrialFailure"] = 3] = "TrialFailure";
|
|
9
9
|
CustomMoveType[CustomMoveType["PlayEffect"] = 4] = "PlayEffect";
|
|
10
10
|
CustomMoveType[CustomMoveType["EndEffect"] = 5] = "EndEffect";
|
|
11
|
-
CustomMoveType[CustomMoveType["
|
|
12
|
-
CustomMoveType[CustomMoveType["
|
|
13
|
-
CustomMoveType[CustomMoveType["
|
|
14
|
-
CustomMoveType[CustomMoveType["ChooseEntityCard"] = 9] = "ChooseEntityCard";
|
|
11
|
+
CustomMoveType[CustomMoveType["ChooseMythology"] = 6] = "ChooseMythology";
|
|
12
|
+
CustomMoveType[CustomMoveType["ChooseLine"] = 7] = "ChooseLine";
|
|
13
|
+
CustomMoveType[CustomMoveType["ChooseEntityCard"] = 8] = "ChooseEntityCard";
|
|
15
14
|
})(CustomMoveType = exports.CustomMoveType || (exports.CustomMoveType = {}));
|
|
@@ -148,7 +148,7 @@ export declare class MythologiesRules extends SecretMaterialRules<PlayerColor, M
|
|
|
148
148
|
keepMoveSecret(move: MaterialMove): boolean;
|
|
149
149
|
isPlayerDestiny(move: MoveItem): boolean;
|
|
150
150
|
beforeItemMove(move: ItemMove): MaterialMove<PlayerColor, MaterialType, LocationType, number>[];
|
|
151
|
-
protected onCustomMove(move: CustomMove): MaterialMove<
|
|
151
|
+
protected onCustomMove(move: CustomMove): MaterialMove<PlayerColor, MaterialType, LocationType, number>[];
|
|
152
152
|
getAutomaticMoves(): MaterialMove<number, number, number, number>[];
|
|
153
153
|
startEffectsResolution(): MaterialMove<number, number, number, number>[];
|
|
154
154
|
giveTime(): number;
|
package/dist/MythologiesRules.js
CHANGED
|
@@ -14,6 +14,31 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
18
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19
|
+
if (!m) return o;
|
|
20
|
+
var i = m.call(o), r, ar = [], e;
|
|
21
|
+
try {
|
|
22
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
23
|
+
}
|
|
24
|
+
catch (error) { e = { error: error }; }
|
|
25
|
+
finally {
|
|
26
|
+
try {
|
|
27
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
28
|
+
}
|
|
29
|
+
finally { if (e) throw e.error; }
|
|
30
|
+
}
|
|
31
|
+
return ar;
|
|
32
|
+
};
|
|
33
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
34
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
35
|
+
if (ar || !(i in from)) {
|
|
36
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
37
|
+
ar[i] = from[i];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
41
|
+
};
|
|
17
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
43
|
exports.MythologiesRules = void 0;
|
|
19
44
|
var rules_api_1 = require("@gamepark/rules-api");
|
|
@@ -208,27 +233,26 @@ var MythologiesRules = (function (_super) {
|
|
|
208
233
|
return _super.prototype.beforeItemMove.call(this, move);
|
|
209
234
|
};
|
|
210
235
|
MythologiesRules.prototype.onCustomMove = function (move) {
|
|
211
|
-
var
|
|
236
|
+
var moves = _super.prototype.onCustomMove.call(this, move);
|
|
212
237
|
if (move.type === CustomMoveType_1.CustomMoveType.EndEffect) {
|
|
213
238
|
this.forget(Memory_1.Memory.OngoingEffect);
|
|
214
239
|
if (this.remind(Memory_1.Memory.PendingEffects).length) {
|
|
215
|
-
|
|
240
|
+
moves.push.apply(moves, __spreadArray([], __read(this.startEffectsResolution()), false));
|
|
216
241
|
}
|
|
217
242
|
else {
|
|
218
243
|
var pendingRule = this.remind(Memory_1.Memory.PendingRule);
|
|
219
244
|
if (pendingRule) {
|
|
220
|
-
var id = pendingRule.id, player = pendingRule.player;
|
|
221
245
|
this.forget(Memory_1.Memory.PendingRule);
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
246
|
+
if (pendingRule.id === RuleId_1.RuleId.EndGame) {
|
|
247
|
+
moves.push(this.endGame());
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
moves.push(this.startPlayerTurn(RuleId_1.RuleId.PlaceCards, pendingRule.player));
|
|
227
251
|
}
|
|
228
252
|
}
|
|
229
253
|
}
|
|
230
254
|
}
|
|
231
|
-
return
|
|
255
|
+
return moves;
|
|
232
256
|
};
|
|
233
257
|
MythologiesRules.prototype.getAutomaticMoves = function () {
|
|
234
258
|
var _a;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MaterialRulesPart } from '@gamepark/rules-api';
|
|
2
2
|
import { PlayerColor } from '../PlayerColor';
|
|
3
3
|
export declare class Destiny extends MaterialRulesPart {
|
|
4
|
+
get mythologies(): import("./Mythology").Mythology[];
|
|
4
5
|
getMythologyBoard(player: PlayerColor): import("@gamepark/rules-api").Material<number, number, number>;
|
|
5
6
|
getMythology(player: PlayerColor): import("./Mythology").Mythology;
|
|
6
7
|
getDestinyMap(destiny: number): PlayerColor[][];
|
package/dist/material/Destiny.js
CHANGED
|
@@ -25,6 +25,15 @@ var Destiny = (function (_super) {
|
|
|
25
25
|
function Destiny() {
|
|
26
26
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
27
27
|
}
|
|
28
|
+
Object.defineProperty(Destiny.prototype, "mythologies", {
|
|
29
|
+
get: function () {
|
|
30
|
+
return this.material(MaterialType_1.MaterialType.MythologyBoard)
|
|
31
|
+
.getItems()
|
|
32
|
+
.map(function (item) { return item.id.mythology; });
|
|
33
|
+
},
|
|
34
|
+
enumerable: false,
|
|
35
|
+
configurable: true
|
|
36
|
+
});
|
|
28
37
|
Destiny.prototype.getMythologyBoard = function (player) {
|
|
29
38
|
var destiny = this.material(MaterialType_1.MaterialType.DestinyCard)
|
|
30
39
|
.location(LocationType_1.LocationType.CurrentDestiny)
|
package/dist/material/Entity.js
CHANGED
|
@@ -44,8 +44,8 @@ var Entity;
|
|
|
44
44
|
Entity[Entity["Vetala"] = 39] = "Vetala";
|
|
45
45
|
Entity[Entity["Kinnara"] = 40] = "Kinnara";
|
|
46
46
|
Entity[Entity["Viracocha"] = 41] = "Viracocha";
|
|
47
|
-
Entity[Entity["
|
|
48
|
-
Entity[Entity["
|
|
47
|
+
Entity[Entity["Illapa"] = 42] = "Illapa";
|
|
48
|
+
Entity[Entity["MamaQucha"] = 43] = "MamaQucha";
|
|
49
49
|
Entity[Entity["Inti"] = 44] = "Inti";
|
|
50
50
|
Entity[Entity["Puma"] = 45] = "Puma";
|
|
51
51
|
Entity[Entity["Amaru"] = 46] = "Amaru";
|
|
@@ -21,6 +21,8 @@ export declare enum LocationType {
|
|
|
21
21
|
PlayerGems = 20,
|
|
22
22
|
PlayerFavor = 21,
|
|
23
23
|
PlayerDiscard = 22,
|
|
24
|
-
PlayerBufferArea = 23
|
|
24
|
+
PlayerBufferArea = 23,
|
|
25
|
+
GameHelpArea = 24,
|
|
26
|
+
CardsCount = 25
|
|
25
27
|
}
|
|
26
28
|
export declare const isInSanctuary: (type?: LocationType) => boolean;
|
|
@@ -26,6 +26,8 @@ var LocationType;
|
|
|
26
26
|
LocationType[LocationType["PlayerFavor"] = 21] = "PlayerFavor";
|
|
27
27
|
LocationType[LocationType["PlayerDiscard"] = 22] = "PlayerDiscard";
|
|
28
28
|
LocationType[LocationType["PlayerBufferArea"] = 23] = "PlayerBufferArea";
|
|
29
|
+
LocationType[LocationType["GameHelpArea"] = 24] = "GameHelpArea";
|
|
30
|
+
LocationType[LocationType["CardsCount"] = 25] = "CardsCount";
|
|
29
31
|
})(LocationType = exports.LocationType || (exports.LocationType = {}));
|
|
30
32
|
var isInSanctuary = function (type) { return type === LocationType.SanctuaryCreatureSpot || type === LocationType.SanctuaryGodSpot; };
|
|
31
33
|
exports.isInSanctuary = isInSanctuary;
|
|
@@ -13,4 +13,5 @@ var MaterialType;
|
|
|
13
13
|
MaterialType[MaterialType["RoundCounterBoard"] = 8] = "RoundCounterBoard";
|
|
14
14
|
MaterialType[MaterialType["RoundToken"] = 9] = "RoundToken";
|
|
15
15
|
MaterialType[MaterialType["DestinyCard"] = 10] = "DestinyCard";
|
|
16
|
+
MaterialType[MaterialType["HelpCard"] = 11] = "HelpCard";
|
|
16
17
|
})(MaterialType = exports.MaterialType || (exports.MaterialType = {}));
|
|
@@ -37,6 +37,7 @@ export declare class Pantheon extends MaterialRulesPart {
|
|
|
37
37
|
getInvokeGains(entity: Entity, line: number): MaterialMove<number, number, number, number>[];
|
|
38
38
|
hasEntity(entity: Entity): boolean;
|
|
39
39
|
getPiles(predicate?: (space: XYCoordinates) => boolean): Material[];
|
|
40
|
+
getPile({ x, y }: XYCoordinates, fullPantheon?: Material<number, number, number>): Material;
|
|
40
41
|
isAbleToMove(entity: EntityItem): boolean;
|
|
41
42
|
get mythologies(): import("./Mythology").Mythology[];
|
|
42
43
|
get missingMythologies(): import("./Mythology").Mythology[];
|
|
@@ -58,6 +58,7 @@ var Memory_1 = require("../Memory");
|
|
|
58
58
|
var MythologiesRules_1 = require("../MythologiesRules");
|
|
59
59
|
var PermanentEffectsRule_1 = require("../rules/effects/PermanentEffectsRule");
|
|
60
60
|
var TriggerEffectsRule_1 = require("../rules/effects/TriggerEffectsRule");
|
|
61
|
+
var Destiny_1 = require("./Destiny");
|
|
61
62
|
var Entity_1 = require("./Entity");
|
|
62
63
|
var Effect_1 = require("./entity/Effect");
|
|
63
64
|
var EntityDescription_1 = require("./entity/EntityDescription");
|
|
@@ -208,7 +209,7 @@ var Pantheon = (function (_super) {
|
|
|
208
209
|
grid[move.location.y][move.location.x] = move.itemIndex;
|
|
209
210
|
moves.push.apply(moves, __spreadArray([], __read(this.gainBonus(grid)), false));
|
|
210
211
|
var triggerEffectsRule = new TriggerEffectsRule_1.TriggerEffectsRule(this.game);
|
|
211
|
-
triggerEffectsRule.triggerCardEffect(
|
|
212
|
+
triggerEffectsRule.triggerCardEffect(move.itemIndex, location, { type: Effect_1.TriggerEventType.SelfPlaced });
|
|
212
213
|
var triggerEvents = this.updateGrid(grid);
|
|
213
214
|
var invoked = this.isInvoke;
|
|
214
215
|
if (invoked) {
|
|
@@ -401,24 +402,23 @@ var Pantheon = (function (_super) {
|
|
|
401
402
|
var piles = [];
|
|
402
403
|
var myEntities = this.material(MaterialType_1.MaterialType.EntityCard).player(this.player);
|
|
403
404
|
var fullPantheon = myEntities.location(LocationType_1.LocationType.Pantheon);
|
|
404
|
-
var
|
|
405
|
-
var
|
|
405
|
+
for (var x = 0; x < 3; x++) {
|
|
406
|
+
for (var y = 0; y < 3; y++) {
|
|
406
407
|
if (predicate({ x: x, y: y })) {
|
|
407
|
-
var pile =
|
|
408
|
+
var pile = this.getPile({ x: x, y: y }, fullPantheon);
|
|
408
409
|
if (pile.length > 0) {
|
|
409
410
|
piles.push(pile);
|
|
410
411
|
}
|
|
411
412
|
}
|
|
412
|
-
};
|
|
413
|
-
for (var y = 0; y < 3; y++) {
|
|
414
|
-
_loop_5(y);
|
|
415
413
|
}
|
|
416
|
-
};
|
|
417
|
-
for (var x = 0; x < 3; x++) {
|
|
418
|
-
_loop_4(x);
|
|
419
414
|
}
|
|
420
415
|
return piles;
|
|
421
416
|
};
|
|
417
|
+
Pantheon.prototype.getPile = function (_a, fullPantheon) {
|
|
418
|
+
var x = _a.x, y = _a.y;
|
|
419
|
+
if (fullPantheon === void 0) { fullPantheon = this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.Pantheon).player(this.player); }
|
|
420
|
+
return fullPantheon.location(function (l) { return l.x === x && l.y === y; }).sort(function (item) { return item.location.z; });
|
|
421
|
+
};
|
|
422
422
|
Pantheon.prototype.isAbleToMove = function (entity) {
|
|
423
423
|
return new PermanentEffectsRule_1.PermanentEffectsRule(this.game).canMove(entity);
|
|
424
424
|
};
|
|
@@ -431,18 +431,20 @@ var Pantheon = (function (_super) {
|
|
|
431
431
|
});
|
|
432
432
|
Object.defineProperty(Pantheon.prototype, "missingMythologies", {
|
|
433
433
|
get: function () {
|
|
434
|
-
|
|
435
|
-
.getItems()
|
|
436
|
-
.map(function (item) { return item.id.mythology; });
|
|
437
|
-
return (0, lodash_1.difference)(mythologies, this.mythologies);
|
|
434
|
+
return (0, lodash_1.difference)(new Destiny_1.Destiny(this.game).mythologies, this.mythologies);
|
|
438
435
|
},
|
|
439
436
|
enumerable: false,
|
|
440
437
|
configurable: true
|
|
441
438
|
});
|
|
442
439
|
Pantheon.prototype.onEntitySacrificed = function (card) {
|
|
443
440
|
var _a;
|
|
444
|
-
var
|
|
445
|
-
|
|
441
|
+
var item = card.getItem();
|
|
442
|
+
var _b = item.location, x = _b.x, y = _b.y, z = _b.z;
|
|
443
|
+
var grid = this.indexGrid;
|
|
444
|
+
var cardUnder = this.allCards.location(function (l) { return l.x === x && l.y === y && l.z !== z; }).maxBy(function (item) { return item.location.z; });
|
|
445
|
+
grid[y][x] = cardUnder.length ? cardUnder.getIndex() : null;
|
|
446
|
+
var effects = this.updateGrid(grid);
|
|
447
|
+
effects.push({ type: Effect_1.TriggerEventType.EntitySacrificed, card: item, cardIndex: card.getIndex() });
|
|
446
448
|
(_a = new TriggerEffectsRule_1.TriggerEffectsRule(this.game)).triggerEffects.apply(_a, __spreadArray([], __read(effects), false));
|
|
447
449
|
};
|
|
448
450
|
Pantheon.prototype.hasCrushed = function (card) {
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { Location,
|
|
1
|
+
import { Location, MaterialGame, MaterialMove, MaterialRulesPart, PlayerTurnRule, SimultaneousRule, XYCoordinates } from '@gamepark/rules-api';
|
|
2
2
|
import { PlayerColor } from '../../PlayerColor';
|
|
3
3
|
import { RuleId } from '../../rules/RuleId';
|
|
4
4
|
import { Entity, EntityId, EntityItem } from '../Entity';
|
|
5
|
+
export type TriggerEventContext = {
|
|
6
|
+
cardIndex: number;
|
|
7
|
+
cardLocation: Location;
|
|
8
|
+
game: MaterialGame;
|
|
9
|
+
};
|
|
5
10
|
export type TriggeredEffect = {
|
|
6
|
-
trigger: (event: TriggerEvent,
|
|
11
|
+
trigger: (event: TriggerEvent, context: TriggerEventContext) => boolean;
|
|
7
12
|
rule: new (game: MaterialGame) => EffectRule;
|
|
8
13
|
auto?: boolean;
|
|
9
14
|
};
|
|
@@ -60,7 +65,6 @@ export declare enum TriggerEventType {
|
|
|
60
65
|
}
|
|
61
66
|
export type SelfPlaced = {
|
|
62
67
|
type: TriggerEventType.SelfPlaced;
|
|
63
|
-
location: Location;
|
|
64
68
|
};
|
|
65
69
|
export type EndOfGameEvent = {
|
|
66
70
|
type: TriggerEventType.EndOfGame;
|
|
@@ -99,13 +103,13 @@ export type EntityCrushed = {
|
|
|
99
103
|
card: EntityItem;
|
|
100
104
|
cardIndex: number;
|
|
101
105
|
};
|
|
102
|
-
export declare const isCrushed: (event: TriggerEvent,
|
|
106
|
+
export declare const isCrushed: (event: TriggerEvent, { cardIndex }: TriggerEventContext) => event is EntityCrushed;
|
|
103
107
|
export type EntitySacrificed = {
|
|
104
108
|
type: TriggerEventType.EntitySacrificed;
|
|
105
109
|
card: EntityItem;
|
|
106
110
|
cardIndex: number;
|
|
107
111
|
};
|
|
108
|
-
export declare const isSacrificed: (event: TriggerEvent,
|
|
112
|
+
export declare const isSacrificed: (event: TriggerEvent, { cardIndex }: TriggerEventContext) => event is EntityCrushed;
|
|
109
113
|
export type EntitiesMoved = {
|
|
110
114
|
type: TriggerEventType.EntitiesMoved;
|
|
111
115
|
player: PlayerColor;
|
|
@@ -115,7 +119,7 @@ export type EndOfTurn = {
|
|
|
115
119
|
type: TriggerEventType.EndOfTurn;
|
|
116
120
|
player: PlayerColor;
|
|
117
121
|
};
|
|
118
|
-
export declare const isEndOfMyTurn: (event: TriggerEvent,
|
|
122
|
+
export declare const isEndOfMyTurn: (event: TriggerEvent, { cardLocation }: TriggerEventContext) => event is EndOfTurn;
|
|
119
123
|
export type TriggerEvent = EndOfGameEvent | SelfPlaced | EntityPlaced | LineEvent | ColumnEvent | Infinite | EntityCrushed | EntitySacrificed | EntitiesMoved | EndOfTurn;
|
|
120
124
|
export type PendingEffect<Event extends TriggerEvent = TriggerEvent> = {
|
|
121
125
|
cardIndex: number;
|
|
@@ -14,6 +14,17 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
+
var __values = (this && this.__values) || function(o) {
|
|
18
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
19
|
+
if (m) return m.call(o);
|
|
20
|
+
if (o && typeof o.length === "number") return {
|
|
21
|
+
next: function () {
|
|
22
|
+
if (o && i >= o.length) o = void 0;
|
|
23
|
+
return { value: o && o[i++], done: !o };
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
27
|
+
};
|
|
17
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
29
|
exports.isEndOfMyTurn = exports.isSacrificed = exports.isCrushed = exports.oncePerTurn = exports.LineEventType = exports.isPlaced = exports.isEndOfGame = exports.TriggerEventType = exports.AutoEffectRule = exports.SimultaneousEffectRule = exports.PlayerEffectRule = exports.isTriggeredEffect = void 0;
|
|
19
30
|
var rules_api_1 = require("@gamepark/rules-api");
|
|
@@ -62,12 +73,35 @@ var SimultaneousEffectRule = (function (_super) {
|
|
|
62
73
|
return true;
|
|
63
74
|
};
|
|
64
75
|
SimultaneousEffectRule.prototype.playEffect = function () {
|
|
65
|
-
var
|
|
66
|
-
|
|
76
|
+
var e_1, _a;
|
|
77
|
+
var moves = [];
|
|
78
|
+
var playersToActivate = [];
|
|
79
|
+
try {
|
|
80
|
+
for (var _b = __values(this.getAffectedPlayers()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
81
|
+
var player = _c.value;
|
|
82
|
+
var legalMoves = this.getActivePlayerLegalMoves(player);
|
|
83
|
+
if (legalMoves.length === 1) {
|
|
84
|
+
moves.push(legalMoves[0]);
|
|
85
|
+
}
|
|
86
|
+
else if (legalMoves.length > 1) {
|
|
87
|
+
playersToActivate.push(player);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
92
|
+
finally {
|
|
93
|
+
try {
|
|
94
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
95
|
+
}
|
|
96
|
+
finally { if (e_1) throw e_1.error; }
|
|
97
|
+
}
|
|
98
|
+
if (playersToActivate.length > 0 && this.ruleId) {
|
|
99
|
+
moves.push(this.startSimultaneousRule(this.ruleId, playersToActivate));
|
|
100
|
+
}
|
|
101
|
+
return moves;
|
|
67
102
|
};
|
|
68
103
|
SimultaneousEffectRule.prototype.getAffectedPlayers = function () {
|
|
69
|
-
|
|
70
|
-
return this.game.players.filter(function (player) { return _this.getActivePlayerLegalMoves(player).length > 0; });
|
|
104
|
+
return this.game.players;
|
|
71
105
|
};
|
|
72
106
|
SimultaneousEffectRule.prototype.isOpponent = function (player) {
|
|
73
107
|
return player !== this.card.location.player;
|
|
@@ -141,13 +175,18 @@ var LineEventType;
|
|
|
141
175
|
})(LineEventType = exports.LineEventType || (exports.LineEventType = {}));
|
|
142
176
|
var oncePerTurn = function (event) { return event.type === TriggerEventType.Infinite; };
|
|
143
177
|
exports.oncePerTurn = oncePerTurn;
|
|
144
|
-
var isCrushed = function (event,
|
|
145
|
-
|
|
178
|
+
var isCrushed = function (event, _a) {
|
|
179
|
+
var cardIndex = _a.cardIndex;
|
|
180
|
+
return event.type === TriggerEventType.EntityCrushed && event.cardIndex === cardIndex;
|
|
146
181
|
};
|
|
147
182
|
exports.isCrushed = isCrushed;
|
|
148
|
-
var isSacrificed = function (event,
|
|
149
|
-
|
|
183
|
+
var isSacrificed = function (event, _a) {
|
|
184
|
+
var cardIndex = _a.cardIndex;
|
|
185
|
+
return event.type === TriggerEventType.EntitySacrificed && event.cardIndex === cardIndex;
|
|
150
186
|
};
|
|
151
187
|
exports.isSacrificed = isSacrificed;
|
|
152
|
-
var isEndOfMyTurn = function (event,
|
|
188
|
+
var isEndOfMyTurn = function (event, _a) {
|
|
189
|
+
var cardLocation = _a.cardLocation;
|
|
190
|
+
return event.type === TriggerEventType.EndOfTurn && event.player === cardLocation.player;
|
|
191
|
+
};
|
|
153
192
|
exports.isEndOfMyTurn = isEndOfMyTurn;
|
|
@@ -2,7 +2,6 @@ import { ItemMove, Location, Material, MaterialItem, MaterialMove, MoveItem, XYC
|
|
|
2
2
|
import { PlayerColor } from '../../PlayerColor';
|
|
3
3
|
import { SimultaneousEffectRule } from './Effect';
|
|
4
4
|
export declare abstract class SimultaneousMoveEffectRule extends SimultaneousEffectRule {
|
|
5
|
-
getAffectedPlayers(): PlayerColor[];
|
|
6
5
|
getActivePlayerLegalMoves(player: PlayerColor): MoveItem<number, number, number>[];
|
|
7
6
|
getSacrificeToPreventMove(player: PlayerColor): MoveItem<number, number, number>[];
|
|
8
7
|
getMovementMoves(player: PlayerColor): MoveItem<number, number, number>[];
|
|
@@ -64,10 +64,6 @@ var SimultaneousMoveEffectRule = (function (_super) {
|
|
|
64
64
|
function SimultaneousMoveEffectRule() {
|
|
65
65
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
66
66
|
}
|
|
67
|
-
SimultaneousMoveEffectRule.prototype.getAffectedPlayers = function () {
|
|
68
|
-
var _this = this;
|
|
69
|
-
return this.game.players.filter(function (player) { return _this.getMovementMoves(player).length > 0; });
|
|
70
|
-
};
|
|
71
67
|
SimultaneousMoveEffectRule.prototype.getActivePlayerLegalMoves = function (player) {
|
|
72
68
|
return this.getMovementMoves(player).concat(this.getSacrificeToPreventMove(player));
|
|
73
69
|
};
|
|
@@ -2,7 +2,6 @@ import { ItemMove, Material, MaterialMove, MoveItem } from '@gamepark/rules-api'
|
|
|
2
2
|
import { PlayerColor } from '../../PlayerColor';
|
|
3
3
|
import { SimultaneousEffectRule } from './Effect';
|
|
4
4
|
export declare abstract class SimultaneousSacrificeEffectRule extends SimultaneousEffectRule {
|
|
5
|
-
getAffectedPlayers(): PlayerColor[];
|
|
6
5
|
getActivePlayerLegalMoves(player: PlayerColor): MaterialMove[];
|
|
7
6
|
private getCardsAbleToSacrifice;
|
|
8
7
|
getCardsToSacrifice(player: PlayerColor): Material;
|
|
@@ -27,10 +27,6 @@ var SimultaneousSacrificeEffectRule = (function (_super) {
|
|
|
27
27
|
function SimultaneousSacrificeEffectRule() {
|
|
28
28
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
29
29
|
}
|
|
30
|
-
SimultaneousSacrificeEffectRule.prototype.getAffectedPlayers = function () {
|
|
31
|
-
var _this = this;
|
|
32
|
-
return this.game.players.filter(function (player) { return _this.getCardsToSacrifice(player).length; });
|
|
33
|
-
};
|
|
34
30
|
SimultaneousSacrificeEffectRule.prototype.getActivePlayerLegalMoves = function (player) {
|
|
35
31
|
var cards = this.getCardsAbleToSacrifice(player);
|
|
36
32
|
var moves = cards.moveItems({ type: LocationType_1.LocationType.PlayerDiscard, player: player });
|
|
@@ -31,10 +31,10 @@ exports.Banshee = {
|
|
|
31
31
|
var moves = [];
|
|
32
32
|
var _a = this.card.location, x = _a.x, y = _a.y, player = _a.player;
|
|
33
33
|
var pantheon = new Pantheon_1.Pantheon(this.game, player);
|
|
34
|
-
if (pantheon.grid[y].every(function (entity, column) { return column
|
|
34
|
+
if (pantheon.grid[y].every(function (entity, column) { return column === x || !entity; })) {
|
|
35
35
|
moves.push(pantheon.gainFavor(1));
|
|
36
36
|
}
|
|
37
|
-
if (pantheon.grid.every(function (line, lineY) { return lineY
|
|
37
|
+
if (pantheon.grid.every(function (line, lineY) { return lineY === y || !line[x]; })) {
|
|
38
38
|
moves.push(pantheon.gainGems(1));
|
|
39
39
|
}
|
|
40
40
|
return moves;
|
|
@@ -21,8 +21,9 @@ var Effect_1 = require("../Effect");
|
|
|
21
21
|
exports.Dagda = {
|
|
22
22
|
invoke: [{ gem: 2, favor: 1 }, { favor: 2 }, {}],
|
|
23
23
|
effect: {
|
|
24
|
-
trigger: function (event,
|
|
25
|
-
var
|
|
24
|
+
trigger: function (event, _a) {
|
|
25
|
+
var cardLocation = _a.cardLocation, game = _a.game;
|
|
26
|
+
var player = cardLocation.player;
|
|
26
27
|
switch (event.type) {
|
|
27
28
|
case Effect_1.TriggerEventType.EntitySacrificed:
|
|
28
29
|
case Effect_1.TriggerEventType.EntityCrushed:
|
|
@@ -22,11 +22,9 @@ var Effect_1 = require("../Effect");
|
|
|
22
22
|
exports.ChangE = {
|
|
23
23
|
invoke: [{ gem: 1, favor: 2 }, { gem: 2 }, {}],
|
|
24
24
|
effect: {
|
|
25
|
-
trigger: function (event,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
card.getItem().location.player !== event.location.player &&
|
|
29
|
-
card.getItem().location.y === event.location.y);
|
|
25
|
+
trigger: function (event, _a) {
|
|
26
|
+
var cardLocation = _a.cardLocation;
|
|
27
|
+
return event.type === Effect_1.TriggerEventType.EntityPlaced && event.invoked && cardLocation.player !== event.location.player && cardLocation.y === event.location.y;
|
|
30
28
|
},
|
|
31
29
|
rule: (function (_super) {
|
|
32
30
|
__extends(ChangeEEffectRule, _super);
|
|
@@ -7,7 +7,9 @@ var Effect_1 = require("../Effect");
|
|
|
7
7
|
exports.Fenghuang = {
|
|
8
8
|
invoke: [{ favor: 1 }, {}, { gem: 1 }],
|
|
9
9
|
effect: {
|
|
10
|
-
trigger: function (event,
|
|
10
|
+
trigger: function (event, context) {
|
|
11
|
+
return ((0, Effect_1.isCrushed)(event, context) || (0, Effect_1.isSacrificed)(event, context)) && new PlaceCardsRule_1.PlaceCardsRule(context.game).isOncePerTurnAvailable(context.cardIndex);
|
|
12
|
+
},
|
|
11
13
|
rule: FenghuangEffectRule_1.FenghuangEffectRule
|
|
12
14
|
}
|
|
13
15
|
};
|
|
@@ -21,10 +21,10 @@ var Effect_1 = require("../Effect");
|
|
|
21
21
|
exports.Mogwai = {
|
|
22
22
|
invoke: [{}, { favor: 1 }, { gem: 1 }],
|
|
23
23
|
effect: {
|
|
24
|
-
trigger: function (event,
|
|
25
|
-
var
|
|
26
|
-
return (
|
|
27
|
-
(event.type === Effect_1.TriggerEventType.ColumnEvent && event.eventType === Effect_1.LineEventType.Completed &&
|
|
24
|
+
trigger: function (event, _a) {
|
|
25
|
+
var cardLocation = _a.cardLocation;
|
|
26
|
+
return (event.type === Effect_1.TriggerEventType.LineEvent && event.eventType === Effect_1.LineEventType.Completed && cardLocation.y === event.y) ||
|
|
27
|
+
(event.type === Effect_1.TriggerEventType.ColumnEvent && event.eventType === Effect_1.LineEventType.Completed && cardLocation.x === event.x);
|
|
28
28
|
},
|
|
29
29
|
rule: (function (_super) {
|
|
30
30
|
__extends(MogwaiEffectRule, _super);
|
|
@@ -22,8 +22,9 @@ var Effect_1 = require("../Effect");
|
|
|
22
22
|
exports.SunWukong = {
|
|
23
23
|
invoke: [{ gem: 1 }, { favor: 2 }, { gem: 1 }],
|
|
24
24
|
effect: {
|
|
25
|
-
trigger: function (effect,
|
|
26
|
-
|
|
25
|
+
trigger: function (effect, _a) {
|
|
26
|
+
var cardLocation = _a.cardLocation, game = _a.game;
|
|
27
|
+
return effect.type === Effect_1.TriggerEventType.EntitiesMoved && (0, rules_api_1.areNeighbors)(effect.player, cardLocation.player, game.players);
|
|
27
28
|
},
|
|
28
29
|
rule: (function (_super) {
|
|
29
30
|
__extends(SunWukongEffectRule, _super);
|
|
@@ -22,8 +22,9 @@ var Effect_1 = require("../Effect");
|
|
|
22
22
|
exports.Isis = {
|
|
23
23
|
invoke: [{ gem: 2 }, { gem: 2, favor: 1 }, {}],
|
|
24
24
|
effect: {
|
|
25
|
-
trigger: function (event,
|
|
26
|
-
|
|
25
|
+
trigger: function (event, _a) {
|
|
26
|
+
var cardLocation = _a.cardLocation, game = _a.game;
|
|
27
|
+
return event.type === Effect_1.TriggerEventType.EntityCrushed && (0, rules_api_1.areNeighbors)(cardLocation.player, event.card.location.player, game.players);
|
|
27
28
|
},
|
|
28
29
|
rule: (function (_super) {
|
|
29
30
|
__extends(IsisEffectRule, _super);
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Cyclops = void 0;
|
|
4
|
-
var Memory_1 = require("../../../Memory");
|
|
5
|
-
var MythologiesRules_1 = require("../../../MythologiesRules");
|
|
6
4
|
var CyclopsEffectRule_1 = require("../../../rules/effects/CyclopsEffectRule");
|
|
7
5
|
var Effect_1 = require("../Effect");
|
|
8
6
|
exports.Cyclops = {
|
|
9
7
|
invoke: [{ favor: 1 }, { gem: 1 }, {}],
|
|
10
8
|
effect: {
|
|
11
|
-
trigger: function (event,
|
|
12
|
-
var _a;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if ((_a = new MythologiesRules_1.MythologiesRules(game).remind(Memory_1.Memory.OncePerTurn)) === null || _a === void 0 ? void 0 : _a.includes(card.getIndex()))
|
|
19
|
-
return false;
|
|
20
|
-
return event.type === Effect_1.TriggerEventType.LineEvent ? event.y === y : event.x === x;
|
|
9
|
+
trigger: function (event, _a) {
|
|
10
|
+
var cardLocation = _a.cardLocation, game = _a.game;
|
|
11
|
+
var x = cardLocation.x, y = cardLocation.y, player = cardLocation.player;
|
|
12
|
+
return (((event.type === Effect_1.TriggerEventType.ColumnEvent && event.x === x) || (event.type === Effect_1.TriggerEventType.LineEvent && event.y === y)) &&
|
|
13
|
+
event.eventType === Effect_1.LineEventType.BonusGain &&
|
|
14
|
+
event.player === player &&
|
|
15
|
+
new CyclopsEffectRule_1.CyclopsEffectRule(game).getBonus(event).length > 0);
|
|
21
16
|
},
|
|
22
17
|
rule: CyclopsEffectRule_1.CyclopsEffectRule
|
|
23
18
|
}
|
|
@@ -24,8 +24,9 @@ var Effect_1 = require("../Effect");
|
|
|
24
24
|
exports.Poseidon = {
|
|
25
25
|
invoke: [{}, { gem: 2 }, { favor: 1 }],
|
|
26
26
|
effect: {
|
|
27
|
-
trigger: function (event,
|
|
28
|
-
|
|
27
|
+
trigger: function (event, _a) {
|
|
28
|
+
var cardLocation = _a.cardLocation;
|
|
29
|
+
return event.type === Effect_1.TriggerEventType.EntityPlaced && event.invoked && (0, Entity_1.isGod)(event.entity) && event.location.player === cardLocation.player;
|
|
29
30
|
},
|
|
30
31
|
rule: (function (_super) {
|
|
31
32
|
__extends(PoseidonEffectRule, _super);
|
|
@@ -21,7 +21,10 @@ var Effect_1 = require("../Effect");
|
|
|
21
21
|
exports.Puma = {
|
|
22
22
|
invoke: [{}, { favor: 1 }, {}],
|
|
23
23
|
effect: {
|
|
24
|
-
trigger: function (event,
|
|
24
|
+
trigger: function (event, _a) {
|
|
25
|
+
var cardLocation = _a.cardLocation;
|
|
26
|
+
return event.type === Effect_1.TriggerEventType.EntityCrushed && cardLocation.player === event.card.location.player;
|
|
27
|
+
},
|
|
25
28
|
rule: (function (_super) {
|
|
26
29
|
__extends(PumaEffectRule, _super);
|
|
27
30
|
function PumaEffectRule() {
|