@gamepark/rules-api 5.23.0 → 6.0.0-alpha.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/Action.d.ts +4 -5
- package/dist/Action.js +6 -6
- package/dist/Action.js.map +1 -1
- package/dist/ApplyAutomaticMoves.d.ts +1 -1
- package/dist/ApplyAutomaticMoves.js +1 -1
- package/dist/ApplyAutomaticMoves.js.map +1 -1
- package/dist/Competitive.d.ts +2 -2
- package/dist/Dummy.d.ts +2 -2
- package/dist/Dummy.js +2 -1
- package/dist/Dummy.js.map +1 -1
- package/dist/Eliminations.d.ts +1 -1
- package/dist/IncompleteInformation.d.ts +2 -2
- package/dist/RandomMove.d.ts +2 -2
- package/dist/RandomMove.js +4 -2
- package/dist/RandomMove.js.map +1 -1
- package/dist/Robot.d.ts +1 -2
- package/dist/Rules.d.ts +2 -1
- package/dist/Rules.js +3 -2
- package/dist/Rules.js.map +1 -1
- package/dist/RulesCreator.d.ts +2 -2
- package/dist/TimeLimit.d.ts +2 -2
- package/dist/Undo.d.ts +2 -2
- package/dist/UnpredictableMove.d.ts +12 -0
- package/dist/UnpredictableMove.js +43 -0
- package/dist/UnpredictableMove.js.map +1 -0
- package/dist/index.d.ts +13 -18
- package/dist/index.js +13 -17
- package/dist/index.js.map +1 -1
- package/dist/material/HiddenMaterialRules.d.ts +19 -0
- package/dist/material/HiddenMaterialRules.js +138 -0
- package/dist/material/HiddenMaterialRules.js.map +1 -0
- package/dist/material/MaterialGame.d.ts +11 -0
- package/dist/material/MaterialGame.js +3 -0
- package/dist/material/MaterialGame.js.map +1 -0
- package/dist/material/MaterialRules.d.ts +32 -0
- package/dist/material/MaterialRules.js +216 -0
- package/dist/material/MaterialRules.js.map +1 -0
- package/dist/material/MaterialRulesStep.d.ts +16 -0
- package/dist/material/MaterialRulesStep.js +47 -0
- package/dist/material/MaterialRulesStep.js.map +1 -0
- package/dist/material/MaterialStepRules.d.ts +16 -0
- package/dist/material/MaterialStepRules.js +47 -0
- package/dist/material/MaterialStepRules.js.map +1 -0
- package/dist/material/PlayerRulesStep.d.ts +10 -0
- package/dist/material/PlayerRulesStep.js +54 -0
- package/dist/material/PlayerRulesStep.js.map +1 -0
- package/dist/material/PlayerTurnRule.d.ts +10 -0
- package/dist/material/PlayerTurnRule.js +54 -0
- package/dist/material/PlayerTurnRule.js.map +1 -0
- package/dist/material/SecretMaterialRules.d.ts +12 -0
- package/dist/material/SecretMaterialRules.js +52 -0
- package/dist/material/SecretMaterialRules.js.map +1 -0
- package/dist/material/helper/MaterialMoveBuilder.d.ts +9 -0
- package/dist/material/helper/MaterialMoveBuilder.js +28 -0
- package/dist/material/helper/MaterialMoveBuilder.js.map +1 -0
- package/dist/material/helper/MaterialRulesMovesBuilder.d.ts +8 -0
- package/dist/material/helper/MaterialRulesMovesBuilder.js +26 -0
- package/dist/material/helper/MaterialRulesMovesBuilder.js.map +1 -0
- package/dist/material/helper/MaterialSearchHelper.d.ts +18 -0
- package/dist/material/helper/MaterialSearchHelper.js +62 -0
- package/dist/material/helper/MaterialSearchHelper.js.map +1 -0
- package/dist/material/helper/index.d.ts +2 -0
- package/dist/material/helper/index.js +19 -0
- package/dist/material/helper/index.js.map +1 -0
- package/dist/material/index.d.ts +9 -0
- package/dist/material/index.js +26 -0
- package/dist/material/index.js.map +1 -0
- package/dist/material/items/Material.d.ts +30 -0
- package/dist/material/items/Material.js +149 -0
- package/dist/material/items/Material.js.map +1 -0
- package/dist/material/items/MaterialItem.d.ts +10 -0
- package/dist/material/items/MaterialItem.js +3 -0
- package/dist/material/items/MaterialItem.js.map +1 -0
- package/dist/material/items/MaterialOperation.d.ts +20 -0
- package/dist/material/items/MaterialOperation.js +147 -0
- package/dist/material/items/MaterialOperation.js.map +1 -0
- package/dist/material/items/index.d.ts +3 -0
- package/dist/material/items/index.js +20 -0
- package/dist/material/items/index.js.map +1 -0
- package/dist/material/location/Location.d.ts +14 -0
- package/dist/material/location/Location.js +12 -0
- package/dist/material/location/Location.js.map +1 -0
- package/dist/material/location/index.d.ts +2 -0
- package/dist/material/location/index.js +19 -0
- package/dist/material/location/index.js.map +1 -0
- package/dist/material/location/strategy/LocationStrategy.d.ts +5 -0
- package/dist/material/location/strategy/LocationStrategy.js +3 -0
- package/dist/material/location/strategy/LocationStrategy.js.map +1 -0
- package/dist/material/location/strategy/PositiveSequenceStrategy.d.ts +11 -0
- package/dist/material/location/strategy/PositiveSequenceStrategy.js +42 -0
- package/dist/material/location/strategy/PositiveSequenceStrategy.js.map +1 -0
- package/dist/material/location/strategy/index.d.ts +2 -0
- package/dist/material/location/strategy/index.js +19 -0
- package/dist/material/location/strategy/index.js.map +1 -0
- package/dist/material/moves/CreateItem.d.ts +7 -0
- package/dist/material/moves/CreateItem.js +3 -0
- package/dist/material/moves/CreateItem.js.map +1 -0
- package/dist/material/moves/CustomMove.d.ts +6 -0
- package/dist/material/moves/CustomMove.js +3 -0
- package/dist/material/moves/CustomMove.js.map +1 -0
- package/dist/material/moves/CustomMoves.d.ts +7 -0
- package/dist/material/moves/CustomMoves.js +3 -0
- package/dist/material/moves/CustomMoves.js.map +1 -0
- package/dist/material/moves/DeleteItem.d.ts +7 -0
- package/dist/material/moves/DeleteItem.js +3 -0
- package/dist/material/moves/DeleteItem.js.map +1 -0
- package/dist/material/moves/MaterialMove.d.ts +11 -0
- package/dist/material/moves/MaterialMove.js +3 -0
- package/dist/material/moves/MaterialMove.js.map +1 -0
- package/dist/material/moves/MaterialMoveType.d.ts +6 -0
- package/dist/material/moves/MaterialMoveType.js +11 -0
- package/dist/material/moves/MaterialMoveType.js.map +1 -0
- package/dist/material/moves/MaterialMovesBuilder.d.ts +8 -0
- package/dist/material/moves/MaterialMovesBuilder.js +34 -0
- package/dist/material/moves/MaterialMovesBuilder.js.map +1 -0
- package/dist/material/moves/MaterialRulesMove.d.ts +6 -0
- package/dist/material/moves/MaterialRulesMove.js +3 -0
- package/dist/material/moves/MaterialRulesMove.js.map +1 -0
- package/dist/material/moves/MoveItem.d.ts +17 -0
- package/dist/material/moves/MoveItem.js +54 -0
- package/dist/material/moves/MoveItem.js.map +1 -0
- package/dist/material/moves/MoveKind.d.ts +6 -0
- package/dist/material/moves/MoveKind.js +11 -0
- package/dist/material/moves/MoveKind.js.map +1 -0
- package/dist/material/moves/RulesMoves.d.ts +10 -0
- package/dist/material/moves/RulesMoves.js +3 -0
- package/dist/material/moves/RulesMoves.js.map +1 -0
- package/dist/material/moves/Shuffle.d.ts +9 -0
- package/dist/material/moves/Shuffle.js +3 -0
- package/dist/material/moves/Shuffle.js.map +1 -0
- package/dist/material/moves/index.d.ts +11 -0
- package/dist/material/moves/index.js +28 -0
- package/dist/material/moves/index.js.map +1 -0
- package/dist/material/moves/local/LocalMove.d.ts +6 -0
- package/dist/material/moves/local/LocalMove.js +9 -0
- package/dist/material/moves/local/LocalMove.js.map +1 -0
- package/dist/material/moves/local/RulesDisplay.d.ts +32 -0
- package/dist/material/moves/local/RulesDisplay.js +26 -0
- package/dist/material/moves/local/RulesDisplay.js.map +1 -0
- package/dist/material/moves/local/index.d.ts +2 -0
- package/dist/material/moves/local/index.js +19 -0
- package/dist/material/moves/local/index.js.map +1 -0
- package/dist/material/moves/rules/EndGame.d.ts +4 -0
- package/dist/material/moves/rules/EndGame.js +3 -0
- package/dist/material/moves/rules/EndGame.js.map +1 -0
- package/dist/material/moves/rules/MaterialRulesMovesBuilder.d.ts +8 -0
- package/dist/material/moves/rules/MaterialRulesMovesBuilder.js +26 -0
- package/dist/material/moves/rules/MaterialRulesMovesBuilder.js.map +1 -0
- package/dist/material/moves/rules/Memorize.d.ts +6 -0
- package/dist/material/moves/rules/Memorize.js +3 -0
- package/dist/material/moves/rules/Memorize.js.map +1 -0
- package/dist/material/moves/rules/MemorizeOnGame.d.ts +6 -0
- package/dist/material/moves/rules/MemorizeOnGame.js +3 -0
- package/dist/material/moves/rules/MemorizeOnGame.js.map +1 -0
- package/dist/material/moves/rules/RuleMove.d.ts +16 -0
- package/dist/material/moves/rules/RuleMove.js +19 -0
- package/dist/material/moves/rules/RuleMove.js.map +1 -0
- package/dist/material/moves/rules/StartPlayerTurn.d.ts +7 -0
- package/dist/material/moves/rules/StartPlayerTurn.js +3 -0
- package/dist/material/moves/rules/StartPlayerTurn.js.map +1 -0
- package/dist/material/moves/rules/StartRule.d.ts +7 -0
- package/dist/material/moves/rules/StartRule.js +3 -0
- package/dist/material/moves/rules/StartRule.js.map +1 -0
- package/dist/material/moves/rules/index.d.ts +4 -0
- package/dist/material/moves/rules/index.js +21 -0
- package/dist/material/moves/rules/index.js.map +1 -0
- package/dist/material/rules/MaterialRulesMovesBuilder.d.ts +10 -0
- package/dist/material/rules/MaterialRulesMovesBuilder.js +35 -0
- package/dist/material/rules/MaterialRulesMovesBuilder.js.map +1 -0
- package/dist/material/rules/MaterialStepRules.d.ts +22 -0
- package/dist/material/rules/MaterialStepRules.js +101 -0
- package/dist/material/rules/MaterialStepRules.js.map +1 -0
- package/dist/material/rules/PlayerTurnRule.d.ts +10 -0
- package/dist/material/rules/PlayerTurnRule.js +53 -0
- package/dist/material/rules/PlayerTurnRule.js.map +1 -0
- package/dist/material/rules/Rule.d.ts +5 -0
- package/dist/material/rules/Rule.js +3 -0
- package/dist/material/rules/Rule.js.map +1 -0
- package/dist/material/rules/RuleStep.d.ts +6 -0
- package/dist/material/rules/RuleStep.js +3 -0
- package/dist/material/rules/RuleStep.js.map +1 -0
- package/dist/material/rules/RulesStep.d.ts +5 -0
- package/dist/material/rules/RulesStep.js +3 -0
- package/dist/material/rules/RulesStep.js.map +1 -0
- package/dist/material/rules/index.d.ts +3 -0
- package/dist/material/rules/index.js +20 -0
- package/dist/material/rules/index.js.map +1 -0
- package/dist/options/EnumOption.d.ts +2 -3
- package/dist/options/EnumOption.js.map +1 -1
- package/dist/options/Option.d.ts +1 -2
- package/dist/options/OptionSpecOf.d.ts +3 -4
- package/dist/options/OptionsSpec.d.ts +4 -5
- package/dist/options/OptionsValidationError.d.ts +1 -1
- package/dist/options/OptionsValidationError.js +2 -1
- package/dist/options/OptionsValidationError.js.map +1 -1
- package/dist/options/PlayerIdSpec.d.ts +2 -3
- package/dist/options/PlayerIdSpec.js.map +1 -1
- package/dist/options/PlayersOptionsSpec.d.ts +3 -4
- package/dist/options/WithIdOption.d.ts +1 -2
- package/dist/options/WithPlayerOptionsSpec.d.ts +2 -3
- package/dist/options/WithPlayersOptions.d.ts +1 -2
- package/dist/options/getFallbackPlayerName.d.ts +3 -3
- package/dist/options/getFallbackPlayerName.js +4 -6
- package/dist/options/getFallbackPlayerName.js.map +1 -1
- package/dist/options/index.d.ts +12 -12
- package/dist/options/index.js +12 -12
- package/dist/options/index.js.map +1 -1
- package/dist/options/isWithPlayerIdOptions.d.ts +4 -4
- package/dist/options/isWithPlayerIdOptions.js +2 -1
- package/dist/options/isWithPlayerIdOptions.js.map +1 -1
- package/dist/options/providePlayerIds.d.ts +6 -6
- package/dist/options/providePlayerIds.js +5 -7
- package/dist/options/providePlayerIds.js.map +1 -1
- package/package.json +9 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.MaterialMoveBuilder = void 0;
|
|
15
|
+
var __1 = require("../");
|
|
16
|
+
var MaterialMoveBuilder = /** @class */ (function () {
|
|
17
|
+
function MaterialMoveBuilder(items, type) {
|
|
18
|
+
this.items = items;
|
|
19
|
+
this.type = type;
|
|
20
|
+
}
|
|
21
|
+
MaterialMoveBuilder.prototype.moveTo = function (locationType, factory) {
|
|
22
|
+
var _this = this;
|
|
23
|
+
return this.items.map(function (i) { return ((0, __1.createMoveItemMove)(_this.type, i[0], { location: __assign({ type: locationType }, (typeof factory === 'function' ? factory === null || factory === void 0 ? void 0 : factory(i) : (factory !== null && factory !== void 0 ? factory : {}))) })); });
|
|
24
|
+
};
|
|
25
|
+
return MaterialMoveBuilder;
|
|
26
|
+
}());
|
|
27
|
+
exports.MaterialMoveBuilder = MaterialMoveBuilder;
|
|
28
|
+
//# sourceMappingURL=MaterialMoveBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MaterialMoveBuilder.js","sourceRoot":"","sources":["../../../src/material/helper/MaterialMoveBuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,yBAAsD;AAItD;IAIE,6BACE,KAAqD,EACrD,IAAkB;QAElB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,oCAAM,GAAN,UACE,YAA0B,EAC1B,OAEiG;QAJnG,iBASC;QAHC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CACzB,IAAA,sBAAkB,EAAC,KAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,QAAQ,aAAI,IAAI,EAAE,YAAY,IAAK,CAAC,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,CAAC,CAAE,EAAE,CAAC,CAC/I,EAF0B,CAE1B,CAAC,CAAA;IACJ,CAAC;IACH,0BAAC;AAAD,CAAC,AAtBD,IAsBC;AAtBY,kDAAmB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MaterialGame } from '../MaterialGame';
|
|
2
|
+
import { StartPlayerTurn, StartRule } from '../moves';
|
|
3
|
+
export declare class MaterialRulesMovesBuilder<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> {
|
|
4
|
+
game: MaterialGame<Player, MaterialType, LocationType>;
|
|
5
|
+
constructor(game: MaterialGame<Player, MaterialType, LocationType>);
|
|
6
|
+
startPlayerTurn<RuleId extends number = number>(id: RuleId, player: Player, memory?: Record<string, any>): StartPlayerTurn<Player, RuleId>;
|
|
7
|
+
startRule<RuleId extends number = number>(id: RuleId, player?: Player, memory?: Record<string, any>): StartRule<Player, RuleId>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MaterialRulesMovesBuilder = void 0;
|
|
4
|
+
var moves_1 = require("../moves");
|
|
5
|
+
var MaterialRulesMovesBuilder = /** @class */ (function () {
|
|
6
|
+
function MaterialRulesMovesBuilder(game) {
|
|
7
|
+
this.game = game;
|
|
8
|
+
}
|
|
9
|
+
MaterialRulesMovesBuilder.prototype.startPlayerTurn = function (id, player, memory) {
|
|
10
|
+
var move = { kind: moves_1.MoveKind.RulesMove, type: moves_1.RuleMoveType.StartPlayerTurn, id: id, player: player };
|
|
11
|
+
if (memory)
|
|
12
|
+
move.memory = memory;
|
|
13
|
+
return move;
|
|
14
|
+
};
|
|
15
|
+
MaterialRulesMovesBuilder.prototype.startRule = function (id, player, memory) {
|
|
16
|
+
var move = { kind: moves_1.MoveKind.RulesMove, type: moves_1.RuleMoveType.StartRule, id: id };
|
|
17
|
+
if (player)
|
|
18
|
+
move.player = player;
|
|
19
|
+
if (memory)
|
|
20
|
+
move.memory = memory;
|
|
21
|
+
return move;
|
|
22
|
+
};
|
|
23
|
+
return MaterialRulesMovesBuilder;
|
|
24
|
+
}());
|
|
25
|
+
exports.MaterialRulesMovesBuilder = MaterialRulesMovesBuilder;
|
|
26
|
+
//# sourceMappingURL=MaterialRulesMovesBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MaterialRulesMovesBuilder.js","sourceRoot":"","sources":["../../../src/material/helper/MaterialRulesMovesBuilder.ts"],"names":[],"mappings":";;;AACA,kCAA6E;AAE7E;IAKE,mCAAY,IAAsD;QAChE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,mDAAe,GAAf,UAAgD,EAAU,EAAE,MAAc,EAAE,MAA4B;QACtG,IAAM,IAAI,GAAoC,EAAE,IAAI,EAAE,gBAAQ,CAAC,SAAS,EAAE,IAAI,EAAE,oBAAY,CAAC,eAAe,EAAE,EAAE,IAAA,EAAE,MAAM,QAAA,EAAE,CAAA;QAC1H,IAAI,MAAM;YAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QAChC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,6CAAS,GAAT,UAA0C,EAAU,EAAE,MAAe,EAAE,MAA4B;QACjG,IAAM,IAAI,GAA8B,EAAE,IAAI,EAAE,gBAAQ,CAAC,SAAS,EAAE,IAAI,EAAE,oBAAY,CAAC,SAAS,EAAE,EAAE,IAAA,EAAE,CAAA;QACtG,IAAI,MAAM;YAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QAChC,IAAI,MAAM;YAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QAChC,OAAO,IAAI,CAAA;IACb,CAAC;IACH,gCAAC;AAAD,CAAC,AArBD,IAqBC;AArBY,8DAAyB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MaterialMoveBuilder } from './MaterialMoveBuilder';
|
|
2
|
+
import { MaterialItem } from '../items';
|
|
3
|
+
import { Location } from '../location';
|
|
4
|
+
export declare class MaterialSearchHelper<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> {
|
|
5
|
+
private readonly items;
|
|
6
|
+
private readonly type;
|
|
7
|
+
private filters;
|
|
8
|
+
constructor(items: [number, MaterialItem<Player, LocationType>][], type: MaterialType);
|
|
9
|
+
location(predicate: (locationType: LocationType) => boolean): this;
|
|
10
|
+
location(locationType: LocationType): this;
|
|
11
|
+
player(playerId: Player): this;
|
|
12
|
+
entries(): [number, MaterialItem<Player, LocationType>][];
|
|
13
|
+
all(): MaterialItem<Player, LocationType>[];
|
|
14
|
+
filter(predicate: (item: MaterialItem<Player, LocationType>, id: number) => boolean): this;
|
|
15
|
+
maxBy(selector: (location: Location<Player, LocationType>) => any): MaterialItem<Player, LocationType> | undefined;
|
|
16
|
+
count(): number;
|
|
17
|
+
moves(): MaterialMoveBuilder<Player, MaterialType, LocationType>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MaterialSearchHelper = void 0;
|
|
7
|
+
var MaterialMoveBuilder_1 = require("./MaterialMoveBuilder");
|
|
8
|
+
var matches_1 = __importDefault(require("lodash/matches"));
|
|
9
|
+
var lodash_maxby_1 = __importDefault(require("lodash.maxby"));
|
|
10
|
+
var MaterialSearchHelper = /** @class */ (function () {
|
|
11
|
+
function MaterialSearchHelper(items, type) {
|
|
12
|
+
this.filters = [];
|
|
13
|
+
this.items = items;
|
|
14
|
+
this.type = type;
|
|
15
|
+
}
|
|
16
|
+
MaterialSearchHelper.prototype.location = function (locationType) {
|
|
17
|
+
this.filters.push({
|
|
18
|
+
type: locationType
|
|
19
|
+
});
|
|
20
|
+
return this;
|
|
21
|
+
};
|
|
22
|
+
MaterialSearchHelper.prototype.player = function (playerId) {
|
|
23
|
+
this.filters.push({
|
|
24
|
+
player: playerId
|
|
25
|
+
});
|
|
26
|
+
return this;
|
|
27
|
+
};
|
|
28
|
+
MaterialSearchHelper.prototype.entries = function () {
|
|
29
|
+
var _this = this;
|
|
30
|
+
return this.items.filter(function (i) {
|
|
31
|
+
var location = i[1].location;
|
|
32
|
+
return _this.filters.every(function (f) {
|
|
33
|
+
if (typeof f == 'function') {
|
|
34
|
+
return f(location);
|
|
35
|
+
}
|
|
36
|
+
if (f.predicate) {
|
|
37
|
+
return f.predicate(i[1], i[0]);
|
|
38
|
+
}
|
|
39
|
+
return (0, matches_1.default)(f)(location);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
MaterialSearchHelper.prototype.all = function () {
|
|
44
|
+
return this.entries().map(function (i) { return i[1]; });
|
|
45
|
+
};
|
|
46
|
+
MaterialSearchHelper.prototype.filter = function (predicate) {
|
|
47
|
+
this.filters.push({ predicate: predicate });
|
|
48
|
+
return this;
|
|
49
|
+
};
|
|
50
|
+
MaterialSearchHelper.prototype.maxBy = function (selector) {
|
|
51
|
+
return (0, lodash_maxby_1.default)(this.all(), function (item) { return selector(item.location); });
|
|
52
|
+
};
|
|
53
|
+
MaterialSearchHelper.prototype.count = function () {
|
|
54
|
+
return this.entries().length;
|
|
55
|
+
};
|
|
56
|
+
MaterialSearchHelper.prototype.moves = function () {
|
|
57
|
+
return new MaterialMoveBuilder_1.MaterialMoveBuilder(this.entries(), this.type);
|
|
58
|
+
};
|
|
59
|
+
return MaterialSearchHelper;
|
|
60
|
+
}());
|
|
61
|
+
exports.MaterialSearchHelper = MaterialSearchHelper;
|
|
62
|
+
//# sourceMappingURL=MaterialSearchHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MaterialSearchHelper.js","sourceRoot":"","sources":["../../../src/material/helper/MaterialSearchHelper.ts"],"names":[],"mappings":";;;;;;AAAA,6DAA2D;AAE3D,2DAAoC;AACpC,8DAAgC;AAGhC;IAUE,8BACE,KAAqD,EACrD,IAAkB;QAJZ,YAAO,GAAU,EAAE,CAAA;QAMzB,IAAI,CAAC,K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AC,CAAA;QAEhC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,oCAAK,GAAL,UACE,QAA2D;QAE3D,OAAO,IAAA,sBAAK,EAAC,IAAI,CAAC,GAAG,EAAE,EAAE,UAAC,IAAI,IAAK,OAAA,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAvB,CAAuB,CAAC,CAAA;IAC7D,CAAC;IAED,oCAAK,GAAL;QACE,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,CAAA;IAC9B,CAAC;IAED,oCAAK,GAAL;QACE,OAAO,IAAI,yCAAmB,CAC5B,IAAI,CAAC,OAAO,EAAE,EACd,IAAI,CAAC,IAAI,CACV,CAAA;IACH,CAAC;IACH,2BAAC;AAAD,CAAC,AAjFD,IAiFC;AAjFY,oDAAoB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./MaterialMoveBuilder"), exports);
|
|
18
|
+
__exportStar(require("./MaterialSearchHelper"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/material/helper/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC;AACrC,yDAAsC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './helper';
|
|
2
|
+
export * from './items';
|
|
3
|
+
export * from './location';
|
|
4
|
+
export * from './moves';
|
|
5
|
+
export * from './rules';
|
|
6
|
+
export * from './HiddenMaterialRules';
|
|
7
|
+
export * from './MaterialGame';
|
|
8
|
+
export * from './MaterialRules';
|
|
9
|
+
export * from './SecretMaterialRules';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./helper"), exports);
|
|
18
|
+
__exportStar(require("./items"), exports);
|
|
19
|
+
__exportStar(require("./location"), exports);
|
|
20
|
+
__exportStar(require("./moves"), exports);
|
|
21
|
+
__exportStar(require("./rules"), exports);
|
|
22
|
+
__exportStar(require("./HiddenMaterialRules"), exports);
|
|
23
|
+
__exportStar(require("./MaterialGame"), exports);
|
|
24
|
+
__exportStar(require("./MaterialRules"), exports);
|
|
25
|
+
__exportStar(require("./SecretMaterialRules"), exports);
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/material/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,0CAAuB;AACvB,6CAA0B;AAC1B,0CAAuB;AACvB,0CAAuB;AACvB,wDAAqC;AACrC,iDAA8B;AAC9B,kDAA+B;AAC/B,wDAAqC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { MaterialItem } from './MaterialItem';
|
|
2
|
+
import { Coordinates, Location } from '../location';
|
|
3
|
+
import { CreateItem, MoveItem } from '../moves';
|
|
4
|
+
import { DeleteItem } from '../moves/DeleteItem';
|
|
5
|
+
declare type ItemEntry<P extends number = number, L extends number = number> = [number, MaterialItem<P, L>];
|
|
6
|
+
export declare class Material<P extends number = number, M extends number = number, L extends number = number> {
|
|
7
|
+
private readonly type;
|
|
8
|
+
private readonly entries;
|
|
9
|
+
constructor(type: M, items: ItemEntry<P, L>[]);
|
|
10
|
+
getItems(): MaterialItem<P, L>[];
|
|
11
|
+
getItems<T>(mapFn: (item: MaterialItem<P, L>) => T): T[];
|
|
12
|
+
getItem(index: number): MaterialItem<P, L> | undefined;
|
|
13
|
+
getItem(predicate?: (item: MaterialItem<P, L>) => boolean): MaterialItem<P, L> | undefined;
|
|
14
|
+
get length(): number;
|
|
15
|
+
filter(predicate: (item: MaterialItem<P, L>) => boolean): Material<P, M, L>;
|
|
16
|
+
id<Id extends string | number | Array<any>>(arg?: Id | ((id?: Id) => boolean)): Material<P, M, L>;
|
|
17
|
+
location(arg: L | ((location: Location<P, L>) => boolean)): Material<P, M, L>;
|
|
18
|
+
player(arg?: P | ((player?: P) => boolean)): Material<P, M, L>;
|
|
19
|
+
locationId<Id extends string | number | Array<any>>(arg: Id | ((id?: Id) => boolean)): Material<P, M, L>;
|
|
20
|
+
parent<ParentId extends string | number | Array<any>>(arg?: ParentId | ((parent?: ParentId) => boolean)): Material<P, M, L>;
|
|
21
|
+
minBy(selector: (item: MaterialItem<P, L>) => number): Material<P, M, L>;
|
|
22
|
+
sort(selector: (item: MaterialItem<P, L>) => number): Material<P, M, L>;
|
|
23
|
+
limit(count: number): Material<P, M, L>;
|
|
24
|
+
maxBy(selector: (item: MaterialItem<P, L>) => number): Material<P, M, L>;
|
|
25
|
+
createItem(item: MaterialItem<P, L>): CreateItem<P, M, L>;
|
|
26
|
+
deleteItem(quantity?: number): DeleteItem<M>;
|
|
27
|
+
moveItem(locationType: L, location?: Partial<Location<P, L>>, rotation?: Partial<Coordinates> | false): MoveItem<P, M, L>;
|
|
28
|
+
moveItems(locationType: L, location?: Partial<Location<P, L>>, rotation?: Partial<Coordinates> | false): MoveItem<P, M, L>[];
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Material = void 0;
|
|
18
|
+
var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
|
19
|
+
var moves_1 = require("../moves");
|
|
20
|
+
var minBy_1 = __importDefault(require("lodash/minBy"));
|
|
21
|
+
var maxBy_1 = __importDefault(require("lodash/maxBy"));
|
|
22
|
+
var orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
23
|
+
var Material = /** @class */ (function () {
|
|
24
|
+
function Material(type, items) {
|
|
25
|
+
this.type = type;
|
|
26
|
+
this.entries = items;
|
|
27
|
+
}
|
|
28
|
+
Material.prototype.getItems = function (mapFn) {
|
|
29
|
+
return this.entries.map(function (entry) { return mapFn ? mapFn(entry[1]) : entry[1]; });
|
|
30
|
+
};
|
|
31
|
+
Material.prototype.getItem = function (arg) {
|
|
32
|
+
if (typeof arg === 'number') {
|
|
33
|
+
var entry = this.entries.find(function (entry) { return entry[0] === arg; });
|
|
34
|
+
return entry ? entry[1] : undefined;
|
|
35
|
+
}
|
|
36
|
+
else if (typeof arg === 'function') {
|
|
37
|
+
var entries = this.entries.filter(function (_a) {
|
|
38
|
+
var item = _a[1];
|
|
39
|
+
return arg(item);
|
|
40
|
+
});
|
|
41
|
+
return entries.length ? entries[0][1] : undefined;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return this.entries.length ? this.entries[0][1] : undefined;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(Material.prototype, "length", {
|
|
48
|
+
get: function () {
|
|
49
|
+
return this.entries.length;
|
|
50
|
+
},
|
|
51
|
+
enumerable: false,
|
|
52
|
+
configurable: true
|
|
53
|
+
});
|
|
54
|
+
Material.prototype.filter = function (predicate) {
|
|
55
|
+
return new Material(this.type, this.entries.filter(function (_a) {
|
|
56
|
+
var item = _a[1];
|
|
57
|
+
return predicate(item);
|
|
58
|
+
}));
|
|
59
|
+
};
|
|
60
|
+
Material.prototype.id = function (arg) {
|
|
61
|
+
return this.filter(function (_a) {
|
|
62
|
+
var id = _a.id;
|
|
63
|
+
return typeof arg === 'function' ? arg(id) : (0, fast_deep_equal_1.default)(id, arg);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
Material.prototype.location = function (arg) {
|
|
67
|
+
return this.filter(function (_a) {
|
|
68
|
+
var location = _a.location;
|
|
69
|
+
return typeof arg === 'function' ? arg(location) : location.type === arg;
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
Material.prototype.player = function (arg) {
|
|
73
|
+
return this.location(function (_a) {
|
|
74
|
+
var player = _a.player;
|
|
75
|
+
return typeof arg === 'function' ? arg(player) : player === arg;
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
Material.prototype.locationId = function (arg) {
|
|
79
|
+
return this.location(function (_a) {
|
|
80
|
+
var id = _a.id;
|
|
81
|
+
return typeof arg === 'function' ? arg(id) : (0, fast_deep_equal_1.default)(id, arg);
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
Material.prototype.parent = function (arg) {
|
|
85
|
+
return this.location(function (_a) {
|
|
86
|
+
var parent = _a.parent;
|
|
87
|
+
return typeof arg === 'function' ? arg(parent) : (0, fast_deep_equal_1.default)(parent, arg);
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
Material.prototype.minBy = function (selector) {
|
|
91
|
+
var min = (0, minBy_1.default)(this.entries, function (entry) { return selector(entry[1]); });
|
|
92
|
+
return new Material(this.type, min ? [min] : []);
|
|
93
|
+
};
|
|
94
|
+
Material.prototype.sort = function (selector) {
|
|
95
|
+
var orderedItems = (0, orderBy_1.default)(this.entries, function (entry) { return selector(entry[1]); });
|
|
96
|
+
return new Material(this.type, orderedItems);
|
|
97
|
+
};
|
|
98
|
+
Material.prototype.limit = function (count) {
|
|
99
|
+
return new Material(this.type, this.entries.slice(count));
|
|
100
|
+
};
|
|
101
|
+
Material.prototype.maxBy = function (selector) {
|
|
102
|
+
var max = (0, maxBy_1.default)(this.entries, function (entry) { return selector(entry[1]); });
|
|
103
|
+
return new Material(this.type, max ? [max] : []);
|
|
104
|
+
};
|
|
105
|
+
Material.prototype.createItem = function (item) {
|
|
106
|
+
return { kind: moves_1.MoveKind.MaterialMove, type: moves_1.MaterialMoveType.Create, itemType: this.type, item: item };
|
|
107
|
+
};
|
|
108
|
+
Material.prototype.deleteItem = function (quantity) {
|
|
109
|
+
if (!this.length || (quantity !== undefined && (this.length - quantity < 0)))
|
|
110
|
+
throw new Error('You are trying to delete an item that does not exists');
|
|
111
|
+
return {
|
|
112
|
+
kind: moves_1.MoveKind.MaterialMove,
|
|
113
|
+
type: moves_1.MaterialMoveType.Delete,
|
|
114
|
+
itemType: this.type,
|
|
115
|
+
itemIndex: this.entries[0][0],
|
|
116
|
+
quantity: quantity
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
Material.prototype.moveItem = function (locationType, location, rotation) {
|
|
120
|
+
if (!this.length)
|
|
121
|
+
throw new Error('You are trying to move an item that does not exists');
|
|
122
|
+
var destination = { location: __assign({ type: locationType }, location) };
|
|
123
|
+
if (rotation)
|
|
124
|
+
destination.rotation = rotation;
|
|
125
|
+
return {
|
|
126
|
+
kind: moves_1.MoveKind.MaterialMove,
|
|
127
|
+
type: moves_1.MaterialMoveType.Move,
|
|
128
|
+
itemType: this.type,
|
|
129
|
+
itemIndex: this.entries[0][0],
|
|
130
|
+
item: destination
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
Material.prototype.moveItems = function (locationType, location, rotation) {
|
|
134
|
+
var _this = this;
|
|
135
|
+
var destination = { location: __assign({ type: locationType }, location) };
|
|
136
|
+
if (rotation)
|
|
137
|
+
destination.rotation = rotation;
|
|
138
|
+
return this.entries.map(function (entry) { return ({
|
|
139
|
+
kind: moves_1.MoveKind.MaterialMove,
|
|
140
|
+
type: moves_1.MaterialMoveType.Move,
|
|
141
|
+
itemType: _this.type,
|
|
142
|
+
itemIndex: entry[0],
|
|
143
|
+
item: destination
|
|
144
|
+
}); });
|
|
145
|
+
};
|
|
146
|
+
return Material;
|
|
147
|
+
}());
|
|
148
|
+
exports.Material = Material;
|
|
149
|
+
//# sourceMappingURL=Material.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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AAI,KAAK,CAAC,qDAAqD,CAAC,CAAA;QACxF,IAAM,WAAW,GAAuB,EAAE,QAAQ,aAAI,IAAI,EAAE,YAAY,IAAK,QAAQ,CAAE,EAAE,CAAA;QACzF,IAAI,QAAQ;YAAE,WAAW,CAAC,QAAQ,GAAG,QAAQ,CAAA;QAC7C,OAAO;YACL,IAAI,EAAE,gBAAQ,CAAC,YAAY;YAC3B,IAAI,EAAE,wBAAgB,CAAC,IAAI;YAC3B,QAAQ,EAAE,IAAI,CAAC,IAAI;YACnB,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7B,IAAI,EAAE,WAAW;SAClB,CAAA;IACH,CAAC;IAED,4BAAS,GAAT,UAAU,YAAe,EAAE,QAAkC,EAAE,QAAuC;QAAtG,iBAUC;QATC,IAAM,WAAW,GAAuB,EAAE,QAAQ,aAAI,IAAI,EAAE,YAAY,IAAK,QAAQ,CAAE,EAAE,CAAA;QACzF,IAAI,QAAQ;YAAE,WAAW,CAAC,QAAQ,GAAG,QAAQ,CAAA;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,CAAC;YAChC,IAAI,EAAE,gBAAQ,CAAC,YAAY;YAC3B,IAAI,EAAE,wBAAgB,CAAC,IAAI;YAC3B,QAAQ,EAAE,KAAI,CAAC,IAAI;YACnB,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;YACnB,IAAI,EAAE,WAAW;SAClB,CAAC,EAN+B,CAM/B,CAAC,CAAA;IACL,CAAC;IACH,eAAC;AAAD,CAAC,AArHD,IAqHC;AArHY,4BAAQ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A material item is a piece of material in a game
|
|
3
|
+
*/
|
|
4
|
+
import { Coordinates, Location } from '../location';
|
|
5
|
+
export declare type MaterialItem<Player = number, LocationType = number, Id = any> = {
|
|
6
|
+
id?: Id;
|
|
7
|
+
location: Location<Player, LocationType>;
|
|
8
|
+
rotation?: Partial<Coordinates>;
|
|
9
|
+
quantity?: number;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MaterialItem.js","sourceRoot":"","sources":["../../../src/material/items/MaterialItem.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MaterialItem } from './MaterialItem';
|
|
2
|
+
import { MaterialMoveBuilder, MaterialSearchHelper } from '../helper';
|
|
3
|
+
import { LocationStrategy } from '../location';
|
|
4
|
+
export declare class MaterialOperation<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> {
|
|
5
|
+
readonly type: MaterialType;
|
|
6
|
+
items: MaterialItem<Player, LocationType>[];
|
|
7
|
+
locationsStrategies: Partial<Record<LocationType, LocationStrategy<Player, MaterialType, LocationType>>>;
|
|
8
|
+
constructor(type: MaterialType, items: MaterialItem<Player, LocationType>[], locationsStrategies?: Partial<Record<LocationType, LocationStrategy<Player, MaterialType, LocationType>>>);
|
|
9
|
+
create(item: MaterialItem<Player, LocationType>): this;
|
|
10
|
+
delete(index: number, quantity?: number): void;
|
|
11
|
+
private addItem;
|
|
12
|
+
private applyAddItemStrategy;
|
|
13
|
+
private applyRemoveItemStrategy;
|
|
14
|
+
shuffle(indexes?: number[], newIndexes?: number[]): this;
|
|
15
|
+
move(index: number, movedItem: Partial<MaterialItem<Player, LocationType>>): void;
|
|
16
|
+
private removeItem;
|
|
17
|
+
search(): MaterialSearchHelper<Player, MaterialType, LocationType>;
|
|
18
|
+
moves(): MaterialMoveBuilder<Player, MaterialType, LocationType>;
|
|
19
|
+
}
|
|
20
|
+
export declare const isItemWithLocation: <P extends number = number, L extends number = number>(item: Partial<MaterialItem<P, L, any>>) => item is MaterialItem<P, L, any>;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.isItemWithLocation = exports.MaterialOperation = void 0;
|
|
29
|
+
var lodash_shuffle_1 = __importDefault(require("lodash.shuffle"));
|
|
30
|
+
var helper_1 = require("../helper");
|
|
31
|
+
var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
|
32
|
+
var Material_1 = require("./Material");
|
|
33
|
+
var MaterialOperation = /** @class */ (function () {
|
|
34
|
+
function MaterialOperation(type, items, locationsStrategies) {
|
|
35
|
+
if (locationsStrategies === void 0) { locationsStrategies = {}; }
|
|
36
|
+
this.type = type;
|
|
37
|
+
this.items = items;
|
|
38
|
+
this.locationsStrategies = locationsStrategies;
|
|
39
|
+
}
|
|
40
|
+
MaterialOperation.prototype.create = function (item) {
|
|
41
|
+
var mergeItem = item.quantity && this.items.find(function (existingItem) { return itemsCanMerge(existingItem, item); });
|
|
42
|
+
if (mergeItem) {
|
|
43
|
+
mergeItem.quantity += item.quantity;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
this.addItem(item);
|
|
47
|
+
}
|
|
48
|
+
return this;
|
|
49
|
+
};
|
|
50
|
+
MaterialOperation.prototype.delete = function (index, quantity) {
|
|
51
|
+
if (quantity === void 0) { quantity = 1; }
|
|
52
|
+
var item = this.items[index];
|
|
53
|
+
return this.removeItem(item, quantity);
|
|
54
|
+
};
|
|
55
|
+
MaterialOperation.prototype.addItem = function (item) {
|
|
56
|
+
this.applyAddItemStrategy(item);
|
|
57
|
+
var availableIndex = this.items.findIndex(function (item) { return item.quantity === 0; });
|
|
58
|
+
if (availableIndex !== -1) {
|
|
59
|
+
this.items[availableIndex] = item;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.items.push(item);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
MaterialOperation.prototype.applyAddItemStrategy = function (item) {
|
|
66
|
+
if (item.location.type in this.locationsStrategies) {
|
|
67
|
+
var strategy = this.locationsStrategies[item.location.type];
|
|
68
|
+
if (strategy.addItem) {
|
|
69
|
+
var material = new Material_1.Material(this.type, Array.from(this.items.entries()).filter(function (entry) { return entry[1].quantity !== 0; }))
|
|
70
|
+
.location(item.location.type).player(item.location.player).locationId(item.location.id).parent(item.location.parent);
|
|
71
|
+
strategy.addItem(material, item);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
MaterialOperation.prototype.applyRemoveItemStrategy = function (item) {
|
|
76
|
+
if (item.location.type in this.locationsStrategies) {
|
|
77
|
+
var strategy = this.locationsStrategies[item.location.type];
|
|
78
|
+
if (strategy.removeItem) {
|
|
79
|
+
var material = new Material_1.Material(this.type, Array.from(this.items.entries()).filter(function (entry) { return entry[1].quantity !== 0; }))
|
|
80
|
+
.location(item.location.type).player(item.location.player).locationId(item.location.id).parent(item.location.parent);
|
|
81
|
+
strategy.removeItem(material, item);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
MaterialOperation.prototype.shuffle = function (indexes, newIndexes) {
|
|
86
|
+
var _this = this;
|
|
87
|
+
indexes = indexes || Array.from(this.items.keys());
|
|
88
|
+
newIndexes = newIndexes || (0, lodash_shuffle_1.default)(indexes);
|
|
89
|
+
var shuffledItems = indexes.map(function (index) { return _this.items[index]; });
|
|
90
|
+
newIndexes.forEach(function (newIndex, i) {
|
|
91
|
+
_this.items[newIndex] = __assign(__assign({}, shuffledItems[i]), { location: _this.items[newIndex].location });
|
|
92
|
+
});
|
|
93
|
+
return this;
|
|
94
|
+
};
|
|
95
|
+
MaterialOperation.prototype.move = function (index, movedItem) {
|
|
96
|
+
var _a, _b, _c, _d;
|
|
97
|
+
var item = this.items[index];
|
|
98
|
+
var mergeItem = this.items.find(function (item) { return itemsCanMerge(item, movedItem); });
|
|
99
|
+
if (mergeItem) {
|
|
100
|
+
mergeItem.quantity = ((_a = mergeItem.quantity) !== null && _a !== void 0 ? _a : 1) + ((_b = movedItem.quantity) !== null && _b !== void 0 ? _b : 1);
|
|
101
|
+
this.removeItem(item, movedItem.quantity);
|
|
102
|
+
}
|
|
103
|
+
else if (item.quantity && item.quantity > ((_c = movedItem.quantity) !== null && _c !== void 0 ? _c : 1)) {
|
|
104
|
+
if (!(0, exports.isItemWithLocation)(movedItem))
|
|
105
|
+
throw new Error('You must specify a location if you move only a part of a pile of items');
|
|
106
|
+
item.quantity -= ((_d = movedItem.quantity) !== null && _d !== void 0 ? _d : 1);
|
|
107
|
+
var quantity = item.quantity, rotation = item.rotation, location_1 = item.location, itemData = __rest(item, ["quantity", "rotation", "location"]);
|
|
108
|
+
this.addItem(__assign(__assign({}, itemData), movedItem));
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
var isLocationChange = (0, exports.isItemWithLocation)(movedItem);
|
|
112
|
+
if (!isLocationChange) {
|
|
113
|
+
this.items[index] = __assign(__assign({}, item), movedItem);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
this.applyAddItemStrategy(movedItem);
|
|
117
|
+
var quantity = item.quantity, rotation = item.rotation, location_2 = item.location, itemData = __rest(item, ["quantity", "rotation", "location"]);
|
|
118
|
+
this.items[index] = __assign(__assign({}, itemData), movedItem);
|
|
119
|
+
this.applyRemoveItemStrategy(item);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
MaterialOperation.prototype.removeItem = function (item, quantity) {
|
|
124
|
+
var _a;
|
|
125
|
+
if (quantity === void 0) { quantity = 1; }
|
|
126
|
+
item.quantity = Math.max(0, ((_a = item.quantity) !== null && _a !== void 0 ? _a : 1) - quantity);
|
|
127
|
+
if (item.quantity === 0) {
|
|
128
|
+
this.applyRemoveItemStrategy(item);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
MaterialOperation.prototype.search = function () {
|
|
132
|
+
return new helper_1.MaterialSearchHelper(Array.from(this.items.entries()), this.type);
|
|
133
|
+
};
|
|
134
|
+
MaterialOperation.prototype.moves = function () {
|
|
135
|
+
return new helper_1.MaterialMoveBuilder(Array.from(this.items.entries()), this.type);
|
|
136
|
+
};
|
|
137
|
+
return MaterialOperation;
|
|
138
|
+
}());
|
|
139
|
+
exports.MaterialOperation = MaterialOperation;
|
|
140
|
+
var isItemWithLocation = function (item) { return item.location !== undefined; };
|
|
141
|
+
exports.isItemWithLocation = isItemWithLocation;
|
|
142
|
+
var itemsCanMerge = function (_a, _b) {
|
|
143
|
+
var q1 = _a.quantity, item1 = __rest(_a, ["quantity"]);
|
|
144
|
+
var q2 = _b.quantity, item2 = __rest(_b, ["quantity"]);
|
|
145
|
+
return (0, fast_deep_equal_1.default)(item1, item2);
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=MaterialOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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