@gamepark/mythologies 0.2.0 → 0.3.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 +2 -1
- package/dist/CustomMoveType.js +1 -0
- package/dist/Memory.d.ts +4 -1
- package/dist/Memory.js +3 -0
- package/dist/MythologiesRules.d.ts +17 -5
- package/dist/MythologiesRules.js +36 -33
- package/dist/material/Mythology.js +1 -1
- package/dist/material/Pantheon.d.ts +6 -1
- package/dist/material/Pantheon.js +61 -25
- package/dist/material/entity/Effect.d.ts +21 -8
- package/dist/material/entity/Effect.js +34 -3
- package/dist/material/entity/EntityDescription.d.ts +0 -2
- package/dist/material/entity/EntityDescription.js +1 -7
- package/dist/material/entity/MoveEffectRule.d.ts +2 -2
- package/dist/material/entity/MoveEffectRule.js +7 -3
- package/dist/material/entity/PlaceCardEffectRule.d.ts +2 -2
- package/dist/material/entity/PlaceCardEffectRule.js +29 -3
- package/dist/material/entity/SacrificeEffectRule.d.ts +1 -1
- package/dist/material/entity/SacrificeEffectRule.js +29 -2
- package/dist/material/entity/SimultaneousSacrificeEffectRule.d.ts +1 -1
- package/dist/material/entity/SimultaneousSacrificeEffectRule.js +29 -2
- package/dist/material/entity/chinese/ChangE.js +39 -1
- package/dist/material/entity/chinese/Fenghuang.js +8 -1
- package/dist/material/entity/chinese/Jiangshi.js +7 -1
- package/dist/material/entity/chinese/Mogwai.js +38 -1
- package/dist/material/entity/chinese/Nian.js +36 -1
- package/dist/material/entity/chinese/Nuwa.js +7 -1
- package/dist/material/entity/chinese/Qilin.js +7 -1
- package/dist/material/entity/chinese/SunWukong.js +36 -1
- package/dist/material/entity/chinese/Tianlong.js +7 -1
- package/dist/material/entity/chinese/YanluoWang.js +7 -1
- package/dist/material/entity/egyptian/Beetle.js +1 -1
- package/dist/material/entity/egyptian/Sphinx.js +1 -1
- package/dist/material/entity/greek/Chimera.js +1 -1
- package/dist/material/entity/greek/Poseidon.js +3 -3
- package/dist/material/entity/norse/Draugr.js +1 -1
- package/dist/material/entity/norse/Jotunn.js +3 -2
- package/dist/rules/PlaceCardsRule.d.ts +3 -1
- package/dist/rules/PlaceCardsRule.js +18 -8
- package/dist/rules/PlaceTokenRule.js +3 -1
- package/dist/rules/RuleId.d.ts +8 -1
- package/dist/rules/RuleId.js +7 -0
- package/dist/rules/effects/AlfEffectRule.js +1 -1
- package/dist/rules/effects/ChimeraEffectRule.d.ts +1 -0
- package/dist/rules/effects/ChimeraEffectRule.js +4 -0
- package/dist/rules/effects/CondorEffectRule.d.ts +2 -2
- package/dist/rules/effects/CondorEffectRule.js +3 -7
- package/dist/rules/effects/DraugrEffectRule.d.ts +2 -1
- package/dist/rules/effects/DraugrEffectRule.js +8 -1
- package/dist/rules/effects/FenghuangEffectRule.d.ts +8 -0
- package/dist/rules/effects/FenghuangEffectRule.js +48 -0
- package/dist/rules/effects/HadesEffectRule.js +2 -12
- package/dist/rules/effects/JiangshiEffectRule.d.ts +8 -0
- package/dist/rules/effects/JiangshiEffectRule.js +76 -0
- package/dist/rules/effects/KinnaraEffectRule.js +7 -2
- package/dist/rules/effects/NuwaEffectRule.d.ts +12 -0
- package/dist/rules/effects/NuwaEffectRule.js +97 -0
- package/dist/rules/effects/QilinEffectRule.d.ts +8 -0
- package/dist/rules/effects/QilinEffectRule.js +113 -0
- package/dist/rules/effects/RaEffectRule.js +2 -12
- package/dist/rules/effects/ResolveEffectsRule.d.ts +2 -0
- package/dist/rules/effects/ResolveEffectsRule.js +17 -14
- package/dist/rules/effects/ShivaEffectRule.d.ts +1 -1
- package/dist/rules/effects/ShivaEffectRule.js +5 -2
- package/dist/rules/effects/SphinxEffectRule.js +2 -6
- package/dist/rules/effects/ThorEffectRule.d.ts +1 -1
- package/dist/rules/effects/ThorEffectRule.js +3 -1
- package/dist/rules/effects/TianlongEffectRule.d.ts +17 -0
- package/dist/rules/effects/TianlongEffectRule.js +148 -0
- package/dist/rules/effects/TriggerEffectsRule.js +4 -5
- package/dist/rules/effects/YanluoWangEffectRule.d.ts +9 -0
- package/dist/rules/effects/YanluoWangEffectRule.js +104 -0
- package/package.json +2 -2
|
@@ -51,23 +51,26 @@ var ResolveEffectsRule = (function (_super) {
|
|
|
51
51
|
pendingEffects.splice(0, 1);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
this.
|
|
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;
|
|
54
|
+
return this.playEffect(pendingEffect_1);
|
|
68
55
|
}
|
|
69
56
|
return [];
|
|
70
57
|
};
|
|
58
|
+
ResolveEffectsRule.prototype.playEffect = function (pendingEffect) {
|
|
59
|
+
this.memorize(Memory_1.Memory.OngoingEffect, pendingEffect);
|
|
60
|
+
var card = this.material(MaterialType_1.MaterialType.EntityCard).getItem(pendingEffect.cardIndex);
|
|
61
|
+
var effect = EntityDescription_1.entities[card.id.front].effect;
|
|
62
|
+
if (effect.trigger === Effect_1.oncePerTurn) {
|
|
63
|
+
this.memorize(Memory_1.Memory.OncePerTurn, function (indexes) {
|
|
64
|
+
if (indexes === void 0) { indexes = []; }
|
|
65
|
+
return indexes.concat(pendingEffect.cardIndex);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
var moves = new effect.rule(this.game).playEffect();
|
|
69
|
+
if (!moves.some(function (move) { return move.kind === rules_api_1.MoveKind.RulesMove; })) {
|
|
70
|
+
moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
|
|
71
|
+
}
|
|
72
|
+
return moves;
|
|
73
|
+
};
|
|
71
74
|
return ResolveEffectsRule;
|
|
72
75
|
}(rules_api_1.PlayerTurnRule));
|
|
73
76
|
exports.ResolveEffectsRule = ResolveEffectsRule;
|
|
@@ -6,5 +6,5 @@ export declare class ShivaEffectRule extends PlayerEffectRule {
|
|
|
6
6
|
canPlayEffect(cardIndex: number): boolean;
|
|
7
7
|
onRuleStart(): MaterialMove[];
|
|
8
8
|
getPlayerMoves(): MaterialMove[];
|
|
9
|
-
|
|
9
|
+
beforeItemMove(move: ItemMove): MaterialMove<number, number, number, number>[];
|
|
10
10
|
}
|
|
@@ -70,10 +70,13 @@ var ShivaEffectRule = (function (_super) {
|
|
|
70
70
|
var piles = pantheon.getPiles(function (space) { return (0, rules_api_1.areAdjacentSquares)(space, location); });
|
|
71
71
|
return piles.map(function (pile) { return pile.moveItemsAtOnce({ type: LocationType_1.LocationType.PlayerDiscard, player: _this.player }); });
|
|
72
72
|
};
|
|
73
|
-
ShivaEffectRule.prototype.
|
|
73
|
+
ShivaEffectRule.prototype.beforeItemMove = function (move) {
|
|
74
74
|
if ((0, rules_api_1.isMoveItemTypeAtOnce)(MaterialType_1.MaterialType.EntityCard)(move) && move.location.type === LocationType_1.LocationType.PlayerDiscard) {
|
|
75
75
|
var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
|
|
76
|
-
|
|
76
|
+
var topCard = this.material(MaterialType_1.MaterialType.EntityCard)
|
|
77
|
+
.index(move.indexes)
|
|
78
|
+
.maxBy(function (item) { return item.location.z; });
|
|
79
|
+
return __spreadArray(__spreadArray([pantheon.gainFavor(move.indexes.length)], __read(pantheon.onEntitySacrificed(topCard)), false), __read(this.endEffect()), false);
|
|
77
80
|
}
|
|
78
81
|
return [];
|
|
79
82
|
};
|
|
@@ -28,12 +28,8 @@ var SphinxEffectRule = (function (_super) {
|
|
|
28
28
|
return _this;
|
|
29
29
|
}
|
|
30
30
|
SphinxEffectRule.prototype.getMovingCards = function () {
|
|
31
|
-
var
|
|
32
|
-
|
|
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; });
|
|
31
|
+
var _a = this.card.location, x = _a.x, y = _a.y, z = _a.z;
|
|
32
|
+
return new Pantheon_1.Pantheon(this.game, this.player).allCards.location(function (l) { return l.x === x && l.y === y && l.z === z - 1; });
|
|
37
33
|
};
|
|
38
34
|
SphinxEffectRule.prototype.isLegalDestination = function (space, cardLocation) {
|
|
39
35
|
return space.x === cardLocation.x;
|
|
@@ -7,5 +7,5 @@ export declare class ThorEffectRule extends SimultaneousSacrificeEffectRule {
|
|
|
7
7
|
getAffectedPlayers(): PlayerColor[];
|
|
8
8
|
getActivePlayerLegalMoves(player: PlayerColor): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
|
|
9
9
|
getCardsToSacrifice(player: PlayerColor): Material;
|
|
10
|
-
beforeItemMove(move: ItemMove): import("@gamepark/rules-api").
|
|
10
|
+
beforeItemMove(move: ItemMove): import("@gamepark/rules-api").MaterialMove<number, number, number, number>[];
|
|
11
11
|
}
|
|
@@ -49,7 +49,9 @@ var ThorEffectRule = (function (_super) {
|
|
|
49
49
|
if ((0, rules_api_1.isDeleteItemType)(MaterialType_1.MaterialType.FavorToken)(move)) {
|
|
50
50
|
return [this.endPlayerTurn(this.material(MaterialType_1.MaterialType.FavorToken).getItem(move.itemIndex).location.player)];
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
else {
|
|
53
|
+
return _super.prototype.beforeItemMove.call(this, move);
|
|
54
|
+
}
|
|
53
55
|
};
|
|
54
56
|
return ThorEffectRule;
|
|
55
57
|
}(SimultaneousSacrificeEffectRule_1.SimultaneousSacrificeEffectRule));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ItemMove, MaterialMove, XYCoordinates } from '@gamepark/rules-api';
|
|
2
|
+
import { MoveEffectRule } from '../../material/entity/MoveEffectRule';
|
|
3
|
+
import { SimultaneousMoveEffectRule } from '../../material/entity/SimultaneousMoveEffectRule';
|
|
4
|
+
import { PlayerColor } from '../../PlayerColor';
|
|
5
|
+
import { RuleId } from '../RuleId';
|
|
6
|
+
export declare class TianlongEffectRule extends MoveEffectRule {
|
|
7
|
+
ruleId: RuleId;
|
|
8
|
+
getPlayerMoves(): MaterialMove<number, number, number, number>[];
|
|
9
|
+
beforeItemMove(move: ItemMove): MaterialMove<number, number, number, number>[];
|
|
10
|
+
onCardMoved(): never[];
|
|
11
|
+
}
|
|
12
|
+
export declare class TianlongOpponentsEffectRule extends SimultaneousMoveEffectRule {
|
|
13
|
+
getAffectedPlayers(): number[];
|
|
14
|
+
getMovingCards(player: PlayerColor): import("@gamepark/rules-api").Material<number, number, number>;
|
|
15
|
+
isLegalDestination(space: XYCoordinates): boolean;
|
|
16
|
+
onRuleEnd(): never[];
|
|
17
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
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
|
+
var __values = (this && this.__values) || function(o) {
|
|
43
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
44
|
+
if (m) return m.call(o);
|
|
45
|
+
if (o && typeof o.length === "number") return {
|
|
46
|
+
next: function () {
|
|
47
|
+
if (o && i >= o.length) o = void 0;
|
|
48
|
+
return { value: o && o[i++], done: !o };
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.TianlongOpponentsEffectRule = exports.TianlongEffectRule = void 0;
|
|
55
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
56
|
+
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
57
|
+
var MoveEffectRule_1 = require("../../material/entity/MoveEffectRule");
|
|
58
|
+
var SimultaneousMoveEffectRule_1 = require("../../material/entity/SimultaneousMoveEffectRule");
|
|
59
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
60
|
+
var Pantheon_1 = require("../../material/Pantheon");
|
|
61
|
+
var Memory_1 = require("../../Memory");
|
|
62
|
+
var RuleId_1 = require("../RuleId");
|
|
63
|
+
var TianlongEffectRule = (function (_super) {
|
|
64
|
+
__extends(TianlongEffectRule, _super);
|
|
65
|
+
function TianlongEffectRule() {
|
|
66
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
67
|
+
_this.ruleId = RuleId_1.RuleId.TianlongEffect;
|
|
68
|
+
return _this;
|
|
69
|
+
}
|
|
70
|
+
TianlongEffectRule.prototype.getPlayerMoves = function () {
|
|
71
|
+
var moves = [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
72
|
+
if (new Pantheon_1.Pantheon(this.game, this.player).gems > 0) {
|
|
73
|
+
moves.push.apply(moves, __spreadArray([], __read(_super.prototype.getPlayerMoves.call(this)), false));
|
|
74
|
+
}
|
|
75
|
+
return moves;
|
|
76
|
+
};
|
|
77
|
+
TianlongEffectRule.prototype.beforeItemMove = function (move) {
|
|
78
|
+
var e_1, _a;
|
|
79
|
+
if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.EntityCard)(move) && move.location.player === this.player) {
|
|
80
|
+
var _b = this.material(MaterialType_1.MaterialType.EntityCard).getItem(move.itemIndex).location, x = _b.x, y = _b.y;
|
|
81
|
+
this.memorize(Memory_1.Memory.TianlongVector, [
|
|
82
|
+
{ x: x, y: y },
|
|
83
|
+
{ x: move.location.x, y: move.location.y }
|
|
84
|
+
]);
|
|
85
|
+
var opponentsEffectRule = new TianlongOpponentsEffectRule(this.game);
|
|
86
|
+
var affectedPlayers = opponentsEffectRule.getAffectedPlayers();
|
|
87
|
+
var playersWithChoice = [];
|
|
88
|
+
var moves = [new Pantheon_1.Pantheon(this.game, this.player).spendGems(1)];
|
|
89
|
+
try {
|
|
90
|
+
for (var affectedPlayers_1 = __values(affectedPlayers), affectedPlayers_1_1 = affectedPlayers_1.next(); !affectedPlayers_1_1.done; affectedPlayers_1_1 = affectedPlayers_1.next()) {
|
|
91
|
+
var player = affectedPlayers_1_1.value;
|
|
92
|
+
var legalMoves = opponentsEffectRule.getActivePlayerLegalMoves(player);
|
|
93
|
+
if (legalMoves.length === 1) {
|
|
94
|
+
moves.push(legalMoves[0]);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
playersWithChoice.push(player);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
102
|
+
finally {
|
|
103
|
+
try {
|
|
104
|
+
if (affectedPlayers_1_1 && !affectedPlayers_1_1.done && (_a = affectedPlayers_1.return)) _a.call(affectedPlayers_1);
|
|
105
|
+
}
|
|
106
|
+
finally { if (e_1) throw e_1.error; }
|
|
107
|
+
}
|
|
108
|
+
if (playersWithChoice.length) {
|
|
109
|
+
moves.push(this.startSimultaneousRule(RuleId_1.RuleId.TianlongOpponentsEffect, playersWithChoice));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
this.forget(Memory_1.Memory.TianlongVector);
|
|
113
|
+
moves.push.apply(moves, __spreadArray([], __read(this.endEffect()), false));
|
|
114
|
+
}
|
|
115
|
+
return moves;
|
|
116
|
+
}
|
|
117
|
+
return [];
|
|
118
|
+
};
|
|
119
|
+
TianlongEffectRule.prototype.onCardMoved = function () {
|
|
120
|
+
return [];
|
|
121
|
+
};
|
|
122
|
+
return TianlongEffectRule;
|
|
123
|
+
}(MoveEffectRule_1.MoveEffectRule));
|
|
124
|
+
exports.TianlongEffectRule = TianlongEffectRule;
|
|
125
|
+
var TianlongOpponentsEffectRule = (function (_super) {
|
|
126
|
+
__extends(TianlongOpponentsEffectRule, _super);
|
|
127
|
+
function TianlongOpponentsEffectRule() {
|
|
128
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
129
|
+
}
|
|
130
|
+
TianlongOpponentsEffectRule.prototype.getAffectedPlayers = function () {
|
|
131
|
+
var _this = this;
|
|
132
|
+
return this.game.players.filter(function (player) { return _this.isOpponent(player) && _this.getActivePlayerLegalMoves(player).length > 0; });
|
|
133
|
+
};
|
|
134
|
+
TianlongOpponentsEffectRule.prototype.getMovingCards = function (player) {
|
|
135
|
+
var _a = this.remind(Memory_1.Memory.TianlongVector)[0], x = _a.x, y = _a.y;
|
|
136
|
+
return _super.prototype.getMovingCards.call(this, player).location(function (l) { return l.x === x && l.y === y; });
|
|
137
|
+
};
|
|
138
|
+
TianlongOpponentsEffectRule.prototype.isLegalDestination = function (space) {
|
|
139
|
+
var _a = this.remind(Memory_1.Memory.TianlongVector)[1], x = _a.x, y = _a.y;
|
|
140
|
+
return space.x === x && space.y === y;
|
|
141
|
+
};
|
|
142
|
+
TianlongOpponentsEffectRule.prototype.onRuleEnd = function () {
|
|
143
|
+
this.forget(Memory_1.Memory.TianlongVector);
|
|
144
|
+
return [];
|
|
145
|
+
};
|
|
146
|
+
return TianlongOpponentsEffectRule;
|
|
147
|
+
}(SimultaneousMoveEffectRule_1.SimultaneousMoveEffectRule));
|
|
148
|
+
exports.TianlongOpponentsEffectRule = TianlongOpponentsEffectRule;
|
|
@@ -139,11 +139,10 @@ var TriggerEffectsRule = (function (_super) {
|
|
|
139
139
|
var pendingEffects = [];
|
|
140
140
|
var cardIndex = card.getIndex();
|
|
141
141
|
var cardItem = card.getItem();
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
pendingEffects.push({ cardIndex: cardIndex, effectIndex: effectIndex, triggerEvent: triggerEvent });
|
|
142
|
+
if (cardItem.id.front) {
|
|
143
|
+
var effect = EntityDescription_1.entities[cardItem.id.front].effect;
|
|
144
|
+
if (effect === null || effect === void 0 ? void 0 : effect.trigger(triggerEvent, card, this.game)) {
|
|
145
|
+
pendingEffects.push({ cardIndex: cardIndex, triggerEvent: triggerEvent, auto: !!effect.auto });
|
|
147
146
|
}
|
|
148
147
|
}
|
|
149
148
|
return pendingEffects;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ItemMove, MaterialMove } from '@gamepark/rules-api';
|
|
2
|
+
import { PlayerEffectRule } from '../../material/entity/Effect';
|
|
3
|
+
import { RuleId } from '../RuleId';
|
|
4
|
+
export declare class YanluoWangEffectRule extends PlayerEffectRule {
|
|
5
|
+
ruleId: RuleId;
|
|
6
|
+
onRuleStart(): import("@gamepark/rules-api").CustomMove<number>[];
|
|
7
|
+
getPlayerMoves(): MaterialMove<number, number, number, number>[];
|
|
8
|
+
afterItemMove(move: ItemMove): import("@gamepark/rules-api").MoveItem<number, number, number>[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.YanluoWangEffectRule = void 0;
|
|
30
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
31
|
+
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
32
|
+
var Effect_1 = require("../../material/entity/Effect");
|
|
33
|
+
var LocationType_1 = require("../../material/LocationType");
|
|
34
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
35
|
+
var Pantheon_1 = require("../../material/Pantheon");
|
|
36
|
+
var Memory_1 = require("../../Memory");
|
|
37
|
+
var RuleId_1 = require("../RuleId");
|
|
38
|
+
var YanluoWangEffectRule = (function (_super) {
|
|
39
|
+
__extends(YanluoWangEffectRule, _super);
|
|
40
|
+
function YanluoWangEffectRule() {
|
|
41
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
42
|
+
_this.ruleId = RuleId_1.RuleId.YanluoWangEffect;
|
|
43
|
+
return _this;
|
|
44
|
+
}
|
|
45
|
+
YanluoWangEffectRule.prototype.onRuleStart = function () {
|
|
46
|
+
var e_1, _a;
|
|
47
|
+
if (new Pantheon_1.Pantheon(this.game, this.player).gems) {
|
|
48
|
+
try {
|
|
49
|
+
for (var _b = __values(this.game.players), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
50
|
+
var player = _c.value;
|
|
51
|
+
if (player !== this.player) {
|
|
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.YanluoWangCount, emptySpace, player);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
58
|
+
finally {
|
|
59
|
+
try {
|
|
60
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
61
|
+
}
|
|
62
|
+
finally { if (e_1) throw e_1.error; }
|
|
63
|
+
}
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
YanluoWangEffectRule.prototype.getPlayerMoves = function () {
|
|
71
|
+
var e_2, _a;
|
|
72
|
+
var moves = [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
73
|
+
var gems = this.material(MaterialType_1.MaterialType.GemToken).location(LocationType_1.LocationType.PlayerGems).player(this.player);
|
|
74
|
+
if (gems.getQuantity() > 0) {
|
|
75
|
+
try {
|
|
76
|
+
for (var _b = __values(this.game.players), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
77
|
+
var player = _c.value;
|
|
78
|
+
if (this.remind(Memory_1.Memory.YanluoWangCount, player) && new Pantheon_1.Pantheon(this.game, player).favor) {
|
|
79
|
+
moves.push(gems.moveItem({ type: LocationType_1.LocationType.PlayerGems, player: player }, 1));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
84
|
+
finally {
|
|
85
|
+
try {
|
|
86
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
87
|
+
}
|
|
88
|
+
finally { if (e_2) throw e_2.error; }
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return moves;
|
|
92
|
+
};
|
|
93
|
+
YanluoWangEffectRule.prototype.afterItemMove = function (move) {
|
|
94
|
+
if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.GemToken)(move)) {
|
|
95
|
+
var player = move.location.player;
|
|
96
|
+
this.memorize(Memory_1.Memory.YanluoWangCount, function (count) { return count - 1; }, player);
|
|
97
|
+
var favor = this.material(MaterialType_1.MaterialType.FavorToken).location(LocationType_1.LocationType.PlayerFavor).player(player);
|
|
98
|
+
return [favor.moveItem({ type: LocationType_1.LocationType.PlayerFavor, player: this.player }, 1)];
|
|
99
|
+
}
|
|
100
|
+
return [];
|
|
101
|
+
};
|
|
102
|
+
return YanluoWangEffectRule;
|
|
103
|
+
}(Effect_1.PlayerEffectRule));
|
|
104
|
+
exports.YanluoWangEffectRule = YanluoWangEffectRule;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamepark/mythologies",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
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": "040c56993fd93fc1fa5978d53414ee6fa9b79b2f"
|
|
33
33
|
}
|