@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.
- package/dist/PlayerId.js +1 -2
- package/dist/TeamColor.js +7 -13
- package/dist/ZenithOptions.js +1 -4
- package/dist/ZenithRules.js +71 -122
- package/dist/ZenithSetup.js +123 -266
- package/dist/index.js +3 -9
- package/dist/material/Agent.js +4 -7
- package/dist/material/Agents.js +920 -923
- package/dist/material/Bonus.js +5 -8
- package/dist/material/Bonuses.js +29 -33
- package/dist/material/Credit.js +4 -7
- package/dist/material/Faction.js +4 -7
- package/dist/material/Influence.js +4 -7
- package/dist/material/LocationType.js +2 -5
- package/dist/material/MaterialType.js +2 -5
- package/dist/material/effect/Effect.js +5 -10
- package/dist/material/effect/EffectType.js +2 -5
- package/dist/rules/CustomMoveType.js +2 -5
- package/dist/rules/DiscardActionRule.js +26 -75
- package/dist/rules/Memory.js +2 -5
- package/dist/rules/MulliganRule.js +47 -126
- package/dist/rules/PlayCardRule.js +68 -134
- package/dist/rules/RefillRule.js +83 -190
- package/dist/rules/RuleId.js +2 -5
- package/dist/rules/discard-action/DiplomacyActions.js +15 -20
- package/dist/rules/discard-action/DiplomacyBoardRule.js +27 -64
- package/dist/rules/discard-action/TechnologyActions.js +44 -48
- package/dist/rules/discard-action/TechnologyBoardRule.js +34 -102
- package/dist/rules/effect/ChoiceRule.js +21 -81
- package/dist/rules/effect/ConditionalRule.js +77 -141
- package/dist/rules/effect/DevelopTechnologyRule.js +53 -119
- package/dist/rules/effect/DiscardRule.js +37 -90
- package/dist/rules/effect/EffectRule.js +60 -138
- package/dist/rules/effect/ExileRule.js +62 -147
- package/dist/rules/effect/GiveCreditRule.js +24 -73
- package/dist/rules/effect/GiveInfluenceRule.js +38 -101
- package/dist/rules/effect/GiveLeaderBadgeRule.js +18 -46
- package/dist/rules/effect/GiveZenithiumRule.js +25 -79
- package/dist/rules/effect/MobilizeRule.js +38 -93
- package/dist/rules/effect/ResetInfluenceRule.js +21 -58
- package/dist/rules/effect/SpendCreditRule.js +29 -102
- package/dist/rules/effect/SpendZenithiumRule.js +32 -109
- package/dist/rules/effect/StealCreditRule.js +15 -64
- package/dist/rules/effect/TakeBonusRule.js +30 -91
- package/dist/rules/effect/TakeLeaderBadgeRule.js +31 -88
- package/dist/rules/effect/TakeTechnologyBonusTokenRule.js +45 -112
- package/dist/rules/effect/TransferRule.js +47 -81
- package/dist/rules/effect/WinCreditRule.js +60 -130
- package/dist/rules/effect/WinInfluenceRule.js +128 -248
- package/dist/rules/effect/WinZenithiumRule.js +24 -80
- package/dist/rules/effect/index.js +19 -35
- package/dist/rules/helper/BonusHelper.js +32 -64
- package/dist/rules/helper/CreditHelper.js +19 -44
- package/dist/rules/helper/EffectHelper.js +81 -123
- package/dist/rules/helper/EffectRuleIds.js +25 -29
- package/dist/rules/helper/EndGameHelper.js +24 -57
- package/dist/rules/helper/InfluenceHelper.js +18 -44
- package/dist/rules/helper/MobilizeHelper.js +27 -53
- package/dist/rules/helper/PlanetHelper.js +45 -78
- package/dist/rules/helper/PlayerHelper.js +24 -60
- package/dist/rules/helper/TechnologyHelper.js +31 -87
- package/dist/rules/helper/ZenithiumHelper.js +25 -48
- package/package.json +4 -3
|
@@ -1,86 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.BonusHelper = void 0;
|
|
30
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
31
|
-
var Bonuses_1 = require("../../material/Bonuses");
|
|
32
|
-
var LocationType_1 = require("../../material/LocationType");
|
|
33
|
-
var MaterialType_1 = require("../../material/MaterialType");
|
|
34
|
-
var Memory_1 = require("../Memory");
|
|
35
|
-
var BonusHelper = (function (_super) {
|
|
36
|
-
__extends(BonusHelper, _super);
|
|
37
|
-
function BonusHelper() {
|
|
38
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
39
|
-
}
|
|
40
|
-
BonusHelper.prototype.applyInfluenceBonus = function (influence) {
|
|
41
|
-
var bonusToken = this.material(MaterialType_1.MaterialType.BonusToken).location(LocationType_1.LocationType.PlanetBoardBonusSpace).locationId(influence);
|
|
1
|
+
import { MaterialRulesPart } from '@gamepark/rules-api';
|
|
2
|
+
import { Bonuses } from '../../material/Bonuses';
|
|
3
|
+
import { LocationType } from '../../material/LocationType';
|
|
4
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
5
|
+
import { Memory } from '../Memory';
|
|
6
|
+
export class BonusHelper extends MaterialRulesPart {
|
|
7
|
+
applyInfluenceBonus(influence) {
|
|
8
|
+
const bonusToken = this.material(MaterialType.BonusToken).location(LocationType.PlanetBoardBonusSpace).locationId(influence);
|
|
42
9
|
return this.applyBonusEffect(bonusToken);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
10
|
+
}
|
|
11
|
+
getTechnologyBonus(token) {
|
|
12
|
+
const tokenItem = token.getItem();
|
|
46
13
|
if (tokenItem.location.x !== 2)
|
|
47
14
|
return;
|
|
48
|
-
|
|
15
|
+
const bonusToken = this.material(MaterialType.BonusToken).location(LocationType.TechnologyBoardBonusSpace).parent(tokenItem.location.parent);
|
|
49
16
|
if (!bonusToken.length)
|
|
50
17
|
return;
|
|
51
18
|
return {
|
|
52
19
|
effect: this.getBonusEffect(bonusToken),
|
|
53
20
|
moves: [
|
|
54
21
|
bonusToken.moveItem({
|
|
55
|
-
type:
|
|
22
|
+
type: LocationType.BonusDiscard
|
|
56
23
|
})
|
|
57
24
|
],
|
|
58
25
|
bonusId: bonusToken.getItem().id
|
|
59
26
|
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
27
|
+
}
|
|
28
|
+
applyBonusEffect(bonusToken) {
|
|
29
|
+
const moves = [];
|
|
30
|
+
const bonusEffect = this.getBonusEffect(bonusToken);
|
|
64
31
|
if (bonusEffect) {
|
|
65
32
|
moves.push(bonusToken.moveItem({
|
|
66
|
-
type:
|
|
33
|
+
type: LocationType.BonusDiscard
|
|
67
34
|
}));
|
|
68
|
-
|
|
69
|
-
effects.splice(1, 0,
|
|
70
|
-
|
|
35
|
+
const effects = this.remind(Memory.Effects);
|
|
36
|
+
effects.splice(1, 0, {
|
|
37
|
+
...bonusEffect,
|
|
38
|
+
effectSource: {
|
|
39
|
+
type: MaterialType.BonusToken,
|
|
71
40
|
value: bonusToken.getItem().id
|
|
72
|
-
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
73
43
|
}
|
|
74
44
|
return moves;
|
|
75
|
-
}
|
|
76
|
-
|
|
45
|
+
}
|
|
46
|
+
getBonusEffect(bonusToken) {
|
|
77
47
|
if (bonusToken.length) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return JSON.parse(JSON.stringify(
|
|
48
|
+
const bonusItem = bonusToken.getItem();
|
|
49
|
+
const bonusId = bonusItem.id;
|
|
50
|
+
return JSON.parse(JSON.stringify(Bonuses[bonusId].effect));
|
|
81
51
|
}
|
|
82
52
|
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
}(rules_api_1.MaterialRulesPart));
|
|
86
|
-
exports.BonusHelper = BonusHelper;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,45 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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.CreditHelper = void 0;
|
|
19
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
20
|
-
var Credit_1 = require("../../material/Credit");
|
|
21
|
-
var LocationType_1 = require("../../material/LocationType");
|
|
22
|
-
var MaterialType_1 = require("../../material/MaterialType");
|
|
23
|
-
var PlayerHelper_1 = require("./PlayerHelper");
|
|
24
|
-
var CreditHelper = (function (_super) {
|
|
25
|
-
__extends(CreditHelper, _super);
|
|
26
|
-
function CreditHelper(game, player) {
|
|
27
|
-
var _this = _super.call(this, game) || this;
|
|
28
|
-
_this.player = player;
|
|
29
|
-
_this.playerHelper = new PlayerHelper_1.PlayerHelper(game, player);
|
|
30
|
-
return _this;
|
|
1
|
+
import { MaterialRulesPart } from '@gamepark/rules-api';
|
|
2
|
+
import { credits } from '../../material/Credit';
|
|
3
|
+
import { LocationType } from '../../material/LocationType';
|
|
4
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
5
|
+
import { PlayerHelper } from './PlayerHelper';
|
|
6
|
+
export class CreditHelper extends MaterialRulesPart {
|
|
7
|
+
player;
|
|
8
|
+
playerHelper;
|
|
9
|
+
constructor(game, player) {
|
|
10
|
+
super(game);
|
|
11
|
+
this.player = player;
|
|
12
|
+
this.playerHelper = new PlayerHelper(game, player);
|
|
31
13
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
CreditHelper.prototype.spendCredit = function (count) {
|
|
40
|
-
if (count === void 0) { count = 1; }
|
|
41
|
-
return this.creditMoney.removeMoney(count, { type: LocationType_1.LocationType.TeamCredit, player: this.playerHelper.team });
|
|
42
|
-
};
|
|
43
|
-
return CreditHelper;
|
|
44
|
-
}(rules_api_1.MaterialRulesPart));
|
|
45
|
-
exports.CreditHelper = CreditHelper;
|
|
14
|
+
get creditMoney() {
|
|
15
|
+
return this.material(MaterialType.CreditToken).money(credits);
|
|
16
|
+
}
|
|
17
|
+
spendCredit(count = 1) {
|
|
18
|
+
return this.creditMoney.removeMoney(count, { type: LocationType.TeamCredit, player: this.playerHelper.team });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,133 +1,91 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getEffectRule = exports.EffectHelper = void 0;
|
|
30
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
31
|
-
var Agents_1 = require("../../material/Agents");
|
|
32
|
-
var EffectType_1 = require("../../material/effect/EffectType");
|
|
33
|
-
var MaterialType_1 = require("../../material/MaterialType");
|
|
34
|
-
var effect_1 = require("../effect");
|
|
35
|
-
var SpendZenithiumRule_1 = require("../effect/SpendZenithiumRule");
|
|
36
|
-
var StealCreditRule_1 = require("../effect/StealCreditRule");
|
|
37
|
-
var TakeTechnologyBonusTokenRule_1 = require("../effect/TakeTechnologyBonusTokenRule");
|
|
38
|
-
var Memory_1 = require("../Memory");
|
|
39
|
-
var EffectRuleIds_1 = require("./EffectRuleIds");
|
|
40
|
-
var EffectHelper = (function (_super) {
|
|
41
|
-
__extends(EffectHelper, _super);
|
|
42
|
-
function EffectHelper(game, player) {
|
|
43
|
-
var _this = _super.call(this, game) || this;
|
|
44
|
-
_this.player = player;
|
|
45
|
-
return _this;
|
|
1
|
+
import { MaterialRulesPart } from '@gamepark/rules-api';
|
|
2
|
+
import { Agents } from '../../material/Agents';
|
|
3
|
+
import { EffectType } from '../../material/effect/EffectType';
|
|
4
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
5
|
+
import { ChoiceRule, ConditionalRule, DevelopTechnologyRule, DiscardRule, ExileRule, GiveCreditRule, GiveInfluenceRule, GiveLeaderBadgeRule, GiveZenithiumRule, MobilizeRule, ResetInfluenceRule, SpendCreditRule, TakeBonusRule, TakeLeaderBadgeRule, TransferRule, WinCreditRule, WinInfluenceRule, WinZenithiumRule } from '../effect';
|
|
6
|
+
import { SpendZenithiumRule } from '../effect/SpendZenithiumRule';
|
|
7
|
+
import { StealCreditRule } from '../effect/StealCreditRule';
|
|
8
|
+
import { TakeTechnologyBonusTokenRule } from '../effect/TakeTechnologyBonusTokenRule';
|
|
9
|
+
import { Memory } from '../Memory';
|
|
10
|
+
import { EffectRuleIds } from './EffectRuleIds';
|
|
11
|
+
export class EffectHelper extends MaterialRulesPart {
|
|
12
|
+
player;
|
|
13
|
+
constructor(game, player) {
|
|
14
|
+
super(game);
|
|
15
|
+
this.player = player;
|
|
46
16
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.memorize(
|
|
50
|
-
|
|
17
|
+
applyCard(item) {
|
|
18
|
+
const agent = Agents[item.id];
|
|
19
|
+
this.memorize(Memory.Effects, JSON.parse(JSON.stringify(agent.effects.map((e) => ({
|
|
20
|
+
...e,
|
|
21
|
+
effectSource: {
|
|
22
|
+
type: MaterialType.AgentCard,
|
|
51
23
|
value: item.id
|
|
52
|
-
}
|
|
24
|
+
}
|
|
25
|
+
})))));
|
|
53
26
|
return this.applyFirstEffect();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
27
|
+
}
|
|
28
|
+
applyFirstEffect() {
|
|
29
|
+
const effect = this.effect;
|
|
57
30
|
if (!effect) {
|
|
58
31
|
return [];
|
|
59
32
|
}
|
|
60
33
|
return [this.startRule(this.effectRuleIds[effect.type])];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
enumerable: false,
|
|
75
|
-
configurable: true
|
|
76
|
-
});
|
|
77
|
-
Object.defineProperty(EffectHelper.prototype, "effectRuleIds", {
|
|
78
|
-
get: function () {
|
|
79
|
-
return EffectRuleIds_1.EffectRuleIds;
|
|
80
|
-
},
|
|
81
|
-
enumerable: false,
|
|
82
|
-
configurable: true
|
|
83
|
-
});
|
|
84
|
-
return EffectHelper;
|
|
85
|
-
}(rules_api_1.MaterialRulesPart));
|
|
86
|
-
exports.EffectHelper = EffectHelper;
|
|
87
|
-
var getEffectRule = function (game, effect) {
|
|
34
|
+
}
|
|
35
|
+
get effect() {
|
|
36
|
+
const effects = this.effects;
|
|
37
|
+
return effects[0];
|
|
38
|
+
}
|
|
39
|
+
get effects() {
|
|
40
|
+
return this.remind(Memory.Effects);
|
|
41
|
+
}
|
|
42
|
+
get effectRuleIds() {
|
|
43
|
+
return EffectRuleIds;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export const getEffectRule = (game, effect) => {
|
|
88
47
|
switch (effect.type) {
|
|
89
|
-
case
|
|
90
|
-
return new
|
|
91
|
-
case
|
|
92
|
-
return new
|
|
93
|
-
case
|
|
94
|
-
return new
|
|
95
|
-
case
|
|
96
|
-
return new
|
|
97
|
-
case
|
|
98
|
-
return new
|
|
99
|
-
case
|
|
100
|
-
return new
|
|
101
|
-
case
|
|
102
|
-
return new
|
|
103
|
-
case
|
|
104
|
-
return new
|
|
105
|
-
case
|
|
106
|
-
return new
|
|
107
|
-
case
|
|
108
|
-
return new
|
|
109
|
-
case
|
|
110
|
-
return new
|
|
111
|
-
case
|
|
112
|
-
return new
|
|
113
|
-
case
|
|
114
|
-
return new
|
|
115
|
-
case
|
|
116
|
-
return new
|
|
117
|
-
case
|
|
118
|
-
return new
|
|
119
|
-
case
|
|
120
|
-
return new
|
|
121
|
-
case
|
|
122
|
-
return new
|
|
123
|
-
case
|
|
124
|
-
return new
|
|
125
|
-
case
|
|
126
|
-
return new
|
|
127
|
-
case
|
|
128
|
-
return new
|
|
129
|
-
case
|
|
130
|
-
return new
|
|
48
|
+
case EffectType.ResetInfluence:
|
|
49
|
+
return new ResetInfluenceRule(game, effect);
|
|
50
|
+
case EffectType.WinCredit:
|
|
51
|
+
return new WinCreditRule(game, effect);
|
|
52
|
+
case EffectType.SpendCredit:
|
|
53
|
+
return new SpendCreditRule(game, effect);
|
|
54
|
+
case EffectType.WinZenithium:
|
|
55
|
+
return new WinZenithiumRule(game, effect);
|
|
56
|
+
case EffectType.GiveZenithium:
|
|
57
|
+
return new GiveZenithiumRule(game, effect);
|
|
58
|
+
case EffectType.Exile:
|
|
59
|
+
return new ExileRule(game, effect);
|
|
60
|
+
case EffectType.DevelopTechnology:
|
|
61
|
+
return new DevelopTechnologyRule(game, effect);
|
|
62
|
+
case EffectType.GiveLeaderBadge:
|
|
63
|
+
return new GiveLeaderBadgeRule(game, effect);
|
|
64
|
+
case EffectType.TakeLeaderBadge:
|
|
65
|
+
return new TakeLeaderBadgeRule(game, effect);
|
|
66
|
+
case EffectType.Discard:
|
|
67
|
+
return new DiscardRule(game, effect);
|
|
68
|
+
case EffectType.Mobilize:
|
|
69
|
+
return new MobilizeRule(game, effect);
|
|
70
|
+
case EffectType.Choice:
|
|
71
|
+
return new ChoiceRule(game, effect);
|
|
72
|
+
case EffectType.TakeBonus:
|
|
73
|
+
return new TakeBonusRule(game, effect);
|
|
74
|
+
case EffectType.GiveInfluence:
|
|
75
|
+
return new GiveInfluenceRule(game, effect);
|
|
76
|
+
case EffectType.WinInfluence:
|
|
77
|
+
return new WinInfluenceRule(game, effect);
|
|
78
|
+
case EffectType.Conditional:
|
|
79
|
+
return new ConditionalRule(game, effect);
|
|
80
|
+
case EffectType.Transfer:
|
|
81
|
+
return new TransferRule(game, effect);
|
|
82
|
+
case EffectType.GiveCredit:
|
|
83
|
+
return new GiveCreditRule(game, effect);
|
|
84
|
+
case EffectType.StealCredit:
|
|
85
|
+
return new StealCreditRule(game, effect);
|
|
86
|
+
case EffectType.SpendZenithium:
|
|
87
|
+
return new SpendZenithiumRule(game, effect);
|
|
88
|
+
case EffectType.TakeTechnologyBonusToken:
|
|
89
|
+
return new TakeTechnologyBonusTokenRule(game, effect);
|
|
131
90
|
}
|
|
132
91
|
};
|
|
133
|
-
exports.getEffectRule = getEffectRule;
|
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_a[EffectType_1.EffectType.StealCredit] = RuleId_1.RuleId.StealCredit,
|
|
27
|
-
_a[EffectType_1.EffectType.SpendZenithium] = RuleId_1.RuleId.SpendZenithium,
|
|
28
|
-
_a[EffectType_1.EffectType.TakeTechnologyBonusToken] = RuleId_1.RuleId.TakeTechnologyBonusToken,
|
|
29
|
-
_a);
|
|
1
|
+
import { EffectType } from '../../material/effect/EffectType';
|
|
2
|
+
import { RuleId } from '../RuleId';
|
|
3
|
+
export const EffectRuleIds = {
|
|
4
|
+
[EffectType.Transfer]: RuleId.Transfer,
|
|
5
|
+
[EffectType.GiveCredit]: RuleId.GiveCredit,
|
|
6
|
+
[EffectType.WinCredit]: RuleId.WinCredit,
|
|
7
|
+
[EffectType.SpendCredit]: RuleId.SpendCredit,
|
|
8
|
+
[EffectType.Conditional]: RuleId.Conditional,
|
|
9
|
+
[EffectType.WinZenithium]: RuleId.WinZenithium,
|
|
10
|
+
[EffectType.GiveZenithium]: RuleId.GiveZenithium,
|
|
11
|
+
[EffectType.Exile]: RuleId.Exile,
|
|
12
|
+
[EffectType.WinInfluence]: RuleId.WinInfluence,
|
|
13
|
+
[EffectType.GiveInfluence]: RuleId.GiveInfluence,
|
|
14
|
+
[EffectType.ResetInfluence]: RuleId.ResetInfluence,
|
|
15
|
+
[EffectType.DevelopTechnology]: RuleId.DevelopTechnology,
|
|
16
|
+
[EffectType.GiveLeaderBadge]: RuleId.GiveLeaderBadge,
|
|
17
|
+
[EffectType.TakeLeaderBadge]: RuleId.TakeLeaderBadge,
|
|
18
|
+
[EffectType.Discard]: RuleId.Discard,
|
|
19
|
+
[EffectType.Mobilize]: RuleId.Mobilize,
|
|
20
|
+
[EffectType.Choice]: RuleId.Choice,
|
|
21
|
+
[EffectType.TakeBonus]: RuleId.TakeBonus,
|
|
22
|
+
[EffectType.StealCredit]: RuleId.StealCredit,
|
|
23
|
+
[EffectType.SpendZenithium]: RuleId.SpendZenithium,
|
|
24
|
+
[EffectType.TakeTechnologyBonusToken]: RuleId.TakeTechnologyBonusToken
|
|
25
|
+
};
|
|
@@ -1,70 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.EndGameHelper = void 0;
|
|
22
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
23
|
-
var lodash_1 = require("lodash");
|
|
24
|
-
var maxBy_1 = __importDefault(require("lodash/maxBy"));
|
|
25
|
-
var Influence_1 = require("../../material/Influence");
|
|
26
|
-
var LocationType_1 = require("../../material/LocationType");
|
|
27
|
-
var MaterialType_1 = require("../../material/MaterialType");
|
|
28
|
-
var TeamColor_1 = require("../../TeamColor");
|
|
29
|
-
var EndGameHelper = (function (_super) {
|
|
30
|
-
__extends(EndGameHelper, _super);
|
|
31
|
-
function EndGameHelper() {
|
|
32
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
33
|
-
}
|
|
34
|
-
EndGameHelper.prototype.willEnd = function (team, planets) {
|
|
35
|
-
if (planets === void 0) { planets = this.getTeamPlanet(team); }
|
|
1
|
+
import { MaterialRulesPart } from '@gamepark/rules-api';
|
|
2
|
+
import { uniqBy } from 'lodash';
|
|
3
|
+
import maxBy from 'lodash/maxBy';
|
|
4
|
+
import { influences } from '../../material/Influence';
|
|
5
|
+
import { LocationType } from '../../material/LocationType';
|
|
6
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
7
|
+
import { teamColors } from '../../TeamColor';
|
|
8
|
+
export class EndGameHelper extends MaterialRulesPart {
|
|
9
|
+
willEnd(team, planets = this.getTeamPlanet(team)) {
|
|
36
10
|
if (planets.length === 5)
|
|
37
11
|
return true;
|
|
38
|
-
|
|
12
|
+
const maxSameInfluence = this.getMaxSameInfluence(planets);
|
|
39
13
|
if (maxSameInfluence && maxSameInfluence.count >= 3)
|
|
40
14
|
return true;
|
|
41
15
|
if (this.getCountDifferentInfluence(planets) >= 4)
|
|
42
16
|
return true;
|
|
43
17
|
return false;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
EndGameHelper.prototype.getCountDifferentInfluence = function (planets) {
|
|
57
|
-
return (0, lodash_1.uniqBy)(planets.getItems(), function (item) { return item.id; }).length;
|
|
58
|
-
};
|
|
59
|
-
EndGameHelper.prototype.getMaxSameInfluence = function (planets) {
|
|
60
|
-
var maxInfluence = (0, maxBy_1.default)(Influence_1.influences, function (i) { return planets.id(i).length; });
|
|
18
|
+
}
|
|
19
|
+
get winningTeam() {
|
|
20
|
+
return teamColors.find((team) => this.willEnd(team));
|
|
21
|
+
}
|
|
22
|
+
getTeamPlanet(team) {
|
|
23
|
+
return this.material(MaterialType.InfluenceDisc).location(LocationType.TeamPlanets).player(team);
|
|
24
|
+
}
|
|
25
|
+
getCountDifferentInfluence(planets) {
|
|
26
|
+
return uniqBy(planets.getItems(), (item) => item.id).length;
|
|
27
|
+
}
|
|
28
|
+
getMaxSameInfluence(planets) {
|
|
29
|
+
const maxInfluence = maxBy(influences, (i) => planets.id(i).length);
|
|
61
30
|
if (!maxInfluence)
|
|
62
31
|
return;
|
|
63
32
|
return {
|
|
64
33
|
influence: maxInfluence,
|
|
65
34
|
count: planets.id(maxInfluence).length
|
|
66
35
|
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
}(rules_api_1.MaterialRulesPart));
|
|
70
|
-
exports.EndGameHelper = EndGameHelper;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -1,47 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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.InfluenceHelper = void 0;
|
|
19
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
20
|
-
var Agents_1 = require("../../material/Agents");
|
|
21
|
-
var LocationType_1 = require("../../material/LocationType");
|
|
22
|
-
var MaterialType_1 = require("../../material/MaterialType");
|
|
23
|
-
var InfluenceHelper = (function (_super) {
|
|
24
|
-
__extends(InfluenceHelper, _super);
|
|
25
|
-
function InfluenceHelper(game, team) {
|
|
26
|
-
var _this = _super.call(this, game) || this;
|
|
27
|
-
_this.team = team;
|
|
28
|
-
return _this;
|
|
1
|
+
import { MaterialRulesPart } from '@gamepark/rules-api';
|
|
2
|
+
import { Agents } from '../../material/Agents';
|
|
3
|
+
import { LocationType } from '../../material/LocationType';
|
|
4
|
+
import { MaterialType } from '../../material/MaterialType';
|
|
5
|
+
export class InfluenceHelper extends MaterialRulesPart {
|
|
6
|
+
team;
|
|
7
|
+
constructor(game, team) {
|
|
8
|
+
super(game);
|
|
9
|
+
this.team = team;
|
|
29
10
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var description = Agents_1.Agents[item.id];
|
|
11
|
+
getCost(item, decreaseInfluenceBy = 0) {
|
|
12
|
+
const description = Agents[item.id];
|
|
33
13
|
return Math.max(0, description.cost - (this.getInfluence(description.influence).length - decreaseInfluenceBy));
|
|
34
|
-
}
|
|
35
|
-
|
|
14
|
+
}
|
|
15
|
+
getInfluence(influence) {
|
|
36
16
|
return this.influence.locationId(influence);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
enumerable: false,
|
|
43
|
-
configurable: true
|
|
44
|
-
});
|
|
45
|
-
return InfluenceHelper;
|
|
46
|
-
}(rules_api_1.MaterialRulesPart));
|
|
47
|
-
exports.InfluenceHelper = InfluenceHelper;
|
|
17
|
+
}
|
|
18
|
+
get influence() {
|
|
19
|
+
return this.material(MaterialType.AgentCard).location(LocationType.Influence).player(this.team);
|
|
20
|
+
}
|
|
21
|
+
}
|