@gamepark/mythologies 0.1.0
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 +13 -0
- package/dist/CustomMoveType.js +13 -0
- package/dist/Memory.d.ts +13 -0
- package/dist/Memory.js +17 -0
- package/dist/MythologiesOptions.d.ts +12 -0
- package/dist/MythologiesOptions.js +14 -0
- package/dist/MythologiesRules.d.ts +111 -0
- package/dist/MythologiesRules.js +218 -0
- package/dist/MythologiesSetup.d.ts +17 -0
- package/dist/MythologiesSetup.js +161 -0
- package/dist/PlayerColor.d.ts +10 -0
- package/dist/PlayerColor.js +10 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +9 -0
- package/dist/material/Destiny.d.ts +9 -0
- package/dist/material/Destiny.js +87 -0
- package/dist/material/Entity.d.ts +98 -0
- package/dist/material/Entity.js +99 -0
- package/dist/material/LocationType.d.ts +26 -0
- package/dist/material/LocationType.js +31 -0
- package/dist/material/MaterialType.d.ts +12 -0
- package/dist/material/MaterialType.js +16 -0
- package/dist/material/Mythology.d.ts +19 -0
- package/dist/material/Mythology.js +21 -0
- package/dist/material/Pantheon.d.ts +36 -0
- package/dist/material/Pantheon.js +357 -0
- package/dist/material/Trial.d.ts +22 -0
- package/dist/material/Trial.js +184 -0
- package/dist/material/entity/Effect.d.ts +91 -0
- package/dist/material/entity/Effect.js +115 -0
- package/dist/material/entity/EntityDescription.d.ts +13 -0
- package/dist/material/entity/EntityDescription.js +173 -0
- package/dist/material/entity/MoveEffectRule.d.ts +15 -0
- package/dist/material/entity/MoveEffectRule.js +86 -0
- package/dist/material/entity/PlaceCardEffectRule.d.ts +15 -0
- package/dist/material/entity/PlaceCardEffectRule.js +75 -0
- package/dist/material/entity/SacrificeEffectRule.d.ts +9 -0
- package/dist/material/entity/SacrificeEffectRule.js +58 -0
- package/dist/material/entity/SimultaneousMoveEffectRule.d.ts +13 -0
- package/dist/material/entity/SimultaneousMoveEffectRule.js +124 -0
- package/dist/material/entity/SimultaneousSacrificeEffectRule.d.ts +10 -0
- package/dist/material/entity/SimultaneousSacrificeEffectRule.js +57 -0
- package/dist/material/entity/celtic/Banshee.d.ts +2 -0
- package/dist/material/entity/celtic/Banshee.js +6 -0
- package/dist/material/entity/celtic/Brigid.d.ts +2 -0
- package/dist/material/entity/celtic/Brigid.js +6 -0
- package/dist/material/entity/celtic/Cernunnos.d.ts +2 -0
- package/dist/material/entity/celtic/Cernunnos.js +6 -0
- package/dist/material/entity/celtic/Dagda.d.ts +2 -0
- package/dist/material/entity/celtic/Dagda.js +6 -0
- package/dist/material/entity/celtic/Dryad.d.ts +2 -0
- package/dist/material/entity/celtic/Dryad.js +6 -0
- package/dist/material/entity/celtic/Dullahan.d.ts +2 -0
- package/dist/material/entity/celtic/Dullahan.js +6 -0
- package/dist/material/entity/celtic/Kelpie.d.ts +2 -0
- package/dist/material/entity/celtic/Kelpie.js +6 -0
- package/dist/material/entity/celtic/Leprechaun.d.ts +2 -0
- package/dist/material/entity/celtic/Leprechaun.js +6 -0
- package/dist/material/entity/celtic/Morrigan.d.ts +2 -0
- package/dist/material/entity/celtic/Morrigan.js +6 -0
- package/dist/material/entity/celtic/Selkie.d.ts +2 -0
- package/dist/material/entity/celtic/Selkie.js +6 -0
- package/dist/material/entity/chinese/ChangE.d.ts +2 -0
- package/dist/material/entity/chinese/ChangE.js +6 -0
- package/dist/material/entity/chinese/Fenghuang.d.ts +2 -0
- package/dist/material/entity/chinese/Fenghuang.js +6 -0
- package/dist/material/entity/chinese/Jiangshi.d.ts +2 -0
- package/dist/material/entity/chinese/Jiangshi.js +6 -0
- package/dist/material/entity/chinese/Mogwai.d.ts +2 -0
- package/dist/material/entity/chinese/Mogwai.js +6 -0
- package/dist/material/entity/chinese/Nian.d.ts +2 -0
- package/dist/material/entity/chinese/Nian.js +6 -0
- package/dist/material/entity/chinese/Nuwa.d.ts +2 -0
- package/dist/material/entity/chinese/Nuwa.js +6 -0
- package/dist/material/entity/chinese/Qilin.d.ts +2 -0
- package/dist/material/entity/chinese/Qilin.js +6 -0
- package/dist/material/entity/chinese/SunWukong.d.ts +2 -0
- package/dist/material/entity/chinese/SunWukong.js +6 -0
- package/dist/material/entity/chinese/Tianlong.d.ts +2 -0
- package/dist/material/entity/chinese/Tianlong.js +6 -0
- package/dist/material/entity/chinese/YanluoWang.d.ts +2 -0
- package/dist/material/entity/chinese/YanluoWang.js +6 -0
- package/dist/material/entity/egyptian/Anubis.d.ts +2 -0
- package/dist/material/entity/egyptian/Anubis.js +12 -0
- package/dist/material/entity/egyptian/Babai.d.ts +2 -0
- package/dist/material/entity/egyptian/Babai.js +12 -0
- package/dist/material/entity/egyptian/Beetle.d.ts +2 -0
- package/dist/material/entity/egyptian/Beetle.js +36 -0
- package/dist/material/entity/egyptian/Bennu.d.ts +2 -0
- package/dist/material/entity/egyptian/Bennu.js +12 -0
- package/dist/material/entity/egyptian/Cobra.d.ts +2 -0
- package/dist/material/entity/egyptian/Cobra.js +12 -0
- package/dist/material/entity/egyptian/Isis.d.ts +2 -0
- package/dist/material/entity/egyptian/Isis.js +39 -0
- package/dist/material/entity/egyptian/Mummy.d.ts +2 -0
- package/dist/material/entity/egyptian/Mummy.js +39 -0
- package/dist/material/entity/egyptian/Osiris.d.ts +2 -0
- package/dist/material/entity/egyptian/Osiris.js +71 -0
- package/dist/material/entity/egyptian/Ra.d.ts +2 -0
- package/dist/material/entity/egyptian/Ra.js +12 -0
- package/dist/material/entity/egyptian/Sphinx.d.ts +2 -0
- package/dist/material/entity/egyptian/Sphinx.js +12 -0
- package/dist/material/entity/greek/Athena.d.ts +2 -0
- package/dist/material/entity/greek/Athena.js +12 -0
- package/dist/material/entity/greek/Centaur.d.ts +2 -0
- package/dist/material/entity/greek/Centaur.js +12 -0
- package/dist/material/entity/greek/Chimera.d.ts +2 -0
- package/dist/material/entity/greek/Chimera.js +12 -0
- package/dist/material/entity/greek/Cyclops.d.ts +2 -0
- package/dist/material/entity/greek/Cyclops.js +21 -0
- package/dist/material/entity/greek/Gorgon.d.ts +2 -0
- package/dist/material/entity/greek/Gorgon.js +12 -0
- package/dist/material/entity/greek/Griffin.d.ts +2 -0
- package/dist/material/entity/greek/Griffin.js +12 -0
- package/dist/material/entity/greek/Hades.d.ts +2 -0
- package/dist/material/entity/greek/Hades.js +12 -0
- package/dist/material/entity/greek/Minotaur.d.ts +2 -0
- package/dist/material/entity/greek/Minotaur.js +12 -0
- package/dist/material/entity/greek/Poseidon.d.ts +2 -0
- package/dist/material/entity/greek/Poseidon.js +44 -0
- package/dist/material/entity/greek/Zeus.d.ts +2 -0
- package/dist/material/entity/greek/Zeus.js +39 -0
- package/dist/material/entity/hindu/Asura.d.ts +2 -0
- package/dist/material/entity/hindu/Asura.js +66 -0
- package/dist/material/entity/hindu/Brahma.d.ts +2 -0
- package/dist/material/entity/hindu/Brahma.js +36 -0
- package/dist/material/entity/hindu/Ganesh.d.ts +2 -0
- package/dist/material/entity/hindu/Ganesh.js +44 -0
- package/dist/material/entity/hindu/Garuda.d.ts +2 -0
- package/dist/material/entity/hindu/Garuda.js +12 -0
- package/dist/material/entity/hindu/Kinnara.d.ts +2 -0
- package/dist/material/entity/hindu/Kinnara.js +12 -0
- package/dist/material/entity/hindu/Naga.d.ts +2 -0
- package/dist/material/entity/hindu/Naga.js +68 -0
- package/dist/material/entity/hindu/Rakshasa.d.ts +2 -0
- package/dist/material/entity/hindu/Rakshasa.js +12 -0
- package/dist/material/entity/hindu/Shiva.d.ts +2 -0
- package/dist/material/entity/hindu/Shiva.js +12 -0
- package/dist/material/entity/hindu/Vetala.d.ts +2 -0
- package/dist/material/entity/hindu/Vetala.js +12 -0
- package/dist/material/entity/hindu/Vishnu.d.ts +2 -0
- package/dist/material/entity/hindu/Vishnu.js +71 -0
- package/dist/material/entity/inca/Amaru.d.ts +2 -0
- package/dist/material/entity/inca/Amaru.js +6 -0
- package/dist/material/entity/inca/Caiman.d.ts +2 -0
- package/dist/material/entity/inca/Caiman.js +6 -0
- package/dist/material/entity/inca/Condor.d.ts +2 -0
- package/dist/material/entity/inca/Condor.js +6 -0
- package/dist/material/entity/inca/Illapa.d.ts +2 -0
- package/dist/material/entity/inca/Illapa.js +6 -0
- package/dist/material/entity/inca/Inti.d.ts +2 -0
- package/dist/material/entity/inca/Inti.js +6 -0
- package/dist/material/entity/inca/MamaQucha.d.ts +2 -0
- package/dist/material/entity/inca/MamaQucha.js +6 -0
- package/dist/material/entity/inca/Pumapunku.d.ts +2 -0
- package/dist/material/entity/inca/Pumapunku.js +6 -0
- package/dist/material/entity/inca/Supay.d.ts +2 -0
- package/dist/material/entity/inca/Supay.js +6 -0
- package/dist/material/entity/inca/Ukuku.d.ts +2 -0
- package/dist/material/entity/inca/Ukuku.js +6 -0
- package/dist/material/entity/inca/Viracocha.d.ts +2 -0
- package/dist/material/entity/inca/Viracocha.js +6 -0
- package/dist/material/entity/norse/Alf.d.ts +2 -0
- package/dist/material/entity/norse/Alf.js +12 -0
- package/dist/material/entity/norse/Draugr.d.ts +2 -0
- package/dist/material/entity/norse/Draugr.js +12 -0
- package/dist/material/entity/norse/Fenrir.d.ts +2 -0
- package/dist/material/entity/norse/Fenrir.js +12 -0
- package/dist/material/entity/norse/Freya.d.ts +2 -0
- package/dist/material/entity/norse/Freya.js +39 -0
- package/dist/material/entity/norse/Jotunn.d.ts +2 -0
- package/dist/material/entity/norse/Jotunn.js +36 -0
- package/dist/material/entity/norse/Loki.d.ts +2 -0
- package/dist/material/entity/norse/Loki.js +36 -0
- package/dist/material/entity/norse/Odin.d.ts +2 -0
- package/dist/material/entity/norse/Odin.js +6 -0
- package/dist/material/entity/norse/Thor.d.ts +2 -0
- package/dist/material/entity/norse/Thor.js +12 -0
- package/dist/material/entity/norse/Troll.d.ts +2 -0
- package/dist/material/entity/norse/Troll.js +6 -0
- package/dist/material/entity/norse/Valkyrie.d.ts +2 -0
- package/dist/material/entity/norse/Valkyrie.js +72 -0
- package/dist/material/entity/zulu/Idlozi.d.ts +2 -0
- package/dist/material/entity/zulu/Idlozi.js +6 -0
- package/dist/material/entity/zulu/Impundulu.d.ts +2 -0
- package/dist/material/entity/zulu/Impundulu.js +6 -0
- package/dist/material/entity/zulu/Inkanyamba.d.ts +2 -0
- package/dist/material/entity/zulu/Inkanyamba.js +6 -0
- package/dist/material/entity/zulu/Inkosazana.d.ts +2 -0
- package/dist/material/entity/zulu/Inkosazana.js +6 -0
- package/dist/material/entity/zulu/Shembe.d.ts +2 -0
- package/dist/material/entity/zulu/Shembe.js +6 -0
- package/dist/material/entity/zulu/Tokoloshe.d.ts +2 -0
- package/dist/material/entity/zulu/Tokoloshe.js +6 -0
- package/dist/material/entity/zulu/Umvelinqangi.d.ts +2 -0
- package/dist/material/entity/zulu/Umvelinqangi.js +6 -0
- package/dist/material/entity/zulu/Unkulunkulu.d.ts +2 -0
- package/dist/material/entity/zulu/Unkulunkulu.js +6 -0
- package/dist/material/entity/zulu/Unwabu.d.ts +2 -0
- package/dist/material/entity/zulu/Unwabu.js +6 -0
- package/dist/material/entity/zulu/Werehyena.d.ts +2 -0
- package/dist/material/entity/zulu/Werehyena.js +6 -0
- package/dist/rules/ChooseDraftTokenRule.d.ts +15 -0
- package/dist/rules/ChooseDraftTokenRule.js +103 -0
- package/dist/rules/DrawDestinyCardRule.d.ts +7 -0
- package/dist/rules/DrawDestinyCardRule.js +116 -0
- package/dist/rules/EndGameRule.d.ts +5 -0
- package/dist/rules/EndGameRule.js +44 -0
- package/dist/rules/PlaceCardsRule.d.ts +13 -0
- package/dist/rules/PlaceCardsRule.js +192 -0
- package/dist/rules/PlaceTokenRule.d.ts +13 -0
- package/dist/rules/PlaceTokenRule.js +139 -0
- package/dist/rules/RuleId.d.ts +36 -0
- package/dist/rules/RuleId.js +40 -0
- package/dist/rules/UpkeepRule.d.ts +9 -0
- package/dist/rules/UpkeepRule.js +140 -0
- package/dist/rules/effects/AlfEffectRule.d.ts +10 -0
- package/dist/rules/effects/AlfEffectRule.js +59 -0
- package/dist/rules/effects/AnubisEffectRule.d.ts +9 -0
- package/dist/rules/effects/AnubisEffectRule.js +49 -0
- package/dist/rules/effects/AthenaEffectRule.d.ts +9 -0
- package/dist/rules/effects/AthenaEffectRule.js +104 -0
- package/dist/rules/effects/BabaiEffectRule.d.ts +6 -0
- package/dist/rules/effects/BabaiEffectRule.js +40 -0
- package/dist/rules/effects/BennuEffectRule.d.ts +6 -0
- package/dist/rules/effects/BennuEffectRule.js +35 -0
- package/dist/rules/effects/CentaurEffectRule.d.ts +15 -0
- package/dist/rules/effects/CentaurEffectRule.js +77 -0
- package/dist/rules/effects/ChimeraEffectRule.d.ts +8 -0
- package/dist/rules/effects/ChimeraEffectRule.js +51 -0
- package/dist/rules/effects/CobraEffectRule.d.ts +12 -0
- package/dist/rules/effects/CobraEffectRule.js +55 -0
- package/dist/rules/effects/CyclopsEffectRule.d.ts +8 -0
- package/dist/rules/effects/CyclopsEffectRule.js +87 -0
- package/dist/rules/effects/DraugrEffectRule.d.ts +11 -0
- package/dist/rules/effects/DraugrEffectRule.js +56 -0
- package/dist/rules/effects/FenrirEffectRule.d.ts +15 -0
- package/dist/rules/effects/FenrirEffectRule.js +132 -0
- package/dist/rules/effects/GarudaEffectRule.d.ts +9 -0
- package/dist/rules/effects/GarudaEffectRule.js +84 -0
- package/dist/rules/effects/GorgonEffectRule.d.ts +11 -0
- package/dist/rules/effects/GorgonEffectRule.js +78 -0
- package/dist/rules/effects/GriffinEffectRule.d.ts +9 -0
- package/dist/rules/effects/GriffinEffectRule.js +41 -0
- package/dist/rules/effects/HadesEffectRule.d.ts +5 -0
- package/dist/rules/effects/HadesEffectRule.js +87 -0
- package/dist/rules/effects/KinnaraEffectRule.d.ts +12 -0
- package/dist/rules/effects/KinnaraEffectRule.js +84 -0
- package/dist/rules/effects/MinotaurEffectRule.d.ts +9 -0
- package/dist/rules/effects/MinotaurEffectRule.js +39 -0
- package/dist/rules/effects/OdinEffectRule.d.ts +11 -0
- package/dist/rules/effects/OdinEffectRule.js +52 -0
- package/dist/rules/effects/RaEffectRule.d.ts +5 -0
- package/dist/rules/effects/RaEffectRule.js +87 -0
- package/dist/rules/effects/RakshasaEffectRule.d.ts +13 -0
- package/dist/rules/effects/RakshasaEffectRule.js +48 -0
- package/dist/rules/effects/ResolveEffectsRule.d.ts +6 -0
- package/dist/rules/effects/ResolveEffectsRule.js +73 -0
- package/dist/rules/effects/ShivaEffectRule.d.ts +10 -0
- package/dist/rules/effects/ShivaEffectRule.js +82 -0
- package/dist/rules/effects/SphinxEffectRule.d.ts +9 -0
- package/dist/rules/effects/SphinxEffectRule.js +47 -0
- package/dist/rules/effects/ThorEffectRule.d.ts +11 -0
- package/dist/rules/effects/ThorEffectRule.js +56 -0
- package/dist/rules/effects/TriggerEffectsRule.d.ts +11 -0
- package/dist/rules/effects/TriggerEffectsRule.js +159 -0
- package/dist/rules/effects/VetalaEffectRule.d.ts +11 -0
- package/dist/rules/effects/VetalaEffectRule.js +59 -0
- package/package.json +33 -0
|
@@ -0,0 +1,48 @@
|
|
|
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.RakshasaEffectRule = void 0;
|
|
19
|
+
var Destiny_1 = require("../../material/Destiny");
|
|
20
|
+
var PlaceCardEffectRule_1 = require("../../material/entity/PlaceCardEffectRule");
|
|
21
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
22
|
+
var Pantheon_1 = require("../../material/Pantheon");
|
|
23
|
+
var RuleId_1 = require("../RuleId");
|
|
24
|
+
var RakshasaEffectRule = (function (_super) {
|
|
25
|
+
__extends(RakshasaEffectRule, _super);
|
|
26
|
+
function RakshasaEffectRule() {
|
|
27
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
28
|
+
_this.ruleId = RuleId_1.RuleId.RakshasaEffect;
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
RakshasaEffectRule.prototype.canPlayEffect = function (cardIndex) {
|
|
32
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
|
|
33
|
+
return pantheon.gems > 0 && _super.prototype.canPlayEffect.call(this, cardIndex);
|
|
34
|
+
};
|
|
35
|
+
RakshasaEffectRule.prototype.onRuleStart = function () {
|
|
36
|
+
return [new Pantheon_1.Pantheon(this.game, this.player).spendGems(1)];
|
|
37
|
+
};
|
|
38
|
+
RakshasaEffectRule.prototype.getCardsToPlace = function () {
|
|
39
|
+
return new Destiny_1.Destiny(this.game).getAvailableEntities(this.player);
|
|
40
|
+
};
|
|
41
|
+
RakshasaEffectRule.prototype.getAvailableDestinations = function (cardIndex) {
|
|
42
|
+
var location = this.material(MaterialType_1.MaterialType.EntityCard).getItem(cardIndex).location;
|
|
43
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, location.player);
|
|
44
|
+
return pantheon.isLegalSpaceToInvoke(location) ? [location] : [];
|
|
45
|
+
};
|
|
46
|
+
return RakshasaEffectRule;
|
|
47
|
+
}(PlaceCardEffectRule_1.PlaceCardEffectRule));
|
|
48
|
+
exports.RakshasaEffectRule = RakshasaEffectRule;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CustomMove, PlayerTurnRule, RuleMove, RuleStep } from '@gamepark/rules-api';
|
|
2
|
+
export declare class ResolveEffectsRule extends PlayerTurnRule {
|
|
3
|
+
onRuleStart(_move: RuleMove, previousRule: RuleStep): CustomMove<number>[];
|
|
4
|
+
getPlayerMoves(): CustomMove<number>[];
|
|
5
|
+
onCustomMove(move: CustomMove): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
|
|
6
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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.ResolveEffectsRule = void 0;
|
|
19
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
20
|
+
var lodash_1 = require("lodash");
|
|
21
|
+
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
22
|
+
var Effect_1 = require("../../material/entity/Effect");
|
|
23
|
+
var EntityDescription_1 = require("../../material/entity/EntityDescription");
|
|
24
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
25
|
+
var Memory_1 = require("../../Memory");
|
|
26
|
+
var ResolveEffectsRule = (function (_super) {
|
|
27
|
+
__extends(ResolveEffectsRule, _super);
|
|
28
|
+
function ResolveEffectsRule() {
|
|
29
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
30
|
+
}
|
|
31
|
+
ResolveEffectsRule.prototype.onRuleStart = function (_move, previousRule) {
|
|
32
|
+
if (!this.remind(Memory_1.Memory.PendingRule)) {
|
|
33
|
+
this.memorize(Memory_1.Memory.PendingRule, previousRule);
|
|
34
|
+
}
|
|
35
|
+
var moves = this.getPlayerMoves();
|
|
36
|
+
return moves.length === 1 ? moves : [];
|
|
37
|
+
};
|
|
38
|
+
ResolveEffectsRule.prototype.getPlayerMoves = function () {
|
|
39
|
+
var _this = this;
|
|
40
|
+
var _a;
|
|
41
|
+
var pendingEffects = (_a = this.remind(Memory_1.Memory.PendingEffects)[0]) !== null && _a !== void 0 ? _a : [];
|
|
42
|
+
return pendingEffects.map(function (effect) { return _this.customMove(CustomMoveType_1.CustomMoveType.PlayEffect, effect); });
|
|
43
|
+
};
|
|
44
|
+
ResolveEffectsRule.prototype.onCustomMove = function (move) {
|
|
45
|
+
if (move.type === CustomMoveType_1.CustomMoveType.PlayEffect) {
|
|
46
|
+
var pendingEffect_1 = move.data;
|
|
47
|
+
var pendingEffects = this.remind(Memory_1.Memory.PendingEffects);
|
|
48
|
+
if (pendingEffects.length) {
|
|
49
|
+
pendingEffects[0] = pendingEffects[0].filter(function (effect) { return !(0, lodash_1.isEqual)(effect, pendingEffect_1); });
|
|
50
|
+
if (pendingEffects[0].length === 0) {
|
|
51
|
+
pendingEffects.splice(0, 1);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
this.memorize(Memory_1.Memory.OngoingEffect, pendingEffect_1);
|
|
55
|
+
var card = this.material(MaterialType_1.MaterialType.EntityCard).getItem(pendingEffect_1.cardIndex);
|
|
56
|
+
var effect = (0, EntityDescription_1.getEffects)(card.id.front)[pendingEffect_1.effectIndex];
|
|
57
|
+
if (effect.trigger === Effect_1.oncePerTurn) {
|
|
58
|
+
this.memorize(Memory_1.Memory.OncePerTurn, function (indexes) {
|
|
59
|
+
if (indexes === void 0) { indexes = []; }
|
|
60
|
+
return indexes.concat(pendingEffect_1.cardIndex);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
var moves = new effect.rule(this.game).playEffect();
|
|
64
|
+
if (!moves.some(function (move) { return move.kind === rules_api_1.MoveKind.RulesMove; })) {
|
|
65
|
+
moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
|
|
66
|
+
}
|
|
67
|
+
return moves;
|
|
68
|
+
}
|
|
69
|
+
return [];
|
|
70
|
+
};
|
|
71
|
+
return ResolveEffectsRule;
|
|
72
|
+
}(rules_api_1.PlayerTurnRule));
|
|
73
|
+
exports.ResolveEffectsRule = ResolveEffectsRule;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ItemMove, MaterialMove } from '@gamepark/rules-api';
|
|
2
|
+
import { PlayerEffectRule } from '../../material/entity/Effect';
|
|
3
|
+
import { RuleId } from '../RuleId';
|
|
4
|
+
export declare class ShivaEffectRule extends PlayerEffectRule {
|
|
5
|
+
ruleId: RuleId;
|
|
6
|
+
canPlayEffect(cardIndex: number): boolean;
|
|
7
|
+
onRuleStart(): MaterialMove[];
|
|
8
|
+
getPlayerMoves(): MaterialMove[];
|
|
9
|
+
afterItemMove(move: ItemMove): MaterialMove<number, number, number, number>[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
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 __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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.ShivaEffectRule = void 0;
|
|
44
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
45
|
+
var Effect_1 = require("../../material/entity/Effect");
|
|
46
|
+
var LocationType_1 = require("../../material/LocationType");
|
|
47
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
48
|
+
var Pantheon_1 = require("../../material/Pantheon");
|
|
49
|
+
var RuleId_1 = require("../RuleId");
|
|
50
|
+
var ShivaEffectRule = (function (_super) {
|
|
51
|
+
__extends(ShivaEffectRule, _super);
|
|
52
|
+
function ShivaEffectRule() {
|
|
53
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
54
|
+
_this.ruleId = RuleId_1.RuleId.ShivaEffect;
|
|
55
|
+
return _this;
|
|
56
|
+
}
|
|
57
|
+
ShivaEffectRule.prototype.canPlayEffect = function (cardIndex) {
|
|
58
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
|
|
59
|
+
var cards = pantheon.allCards;
|
|
60
|
+
var location = cards.getItem(cardIndex).location;
|
|
61
|
+
return pantheon.gems > 0 && cards.location(function (l) { return (0, rules_api_1.areAdjacentSquares)(l, location); }).length > 0;
|
|
62
|
+
};
|
|
63
|
+
ShivaEffectRule.prototype.onRuleStart = function () {
|
|
64
|
+
return [new Pantheon_1.Pantheon(this.game, this.player).spendGems(1)];
|
|
65
|
+
};
|
|
66
|
+
ShivaEffectRule.prototype.getPlayerMoves = function () {
|
|
67
|
+
var _this = this;
|
|
68
|
+
var location = this.card.location;
|
|
69
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
|
|
70
|
+
var piles = pantheon.getPiles(function (space) { return (0, rules_api_1.areAdjacentSquares)(space, location); });
|
|
71
|
+
return piles.map(function (pile) { return pile.moveItemsAtOnce({ type: LocationType_1.LocationType.PlayerDiscard, player: _this.player }); });
|
|
72
|
+
};
|
|
73
|
+
ShivaEffectRule.prototype.afterItemMove = function (move) {
|
|
74
|
+
if ((0, rules_api_1.isMoveItemTypeAtOnce)(MaterialType_1.MaterialType.EntityCard)(move) && move.location.type === LocationType_1.LocationType.PlayerDiscard) {
|
|
75
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
|
|
76
|
+
return __spreadArray([pantheon.gainFavor(move.indexes.length)], __read(this.endEffect()), false);
|
|
77
|
+
}
|
|
78
|
+
return [];
|
|
79
|
+
};
|
|
80
|
+
return ShivaEffectRule;
|
|
81
|
+
}(Effect_1.PlayerEffectRule));
|
|
82
|
+
exports.ShivaEffectRule = ShivaEffectRule;
|
|
@@ -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 SphinxEffectRule extends MoveEffectRule {
|
|
5
|
+
ruleId: RuleId;
|
|
6
|
+
getMovingCards(): Material;
|
|
7
|
+
isLegalDestination(space: XYCoordinates, cardLocation: Location): boolean;
|
|
8
|
+
onCardMoved(move: MoveItem): MaterialMove[];
|
|
9
|
+
}
|
|
@@ -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.SphinxEffectRule = void 0;
|
|
19
|
+
var MoveEffectRule_1 = require("../../material/entity/MoveEffectRule");
|
|
20
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
21
|
+
var Pantheon_1 = require("../../material/Pantheon");
|
|
22
|
+
var RuleId_1 = require("../RuleId");
|
|
23
|
+
var SphinxEffectRule = (function (_super) {
|
|
24
|
+
__extends(SphinxEffectRule, _super);
|
|
25
|
+
function SphinxEffectRule() {
|
|
26
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
27
|
+
_this.ruleId = RuleId_1.RuleId.SphinxEffect;
|
|
28
|
+
return _this;
|
|
29
|
+
}
|
|
30
|
+
SphinxEffectRule.prototype.getMovingCards = function () {
|
|
31
|
+
var cardIndex = this.getEffect().cardIndex;
|
|
32
|
+
var _a = this.card.location, x = _a.x, y = _a.y;
|
|
33
|
+
return new Pantheon_1.Pantheon(this.game, this.player).allCards
|
|
34
|
+
.location(function (l) { return l.x === x && l.y === y; })
|
|
35
|
+
.index(function (i) { return i !== cardIndex; })
|
|
36
|
+
.maxBy(function (item) { return item.location.z; });
|
|
37
|
+
};
|
|
38
|
+
SphinxEffectRule.prototype.isLegalDestination = function (space, cardLocation) {
|
|
39
|
+
return space.x === cardLocation.x;
|
|
40
|
+
};
|
|
41
|
+
SphinxEffectRule.prototype.onCardMoved = function (move) {
|
|
42
|
+
var entity = this.material(MaterialType_1.MaterialType.EntityCard).getItem(move.itemIndex).id.front;
|
|
43
|
+
return new Pantheon_1.Pantheon(this.game, this.player).getInvokeGains(entity, move.location.y).concat(this.endEffect());
|
|
44
|
+
};
|
|
45
|
+
return SphinxEffectRule;
|
|
46
|
+
}(MoveEffectRule_1.MoveEffectRule));
|
|
47
|
+
exports.SphinxEffectRule = SphinxEffectRule;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ItemMove, Material } from '@gamepark/rules-api';
|
|
2
|
+
import { SimultaneousSacrificeEffectRule } from '../../material/entity/SimultaneousSacrificeEffectRule';
|
|
3
|
+
import { PlayerColor } from '../../PlayerColor';
|
|
4
|
+
import { RuleId } from '../RuleId';
|
|
5
|
+
export declare class ThorEffectRule extends SimultaneousSacrificeEffectRule {
|
|
6
|
+
ruleId: RuleId;
|
|
7
|
+
getAffectedPlayers(): PlayerColor[];
|
|
8
|
+
getActivePlayerLegalMoves(player: PlayerColor): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
|
|
9
|
+
getCardsToSacrifice(player: PlayerColor): Material;
|
|
10
|
+
beforeItemMove(move: ItemMove): import("@gamepark/rules-api").EndPlayerTurn<number>[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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.ThorEffectRule = void 0;
|
|
19
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
20
|
+
var Entity_1 = require("../../material/Entity");
|
|
21
|
+
var SimultaneousSacrificeEffectRule_1 = require("../../material/entity/SimultaneousSacrificeEffectRule");
|
|
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 ThorEffectRule = (function (_super) {
|
|
27
|
+
__extends(ThorEffectRule, _super);
|
|
28
|
+
function ThorEffectRule() {
|
|
29
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
30
|
+
_this.ruleId = RuleId_1.RuleId.ThorEffect;
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
ThorEffectRule.prototype.getAffectedPlayers = function () {
|
|
34
|
+
var _this = this;
|
|
35
|
+
return _super.prototype.getAffectedPlayers.call(this).filter(function (player) { return _this.isOpponent(player); });
|
|
36
|
+
};
|
|
37
|
+
ThorEffectRule.prototype.getActivePlayerLegalMoves = function (player) {
|
|
38
|
+
var moves = _super.prototype.getActivePlayerLegalMoves.call(this, player);
|
|
39
|
+
var favor = this.material(MaterialType_1.MaterialType.FavorToken).location(LocationType_1.LocationType.PlayerFavor).player(player);
|
|
40
|
+
if (favor.getQuantity() >= 2 || (favor.getQuantity() === 1 && moves.length === 0)) {
|
|
41
|
+
moves.push(favor.deleteItem(2));
|
|
42
|
+
}
|
|
43
|
+
return moves;
|
|
44
|
+
};
|
|
45
|
+
ThorEffectRule.prototype.getCardsToSacrifice = function (player) {
|
|
46
|
+
return new Pantheon_1.Pantheon(this.game, player).visibleEntities.id(function (id) { return (0, Entity_1.isGod)(id.front); });
|
|
47
|
+
};
|
|
48
|
+
ThorEffectRule.prototype.beforeItemMove = function (move) {
|
|
49
|
+
if ((0, rules_api_1.isDeleteItemType)(MaterialType_1.MaterialType.FavorToken)(move)) {
|
|
50
|
+
return [this.endPlayerTurn(this.material(MaterialType_1.MaterialType.FavorToken).getItem(move.itemIndex).location.player)];
|
|
51
|
+
}
|
|
52
|
+
return [];
|
|
53
|
+
};
|
|
54
|
+
return ThorEffectRule;
|
|
55
|
+
}(SimultaneousSacrificeEffectRule_1.SimultaneousSacrificeEffectRule));
|
|
56
|
+
exports.ThorEffectRule = ThorEffectRule;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Material, MaterialRulesPart } from '@gamepark/rules-api';
|
|
2
|
+
import { PendingEffect, TriggerEvent } from '../../material/entity/Effect';
|
|
3
|
+
import { PlayerColor } from '../../PlayerColor';
|
|
4
|
+
export declare class TriggerEffectsRule extends MaterialRulesPart {
|
|
5
|
+
triggerEffects(...triggerEvents: TriggerEvent[]): void;
|
|
6
|
+
triggerPlayerEffects(player: PlayerColor, ...triggerEvents: TriggerEvent[]): void;
|
|
7
|
+
getPlayerEffects(player: PlayerColor, ...triggerEvents: TriggerEvent[]): PendingEffect<TriggerEvent>[];
|
|
8
|
+
triggerCardEffect(card: Material, triggerEvent: TriggerEvent): void;
|
|
9
|
+
getCardEffect(card: Material, triggerEvent: TriggerEvent): PendingEffect[];
|
|
10
|
+
private getPlayersByEffectPriorityOrder;
|
|
11
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
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
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
29
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
30
|
+
if (!m) return o;
|
|
31
|
+
var i = m.call(o), r, ar = [], e;
|
|
32
|
+
try {
|
|
33
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
34
|
+
}
|
|
35
|
+
catch (error) { e = { error: error }; }
|
|
36
|
+
finally {
|
|
37
|
+
try {
|
|
38
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
39
|
+
}
|
|
40
|
+
finally { if (e) throw e.error; }
|
|
41
|
+
}
|
|
42
|
+
return ar;
|
|
43
|
+
};
|
|
44
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
45
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
46
|
+
if (ar || !(i in from)) {
|
|
47
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
48
|
+
ar[i] = from[i];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.TriggerEffectsRule = void 0;
|
|
55
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
56
|
+
var EntityDescription_1 = require("../../material/entity/EntityDescription");
|
|
57
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
58
|
+
var Pantheon_1 = require("../../material/Pantheon");
|
|
59
|
+
var Memory_1 = require("../../Memory");
|
|
60
|
+
var TriggerEffectsRule = (function (_super) {
|
|
61
|
+
__extends(TriggerEffectsRule, _super);
|
|
62
|
+
function TriggerEffectsRule() {
|
|
63
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
64
|
+
}
|
|
65
|
+
TriggerEffectsRule.prototype.triggerEffects = function () {
|
|
66
|
+
var e_1, _a;
|
|
67
|
+
var triggerEvents = [];
|
|
68
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
69
|
+
triggerEvents[_i] = arguments[_i];
|
|
70
|
+
}
|
|
71
|
+
var players = this.getPlayersByEffectPriorityOrder();
|
|
72
|
+
try {
|
|
73
|
+
for (var _b = __values(players.reverse()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
74
|
+
var player = _c.value;
|
|
75
|
+
this.triggerPlayerEffects.apply(this, __spreadArray([player], __read(triggerEvents), false));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
79
|
+
finally {
|
|
80
|
+
try {
|
|
81
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
82
|
+
}
|
|
83
|
+
finally { if (e_1) throw e_1.error; }
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
TriggerEffectsRule.prototype.triggerPlayerEffects = function (player) {
|
|
87
|
+
var triggerEvents = [];
|
|
88
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
89
|
+
triggerEvents[_i - 1] = arguments[_i];
|
|
90
|
+
}
|
|
91
|
+
var pendingEffects = this.getPlayerEffects.apply(this, __spreadArray([player], __read(triggerEvents), false));
|
|
92
|
+
if (pendingEffects.length) {
|
|
93
|
+
this.remind(Memory_1.Memory.PendingEffects).unshift(pendingEffects);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
TriggerEffectsRule.prototype.getPlayerEffects = function (player) {
|
|
97
|
+
var e_2, _a, e_3, _b;
|
|
98
|
+
var triggerEvents = [];
|
|
99
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
100
|
+
triggerEvents[_i - 1] = arguments[_i];
|
|
101
|
+
}
|
|
102
|
+
var pendingEffects = [];
|
|
103
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, player);
|
|
104
|
+
var cards = pantheon.visibleEntities;
|
|
105
|
+
try {
|
|
106
|
+
for (var triggerEvents_1 = __values(triggerEvents), triggerEvents_1_1 = triggerEvents_1.next(); !triggerEvents_1_1.done; triggerEvents_1_1 = triggerEvents_1.next()) {
|
|
107
|
+
var triggerEvent = triggerEvents_1_1.value;
|
|
108
|
+
try {
|
|
109
|
+
for (var _c = (e_3 = void 0, __values(cards.getIndexes())), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
110
|
+
var cardIndex = _d.value;
|
|
111
|
+
pendingEffects.push.apply(pendingEffects, __spreadArray([], __read(this.getCardEffect(cards.index(cardIndex), triggerEvent)), false));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
115
|
+
finally {
|
|
116
|
+
try {
|
|
117
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
118
|
+
}
|
|
119
|
+
finally { if (e_3) throw e_3.error; }
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
124
|
+
finally {
|
|
125
|
+
try {
|
|
126
|
+
if (triggerEvents_1_1 && !triggerEvents_1_1.done && (_a = triggerEvents_1.return)) _a.call(triggerEvents_1);
|
|
127
|
+
}
|
|
128
|
+
finally { if (e_2) throw e_2.error; }
|
|
129
|
+
}
|
|
130
|
+
return pendingEffects;
|
|
131
|
+
};
|
|
132
|
+
TriggerEffectsRule.prototype.triggerCardEffect = function (card, triggerEvent) {
|
|
133
|
+
var pendingEffects = this.getCardEffect(card, triggerEvent);
|
|
134
|
+
if (pendingEffects.length) {
|
|
135
|
+
this.remind(Memory_1.Memory.PendingEffects).unshift(pendingEffects);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
TriggerEffectsRule.prototype.getCardEffect = function (card, triggerEvent) {
|
|
139
|
+
var pendingEffects = [];
|
|
140
|
+
var cardIndex = card.getIndex();
|
|
141
|
+
var cardItem = card.getItem();
|
|
142
|
+
var effects = cardItem.id.front ? (0, EntityDescription_1.getEffects)(cardItem.id.front) : [];
|
|
143
|
+
for (var effectIndex = 0; effectIndex < effects.length; effectIndex++) {
|
|
144
|
+
var effect = effects[effectIndex];
|
|
145
|
+
if (effect.trigger(triggerEvent, card, this.game)) {
|
|
146
|
+
pendingEffects.push({ cardIndex: cardIndex, effectIndex: effectIndex, triggerEvent: triggerEvent });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return pendingEffects;
|
|
150
|
+
};
|
|
151
|
+
TriggerEffectsRule.prototype.getPlayersByEffectPriorityOrder = function () {
|
|
152
|
+
var _a, _b;
|
|
153
|
+
var firstPlayer = (_b = (_a = this.game.rule) === null || _a === void 0 ? void 0 : _a.player) !== null && _b !== void 0 ? _b : this.material(MaterialType_1.MaterialType.FirstPlayerToken).getItem().location.player;
|
|
154
|
+
var index = this.game.players.indexOf(firstPlayer);
|
|
155
|
+
return this.game.players.slice(index).concat(this.game.players.slice(0, index));
|
|
156
|
+
};
|
|
157
|
+
return TriggerEffectsRule;
|
|
158
|
+
}(rules_api_1.MaterialRulesPart));
|
|
159
|
+
exports.TriggerEffectsRule = TriggerEffectsRule;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MaterialItem, MaterialMove } from '@gamepark/rules-api';
|
|
2
|
+
import { MoveEffectRule } from '../../material/entity/MoveEffectRule';
|
|
3
|
+
import { RuleId } from '../RuleId';
|
|
4
|
+
export declare class VetalaEffectRule extends MoveEffectRule {
|
|
5
|
+
ruleId: RuleId;
|
|
6
|
+
onRuleStart(): MaterialMove[];
|
|
7
|
+
getPlayerMoves(): MaterialMove<number, number, number, number>[];
|
|
8
|
+
getAvailableDestinations(card: MaterialItem, cardIndex: number): import("@gamepark/rules-api").XYCoordinates[];
|
|
9
|
+
onCardMoved(): MaterialMove[];
|
|
10
|
+
onRuleEnd(): never[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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.VetalaEffectRule = void 0;
|
|
19
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
20
|
+
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
21
|
+
var MoveEffectRule_1 = require("../../material/entity/MoveEffectRule");
|
|
22
|
+
var LocationType_1 = require("../../material/LocationType");
|
|
23
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
24
|
+
var Memory_1 = require("../../Memory");
|
|
25
|
+
var RuleId_1 = require("../RuleId");
|
|
26
|
+
var VetalaEffectRule = (function (_super) {
|
|
27
|
+
__extends(VetalaEffectRule, _super);
|
|
28
|
+
function VetalaEffectRule() {
|
|
29
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
30
|
+
_this.ruleId = RuleId_1.RuleId.VetalaEffect;
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
VetalaEffectRule.prototype.onRuleStart = function () {
|
|
34
|
+
var entitiesSacrificed = this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.PlayerDiscard).player(this.player).length;
|
|
35
|
+
if (entitiesSacrificed) {
|
|
36
|
+
this.memorize(Memory_1.Memory.VetalaCount, entitiesSacrificed);
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return this.endEffect();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
VetalaEffectRule.prototype.getPlayerMoves = function () {
|
|
44
|
+
return _super.prototype.getPlayerMoves.call(this).concat(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
|
|
45
|
+
};
|
|
46
|
+
VetalaEffectRule.prototype.getAvailableDestinations = function (card, cardIndex) {
|
|
47
|
+
return _super.prototype.getAvailableDestinations.call(this, card, cardIndex).filter(function (space) { return (0, rules_api_1.areAdjacentSquares)(card.location, space); });
|
|
48
|
+
};
|
|
49
|
+
VetalaEffectRule.prototype.onCardMoved = function () {
|
|
50
|
+
var count = this.memorize(Memory_1.Memory.VetalaCount, function (count) { return count - 1; });
|
|
51
|
+
return count > 0 ? [] : this.endEffect();
|
|
52
|
+
};
|
|
53
|
+
VetalaEffectRule.prototype.onRuleEnd = function () {
|
|
54
|
+
this.forget(Memory_1.Memory.VetalaCount);
|
|
55
|
+
return [];
|
|
56
|
+
};
|
|
57
|
+
return VetalaEffectRule;
|
|
58
|
+
}(MoveEffectRule_1.MoveEffectRule));
|
|
59
|
+
exports.VetalaEffectRule = VetalaEffectRule;
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gamepark/mythologies",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The rules of Mythologies adapted for Game Park",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"author": "Romain Fromi <romain@game-park.com> (https://game-park.com/)",
|
|
12
|
+
"license": "ISC",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"prepublishOnly": "tsc",
|
|
19
|
+
"publish": "lerna publish",
|
|
20
|
+
"lint": "eslint --fix"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@gamepark/rules-api": ">=6.36.7",
|
|
24
|
+
"lodash": ">=4.17"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@gamepark/rules-api": "~6.36.7",
|
|
28
|
+
"@types/lodash": "^4.17.7",
|
|
29
|
+
"i18next": "^22.0.3",
|
|
30
|
+
"lodash": "^4.17.21"
|
|
31
|
+
},
|
|
32
|
+
"gitHead": "58603385bd3898b027d4ad792b8740ad85575519"
|
|
33
|
+
}
|