@gamepark/mythologies 0.7.7 → 0.8.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/material/Destiny.d.ts +6 -3
- package/dist/material/Destiny.js +16 -3
- package/dist/material/Pantheon.d.ts +1 -0
- package/dist/material/Pantheon.js +13 -2
- package/dist/material/entity/Effect.d.ts +1 -0
- package/dist/material/entity/chinese/ChangE.js +1 -35
- package/dist/material/entity/hindu/Asura.js +1 -1
- package/dist/rules/PlaceTokenRule.d.ts +1 -3
- package/dist/rules/PlaceTokenRule.js +6 -9
- package/dist/rules/effects/RakshasaEffectRule.js +1 -1
- package/package.json +2 -2
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { MaterialRulesPart } from '@gamepark/rules-api';
|
|
2
2
|
import { PlayerColor } from '../PlayerColor';
|
|
3
|
+
import { Mythology } from './Mythology';
|
|
3
4
|
export declare class Destiny extends MaterialRulesPart {
|
|
4
|
-
get mythologies():
|
|
5
|
+
get mythologies(): Mythology[];
|
|
5
6
|
getMythologyBoard(player: PlayerColor): import("@gamepark/rules-api").Material<number, number, number>;
|
|
6
|
-
getMythology(player: PlayerColor):
|
|
7
|
+
getMythology(player: PlayerColor): Mythology;
|
|
7
8
|
getDestinyMap(destiny: number): PlayerColor[][];
|
|
8
9
|
get cardsWithoutToken(): import("@gamepark/rules-api").Material<number, number, number>;
|
|
9
|
-
|
|
10
|
+
getAvailableCards(player: PlayerColor): import("@gamepark/rules-api").Material<number, number, number>;
|
|
11
|
+
getAvailableCardsOnBoard(player: PlayerColor): import("@gamepark/rules-api").Material<number, number, number>;
|
|
12
|
+
getTopDeckCreature(mythology: Mythology): import("@gamepark/rules-api").MaterialDeck<number, number, number>;
|
|
10
13
|
getBoardsWithoutPlayer(): import("@gamepark/rules-api").Material<number, number, number>;
|
|
11
14
|
get creaturesOnTopOfDecks(): import("@gamepark/rules-api").Material<number, number, number>;
|
|
12
15
|
}
|
package/dist/material/Destiny.js
CHANGED
|
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.Destiny = void 0;
|
|
19
19
|
var rules_api_1 = require("@gamepark/rules-api");
|
|
20
20
|
var PlayerColor_1 = require("../PlayerColor");
|
|
21
|
+
var Entity_1 = require("./Entity");
|
|
21
22
|
var LocationType_1 = require("./LocationType");
|
|
22
23
|
var MaterialType_1 = require("./MaterialType");
|
|
23
24
|
var Destiny = (function (_super) {
|
|
@@ -82,9 +83,21 @@ var Destiny = (function (_super) {
|
|
|
82
83
|
enumerable: false,
|
|
83
84
|
configurable: true
|
|
84
85
|
});
|
|
85
|
-
Destiny.prototype.
|
|
86
|
-
var
|
|
87
|
-
|
|
86
|
+
Destiny.prototype.getAvailableCards = function (player) {
|
|
87
|
+
var entities = this.getAvailableCardsOnBoard(player);
|
|
88
|
+
if (entities.getItems().some(function (item) { return (0, Entity_1.isCreature)(item.id.front); })) {
|
|
89
|
+
return entities;
|
|
90
|
+
}
|
|
91
|
+
var topDeckCreature = this.getTopDeckCreature(this.getMythology(player));
|
|
92
|
+
var indexes = entities.getIndexes().concat(topDeckCreature.getIndex());
|
|
93
|
+
return this.material(MaterialType_1.MaterialType.EntityCard).index(indexes);
|
|
94
|
+
};
|
|
95
|
+
Destiny.prototype.getAvailableCardsOnBoard = function (player) {
|
|
96
|
+
var boardCards = this.cardsWithoutToken.location(function (l) { return l.type === LocationType_1.LocationType.SanctuaryGodSpot || l.type === LocationType_1.LocationType.SanctuaryCreatureSpot; });
|
|
97
|
+
return boardCards.parent(this.getMythologyBoard(player).getIndex());
|
|
98
|
+
};
|
|
99
|
+
Destiny.prototype.getTopDeckCreature = function (mythology) {
|
|
100
|
+
return this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.CreaturesDeck).locationId(mythology).deck();
|
|
88
101
|
};
|
|
89
102
|
Destiny.prototype.getBoardsWithoutPlayer = function () {
|
|
90
103
|
var _this = this;
|
|
@@ -13,6 +13,7 @@ export declare class Pantheon extends MaterialRulesPart {
|
|
|
13
13
|
get legalSpacesToInvoke(): XYCoordinates[];
|
|
14
14
|
isLegalSpaceToInvoke(space: XYCoordinates): boolean;
|
|
15
15
|
getFavorTax(space: XYCoordinates): number;
|
|
16
|
+
getGemTax(space: XYCoordinates): number;
|
|
16
17
|
get legalSpaces(): XYCoordinates[];
|
|
17
18
|
isLegalSpace({ x, y }: XYCoordinates, grid?: (Entity | undefined)[][]): boolean;
|
|
18
19
|
isFreeSpace({ x, y }: XYCoordinates): boolean;
|
|
@@ -133,13 +133,19 @@ var Pantheon = (function (_super) {
|
|
|
133
133
|
var _this = this;
|
|
134
134
|
var opponents = this.game.players.filter(function (player) { return player !== _this.player; });
|
|
135
135
|
var favorTax = (0, lodash_1.sumBy)(opponents, function (opponent) { return new Pantheon(_this.game, opponent).getFavorTax(space); });
|
|
136
|
-
return
|
|
136
|
+
var gemTax = (0, lodash_1.sumBy)(opponents, function (opponent) { return new Pantheon(_this.game, opponent).getGemTax(space); });
|
|
137
|
+
return (!favorTax || this.favor >= favorTax) && (!gemTax || this.gems >= gemTax);
|
|
137
138
|
};
|
|
138
139
|
Pantheon.prototype.getFavorTax = function (space) {
|
|
139
140
|
return (0, lodash_1.sumBy)(this.visibleEntities.getItems(), function (card) {
|
|
140
141
|
return (0, lodash_1.sumBy)((0, EntityDescription_1.getEffects)(card.id.front), function (effect) { var _a, _b, _c; return (_c = (_b = (_a = effect).favorTax) === null || _b === void 0 ? void 0 : _b.call(_a, space, card)) !== null && _c !== void 0 ? _c : 0; });
|
|
141
142
|
});
|
|
142
143
|
};
|
|
144
|
+
Pantheon.prototype.getGemTax = function (space) {
|
|
145
|
+
return (0, lodash_1.sumBy)(this.visibleEntities.getItems(), function (card) {
|
|
146
|
+
return (0, lodash_1.sumBy)((0, EntityDescription_1.getEffects)(card.id.front), function (effect) { var _a, _b, _c; return (_c = (_b = (_a = effect).gemTax) === null || _b === void 0 ? void 0 : _b.call(_a, space, card)) !== null && _c !== void 0 ? _c : 0; });
|
|
147
|
+
});
|
|
148
|
+
};
|
|
143
149
|
Object.defineProperty(Pantheon.prototype, "legalSpaces", {
|
|
144
150
|
get: function () {
|
|
145
151
|
var _this = this;
|
|
@@ -361,15 +367,20 @@ var Pantheon = (function (_super) {
|
|
|
361
367
|
var entity = card.id.front;
|
|
362
368
|
if (!entity)
|
|
363
369
|
return [];
|
|
364
|
-
var favor = this.material(MaterialType_1.MaterialType.FavorToken).location(LocationType_1.LocationType.PlayerFavor).player(this.player);
|
|
365
370
|
try {
|
|
366
371
|
for (var _b = __values(this.game.players), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
367
372
|
var player = _c.value;
|
|
368
373
|
if (player !== this.player) {
|
|
369
374
|
var favorTax = new Pantheon(this.game, player).getFavorTax(move.location);
|
|
370
375
|
if (favorTax > 0) {
|
|
376
|
+
var favor = this.material(MaterialType_1.MaterialType.FavorToken).location(LocationType_1.LocationType.PlayerFavor).player(this.player);
|
|
371
377
|
moves.push(favor.moveItem({ type: LocationType_1.LocationType.PlayerFavor, player: player }, favorTax));
|
|
372
378
|
}
|
|
379
|
+
var gemTax = new Pantheon(this.game, player).getGemTax(move.location);
|
|
380
|
+
if (gemTax > 0) {
|
|
381
|
+
var gems = this.material(MaterialType_1.MaterialType.GemToken).location(LocationType_1.LocationType.PlayerGems).player(this.player);
|
|
382
|
+
moves.push(gems.moveItem({ type: LocationType_1.LocationType.PlayerFavor, player: player }, gemTax));
|
|
383
|
+
}
|
|
373
384
|
}
|
|
374
385
|
}
|
|
375
386
|
}
|
|
@@ -19,6 +19,7 @@ export type PermanentEffect = {
|
|
|
19
19
|
preventCrush?: (card: EntityItem, effectCard: EntityItem) => boolean;
|
|
20
20
|
replaceSacrifice?: (card: EntityItem, effectCard: EntityItem) => boolean;
|
|
21
21
|
favorTax?: (space: XYCoordinates, card: EntityItem) => number;
|
|
22
|
+
gemTax?: (space: XYCoordinates, card: EntityItem) => number;
|
|
22
23
|
sacrificeInsteadOfMove?: boolean;
|
|
23
24
|
};
|
|
24
25
|
export type Effect = TriggeredEffect | PermanentEffect;
|
|
@@ -1,43 +1,9 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.ChangE = void 0;
|
|
19
|
-
var LocationType_1 = require("../../LocationType");
|
|
20
|
-
var MaterialType_1 = require("../../MaterialType");
|
|
21
|
-
var Effect_1 = require("../Effect");
|
|
22
4
|
exports.ChangE = {
|
|
23
5
|
invoke: [{ gem: 1, favor: 2 }, { gem: 2 }, {}],
|
|
24
6
|
effect: {
|
|
25
|
-
|
|
26
|
-
var cardLocation = _a.cardLocation;
|
|
27
|
-
return event.type === Effect_1.TriggerEventType.EntityPlaced && event.invoked && cardLocation.player !== event.location.player && cardLocation.y === event.location.y;
|
|
28
|
-
},
|
|
29
|
-
rule: (function (_super) {
|
|
30
|
-
__extends(ChangeEEffectRule, _super);
|
|
31
|
-
function ChangeEEffectRule() {
|
|
32
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
33
|
-
}
|
|
34
|
-
ChangeEEffectRule.prototype.playEffect = function () {
|
|
35
|
-
var playerInvoked = this.getEffect().triggerEvent.location.player;
|
|
36
|
-
var gems = this.material(MaterialType_1.MaterialType.GemToken).location(LocationType_1.LocationType.PlayerGems).player(playerInvoked);
|
|
37
|
-
return gems.getQuantity() > 0 ? [gems.moveItem({ type: LocationType_1.LocationType.PlayerGems, player: this.player }, 1)] : [];
|
|
38
|
-
};
|
|
39
|
-
return ChangeEEffectRule;
|
|
40
|
-
}(Effect_1.AutoEffectRule)),
|
|
41
|
-
auto: true
|
|
7
|
+
gemTax: function (space, changE) { return (space.y === changE.location.y ? 1 : 0); }
|
|
42
8
|
}
|
|
43
9
|
};
|
|
@@ -54,7 +54,7 @@ exports.Asura = {
|
|
|
54
54
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
55
55
|
}
|
|
56
56
|
AsuraEffectRule.prototype.playEffect = function () {
|
|
57
|
-
var cardsToExile = new Destiny_1.Destiny(this.game).
|
|
57
|
+
var cardsToExile = new Destiny_1.Destiny(this.game).getAvailableCardsOnBoard(this.player);
|
|
58
58
|
if (!cardsToExile.length)
|
|
59
59
|
return [];
|
|
60
60
|
var pantheon = new Pantheon_1.Pantheon(this.game, this.player);
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { ItemMove, MaterialMove, SimultaneousRule } from '@gamepark/rules-api';
|
|
2
2
|
import { EntityItem } from '../material/Entity';
|
|
3
|
-
import { Mythology } from '../material/Mythology';
|
|
4
3
|
import { PlayerColor } from '../PlayerColor';
|
|
5
4
|
import { RuleId } from './RuleId';
|
|
6
5
|
export declare class PlaceTokenRule extends SimultaneousRule {
|
|
7
6
|
onRuleStart(): MaterialMove<number, number, number, number>[];
|
|
8
7
|
getActivePlayerLegalMoves(player: PlayerColor): import("@gamepark/rules-api").MoveItem<number, number, number>[];
|
|
9
|
-
getAvailableCards(player: PlayerColor): number
|
|
10
|
-
getTopDeckCreature(mythology: Mythology): number;
|
|
8
|
+
getAvailableCards(player: PlayerColor): import("@gamepark/rules-api").Material<number, number, number>;
|
|
11
9
|
afterItemMove(move: ItemMove): import("@gamepark/rules-api").EndPlayerTurn<PlayerColor>[];
|
|
12
10
|
getMovesAfterPlayersDone(): import("@gamepark/rules-api").StartRule<RuleId.DrawDestinyCard>[] | (import("@gamepark/rules-api").MoveItem<number, number, number> | import("@gamepark/rules-api").StartPlayerTurn<number, RuleId.PlaceCards>)[];
|
|
13
11
|
getMythologyBoardIndex(item: EntityItem): number;
|
|
@@ -92,22 +92,19 @@ var PlaceTokenRule = (function (_super) {
|
|
|
92
92
|
.location(LocationType_1.LocationType.PlayedTokenSpot);
|
|
93
93
|
if (!token.length)
|
|
94
94
|
return [];
|
|
95
|
-
return this.getAvailableCards(player)
|
|
95
|
+
return this.getAvailableCards(player)
|
|
96
|
+
.getIndexes()
|
|
97
|
+
.map(function (parent) { return token.moveItem({ type: LocationType_1.LocationType.OnEntityCard, parent: parent }); });
|
|
96
98
|
};
|
|
97
99
|
PlaceTokenRule.prototype.getAvailableCards = function (player) {
|
|
98
100
|
var destiny = new Destiny_1.Destiny(this.game);
|
|
99
101
|
var mythology = destiny.getMythology(player);
|
|
100
102
|
if (this.remind(Memory_1.Memory.TargetMythology) === mythology && !new Pantheon_1.Pantheon(this.game, player).hasEntity(Entity_1.Entity.Odin)) {
|
|
101
|
-
return
|
|
103
|
+
return destiny.getTopDeckCreature(mythology);
|
|
102
104
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return entities.getIndexes().concat(this.getTopDeckCreature(mythology));
|
|
105
|
+
else {
|
|
106
|
+
return destiny.getAvailableCards(player);
|
|
106
107
|
}
|
|
107
|
-
return entities.getIndexes();
|
|
108
|
-
};
|
|
109
|
-
PlaceTokenRule.prototype.getTopDeckCreature = function (mythology) {
|
|
110
|
-
return this.material(MaterialType_1.MaterialType.EntityCard).location(LocationType_1.LocationType.CreaturesDeck).locationId(mythology).deck().getIndex();
|
|
111
108
|
};
|
|
112
109
|
PlaceTokenRule.prototype.afterItemMove = function (move) {
|
|
113
110
|
if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.DraftToken)(move) && move.location.type === LocationType_1.LocationType.OnEntityCard) {
|
|
@@ -36,7 +36,7 @@ var RakshasaEffectRule = (function (_super) {
|
|
|
36
36
|
return [new Pantheon_1.Pantheon(this.game, this.player).spendGems(1)];
|
|
37
37
|
};
|
|
38
38
|
RakshasaEffectRule.prototype.getCardsToPlace = function () {
|
|
39
|
-
return new Destiny_1.Destiny(this.game).
|
|
39
|
+
return new Destiny_1.Destiny(this.game).getAvailableCards(this.player);
|
|
40
40
|
};
|
|
41
41
|
RakshasaEffectRule.prototype.getAvailableDestinations = function (cardIndex) {
|
|
42
42
|
var location = this.material(MaterialType_1.MaterialType.EntityCard).getItem(cardIndex).location;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamepark/mythologies",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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": "c165b112d35146faa43a2fef4be62ee710c4ec22"
|
|
33
33
|
}
|