@gamepark/mythologies 0.7.7 → 0.8.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.
@@ -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 this.favor >= favorTax;
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
- trigger: function (event, _a) {
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamepark/mythologies",
3
- "version": "0.7.7",
3
+ "version": "0.8.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": "3071ce226b766cf47f794dc90d473bfcb18e1d5a"
32
+ "gitHead": "b1f0590fe690cfda4ede6e89c084f0830d1de33c"
33
33
  }