@gamepark/mythologies 0.2.0 → 0.2.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 CHANGED
@@ -11,5 +11,6 @@ export declare enum Memory {
11
11
  AnubisInvoke1 = 12,
12
12
  GarudaSacrificeCount = 13,
13
13
  VetalaCount = 14,
14
- IllapaLine = 15
14
+ IllapaLine = 15,
15
+ YanluoWangCount = 16
15
16
  }
package/dist/Memory.js CHANGED
@@ -16,4 +16,5 @@ var Memory;
16
16
  Memory[Memory["GarudaSacrificeCount"] = 13] = "GarudaSacrificeCount";
17
17
  Memory[Memory["VetalaCount"] = 14] = "VetalaCount";
18
18
  Memory[Memory["IllapaLine"] = 15] = "IllapaLine";
19
+ Memory[Memory["YanluoWangCount"] = 16] = "YanluoWangCount";
19
20
  })(Memory = exports.Memory || (exports.Memory = {}));
@@ -34,6 +34,7 @@ import { ThorEffectRule } from './rules/effects/ThorEffectRule';
34
34
  import { UkukuEffectRule, UkukuPlaceEffectRule } from './rules/effects/UkukuEffectRule';
35
35
  import { VetalaEffectRule } from './rules/effects/VetalaEffectRule';
36
36
  import { ViracochaEffectRule } from './rules/effects/ViracochaEffectRule';
37
+ import { YanluoWangEffectRule } from './rules/effects/YanluoWangEffectRule';
37
38
  import { EndGameRule } from './rules/EndGameRule';
38
39
  import { PlaceCardsRule } from './rules/PlaceCardsRule';
39
40
  import { PlaceTokenRule } from './rules/PlaceTokenRule';
@@ -83,6 +84,7 @@ export declare class MythologiesRules extends SecretMaterialRules<PlayerColor, M
83
84
  43: typeof SupayEffectRule;
84
85
  44: typeof UkukuEffectRule;
85
86
  45: typeof UkukuPlaceEffectRule;
87
+ 46: typeof YanluoWangEffectRule;
86
88
  };
87
89
  locationsStrategies: {
88
90
  2: {
@@ -57,6 +57,7 @@ var TriggerEffectsRule_1 = require("./rules/effects/TriggerEffectsRule");
57
57
  var UkukuEffectRule_1 = require("./rules/effects/UkukuEffectRule");
58
58
  var VetalaEffectRule_1 = require("./rules/effects/VetalaEffectRule");
59
59
  var ViracochaEffectRule_1 = require("./rules/effects/ViracochaEffectRule");
60
+ var YanluoWangEffectRule_1 = require("./rules/effects/YanluoWangEffectRule");
60
61
  var EndGameRule_1 = require("./rules/EndGameRule");
61
62
  var PlaceCardsRule_1 = require("./rules/PlaceCardsRule");
62
63
  var PlaceTokenRule_1 = require("./rules/PlaceTokenRule");
@@ -110,6 +111,7 @@ var MythologiesRules = (function (_super) {
110
111
  _a[RuleId_1.RuleId.SupayEffect] = SupayEffectRule_1.SupayEffectRule,
111
112
  _a[RuleId_1.RuleId.UkukuEffect] = UkukuEffectRule_1.UkukuEffectRule,
112
113
  _a[RuleId_1.RuleId.UkukuPlaceEffect] = UkukuEffectRule_1.UkukuPlaceEffectRule,
114
+ _a[RuleId_1.RuleId.YanluoWangEffect] = YanluoWangEffectRule_1.YanluoWangEffectRule,
113
115
  _a);
114
116
  _this.locationsStrategies = (_b = {},
115
117
  _b[MaterialType_1.MaterialType.EntityCard] = (_c = {},
@@ -182,11 +182,12 @@ var Pantheon = (function (_super) {
182
182
  return this.material(MaterialType_1.MaterialType.FavorToken).location(LocationType_1.LocationType.PlayerFavor).player(this.player).deleteItem(quantity);
183
183
  };
184
184
  Pantheon.prototype.onCardPlaced = function (move) {
185
+ var _a, _b;
185
186
  var moves = [];
186
187
  var location = move.location;
187
188
  var card = this.material(MaterialType_1.MaterialType.EntityCard).index(move.itemIndex);
188
189
  var cardItem = card.getItem();
189
- var entity = cardItem.id.front;
190
+ var entity = (_a = cardItem.id.front) !== null && _a !== void 0 ? _a : ((_b = move.reveal) === null || _b === void 0 ? void 0 : _b.id).front;
190
191
  if ((0, Entity_1.isGod)(entity)) {
191
192
  moves.push(this.spendGems(4));
192
193
  }
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.YanluoWang = void 0;
4
+ var YanluoWangEffectRule_1 = require("../../../rules/effects/YanluoWangEffectRule");
5
+ var Effect_1 = require("../Effect");
4
6
  exports.YanluoWang = {
5
- invoke: [{}, {}, { favor: 2 }]
7
+ invoke: [{}, {}, { favor: 2 }],
8
+ effect: {
9
+ trigger: Effect_1.isEndOfGame,
10
+ rule: YanluoWangEffectRule_1.YanluoWangEffectRule
11
+ }
6
12
  };
@@ -40,5 +40,6 @@ export declare enum RuleId {
40
40
  CondorEffect = 42,
41
41
  SupayEffect = 43,
42
42
  UkukuEffect = 44,
43
- UkukuPlaceEffect = 45
43
+ UkukuPlaceEffect = 45,
44
+ YanluoWangEffect = 46
44
45
  }
@@ -45,4 +45,5 @@ var RuleId;
45
45
  RuleId[RuleId["SupayEffect"] = 43] = "SupayEffect";
46
46
  RuleId[RuleId["UkukuEffect"] = 44] = "UkukuEffect";
47
47
  RuleId[RuleId["UkukuPlaceEffect"] = 45] = "UkukuPlaceEffect";
48
+ RuleId[RuleId["YanluoWangEffect"] = 46] = "YanluoWangEffect";
48
49
  })(RuleId = exports.RuleId || (exports.RuleId = {}));
@@ -14,17 +14,6 @@ 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 __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
17
  var __values = (this && this.__values) || function(o) {
29
18
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
30
19
  if (m) return m.call(o);
@@ -40,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
40
29
  exports.HadesEffectRule = void 0;
41
30
  var Entity_1 = require("../../material/Entity");
42
31
  var SimultaneousMoveEffectRule_1 = require("../../material/entity/SimultaneousMoveEffectRule");
32
+ var LocationType_1 = require("../../material/LocationType");
43
33
  var Pantheon_1 = require("../../material/Pantheon");
44
34
  var HadesEffectRule = (function (_super) {
45
35
  __extends(HadesEffectRule, _super);
@@ -60,7 +50,7 @@ var HadesEffectRule = (function (_super) {
60
50
  var entity = entities.getItem(index);
61
51
  var _g = entity.location, x = _g.x, y = _g.y;
62
52
  if (y !== 2 && !(0, Entity_1.isGod)(entity.id.front) && pantheon.isFreeSpace({ x: x, y: y + 1 })) {
63
- moves.push(entities.index(index).moveItem(__assign(__assign({}, entity.location), { y: y + 1 })));
53
+ moves.push(entities.index(index).moveItem({ type: LocationType_1.LocationType.Pantheon, player: player, x: x, y: y + 1 }));
64
54
  }
65
55
  }
66
56
  }
@@ -14,17 +14,6 @@ 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 __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
17
  var __values = (this && this.__values) || function(o) {
29
18
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
30
19
  if (m) return m.call(o);
@@ -40,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
40
29
  exports.RaEffectRule = void 0;
41
30
  var Entity_1 = require("../../material/Entity");
42
31
  var SimultaneousMoveEffectRule_1 = require("../../material/entity/SimultaneousMoveEffectRule");
32
+ var LocationType_1 = require("../../material/LocationType");
43
33
  var Pantheon_1 = require("../../material/Pantheon");
44
34
  var RaEffectRule = (function (_super) {
45
35
  __extends(RaEffectRule, _super);
@@ -60,7 +50,7 @@ var RaEffectRule = (function (_super) {
60
50
  var entity = entities.getItem(index);
61
51
  var _g = entity.location, x = _g.x, y = _g.y;
62
52
  if (y !== 0 && !(0, Entity_1.isGod)(entity.id.front) && pantheon.isFreeSpace({ x: x, y: y - 1 })) {
63
- moves.push(entities.index(index).moveItem(__assign(__assign({}, entity.location), { y: y - 1 })));
53
+ moves.push(entities.index(index).moveItem({ type: LocationType_1.LocationType.Pantheon, player: player, x: x, y: y - 1 }));
64
54
  }
65
55
  }
66
56
  }
@@ -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.2.0",
3
+ "version": "0.2.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": "a9d4070ed2adea2a03d0e61312b0b947c70341c9"
32
+ "gitHead": "de5a3ab0f3d679595718820f22bac06791fb7eb9"
33
33
  }