@gamepark/zenith 0.0.1 → 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
package/dist/material/Bonus.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.bonuses = exports.allBonuses = exports.Bonus = void 0;
|
|
4
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
5
|
-
var Bonus;
|
|
1
|
+
import { getEnumValues } from '@gamepark/rules-api';
|
|
2
|
+
export var Bonus;
|
|
6
3
|
(function (Bonus) {
|
|
7
4
|
Bonus[Bonus["Exile2OpponentCards"] = 1] = "Exile2OpponentCards";
|
|
8
5
|
Bonus[Bonus["Mobilize2"] = 2] = "Mobilize2";
|
|
@@ -12,8 +9,8 @@ var Bonus;
|
|
|
12
9
|
Bonus[Bonus["Win3Credits"] = 6] = "Win3Credits";
|
|
13
10
|
Bonus[Bonus["Win4Credits"] = 7] = "Win4Credits";
|
|
14
11
|
Bonus[Bonus["WinInfluence"] = 8] = "WinInfluence";
|
|
15
|
-
})(Bonus || (
|
|
16
|
-
|
|
12
|
+
})(Bonus || (Bonus = {}));
|
|
13
|
+
export const allBonuses = [
|
|
17
14
|
Bonus.WinInfluence,
|
|
18
15
|
Bonus.WinInfluence,
|
|
19
16
|
Bonus.WinInfluence,
|
|
@@ -31,4 +28,4 @@ exports.allBonuses = [
|
|
|
31
28
|
Bonus.TakeLeaderBadge,
|
|
32
29
|
Bonus.TakeLeaderBadge
|
|
33
30
|
];
|
|
34
|
-
|
|
31
|
+
export const bonuses = getEnumValues(Bonus);
|
package/dist/material/Bonuses.js
CHANGED
|
@@ -1,63 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var EffectType_1 = require("./effect/EffectType");
|
|
7
|
-
exports.Exile2OpponentCards = {
|
|
8
|
-
effect: {
|
|
9
|
-
type: EffectType_1.EffectType.Exile,
|
|
1
|
+
import { Bonus } from './Bonus';
|
|
2
|
+
import { EffectType } from './effect/EffectType';
|
|
3
|
+
export const Exile2OpponentCards = {
|
|
4
|
+
effect: {
|
|
5
|
+
type: EffectType.Exile,
|
|
10
6
|
quantity: 2,
|
|
11
7
|
opponent: true
|
|
12
8
|
}
|
|
13
9
|
};
|
|
14
|
-
|
|
10
|
+
export const Mobilize2 = {
|
|
15
11
|
effect: {
|
|
16
|
-
type:
|
|
12
|
+
type: EffectType.Mobilize,
|
|
17
13
|
quantity: 2
|
|
18
14
|
}
|
|
19
15
|
};
|
|
20
|
-
|
|
16
|
+
export const TakeLeaderBadge = {
|
|
21
17
|
effect: {
|
|
22
|
-
type:
|
|
18
|
+
type: EffectType.TakeLeaderBadge
|
|
23
19
|
}
|
|
24
20
|
};
|
|
25
|
-
|
|
21
|
+
export const Transfer = {
|
|
26
22
|
effect: {
|
|
27
|
-
type:
|
|
23
|
+
type: EffectType.Transfer
|
|
28
24
|
}
|
|
29
25
|
};
|
|
30
|
-
|
|
26
|
+
export const Win1Zenithium = {
|
|
31
27
|
effect: {
|
|
32
|
-
type:
|
|
28
|
+
type: EffectType.WinZenithium,
|
|
33
29
|
quantity: 1
|
|
34
30
|
}
|
|
35
31
|
};
|
|
36
|
-
|
|
32
|
+
export const Win3Credit = {
|
|
37
33
|
effect: {
|
|
38
|
-
type:
|
|
34
|
+
type: EffectType.WinCredit,
|
|
39
35
|
quantity: 3
|
|
40
36
|
}
|
|
41
37
|
};
|
|
42
|
-
|
|
38
|
+
export const Win4Credits = {
|
|
43
39
|
effect: {
|
|
44
|
-
type:
|
|
40
|
+
type: EffectType.WinCredit,
|
|
45
41
|
quantity: 4
|
|
46
42
|
}
|
|
47
43
|
};
|
|
48
|
-
|
|
44
|
+
export const WinInfluence = {
|
|
49
45
|
effect: {
|
|
50
|
-
type:
|
|
46
|
+
type: EffectType.WinInfluence,
|
|
51
47
|
quantity: 1
|
|
52
48
|
}
|
|
53
49
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
export const Bonuses = {
|
|
51
|
+
[Bonus.Exile2OpponentCards]: Exile2OpponentCards,
|
|
52
|
+
[Bonus.Mobilize2]: Mobilize2,
|
|
53
|
+
[Bonus.TakeLeaderBadge]: TakeLeaderBadge,
|
|
54
|
+
[Bonus.Transfer]: Transfer,
|
|
55
|
+
[Bonus.Win1Zenithium]: Win1Zenithium,
|
|
56
|
+
[Bonus.Win3Credits]: Win3Credit,
|
|
57
|
+
[Bonus.Win4Credits]: Win4Credits,
|
|
58
|
+
[Bonus.WinInfluence]: WinInfluence
|
|
59
|
+
};
|
package/dist/material/Credit.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.credits = exports.Credit = void 0;
|
|
4
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
5
|
-
var Credit;
|
|
1
|
+
import { getEnumValues } from '@gamepark/rules-api';
|
|
2
|
+
export var Credit;
|
|
6
3
|
(function (Credit) {
|
|
7
4
|
Credit[Credit["Credit1"] = 1] = "Credit1";
|
|
8
5
|
Credit[Credit["Credit3"] = 3] = "Credit3";
|
|
9
6
|
Credit[Credit["Credit5"] = 5] = "Credit5";
|
|
10
|
-
})(Credit || (
|
|
11
|
-
|
|
7
|
+
})(Credit || (Credit = {}));
|
|
8
|
+
export const credits = getEnumValues(Credit);
|
package/dist/material/Faction.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.factions = exports.Faction = void 0;
|
|
4
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
5
|
-
var Faction;
|
|
1
|
+
import { getEnumValues } from '@gamepark/rules-api';
|
|
2
|
+
export var Faction;
|
|
6
3
|
(function (Faction) {
|
|
7
4
|
Faction[Faction["Animod"] = 1] = "Animod";
|
|
8
5
|
Faction[Faction["Human"] = 2] = "Human";
|
|
9
6
|
Faction[Faction["Robot"] = 3] = "Robot";
|
|
10
|
-
})(Faction || (
|
|
11
|
-
|
|
7
|
+
})(Faction || (Faction = {}));
|
|
8
|
+
export const factions = getEnumValues(Faction);
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.influences = exports.Influence = void 0;
|
|
4
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
5
|
-
var Influence;
|
|
1
|
+
import { getEnumValues } from '@gamepark/rules-api';
|
|
2
|
+
export var Influence;
|
|
6
3
|
(function (Influence) {
|
|
7
4
|
Influence[Influence["Mercury"] = 1] = "Mercury";
|
|
8
5
|
Influence[Influence["Venus"] = 2] = "Venus";
|
|
9
6
|
Influence[Influence["Terra"] = 3] = "Terra";
|
|
10
7
|
Influence[Influence["Mars"] = 4] = "Mars";
|
|
11
8
|
Influence[Influence["Jupiter"] = 5] = "Jupiter";
|
|
12
|
-
})(Influence || (
|
|
13
|
-
|
|
9
|
+
})(Influence || (Influence = {}));
|
|
10
|
+
export const influences = getEnumValues(Influence);
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LocationType = void 0;
|
|
4
|
-
var LocationType;
|
|
1
|
+
export var LocationType;
|
|
5
2
|
(function (LocationType) {
|
|
6
3
|
LocationType[LocationType["PlanetBoardPlace"] = 1] = "PlanetBoardPlace";
|
|
7
4
|
LocationType[LocationType["TechnologyBoardPlace"] = 2] = "TechnologyBoardPlace";
|
|
@@ -24,4 +21,4 @@ var LocationType;
|
|
|
24
21
|
LocationType[LocationType["ZenithiumStock"] = 19] = "ZenithiumStock";
|
|
25
22
|
LocationType[LocationType["CreditStock"] = 20] = "CreditStock";
|
|
26
23
|
LocationType[LocationType["BonusDiscard"] = 21] = "BonusDiscard";
|
|
27
|
-
})(LocationType || (
|
|
24
|
+
})(LocationType || (LocationType = {}));
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MaterialType = void 0;
|
|
4
|
-
var MaterialType;
|
|
1
|
+
export var MaterialType;
|
|
5
2
|
(function (MaterialType) {
|
|
6
3
|
MaterialType[MaterialType["AgentCard"] = 1] = "AgentCard";
|
|
7
4
|
MaterialType[MaterialType["TechnologyBoard"] = 2] = "TechnologyBoard";
|
|
@@ -13,4 +10,4 @@ var MaterialType;
|
|
|
13
10
|
MaterialType[MaterialType["CreditToken"] = 8] = "CreditToken";
|
|
14
11
|
MaterialType[MaterialType["BonusToken"] = 9] = "BonusToken";
|
|
15
12
|
MaterialType[MaterialType["LeaderBadgeToken"] = 10] = "LeaderBadgeToken";
|
|
16
|
-
})(MaterialType || (
|
|
13
|
+
})(MaterialType || (MaterialType = {}));
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.isDoEffect = exports.isSpendZenithium = exports.ConditionType = void 0;
|
|
4
|
-
var EffectType_1 = require("./EffectType");
|
|
5
|
-
var ConditionType;
|
|
1
|
+
import { EffectType } from './EffectType';
|
|
2
|
+
export var ConditionType;
|
|
6
3
|
(function (ConditionType) {
|
|
7
4
|
ConditionType[ConditionType["DoEffect"] = 0] = "DoEffect";
|
|
8
5
|
ConditionType[ConditionType["Leader"] = 1] = "Leader";
|
|
9
6
|
ConditionType[ConditionType["HaveCredits"] = 2] = "HaveCredits";
|
|
10
|
-
})(ConditionType || (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var isDoEffect = function (condition) { return condition.type === ConditionType.DoEffect; };
|
|
14
|
-
exports.isDoEffect = isDoEffect;
|
|
7
|
+
})(ConditionType || (ConditionType = {}));
|
|
8
|
+
export const isSpendZenithium = (effect) => effect.type === EffectType.SpendZenithium;
|
|
9
|
+
export const isDoEffect = (condition) => condition.type === ConditionType.DoEffect;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EffectType = void 0;
|
|
4
|
-
var EffectType;
|
|
1
|
+
export var EffectType;
|
|
5
2
|
(function (EffectType) {
|
|
6
3
|
EffectType[EffectType["Transfer"] = 1] = "Transfer";
|
|
7
4
|
EffectType[EffectType["GiveCredit"] = 2] = "GiveCredit";
|
|
@@ -24,4 +21,4 @@ var EffectType;
|
|
|
24
21
|
EffectType[EffectType["StealCredit"] = 19] = "StealCredit";
|
|
25
22
|
EffectType[EffectType["SpendZenithium"] = 20] = "SpendZenithium";
|
|
26
23
|
EffectType[EffectType["TakeTechnologyBonusToken"] = 21] = "TakeTechnologyBonusToken";
|
|
27
|
-
})(EffectType || (
|
|
24
|
+
})(EffectType || (EffectType = {}));
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CustomMoveType = void 0;
|
|
4
|
-
var CustomMoveType;
|
|
1
|
+
export var CustomMoveType;
|
|
5
2
|
(function (CustomMoveType) {
|
|
6
3
|
CustomMoveType[CustomMoveType["Pass"] = 1] = "Pass";
|
|
7
4
|
CustomMoveType[CustomMoveType["Diplomacy"] = 2] = "Diplomacy";
|
|
@@ -9,4 +6,4 @@ var CustomMoveType;
|
|
|
9
6
|
CustomMoveType[CustomMoveType["SpendCredit"] = 4] = "SpendCredit";
|
|
10
7
|
CustomMoveType[CustomMoveType["Choice"] = 5] = "Choice";
|
|
11
8
|
CustomMoveType[CustomMoveType["WinCreditLog"] = 6] = "WinCreditLog";
|
|
12
|
-
})(CustomMoveType || (
|
|
9
|
+
})(CustomMoveType || (CustomMoveType = {}));
|
|
@@ -1,84 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.DiscardActionRule = void 0;
|
|
44
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
45
|
-
var MaterialType_1 = require("../material/MaterialType");
|
|
46
|
-
var CustomMoveType_1 = require("./CustomMoveType");
|
|
47
|
-
var DiplomacyBoardRule_1 = require("./discard-action/DiplomacyBoardRule");
|
|
48
|
-
var TechnologyBoardRule_1 = require("./discard-action/TechnologyBoardRule");
|
|
49
|
-
var RuleId_1 = require("./RuleId");
|
|
50
|
-
var DiscardActionRule = (function (_super) {
|
|
51
|
-
__extends(DiscardActionRule, _super);
|
|
52
|
-
function DiscardActionRule() {
|
|
53
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
54
|
-
}
|
|
55
|
-
DiscardActionRule.prototype.getPlayerMoves = function () {
|
|
56
|
-
var moves = [];
|
|
57
|
-
moves.push.apply(moves, __spreadArray([], __read(new TechnologyBoardRule_1.TechnologyBoardRule(this.game).getPlayerMoves()), false));
|
|
58
|
-
moves.push.apply(moves, __spreadArray([], __read(new DiplomacyBoardRule_1.DiplomacyBoardRule(this.game).getPlayerMoves()), false));
|
|
1
|
+
import { isCustomMoveType, isMoveItemType, PlayerTurnRule } from '@gamepark/rules-api';
|
|
2
|
+
import { MaterialType } from '../material/MaterialType';
|
|
3
|
+
import { CustomMoveType } from './CustomMoveType';
|
|
4
|
+
import { DiplomacyBoardRule } from './discard-action/DiplomacyBoardRule';
|
|
5
|
+
import { TechnologyBoardRule } from './discard-action/TechnologyBoardRule';
|
|
6
|
+
import { RuleId } from './RuleId';
|
|
7
|
+
export class DiscardActionRule extends PlayerTurnRule {
|
|
8
|
+
getPlayerMoves() {
|
|
9
|
+
const moves = [];
|
|
10
|
+
moves.push(...new TechnologyBoardRule(this.game).getPlayerMoves());
|
|
11
|
+
moves.push(...new DiplomacyBoardRule(this.game).getPlayerMoves());
|
|
59
12
|
if (!moves.length) {
|
|
60
|
-
moves.push(this.startPlayerTurn(
|
|
13
|
+
moves.push(this.startPlayerTurn(RuleId.PlayCard, this.nextPlayer));
|
|
61
14
|
}
|
|
62
15
|
return moves;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (
|
|
66
|
-
return new
|
|
16
|
+
}
|
|
17
|
+
beforeItemMove(move) {
|
|
18
|
+
if (isMoveItemType(MaterialType.TechMarker)(move)) {
|
|
19
|
+
return new TechnologyBoardRule(this.game).beforeItemMove(move);
|
|
67
20
|
}
|
|
68
21
|
return [];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
return new
|
|
22
|
+
}
|
|
23
|
+
afterItemMove(move) {
|
|
24
|
+
if (isMoveItemType(MaterialType.TechMarker)(move)) {
|
|
25
|
+
return new TechnologyBoardRule(this.game).afterItemMove(move);
|
|
73
26
|
}
|
|
74
27
|
return [];
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (
|
|
78
|
-
return new
|
|
28
|
+
}
|
|
29
|
+
onCustomMove(move) {
|
|
30
|
+
if (isCustomMoveType(CustomMoveType.Diplomacy)(move)) {
|
|
31
|
+
return new DiplomacyBoardRule(this.game).onCustomMove(move);
|
|
79
32
|
}
|
|
80
33
|
return [];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
}(rules_api_1.PlayerTurnRule));
|
|
84
|
-
exports.DiscardActionRule = DiscardActionRule;
|
|
34
|
+
}
|
|
35
|
+
}
|
package/dist/rules/Memory.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Memory = void 0;
|
|
4
|
-
var Memory;
|
|
1
|
+
export var Memory;
|
|
5
2
|
(function (Memory) {
|
|
6
3
|
Memory[Memory["Mulligan"] = 1] = "Mulligan";
|
|
7
4
|
Memory[Memory["TurnOrder"] = 2] = "TurnOrder";
|
|
@@ -16,4 +13,4 @@ var Memory;
|
|
|
16
13
|
Memory[Memory["Zenithium"] = 11] = "Zenithium";
|
|
17
14
|
Memory[Memory["CurrentEffect"] = 12] = "CurrentEffect";
|
|
18
15
|
Memory[Memory["WonBonus"] = 13] = "WonBonus";
|
|
19
|
-
})(Memory || (
|
|
16
|
+
})(Memory || (Memory = {}));
|
|
@@ -1,138 +1,59 @@
|
|
|
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);
|
|
1
|
+
import { isCustomMoveType, isMoveItemType, SimultaneousRule } from '@gamepark/rules-api';
|
|
2
|
+
import { LocationType } from '../material/LocationType';
|
|
3
|
+
import { MaterialType } from '../material/MaterialType';
|
|
4
|
+
import { CustomMoveType } from './CustomMoveType';
|
|
5
|
+
import { Memory } from './Memory';
|
|
6
|
+
import { RuleId } from './RuleId';
|
|
7
|
+
export class MulliganRule extends SimultaneousRule {
|
|
8
|
+
getActivePlayerLegalMoves(player) {
|
|
9
|
+
return [
|
|
10
|
+
...this.getHand(player).moveItems({
|
|
11
|
+
type: LocationType.AgentDiscard
|
|
12
|
+
}),
|
|
13
|
+
this.customMove(CustomMoveType.Pass, player)
|
|
14
|
+
];
|
|
23
15
|
}
|
|
24
|
-
|
|
25
|
-
|
|
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 __values = (this && this.__values) || function(o) {
|
|
43
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
44
|
-
if (m) return m.call(o);
|
|
45
|
-
if (o && typeof o.length === "number") return {
|
|
46
|
-
next: function () {
|
|
47
|
-
if (o && i >= o.length) o = void 0;
|
|
48
|
-
return { value: o && o[i++], done: !o };
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.MulliganRule = void 0;
|
|
55
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
56
|
-
var LocationType_1 = require("../material/LocationType");
|
|
57
|
-
var MaterialType_1 = require("../material/MaterialType");
|
|
58
|
-
var CustomMoveType_1 = require("./CustomMoveType");
|
|
59
|
-
var Memory_1 = require("./Memory");
|
|
60
|
-
var RuleId_1 = require("./RuleId");
|
|
61
|
-
var MulliganRule = (function (_super) {
|
|
62
|
-
__extends(MulliganRule, _super);
|
|
63
|
-
function MulliganRule() {
|
|
64
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
65
|
-
}
|
|
66
|
-
MulliganRule.prototype.getActivePlayerLegalMoves = function (player) {
|
|
67
|
-
return __spreadArray(__spreadArray([], __read(this.getHand(player).moveItems({
|
|
68
|
-
type: LocationType_1.LocationType.AgentDiscard
|
|
69
|
-
})), false), [
|
|
70
|
-
this.customMove(CustomMoveType_1.CustomMoveType.Pass, player)
|
|
71
|
-
], false);
|
|
72
|
-
};
|
|
73
|
-
MulliganRule.prototype.onCustomMove = function (move) {
|
|
74
|
-
if (!(0, rules_api_1.isCustomMoveType)(CustomMoveType_1.CustomMoveType.Pass)(move))
|
|
16
|
+
onCustomMove(move) {
|
|
17
|
+
if (!isCustomMoveType(CustomMoveType.Pass)(move))
|
|
75
18
|
return [];
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
19
|
+
const player = move.data;
|
|
20
|
+
const mulliganCount = this.getMulliganCount(player);
|
|
21
|
+
const moves = [];
|
|
79
22
|
if (mulliganCount) {
|
|
80
|
-
|
|
23
|
+
const deck = this.deck;
|
|
81
24
|
moves.push(deck.dealAtOnce({
|
|
82
|
-
type:
|
|
25
|
+
type: LocationType.PlayerHand,
|
|
83
26
|
player: player
|
|
84
27
|
}, mulliganCount));
|
|
85
28
|
}
|
|
86
29
|
moves.push(this.endPlayerTurn(player));
|
|
87
30
|
return moves;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
enumerable: false,
|
|
98
|
-
configurable: true
|
|
99
|
-
});
|
|
100
|
-
MulliganRule.prototype.beforeItemMove = function (move) {
|
|
101
|
-
if (!(0, rules_api_1.isMoveItemType)(MaterialType_1.MaterialType.AgentCard)(move) || move.location.type !== LocationType_1.LocationType.AgentDiscard)
|
|
31
|
+
}
|
|
32
|
+
getMulliganCount(player) {
|
|
33
|
+
return this.remind(Memory.Mulligan, player) ?? 0;
|
|
34
|
+
}
|
|
35
|
+
get deck() {
|
|
36
|
+
return this.material(MaterialType.AgentCard).location(LocationType.AgentDeck).deck();
|
|
37
|
+
}
|
|
38
|
+
beforeItemMove(move) {
|
|
39
|
+
if (!isMoveItemType(MaterialType.AgentCard)(move) || move.location.type !== LocationType.AgentDiscard)
|
|
102
40
|
return [];
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
this.memorize(
|
|
41
|
+
const item = this.material(MaterialType.AgentCard).getItem(move.itemIndex);
|
|
42
|
+
const player = item.location.player;
|
|
43
|
+
const mulliganCount = this.getMulliganCount(player);
|
|
44
|
+
this.memorize(Memory.Mulligan, mulliganCount + 1, player);
|
|
107
45
|
return [];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return this.material(
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
for (var _b = __values(this.game.players), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
116
|
-
var player = _c.value;
|
|
117
|
-
this.forget(Memory_1.Memory.Mulligan, player);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
121
|
-
finally {
|
|
122
|
-
try {
|
|
123
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
124
|
-
}
|
|
125
|
-
finally { if (e_1) throw e_1.error; }
|
|
46
|
+
}
|
|
47
|
+
getHand(playerId) {
|
|
48
|
+
return this.material(MaterialType.AgentCard).location(LocationType.PlayerHand).player(playerId);
|
|
49
|
+
}
|
|
50
|
+
getMovesAfterPlayersDone() {
|
|
51
|
+
for (const player of this.game.players) {
|
|
52
|
+
this.forget(Memory.Mulligan, player);
|
|
126
53
|
}
|
|
127
|
-
return [this.startPlayerTurn(
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
enumerable: false,
|
|
134
|
-
configurable: true
|
|
135
|
-
});
|
|
136
|
-
return MulliganRule;
|
|
137
|
-
}(rules_api_1.SimultaneousRule));
|
|
138
|
-
exports.MulliganRule = MulliganRule;
|
|
54
|
+
return [this.startPlayerTurn(RuleId.PlayCard, this.turnOrder[0])];
|
|
55
|
+
}
|
|
56
|
+
get turnOrder() {
|
|
57
|
+
return this.remind(Memory.TurnOrder);
|
|
58
|
+
}
|
|
59
|
+
}
|