@gamepark/mythologies 0.8.3 → 0.8.4
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 -4
- package/dist/MythologiesRules.js +6 -62
- package/dist/MythologiesSetup.js +1 -1
- package/dist/material/Pantheon.d.ts +1 -1
- package/dist/material/Pantheon.js +9 -7
- package/dist/material/Trial.js +0 -1
- package/dist/material/entity/AutoEffectRule.d.ts +11 -0
- package/dist/material/entity/AutoEffectRule.js +49 -0
- package/dist/material/entity/Effect.d.ts +3 -31
- package/dist/material/entity/Effect.js +1 -170
- package/dist/material/entity/MoveEffectRule.d.ts +4 -5
- package/dist/material/entity/MoveEffectRule.js +9 -16
- package/dist/material/entity/PlaceCardEffectRule.d.ts +1 -1
- package/dist/material/entity/PlaceCardEffectRule.js +2 -2
- package/dist/material/entity/PlayerEffectRule.d.ts +14 -0
- package/dist/material/entity/PlayerEffectRule.js +63 -0
- package/dist/material/entity/SacrificeEffectRule.d.ts +1 -1
- package/dist/material/entity/SacrificeEffectRule.js +2 -4
- package/dist/material/entity/SimultaneousEffectRule.d.ts +18 -0
- package/dist/material/entity/SimultaneousEffectRule.js +149 -0
- package/dist/material/entity/SimultaneousMoveEffectRule.d.ts +1 -2
- package/dist/material/entity/SimultaneousMoveEffectRule.js +3 -11
- package/dist/material/entity/SimultaneousSacrificeEffectRule.d.ts +1 -1
- package/dist/material/entity/SimultaneousSacrificeEffectRule.js +2 -4
- package/dist/material/entity/celtic/Banshee.js +2 -1
- package/dist/material/entity/celtic/Brigid.js +2 -1
- package/dist/material/entity/celtic/Cernunnos.js +2 -1
- package/dist/material/entity/celtic/Dagda.js +2 -1
- package/dist/material/entity/celtic/Kelpie.js +2 -1
- package/dist/material/entity/chinese/Mogwai.js +2 -1
- package/dist/material/entity/chinese/Nian.js +2 -1
- package/dist/material/entity/chinese/SunWukong.js +2 -1
- package/dist/material/entity/egyptian/Beetle.js +2 -1
- package/dist/material/entity/egyptian/Isis.js +2 -1
- package/dist/material/entity/egyptian/Mummy.js +2 -1
- package/dist/material/entity/egyptian/Osiris.js +2 -1
- package/dist/material/entity/greek/Poseidon.js +2 -1
- package/dist/material/entity/greek/Zeus.js +2 -1
- package/dist/material/entity/hindu/Asura.js +2 -1
- package/dist/material/entity/hindu/Brahma.js +2 -1
- package/dist/material/entity/hindu/Ganesh.js +2 -1
- package/dist/material/entity/hindu/Naga.js +2 -1
- package/dist/material/entity/hindu/Vishnu.js +2 -1
- package/dist/material/entity/inca/Amaru.js +2 -1
- package/dist/material/entity/inca/Inti.js +2 -1
- package/dist/material/entity/inca/MamaQucha.js +2 -1
- package/dist/material/entity/inca/Puma.js +2 -1
- package/dist/material/entity/norse/Freya.js +2 -1
- package/dist/material/entity/norse/Jotunn.js +2 -1
- package/dist/material/entity/norse/Loki.js +2 -1
- package/dist/material/entity/norse/Valkyrie.js +2 -1
- package/dist/material/entity/zulu/Inkanyamba.js +2 -1
- package/dist/material/entity/zulu/Shembe.js +2 -1
- package/dist/material/entity/zulu/Tokoloshe.js +2 -1
- package/dist/material/entity/zulu/Umvelinqangi.js +3 -2
- package/dist/material/entity/zulu/Unkulunkulu.js +2 -1
- package/dist/material/entity/zulu/Unwabu.js +2 -1
- package/dist/rules/effects/AthenaEffectRule.d.ts +5 -3
- package/dist/rules/effects/AthenaEffectRule.js +55 -20
- package/dist/rules/effects/CentaurEffectRule.d.ts +2 -5
- package/dist/rules/effects/CentaurEffectRule.js +1 -23
- package/dist/rules/effects/CyclopsEffectRule.d.ts +2 -1
- package/dist/rules/effects/CyclopsEffectRule.js +2 -1
- package/dist/rules/effects/DullahanEffectRule.js +1 -1
- package/dist/rules/effects/FenrirEffectRule.d.ts +2 -1
- package/dist/rules/effects/FenrirEffectRule.js +4 -3
- package/dist/rules/effects/IllapaEffectRule.d.ts +1 -1
- package/dist/rules/effects/IllapaEffectRule.js +3 -3
- package/dist/rules/effects/JiangshiEffectRule.d.ts +1 -1
- package/dist/rules/effects/JiangshiEffectRule.js +2 -6
- package/dist/rules/effects/KinnaraEffectRule.d.ts +1 -1
- package/dist/rules/effects/KinnaraEffectRule.js +2 -2
- package/dist/rules/effects/LeprechaunEffectRule.d.ts +1 -1
- package/dist/rules/effects/LeprechaunEffectRule.js +2 -2
- package/dist/rules/effects/MinotaurEffectRule.js +0 -1
- package/dist/rules/effects/MultipleSimultaneousMoveEffectRule.js +1 -36
- package/dist/rules/effects/QilinEffectRule.d.ts +1 -1
- package/dist/rules/effects/QilinEffectRule.js +3 -2
- package/dist/rules/effects/ResolveEffectsRule.d.ts +6 -3
- package/dist/rules/effects/ResolveEffectsRule.js +63 -0
- package/dist/rules/effects/SelkieEffectRule.d.ts +1 -1
- package/dist/rules/effects/SelkieEffectRule.js +2 -2
- package/dist/rules/effects/ShivaEffectRule.d.ts +1 -1
- package/dist/rules/effects/ShivaEffectRule.js +2 -6
- package/dist/rules/effects/SphinxEffectRule.d.ts +1 -1
- package/dist/rules/effects/SphinxEffectRule.js +3 -32
- package/dist/rules/effects/SupayEffectRule.d.ts +1 -1
- package/dist/rules/effects/SupayEffectRule.js +2 -2
- package/dist/rules/effects/TianlongEffectRule.js +1 -9
- package/dist/rules/effects/UkukuEffectRule.d.ts +1 -1
- package/dist/rules/effects/UkukuEffectRule.js +2 -2
- package/dist/rules/effects/VetalaEffectRule.d.ts +2 -2
- package/dist/rules/effects/VetalaEffectRule.js +1 -3
- package/dist/rules/effects/WerehyenaEffectRule.d.ts +1 -1
- package/dist/rules/effects/WerehyenaEffectRule.js +2 -2
- package/dist/rules/effects/YanluoWangEffectRule.d.ts +1 -1
- package/dist/rules/effects/YanluoWangEffectRule.js +2 -2
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CompetitiveScore,
|
|
1
|
+
import { CompetitiveScore, FillGapStrategy, ItemMove, MaterialGame, MaterialItem, MaterialMove, MoveItem, PositiveSequenceStrategy, SecretMaterialRules, StackingStrategy, TimeLimit } from '@gamepark/rules-api';
|
|
2
2
|
import { LocationType } from './material/LocationType';
|
|
3
3
|
import { MaterialType } from './material/MaterialType';
|
|
4
4
|
import { PlayerColor } from './PlayerColor';
|
|
@@ -52,6 +52,7 @@ import { YanluoWangEffectRule } from './rules/effects/YanluoWangEffectRule';
|
|
|
52
52
|
import { EndGameRule } from './rules/EndGameRule';
|
|
53
53
|
import { PlaceCardsRule } from './rules/PlaceCardsRule';
|
|
54
54
|
import { PlaceTokenRule } from './rules/PlaceTokenRule';
|
|
55
|
+
import { RuleId } from './rules/RuleId';
|
|
55
56
|
import { UpkeepRule } from './rules/UpkeepRule';
|
|
56
57
|
export declare class MythologiesRules extends SecretMaterialRules<PlayerColor, MaterialType, LocationType> implements TimeLimit<MaterialGame<PlayerColor, MaterialType, LocationType>, MaterialMove<PlayerColor, MaterialType, LocationType>, PlayerColor>, CompetitiveScore {
|
|
57
58
|
rules: {
|
|
@@ -148,9 +149,7 @@ export declare class MythologiesRules extends SecretMaterialRules<PlayerColor, M
|
|
|
148
149
|
keepMoveSecret(move: MaterialMove): boolean;
|
|
149
150
|
isPlayerDestiny(move: MoveItem): boolean;
|
|
150
151
|
beforeItemMove(move: ItemMove): MaterialMove<PlayerColor, MaterialType, LocationType, number>[];
|
|
151
|
-
|
|
152
|
-
getAutomaticMoves(): MaterialMove<number, number, number, number>[];
|
|
153
|
-
startEffectsResolution(): MaterialMove<number, number, number, number>[];
|
|
152
|
+
getAutomaticMoves(): import("@gamepark/rules-api").StartPlayerTurn<number, RuleId.ResolveEffects>[] | import("@gamepark/rules-api").StartRule<RuleId.ResolveEffects>[];
|
|
154
153
|
giveTime(): number;
|
|
155
154
|
getScore(player: PlayerColor): number;
|
|
156
155
|
getTieBreaker(tieBreaker: number, player: PlayerColor): number | undefined;
|
package/dist/MythologiesRules.js
CHANGED
|
@@ -14,35 +14,9 @@ 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
|
-
};
|
|
42
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
18
|
exports.MythologiesRules = void 0;
|
|
44
19
|
var rules_api_1 = require("@gamepark/rules-api");
|
|
45
|
-
var CustomMoveType_1 = require("./CustomMoveType");
|
|
46
20
|
var Destiny_1 = require("./material/Destiny");
|
|
47
21
|
var Entity_1 = require("./material/Entity");
|
|
48
22
|
var Effect_1 = require("./material/entity/Effect");
|
|
@@ -230,51 +204,21 @@ var MythologiesRules = (function (_super) {
|
|
|
230
204
|
new TriggerEffectsRule_1.TriggerEffectsRule(this.game).triggerEffects({ type: Effect_1.TriggerEventType.ColumnEvent, eventType: Effect_1.LineEventType.BonusGain, player: player, x: favor.x });
|
|
231
205
|
}
|
|
232
206
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if (move.type === CustomMoveType_1.CustomMoveType.EndEffect) {
|
|
238
|
-
this.forget(Memory_1.Memory.OngoingEffect);
|
|
239
|
-
if (this.remind(Memory_1.Memory.PendingEffects).length) {
|
|
240
|
-
moves.push.apply(moves, __spreadArray([], __read(this.startEffectsResolution()), false));
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
var pendingRule = this.remind(Memory_1.Memory.PendingRule);
|
|
244
|
-
if (pendingRule) {
|
|
245
|
-
this.forget(Memory_1.Memory.PendingRule);
|
|
246
|
-
if (pendingRule.id === RuleId_1.RuleId.EndGame) {
|
|
247
|
-
moves.push.apply(moves, __spreadArray(__spreadArray([], __read(new EndGameRule_1.EndGameRule(this.game).convertGems()), false), [this.endGame()], false));
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
moves.push(this.startPlayerTurn(RuleId_1.RuleId.PlaceCards, pendingRule.player));
|
|
251
|
-
}
|
|
252
|
-
}
|
|
207
|
+
if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.EntityCard)(move) && move.location.type === LocationType_1.LocationType.PlayerDiscard) {
|
|
208
|
+
var card = this.material(MaterialType_1.MaterialType.EntityCard).getItem(move.itemIndex);
|
|
209
|
+
if (card.location.type === LocationType_1.LocationType.Pantheon) {
|
|
210
|
+
new Pantheon_1.Pantheon(this.game, card.location.player).onEntitySacrificed(move.itemIndex);
|
|
253
211
|
}
|
|
254
212
|
}
|
|
255
|
-
return
|
|
213
|
+
return _super.prototype.beforeItemMove.call(this, move);
|
|
256
214
|
};
|
|
257
215
|
MythologiesRules.prototype.getAutomaticMoves = function () {
|
|
258
216
|
var _a;
|
|
259
217
|
if (!this.remind(Memory_1.Memory.OngoingEffect) && ((_a = this.game.rule) === null || _a === void 0 ? void 0 : _a.id) !== RuleId_1.RuleId.ResolveEffects && this.remind(Memory_1.Memory.PendingEffects).length) {
|
|
260
|
-
return this.startEffectsResolution();
|
|
218
|
+
return new ResolveEffectsRule_1.ResolveEffectsRule(this.game).startEffectsResolution();
|
|
261
219
|
}
|
|
262
220
|
return [];
|
|
263
221
|
};
|
|
264
|
-
MythologiesRules.prototype.startEffectsResolution = function () {
|
|
265
|
-
var pendingEffects = this.remind(Memory_1.Memory.PendingEffects)[0];
|
|
266
|
-
var autoEffectIndex = pendingEffects.findIndex(function (effect) { return effect.auto; });
|
|
267
|
-
if (autoEffectIndex !== -1) {
|
|
268
|
-
var autoEffect = pendingEffects.splice(autoEffectIndex, 1)[0];
|
|
269
|
-
if (pendingEffects.length === 0) {
|
|
270
|
-
this.remind(Memory_1.Memory.PendingEffects).shift();
|
|
271
|
-
}
|
|
272
|
-
return new ResolveEffectsRule_1.ResolveEffectsRule(this.game).playEffect(autoEffect);
|
|
273
|
-
}
|
|
274
|
-
var cardIndex = pendingEffects[0].cardIndex;
|
|
275
|
-
var player = this.material(MaterialType_1.MaterialType.EntityCard).getItem(cardIndex).location.player;
|
|
276
|
-
return [this.startPlayerTurn(RuleId_1.RuleId.ResolveEffects, player)];
|
|
277
|
-
};
|
|
278
222
|
MythologiesRules.prototype.giveTime = function () {
|
|
279
223
|
return 60;
|
|
280
224
|
};
|
package/dist/MythologiesSetup.js
CHANGED
|
@@ -66,7 +66,7 @@ var MythologiesSetup = (function (_super) {
|
|
|
66
66
|
};
|
|
67
67
|
MythologiesSetup.prototype.setupMythologies = function (mythologies) {
|
|
68
68
|
var e_1, _a;
|
|
69
|
-
this.material(MaterialType_1.MaterialType.MythologyBoard).createItems(mythologies.map(function (mythology, index) { return ({
|
|
69
|
+
this.material(MaterialType_1.MaterialType.MythologyBoard).createItems((0, lodash_1.shuffle)(mythologies).map(function (mythology, index) { return ({
|
|
70
70
|
id: { mythology: mythology, side: index % 2 },
|
|
71
71
|
location: {
|
|
72
72
|
type: LocationType_1.LocationType.Sanctuary,
|
|
@@ -43,7 +43,7 @@ export declare class Pantheon extends MaterialRulesPart {
|
|
|
43
43
|
isVisible(entity: EntityItem): boolean;
|
|
44
44
|
get mythologies(): import("./Mythology").Mythology[];
|
|
45
45
|
get missingMythologies(): import("./Mythology").Mythology[];
|
|
46
|
-
onEntitySacrificed(
|
|
46
|
+
onEntitySacrificed(cardIndex: number): void;
|
|
47
47
|
hasCrushed(card: MaterialItem): boolean;
|
|
48
48
|
isOpponentOngoingEffect(): boolean;
|
|
49
49
|
replaceSacrifice(cards: EntityItem[]): Material<number, number, number>;
|
|
@@ -450,14 +450,16 @@ var Pantheon = (function (_super) {
|
|
|
450
450
|
enumerable: false,
|
|
451
451
|
configurable: true
|
|
452
452
|
});
|
|
453
|
-
Pantheon.prototype.onEntitySacrificed = function (
|
|
454
|
-
var
|
|
455
|
-
var _a =
|
|
453
|
+
Pantheon.prototype.onEntitySacrificed = function (cardIndex) {
|
|
454
|
+
var card = this.material(MaterialType_1.MaterialType.EntityCard).getItem(cardIndex);
|
|
455
|
+
var _a = card.location, x = _a.x, y = _a.y, z = _a.z;
|
|
456
456
|
var grid = this.indexGrid;
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
457
|
+
if (grid[y][x] === cardIndex) {
|
|
458
|
+
var cardUnder = this.allCards.location(function (l) { return l.x === x && l.y === y && l.z !== z; }).maxBy(function (item) { return item.location.z; });
|
|
459
|
+
grid[y][x] = cardUnder.length ? cardUnder.getIndex() : null;
|
|
460
|
+
this.memorize(Memory_1.Memory.PlayerGrid, grid, this.player);
|
|
461
|
+
new TriggerEffectsRule_1.TriggerEffectsRule(this.game).triggerEffects({ type: Effect_1.TriggerEventType.EntitySacrificed, card: card, cardIndex: cardIndex });
|
|
462
|
+
}
|
|
461
463
|
};
|
|
462
464
|
Pantheon.prototype.hasCrushed = function (card) {
|
|
463
465
|
return this.allCards.location(function (l) { return l.x === card.location.x && l.y === card.location.y && l.z < card.location.z; }).length > 0;
|
package/dist/material/Trial.js
CHANGED
|
@@ -172,7 +172,6 @@ var Trial = (function (_super) {
|
|
|
172
172
|
Trial.prototype.getTrialRightReward = function (mythology) {
|
|
173
173
|
switch (mythology) {
|
|
174
174
|
case Mythology_1.Mythology.Chinese:
|
|
175
|
-
case Mythology_1.Mythology.Zulu:
|
|
176
175
|
case Mythology_1.Mythology.Celtic:
|
|
177
176
|
return 1;
|
|
178
177
|
default:
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MaterialMove, MaterialRulesPart } from '@gamepark/rules-api';
|
|
2
|
+
import { PlayerColor } from '../../PlayerColor';
|
|
3
|
+
import { EntityId } from '../Entity';
|
|
4
|
+
import { EffectRule, PendingEffect, TriggerEvent } from './Effect';
|
|
5
|
+
export declare abstract class AutoEffectRule extends MaterialRulesPart implements EffectRule {
|
|
6
|
+
canPlayEffect: () => boolean;
|
|
7
|
+
abstract playEffect(): MaterialMove[];
|
|
8
|
+
getEffect<Event extends TriggerEvent>(): PendingEffect<Event>;
|
|
9
|
+
get card(): import("@gamepark/rules-api").MaterialItem<number, number, EntityId>;
|
|
10
|
+
get player(): PlayerColor;
|
|
11
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.AutoEffectRule = void 0;
|
|
19
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
20
|
+
var Memory_1 = require("../../Memory");
|
|
21
|
+
var MaterialType_1 = require("../MaterialType");
|
|
22
|
+
var AutoEffectRule = (function (_super) {
|
|
23
|
+
__extends(AutoEffectRule, _super);
|
|
24
|
+
function AutoEffectRule() {
|
|
25
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
+
_this.canPlayEffect = function () { return true; };
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
AutoEffectRule.prototype.getEffect = function () {
|
|
30
|
+
return this.remind(Memory_1.Memory.OngoingEffect);
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(AutoEffectRule.prototype, "card", {
|
|
33
|
+
get: function () {
|
|
34
|
+
var index = this.getEffect().cardIndex;
|
|
35
|
+
return this.material(MaterialType_1.MaterialType.EntityCard).getItem(index);
|
|
36
|
+
},
|
|
37
|
+
enumerable: false,
|
|
38
|
+
configurable: true
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(AutoEffectRule.prototype, "player", {
|
|
41
|
+
get: function () {
|
|
42
|
+
return this.card.location.player;
|
|
43
|
+
},
|
|
44
|
+
enumerable: false,
|
|
45
|
+
configurable: true
|
|
46
|
+
});
|
|
47
|
+
return AutoEffectRule;
|
|
48
|
+
}(rules_api_1.MaterialRulesPart));
|
|
49
|
+
exports.AutoEffectRule = AutoEffectRule;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Location, MaterialGame, MaterialMove,
|
|
1
|
+
import { Location, MaterialGame, MaterialMove, XYCoordinates } from '@gamepark/rules-api';
|
|
2
2
|
import { PlayerColor } from '../../PlayerColor';
|
|
3
|
-
import {
|
|
4
|
-
import { Entity, EntityId, EntityItem } from '../Entity';
|
|
3
|
+
import { Entity, EntityItem } from '../Entity';
|
|
5
4
|
export type TriggerEventContext = {
|
|
6
5
|
cardIndex: number;
|
|
7
6
|
cardLocation: Location;
|
|
@@ -23,36 +22,10 @@ export type PermanentEffect = {
|
|
|
23
22
|
sacrificeInsteadOfMove?: boolean;
|
|
24
23
|
};
|
|
25
24
|
export type Effect = TriggeredEffect | PermanentEffect;
|
|
26
|
-
interface EffectRule {
|
|
25
|
+
export interface EffectRule {
|
|
27
26
|
canPlayEffect(cardIndex: number): boolean;
|
|
28
27
|
playEffect(): MaterialMove[];
|
|
29
28
|
}
|
|
30
|
-
export declare abstract class PlayerEffectRule extends PlayerTurnRule implements EffectRule {
|
|
31
|
-
canPlayEffect(_cardIndex: number): boolean;
|
|
32
|
-
ruleId?: RuleId;
|
|
33
|
-
playEffect(): MaterialMove[];
|
|
34
|
-
onRuleStart(): MaterialMove[];
|
|
35
|
-
get card(): import("@gamepark/rules-api").MaterialItem<number, number, EntityId>;
|
|
36
|
-
getEffect<Event extends TriggerEvent>(): PendingEffect<Event>;
|
|
37
|
-
}
|
|
38
|
-
export declare abstract class SimultaneousEffectRule extends SimultaneousRule implements EffectRule {
|
|
39
|
-
canPlayEffect(_cardIndex: number): boolean;
|
|
40
|
-
ruleId?: RuleId;
|
|
41
|
-
playEffect(): MaterialMove[];
|
|
42
|
-
onRuleStart(): MaterialMove<number, number, number, number>[];
|
|
43
|
-
getAffectedPlayers(): PlayerColor[];
|
|
44
|
-
isOpponent(player: PlayerColor): boolean;
|
|
45
|
-
get card(): import("@gamepark/rules-api").MaterialItem<number, number, EntityId>;
|
|
46
|
-
getEffect<Event extends TriggerEvent>(): PendingEffect<Event>;
|
|
47
|
-
getMovesAfterPlayersDone(): MaterialMove[];
|
|
48
|
-
}
|
|
49
|
-
export declare abstract class AutoEffectRule extends MaterialRulesPart implements EffectRule {
|
|
50
|
-
canPlayEffect: () => boolean;
|
|
51
|
-
abstract playEffect(): MaterialMove[];
|
|
52
|
-
getEffect<Event extends TriggerEvent>(): PendingEffect<Event>;
|
|
53
|
-
get card(): import("@gamepark/rules-api").MaterialItem<number, number, EntityId>;
|
|
54
|
-
get player(): PlayerColor;
|
|
55
|
-
}
|
|
56
29
|
export declare enum TriggerEventType {
|
|
57
30
|
EndOfGame = 1,
|
|
58
31
|
SelfPlaced = 2,
|
|
@@ -129,4 +102,3 @@ export type PendingEffect<Event extends TriggerEvent = TriggerEvent> = {
|
|
|
129
102
|
triggerEvent: Event;
|
|
130
103
|
auto: boolean;
|
|
131
104
|
};
|
|
132
|
-
export {};
|
|
@@ -1,177 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
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
|
-
};
|
|
28
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.isEndOfMyTurn = exports.isSacrificed = exports.isCrushed = exports.oncePerTurn = exports.LineEventType = exports.isPlaced = exports.isEndOfGame = exports.TriggerEventType = exports.
|
|
30
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
31
|
-
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
32
|
-
var Memory_1 = require("../../Memory");
|
|
33
|
-
var MaterialType_1 = require("../MaterialType");
|
|
3
|
+
exports.isEndOfMyTurn = exports.isSacrificed = exports.isCrushed = exports.oncePerTurn = exports.LineEventType = exports.isPlaced = exports.isEndOfGame = exports.TriggerEventType = exports.isTriggeredEffect = void 0;
|
|
34
4
|
var isTriggeredEffect = function (effect) { return typeof effect.trigger === 'function'; };
|
|
35
5
|
exports.isTriggeredEffect = isTriggeredEffect;
|
|
36
|
-
var PlayerEffectRule = (function (_super) {
|
|
37
|
-
__extends(PlayerEffectRule, _super);
|
|
38
|
-
function PlayerEffectRule() {
|
|
39
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
40
|
-
}
|
|
41
|
-
PlayerEffectRule.prototype.canPlayEffect = function (_cardIndex) {
|
|
42
|
-
return true;
|
|
43
|
-
};
|
|
44
|
-
PlayerEffectRule.prototype.playEffect = function () {
|
|
45
|
-
return this.ruleId ? [this.startRule(this.ruleId)] : [];
|
|
46
|
-
};
|
|
47
|
-
PlayerEffectRule.prototype.onRuleStart = function () {
|
|
48
|
-
if (!this.getPlayerMoves().length) {
|
|
49
|
-
return [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
50
|
-
}
|
|
51
|
-
return [];
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(PlayerEffectRule.prototype, "card", {
|
|
54
|
-
get: function () {
|
|
55
|
-
var index = this.getEffect().cardIndex;
|
|
56
|
-
return this.material(MaterialType_1.MaterialType.EntityCard).getItem(index);
|
|
57
|
-
},
|
|
58
|
-
enumerable: false,
|
|
59
|
-
configurable: true
|
|
60
|
-
});
|
|
61
|
-
PlayerEffectRule.prototype.getEffect = function () {
|
|
62
|
-
return this.remind(Memory_1.Memory.OngoingEffect);
|
|
63
|
-
};
|
|
64
|
-
return PlayerEffectRule;
|
|
65
|
-
}(rules_api_1.PlayerTurnRule));
|
|
66
|
-
exports.PlayerEffectRule = PlayerEffectRule;
|
|
67
|
-
var SimultaneousEffectRule = (function (_super) {
|
|
68
|
-
__extends(SimultaneousEffectRule, _super);
|
|
69
|
-
function SimultaneousEffectRule() {
|
|
70
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
71
|
-
}
|
|
72
|
-
SimultaneousEffectRule.prototype.canPlayEffect = function (_cardIndex) {
|
|
73
|
-
return true;
|
|
74
|
-
};
|
|
75
|
-
SimultaneousEffectRule.prototype.playEffect = function () {
|
|
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 && !(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.EntityCard)(legalMoves[0])) {
|
|
84
|
-
moves.push(legalMoves[0]);
|
|
85
|
-
}
|
|
86
|
-
else if (legalMoves.length > 0) {
|
|
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;
|
|
102
|
-
};
|
|
103
|
-
SimultaneousEffectRule.prototype.onRuleStart = function () {
|
|
104
|
-
var e_2, _a;
|
|
105
|
-
var moves = [];
|
|
106
|
-
try {
|
|
107
|
-
for (var _b = __values(this.game.rule.players), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
108
|
-
var player = _c.value;
|
|
109
|
-
var legalMoves = this.getActivePlayerLegalMoves(player);
|
|
110
|
-
if (legalMoves.length === 1) {
|
|
111
|
-
moves.push(legalMoves[0]);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
116
|
-
finally {
|
|
117
|
-
try {
|
|
118
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
119
|
-
}
|
|
120
|
-
finally { if (e_2) throw e_2.error; }
|
|
121
|
-
}
|
|
122
|
-
return moves;
|
|
123
|
-
};
|
|
124
|
-
SimultaneousEffectRule.prototype.getAffectedPlayers = function () {
|
|
125
|
-
return this.game.players;
|
|
126
|
-
};
|
|
127
|
-
SimultaneousEffectRule.prototype.isOpponent = function (player) {
|
|
128
|
-
return player !== this.card.location.player;
|
|
129
|
-
};
|
|
130
|
-
Object.defineProperty(SimultaneousEffectRule.prototype, "card", {
|
|
131
|
-
get: function () {
|
|
132
|
-
var index = this.getEffect().cardIndex;
|
|
133
|
-
return this.material(MaterialType_1.MaterialType.EntityCard).getItem(index);
|
|
134
|
-
},
|
|
135
|
-
enumerable: false,
|
|
136
|
-
configurable: true
|
|
137
|
-
});
|
|
138
|
-
SimultaneousEffectRule.prototype.getEffect = function () {
|
|
139
|
-
return this.remind(Memory_1.Memory.OngoingEffect);
|
|
140
|
-
};
|
|
141
|
-
SimultaneousEffectRule.prototype.getMovesAfterPlayersDone = function () {
|
|
142
|
-
return [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
143
|
-
};
|
|
144
|
-
return SimultaneousEffectRule;
|
|
145
|
-
}(rules_api_1.SimultaneousRule));
|
|
146
|
-
exports.SimultaneousEffectRule = SimultaneousEffectRule;
|
|
147
|
-
var AutoEffectRule = (function (_super) {
|
|
148
|
-
__extends(AutoEffectRule, _super);
|
|
149
|
-
function AutoEffectRule() {
|
|
150
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
151
|
-
_this.canPlayEffect = function () { return true; };
|
|
152
|
-
return _this;
|
|
153
|
-
}
|
|
154
|
-
AutoEffectRule.prototype.getEffect = function () {
|
|
155
|
-
return this.remind(Memory_1.Memory.OngoingEffect);
|
|
156
|
-
};
|
|
157
|
-
Object.defineProperty(AutoEffectRule.prototype, "card", {
|
|
158
|
-
get: function () {
|
|
159
|
-
var index = this.getEffect().cardIndex;
|
|
160
|
-
return this.material(MaterialType_1.MaterialType.EntityCard).getItem(index);
|
|
161
|
-
},
|
|
162
|
-
enumerable: false,
|
|
163
|
-
configurable: true
|
|
164
|
-
});
|
|
165
|
-
Object.defineProperty(AutoEffectRule.prototype, "player", {
|
|
166
|
-
get: function () {
|
|
167
|
-
return this.card.location.player;
|
|
168
|
-
},
|
|
169
|
-
enumerable: false,
|
|
170
|
-
configurable: true
|
|
171
|
-
});
|
|
172
|
-
return AutoEffectRule;
|
|
173
|
-
}(rules_api_1.MaterialRulesPart));
|
|
174
|
-
exports.AutoEffectRule = AutoEffectRule;
|
|
175
6
|
var TriggerEventType;
|
|
176
7
|
(function (TriggerEventType) {
|
|
177
8
|
TriggerEventType[TriggerEventType["EndOfGame"] = 1] = "EndOfGame";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PlayerEffectRule } from './
|
|
1
|
+
import { ItemMove, Location, Material, MaterialItem, MaterialMove, MoveItem, XYCoordinates } from '@gamepark/rules-api';
|
|
2
|
+
import { PlayerEffectRule } from './PlayerEffectRule';
|
|
3
3
|
export declare abstract class MoveEffectRule extends PlayerEffectRule {
|
|
4
4
|
canPlayEffect(cardIndex: number): boolean;
|
|
5
5
|
playEffect(): MaterialMove[];
|
|
@@ -13,7 +13,6 @@ export declare abstract class MoveEffectRule extends PlayerEffectRule {
|
|
|
13
13
|
beforeItemMove(move: ItemMove): MaterialMove<number, number, number, number>[];
|
|
14
14
|
onCardMoved(_move: MoveItem): MaterialMove[];
|
|
15
15
|
onCardSacrificed(move: MoveItem): MaterialMove[];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
onRuleEnd(): never[];
|
|
16
|
+
onEndEffect(): MaterialMove<number, number, number, number>[];
|
|
17
|
+
updateGridAfterMoves(): MaterialMove<number, number, number, number>[];
|
|
19
18
|
}
|
|
@@ -42,13 +42,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
43
|
exports.MoveEffectRule = void 0;
|
|
44
44
|
var rules_api_1 = require("@gamepark/rules-api");
|
|
45
|
+
var lodash_1 = require("lodash");
|
|
45
46
|
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
46
|
-
var Memory_1 = require("../../Memory");
|
|
47
47
|
var TriggerEffectsRule_1 = require("../../rules/effects/TriggerEffectsRule");
|
|
48
48
|
var LocationType_1 = require("../LocationType");
|
|
49
49
|
var MaterialType_1 = require("../MaterialType");
|
|
50
50
|
var Pantheon_1 = require("../Pantheon");
|
|
51
|
-
var
|
|
51
|
+
var PlayerEffectRule_1 = require("./PlayerEffectRule");
|
|
52
52
|
var MoveEffectRule = (function (_super) {
|
|
53
53
|
__extends(MoveEffectRule, _super);
|
|
54
54
|
function MoveEffectRule() {
|
|
@@ -66,7 +66,7 @@ var MoveEffectRule = (function (_super) {
|
|
|
66
66
|
return this.getMoveCardsMoves().concat(this.getSacrificeToPreventMove());
|
|
67
67
|
};
|
|
68
68
|
MoveEffectRule.prototype.getSacrificeToPreventMove = function () {
|
|
69
|
-
return
|
|
69
|
+
return new Pantheon_1.Pantheon(this.game, this.player).sacrificeToPreventMove();
|
|
70
70
|
};
|
|
71
71
|
MoveEffectRule.prototype.getMoveCardsMoves = function (effectCardIndex) {
|
|
72
72
|
var _this = this;
|
|
@@ -98,7 +98,6 @@ var MoveEffectRule = (function (_super) {
|
|
|
98
98
|
MoveEffectRule.prototype.beforeItemMove = function (move) {
|
|
99
99
|
if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.EntityCard)(move)) {
|
|
100
100
|
if (move.location.type === LocationType_1.LocationType.Pantheon) {
|
|
101
|
-
this.memorize(Memory_1.Memory.EntityMoved, true, this.player);
|
|
102
101
|
return this.onCardMoved(move);
|
|
103
102
|
}
|
|
104
103
|
else if (move.location.type === LocationType_1.LocationType.PlayerDiscard) {
|
|
@@ -111,26 +110,20 @@ var MoveEffectRule = (function (_super) {
|
|
|
111
110
|
return [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
112
111
|
};
|
|
113
112
|
MoveEffectRule.prototype.onCardSacrificed = function (move) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
117
|
-
};
|
|
118
|
-
MoveEffectRule.prototype.onCustomMove = function (move) {
|
|
119
|
-
if (move.type === CustomMoveType_1.CustomMoveType.EndEffect) {
|
|
120
|
-
return this.onEndEffect();
|
|
113
|
+
if (this.getSacrificeToPreventMove().some(function (sacrificeMove) { return (0, lodash_1.isEqual)(move, sacrificeMove); })) {
|
|
114
|
+
return [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
121
115
|
}
|
|
122
116
|
return [];
|
|
123
117
|
};
|
|
124
118
|
MoveEffectRule.prototype.onEndEffect = function () {
|
|
119
|
+
return this.updateGridAfterMoves().concat(_super.prototype.onEndEffect.call(this));
|
|
120
|
+
};
|
|
121
|
+
MoveEffectRule.prototype.updateGridAfterMoves = function () {
|
|
125
122
|
var _a;
|
|
126
123
|
var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
|
|
127
124
|
(_a = new TriggerEffectsRule_1.TriggerEffectsRule(this.game)).triggerEffects.apply(_a, __spreadArray([], __read(pantheon.updateGrid()), false));
|
|
128
125
|
return pantheon.gainBonus();
|
|
129
126
|
};
|
|
130
|
-
MoveEffectRule.prototype.onRuleEnd = function () {
|
|
131
|
-
this.forget(Memory_1.Memory.EntityMoved);
|
|
132
|
-
return [];
|
|
133
|
-
};
|
|
134
127
|
return MoveEffectRule;
|
|
135
|
-
}(
|
|
128
|
+
}(PlayerEffectRule_1.PlayerEffectRule));
|
|
136
129
|
exports.MoveEffectRule = MoveEffectRule;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ItemMove, Material, MaterialMove, MoveItem, XYCoordinates } from '@gamepark/rules-api';
|
|
2
|
-
import { PlayerEffectRule } from './
|
|
2
|
+
import { PlayerEffectRule } from './PlayerEffectRule';
|
|
3
3
|
export declare abstract class PlaceCardEffectRule extends PlayerEffectRule {
|
|
4
4
|
canPlayEffect(cardIndex: number): boolean;
|
|
5
5
|
playEffect(): MaterialMove[];
|
|
@@ -22,7 +22,7 @@ var Entity_1 = require("../Entity");
|
|
|
22
22
|
var LocationType_1 = require("../LocationType");
|
|
23
23
|
var MaterialType_1 = require("../MaterialType");
|
|
24
24
|
var Pantheon_1 = require("../Pantheon");
|
|
25
|
-
var
|
|
25
|
+
var PlayerEffectRule_1 = require("./PlayerEffectRule");
|
|
26
26
|
var PlaceCardEffectRule = (function (_super) {
|
|
27
27
|
__extends(PlaceCardEffectRule, _super);
|
|
28
28
|
function PlaceCardEffectRule() {
|
|
@@ -61,7 +61,7 @@ var PlaceCardEffectRule = (function (_super) {
|
|
|
61
61
|
return moves;
|
|
62
62
|
};
|
|
63
63
|
return PlaceCardEffectRule;
|
|
64
|
-
}(
|
|
64
|
+
}(PlayerEffectRule_1.PlayerEffectRule));
|
|
65
65
|
exports.PlaceCardEffectRule = PlaceCardEffectRule;
|
|
66
66
|
var InvokeEffectRule = (function (_super) {
|
|
67
67
|
__extends(InvokeEffectRule, _super);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CustomMove, MaterialMove, PlayerTurnRule } from '@gamepark/rules-api';
|
|
2
|
+
import { RuleId } from '../../rules/RuleId';
|
|
3
|
+
import { EntityId } from '../Entity';
|
|
4
|
+
import { EffectRule, PendingEffect, TriggerEvent } from './Effect';
|
|
5
|
+
export declare abstract class PlayerEffectRule extends PlayerTurnRule implements EffectRule {
|
|
6
|
+
canPlayEffect(_cardIndex: number): boolean;
|
|
7
|
+
ruleId?: RuleId;
|
|
8
|
+
playEffect(): MaterialMove[];
|
|
9
|
+
onRuleStart(): MaterialMove[];
|
|
10
|
+
get card(): import("@gamepark/rules-api").MaterialItem<number, number, EntityId>;
|
|
11
|
+
getEffect<Event extends TriggerEvent>(): PendingEffect<Event>;
|
|
12
|
+
onCustomMove(move: CustomMove): MaterialMove<number, number, number, number>[];
|
|
13
|
+
onEndEffect(): MaterialMove<number, number, number, number>[];
|
|
14
|
+
}
|