@gamepark/mythologies 0.7.1 → 0.7.3
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 +3 -4
- package/dist/CustomMoveType.js +3 -4
- package/dist/MythologiesRules.d.ts +1 -1
- package/dist/MythologiesRules.js +33 -9
- package/dist/material/Entity.d.ts +2 -2
- package/dist/material/Entity.js +2 -2
- package/dist/material/LocationType.d.ts +2 -1
- package/dist/material/LocationType.js +1 -0
- package/dist/material/Pantheon.d.ts +1 -0
- package/dist/material/Pantheon.js +16 -14
- package/dist/material/entity/Effect.d.ts +11 -6
- package/dist/material/entity/Effect.js +69 -9
- package/dist/material/entity/SimultaneousMoveEffectRule.d.ts +0 -1
- package/dist/material/entity/SimultaneousMoveEffectRule.js +0 -4
- package/dist/material/entity/SimultaneousSacrificeEffectRule.d.ts +0 -1
- package/dist/material/entity/SimultaneousSacrificeEffectRule.js +0 -4
- package/dist/material/entity/celtic/Banshee.js +2 -2
- package/dist/material/entity/celtic/Dagda.js +3 -2
- package/dist/material/entity/chinese/ChangE.js +3 -5
- package/dist/material/entity/chinese/Fenghuang.js +3 -1
- package/dist/material/entity/chinese/Mogwai.js +4 -4
- package/dist/material/entity/chinese/SunWukong.js +3 -2
- package/dist/material/entity/egyptian/Isis.js +3 -2
- package/dist/material/entity/greek/Cyclops.js +7 -12
- package/dist/material/entity/greek/Poseidon.js +3 -2
- package/dist/material/entity/inca/Puma.js +4 -1
- package/dist/material/entity/inca/Ukuku.js +4 -4
- package/dist/material/entity/zulu/Inkanyamba.js +4 -1
- package/dist/rules/PlaceCardsRule.d.ts +0 -2
- package/dist/rules/PlaceCardsRule.js +23 -17
- package/dist/rules/PlaceTokenRule.js +5 -3
- package/dist/rules/effects/CentaurEffectRule.d.ts +1 -0
- package/dist/rules/effects/CentaurEffectRule.js +8 -44
- package/dist/rules/effects/CyclopsEffectRule.d.ts +5 -4
- package/dist/rules/effects/CyclopsEffectRule.js +58 -49
- package/dist/rules/effects/DraugrEffectRule.d.ts +1 -1
- package/dist/rules/effects/DraugrEffectRule.js +1 -1
- package/dist/rules/effects/FenrirEffectRule.js +6 -1
- package/dist/rules/effects/IllapaEffectRule.d.ts +4 -2
- package/dist/rules/effects/IllapaEffectRule.js +17 -12
- package/dist/rules/effects/MinotaurEffectRule.d.ts +2 -0
- package/dist/rules/effects/MinotaurEffectRule.js +11 -1
- package/dist/rules/effects/NuwaEffectRule.d.ts +3 -1
- package/dist/rules/effects/NuwaEffectRule.js +20 -12
- package/dist/rules/effects/ThorEffectRule.js +1 -1
- package/dist/rules/effects/TianlongEffectRule.d.ts +1 -0
- package/dist/rules/effects/TianlongEffectRule.js +19 -48
- package/dist/rules/effects/TriggerEffectsRule.d.ts +3 -3
- package/dist/rules/effects/TriggerEffectsRule.js +22 -18
- package/package.json +4 -4
|
@@ -39,19 +39,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
39
39
|
}
|
|
40
40
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
41
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
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
43
|
exports.TianlongOpponentsEffectRule = exports.TianlongEffectRule = void 0;
|
|
44
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
55
45
|
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
56
46
|
var MoveEffectRule_1 = require("../../material/entity/MoveEffectRule");
|
|
57
47
|
var SimultaneousMoveEffectRule_1 = require("../../material/entity/SimultaneousMoveEffectRule");
|
|
@@ -74,43 +64,22 @@ var TianlongEffectRule = (function (_super) {
|
|
|
74
64
|
return moves;
|
|
75
65
|
};
|
|
76
66
|
TianlongEffectRule.prototype.onCardMoved = function (move) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var player = affectedPlayers_1_1.value;
|
|
90
|
-
var legalMoves = opponentsEffectRule.getActivePlayerLegalMoves(player);
|
|
91
|
-
if (legalMoves.length === 1) {
|
|
92
|
-
moves.push(legalMoves[0]);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
playersWithChoice.push(player);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
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);
|
|
67
|
+
if (move.location.player === this.player) {
|
|
68
|
+
var _a = this.material(MaterialType_1.MaterialType.EntityCard).getItem(move.itemIndex).location, x = _a.x, y = _a.y;
|
|
69
|
+
this.memorize(Memory_1.Memory.TargetLocations, [
|
|
70
|
+
{ x: x, y: y },
|
|
71
|
+
{ x: move.location.x, y: move.location.y }
|
|
72
|
+
]);
|
|
73
|
+
var opponentsEffectRule = new TianlongOpponentsEffectRule(this.game);
|
|
74
|
+
var moves = [new Pantheon_1.Pantheon(this.game, this.player).spendGems(1)];
|
|
75
|
+
moves.push.apply(moves, __spreadArray([], __read(opponentsEffectRule.playEffect()), false));
|
|
76
|
+
if (!moves.some(rules_api_1.isStartSimultaneousRule)) {
|
|
77
|
+
this.forget(Memory_1.Memory.TargetLocations);
|
|
78
|
+
moves.push(this.customMove(CustomMoveType_1.CustomMoveType.EndEffect));
|
|
103
79
|
}
|
|
104
|
-
|
|
80
|
+
return moves;
|
|
105
81
|
}
|
|
106
|
-
|
|
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;
|
|
82
|
+
return [];
|
|
114
83
|
};
|
|
115
84
|
return TianlongEffectRule;
|
|
116
85
|
}(MoveEffectRule_1.MoveEffectRule));
|
|
@@ -118,11 +87,13 @@ exports.TianlongEffectRule = TianlongEffectRule;
|
|
|
118
87
|
var TianlongOpponentsEffectRule = (function (_super) {
|
|
119
88
|
__extends(TianlongOpponentsEffectRule, _super);
|
|
120
89
|
function TianlongOpponentsEffectRule() {
|
|
121
|
-
|
|
90
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
91
|
+
_this.ruleId = RuleId_1.RuleId.TianlongOpponentsEffect;
|
|
92
|
+
return _this;
|
|
122
93
|
}
|
|
123
94
|
TianlongOpponentsEffectRule.prototype.getAffectedPlayers = function () {
|
|
124
95
|
var _this = this;
|
|
125
|
-
return this.game.players.filter(function (player) { return _this.isOpponent(player)
|
|
96
|
+
return this.game.players.filter(function (player) { return _this.isOpponent(player); });
|
|
126
97
|
};
|
|
127
98
|
TianlongOpponentsEffectRule.prototype.getMovingCards = function (player) {
|
|
128
99
|
var _a = this.remind(Memory_1.Memory.TargetLocations)[0], x = _a.x, y = _a.y;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Location, MaterialRulesPart } from '@gamepark/rules-api';
|
|
2
2
|
import { PendingEffect, TriggerEvent } from '../../material/entity/Effect';
|
|
3
3
|
import { PlayerColor } from '../../PlayerColor';
|
|
4
4
|
export declare class TriggerEffectsRule extends MaterialRulesPart {
|
|
5
5
|
triggerEffects(...triggerEvents: TriggerEvent[]): void;
|
|
6
6
|
triggerPlayerEffects(player: PlayerColor, ...triggerEvents: TriggerEvent[]): void;
|
|
7
7
|
getPlayerEffects(player: PlayerColor, ...triggerEvents: TriggerEvent[]): PendingEffect<TriggerEvent>[];
|
|
8
|
-
triggerCardEffect(
|
|
9
|
-
getCardEffects(
|
|
8
|
+
triggerCardEffect(cardIndex: number, cardLocation: Location, triggerEvent: TriggerEvent): void;
|
|
9
|
+
getCardEffects(cardIndex: number, cardLocation: Location, triggerEvent: TriggerEvent): PendingEffect[];
|
|
10
10
|
private getPlayersByEffectPriorityOrder;
|
|
11
11
|
}
|
|
@@ -103,16 +103,22 @@ var TriggerEffectsRule = (function (_super) {
|
|
|
103
103
|
var pendingEffects = [];
|
|
104
104
|
var pantheon = new Pantheon_1.Pantheon(this.game, player);
|
|
105
105
|
var material = this.material(MaterialType_1.MaterialType.EntityCard);
|
|
106
|
-
var cards = pantheon.visibleEntities.getIndexes();
|
|
106
|
+
var cards = pantheon.visibleEntities.getIndexes().map(function (index) { return ({ index: index, location: material.getItem(index).location }); });
|
|
107
|
+
var _loop_1 = function (event) {
|
|
108
|
+
if (event.type === Effect_1.TriggerEventType.EntityCrushed) {
|
|
109
|
+
var location = material.getItem(event.cardIndex).location;
|
|
110
|
+
if (location.player === player && !cards.some(function (card) { return card.index === event.cardIndex; })) {
|
|
111
|
+
cards.push({ index: event.cardIndex, location: location });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (event.type === Effect_1.TriggerEventType.EntityPlaced && event.location.player === player && !cards.some(function (card) { return card.index === event.cardIndex; })) {
|
|
115
|
+
cards.push({ index: event.cardIndex, location: event.location });
|
|
116
|
+
}
|
|
117
|
+
};
|
|
107
118
|
try {
|
|
108
119
|
for (var triggerEvents_1 = __values(triggerEvents), triggerEvents_1_1 = triggerEvents_1.next(); !triggerEvents_1_1.done; triggerEvents_1_1 = triggerEvents_1.next()) {
|
|
109
120
|
var event = triggerEvents_1_1.value;
|
|
110
|
-
|
|
111
|
-
cards.push(event.cardIndex);
|
|
112
|
-
}
|
|
113
|
-
if (event.type === Effect_1.TriggerEventType.EntityPlaced && event.location.player === player && !cards.includes(event.cardIndex)) {
|
|
114
|
-
cards.push(event.cardIndex);
|
|
115
|
-
}
|
|
121
|
+
_loop_1(event);
|
|
116
122
|
}
|
|
117
123
|
}
|
|
118
124
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -127,9 +133,8 @@ var TriggerEffectsRule = (function (_super) {
|
|
|
127
133
|
var triggerEvent = triggerEvents_2_1.value;
|
|
128
134
|
try {
|
|
129
135
|
for (var cards_1 = (e_4 = void 0, __values(cards)), cards_1_1 = cards_1.next(); !cards_1_1.done; cards_1_1 = cards_1.next()) {
|
|
130
|
-
var
|
|
131
|
-
|
|
132
|
-
pendingEffects.push.apply(pendingEffects, __spreadArray([], __read(this.getCardEffects(card, triggerEvent)), false));
|
|
136
|
+
var _d = cards_1_1.value, index = _d.index, location = _d.location;
|
|
137
|
+
pendingEffects.push.apply(pendingEffects, __spreadArray([], __read(this.getCardEffects(index, location, triggerEvent)), false));
|
|
133
138
|
}
|
|
134
139
|
}
|
|
135
140
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
@@ -150,19 +155,18 @@ var TriggerEffectsRule = (function (_super) {
|
|
|
150
155
|
}
|
|
151
156
|
return pendingEffects;
|
|
152
157
|
};
|
|
153
|
-
TriggerEffectsRule.prototype.triggerCardEffect = function (
|
|
154
|
-
var pendingEffects = this.getCardEffects(
|
|
158
|
+
TriggerEffectsRule.prototype.triggerCardEffect = function (cardIndex, cardLocation, triggerEvent) {
|
|
159
|
+
var pendingEffects = this.getCardEffects(cardIndex, cardLocation, triggerEvent);
|
|
155
160
|
if (pendingEffects.length) {
|
|
156
161
|
this.remind(Memory_1.Memory.PendingEffects).unshift(pendingEffects);
|
|
157
162
|
}
|
|
158
163
|
};
|
|
159
|
-
TriggerEffectsRule.prototype.getCardEffects = function (
|
|
164
|
+
TriggerEffectsRule.prototype.getCardEffects = function (cardIndex, cardLocation, triggerEvent) {
|
|
160
165
|
var pendingEffects = [];
|
|
161
|
-
var
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if ((0, Effect_1.isTriggeredEffect)(effect) && effect.trigger(triggerEvent, card, this.game)) {
|
|
166
|
+
var card = this.material(MaterialType_1.MaterialType.EntityCard).getItem(cardIndex);
|
|
167
|
+
for (var effectIndex = 0; effectIndex < (0, EntityDescription_1.getEffects)(card.id.front).length; effectIndex++) {
|
|
168
|
+
var effect = (0, EntityDescription_1.getEffects)(card.id.front)[effectIndex];
|
|
169
|
+
if ((0, Effect_1.isTriggeredEffect)(effect) && effect.trigger(triggerEvent, { cardIndex: cardIndex, cardLocation: cardLocation, game: this.game })) {
|
|
166
170
|
pendingEffects.push({ cardIndex: cardIndex, effectIndex: effectIndex, triggerEvent: triggerEvent, auto: !!effect.auto });
|
|
167
171
|
}
|
|
168
172
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamepark/mythologies",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "The rules of Mythologies adapted for Game Park",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"lint": "eslint --fix"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@gamepark/rules-api": ">=6.38",
|
|
23
|
+
"@gamepark/rules-api": ">=6.38.5",
|
|
24
24
|
"lodash": ">=4.17"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@gamepark/rules-api": "~6.38.
|
|
27
|
+
"@gamepark/rules-api": "~6.38.5",
|
|
28
28
|
"@types/lodash": "^4.17.7",
|
|
29
29
|
"i18next": "^22.0.3",
|
|
30
30
|
"lodash": "^4.17.21"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "dea6a9053b6c44493df694a064d2b1288ae86a3b"
|
|
33
33
|
}
|