@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,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.GorgonEffectRule = void 0;
|
|
19
|
+
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
44
20
|
var SacrificeEffectRule_1 = require("../../material/entity/SacrificeEffectRule");
|
|
45
21
|
var Pantheon_1 = require("../../material/Pantheon");
|
|
46
22
|
var RuleId_1 = require("../RuleId");
|
|
@@ -57,7 +33,7 @@ var GorgonEffectRule = (function (_super) {
|
|
|
57
33
|
};
|
|
58
34
|
GorgonEffectRule.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 GorgonEffectRule;
|
|
63
39
|
}(SacrificeEffectRule_1.SacrificeEffectRule));
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Location, XYCoordinates } from '@gamepark/rules-api';
|
|
2
|
+
import { PlayerColor } from '../../PlayerColor';
|
|
3
|
+
import { RuleId } from '../RuleId';
|
|
4
|
+
import { MultipleSimultaneousMoveEffectRule } from './MultipleSimultaneousMoveEffectRule';
|
|
5
|
+
export declare class HadesEffectRule extends MultipleSimultaneousMoveEffectRule {
|
|
6
|
+
ruleId: RuleId;
|
|
7
|
+
getTargetEntities(player: PlayerColor): import("@gamepark/rules-api").Material<number, number, number>;
|
|
8
|
+
isLegalDestination(space: XYCoordinates, cardLocation: Location): boolean;
|
|
5
9
|
}
|
|
@@ -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.HadesEffectRule = 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 HadesEffectRule = (function (_super) {
|
|
35
24
|
__extends(HadesEffectRule, _super);
|
|
36
25
|
function HadesEffectRule() {
|
|
37
|
-
|
|
26
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
27
|
+
_this.ruleId = RuleId_1.RuleId.HadesEffect;
|
|
28
|
+
return _this;
|
|
38
29
|
}
|
|
39
|
-
HadesEffectRule.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 !== 2 && !(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
|
+
HadesEffectRule.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 < 2 && pantheon.isFreeSpace({ x: l.x, y: l.y + 1 }); });
|
|
33
|
+
};
|
|
34
|
+
HadesEffectRule.prototype.isLegalDestination = function (space, cardLocation) {
|
|
35
|
+
return cardLocation.x === space.x && cardLocation.y === space.y - 1;
|
|
74
36
|
};
|
|
75
37
|
return HadesEffectRule;
|
|
76
|
-
}(
|
|
38
|
+
}(MultipleSimultaneousMoveEffectRule_1.MultipleSimultaneousMoveEffectRule));
|
|
77
39
|
exports.HadesEffectRule = HadesEffectRule;
|
|
@@ -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 IdloziEffectRule extends MoveEffectRule {
|
|
5
5
|
ruleId: RuleId;
|
|
6
6
|
getMovingCards(effectCardIndex: number): 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.IdloziEffectRule = void 0;
|
|
19
|
+
var CustomMoveType_1 = require("../../CustomMoveType");
|
|
19
20
|
var Entity_1 = require("../../material/Entity");
|
|
20
21
|
var MoveEffectRule_1 = require("../../material/entity/MoveEffectRule");
|
|
21
22
|
var MaterialType_1 = require("../../material/MaterialType");
|
|
@@ -36,7 +37,9 @@ var IdloziEffectRule = (function (_super) {
|
|
|
36
37
|
};
|
|
37
38
|
IdloziEffectRule.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 IdloziEffectRule;
|
|
42
45
|
}(MoveEffectRule_1.MoveEffectRule));
|
|
@@ -6,7 +6,7 @@ import { RuleId } from '../RuleId';
|
|
|
6
6
|
export declare class IllapaEffectRule extends PlayerEffectRule {
|
|
7
7
|
ruleId: RuleId;
|
|
8
8
|
getPlayerMoves(): CustomMove<number>[];
|
|
9
|
-
onCustomMove(move: CustomMove): import("@gamepark/rules-api").
|
|
9
|
+
onCustomMove(move: CustomMove): CustomMove<number>[] | import("@gamepark/rules-api").StartSimultaneousRule<number, RuleId.IllapaSacrifice>[];
|
|
10
10
|
getPlayersHavingToSacrifice(line: number): number[];
|
|
11
11
|
}
|
|
12
12
|
export declare class IllapaSacrificeRule extends SimultaneousSacrificeEffectRule {
|
|
@@ -37,13 +37,13 @@ var IllapaEffectRule = (function (_super) {
|
|
|
37
37
|
};
|
|
38
38
|
IllapaEffectRule.prototype.onCustomMove = function (move) {
|
|
39
39
|
if (move.type === CustomMoveType_1.CustomMoveType.ChooseLine) {
|
|
40
|
-
this.memorize(Memory_1.Memory.
|
|
40
|
+
this.memorize(Memory_1.Memory.TargetLine, move.data);
|
|
41
41
|
var players = this.getPlayersHavingToSacrifice(move.data);
|
|
42
42
|
if (players.length) {
|
|
43
43
|
return [this.startSimultaneousRule(RuleId_1.RuleId.IllapaSacrifice, players)];
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
return
|
|
46
|
+
return [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
return [];
|
|
@@ -61,7 +61,7 @@ var IllapaSacrificeRule = (function (_super) {
|
|
|
61
61
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
62
62
|
}
|
|
63
63
|
IllapaSacrificeRule.prototype.getCardsToSacrifice = function (player) {
|
|
64
|
-
var line = this.remind(Memory_1.Memory.
|
|
64
|
+
var line = this.remind(Memory_1.Memory.TargetLine);
|
|
65
65
|
return _super.prototype.getCardsToSacrifice.call(this, player)
|
|
66
66
|
.id(function (id) { return (0, Entity_1.isCreature)(id.front); })
|
|
67
67
|
.location(function (l) { return l.y === line; });
|
|
@@ -29,12 +29,12 @@ var InkosazanaEffectRule = (function (_super) {
|
|
|
29
29
|
return _this;
|
|
30
30
|
}
|
|
31
31
|
InkosazanaEffectRule.prototype.onRuleStart = function () {
|
|
32
|
-
if (!this.remind(Memory_1.Memory.
|
|
32
|
+
if (!this.remind(Memory_1.Memory.EffectCount)) {
|
|
33
33
|
this.remind(Memory_1.Memory.PendingEffects).unshift([this.getEffect()]);
|
|
34
|
-
this.memorize(Memory_1.Memory.
|
|
34
|
+
this.memorize(Memory_1.Memory.EffectCount, true);
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
this.forget(Memory_1.Memory.
|
|
37
|
+
this.forget(Memory_1.Memory.EffectCount);
|
|
38
38
|
}
|
|
39
39
|
return _super.prototype.onRuleStart.call(this);
|
|
40
40
|
};
|
|
@@ -4,5 +4,5 @@ import { RuleId } from '../RuleId';
|
|
|
4
4
|
export declare class JiangshiEffectRule extends PlayerEffectRule {
|
|
5
5
|
ruleId: RuleId;
|
|
6
6
|
getPlayerMoves(): MaterialMove[];
|
|
7
|
-
beforeItemMove(move: ItemMove):
|
|
7
|
+
beforeItemMove(move: ItemMove): (import("@gamepark/rules-api").CustomMove<number> | import("@gamepark/rules-api").CreateItem<number, number, number>)[];
|
|
8
8
|
}
|
|
@@ -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.JiangshiEffectRule = 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");
|
|
@@ -70,7 +46,7 @@ var JiangshiEffectRule = (function (_super) {
|
|
|
70
46
|
.index(move.indexes)
|
|
71
47
|
.maxBy(function (item) { return item.location.z; });
|
|
72
48
|
pantheon.onEntitySacrificed(topCard);
|
|
73
|
-
return
|
|
49
|
+
return [pantheon.gainGems(2), this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
74
50
|
}
|
|
75
51
|
return [];
|
|
76
52
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ItemMove } from '@gamepark/rules-api';
|
|
2
|
+
import { PlayerEffectRule } from '../../material/entity/Effect';
|
|
3
|
+
import { RuleId } from '../RuleId';
|
|
4
|
+
export declare class LeprechaunEffectRule extends PlayerEffectRule {
|
|
5
|
+
ruleId: RuleId;
|
|
6
|
+
canPlayEffect(cardIndex: number): boolean;
|
|
7
|
+
getPlayerMoves(cardIndex?: number): import("@gamepark/rules-api").MoveItem<number, number, number>[];
|
|
8
|
+
afterItemMove(move: ItemMove): import("@gamepark/rules-api").CustomMove<number>[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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.LeprechaunEffectRule = 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 LeprechaunEffectRule = (function (_super) {
|
|
26
|
+
__extends(LeprechaunEffectRule, _super);
|
|
27
|
+
function LeprechaunEffectRule() {
|
|
28
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
29
|
+
_this.ruleId = RuleId_1.RuleId.LeprechaunEffect;
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
LeprechaunEffectRule.prototype.canPlayEffect = function (cardIndex) {
|
|
33
|
+
return this.getPlayerMoves(cardIndex).length > 0;
|
|
34
|
+
};
|
|
35
|
+
LeprechaunEffectRule.prototype.getPlayerMoves = function (cardIndex) {
|
|
36
|
+
if (cardIndex === void 0) { cardIndex = this.getEffect().cardIndex; }
|
|
37
|
+
var _a = this.material(MaterialType_1.MaterialType.EntityCard).getItem(cardIndex).location, x = _a.x, y = _a.y, player = _a.player;
|
|
38
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, player);
|
|
39
|
+
return pantheon.gainLineBonus(y).concat(pantheon.gainColumnBonus(x));
|
|
40
|
+
};
|
|
41
|
+
LeprechaunEffectRule.prototype.afterItemMove = function (move) {
|
|
42
|
+
if ((0, rules_api_1.isMoveItem)(move) && (move.itemType === MaterialType_1.MaterialType.GemToken || move.itemType === MaterialType_1.MaterialType.FavorToken)) {
|
|
43
|
+
return [this.customMove(CustomMoveType_1.CustomMoveType.EndEffect)];
|
|
44
|
+
}
|
|
45
|
+
return [];
|
|
46
|
+
};
|
|
47
|
+
return LeprechaunEffectRule;
|
|
48
|
+
}(Effect_1.PlayerEffectRule));
|
|
49
|
+
exports.LeprechaunEffectRule = LeprechaunEffectRule;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MaterialMove, MoveItem } from '@gamepark/rules-api';
|
|
2
|
+
import { SimultaneousMoveEffectRule } from '../../material/entity/SimultaneousMoveEffectRule';
|
|
3
|
+
import { PlayerColor } from '../../PlayerColor';
|
|
4
|
+
export declare abstract class MultipleSimultaneousMoveEffectRule extends SimultaneousMoveEffectRule {
|
|
5
|
+
playEffect(): MaterialMove[];
|
|
6
|
+
getTargetEntitiesAbleToMove(player: PlayerColor): import("@gamepark/rules-api").Material<number, number, number>;
|
|
7
|
+
getTargetEntities(player: PlayerColor): import("@gamepark/rules-api").Material<number, number, number>;
|
|
8
|
+
getEffectCount(player: PlayerColor): number;
|
|
9
|
+
getMovingCards(player: PlayerColor): import("@gamepark/rules-api").Material<number, number, number>;
|
|
10
|
+
onCardMoved(move: MoveItem): import("@gamepark/rules-api").EndPlayerTurn<number>[];
|
|
11
|
+
onCardSacrificed(move: MoveItem): MaterialMove[];
|
|
12
|
+
onRuleEnd(): never[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
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.MultipleSimultaneousMoveEffectRule = void 0;
|
|
55
|
+
var Effect_1 = require("../../material/entity/Effect");
|
|
56
|
+
var SimultaneousMoveEffectRule_1 = require("../../material/entity/SimultaneousMoveEffectRule");
|
|
57
|
+
var LocationType_1 = require("../../material/LocationType");
|
|
58
|
+
var MaterialType_1 = require("../../material/MaterialType");
|
|
59
|
+
var Pantheon_1 = require("../../material/Pantheon");
|
|
60
|
+
var Memory_1 = require("../../Memory");
|
|
61
|
+
var TriggerEffectsRule_1 = require("./TriggerEffectsRule");
|
|
62
|
+
var MultipleSimultaneousMoveEffectRule = (function (_super) {
|
|
63
|
+
__extends(MultipleSimultaneousMoveEffectRule, _super);
|
|
64
|
+
function MultipleSimultaneousMoveEffectRule() {
|
|
65
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
66
|
+
}
|
|
67
|
+
MultipleSimultaneousMoveEffectRule.prototype.playEffect = function () {
|
|
68
|
+
var e_1, _a;
|
|
69
|
+
var _this = this;
|
|
70
|
+
var moves = [];
|
|
71
|
+
var playersToActivate = [];
|
|
72
|
+
var _loop_1 = function (player) {
|
|
73
|
+
var e_2, _d;
|
|
74
|
+
var effectCount = this_1.getEffectCount(player);
|
|
75
|
+
var targetEntities = this_1.getTargetEntitiesAbleToMove(player);
|
|
76
|
+
var pantheon = new Pantheon_1.Pantheon(this_1.game, player);
|
|
77
|
+
var canSacrificeToPreventMove = targetEntities.length > 0 && effectCount > 0 && pantheon.sacrificeToPreventMove().length > 0;
|
|
78
|
+
if (canSacrificeToPreventMove ||
|
|
79
|
+
effectCount < targetEntities.length ||
|
|
80
|
+
targetEntities.getItems().some(function (entity) { return _this.getAvailableDestinations(player, entity).length > 1; })) {
|
|
81
|
+
this_1.memorize(Memory_1.Memory.TargetEntities, targetEntities.getIndexes(), player);
|
|
82
|
+
this_1.memorize(Memory_1.Memory.EffectCount, effectCount, player);
|
|
83
|
+
playersToActivate.push(player);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
try {
|
|
87
|
+
for (var _e = (e_2 = void 0, __values(targetEntities.getIndexes())), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
88
|
+
var index = _f.value;
|
|
89
|
+
var card = targetEntities.index(index);
|
|
90
|
+
var destinations = this_1.getAvailableDestinations(player, card.getItem());
|
|
91
|
+
if (destinations.length) {
|
|
92
|
+
var _g = destinations[0], x = _g.x, y = _g.y;
|
|
93
|
+
moves.push(card.moveItem({ type: LocationType_1.LocationType.Pantheon, player: player, x: x, y: y }));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
98
|
+
finally {
|
|
99
|
+
try {
|
|
100
|
+
if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
|
|
101
|
+
}
|
|
102
|
+
finally { if (e_2) throw e_2.error; }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var this_1 = this;
|
|
107
|
+
try {
|
|
108
|
+
for (var _b = __values(this.game.players), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
109
|
+
var player = _c.value;
|
|
110
|
+
_loop_1(player);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
114
|
+
finally {
|
|
115
|
+
try {
|
|
116
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
117
|
+
}
|
|
118
|
+
finally { if (e_1) throw e_1.error; }
|
|
119
|
+
}
|
|
120
|
+
if (this.ruleId && playersToActivate.length) {
|
|
121
|
+
moves.push(this.startSimultaneousRule(this.ruleId, playersToActivate));
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
moves.push.apply(moves, __spreadArray([], __read(this.updatePlayersGrids()), false));
|
|
125
|
+
}
|
|
126
|
+
return moves;
|
|
127
|
+
};
|
|
128
|
+
MultipleSimultaneousMoveEffectRule.prototype.getTargetEntitiesAbleToMove = function (player) {
|
|
129
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, player);
|
|
130
|
+
return this.getTargetEntities(player).filter(function (item) { return pantheon.isAbleToMove(item); });
|
|
131
|
+
};
|
|
132
|
+
MultipleSimultaneousMoveEffectRule.prototype.getTargetEntities = function (player) {
|
|
133
|
+
var pantheon = new Pantheon_1.Pantheon(this.game, player);
|
|
134
|
+
return pantheon.visibleEntities;
|
|
135
|
+
};
|
|
136
|
+
MultipleSimultaneousMoveEffectRule.prototype.getEffectCount = function (player) {
|
|
137
|
+
return this.getTargetEntitiesAbleToMove(player).length;
|
|
138
|
+
};
|
|
139
|
+
MultipleSimultaneousMoveEffectRule.prototype.getMovingCards = function (player) {
|
|
140
|
+
return this.material(MaterialType_1.MaterialType.EntityCard).index(this.remind(Memory_1.Memory.TargetEntities, player));
|
|
141
|
+
};
|
|
142
|
+
MultipleSimultaneousMoveEffectRule.prototype.onCardMoved = function (move) {
|
|
143
|
+
this.memorize(Memory_1.Memory.TargetEntities, function (entities) { return entities.filter(function (index) { return index !== move.itemIndex; }); }, move.location.player);
|
|
144
|
+
var count = this.memorize(Memory_1.Memory.EffectCount, function (count) { return count - 1; }, move.location.player);
|
|
145
|
+
return count ? [] : [this.endPlayerTurn(move.location.player)];
|
|
146
|
+
};
|
|
147
|
+
MultipleSimultaneousMoveEffectRule.prototype.onCardSacrificed = function (move) {
|
|
148
|
+
var card = this.material(MaterialType_1.MaterialType.EntityCard).index(move.itemIndex);
|
|
149
|
+
new TriggerEffectsRule_1.TriggerEffectsRule(this.game).triggerEffects({ type: Effect_1.TriggerEventType.EntitySacrificed, card: card.getItem(), cardIndex: card.getIndex() });
|
|
150
|
+
return this.onCardMoved(move);
|
|
151
|
+
};
|
|
152
|
+
MultipleSimultaneousMoveEffectRule.prototype.onRuleEnd = function () {
|
|
153
|
+
this.forget(Memory_1.Memory.EntityMoved);
|
|
154
|
+
this.forget(Memory_1.Memory.TargetEntities);
|
|
155
|
+
this.forget(Memory_1.Memory.EffectCount);
|
|
156
|
+
return [];
|
|
157
|
+
};
|
|
158
|
+
return MultipleSimultaneousMoveEffectRule;
|
|
159
|
+
}(SimultaneousMoveEffectRule_1.SimultaneousMoveEffectRule));
|
|
160
|
+
exports.MultipleSimultaneousMoveEffectRule = MultipleSimultaneousMoveEffectRule;
|
|
@@ -51,7 +51,7 @@ var NuwaEffectRule = (function (_super) {
|
|
|
51
51
|
if (this.isOpponent(player)) {
|
|
52
52
|
var creatures = new Pantheon_1.Pantheon(this.game, player).visibleEntities.id(function (id) { return (0, Entity_1.isCreature)(id.front); }).getIndexes();
|
|
53
53
|
if (creatures.length > 0) {
|
|
54
|
-
this.memorize(Memory_1.Memory.
|
|
54
|
+
this.memorize(Memory_1.Memory.TargetEntities, creatures, player);
|
|
55
55
|
players.push(player);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -69,18 +69,18 @@ var NuwaEffectRule = (function (_super) {
|
|
|
69
69
|
NuwaEffectRule.prototype.getActivePlayerLegalMoves = function (player) {
|
|
70
70
|
var moves = _super.prototype.getActivePlayerLegalMoves.call(this, player);
|
|
71
71
|
var gems = this.material(MaterialType_1.MaterialType.GemToken).location(LocationType_1.LocationType.PlayerGems).player(player);
|
|
72
|
-
var creatures = this.remind(Memory_1.Memory.
|
|
72
|
+
var creatures = this.remind(Memory_1.Memory.TargetEntities, player);
|
|
73
73
|
if (gems.getQuantity() >= creatures.length) {
|
|
74
74
|
moves.push(gems.moveItem({ type: LocationType_1.LocationType.PlayerGems, player: this.card.location.player }, creatures.length));
|
|
75
75
|
}
|
|
76
76
|
return moves;
|
|
77
77
|
};
|
|
78
78
|
NuwaEffectRule.prototype.getCardsToSacrifice = function (player) {
|
|
79
|
-
return _super.prototype.getCardsToSacrifice.call(this, player).index(this.remind(Memory_1.Memory.
|
|
79
|
+
return _super.prototype.getCardsToSacrifice.call(this, player).index(this.remind(Memory_1.Memory.TargetEntities, player));
|
|
80
80
|
};
|
|
81
81
|
NuwaEffectRule.prototype.onSacrifice = function (move) {
|
|
82
82
|
var player = move.location.player;
|
|
83
|
-
var creaturesLeft = this.memorize(Memory_1.Memory.
|
|
83
|
+
var creaturesLeft = this.memorize(Memory_1.Memory.TargetEntities, function (creatures) { return creatures.filter(function (c) { return c !== move.itemIndex; }); }, player);
|
|
84
84
|
return creaturesLeft.length ? [] : [this.endPlayerTurn(player)];
|
|
85
85
|
};
|
|
86
86
|
NuwaEffectRule.prototype.beforeItemMove = function (move) {
|
|
@@ -37,14 +37,14 @@ var OdinEffectRule = (function (_super) {
|
|
|
37
37
|
};
|
|
38
38
|
OdinEffectRule.prototype.onCustomMove = function (move) {
|
|
39
39
|
if (move.type === CustomMoveType_1.CustomMoveType.ChooseMythology) {
|
|
40
|
-
this.memorize(Memory_1.Memory.
|
|
40
|
+
this.memorize(Memory_1.Memory.TargetMythology, move.data);
|
|
41
41
|
return [this.startRule(RuleId_1.RuleId.DrawDestinyCard)];
|
|
42
42
|
}
|
|
43
43
|
return [];
|
|
44
44
|
};
|
|
45
45
|
OdinEffectRule.prototype.isCardRestricted = function (card, player) {
|
|
46
46
|
return ((card.location.type === LocationType_1.LocationType.SanctuaryCreatureSpot || card.location.type === LocationType_1.LocationType.SanctuaryGodSpot) &&
|
|
47
|
-
(0, Entity_1.entityMythology)(card.id.front) === this.remind(Memory_1.Memory.
|
|
47
|
+
(0, Entity_1.entityMythology)(card.id.front) === this.remind(Memory_1.Memory.TargetMythology) &&
|
|
48
48
|
(!player || !new Pantheon_1.Pantheon(this.game, player).hasEntity(Entity_1.Entity.Odin)));
|
|
49
49
|
};
|
|
50
50
|
return OdinEffectRule;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Location, XYCoordinates } from '@gamepark/rules-api';
|
|
2
|
+
import { PlayerColor } from '../../PlayerColor';
|
|
3
|
+
import { RuleId } from '../RuleId';
|
|
4
|
+
import { MultipleSimultaneousMoveEffectRule } from './MultipleSimultaneousMoveEffectRule';
|
|
5
|
+
export declare class RaEffectRule extends MultipleSimultaneousMoveEffectRule {
|
|
6
|
+
ruleId: RuleId;
|
|
7
|
+
getTargetEntities(player: PlayerColor): import("@gamepark/rules-api").Material<number, number, number>;
|
|
8
|
+
isLegalDestination(space: XYCoordinates, cardLocation: Location): boolean;
|
|
5
9
|
}
|