@gamepark/mythologies 0.3.1 → 0.4.1
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/Memory.d.ts +3 -1
- package/dist/Memory.js +2 -0
- package/dist/MythologiesRules.d.ts +11 -0
- package/dist/MythologiesRules.js +11 -0
- package/dist/material/Destiny.d.ts +1 -0
- package/dist/material/Destiny.js +10 -6
- package/dist/material/Entity.d.ts +5 -1
- package/dist/material/Entity.js +1 -1
- package/dist/material/Mythology.js +1 -1
- package/dist/material/Pantheon.d.ts +11 -7
- package/dist/material/Pantheon.js +98 -54
- package/dist/material/entity/Effect.d.ts +29 -14
- package/dist/material/entity/Effect.js +7 -2
- package/dist/material/entity/EntityDescription.d.ts +2 -0
- package/dist/material/entity/EntityDescription.js +6 -3
- package/dist/material/entity/MoveEffectRule.js +29 -1
- package/dist/material/entity/SacrificeEffectRule.d.ts +1 -0
- package/dist/material/entity/SacrificeEffectRule.js +13 -36
- package/dist/material/entity/SimultaneousMoveEffectRule.js +9 -5
- package/dist/material/entity/SimultaneousSacrificeEffectRule.d.ts +1 -0
- package/dist/material/entity/SimultaneousSacrificeEffectRule.js +12 -35
- package/dist/material/entity/celtic/Banshee.js +33 -1
- package/dist/material/entity/celtic/Brigid.js +34 -1
- package/dist/material/entity/celtic/Cernunnos.js +37 -1
- package/dist/material/entity/celtic/Dagda.js +43 -1
- package/dist/material/entity/celtic/Fairy.d.ts +2 -0
- package/dist/material/entity/celtic/Fairy.js +12 -0
- package/dist/material/entity/celtic/Kelpie.js +33 -1
- package/dist/material/entity/celtic/Morrigan.js +6 -1
- package/dist/material/entity/chinese/SunWukong.js +1 -1
- package/dist/material/entity/egyptian/Beetle.js +19 -13
- package/dist/material/entity/hindu/Naga.js +36 -30
- package/dist/material/entity/hindu/Vishnu.js +2 -6
- package/dist/material/entity/norse/Troll.js +4 -1
- package/dist/material/entity/zulu/Idlozi.js +7 -1
- package/dist/material/entity/zulu/Impundulu.js +7 -1
- package/dist/material/entity/zulu/Inkanyamba.js +33 -1
- package/dist/material/entity/zulu/Inkosazana.js +7 -1
- package/dist/material/entity/zulu/Shembe.js +38 -1
- package/dist/material/entity/zulu/Tokoloshe.js +41 -1
- package/dist/material/entity/zulu/Umvelinqangi.js +39 -1
- package/dist/material/entity/zulu/Unkulunkulu.js +37 -1
- package/dist/material/entity/zulu/Unwabu.js +43 -1
- package/dist/material/entity/zulu/Werehyena.js +7 -1
- package/dist/rules/DrawDestinyCardRule.js +3 -4
- package/dist/rules/PlaceCardsRule.js +4 -2
- package/dist/rules/RuleId.d.ts +7 -1
- package/dist/rules/RuleId.js +6 -0
- package/dist/rules/effects/AthenaEffectRule.js +29 -1
- package/dist/rules/effects/CentaurEffectRule.js +29 -1
- package/dist/rules/effects/FairyEffectRule.d.ts +10 -0
- package/dist/rules/effects/FairyEffectRule.js +55 -0
- package/dist/rules/effects/IdloziEffectRule.d.ts +9 -0
- package/dist/rules/effects/IdloziEffectRule.js +43 -0
- package/dist/rules/effects/ImpunduluEffectRule.d.ts +7 -0
- package/dist/rules/effects/ImpunduluEffectRule.js +47 -0
- package/dist/rules/effects/InkosazanaEffectRule.d.ts +7 -0
- package/dist/rules/effects/InkosazanaEffectRule.js +46 -0
- package/dist/rules/effects/JiangshiEffectRule.js +5 -2
- package/dist/rules/effects/PermanentEffectsRule.d.ts +7 -0
- package/dist/rules/effects/PermanentEffectsRule.js +54 -0
- package/dist/rules/effects/QilinEffectRule.js +6 -5
- package/dist/rules/effects/ResolveEffectsRule.js +1 -1
- package/dist/rules/effects/ShivaEffectRule.d.ts +1 -1
- package/dist/rules/effects/ShivaEffectRule.js +14 -10
- package/dist/rules/effects/TriggerEffectsRule.d.ts +1 -1
- package/dist/rules/effects/TriggerEffectsRule.js +36 -18
- package/dist/rules/effects/WerehyenaEffectRule.d.ts +11 -0
- package/dist/rules/effects/WerehyenaEffectRule.js +54 -0
- package/package.json +2 -2
|
@@ -0,0 +1,55 @@
|
|
|
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.FairyEffectRule = void 0;
|
|
19
|
+
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
20
|
+
var SacrificeEffectRule_1 = require("../../material/entity/SacrificeEffectRule");
|
|
21
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
22
|
+
var Pantheon_1 = require("../../material/Pantheon");
|
|
23
|
+
var Memory_1 = require("../../Memory");
|
|
24
|
+
var RuleId_1 = require("../RuleId");
|
|
25
|
+
var FairyEffectRule = (function (_super) {
|
|
26
|
+
__extends(FairyEffectRule, _super);
|
|
27
|
+
function FairyEffectRule() {
|
|
28
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
29
|
+
_this.ruleId = RuleId_1.RuleId.FairyEffect;
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
FairyEffectRule.prototype.playEffect = function () {
|
|
33
|
+
var _a = this.card.location, x = _a.x, y = _a.y;
|
|
34
|
+
var targets = new Pantheon_1.Pantheon(this.game, this.player).visibleEntities.location(function (l) { return l.y === y && l.x !== x; }).sort(function (item) { return item.location.x; }).getIndexes();
|
|
35
|
+
this.memorize(Memory_1.Memory.FairyTargets, targets);
|
|
36
|
+
return _super.prototype.playEffect.call(this);
|
|
37
|
+
};
|
|
38
|
+
FairyEffectRule.prototype.getCardsToSacrifice = function () {
|
|
39
|
+
return this.material(MaterialType_1.MaterialType.EntityCard).index(this.remind(Memory_1.Memory.FairyTargets)[0]);
|
|
40
|
+
};
|
|
41
|
+
FairyEffectRule.prototype.onSacrifice = function () {
|
|
42
|
+
var moves = [new Pantheon_1.Pantheon(this.game, this.player).gainGems(2)];
|
|
43
|
+
var targets = this.memorize(Memory_1.Memory.FairyTargets, function (targets) { return targets.slice(1); });
|
|
44
|
+
if (!targets.length) {
|
|
45
|
+
moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
|
|
46
|
+
}
|
|
47
|
+
return moves;
|
|
48
|
+
};
|
|
49
|
+
FairyEffectRule.prototype.onRuleEnd = function () {
|
|
50
|
+
this.forget(Memory_1.Memory.FairyTargets);
|
|
51
|
+
return [];
|
|
52
|
+
};
|
|
53
|
+
return FairyEffectRule;
|
|
54
|
+
}(SacrificeEffectRule_1.SacrificeEffectRule));
|
|
55
|
+
exports.FairyEffectRule = FairyEffectRule;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Location, Material, MaterialMove, MoveItem, XYCoordinates } from '@gamepark/rules-api';
|
|
2
|
+
import { MoveEffectRule } from '../../material/entity/MoveEffectRule';
|
|
3
|
+
import { RuleId } from '../RuleId';
|
|
4
|
+
export declare class IdloziEffectRule extends MoveEffectRule {
|
|
5
|
+
ruleId: RuleId;
|
|
6
|
+
getMovingCards(effectCardIndex: number): Material;
|
|
7
|
+
isLegalDestination(space: XYCoordinates, cardLocation: Location): boolean;
|
|
8
|
+
onCardMoved(move: MoveItem): MaterialMove[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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.IdloziEffectRule = void 0;
|
|
19
|
+
var Entity_1 = require("../../material/Entity");
|
|
20
|
+
var MoveEffectRule_1 = require("../../material/entity/MoveEffectRule");
|
|
21
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
22
|
+
var Pantheon_1 = require("../../material/Pantheon");
|
|
23
|
+
var RuleId_1 = require("../RuleId");
|
|
24
|
+
var IdloziEffectRule = (function (_super) {
|
|
25
|
+
__extends(IdloziEffectRule, _super);
|
|
26
|
+
function IdloziEffectRule() {
|
|
27
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
28
|
+
_this.ruleId = RuleId_1.RuleId.IdloziEffect;
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
IdloziEffectRule.prototype.getMovingCards = function (effectCardIndex) {
|
|
32
|
+
return _super.prototype.getMovingCards.call(this, effectCardIndex).id(function (id) { return (0, Entity_1.isCreature)(id.front); });
|
|
33
|
+
};
|
|
34
|
+
IdloziEffectRule.prototype.isLegalDestination = function (space, cardLocation) {
|
|
35
|
+
return space.y !== cardLocation.y;
|
|
36
|
+
};
|
|
37
|
+
IdloziEffectRule.prototype.onCardMoved = function (move) {
|
|
38
|
+
var entity = this.material(MaterialType_1.MaterialType.EntityCard).getItem(move.itemIndex).id.front;
|
|
39
|
+
return new Pantheon_1.Pantheon(this.game, this.player).getInvokeGains(entity, move.location.y).concat(this.endEffect());
|
|
40
|
+
};
|
|
41
|
+
return IdloziEffectRule;
|
|
42
|
+
}(MoveEffectRule_1.MoveEffectRule));
|
|
43
|
+
exports.IdloziEffectRule = IdloziEffectRule;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InvokeEffectRule } from '../../material/entity/PlaceCardEffectRule';
|
|
2
|
+
import { RuleId } from '../RuleId';
|
|
3
|
+
export declare class ImpunduluEffectRule extends InvokeEffectRule {
|
|
4
|
+
ruleId: RuleId;
|
|
5
|
+
playEffect(): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
|
|
6
|
+
getCardsToPlace(): import("@gamepark/rules-api").Material<number, number, number>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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.ImpunduluEffectRule = void 0;
|
|
19
|
+
var Destiny_1 = require("../../material/Destiny");
|
|
20
|
+
var Entity_1 = require("../../material/Entity");
|
|
21
|
+
var PlaceCardEffectRule_1 = require("../../material/entity/PlaceCardEffectRule");
|
|
22
|
+
var LocationType_1 = require("../../material/LocationType");
|
|
23
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
24
|
+
var Pantheon_1 = require("../../material/Pantheon");
|
|
25
|
+
var RuleId_1 = require("../RuleId");
|
|
26
|
+
var ImpunduluEffectRule = (function (_super) {
|
|
27
|
+
__extends(ImpunduluEffectRule, _super);
|
|
28
|
+
function ImpunduluEffectRule() {
|
|
29
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
30
|
+
_this.ruleId = RuleId_1.RuleId.ImpunduluEffect;
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
ImpunduluEffectRule.prototype.playEffect = function () {
|
|
34
|
+
var player = this.card.location.player;
|
|
35
|
+
return new Pantheon_1.Pantheon(this.game, player).hasCrushed(this.card) ? _super.prototype.playEffect.call(this) : [];
|
|
36
|
+
};
|
|
37
|
+
ImpunduluEffectRule.prototype.getCardsToPlace = function () {
|
|
38
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
|
|
39
|
+
var _a = this.card.location, x = _a.x, y = _a.y;
|
|
40
|
+
var crushed = pantheon.coveredEntities.location(function (l) { return l.x === x && l.y === y; }).maxBy(function (item) { return item.location.z; });
|
|
41
|
+
var mythology = (0, Entity_1.entityMythology)(crushed.getItem().id.front);
|
|
42
|
+
var board = this.material(MaterialType_1.MaterialType.MythologyBoard).id(function (id) { return id.mythology === mythology; });
|
|
43
|
+
return new Destiny_1.Destiny(this.game).cardsWithoutToken.location(LocationType_1.LocationType.SanctuaryCreatureSpot).parent(board.getIndex());
|
|
44
|
+
};
|
|
45
|
+
return ImpunduluEffectRule;
|
|
46
|
+
}(PlaceCardEffectRule_1.InvokeEffectRule));
|
|
47
|
+
exports.ImpunduluEffectRule = ImpunduluEffectRule;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InvokeEffectRule } from '../../material/entity/PlaceCardEffectRule';
|
|
2
|
+
import { RuleId } from '../RuleId';
|
|
3
|
+
export declare class InkosazanaEffectRule extends InvokeEffectRule {
|
|
4
|
+
ruleId: RuleId;
|
|
5
|
+
onRuleStart(): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
|
|
6
|
+
getCardsToPlace(): import("@gamepark/rules-api").Material<number, number, number>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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.InkosazanaEffectRule = void 0;
|
|
19
|
+
var PlaceCardEffectRule_1 = require("../../material/entity/PlaceCardEffectRule");
|
|
20
|
+
var LocationType_1 = require("../../material/LocationType");
|
|
21
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
22
|
+
var Memory_1 = require("../../Memory");
|
|
23
|
+
var RuleId_1 = require("../RuleId");
|
|
24
|
+
var InkosazanaEffectRule = (function (_super) {
|
|
25
|
+
__extends(InkosazanaEffectRule, _super);
|
|
26
|
+
function InkosazanaEffectRule() {
|
|
27
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
28
|
+
_this.ruleId = RuleId_1.RuleId.InkosazanaEffect;
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
InkosazanaEffectRule.prototype.onRuleStart = function () {
|
|
32
|
+
if (!this.remind(Memory_1.Memory.InkosazanaInvoke1)) {
|
|
33
|
+
this.remind(Memory_1.Memory.PendingEffects).unshift([this.getEffect()]);
|
|
34
|
+
this.memorize(Memory_1.Memory.InkosazanaInvoke1, true);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.forget(Memory_1.Memory.InkosazanaInvoke1);
|
|
38
|
+
}
|
|
39
|
+
return _super.prototype.onRuleStart.call(this);
|
|
40
|
+
};
|
|
41
|
+
InkosazanaEffectRule.prototype.getCardsToPlace = function () {
|
|
42
|
+
return this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.PlayerDiscard).player(this.player);
|
|
43
|
+
};
|
|
44
|
+
return InkosazanaEffectRule;
|
|
45
|
+
}(PlaceCardEffectRule_1.InvokeEffectRule));
|
|
46
|
+
exports.InkosazanaEffectRule = InkosazanaEffectRule;
|
|
@@ -47,6 +47,7 @@ var LocationType_1 = require("../../material/LocationType");
|
|
|
47
47
|
var MaterialType_1 = require("../../material/MaterialType");
|
|
48
48
|
var Pantheon_1 = require("../../material/Pantheon");
|
|
49
49
|
var RuleId_1 = require("../RuleId");
|
|
50
|
+
var PermanentEffectsRule_1 = require("./PermanentEffectsRule");
|
|
50
51
|
var JiangshiEffectRule = (function (_super) {
|
|
51
52
|
__extends(JiangshiEffectRule, _super);
|
|
52
53
|
function JiangshiEffectRule() {
|
|
@@ -58,7 +59,8 @@ var JiangshiEffectRule = (function (_super) {
|
|
|
58
59
|
var _this = this;
|
|
59
60
|
var location = this.card.location;
|
|
60
61
|
var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
|
|
61
|
-
var
|
|
62
|
+
var rule = new PermanentEffectsRule_1.PermanentEffectsRule(this.game);
|
|
63
|
+
var piles = pantheon.getPiles(function (space) { return space.y === location.y; }).filter(function (pile) { return rule.canSacrifice(pile.maxBy(function (item) { return item.location.z; }).getItem()); });
|
|
62
64
|
return piles.map(function (pile) { return pile.moveItemsAtOnce({ type: LocationType_1.LocationType.PlayerDiscard, player: _this.player }); });
|
|
63
65
|
};
|
|
64
66
|
JiangshiEffectRule.prototype.beforeItemMove = function (move) {
|
|
@@ -67,7 +69,8 @@ var JiangshiEffectRule = (function (_super) {
|
|
|
67
69
|
var topCard = this.material(MaterialType_1.MaterialType.EntityCard)
|
|
68
70
|
.index(move.indexes)
|
|
69
71
|
.maxBy(function (item) { return item.location.z; });
|
|
70
|
-
|
|
72
|
+
pantheon.onEntitySacrificed(topCard);
|
|
73
|
+
return __spreadArray([pantheon.gainGems(2)], __read(this.endEffect()), false);
|
|
71
74
|
}
|
|
72
75
|
return [];
|
|
73
76
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MaterialRulesPart } from '@gamepark/rules-api';
|
|
2
|
+
import { EntityItem } from '../../material/Entity';
|
|
3
|
+
export declare class PermanentEffectsRule extends MaterialRulesPart {
|
|
4
|
+
canSacrifice(card: EntityItem): boolean;
|
|
5
|
+
canCrush(card: EntityItem): boolean;
|
|
6
|
+
canMove(card: EntityItem): boolean;
|
|
7
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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.PermanentEffectsRule = void 0;
|
|
19
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
20
|
+
var Effect_1 = require("../../material/entity/Effect");
|
|
21
|
+
var EntityDescription_1 = require("../../material/entity/EntityDescription");
|
|
22
|
+
var Pantheon_1 = require("../../material/Pantheon");
|
|
23
|
+
var PermanentEffectsRule = (function (_super) {
|
|
24
|
+
__extends(PermanentEffectsRule, _super);
|
|
25
|
+
function PermanentEffectsRule() {
|
|
26
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
27
|
+
}
|
|
28
|
+
PermanentEffectsRule.prototype.canSacrifice = function (card) {
|
|
29
|
+
var _this = this;
|
|
30
|
+
return !this.game.players.some(function (player) {
|
|
31
|
+
return new Pantheon_1.Pantheon(_this.game, player).visibleEntities
|
|
32
|
+
.getItems()
|
|
33
|
+
.some(function (effectCard) { return (0, EntityDescription_1.getEffects)(effectCard.id.front).some(function (effect) { var _a; return !(0, Effect_1.isTriggeredEffect)(effect) && ((_a = effect.preventSacrifice) === null || _a === void 0 ? void 0 : _a.call(effect, card, effectCard)); }); });
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
PermanentEffectsRule.prototype.canCrush = function (card) {
|
|
37
|
+
var _this = this;
|
|
38
|
+
return !this.game.players.some(function (player) {
|
|
39
|
+
return new Pantheon_1.Pantheon(_this.game, player).visibleEntities
|
|
40
|
+
.getItems()
|
|
41
|
+
.some(function (effectCard) { return (0, EntityDescription_1.getEffects)(effectCard.id.front).some(function (effect) { var _a; return !(0, Effect_1.isTriggeredEffect)(effect) && ((_a = effect.preventCrush) === null || _a === void 0 ? void 0 : _a.call(effect, card, effectCard)); }); });
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
PermanentEffectsRule.prototype.canMove = function (card) {
|
|
45
|
+
var _this = this;
|
|
46
|
+
return !this.game.players.some(function (player) {
|
|
47
|
+
return new Pantheon_1.Pantheon(_this.game, player).visibleEntities
|
|
48
|
+
.getItems()
|
|
49
|
+
.some(function (effectCard) { return (0, EntityDescription_1.getEffects)(effectCard.id.front).some(function (effect) { var _a; return !(0, Effect_1.isTriggeredEffect)(effect) && ((_a = effect.preventMove) === null || _a === void 0 ? void 0 : _a.call(effect, card, effectCard)); }); });
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
return PermanentEffectsRule;
|
|
53
|
+
}(rules_api_1.MaterialRulesPart));
|
|
54
|
+
exports.PermanentEffectsRule = PermanentEffectsRule;
|
|
@@ -78,10 +78,9 @@ var QilinEffectRule = (function (_super) {
|
|
|
78
78
|
cardsToCopy.push.apply(cardsToCopy, __spreadArray([], __read(new Pantheon_1.Pantheon(this.game, player).visibleEntities
|
|
79
79
|
.location(function (l) { return l.x === _this.card.location.x; })
|
|
80
80
|
.id(function (id) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return (0, Entity_1.isCreature)(entity) && trigger === Effect_1.isPlaced;
|
|
81
|
+
return (0, Entity_1.isCreature)(id.front) &&
|
|
82
|
+
id.front !== Entity_1.Entity.Qilin &&
|
|
83
|
+
(0, EntityDescription_1.getEffects)(id.front).some(function (effect) { return (0, Effect_1.isTriggeredEffect)(effect) && effect.trigger === Effect_1.isPlaced; });
|
|
85
84
|
})
|
|
86
85
|
.getIndexes()), false));
|
|
87
86
|
}
|
|
@@ -99,7 +98,9 @@ var QilinEffectRule = (function (_super) {
|
|
|
99
98
|
QilinEffectRule.prototype.onCustomMove = function (move) {
|
|
100
99
|
if (move.type === CustomMoveType_1.CustomMoveType.ChooseEntityCard) {
|
|
101
100
|
var card = this.material(MaterialType_1.MaterialType.EntityCard).getItem(move.data);
|
|
102
|
-
var effect = EntityDescription_1.
|
|
101
|
+
var effect = (0, EntityDescription_1.getEffects)(card.id.front)
|
|
102
|
+
.filter(Effect_1.isTriggeredEffect)
|
|
103
|
+
.find(function (effect) { return effect.trigger === Effect_1.isPlaced; });
|
|
103
104
|
var moves = new effect.rule(this.game).playEffect();
|
|
104
105
|
if (!moves.some(function (move) { return move.kind === rules_api_1.MoveKind.RulesMove; })) {
|
|
105
106
|
moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
|
|
@@ -58,7 +58,7 @@ var ResolveEffectsRule = (function (_super) {
|
|
|
58
58
|
ResolveEffectsRule.prototype.playEffect = function (pendingEffect) {
|
|
59
59
|
this.memorize(Memory_1.Memory.OngoingEffect, pendingEffect);
|
|
60
60
|
var card = this.material(MaterialType_1.MaterialType.EntityCard).getItem(pendingEffect.cardIndex);
|
|
61
|
-
var effect = EntityDescription_1.
|
|
61
|
+
var effect = (0, EntityDescription_1.getEffects)(card.id.front)[pendingEffect.effectIndex];
|
|
62
62
|
if (effect.trigger === Effect_1.oncePerTurn) {
|
|
63
63
|
this.memorize(Memory_1.Memory.OncePerTurn, function (indexes) {
|
|
64
64
|
if (indexes === void 0) { indexes = []; }
|
|
@@ -5,6 +5,6 @@ export declare class ShivaEffectRule extends PlayerEffectRule {
|
|
|
5
5
|
ruleId: RuleId;
|
|
6
6
|
canPlayEffect(cardIndex: number): boolean;
|
|
7
7
|
onRuleStart(): MaterialMove[];
|
|
8
|
-
getPlayerMoves(): MaterialMove[];
|
|
8
|
+
getPlayerMoves(player?: number): MaterialMove[];
|
|
9
9
|
beforeItemMove(move: ItemMove): MaterialMove<number, number, number, number>[];
|
|
10
10
|
}
|
|
@@ -47,6 +47,7 @@ var LocationType_1 = require("../../material/LocationType");
|
|
|
47
47
|
var MaterialType_1 = require("../../material/MaterialType");
|
|
48
48
|
var Pantheon_1 = require("../../material/Pantheon");
|
|
49
49
|
var RuleId_1 = require("../RuleId");
|
|
50
|
+
var PermanentEffectsRule_1 = require("./PermanentEffectsRule");
|
|
50
51
|
var ShivaEffectRule = (function (_super) {
|
|
51
52
|
__extends(ShivaEffectRule, _super);
|
|
52
53
|
function ShivaEffectRule() {
|
|
@@ -55,20 +56,22 @@ var ShivaEffectRule = (function (_super) {
|
|
|
55
56
|
return _this;
|
|
56
57
|
}
|
|
57
58
|
ShivaEffectRule.prototype.canPlayEffect = function (cardIndex) {
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
return pantheon.gems > 0 && cards.location(function (l) { return (0, rules_api_1.areAdjacentSquares)(l, location); }).length > 0;
|
|
59
|
+
var player = this.material(MaterialType_1.MaterialType.EntityCard).getItem(cardIndex).location.player;
|
|
60
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, player);
|
|
61
|
+
return pantheon.gems > 0 && this.getPlayerMoves(player).length > 0;
|
|
62
62
|
};
|
|
63
63
|
ShivaEffectRule.prototype.onRuleStart = function () {
|
|
64
64
|
return [new Pantheon_1.Pantheon(this.game, this.player).spendGems(1)];
|
|
65
65
|
};
|
|
66
|
-
ShivaEffectRule.prototype.getPlayerMoves = function () {
|
|
67
|
-
|
|
66
|
+
ShivaEffectRule.prototype.getPlayerMoves = function (player) {
|
|
67
|
+
if (player === void 0) { player = this.player; }
|
|
68
68
|
var location = this.card.location;
|
|
69
|
-
var pantheon = new Pantheon_1.Pantheon(this.game,
|
|
70
|
-
var
|
|
71
|
-
|
|
69
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, player);
|
|
70
|
+
var rule = new PermanentEffectsRule_1.PermanentEffectsRule(this.game);
|
|
71
|
+
var piles = pantheon
|
|
72
|
+
.getPiles(function (space) { return (0, rules_api_1.areAdjacentSquares)(space, location); })
|
|
73
|
+
.filter(function (pile) { return rule.canSacrifice(pile.maxBy(function (item) { return item.location.z; }).getItem()); });
|
|
74
|
+
return piles.map(function (pile) { return pile.moveItemsAtOnce({ type: LocationType_1.LocationType.PlayerDiscard, player: player }); });
|
|
72
75
|
};
|
|
73
76
|
ShivaEffectRule.prototype.beforeItemMove = function (move) {
|
|
74
77
|
if ((0, rules_api_1.isMoveItemTypeAtOnce)(MaterialType_1.MaterialType.EntityCard)(move) && move.location.type === LocationType_1.LocationType.PlayerDiscard) {
|
|
@@ -76,7 +79,8 @@ var ShivaEffectRule = (function (_super) {
|
|
|
76
79
|
var topCard = this.material(MaterialType_1.MaterialType.EntityCard)
|
|
77
80
|
.index(move.indexes)
|
|
78
81
|
.maxBy(function (item) { return item.location.z; });
|
|
79
|
-
|
|
82
|
+
pantheon.onEntitySacrificed(topCard);
|
|
83
|
+
return __spreadArray([pantheon.gainFavor(move.indexes.length)], __read(this.endEffect()), false);
|
|
80
84
|
}
|
|
81
85
|
return [];
|
|
82
86
|
};
|
|
@@ -6,6 +6,6 @@ export declare class TriggerEffectsRule extends MaterialRulesPart {
|
|
|
6
6
|
triggerPlayerEffects(player: PlayerColor, ...triggerEvents: TriggerEvent[]): void;
|
|
7
7
|
getPlayerEffects(player: PlayerColor, ...triggerEvents: TriggerEvent[]): PendingEffect<TriggerEvent>[];
|
|
8
8
|
triggerCardEffect(card: Material, triggerEvent: TriggerEvent): void;
|
|
9
|
-
|
|
9
|
+
getCardEffects(card: Material, triggerEvent: TriggerEvent): PendingEffect[];
|
|
10
10
|
private getPlayersByEffectPriorityOrder;
|
|
11
11
|
}
|
|
@@ -53,6 +53,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
54
|
exports.TriggerEffectsRule = void 0;
|
|
55
55
|
var rules_api_1 = require("@gamepark/rules-api");
|
|
56
|
+
var Effect_1 = require("../../material/entity/Effect");
|
|
56
57
|
var EntityDescription_1 = require("../../material/entity/EntityDescription");
|
|
57
58
|
var MaterialType_1 = require("../../material/MaterialType");
|
|
58
59
|
var Pantheon_1 = require("../../material/Pantheon");
|
|
@@ -94,55 +95,72 @@ var TriggerEffectsRule = (function (_super) {
|
|
|
94
95
|
}
|
|
95
96
|
};
|
|
96
97
|
TriggerEffectsRule.prototype.getPlayerEffects = function (player) {
|
|
97
|
-
var e_2, _a, e_3, _b;
|
|
98
|
+
var e_2, _a, e_3, _b, e_4, _c;
|
|
98
99
|
var triggerEvents = [];
|
|
99
100
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
100
101
|
triggerEvents[_i - 1] = arguments[_i];
|
|
101
102
|
}
|
|
102
103
|
var pendingEffects = [];
|
|
103
104
|
var pantheon = new Pantheon_1.Pantheon(this.game, player);
|
|
104
|
-
var
|
|
105
|
+
var material = this.material(MaterialType_1.MaterialType.EntityCard);
|
|
106
|
+
var cards = pantheon.visibleEntities.getIndexes();
|
|
105
107
|
try {
|
|
106
108
|
for (var triggerEvents_1 = __values(triggerEvents), triggerEvents_1_1 = triggerEvents_1.next(); !triggerEvents_1_1.done; triggerEvents_1_1 = triggerEvents_1.next()) {
|
|
107
|
-
var
|
|
109
|
+
var event = triggerEvents_1_1.value;
|
|
110
|
+
if (event.type === Effect_1.TriggerEventType.EntityCrushed && material.getItem(event.cardIndex).location.player === player && !cards.includes(event.cardIndex)) {
|
|
111
|
+
cards.push(event.cardIndex);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
116
|
+
finally {
|
|
117
|
+
try {
|
|
118
|
+
if (triggerEvents_1_1 && !triggerEvents_1_1.done && (_a = triggerEvents_1.return)) _a.call(triggerEvents_1);
|
|
119
|
+
}
|
|
120
|
+
finally { if (e_2) throw e_2.error; }
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
for (var triggerEvents_2 = __values(triggerEvents), triggerEvents_2_1 = triggerEvents_2.next(); !triggerEvents_2_1.done; triggerEvents_2_1 = triggerEvents_2.next()) {
|
|
124
|
+
var triggerEvent = triggerEvents_2_1.value;
|
|
108
125
|
try {
|
|
109
|
-
for (var
|
|
110
|
-
var cardIndex =
|
|
111
|
-
|
|
126
|
+
for (var cards_1 = (e_4 = void 0, __values(cards)), cards_1_1 = cards_1.next(); !cards_1_1.done; cards_1_1 = cards_1.next()) {
|
|
127
|
+
var cardIndex = cards_1_1.value;
|
|
128
|
+
var card = material.index(cardIndex);
|
|
129
|
+
pendingEffects.push.apply(pendingEffects, __spreadArray([], __read(this.getCardEffects(card, triggerEvent)), false));
|
|
112
130
|
}
|
|
113
131
|
}
|
|
114
|
-
catch (
|
|
132
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
115
133
|
finally {
|
|
116
134
|
try {
|
|
117
|
-
if (
|
|
135
|
+
if (cards_1_1 && !cards_1_1.done && (_c = cards_1.return)) _c.call(cards_1);
|
|
118
136
|
}
|
|
119
|
-
finally { if (
|
|
137
|
+
finally { if (e_4) throw e_4.error; }
|
|
120
138
|
}
|
|
121
139
|
}
|
|
122
140
|
}
|
|
123
|
-
catch (
|
|
141
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
124
142
|
finally {
|
|
125
143
|
try {
|
|
126
|
-
if (
|
|
144
|
+
if (triggerEvents_2_1 && !triggerEvents_2_1.done && (_b = triggerEvents_2.return)) _b.call(triggerEvents_2);
|
|
127
145
|
}
|
|
128
|
-
finally { if (
|
|
146
|
+
finally { if (e_3) throw e_3.error; }
|
|
129
147
|
}
|
|
130
148
|
return pendingEffects;
|
|
131
149
|
};
|
|
132
150
|
TriggerEffectsRule.prototype.triggerCardEffect = function (card, triggerEvent) {
|
|
133
|
-
var pendingEffects = this.
|
|
151
|
+
var pendingEffects = this.getCardEffects(card, triggerEvent);
|
|
134
152
|
if (pendingEffects.length) {
|
|
135
153
|
this.remind(Memory_1.Memory.PendingEffects).unshift(pendingEffects);
|
|
136
154
|
}
|
|
137
155
|
};
|
|
138
|
-
TriggerEffectsRule.prototype.
|
|
156
|
+
TriggerEffectsRule.prototype.getCardEffects = function (card, triggerEvent) {
|
|
139
157
|
var pendingEffects = [];
|
|
140
158
|
var cardIndex = card.getIndex();
|
|
141
159
|
var cardItem = card.getItem();
|
|
142
|
-
|
|
143
|
-
var effect = EntityDescription_1.
|
|
144
|
-
if (
|
|
145
|
-
pendingEffects.push({ cardIndex: cardIndex, triggerEvent: triggerEvent, auto: !!effect.auto });
|
|
160
|
+
for (var effectIndex = 0; effectIndex < (0, EntityDescription_1.getEffects)(cardItem.id.front).length; effectIndex++) {
|
|
161
|
+
var effect = (0, EntityDescription_1.getEffects)(cardItem.id.front)[effectIndex];
|
|
162
|
+
if ((0, Effect_1.isTriggeredEffect)(effect) && effect.trigger(triggerEvent, card, this.game)) {
|
|
163
|
+
pendingEffects.push({ cardIndex: cardIndex, effectIndex: effectIndex, triggerEvent: triggerEvent, auto: !!effect.auto });
|
|
146
164
|
}
|
|
147
165
|
}
|
|
148
166
|
return pendingEffects;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PlaceCardEffectRule } from '../../material/entity/PlaceCardEffectRule';
|
|
2
|
+
import { SacrificeEffectRule } from '../../material/entity/SacrificeEffectRule';
|
|
3
|
+
import { RuleId } from '../RuleId';
|
|
4
|
+
export declare class WerehyenaEffectRule extends SacrificeEffectRule {
|
|
5
|
+
ruleId: RuleId;
|
|
6
|
+
getCardsToSacrifice(): import("@gamepark/rules-api").Material<number, number, number>;
|
|
7
|
+
onSacrifice(): import("@gamepark/rules-api").StartRule<RuleId.WerehyenaCallEffect>[];
|
|
8
|
+
}
|
|
9
|
+
export declare class WerehyenaCallEffectRule extends PlaceCardEffectRule {
|
|
10
|
+
getCardsToPlace(): import("@gamepark/rules-api").Material<number, number, number>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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.WerehyenaCallEffectRule = exports.WerehyenaEffectRule = void 0;
|
|
19
|
+
var Entity_1 = require("../../material/Entity");
|
|
20
|
+
var PlaceCardEffectRule_1 = require("../../material/entity/PlaceCardEffectRule");
|
|
21
|
+
var SacrificeEffectRule_1 = require("../../material/entity/SacrificeEffectRule");
|
|
22
|
+
var LocationType_1 = require("../../material/LocationType");
|
|
23
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
24
|
+
var RuleId_1 = require("../RuleId");
|
|
25
|
+
var WerehyenaEffectRule = (function (_super) {
|
|
26
|
+
__extends(WerehyenaEffectRule, _super);
|
|
27
|
+
function WerehyenaEffectRule() {
|
|
28
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
29
|
+
_this.ruleId = RuleId_1.RuleId.WerehyenaEffect;
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
WerehyenaEffectRule.prototype.getCardsToSacrifice = function () {
|
|
33
|
+
return _super.prototype.getCardsToSacrifice.call(this).id(function (id) { return (0, Entity_1.isCreature)(id.front); });
|
|
34
|
+
};
|
|
35
|
+
WerehyenaEffectRule.prototype.onSacrifice = function () {
|
|
36
|
+
return [this.startRule(RuleId_1.RuleId.WerehyenaCallEffect)];
|
|
37
|
+
};
|
|
38
|
+
return WerehyenaEffectRule;
|
|
39
|
+
}(SacrificeEffectRule_1.SacrificeEffectRule));
|
|
40
|
+
exports.WerehyenaEffectRule = WerehyenaEffectRule;
|
|
41
|
+
var WerehyenaCallEffectRule = (function (_super) {
|
|
42
|
+
__extends(WerehyenaCallEffectRule, _super);
|
|
43
|
+
function WerehyenaCallEffectRule() {
|
|
44
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
45
|
+
}
|
|
46
|
+
WerehyenaCallEffectRule.prototype.getCardsToPlace = function () {
|
|
47
|
+
var _this = this;
|
|
48
|
+
return this.material(MaterialType_1.MaterialType.EntityCard)
|
|
49
|
+
.location(LocationType_1.LocationType.PlayerDiscard)
|
|
50
|
+
.player(function (player) { return player !== _this.player; });
|
|
51
|
+
};
|
|
52
|
+
return WerehyenaCallEffectRule;
|
|
53
|
+
}(PlaceCardEffectRule_1.PlaceCardEffectRule));
|
|
54
|
+
exports.WerehyenaCallEffectRule = WerehyenaCallEffectRule;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamepark/mythologies",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "The rules of Mythologies adapted for Game Park",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"i18next": "^22.0.3",
|
|
30
30
|
"lodash": "^4.17.21"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "d8c1359afbcb56757b75fda229d3a030a64b4d8b"
|
|
33
33
|
}
|