@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,147 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.PlayCardRule = void 0;
|
|
44
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
45
|
-
var Agents_1 = require("../material/Agents");
|
|
46
|
-
var LocationType_1 = require("../material/LocationType");
|
|
47
|
-
var MaterialType_1 = require("../material/MaterialType");
|
|
48
|
-
var TeamColor_1 = require("../TeamColor");
|
|
49
|
-
var CreditHelper_1 = require("./helper/CreditHelper");
|
|
50
|
-
var EffectHelper_1 = require("./helper/EffectHelper");
|
|
51
|
-
var InfluenceHelper_1 = require("./helper/InfluenceHelper");
|
|
52
|
-
var PlayerHelper_1 = require("./helper/PlayerHelper");
|
|
53
|
-
var Memory_1 = require("./Memory");
|
|
54
|
-
var RuleId_1 = require("./RuleId");
|
|
55
|
-
var PlayCardRule = (function (_super) {
|
|
56
|
-
__extends(PlayCardRule, _super);
|
|
57
|
-
function PlayCardRule() {
|
|
58
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
59
|
-
}
|
|
60
|
-
PlayCardRule.prototype.onRuleStart = function () {
|
|
61
|
-
this.forget(Memory_1.Memory.DiscardFaction);
|
|
62
|
-
this.forget(Memory_1.Memory.LastPlanetsMoved);
|
|
1
|
+
import { isMoveItemType, isStartPlayerTurn, isStartRule, PlayerTurnRule } from '@gamepark/rules-api';
|
|
2
|
+
import { Agents } from '../material/Agents';
|
|
3
|
+
import { LocationType } from '../material/LocationType';
|
|
4
|
+
import { MaterialType } from '../material/MaterialType';
|
|
5
|
+
import { getTeamColor } from '../TeamColor';
|
|
6
|
+
import { CreditHelper } from './helper/CreditHelper';
|
|
7
|
+
import { EffectHelper } from './helper/EffectHelper';
|
|
8
|
+
import { InfluenceHelper } from './helper/InfluenceHelper';
|
|
9
|
+
import { PlayerHelper } from './helper/PlayerHelper';
|
|
10
|
+
import { Memory } from './Memory';
|
|
11
|
+
import { RuleId } from './RuleId';
|
|
12
|
+
export class PlayCardRule extends PlayerTurnRule {
|
|
13
|
+
onRuleStart() {
|
|
14
|
+
this.forget(Memory.DiscardFaction);
|
|
15
|
+
this.forget(Memory.LastPlanetsMoved);
|
|
63
16
|
return [];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
moves.push
|
|
69
|
-
moves.push
|
|
17
|
+
}
|
|
18
|
+
getPlayerMoves() {
|
|
19
|
+
const moves = [];
|
|
20
|
+
const hand = this.hand;
|
|
21
|
+
moves.push(...this.discardAgents(hand));
|
|
22
|
+
moves.push(...this.placeInInfluence(hand));
|
|
70
23
|
return moves;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var playerHelper = this.playerHelper;
|
|
24
|
+
}
|
|
25
|
+
placeInInfluence(cards) {
|
|
26
|
+
const influenceHelper = this.influenceHelper;
|
|
27
|
+
const playerHelper = this.playerHelper;
|
|
76
28
|
return cards
|
|
77
|
-
.filter(
|
|
78
|
-
.moveItems(
|
|
79
|
-
type:
|
|
80
|
-
id:
|
|
81
|
-
player:
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
|
|
29
|
+
.filter((item) => influenceHelper.getCost(item) <= playerHelper.credits)
|
|
30
|
+
.moveItems((item) => ({
|
|
31
|
+
type: LocationType.Influence,
|
|
32
|
+
id: Agents[item.id].influence,
|
|
33
|
+
player: getTeamColor(this.player)
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
discardAgents(cards) {
|
|
85
37
|
return cards.moveItems({
|
|
86
|
-
type:
|
|
38
|
+
type: LocationType.AgentDiscard
|
|
87
39
|
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
configurable: true
|
|
95
|
-
});
|
|
96
|
-
PlayCardRule.prototype.afterItemMove = function (move) {
|
|
97
|
-
if (!(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.AgentCard)(move))
|
|
40
|
+
}
|
|
41
|
+
get creditHelper() {
|
|
42
|
+
return new CreditHelper(this.game, this.player);
|
|
43
|
+
}
|
|
44
|
+
afterItemMove(move) {
|
|
45
|
+
if (!isMoveItemType(MaterialType.AgentCard)(move))
|
|
98
46
|
return [];
|
|
99
|
-
if (move.location.type ===
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
this.memorize(
|
|
103
|
-
return [this.startRule(
|
|
47
|
+
if (move.location.type === LocationType.AgentDiscard) {
|
|
48
|
+
const item = this.material(MaterialType.AgentCard).getItem(move.itemIndex);
|
|
49
|
+
const agent = Agents[item.id];
|
|
50
|
+
this.memorize(Memory.DiscardFaction, agent.faction);
|
|
51
|
+
return [this.startRule(RuleId.DiscardAction)];
|
|
104
52
|
}
|
|
105
|
-
|
|
106
|
-
if (move.location.type ===
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.memorize(
|
|
110
|
-
|
|
53
|
+
const moves = [];
|
|
54
|
+
if (move.location.type === LocationType.Influence) {
|
|
55
|
+
const influenceHelper = this.influenceHelper;
|
|
56
|
+
const item = this.material(MaterialType.AgentCard).getItem(move.itemIndex);
|
|
57
|
+
this.memorize(Memory.CardPlayed, item.id);
|
|
58
|
+
const cost = influenceHelper.getCost(item, 1);
|
|
111
59
|
if (cost > 0) {
|
|
112
|
-
moves.push
|
|
60
|
+
moves.push(...this.creditHelper.spendCredit(cost));
|
|
113
61
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (effectMoves.some(
|
|
117
|
-
moves.push
|
|
62
|
+
const helper = new EffectHelper(this.game, this.player);
|
|
63
|
+
const effectMoves = helper.applyCard(item);
|
|
64
|
+
if (effectMoves.some((move) => isStartRule(move) || isStartPlayerTurn(move))) {
|
|
65
|
+
moves.push(...effectMoves);
|
|
118
66
|
return moves;
|
|
119
67
|
}
|
|
120
|
-
moves.push(this.startRule(
|
|
68
|
+
moves.push(this.startRule(RuleId.Refill));
|
|
121
69
|
}
|
|
122
70
|
return moves;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
enumerable: false,
|
|
136
|
-
configurable: true
|
|
137
|
-
});
|
|
138
|
-
Object.defineProperty(PlayCardRule.prototype, "hand", {
|
|
139
|
-
get: function () {
|
|
140
|
-
return this.material(MaterialType_1.MaterialType.AgentCard).location(LocationType_1.LocationType.PlayerHand).player(this.player);
|
|
141
|
-
},
|
|
142
|
-
enumerable: false,
|
|
143
|
-
configurable: true
|
|
144
|
-
});
|
|
145
|
-
return PlayCardRule;
|
|
146
|
-
}(rules_api_1.PlayerTurnRule));
|
|
147
|
-
exports.PlayCardRule = PlayCardRule;
|
|
71
|
+
}
|
|
72
|
+
get influenceHelper() {
|
|
73
|
+
return new InfluenceHelper(this.game, getTeamColor(this.player));
|
|
74
|
+
}
|
|
75
|
+
get playerHelper() {
|
|
76
|
+
return new PlayerHelper(this.game, this.player);
|
|
77
|
+
}
|
|
78
|
+
get hand() {
|
|
79
|
+
return this.material(MaterialType.AgentCard).location(LocationType.PlayerHand).player(this.player);
|
|
80
|
+
}
|
|
81
|
+
}
|
package/dist/rules/RefillRule.js
CHANGED
|
@@ -1,211 +1,104 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
next: function () {
|
|
22
|
-
if (o && i >= o.length) o = void 0;
|
|
23
|
-
return { value: o && o[i++], done: !o };
|
|
1
|
+
import { isMoveItemTypeAtOnce, isShuffleItemType, PlayerTurnRule } from '@gamepark/rules-api';
|
|
2
|
+
import { influences } from '../material/Influence';
|
|
3
|
+
import { LocationType } from '../material/LocationType';
|
|
4
|
+
import { MaterialType } from '../material/MaterialType';
|
|
5
|
+
import { PlayerHelper } from './helper/PlayerHelper';
|
|
6
|
+
import { Memory } from './Memory';
|
|
7
|
+
import { RuleId } from './RuleId';
|
|
8
|
+
export class RefillRule extends PlayerTurnRule {
|
|
9
|
+
onRuleStart() {
|
|
10
|
+
this.memorize(Memory.AlreadyPlayedPlayers, (p = []) => p.concat(this.player));
|
|
11
|
+
const moves = [];
|
|
12
|
+
for (const influence of influences) {
|
|
13
|
+
const planet = this.material(MaterialType.InfluenceDisc).location(LocationType.PlanetBoardInfluenceDiscSpace).locationId(influence);
|
|
14
|
+
if (planet.length)
|
|
15
|
+
continue;
|
|
16
|
+
moves.push(this.getNewInfluenceDisc(influence).moveItem({
|
|
17
|
+
type: LocationType.PlanetBoardInfluenceDiscSpace,
|
|
18
|
+
id: influence,
|
|
19
|
+
x: 0
|
|
20
|
+
}));
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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);
|
|
22
|
+
const maxSize = this.handSize;
|
|
23
|
+
moves.push(...this.refillHand(maxSize));
|
|
24
|
+
if (moves.some((move) => isMoveItemTypeAtOnce(MaterialType.AgentCard)(move) && move.location.type === LocationType.AgentDeck)) {
|
|
25
|
+
return moves;
|
|
39
26
|
}
|
|
40
|
-
|
|
27
|
+
moves.push(...this.endRuleMoves);
|
|
28
|
+
return moves;
|
|
41
29
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
30
|
+
getNewInfluenceDisc(influence) {
|
|
31
|
+
return this.material(MaterialType.InfluenceDisc)
|
|
32
|
+
.location(LocationType.InfluenceDiscStock)
|
|
33
|
+
.locationId(influence)
|
|
34
|
+
.maxBy((item) => item.location.x);
|
|
35
|
+
}
|
|
36
|
+
get endRuleMoves() {
|
|
37
|
+
const isTurnEnded = this.remind(Memory.AlreadyPlayedPlayers).length === this.game.players.length;
|
|
38
|
+
if (isTurnEnded) {
|
|
39
|
+
this.forget(Memory.AlreadyPlayedPlayers);
|
|
40
|
+
return [this.startPlayerTurn(RuleId.PlayCard, this.turnOrder[0])];
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return [this.startPlayerTurn(RuleId.PlayCard, this.nextPlayer)];
|
|
49
44
|
}
|
|
50
45
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.RefillRule = void 0;
|
|
55
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
56
|
-
var Influence_1 = require("../material/Influence");
|
|
57
|
-
var LocationType_1 = require("../material/LocationType");
|
|
58
|
-
var MaterialType_1 = require("../material/MaterialType");
|
|
59
|
-
var PlayerHelper_1 = require("./helper/PlayerHelper");
|
|
60
|
-
var Memory_1 = require("./Memory");
|
|
61
|
-
var RuleId_1 = require("./RuleId");
|
|
62
|
-
var RefillRule = (function (_super) {
|
|
63
|
-
__extends(RefillRule, _super);
|
|
64
|
-
function RefillRule() {
|
|
65
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
46
|
+
get turnOrder() {
|
|
47
|
+
return this.remind(Memory.TurnOrder);
|
|
66
48
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
try {
|
|
76
|
-
for (var influences_1 = __values(Influence_1.influences), influences_1_1 = influences_1.next(); !influences_1_1.done; influences_1_1 = influences_1.next()) {
|
|
77
|
-
var influence = influences_1_1.value;
|
|
78
|
-
var planet = this.material(MaterialType_1.MaterialType.InfluenceDisc).location(LocationType_1.LocationType.PlanetBoardInfluenceDiscSpace).locationId(influence);
|
|
79
|
-
if (planet.length)
|
|
80
|
-
continue;
|
|
81
|
-
moves.push(this.getNewInfluenceDisc(influence).moveItem({
|
|
82
|
-
type: LocationType_1.LocationType.PlanetBoardInfluenceDiscSpace,
|
|
83
|
-
id: influence,
|
|
84
|
-
x: 0
|
|
85
|
-
}));
|
|
86
|
-
}
|
|
49
|
+
get nextPlayer() {
|
|
50
|
+
const players = this.turnOrder;
|
|
51
|
+
return players[(players.indexOf(this.player) + 1) % players.length];
|
|
52
|
+
}
|
|
53
|
+
get handSize() {
|
|
54
|
+
const leaderBadge = this.leaderBadge;
|
|
55
|
+
if (!leaderBadge.length) {
|
|
56
|
+
return 4;
|
|
87
57
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
finally { if (e_1) throw e_1.error; }
|
|
94
|
-
}
|
|
95
|
-
var maxSize = this.handSize;
|
|
96
|
-
moves.push.apply(moves, __spreadArray([], __read(this.refillHand(maxSize)), false));
|
|
97
|
-
if (moves.some(function (move) { return (0, rules_api_1.isMoveItemTypeAtOnce)(MaterialType_1.MaterialType.AgentCard)(move) && move.location.type === LocationType_1.LocationType.AgentDeck; })) {
|
|
98
|
-
return moves;
|
|
99
|
-
}
|
|
100
|
-
moves.push.apply(moves, __spreadArray([], __read(this.endRuleMoves), false));
|
|
101
|
-
return moves;
|
|
102
|
-
};
|
|
103
|
-
RefillRule.prototype.getNewInfluenceDisc = function (influence) {
|
|
104
|
-
return this.material(MaterialType_1.MaterialType.InfluenceDisc)
|
|
105
|
-
.location(LocationType_1.LocationType.InfluenceDiscStock)
|
|
106
|
-
.locationId(influence)
|
|
107
|
-
.maxBy(function (item) { return item.location.x; });
|
|
108
|
-
};
|
|
109
|
-
Object.defineProperty(RefillRule.prototype, "endRuleMoves", {
|
|
110
|
-
get: function () {
|
|
111
|
-
var isTurnEnded = this.remind(Memory_1.Memory.AlreadyPlayedPlayers).length === this.game.players.length;
|
|
112
|
-
if (isTurnEnded) {
|
|
113
|
-
this.forget(Memory_1.Memory.AlreadyPlayedPlayers);
|
|
114
|
-
return [this.startPlayerTurn(RuleId_1.RuleId.PlayCard, this.turnOrder[0])];
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
return [this.startPlayerTurn(RuleId_1.RuleId.PlayCard, this.nextPlayer)];
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
enumerable: false,
|
|
121
|
-
configurable: true
|
|
122
|
-
});
|
|
123
|
-
Object.defineProperty(RefillRule.prototype, "turnOrder", {
|
|
124
|
-
get: function () {
|
|
125
|
-
return this.remind(Memory_1.Memory.TurnOrder);
|
|
126
|
-
},
|
|
127
|
-
enumerable: false,
|
|
128
|
-
configurable: true
|
|
129
|
-
});
|
|
130
|
-
Object.defineProperty(RefillRule.prototype, "nextPlayer", {
|
|
131
|
-
get: function () {
|
|
132
|
-
var players = this.turnOrder;
|
|
133
|
-
return players[(players.indexOf(this.player) + 1) % players.length];
|
|
134
|
-
},
|
|
135
|
-
enumerable: false,
|
|
136
|
-
configurable: true
|
|
137
|
-
});
|
|
138
|
-
Object.defineProperty(RefillRule.prototype, "handSize", {
|
|
139
|
-
get: function () {
|
|
140
|
-
var leaderBadge = this.leaderBadge;
|
|
141
|
-
if (!leaderBadge.length) {
|
|
142
|
-
return 4;
|
|
58
|
+
else {
|
|
59
|
+
const item = leaderBadge.getItem();
|
|
60
|
+
if (!item.location.rotation) {
|
|
61
|
+
return 5;
|
|
143
62
|
}
|
|
144
63
|
else {
|
|
145
|
-
|
|
146
|
-
if (!item.location.rotation) {
|
|
147
|
-
return 5;
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
return 6;
|
|
151
|
-
}
|
|
64
|
+
return 6;
|
|
152
65
|
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
var deck = this.deck;
|
|
159
|
-
var quantity = Math.max(0, maxCount - this.hand.length);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
refillHand(maxCount) {
|
|
69
|
+
const deck = this.deck;
|
|
70
|
+
const quantity = Math.max(0, maxCount - this.hand.length);
|
|
160
71
|
if (!quantity)
|
|
161
72
|
return [];
|
|
162
|
-
|
|
163
|
-
type:
|
|
73
|
+
const moves = deck.deal({
|
|
74
|
+
type: LocationType.PlayerHand,
|
|
164
75
|
player: this.player
|
|
165
76
|
}, quantity);
|
|
166
|
-
|
|
77
|
+
const remaining = quantity - moves.length;
|
|
167
78
|
if (!remaining)
|
|
168
79
|
return moves;
|
|
169
|
-
moves.push(this.discard.moveItemsAtOnce({ type:
|
|
80
|
+
moves.push(this.discard.moveItemsAtOnce({ type: LocationType.AgentDeck }));
|
|
170
81
|
return moves;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
});
|
|
179
|
-
RefillRule.prototype.afterItemMove = function (move) {
|
|
180
|
-
if ((0, rules_api_1.isShuffleItemType)(MaterialType_1.MaterialType.AgentCard)(move)) {
|
|
181
|
-
return __spreadArray(__spreadArray([], __read(this.refillHand(this.handSize)), false), __read(this.endRuleMoves), false);
|
|
82
|
+
}
|
|
83
|
+
get discard() {
|
|
84
|
+
return this.material(MaterialType.AgentCard).location(LocationType.AgentDiscard);
|
|
85
|
+
}
|
|
86
|
+
afterItemMove(move) {
|
|
87
|
+
if (isShuffleItemType(MaterialType.AgentCard)(move)) {
|
|
88
|
+
return [...this.refillHand(this.handSize), ...this.endRuleMoves];
|
|
182
89
|
}
|
|
183
|
-
if (
|
|
90
|
+
if (isMoveItemTypeAtOnce(MaterialType.AgentCard)(move) && move.location.type === LocationType.AgentDeck) {
|
|
184
91
|
return [this.deck.shuffle()];
|
|
185
92
|
}
|
|
186
93
|
return [];
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
},
|
|
199
|
-
enumerable: false,
|
|
200
|
-
configurable: true
|
|
201
|
-
});
|
|
202
|
-
Object.defineProperty(RefillRule.prototype, "leaderBadge", {
|
|
203
|
-
get: function () {
|
|
204
|
-
return this.material(MaterialType_1.MaterialType.LeaderBadgeToken).player(new PlayerHelper_1.PlayerHelper(this.game, this.player).team);
|
|
205
|
-
},
|
|
206
|
-
enumerable: false,
|
|
207
|
-
configurable: true
|
|
208
|
-
});
|
|
209
|
-
return RefillRule;
|
|
210
|
-
}(rules_api_1.PlayerTurnRule));
|
|
211
|
-
exports.RefillRule = RefillRule;
|
|
94
|
+
}
|
|
95
|
+
get hand() {
|
|
96
|
+
return this.material(MaterialType.AgentCard).location(LocationType.PlayerHand).player(this.player);
|
|
97
|
+
}
|
|
98
|
+
get deck() {
|
|
99
|
+
return this.material(MaterialType.AgentCard).location(LocationType.AgentDeck).deck();
|
|
100
|
+
}
|
|
101
|
+
get leaderBadge() {
|
|
102
|
+
return this.material(MaterialType.LeaderBadgeToken).player(new PlayerHelper(this.game, this.player).team);
|
|
103
|
+
}
|
|
104
|
+
}
|
package/dist/rules/RuleId.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RuleId = void 0;
|
|
4
|
-
var RuleId;
|
|
1
|
+
export var RuleId;
|
|
5
2
|
(function (RuleId) {
|
|
6
3
|
RuleId[RuleId["Muligan"] = 1] = "Muligan";
|
|
7
4
|
RuleId[RuleId["PlayCard"] = 2] = "PlayCard";
|
|
@@ -28,4 +25,4 @@ var RuleId;
|
|
|
28
25
|
RuleId[RuleId["StealCredit"] = 23] = "StealCredit";
|
|
29
26
|
RuleId[RuleId["SpendZenithium"] = 24] = "SpendZenithium";
|
|
30
27
|
RuleId[RuleId["TakeTechnologyBonusToken"] = 25] = "TakeTechnologyBonusToken";
|
|
31
|
-
})(RuleId || (
|
|
28
|
+
})(RuleId || (RuleId = {}));
|
|
@@ -1,39 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.getDiplomacyActions = void 0;
|
|
5
|
-
var EffectType_1 = require("../../material/effect/EffectType");
|
|
6
|
-
var Faction_1 = require("../../material/Faction");
|
|
7
|
-
var getDiplomacyActions = function (_players) {
|
|
1
|
+
import { EffectType } from '../../material/effect/EffectType';
|
|
2
|
+
import { Faction } from '../../material/Faction';
|
|
3
|
+
export const getDiplomacyActions = (_players) => {
|
|
8
4
|
return TwoPlayerDiplomacyActions;
|
|
9
5
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
_a[Faction_1.Faction.Robot] = [
|
|
6
|
+
const TwoPlayerDiplomacyActions = {
|
|
7
|
+
[Faction.Robot]: [
|
|
13
8
|
{
|
|
14
|
-
type:
|
|
9
|
+
type: EffectType.TakeLeaderBadge
|
|
15
10
|
},
|
|
16
11
|
{
|
|
17
|
-
type:
|
|
12
|
+
type: EffectType.WinZenithium,
|
|
18
13
|
quantity: 1
|
|
19
14
|
}
|
|
20
15
|
],
|
|
21
|
-
|
|
16
|
+
[Faction.Human]: [
|
|
22
17
|
{
|
|
23
|
-
type:
|
|
18
|
+
type: EffectType.TakeLeaderBadge
|
|
24
19
|
},
|
|
25
20
|
{
|
|
26
|
-
type:
|
|
21
|
+
type: EffectType.WinCredit,
|
|
27
22
|
quantity: 3
|
|
28
23
|
}
|
|
29
24
|
],
|
|
30
|
-
|
|
25
|
+
[Faction.Animod]: [
|
|
31
26
|
{
|
|
32
|
-
type:
|
|
27
|
+
type: EffectType.TakeLeaderBadge
|
|
33
28
|
},
|
|
34
29
|
{
|
|
35
|
-
type:
|
|
30
|
+
type: EffectType.Mobilize,
|
|
36
31
|
quantity: 2
|
|
37
32
|
}
|
|
38
|
-
]
|
|
39
|
-
|
|
33
|
+
]
|
|
34
|
+
};
|