@gamepark/its-a-wonderful-world 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -44,6 +44,7 @@ export declare function getRemainingCost(construction: Construction): {
|
|
|
44
44
|
space: number;
|
|
45
45
|
}[];
|
|
46
46
|
export declare function getSpacesMissingItem(construction: Construction, predicate: (item: Resource | Character) => boolean): number[];
|
|
47
|
+
export declare function couldPlaceResource(construction: Construction, resource: Resource): boolean;
|
|
47
48
|
export declare function getNextProductionStep(game: GameState | GameView): Resource.Energy | Resource.Science | Resource.Gold | Resource.Exploration | undefined;
|
|
48
49
|
export declare function canBuild(player: Player, card: number): boolean;
|
|
49
50
|
export declare function canPay(player: Player, cost: (Resource | Character)[]): boolean;
|
|
@@ -95,7 +95,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
95
95
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
96
96
|
};
|
|
97
97
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
98
|
-
exports.placeAvailableCubesMoves = exports.constructionsThatMayReceiveCubes = exports.isOver = exports.countCharacters = exports.isActive = exports.isPlaceItemOnCard = exports.getMovesToBuild = exports.canPay = exports.canBuild = exports.getNextProductionStep = exports.getSpacesMissingItem = exports.getRemainingCost = exports.getCost = exports.getLegalMoves = exports.getPredictableAutomaticMoves = exports.setupPlayers = exports.numberOfRounds = exports.numberOfCardsToDraft = void 0;
|
|
98
|
+
exports.placeAvailableCubesMoves = exports.constructionsThatMayReceiveCubes = exports.isOver = exports.countCharacters = exports.isActive = exports.isPlaceItemOnCard = exports.getMovesToBuild = exports.canPay = exports.canBuild = exports.getNextProductionStep = exports.couldPlaceResource = exports.getSpacesMissingItem = exports.getRemainingCost = exports.getCost = exports.getLegalMoves = exports.getPredictableAutomaticMoves = exports.setupPlayers = exports.numberOfRounds = exports.numberOfCardsToDraft = void 0;
|
|
99
99
|
var rules_api_1 = require("@gamepark/rules-api");
|
|
100
100
|
var lodash_shuffle_1 = __importDefault(require("lodash.shuffle"));
|
|
101
101
|
var canUndo_1 = __importDefault(require("./canUndo"));
|
|
@@ -410,7 +410,7 @@ function getPredictableAutomaticMoves(state) {
|
|
|
410
410
|
}
|
|
411
411
|
var _loop_1 = function (resource) {
|
|
412
412
|
if (!player.draftArea.some(function (card) { return (0, Developments_1.getCardDetails)(card).constructionCost[resource]; })
|
|
413
|
-
&& !player.constructionArea.some(function (construction) { return
|
|
413
|
+
&& !player.constructionArea.some(function (construction) { return couldPlaceResource(construction, resource); })) {
|
|
414
414
|
return { value: (0, PlaceResource_1.placeResourceOnEmpireMove)(player.empire, resource) };
|
|
415
415
|
}
|
|
416
416
|
};
|
|
@@ -496,8 +496,7 @@ function getCost(card) {
|
|
|
496
496
|
}
|
|
497
497
|
exports.getCost = getCost;
|
|
498
498
|
function getRemainingCost(construction) {
|
|
499
|
-
|
|
500
|
-
return Array.of.apply(Array, __spreadArray(__spreadArray([], __read(Resource_1.resources), false), __read(Character_1.characters), false)).flatMap(function (item) { return Array(development.constructionCost[item] || 0).fill(item); })
|
|
499
|
+
return getCost(construction.card)
|
|
501
500
|
.map(function (item, index) { return ({ item: item, space: index }); })
|
|
502
501
|
.filter(function (item) { return !construction.costSpaces[item.space]; });
|
|
503
502
|
}
|
|
@@ -506,6 +505,14 @@ function getSpacesMissingItem(construction, predicate) {
|
|
|
506
505
|
return getRemainingCost(construction).filter(function (cost) { return predicate(cost.item); }).map(function (cost) { return cost.space; });
|
|
507
506
|
}
|
|
508
507
|
exports.getSpacesMissingItem = getSpacesMissingItem;
|
|
508
|
+
function couldPlaceResource(construction, resource) {
|
|
509
|
+
return Array.from(getCost(construction.card).entries())
|
|
510
|
+
.some(function (_a) {
|
|
511
|
+
var _b = __read(_a, 2), space = _b[0], item = _b[1];
|
|
512
|
+
return resource === item && (!construction.costSpaces[space] || construction.costSpaces[space] === Resource_1.default.Krystallium);
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
exports.couldPlaceResource = couldPlaceResource;
|
|
509
516
|
function getNextProductionStep(game) {
|
|
510
517
|
switch (game.productionStep) {
|
|
511
518
|
case Resource_1.default.Materials:
|
package/dist/moves/StartPhase.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __values = (this && this.__values) || function(o) {
|
|
3
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
+
if (m) return m.call(o);
|
|
5
|
+
if (o && typeof o.length === "number") return {
|
|
6
|
+
next: function () {
|
|
7
|
+
if (o && i >= o.length) o = void 0;
|
|
8
|
+
return { value: o && o[i++], done: !o };
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
@@ -12,8 +23,21 @@ var startPhaseMove = function (phase) { return ({
|
|
|
12
23
|
}); };
|
|
13
24
|
exports.startPhaseMove = startPhaseMove;
|
|
14
25
|
function startPhase(state, move) {
|
|
26
|
+
var e_1, _a;
|
|
15
27
|
state.phase = move.phase;
|
|
16
|
-
|
|
28
|
+
try {
|
|
29
|
+
for (var _b = __values(state.players), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
30
|
+
var player = _c.value;
|
|
31
|
+
player.ready = false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
35
|
+
finally {
|
|
36
|
+
try {
|
|
37
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
38
|
+
}
|
|
39
|
+
finally { if (e_1) throw e_1.error; }
|
|
40
|
+
}
|
|
17
41
|
if (move.phase === Phase_1.default.Draft) {
|
|
18
42
|
delete state.productionStep;
|
|
19
43
|
state.round++;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamepark/its-a-wonderful-world",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "It's a Wonderful World rules for Game Park",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,15 +12,13 @@
|
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
|
-
"
|
|
16
|
-
"@gamepark/rules-api": "~5.
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"@gamepark/rules-api": "~5.11.2",
|
|
17
|
+
"lodash.shuffle": "^4.2.0"
|
|
17
18
|
},
|
|
18
19
|
"scripts": {
|
|
19
20
|
"build": "tsc",
|
|
20
21
|
"prepublishOnly": "tsc"
|
|
21
22
|
},
|
|
22
|
-
"
|
|
23
|
-
"i18next": "^21.0.1"
|
|
24
|
-
},
|
|
25
|
-
"gitHead": "4a18681e5b3ddfa8e2b39fb75a5085f9da570608"
|
|
23
|
+
"gitHead": "b1022b426ce7225753998245be8f95519022625a"
|
|
26
24
|
}
|