@gamepark/mythologies 0.4.1 → 0.5.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 +6 -11
- package/dist/Memory.js +6 -11
- package/dist/MythologiesRules.d.ts +41 -33
- package/dist/MythologiesRules.js +8 -0
- package/dist/MythologiesSetup.js +1 -1
- package/dist/material/Mythology.d.ts +0 -1
- package/dist/material/Mythology.js +1 -3
- package/dist/material/Pantheon.d.ts +1 -0
- package/dist/material/Pantheon.js +8 -2
- package/dist/material/entity/Effect.d.ts +9 -8
- package/dist/material/entity/Effect.js +5 -8
- package/dist/material/entity/MoveEffectRule.d.ts +4 -1
- package/dist/material/entity/MoveEffectRule.js +24 -5
- package/dist/material/entity/PlaceCardEffectRule.js +4 -27
- package/dist/material/entity/SacrificeEffectRule.d.ts +1 -1
- package/dist/material/entity/SacrificeEffectRule.js +2 -1
- package/dist/material/entity/SimultaneousMoveEffectRule.d.ts +8 -2
- package/dist/material/entity/SimultaneousMoveEffectRule.js +34 -6
- package/dist/material/entity/celtic/Dullahan.js +7 -1
- package/dist/material/entity/celtic/Leprechaun.js +7 -1
- package/dist/material/entity/celtic/Selkie.js +12 -1
- package/dist/material/entity/chinese/ChangE.js +5 -4
- package/dist/material/entity/greek/Poseidon.js +2 -2
- package/dist/rules/PlaceTokenRule.js +1 -1
- package/dist/rules/RuleId.d.ts +37 -33
- package/dist/rules/RuleId.js +37 -33
- package/dist/rules/effects/AnubisEffectRule.js +3 -3
- package/dist/rules/effects/CentaurEffectRule.d.ts +5 -3
- package/dist/rules/effects/CentaurEffectRule.js +64 -16
- package/dist/rules/effects/CondorEffectRule.d.ts +1 -1
- package/dist/rules/effects/CondorEffectRule.js +5 -1
- package/dist/rules/effects/DullahanEffectRule.d.ts +11 -0
- package/dist/rules/effects/DullahanEffectRule.js +73 -0
- package/dist/rules/effects/FairyEffectRule.js +4 -4
- package/dist/rules/effects/FenrirEffectRule.js +5 -4
- package/dist/rules/effects/GarudaEffectRule.d.ts +1 -1
- package/dist/rules/effects/GarudaEffectRule.js +6 -5
- package/dist/rules/effects/GorgonEffectRule.d.ts +1 -1
- package/dist/rules/effects/GorgonEffectRule.js +2 -26
- package/dist/rules/effects/HadesEffectRule.d.ts +8 -4
- package/dist/rules/effects/HadesEffectRule.js +12 -50
- package/dist/rules/effects/IdloziEffectRule.d.ts +2 -2
- package/dist/rules/effects/IdloziEffectRule.js +4 -1
- package/dist/rules/effects/IllapaEffectRule.d.ts +1 -1
- package/dist/rules/effects/IllapaEffectRule.js +3 -3
- package/dist/rules/effects/InkosazanaEffectRule.js +3 -3
- package/dist/rules/effects/JiangshiEffectRule.d.ts +1 -1
- package/dist/rules/effects/JiangshiEffectRule.js +2 -26
- package/dist/rules/effects/LeprechaunEffectRule.d.ts +9 -0
- package/dist/rules/effects/LeprechaunEffectRule.js +49 -0
- package/dist/rules/effects/MultipleSimultaneousMoveEffectRule.d.ts +13 -0
- package/dist/rules/effects/MultipleSimultaneousMoveEffectRule.js +160 -0
- package/dist/rules/effects/NuwaEffectRule.js +4 -4
- package/dist/rules/effects/OdinEffectRule.js +2 -2
- package/dist/rules/effects/RaEffectRule.d.ts +8 -4
- package/dist/rules/effects/RaEffectRule.js +12 -50
- package/dist/rules/effects/SelkieEffectRule.d.ts +8 -0
- package/dist/rules/effects/SelkieEffectRule.js +44 -0
- package/dist/rules/effects/ShivaEffectRule.d.ts +2 -2
- package/dist/rules/effects/ShivaEffectRule.js +8 -32
- package/dist/rules/effects/SphinxEffectRule.d.ts +2 -2
- package/dist/rules/effects/SphinxEffectRule.js +4 -1
- package/dist/rules/effects/TianlongEffectRule.d.ts +2 -3
- package/dist/rules/effects/TianlongEffectRule.js +36 -42
- package/dist/rules/effects/TriggerEffectsRule.js +3 -0
- package/dist/rules/effects/VetalaEffectRule.d.ts +3 -2
- package/dist/rules/effects/VetalaEffectRule.js +10 -5
- package/dist/rules/effects/ViracochaEffectRule.d.ts +1 -1
- package/dist/rules/effects/ViracochaEffectRule.js +2 -26
- package/dist/rules/effects/YanluoWangEffectRule.js +3 -3
- package/package.json +2 -2
|
@@ -14,64 +14,26 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
-
var __values = (this && this.__values) || function(o) {
|
|
18
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
19
|
-
if (m) return m.call(o);
|
|
20
|
-
if (o && typeof o.length === "number") return {
|
|
21
|
-
next: function () {
|
|
22
|
-
if (o && i >= o.length) o = void 0;
|
|
23
|
-
return { value: o && o[i++], done: !o };
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
27
|
-
};
|
|
28
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
18
|
exports.RaEffectRule = void 0;
|
|
30
19
|
var Entity_1 = require("../../material/Entity");
|
|
31
|
-
var SimultaneousMoveEffectRule_1 = require("../../material/entity/SimultaneousMoveEffectRule");
|
|
32
|
-
var LocationType_1 = require("../../material/LocationType");
|
|
33
20
|
var Pantheon_1 = require("../../material/Pantheon");
|
|
21
|
+
var RuleId_1 = require("../RuleId");
|
|
22
|
+
var MultipleSimultaneousMoveEffectRule_1 = require("./MultipleSimultaneousMoveEffectRule");
|
|
34
23
|
var RaEffectRule = (function (_super) {
|
|
35
24
|
__extends(RaEffectRule, _super);
|
|
36
25
|
function RaEffectRule() {
|
|
37
|
-
|
|
26
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
27
|
+
_this.ruleId = RuleId_1.RuleId.RaEffect;
|
|
28
|
+
return _this;
|
|
38
29
|
}
|
|
39
|
-
RaEffectRule.prototype.
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var pantheon = new Pantheon_1.Pantheon(this.game, player);
|
|
46
|
-
var entities = pantheon.visibleEntities;
|
|
47
|
-
try {
|
|
48
|
-
for (var _e = (e_2 = void 0, __values(entities.getIndexes())), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
49
|
-
var index = _f.value;
|
|
50
|
-
var entity = entities.getItem(index);
|
|
51
|
-
var _g = entity.location, x = _g.x, y = _g.y;
|
|
52
|
-
if (y !== 0 && !(0, Entity_1.isGod)(entity.id.front) && pantheon.isFreeSpace({ x: x, y: y - 1 })) {
|
|
53
|
-
moves.push(entities.index(index).moveItem({ type: LocationType_1.LocationType.Pantheon, player: player, x: x, y: y - 1 }));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
58
|
-
finally {
|
|
59
|
-
try {
|
|
60
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
61
|
-
}
|
|
62
|
-
finally { if (e_2) throw e_2.error; }
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
67
|
-
finally {
|
|
68
|
-
try {
|
|
69
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
70
|
-
}
|
|
71
|
-
finally { if (e_1) throw e_1.error; }
|
|
72
|
-
}
|
|
73
|
-
return moves;
|
|
30
|
+
RaEffectRule.prototype.getTargetEntities = function (player) {
|
|
31
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, player);
|
|
32
|
+
return pantheon.visibleEntities.id(function (id) { return !(0, Entity_1.isGod)(id.front); }).location(function (l) { return l.y > 0 && pantheon.isFreeSpace({ x: l.x, y: l.y - 1 }); });
|
|
33
|
+
};
|
|
34
|
+
RaEffectRule.prototype.isLegalDestination = function (space, cardLocation) {
|
|
35
|
+
return cardLocation.x === space.x && cardLocation.y === space.y + 1;
|
|
74
36
|
};
|
|
75
37
|
return RaEffectRule;
|
|
76
|
-
}(
|
|
38
|
+
}(MultipleSimultaneousMoveEffectRule_1.MultipleSimultaneousMoveEffectRule));
|
|
77
39
|
exports.RaEffectRule = RaEffectRule;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ItemMove } from '@gamepark/rules-api';
|
|
2
|
+
import { PlayerEffectRule } from '../../material/entity/Effect';
|
|
3
|
+
import { RuleId } from '../RuleId';
|
|
4
|
+
export declare class SelkieEffectRule extends PlayerEffectRule {
|
|
5
|
+
ruleId: RuleId;
|
|
6
|
+
getPlayerMoves(): import("@gamepark/rules-api").CreateItem<number, number, number>[];
|
|
7
|
+
afterItemMove(move: ItemMove): import("@gamepark/rules-api").CustomMove<number>[];
|
|
8
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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.SelkieEffectRule = void 0;
|
|
19
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
20
|
+
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
21
|
+
var Effect_1 = require("../../material/entity/Effect");
|
|
22
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
23
|
+
var Pantheon_1 = require("../../material/Pantheon");
|
|
24
|
+
var RuleId_1 = require("../RuleId");
|
|
25
|
+
var SelkieEffectRule = (function (_super) {
|
|
26
|
+
__extends(SelkieEffectRule, _super);
|
|
27
|
+
function SelkieEffectRule() {
|
|
28
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
29
|
+
_this.ruleId = RuleId_1.RuleId.SelkieEffect;
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
SelkieEffectRule.prototype.getPlayerMoves = function () {
|
|
33
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
|
|
34
|
+
return [pantheon.gainFavor(1), pantheon.gainGems(1)];
|
|
35
|
+
};
|
|
36
|
+
SelkieEffectRule.prototype.afterItemMove = function (move) {
|
|
37
|
+
if ((0, rules_api_1.isCreateItemType)(MaterialType_1.MaterialType.GemToken)(move) || (0, rules_api_1.isCreateItemType)(MaterialType_1.MaterialType.FavorToken)(move)) {
|
|
38
|
+
return [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
39
|
+
}
|
|
40
|
+
return [];
|
|
41
|
+
};
|
|
42
|
+
return SelkieEffectRule;
|
|
43
|
+
}(Effect_1.PlayerEffectRule));
|
|
44
|
+
exports.SelkieEffectRule = SelkieEffectRule;
|
|
@@ -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(
|
|
9
|
-
beforeItemMove(move: ItemMove):
|
|
8
|
+
getPlayerMoves(cardIndex?: number): import("@gamepark/rules-api").MoveItemsAtOnce<number, number, number>[];
|
|
9
|
+
beforeItemMove(move: ItemMove): (import("@gamepark/rules-api").CustomMove<number> | import("@gamepark/rules-api").CreateItem<number, number, number>)[];
|
|
10
10
|
}
|
|
@@ -14,34 +14,10 @@ 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.ShivaEffectRule = void 0;
|
|
44
19
|
var rules_api_1 = require("@gamepark/rules-api");
|
|
20
|
+
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
45
21
|
var Effect_1 = require("../../material/entity/Effect");
|
|
46
22
|
var LocationType_1 = require("../../material/LocationType");
|
|
47
23
|
var MaterialType_1 = require("../../material/MaterialType");
|
|
@@ -58,20 +34,20 @@ var ShivaEffectRule = (function (_super) {
|
|
|
58
34
|
ShivaEffectRule.prototype.canPlayEffect = function (cardIndex) {
|
|
59
35
|
var player = this.material(MaterialType_1.MaterialType.EntityCard).getItem(cardIndex).location.player;
|
|
60
36
|
var pantheon = new Pantheon_1.Pantheon(this.game, player);
|
|
61
|
-
return pantheon.gems > 0 && this.getPlayerMoves(
|
|
37
|
+
return pantheon.gems > 0 && this.getPlayerMoves(cardIndex).length > 0;
|
|
62
38
|
};
|
|
63
39
|
ShivaEffectRule.prototype.onRuleStart = function () {
|
|
64
40
|
return [new Pantheon_1.Pantheon(this.game, this.player).spendGems(1)];
|
|
65
41
|
};
|
|
66
|
-
ShivaEffectRule.prototype.getPlayerMoves = function (
|
|
67
|
-
if (
|
|
68
|
-
var location = this.
|
|
69
|
-
var pantheon = new Pantheon_1.Pantheon(this.game, player);
|
|
42
|
+
ShivaEffectRule.prototype.getPlayerMoves = function (cardIndex) {
|
|
43
|
+
if (cardIndex === void 0) { cardIndex = this.getEffect().cardIndex; }
|
|
44
|
+
var location = this.material(MaterialType_1.MaterialType.EntityCard).getItem(cardIndex).location;
|
|
45
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, location.player);
|
|
70
46
|
var rule = new PermanentEffectsRule_1.PermanentEffectsRule(this.game);
|
|
71
47
|
var piles = pantheon
|
|
72
48
|
.getPiles(function (space) { return (0, rules_api_1.areAdjacentSquares)(space, location); })
|
|
73
49
|
.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 }); });
|
|
50
|
+
return piles.map(function (pile) { return pile.moveItemsAtOnce({ type: LocationType_1.LocationType.PlayerDiscard, player: location.player }); });
|
|
75
51
|
};
|
|
76
52
|
ShivaEffectRule.prototype.beforeItemMove = function (move) {
|
|
77
53
|
if ((0, rules_api_1.isMoveItemTypeAtOnce)(MaterialType_1.MaterialType.EntityCard)(move) && move.location.type === LocationType_1.LocationType.PlayerDiscard) {
|
|
@@ -80,7 +56,7 @@ var ShivaEffectRule = (function (_super) {
|
|
|
80
56
|
.index(move.indexes)
|
|
81
57
|
.maxBy(function (item) { return item.location.z; });
|
|
82
58
|
pantheon.onEntitySacrificed(topCard);
|
|
83
|
-
return
|
|
59
|
+
return [pantheon.gainFavor(move.indexes.length), this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
84
60
|
}
|
|
85
61
|
return [];
|
|
86
62
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Location, Material,
|
|
1
|
+
import { Location, Material, MoveItem, XYCoordinates } from '@gamepark/rules-api';
|
|
2
2
|
import { MoveEffectRule } from '../../material/entity/MoveEffectRule';
|
|
3
3
|
import { RuleId } from '../RuleId';
|
|
4
4
|
export declare class SphinxEffectRule extends MoveEffectRule {
|
|
5
5
|
ruleId: RuleId;
|
|
6
6
|
getMovingCards(): Material;
|
|
7
7
|
isLegalDestination(space: XYCoordinates, cardLocation: Location): boolean;
|
|
8
|
-
onCardMoved(move: MoveItem): MaterialMove[];
|
|
8
|
+
onCardMoved(move: MoveItem): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
|
|
9
9
|
}
|
|
@@ -16,6 +16,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.SphinxEffectRule = void 0;
|
|
19
|
+
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
19
20
|
var MoveEffectRule_1 = require("../../material/entity/MoveEffectRule");
|
|
20
21
|
var MaterialType_1 = require("../../material/MaterialType");
|
|
21
22
|
var Pantheon_1 = require("../../material/Pantheon");
|
|
@@ -36,7 +37,9 @@ var SphinxEffectRule = (function (_super) {
|
|
|
36
37
|
};
|
|
37
38
|
SphinxEffectRule.prototype.onCardMoved = function (move) {
|
|
38
39
|
var entity = this.material(MaterialType_1.MaterialType.EntityCard).getItem(move.itemIndex).id.front;
|
|
39
|
-
|
|
40
|
+
var moves = new Pantheon_1.Pantheon(this.game, this.player).getInvokeGains(entity, move.location.y);
|
|
41
|
+
moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
|
|
42
|
+
return moves;
|
|
40
43
|
};
|
|
41
44
|
return SphinxEffectRule;
|
|
42
45
|
}(MoveEffectRule_1.MoveEffectRule));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MaterialMove, MoveItem, XYCoordinates } from '@gamepark/rules-api';
|
|
2
2
|
import { MoveEffectRule } from '../../material/entity/MoveEffectRule';
|
|
3
3
|
import { SimultaneousMoveEffectRule } from '../../material/entity/SimultaneousMoveEffectRule';
|
|
4
4
|
import { PlayerColor } from '../../PlayerColor';
|
|
@@ -6,8 +6,7 @@ import { RuleId } from '../RuleId';
|
|
|
6
6
|
export declare class TianlongEffectRule extends MoveEffectRule {
|
|
7
7
|
ruleId: RuleId;
|
|
8
8
|
getPlayerMoves(): MaterialMove<number, number, number, number>[];
|
|
9
|
-
|
|
10
|
-
onCardMoved(): never[];
|
|
9
|
+
onCardMoved(move: MoveItem): MaterialMove<number, number, number, number>[];
|
|
11
10
|
}
|
|
12
11
|
export declare class TianlongOpponentsEffectRule extends SimultaneousMoveEffectRule {
|
|
13
12
|
getAffectedPlayers(): number[];
|
|
@@ -52,7 +52,6 @@ var __values = (this && this.__values) || function(o) {
|
|
|
52
52
|
};
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
54
|
exports.TianlongOpponentsEffectRule = exports.TianlongEffectRule = void 0;
|
|
55
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
56
55
|
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
57
56
|
var MoveEffectRule_1 = require("../../material/entity/MoveEffectRule");
|
|
58
57
|
var SimultaneousMoveEffectRule_1 = require("../../material/entity/SimultaneousMoveEffectRule");
|
|
@@ -74,50 +73,44 @@ var TianlongEffectRule = (function (_super) {
|
|
|
74
73
|
}
|
|
75
74
|
return moves;
|
|
76
75
|
};
|
|
77
|
-
TianlongEffectRule.prototype.
|
|
76
|
+
TianlongEffectRule.prototype.onCardMoved = function (move) {
|
|
78
77
|
var e_1, _a;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
moves.push(legalMoves[0]);
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
playersWithChoice.push(player);
|
|
98
|
-
}
|
|
78
|
+
var _b = this.material(MaterialType_1.MaterialType.EntityCard).getItem(move.itemIndex).location, x = _b.x, y = _b.y;
|
|
79
|
+
this.memorize(Memory_1.Memory.TargetLocations, [
|
|
80
|
+
{ x: x, y: y },
|
|
81
|
+
{ x: move.location.x, y: move.location.y }
|
|
82
|
+
]);
|
|
83
|
+
var opponentsEffectRule = new TianlongOpponentsEffectRule(this.game);
|
|
84
|
+
var affectedPlayers = opponentsEffectRule.getAffectedPlayers();
|
|
85
|
+
var playersWithChoice = [];
|
|
86
|
+
var moves = [new Pantheon_1.Pantheon(this.game, this.player).spendGems(1)];
|
|
87
|
+
try {
|
|
88
|
+
for (var affectedPlayers_1 = __values(affectedPlayers), affectedPlayers_1_1 = affectedPlayers_1.next(); !affectedPlayers_1_1.done; affectedPlayers_1_1 = affectedPlayers_1.next()) {
|
|
89
|
+
var player = affectedPlayers_1_1.value;
|
|
90
|
+
var legalMoves = opponentsEffectRule.getActivePlayerLegalMoves(player);
|
|
91
|
+
if (legalMoves.length === 1) {
|
|
92
|
+
moves.push(legalMoves[0]);
|
|
99
93
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
finally {
|
|
103
|
-
try {
|
|
104
|
-
if (affectedPlayers_1_1 && !affectedPlayers_1_1.done && (_a = affectedPlayers_1.return)) _a.call(affectedPlayers_1);
|
|
94
|
+
else {
|
|
95
|
+
playersWithChoice.push(player);
|
|
105
96
|
}
|
|
106
|
-
finally { if (e_1) throw e_1.error; }
|
|
107
97
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
moves.push.apply(moves, __spreadArray([], __read(this.endEffect()), false));
|
|
98
|
+
}
|
|
99
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
100
|
+
finally {
|
|
101
|
+
try {
|
|
102
|
+
if (affectedPlayers_1_1 && !affectedPlayers_1_1.done && (_a = affectedPlayers_1.return)) _a.call(affectedPlayers_1);
|
|
114
103
|
}
|
|
115
|
-
|
|
104
|
+
finally { if (e_1) throw e_1.error; }
|
|
116
105
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
106
|
+
if (playersWithChoice.length) {
|
|
107
|
+
moves.push(this.startSimultaneousRule(RuleId_1.RuleId.TianlongOpponentsEffect, playersWithChoice));
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this.forget(Memory_1.Memory.TargetLocations);
|
|
111
|
+
moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
|
|
112
|
+
}
|
|
113
|
+
return moves;
|
|
121
114
|
};
|
|
122
115
|
return TianlongEffectRule;
|
|
123
116
|
}(MoveEffectRule_1.MoveEffectRule));
|
|
@@ -132,15 +125,16 @@ var TianlongOpponentsEffectRule = (function (_super) {
|
|
|
132
125
|
return this.game.players.filter(function (player) { return _this.isOpponent(player) && _this.getActivePlayerLegalMoves(player).length > 0; });
|
|
133
126
|
};
|
|
134
127
|
TianlongOpponentsEffectRule.prototype.getMovingCards = function (player) {
|
|
135
|
-
var _a = this.remind(Memory_1.Memory.
|
|
128
|
+
var _a = this.remind(Memory_1.Memory.TargetLocations)[0], x = _a.x, y = _a.y;
|
|
136
129
|
return _super.prototype.getMovingCards.call(this, player).location(function (l) { return l.x === x && l.y === y; });
|
|
137
130
|
};
|
|
138
131
|
TianlongOpponentsEffectRule.prototype.isLegalDestination = function (space) {
|
|
139
|
-
var _a = this.remind(Memory_1.Memory.
|
|
132
|
+
var _a = this.remind(Memory_1.Memory.TargetLocations)[1], x = _a.x, y = _a.y;
|
|
140
133
|
return space.x === x && space.y === y;
|
|
141
134
|
};
|
|
142
135
|
TianlongOpponentsEffectRule.prototype.onRuleEnd = function () {
|
|
143
|
-
this.forget(Memory_1.Memory.
|
|
136
|
+
this.forget(Memory_1.Memory.EntityMoved);
|
|
137
|
+
this.forget(Memory_1.Memory.TargetLocations);
|
|
144
138
|
return [];
|
|
145
139
|
};
|
|
146
140
|
return TianlongOpponentsEffectRule;
|
|
@@ -110,6 +110,9 @@ var TriggerEffectsRule = (function (_super) {
|
|
|
110
110
|
if (event.type === Effect_1.TriggerEventType.EntityCrushed && material.getItem(event.cardIndex).location.player === player && !cards.includes(event.cardIndex)) {
|
|
111
111
|
cards.push(event.cardIndex);
|
|
112
112
|
}
|
|
113
|
+
if (event.type === Effect_1.TriggerEventType.EntityPlaced && event.location.player === player && !cards.includes(event.cardIndex)) {
|
|
114
|
+
cards.push(event.cardIndex);
|
|
115
|
+
}
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
118
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MaterialItem, MaterialMove } from '@gamepark/rules-api';
|
|
1
|
+
import { MaterialItem, MaterialMove, MoveItem } from '@gamepark/rules-api';
|
|
2
2
|
import { MoveEffectRule } from '../../material/entity/MoveEffectRule';
|
|
3
3
|
import { RuleId } from '../RuleId';
|
|
4
4
|
export declare class VetalaEffectRule extends MoveEffectRule {
|
|
@@ -6,6 +6,7 @@ export declare class VetalaEffectRule extends MoveEffectRule {
|
|
|
6
6
|
onRuleStart(): MaterialMove[];
|
|
7
7
|
getPlayerMoves(): MaterialMove<number, number, number, number>[];
|
|
8
8
|
getAvailableDestinations(card: MaterialItem, cardIndex: number): import("@gamepark/rules-api").XYCoordinates[];
|
|
9
|
-
onCardMoved():
|
|
9
|
+
onCardMoved(): import("@gamepark/rules-api").CustomMove<number>[];
|
|
10
|
+
onCardSacrificed(move: MoveItem): import("@gamepark/rules-api").CustomMove<number>[];
|
|
10
11
|
onRuleEnd(): never[];
|
|
11
12
|
}
|
|
@@ -33,11 +33,11 @@ var VetalaEffectRule = (function (_super) {
|
|
|
33
33
|
VetalaEffectRule.prototype.onRuleStart = function () {
|
|
34
34
|
var entitiesSacrificed = this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.PlayerDiscard).player(this.player).length;
|
|
35
35
|
if (entitiesSacrificed) {
|
|
36
|
-
this.memorize(Memory_1.Memory.
|
|
36
|
+
this.memorize(Memory_1.Memory.EffectCount, entitiesSacrificed);
|
|
37
37
|
return [];
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
-
return this.
|
|
40
|
+
return [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
VetalaEffectRule.prototype.getPlayerMoves = function () {
|
|
@@ -47,11 +47,16 @@ var VetalaEffectRule = (function (_super) {
|
|
|
47
47
|
return _super.prototype.getAvailableDestinations.call(this, card, cardIndex).filter(function (space) { return (0, rules_api_1.areAdjacentSquares)(card.location, space); });
|
|
48
48
|
};
|
|
49
49
|
VetalaEffectRule.prototype.onCardMoved = function () {
|
|
50
|
-
var count = this.memorize(Memory_1.Memory.
|
|
51
|
-
return count > 0 ? [] : this.
|
|
50
|
+
var count = this.memorize(Memory_1.Memory.EffectCount, function (count) { return count - 1; });
|
|
51
|
+
return count > 0 ? [] : [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
52
|
+
};
|
|
53
|
+
VetalaEffectRule.prototype.onCardSacrificed = function (move) {
|
|
54
|
+
_super.prototype.onCardSacrificed.call(this, move);
|
|
55
|
+
return this.onCardMoved();
|
|
52
56
|
};
|
|
53
57
|
VetalaEffectRule.prototype.onRuleEnd = function () {
|
|
54
|
-
this.forget(Memory_1.Memory.
|
|
58
|
+
this.forget(Memory_1.Memory.EntityMoved);
|
|
59
|
+
this.forget(Memory_1.Memory.EffectCount);
|
|
55
60
|
return [];
|
|
56
61
|
};
|
|
57
62
|
return VetalaEffectRule;
|
|
@@ -3,5 +3,5 @@ import { RuleId } from '../RuleId';
|
|
|
3
3
|
export declare class ViracochaEffectRule extends SacrificeEffectRule {
|
|
4
4
|
ruleId: RuleId;
|
|
5
5
|
getCardsToSacrifice(): import("@gamepark/rules-api").Material<number, number, number>;
|
|
6
|
-
onSacrifice(): import("@gamepark/rules-api").
|
|
6
|
+
onSacrifice(): (import("@gamepark/rules-api").CustomMove<number> | import("@gamepark/rules-api").CreateItem<number, number, number>)[];
|
|
7
7
|
}
|
|
@@ -14,33 +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.ViracochaEffectRule = void 0;
|
|
19
|
+
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
44
20
|
var Entity_1 = require("../../material/Entity");
|
|
45
21
|
var SacrificeEffectRule_1 = require("../../material/entity/SacrificeEffectRule");
|
|
46
22
|
var Pantheon_1 = require("../../material/Pantheon");
|
|
@@ -57,7 +33,7 @@ var ViracochaEffectRule = (function (_super) {
|
|
|
57
33
|
};
|
|
58
34
|
ViracochaEffectRule.prototype.onSacrifice = function () {
|
|
59
35
|
var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
|
|
60
|
-
return
|
|
36
|
+
return [pantheon.gainGems(2), this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
61
37
|
};
|
|
62
38
|
return ViracochaEffectRule;
|
|
63
39
|
}(SacrificeEffectRule_1.SacrificeEffectRule));
|
|
@@ -50,7 +50,7 @@ var YanluoWangEffectRule = (function (_super) {
|
|
|
50
50
|
var player = _c.value;
|
|
51
51
|
if (player !== this.player) {
|
|
52
52
|
var emptySpace = new Pantheon_1.Pantheon(this.game, player).grid[2].filter(function (space) { return space === undefined; }).length;
|
|
53
|
-
this.memorize(Memory_1.Memory.
|
|
53
|
+
this.memorize(Memory_1.Memory.EffectCount, emptySpace, player);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -75,7 +75,7 @@ var YanluoWangEffectRule = (function (_super) {
|
|
|
75
75
|
try {
|
|
76
76
|
for (var _b = __values(this.game.players), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
77
77
|
var player = _c.value;
|
|
78
|
-
if (this.remind(Memory_1.Memory.
|
|
78
|
+
if (this.remind(Memory_1.Memory.EffectCount, player) && new Pantheon_1.Pantheon(this.game, player).favor) {
|
|
79
79
|
moves.push(gems.moveItem({ type: LocationType_1.LocationType.PlayerGems, player: player }, 1));
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -93,7 +93,7 @@ var YanluoWangEffectRule = (function (_super) {
|
|
|
93
93
|
YanluoWangEffectRule.prototype.afterItemMove = function (move) {
|
|
94
94
|
if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.GemToken)(move)) {
|
|
95
95
|
var player = move.location.player;
|
|
96
|
-
this.memorize(Memory_1.Memory.
|
|
96
|
+
this.memorize(Memory_1.Memory.EffectCount, function (count) { return count - 1; }, player);
|
|
97
97
|
var favor = this.material(MaterialType_1.MaterialType.FavorToken).location(LocationType_1.LocationType.PlayerFavor).player(player);
|
|
98
98
|
return [favor.moveItem({ type: LocationType_1.LocationType.PlayerFavor, player: this.player }, 1)];
|
|
99
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamepark/mythologies",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.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": "2a9168d4a7d37a2588e10d2f2e9794a2657a7d60"
|
|
33
33
|
}
|