@gamepark/zenith 0.0.2 → 0.1.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.
Files changed (63) hide show
  1. package/dist/PlayerId.js +1 -2
  2. package/dist/TeamColor.js +7 -13
  3. package/dist/ZenithOptions.js +1 -4
  4. package/dist/ZenithRules.js +71 -122
  5. package/dist/ZenithSetup.js +123 -266
  6. package/dist/index.js +3 -9
  7. package/dist/material/Agent.js +4 -7
  8. package/dist/material/Agents.js +920 -923
  9. package/dist/material/Bonus.js +5 -8
  10. package/dist/material/Bonuses.js +29 -33
  11. package/dist/material/Credit.js +4 -7
  12. package/dist/material/Faction.js +4 -7
  13. package/dist/material/Influence.js +4 -7
  14. package/dist/material/LocationType.js +2 -5
  15. package/dist/material/MaterialType.js +2 -5
  16. package/dist/material/effect/Effect.js +5 -10
  17. package/dist/material/effect/EffectType.js +2 -5
  18. package/dist/rules/CustomMoveType.js +2 -5
  19. package/dist/rules/DiscardActionRule.js +26 -75
  20. package/dist/rules/Memory.js +2 -5
  21. package/dist/rules/MulliganRule.js +47 -126
  22. package/dist/rules/PlayCardRule.js +68 -134
  23. package/dist/rules/RefillRule.js +83 -190
  24. package/dist/rules/RuleId.js +2 -5
  25. package/dist/rules/discard-action/DiplomacyActions.js +15 -20
  26. package/dist/rules/discard-action/DiplomacyBoardRule.js +27 -64
  27. package/dist/rules/discard-action/TechnologyActions.js +44 -48
  28. package/dist/rules/discard-action/TechnologyBoardRule.js +34 -102
  29. package/dist/rules/effect/ChoiceRule.js +21 -81
  30. package/dist/rules/effect/ConditionalRule.js +77 -141
  31. package/dist/rules/effect/DevelopTechnologyRule.js +53 -119
  32. package/dist/rules/effect/DiscardRule.js +37 -90
  33. package/dist/rules/effect/EffectRule.js +60 -138
  34. package/dist/rules/effect/ExileRule.js +62 -147
  35. package/dist/rules/effect/GiveCreditRule.js +24 -73
  36. package/dist/rules/effect/GiveInfluenceRule.js +38 -101
  37. package/dist/rules/effect/GiveLeaderBadgeRule.js +18 -46
  38. package/dist/rules/effect/GiveZenithiumRule.js +25 -79
  39. package/dist/rules/effect/MobilizeRule.js +38 -93
  40. package/dist/rules/effect/ResetInfluenceRule.js +21 -58
  41. package/dist/rules/effect/SpendCreditRule.js +29 -102
  42. package/dist/rules/effect/SpendZenithiumRule.js +32 -109
  43. package/dist/rules/effect/StealCreditRule.js +15 -64
  44. package/dist/rules/effect/TakeBonusRule.js +30 -91
  45. package/dist/rules/effect/TakeLeaderBadgeRule.js +31 -88
  46. package/dist/rules/effect/TakeTechnologyBonusTokenRule.js +45 -112
  47. package/dist/rules/effect/TransferRule.js +47 -81
  48. package/dist/rules/effect/WinCreditRule.js +60 -130
  49. package/dist/rules/effect/WinInfluenceRule.js +128 -248
  50. package/dist/rules/effect/WinZenithiumRule.js +24 -80
  51. package/dist/rules/effect/index.js +19 -35
  52. package/dist/rules/helper/BonusHelper.js +32 -64
  53. package/dist/rules/helper/CreditHelper.js +19 -44
  54. package/dist/rules/helper/EffectHelper.js +81 -123
  55. package/dist/rules/helper/EffectRuleIds.js +25 -29
  56. package/dist/rules/helper/EndGameHelper.js +24 -57
  57. package/dist/rules/helper/InfluenceHelper.js +18 -44
  58. package/dist/rules/helper/MobilizeHelper.js +27 -53
  59. package/dist/rules/helper/PlanetHelper.js +45 -78
  60. package/dist/rules/helper/PlayerHelper.js +24 -60
  61. package/dist/rules/helper/TechnologyHelper.js +31 -87
  62. package/dist/rules/helper/ZenithiumHelper.js +25 -48
  63. package/package.json +4 -3
@@ -1,122 +1,55 @@
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 __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
- 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.TakeTechnologyBonusTokenRule = void 0;
55
- var LocationType_1 = require("../../material/LocationType");
56
- var MaterialType_1 = require("../../material/MaterialType");
57
- var BonusHelper_1 = require("../helper/BonusHelper");
58
- var Memory_1 = require("../Memory");
59
- var EffectRule_1 = require("./EffectRule");
60
- var TakeTechnologyBonusTokenRule = (function (_super) {
61
- __extends(TakeTechnologyBonusTokenRule, _super);
62
- function TakeTechnologyBonusTokenRule() {
63
- return _super !== null && _super.apply(this, arguments) || this;
64
- }
65
- TakeTechnologyBonusTokenRule.prototype.onRuleStart = function () {
66
- var _this = this;
67
- var moves = _super.prototype.onRuleStart.call(this);
1
+ import { LocationType } from '../../material/LocationType';
2
+ import { MaterialType } from '../../material/MaterialType';
3
+ import { BonusHelper } from '../helper/BonusHelper';
4
+ import { Memory } from '../Memory';
5
+ import { EffectRule } from './EffectRule';
6
+ export class TakeTechnologyBonusTokenRule extends EffectRule {
7
+ onRuleStart() {
8
+ const moves = super.onRuleStart();
68
9
  if (moves.length > 0)
69
10
  return moves;
70
- var bonusEffect = this.bonusEffect;
71
- this.memorize(Memory_1.Memory.CurrentEffect, JSON.parse(JSON.stringify(this.effect)));
11
+ const bonusEffect = this.bonusEffect;
12
+ this.memorize(Memory.CurrentEffect, JSON.parse(JSON.stringify(this.effect)));
72
13
  this.removeFirstEffect();
73
14
  if (bonusEffect) {
74
- this.memorize(Memory_1.Memory.WonBonus, bonusEffect.bonusId);
75
- this.memorize(Memory_1.Memory.Effects, function (effects) {
76
- if (effects === void 0) { effects = []; }
77
- effects.unshift(__assign(__assign({}, bonusEffect.effect), { effectSource: {
78
- type: MaterialType_1.MaterialType.TechnologyBoard,
79
- value: _this.board.getItem().location.id
80
- } }));
15
+ this.memorize(Memory.WonBonus, bonusEffect.bonusId);
16
+ this.memorize(Memory.Effects, (effects = []) => {
17
+ effects.unshift({
18
+ ...bonusEffect.effect,
19
+ effectSource: {
20
+ type: MaterialType.TechnologyBoard,
21
+ value: this.board.getItem().location.id
22
+ }
23
+ });
81
24
  return effects;
82
25
  });
83
- moves.push.apply(moves, __spreadArray([], __read(bonusEffect.moves), false));
26
+ moves.push(...bonusEffect.moves);
84
27
  }
85
- moves.push.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
28
+ moves.push(...this.afterEffectPlayed());
86
29
  return moves;
87
- };
88
- Object.defineProperty(TakeTechnologyBonusTokenRule.prototype, "bonusEffect", {
89
- get: function () {
90
- var effect = this.effect;
91
- var board = this.board;
92
- var token = this.material(MaterialType_1.MaterialType.TechMarker)
93
- .location(LocationType_1.LocationType.TechnologyBoardTokenSpace)
94
- .parent(board.getIndex())
95
- .player(this.playerHelper.team);
96
- var item = token.getItem();
97
- if (item.location.x !== effect.x)
98
- return undefined;
99
- return new BonusHelper_1.BonusHelper(this.game).getTechnologyBonus(token);
100
- },
101
- enumerable: false,
102
- configurable: true
103
- });
104
- Object.defineProperty(TakeTechnologyBonusTokenRule.prototype, "board", {
105
- get: function () {
106
- var effect = this.effect;
107
- return this.material(MaterialType_1.MaterialType.TechnologyBoard).locationId(effect.faction);
108
- },
109
- enumerable: false,
110
- configurable: true
111
- });
112
- TakeTechnologyBonusTokenRule.prototype.isPossible = function () {
30
+ }
31
+ get bonusEffect() {
32
+ const effect = this.effect;
33
+ const board = this.board;
34
+ const token = this.material(MaterialType.TechMarker)
35
+ .location(LocationType.TechnologyBoardTokenSpace)
36
+ .parent(board.getIndex())
37
+ .player(this.playerHelper.team);
38
+ const item = token.getItem();
39
+ if (item.location.x !== effect.x)
40
+ return undefined;
41
+ return new BonusHelper(this.game).getTechnologyBonus(token);
42
+ }
43
+ get board() {
44
+ const effect = this.effect;
45
+ return this.material(MaterialType.TechnologyBoard).locationId(effect.faction);
46
+ }
47
+ isPossible() {
113
48
  return this.bonusEffect !== undefined;
114
- };
115
- TakeTechnologyBonusTokenRule.prototype.onRuleEnd = function () {
116
- this.forget(Memory_1.Memory.WonBonus);
117
- this.forget(Memory_1.Memory.CurrentEffect);
49
+ }
50
+ onRuleEnd() {
51
+ this.forget(Memory.WonBonus);
52
+ this.forget(Memory.CurrentEffect);
118
53
  return [];
119
- };
120
- return TakeTechnologyBonusTokenRule;
121
- }(EffectRule_1.EffectRule));
122
- exports.TakeTechnologyBonusTokenRule = TakeTechnologyBonusTokenRule;
54
+ }
55
+ }
@@ -1,55 +1,32 @@
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.TransferRule = void 0;
19
- var rules_api_1 = require("@gamepark/rules-api");
20
- var Agents_1 = require("../../material/Agents");
21
- var Influence_1 = require("../../material/Influence");
22
- var LocationType_1 = require("../../material/LocationType");
23
- var MaterialType_1 = require("../../material/MaterialType");
24
- var index_1 = require("./index");
25
- var TransferRule = (function (_super) {
26
- __extends(TransferRule, _super);
27
- function TransferRule() {
28
- return _super !== null && _super.apply(this, arguments) || this;
29
- }
30
- TransferRule.prototype.onRuleStart = function () {
31
- var _a;
32
- var moves = _super.prototype.onRuleStart.call(this);
1
+ import { isMoveItemType } from '@gamepark/rules-api';
2
+ import { Agents } from '../../material/Agents';
3
+ import { influences } from '../../material/Influence';
4
+ import { LocationType } from '../../material/LocationType';
5
+ import { MaterialType } from '../../material/MaterialType';
6
+ import { EffectRule } from './index';
7
+ export class TransferRule extends EffectRule {
8
+ onRuleStart() {
9
+ const moves = super.onRuleStart();
33
10
  if (moves.length > 0)
34
11
  return moves;
35
- if (this.effect.influence && ((_a = this.effect.quantity) !== null && _a !== void 0 ? _a : 1) === 1)
12
+ if (this.effect.influence && (this.effect.quantity ?? 1) === 1)
36
13
  return this.transferOneCard();
37
14
  return moves;
38
- };
39
- TransferRule.prototype.getPlayerMoves = function () {
15
+ }
16
+ getPlayerMoves() {
40
17
  return this.transferOneCard();
41
- };
42
- TransferRule.prototype.decrement = function (move) {
43
- if (!(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.AgentCard)(move) || move.location.type !== LocationType_1.LocationType.Influence)
18
+ }
19
+ decrement(move) {
20
+ if (!isMoveItemType(MaterialType.AgentCard)(move) || move.location.type !== LocationType.Influence)
44
21
  return false;
45
22
  if (this.effect.quantity) {
46
23
  this.effect.quantity--;
47
24
  return this.effect.quantity === 0 || !this.isPossible();
48
25
  }
49
26
  return true;
50
- };
51
- TransferRule.prototype.afterItemMove = function (move) {
52
- if (!(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.AgentCard)(move) || move.location.type !== LocationType_1.LocationType.Influence)
27
+ }
28
+ afterItemMove(move) {
29
+ if (!isMoveItemType(MaterialType.AgentCard)(move) || move.location.type !== LocationType.Influence)
53
30
  return [];
54
31
  if (this.effect.quantity) {
55
32
  this.effect.quantity--;
@@ -59,46 +36,35 @@ var TransferRule = (function (_super) {
59
36
  return this.afterEffectPlayed();
60
37
  }
61
38
  return [];
62
- };
63
- TransferRule.prototype.isPossible = function () {
64
- var _a;
65
- return this.influenceCards.length >= ((_a = this.effect.quantity) !== null && _a !== void 0 ? _a : 1);
66
- };
67
- TransferRule.prototype.transferOneCard = function () {
68
- var _this = this;
69
- var allInfluences = Influence_1.influences;
70
- var allCards = this.influenceCards;
39
+ }
40
+ isPossible() {
41
+ return this.influenceCards.length >= (this.effect.quantity ?? 1);
42
+ }
43
+ transferOneCard() {
44
+ const allInfluences = influences;
45
+ const allCards = this.influenceCards;
71
46
  return allInfluences
72
- .filter(function (influence) { return (_this.effect.influence ? influence === _this.effect.influence : true); })
73
- .flatMap(function (influence) {
74
- return allCards
75
- .locationId(influence)
76
- .maxBy(function (item) { return item.location.x; })
77
- .moveItems({
78
- type: LocationType_1.LocationType.Influence,
79
- id: influence,
80
- player: _this.playerHelper.team
81
- });
82
- });
83
- };
84
- Object.defineProperty(TransferRule.prototype, "influenceCards", {
85
- get: function () {
86
- var _this = this;
87
- var cards = this.material(MaterialType_1.MaterialType.AgentCard).location(LocationType_1.LocationType.Influence).player(this.opponentTeam);
88
- if (this.effect.influence)
89
- return cards.filter(function (item) { return Agents_1.Agents[item.id].influence === _this.effect.influence; });
90
- return cards;
91
- },
92
- enumerable: false,
93
- configurable: true
94
- });
95
- TransferRule.prototype.getExtraDataFromMove = function (move) {
96
- if ((0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.AgentCard)(move) && move.location.type === LocationType_1.LocationType.Influence) {
97
- var card = this.material(MaterialType_1.MaterialType.AgentCard).getItem(move.itemIndex);
98
- return { quantity: Agents_1.Agents[card.id].cost, influence: Agents_1.Agents[card.id].influence };
47
+ .filter((influence) => (this.effect.influence ? influence === this.effect.influence : true))
48
+ .flatMap((influence) => allCards
49
+ .locationId(influence)
50
+ .maxBy((item) => item.location.x)
51
+ .moveItems({
52
+ type: LocationType.Influence,
53
+ id: influence,
54
+ player: this.playerHelper.team
55
+ }));
56
+ }
57
+ get influenceCards() {
58
+ const cards = this.material(MaterialType.AgentCard).location(LocationType.Influence).player(this.opponentTeam);
59
+ if (this.effect.influence)
60
+ return cards.filter((item) => Agents[item.id].influence === this.effect.influence);
61
+ return cards;
62
+ }
63
+ getExtraDataFromMove(move) {
64
+ if (isMoveItemType(MaterialType.AgentCard)(move) && move.location.type === LocationType.Influence) {
65
+ const card = this.material(MaterialType.AgentCard).getItem(move.itemIndex);
66
+ return { quantity: Agents[card.id].cost, influence: Agents[card.id].influence };
99
67
  }
100
68
  return {};
101
- };
102
- return TransferRule;
103
- }(index_1.EffectRule));
104
- exports.TransferRule = TransferRule;
69
+ }
70
+ }
@@ -1,89 +1,35 @@
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 __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
- var __importDefault = (this && this.__importDefault) || function (mod) {
43
- return (mod && mod.__esModule) ? mod : { "default": mod };
44
- };
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.WinCreditRule = void 0;
47
- var uniq_1 = __importDefault(require("lodash/uniq"));
48
- var Agents_1 = require("../../material/Agents");
49
- var LocationType_1 = require("../../material/LocationType");
50
- var MaterialType_1 = require("../../material/MaterialType");
51
- var CustomMoveType_1 = require("../CustomMoveType");
52
- var Memory_1 = require("../Memory");
53
- var index_1 = require("./index");
54
- var WinCreditRule = (function (_super) {
55
- __extends(WinCreditRule, _super);
56
- function WinCreditRule() {
57
- return _super !== null && _super.apply(this, arguments) || this;
58
- }
59
- WinCreditRule.prototype.onRuleStart = function () {
60
- var moves = [];
61
- var money = this.creditMoney;
62
- var credits = this.wonCredit;
63
- this.memorize(Memory_1.Memory.Credit, credits);
64
- this.memorize(Memory_1.Memory.CurrentEffect, JSON.parse(JSON.stringify(this.effect)));
65
- moves.push(this.customMove(CustomMoveType_1.CustomMoveType.WinCreditLog, credits));
66
- moves.push.apply(moves, __spreadArray([], __read(money.addMoney(credits, { type: LocationType_1.LocationType.TeamCredit, player: this.effect.opponent ? this.opponentTeam : this.playerHelper.team })), false));
1
+ import uniq from 'lodash/uniq';
2
+ import { Agents } from '../../material/Agents';
3
+ import { LocationType } from '../../material/LocationType';
4
+ import { MaterialType } from '../../material/MaterialType';
5
+ import { CustomMoveType } from '../CustomMoveType';
6
+ import { Memory } from '../Memory';
7
+ import { EffectRule } from './index';
8
+ export class WinCreditRule extends EffectRule {
9
+ onRuleStart() {
10
+ const moves = [];
11
+ const money = this.creditMoney;
12
+ const credits = this.wonCredit;
13
+ this.memorize(Memory.Credit, credits);
14
+ this.memorize(Memory.CurrentEffect, JSON.parse(JSON.stringify(this.effect)));
15
+ moves.push(this.customMove(CustomMoveType.WinCreditLog, credits));
16
+ moves.push(...money.addMoney(credits, { type: LocationType.TeamCredit, player: this.effect.opponent ? this.opponentTeam : this.playerHelper.team }));
67
17
  this.removeFirstEffect();
68
- moves.push.apply(moves, __spreadArray([], __read(this.afterEffectPlayed()), false));
18
+ moves.push(...this.afterEffectPlayed());
69
19
  return moves;
70
- };
71
- Object.defineProperty(WinCreditRule.prototype, "wonCredit", {
72
- get: function () {
73
- if (this.effect.quantity)
74
- return this.effect.quantity;
75
- if (this.effect.perLevel1Technology)
76
- return this.effect.perLevel1Technology[this.level1Technology - 1];
77
- if (this.effect.factorPerDifferentInfluence)
78
- return this.distinctInfluence * this.effect.factorPerDifferentInfluence;
79
- if (this.effect.factorPerDifferentOpponentInfluence)
80
- return this.opponentDistinctInfluence * this.effect.factorPerDifferentOpponentInfluence;
81
- return 0;
82
- },
83
- enumerable: false,
84
- configurable: true
85
- });
86
- WinCreditRule.prototype.isPossible = function () {
20
+ }
21
+ get wonCredit() {
22
+ if (this.effect.quantity)
23
+ return this.effect.quantity;
24
+ if (this.effect.perLevel1Technology)
25
+ return this.effect.perLevel1Technology[this.level1Technology - 1];
26
+ if (this.effect.factorPerDifferentInfluence)
27
+ return this.distinctInfluence * this.effect.factorPerDifferentInfluence;
28
+ if (this.effect.factorPerDifferentOpponentInfluence)
29
+ return this.opponentDistinctInfluence * this.effect.factorPerDifferentOpponentInfluence;
30
+ return 0;
31
+ }
32
+ isPossible() {
87
33
  if (this.effect.perLevel1Technology)
88
34
  return this.level1Technology > 0;
89
35
  if (this.effect.factorPerDifferentInfluence)
@@ -91,52 +37,36 @@ var WinCreditRule = (function (_super) {
91
37
  if (this.effect.factorPerDifferentOpponentInfluence)
92
38
  return this.opponentDistinctInfluence > 0;
93
39
  return true;
94
- };
95
- Object.defineProperty(WinCreditRule.prototype, "distinctInfluence", {
96
- get: function () {
97
- var items = this.material(MaterialType_1.MaterialType.AgentCard)
98
- .location(LocationType_1.LocationType.Influence)
99
- .player(this.playerHelper.team)
100
- .getItems()
101
- .map(function (a) { return Agents_1.Agents[a.id].influence; });
102
- return (0, uniq_1.default)(items).length;
103
- },
104
- enumerable: false,
105
- configurable: true
106
- });
107
- Object.defineProperty(WinCreditRule.prototype, "opponentDistinctInfluence", {
108
- get: function () {
109
- var items = this.material(MaterialType_1.MaterialType.AgentCard)
110
- .location(LocationType_1.LocationType.Influence)
111
- .player(this.opponentTeam)
112
- .getItems()
113
- .map(function (a) { return Agents_1.Agents[a.id].influence; });
114
- return (0, uniq_1.default)(items).length;
115
- },
116
- enumerable: false,
117
- configurable: true
118
- });
119
- Object.defineProperty(WinCreditRule.prototype, "level1Technology", {
120
- get: function () {
121
- return this.material(MaterialType_1.MaterialType.TechMarker)
122
- .player(this.playerHelper.team)
123
- .location(function (l) { return l.type === LocationType_1.LocationType.TechnologyBoardTokenSpace && l.x === 1; }).length;
124
- },
125
- enumerable: false,
126
- configurable: true
127
- });
128
- WinCreditRule.prototype.setExtraData = function (_extraData) {
129
- var _a;
130
- var _b;
40
+ }
41
+ get distinctInfluence() {
42
+ const items = this.material(MaterialType.AgentCard)
43
+ .location(LocationType.Influence)
44
+ .player(this.playerHelper.team)
45
+ .getItems()
46
+ .map((a) => Agents[a.id].influence);
47
+ return uniq(items).length;
48
+ }
49
+ get opponentDistinctInfluence() {
50
+ const items = this.material(MaterialType.AgentCard)
51
+ .location(LocationType.Influence)
52
+ .player(this.opponentTeam)
53
+ .getItems()
54
+ .map((a) => Agents[a.id].influence);
55
+ return uniq(items).length;
56
+ }
57
+ get level1Technology() {
58
+ return this.material(MaterialType.TechMarker)
59
+ .player(this.playerHelper.team)
60
+ .location((l) => l.type === LocationType.TechnologyBoardTokenSpace && l.x === 1).length;
61
+ }
62
+ setExtraData(_extraData) {
131
63
  if (_extraData.quantity) {
132
- (_a = (_b = this.effect).quantity) !== null && _a !== void 0 ? _a : (_b.quantity = _extraData.quantity);
64
+ this.effect.quantity ??= _extraData.quantity;
133
65
  }
134
- };
135
- WinCreditRule.prototype.onRuleEnd = function () {
136
- this.forget(Memory_1.Memory.Credit);
137
- this.forget(Memory_1.Memory.CurrentEffect);
66
+ }
67
+ onRuleEnd() {
68
+ this.forget(Memory.Credit);
69
+ this.forget(Memory.CurrentEffect);
138
70
  return [];
139
- };
140
- return WinCreditRule;
141
- }(index_1.EffectRule));
142
- exports.WinCreditRule = WinCreditRule;
71
+ }
72
+ }