@gamepark/rules-api 6.24.1 → 6.24.3
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 +7 -0
- package/dist/Bot.d.ts +21 -0
- package/dist/Bot.js +18 -2
- package/dist/Bot.js.map +1 -1
- package/dist/Competitive.d.ts +45 -0
- package/dist/Competitive.js +15 -0
- package/dist/Competitive.js.map +1 -1
- package/dist/Eliminations.d.ts +17 -0
- package/dist/Eliminations.js +5 -0
- package/dist/Eliminations.js.map +1 -1
- package/dist/GameSetup.d.ts +14 -0
- package/dist/HiddenInformation.d.ts +22 -0
- package/dist/HiddenInformation.js +5 -0
- package/dist/HiddenInformation.js.map +1 -1
- package/dist/LocalMovePreview.d.ts +14 -0
- package/dist/LocalMovePreview.js +5 -0
- package/dist/LocalMovePreview.js.map +1 -1
- package/dist/RandomMove.d.ts +17 -0
- package/dist/Rules.d.ts +119 -0
- package/dist/Rules.js +102 -1
- package/dist/Rules.js.map +1 -1
- package/dist/SecretInformation.d.ts +39 -0
- package/dist/SecretInformation.js +5 -0
- package/dist/SecretInformation.js.map +1 -1
- package/dist/TimeLimit.d.ts +22 -0
- package/dist/TimeLimit.js +5 -0
- package/dist/TimeLimit.js.map +1 -1
- package/dist/Undo.d.ts +18 -0
- package/dist/Undo.js +6 -0
- package/dist/Undo.js.map +1 -1
- package/dist/UnpredictableMove.d.ts +19 -0
- package/dist/UnpredictableMove.js +5 -0
- package/dist/UnpredictableMove.js.map +1 -1
- package/dist/material/HiddenMaterialRules.d.ts +49 -1
- package/dist/material/HiddenMaterialRules.js +49 -3
- package/dist/material/HiddenMaterialRules.js.map +1 -1
- package/dist/material/MaterialGame.d.ts +12 -0
- package/dist/material/MaterialGameSetup.d.ts +74 -0
- package/dist/material/MaterialGameSetup.js +67 -1
- package/dist/material/MaterialGameSetup.js.map +1 -1
- package/dist/material/MaterialRules.d.ts +125 -0
- package/dist/material/MaterialRules.js +122 -3
- package/dist/material/MaterialRules.js.map +1 -1
- package/dist/material/SecretMaterialRules.d.ts +31 -0
- package/dist/material/SecretMaterialRules.js +23 -1
- package/dist/material/SecretMaterialRules.js.map +1 -1
- package/dist/material/items/Material.d.ts +253 -0
- package/dist/material/items/Material.js +248 -1
- package/dist/material/items/Material.js.map +1 -1
- package/dist/material/items/MaterialDeck.d.ts +33 -0
- package/dist/material/items/MaterialDeck.js +34 -1
- package/dist/material/items/MaterialDeck.js.map +1 -1
- package/dist/material/items/MaterialItem.d.ts +12 -0
- package/dist/material/items/MaterialMutator.d.ts +39 -0
- package/dist/material/items/MaterialMutator.js +41 -2
- package/dist/material/items/MaterialMutator.js.map +1 -1
- package/dist/material/items/index.js +1 -1
- package/dist/material/items/index.js.map +1 -1
- package/dist/material/location/Location.d.ts +28 -0
- package/dist/material/location/Location.js +5 -0
- package/dist/material/location/Location.js.map +1 -1
- package/dist/material/location/LocationBuilder.js +1 -1
- package/dist/material/location/strategy/FillGapStrategy.d.ts +4 -0
- package/dist/material/location/strategy/FillGapStrategy.js +5 -1
- package/dist/material/location/strategy/FillGapStrategy.js.map +1 -1
- package/dist/material/location/strategy/LocationStrategy.d.ts +20 -0
- package/dist/material/location/strategy/PositiveSequenceStrategy.d.ts +4 -0
- package/dist/material/location/strategy/PositiveSequenceStrategy.js +5 -1
- package/dist/material/location/strategy/PositiveSequenceStrategy.js.map +1 -1
- package/dist/material/memory/GameMemory.d.ts +21 -0
- package/dist/material/memory/GameMemory.js +22 -1
- package/dist/material/memory/GameMemory.js.map +1 -1
- package/dist/material/memory/PlayerMemory.d.ts +22 -0
- package/dist/material/memory/PlayerMemory.js +23 -1
- package/dist/material/memory/PlayerMemory.js.map +1 -1
- package/dist/material/moves/CustomMove.d.ts +18 -0
- package/dist/material/moves/CustomMove.js +13 -0
- package/dist/material/moves/CustomMove.js.map +1 -1
- package/dist/material/moves/MaterialMove.d.ts +9 -0
- package/dist/material/moves/MaterialMoveBuilder.d.ts +36 -0
- package/dist/material/moves/MaterialMoveBuilder.js +36 -0
- package/dist/material/moves/MaterialMoveBuilder.js.map +1 -1
- package/dist/material/moves/MoveKind.d.ts +3 -0
- package/dist/material/moves/MoveKind.js +3 -0
- package/dist/material/moves/MoveKind.js.map +1 -1
- package/dist/material/moves/items/CreateItem.d.ts +13 -0
- package/dist/material/moves/items/CreateItem.js +10 -0
- package/dist/material/moves/items/CreateItem.js.map +1 -1
- package/dist/material/moves/items/CreateItemsAtOnce.d.ts +14 -0
- package/dist/material/moves/items/CreateItemsAtOnce.js +10 -0
- package/dist/material/moves/items/CreateItemsAtOnce.js.map +1 -1
- package/dist/material/moves/items/DeleteItem.d.ts +18 -0
- package/dist/material/moves/items/DeleteItem.js +11 -0
- package/dist/material/moves/items/DeleteItem.js.map +1 -1
- package/dist/material/moves/items/DeleteItemsAtOnce.d.ts +17 -0
- package/dist/material/moves/items/DeleteItemsAtOnce.js +10 -0
- package/dist/material/moves/items/DeleteItemsAtOnce.js.map +1 -1
- package/dist/material/moves/items/ItemMove.d.ts +12 -0
- package/dist/material/moves/items/ItemMoveType.d.ts +3 -0
- package/dist/material/moves/items/ItemMoveType.js +3 -0
- package/dist/material/moves/items/ItemMoveType.js.map +1 -1
- package/dist/material/moves/items/MoveItem.d.ts +20 -0
- package/dist/material/moves/items/MoveItem.js +11 -0
- package/dist/material/moves/items/MoveItem.js.map +1 -1
- package/dist/material/moves/items/MoveItemsAtOnce.d.ts +20 -0
- package/dist/material/moves/items/MoveItemsAtOnce.js +10 -0
- package/dist/material/moves/items/MoveItemsAtOnce.js.map +1 -1
- package/dist/material/moves/items/RollItem.d.ts +19 -0
- package/dist/material/moves/items/RollItem.js +10 -0
- package/dist/material/moves/items/RollItem.js.map +1 -1
- package/dist/material/moves/items/SelectItem.d.ts +20 -0
- package/dist/material/moves/items/SelectItem.js +11 -0
- package/dist/material/moves/items/SelectItem.js.map +1 -1
- package/dist/material/moves/items/Shuffle.d.ts +26 -0
- package/dist/material/moves/items/Shuffle.js +15 -0
- package/dist/material/moves/items/Shuffle.js.map +1 -1
- package/dist/material/moves/local/CloseTutorialPopup.d.ts +8 -0
- package/dist/material/moves/local/CloseTutorialPopup.js +5 -0
- package/dist/material/moves/local/CloseTutorialPopup.js.map +1 -1
- package/dist/material/moves/local/DisplayHelp.d.ts +18 -0
- package/dist/material/moves/local/DisplayHelp.js +3 -0
- package/dist/material/moves/local/DisplayHelp.js.map +1 -1
- package/dist/material/moves/local/DropItem.d.ts +9 -0
- package/dist/material/moves/local/LocalMove.d.ts +6 -0
- package/dist/material/moves/local/LocalMove.js +3 -0
- package/dist/material/moves/local/LocalMove.js.map +1 -1
- package/dist/material/moves/local/SetTutorialStep.d.ts +8 -0
- package/dist/material/moves/local/SetTutorialStep.js +5 -0
- package/dist/material/moves/local/SetTutorialStep.js.map +1 -1
- package/dist/material/rules/MaterialRulesPart.d.ts +76 -0
- package/dist/material/rules/MaterialRulesPart.js +74 -1
- package/dist/material/rules/MaterialRulesPart.js.map +1 -1
- package/dist/material/rules/PlayerTurnRule.d.ts +19 -0
- package/dist/material/rules/PlayerTurnRule.js +20 -1
- package/dist/material/rules/PlayerTurnRule.js.map +1 -1
- package/dist/material/rules/RuleStep.d.ts +3 -0
- package/dist/material/rules/SimultaneousRule.d.ts +25 -0
- package/dist/material/rules/SimultaneousRule.js +21 -1
- package/dist/material/rules/SimultaneousRule.js.map +1 -1
- package/dist/material/tutorial/TutorialState.d.ts +7 -0
- package/dist/options/OptionsValidationError.js +1 -1
- package/dist/options/PlayerEnumOption.js +3 -0
- package/dist/options/PlayerEnumOption.js.map +1 -1
- package/dist/utils/action-view.util.js +2 -0
- package/dist/utils/action-view.util.js.map +1 -1
- package/dist/utils/enum.util.d.ts +27 -0
- package/dist/utils/enum.util.js +24 -0
- package/dist/utils/enum.util.js.map +1 -1
- package/dist/utils/grid.squares.util.d.ts +26 -0
- package/dist/utils/grid.squares.util.js +26 -0
- package/dist/utils/grid.squares.util.js.map +1 -1
- package/dist/utils/grid.util.d.ts +8 -0
- package/dist/utils/grid.util.js +5 -0
- package/dist/utils/grid.util.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/listing.util.d.ts +12 -0
- package/dist/utils/listing.util.js +12 -0
- package/dist/utils/listing.util.js.map +1 -1
- package/dist/utils/money.util.d.ts +48 -0
- package/dist/utils/money.util.js +174 -0
- package/dist/utils/money.util.js.map +1 -0
- package/dist/utils/random.util.d.ts +11 -0
- package/dist/utils/random.util.js +11 -0
- package/dist/utils/random.util.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,15 +1,43 @@
|
|
|
1
1
|
import { LocationStrategy } from '../location';
|
|
2
2
|
import { ItemMoveRandomized, ItemMoveView, MoveItem, MoveItemsAtOnce } from '../moves';
|
|
3
3
|
import { MaterialItem } from './index';
|
|
4
|
+
/**
|
|
5
|
+
* Helper class to change the state of any {@link MaterialItem} in a game implemented with {@link MaterialRules}.
|
|
6
|
+
*
|
|
7
|
+
* @typeparam P - identifier of a player. Either a number or a numeric enum (eg: PlayerColor)
|
|
8
|
+
* @typeparam M - Numeric enum of the types of material manipulated in the game
|
|
9
|
+
* @typeparam L - Numeric enum of the types of location in the game where the material can be located
|
|
10
|
+
*/
|
|
4
11
|
export declare class MaterialMutator<P extends number = number, M extends number = number, L extends number = number> {
|
|
5
12
|
private readonly type;
|
|
6
13
|
private readonly items;
|
|
7
14
|
private readonly locationsStrategies;
|
|
8
15
|
private readonly canMerge;
|
|
16
|
+
/**
|
|
17
|
+
* @param type Type of items this mutator will work on
|
|
18
|
+
* @param items Items to work with
|
|
19
|
+
* @param locationsStrategies The strategies that these items must follow
|
|
20
|
+
* @param canMerge Whether to items at the exact same location can merge into one item with a quantity
|
|
21
|
+
*/
|
|
9
22
|
constructor(type: M, items: MaterialItem<P, L>[], locationsStrategies?: Partial<Record<L, LocationStrategy<P, M, L>>>, canMerge?: boolean);
|
|
23
|
+
/**
|
|
24
|
+
* Executes a move on the game items
|
|
25
|
+
* @param move
|
|
26
|
+
*/
|
|
10
27
|
applyMove(move: ItemMoveRandomized<P, M, L> | ItemMoveView<P, M, L>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Find the index of an existing item we could merge a new item with (create a single item with a quantity)
|
|
30
|
+
*
|
|
31
|
+
* @param newItem An item to compare with existing items
|
|
32
|
+
* @returns {number} Index of the existing item we can merge with, or -1 if there is no possible merge
|
|
33
|
+
*/
|
|
11
34
|
findMergeIndex(newItem: MaterialItem<P, L>): number;
|
|
12
35
|
private addItem;
|
|
36
|
+
/**
|
|
37
|
+
* Provides the index that the new item will have
|
|
38
|
+
* @param newItem An item that is going to be created
|
|
39
|
+
* @returns {number} the future index of that item
|
|
40
|
+
*/
|
|
13
41
|
getItemCreationIndex(newItem: MaterialItem<P, L>): number;
|
|
14
42
|
private applyAddItemStrategy;
|
|
15
43
|
private applyMoveItemStrategy;
|
|
@@ -20,7 +48,18 @@ export declare class MaterialMutator<P extends number = number, M extends number
|
|
|
20
48
|
private roll;
|
|
21
49
|
private moveItem;
|
|
22
50
|
private moveItemsAtOnce;
|
|
51
|
+
/**
|
|
52
|
+
* Provides the state of an item after it is moved
|
|
53
|
+
* @param move The move that is going to happen
|
|
54
|
+
* @return {MaterialItem} state of the item after the move is executed
|
|
55
|
+
*/
|
|
23
56
|
getItemAfterMove(move: MoveItem<P, M, L>): MaterialItem<P, L>;
|
|
57
|
+
/**
|
|
58
|
+
* Provides the state of an item after it is moved
|
|
59
|
+
* @param move The move that is going to happen
|
|
60
|
+
* @param index Index of the item to consider
|
|
61
|
+
* @return {MaterialItem} state of the item after the move is executed
|
|
62
|
+
*/
|
|
24
63
|
getItemAfterMoveAtOnce(move: MoveItemsAtOnce<P, M, L>, index: number): MaterialItem<P, L>;
|
|
25
64
|
private getItemWithLocation;
|
|
26
65
|
private delete;
|
|
@@ -31,7 +31,20 @@ var merge_1 = __importDefault(require("lodash/merge"));
|
|
|
31
31
|
var location_1 = require("../location");
|
|
32
32
|
var moves_1 = require("../moves");
|
|
33
33
|
var index_1 = require("./index");
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Helper class to change the state of any {@link MaterialItem} in a game implemented with {@link MaterialRules}.
|
|
36
|
+
*
|
|
37
|
+
* @typeparam P - identifier of a player. Either a number or a numeric enum (eg: PlayerColor)
|
|
38
|
+
* @typeparam M - Numeric enum of the types of material manipulated in the game
|
|
39
|
+
* @typeparam L - Numeric enum of the types of location in the game where the material can be located
|
|
40
|
+
*/
|
|
41
|
+
var MaterialMutator = /** @class */ (function () {
|
|
42
|
+
/**
|
|
43
|
+
* @param type Type of items this mutator will work on
|
|
44
|
+
* @param items Items to work with
|
|
45
|
+
* @param locationsStrategies The strategies that these items must follow
|
|
46
|
+
* @param canMerge Whether to items at the exact same location can merge into one item with a quantity
|
|
47
|
+
*/
|
|
35
48
|
function MaterialMutator(type, items, locationsStrategies, canMerge) {
|
|
36
49
|
if (locationsStrategies === void 0) { locationsStrategies = {}; }
|
|
37
50
|
if (canMerge === void 0) { canMerge = true; }
|
|
@@ -40,6 +53,10 @@ var MaterialMutator = (function () {
|
|
|
40
53
|
this.locationsStrategies = locationsStrategies;
|
|
41
54
|
this.canMerge = canMerge;
|
|
42
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Executes a move on the game items
|
|
58
|
+
* @param move
|
|
59
|
+
*/
|
|
43
60
|
MaterialMutator.prototype.applyMove = function (move) {
|
|
44
61
|
switch (move.type) {
|
|
45
62
|
case moves_1.ItemMoveType.Create:
|
|
@@ -77,6 +94,12 @@ var MaterialMutator = (function () {
|
|
|
77
94
|
break;
|
|
78
95
|
}
|
|
79
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* Find the index of an existing item we could merge a new item with (create a single item with a quantity)
|
|
99
|
+
*
|
|
100
|
+
* @param newItem An item to compare with existing items
|
|
101
|
+
* @returns {number} Index of the existing item we can merge with, or -1 if there is no possible merge
|
|
102
|
+
*/
|
|
80
103
|
MaterialMutator.prototype.findMergeIndex = function (newItem) {
|
|
81
104
|
if (!this.canMerge)
|
|
82
105
|
return -1;
|
|
@@ -96,6 +119,11 @@ var MaterialMutator = (function () {
|
|
|
96
119
|
this.items.push(item);
|
|
97
120
|
}
|
|
98
121
|
};
|
|
122
|
+
/**
|
|
123
|
+
* Provides the index that the new item will have
|
|
124
|
+
* @param newItem An item that is going to be created
|
|
125
|
+
* @returns {number} the future index of that item
|
|
126
|
+
*/
|
|
99
127
|
MaterialMutator.prototype.getItemCreationIndex = function (newItem) {
|
|
100
128
|
var mergeIndex = this.findMergeIndex(newItem);
|
|
101
129
|
if (mergeIndex !== -1)
|
|
@@ -212,6 +240,11 @@ var MaterialMutator = (function () {
|
|
|
212
240
|
}
|
|
213
241
|
}
|
|
214
242
|
};
|
|
243
|
+
/**
|
|
244
|
+
* Provides the state of an item after it is moved
|
|
245
|
+
* @param move The move that is going to happen
|
|
246
|
+
* @return {MaterialItem} state of the item after the move is executed
|
|
247
|
+
*/
|
|
215
248
|
MaterialMutator.prototype.getItemAfterMove = function (move) {
|
|
216
249
|
var item = this.getItemWithLocation(move.location, move.itemIndex);
|
|
217
250
|
if (move.reveal) {
|
|
@@ -225,6 +258,12 @@ var MaterialMutator = (function () {
|
|
|
225
258
|
}
|
|
226
259
|
return item;
|
|
227
260
|
};
|
|
261
|
+
/**
|
|
262
|
+
* Provides the state of an item after it is moved
|
|
263
|
+
* @param move The move that is going to happen
|
|
264
|
+
* @param index Index of the item to consider
|
|
265
|
+
* @return {MaterialItem} state of the item after the move is executed
|
|
266
|
+
*/
|
|
228
267
|
MaterialMutator.prototype.getItemAfterMoveAtOnce = function (move, index) {
|
|
229
268
|
var item = this.getItemWithLocation(move.location, index);
|
|
230
269
|
if (move.reveal && move.reveal[index]) {
|
|
@@ -244,7 +283,7 @@ var MaterialMutator = (function () {
|
|
|
244
283
|
MaterialMutator.prototype.shuffle = function (move) {
|
|
245
284
|
var _this = this;
|
|
246
285
|
if (!(0, moves_1.isShuffleRandomized)(move))
|
|
247
|
-
return;
|
|
286
|
+
return; // Nothing to do on front-end side for a shuffle. The index swap is only required on the backend.
|
|
248
287
|
var shuffledItems = move.indexes.map(function (index) { return _this.items[index]; });
|
|
249
288
|
move.newIndexes.forEach(function (newIndex, i) {
|
|
250
289
|
_this.items[newIndex] = __assign(__assign({}, shuffledItems[i]), { location: _this.items[newIndex].location });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialMutator.js","sourceRoot":"","sources":["../../../src/material/items/MaterialMutator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAoC;AACpC,uDAAgC;AAChC,wCAA4E;AAC5E,kCAaiB;AACjB,iCAAgD;
|
|
1
|
+
{"version":3,"file":"MaterialMutator.js","sourceRoot":"","sources":["../../../src/material/items/MaterialMutator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAoC;AACpC,uDAAgC;AAChC,wCAA4E;AAC5E,kCAaiB;AACjB,iCAAgD;AAEhD;;;;;;GAMG;AACH;IACE;;;;;OAKG;IACH,yBACmB,IAAO,EACP,KAA2B,EAC3B,mBAAuE,EACvE,QAAwB;QADxB,oCAAA,EAAA,wBAAuE;QACvE,yBAAA,EAAA,eAAwB;QAHxB,SAAI,GAAJ,IAAI,CAAG;QACP,UAAK,GAAL,KAAK,CAAsB;QAC3B,wBAAmB,GAAnB,mBAAmB,CAAoD;QACvE,aAAQ,GAAR,QAAQ,CAAgB;IAE3C,CAAC;IAED;;;OAGG;IACH,mCAAS,GAAT,UAAU,IAAyD;QACjE,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YAClB,KAAK,oBAAY,CAAC,MAAM;gBACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;gBACjB,MAAK;YACP,KAAK,oBAAY,CAAC,YAAY;gBAC5B,KAAmB,UAAU,EAAV,KAAA,IAAI,CAAC,KAAK,EAAV,cAAU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AAC;IAEO,gCAAM,GAAd,UAAe,IAAmB;QAChC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IACpE,CAAC;IAEO,iCAAO,GAAf,UAAgB,IAAuC;QAAvD,iBAMC;QALC,IAAI,CAAC,IAAA,2BAAmB,EAAC,IAAI,CAAC;YAAE,OAAM,CAAC,iGAAiG;QACxI,IAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,KAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAjB,CAAiB,CAAC,CAAA;QACpE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAC,QAAQ,EAAE,CAAC;YAClC,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,yBAAQ,aAAa,CAAC,CAAC,CAAC,KAAE,QAAQ,EAAE,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,QAAQ,GAAE,CAAA;QACzF,CAAC,CAAC,CAAA;IACJ,CAAC;IAEO,gCAAM,GAAd,UAAe,IAAmB;;QAChC,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACvC,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC,QAAQ,CAAA;QACtB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,GAAG,MAAA,IAAI,CAAC,QAAQ,mCAAI,IAAI,CAAA;QACvC,CAAC;IACH,CAAC;IACH,sBAAC;AAAD,CAAC,AA9PD,IA8PC;AA9PY,0CAAe"}
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./MaterialDeck"), exports);
|
|
17
|
+
__exportStar(require("./MaterialDeck"), exports); // Important: must be before Material import to prevent a circular dependency crash
|
|
18
18
|
__exportStar(require("./Material"), exports);
|
|
19
19
|
__exportStar(require("./MaterialItem"), exports);
|
|
20
20
|
__exportStar(require("./MaterialMutator"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/material/items/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/material/items/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B,CAAC,mFAAmF;AAClH,6CAA0B;AAC1B,iDAA8B;AAC9B,oDAAiC"}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { XYCoordinates } from '../../utils';
|
|
2
|
+
/**
|
|
3
|
+
* A location where to place the material in a game
|
|
4
|
+
*
|
|
5
|
+
* @typeparam Player - identifier of a player. Either a number or a numeric enum (eg: PlayerColor)
|
|
6
|
+
* @typeparam LocationType - Numeric enum of the types of location in the game where the material can be located
|
|
7
|
+
* @typeparam Id - Type of id property of the location. Must be JSON serializable.
|
|
8
|
+
*
|
|
9
|
+
* @property type The type of location. Usually an enum named LocationType.
|
|
10
|
+
* @property id Optional location identifier, if the coordinates, player and parent items are not enough.
|
|
11
|
+
* @property player Optional owner player of that location.
|
|
12
|
+
* @property parent Optional index of the parent item this location belongs to.
|
|
13
|
+
* @property rotation Rotation applied to the item's location
|
|
14
|
+
* @property x Optional X-coordinate
|
|
15
|
+
* @property y Optional Y-coordinate
|
|
16
|
+
* @property z Optional Z-coordinate
|
|
17
|
+
*/
|
|
2
18
|
export type Location<Player = number, LocationType = number, Id = any, Rotation = any> = {
|
|
3
19
|
type: LocationType;
|
|
4
20
|
id?: Id;
|
|
@@ -6,7 +22,19 @@ export type Location<Player = number, LocationType = number, Id = any, Rotation
|
|
|
6
22
|
parent?: number;
|
|
7
23
|
rotation?: Rotation;
|
|
8
24
|
} & Partial<Coordinates>;
|
|
25
|
+
/**
|
|
26
|
+
* A 3-dimension coordinates system
|
|
27
|
+
*
|
|
28
|
+
* @property x X-coordinate
|
|
29
|
+
* @property y Y-coordinate
|
|
30
|
+
* @property z Z-coordinate
|
|
31
|
+
*/
|
|
9
32
|
export type Coordinates = XYCoordinates & {
|
|
10
33
|
z: number;
|
|
11
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Utility function to know whether some locations share the same type, id, player and parent.
|
|
37
|
+
* @param locations Locations to test
|
|
38
|
+
* @returns true if all the locations belongs to the same "area" (only varies in coordinates or rotation)
|
|
39
|
+
*/
|
|
12
40
|
export declare const isSameLocationArea: (...locations: Partial<Location>[]) => boolean;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isSameLocationArea = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Utility function to know whether some locations share the same type, id, player and parent.
|
|
6
|
+
* @param locations Locations to test
|
|
7
|
+
* @returns true if all the locations belongs to the same "area" (only varies in coordinates or rotation)
|
|
8
|
+
*/
|
|
4
9
|
var isSameLocationArea = function () {
|
|
5
10
|
var locations = [];
|
|
6
11
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Location.js","sourceRoot":"","sources":["../../../src/material/location/Location.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Location.js","sourceRoot":"","sources":["../../../src/material/location/Location.ts"],"names":[],"mappings":";;;AAmCA;;;;GAIG;AACI,IAAM,kBAAkB,GAAG;IAAC,mBAAiC;SAAjC,UAAiC,EAAjC,qBAAiC,EAAjC,IAAiC;QAAjC,8BAAiC;;IAAc,OAAA,SAAS,CAAC,KAAK,CAAC,UAAC,CAAC,EAAE,CAAC,EAAE,EAAI;YAAH,EAAE,QAAA;QAC1G,OAAA,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM;IAAxF,CAAwF,CACzF;AAFiF,CAEjF,CAAA;AAFY,QAAA,kBAAkB,sBAE9B"}
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.LocationBuilder = void 0;
|
|
15
|
-
var LocationBuilder = (function () {
|
|
15
|
+
var LocationBuilder = /** @class */ (function () {
|
|
16
16
|
function LocationBuilder(location) {
|
|
17
17
|
this.location = location;
|
|
18
18
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Material, MaterialItem } from '../../items';
|
|
2
2
|
import { LocationStrategy } from './LocationStrategy';
|
|
3
|
+
/**
|
|
4
|
+
* This strategy attributes the first gap in a sequence, and leaves a gap when an item is removed.
|
|
5
|
+
* Use for river-type mechanisms for instance.
|
|
6
|
+
*/
|
|
3
7
|
export declare class FillGapStrategy<P extends number = number, M extends number = number, L extends number = number> implements LocationStrategy<P, M, L> {
|
|
4
8
|
axis: 'x' | 'y' | 'z';
|
|
5
9
|
constructor(axis?: 'x' | 'y' | 'z');
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FillGapStrategy = void 0;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* This strategy attributes the first gap in a sequence, and leaves a gap when an item is removed.
|
|
6
|
+
* Use for river-type mechanisms for instance.
|
|
7
|
+
*/
|
|
8
|
+
var FillGapStrategy = /** @class */ (function () {
|
|
5
9
|
function FillGapStrategy(axis) {
|
|
6
10
|
if (axis === void 0) { axis = 'x'; }
|
|
7
11
|
this.axis = axis;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FillGapStrategy.js","sourceRoot":"","sources":["../../../../src/material/location/strategy/FillGapStrategy.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"FillGapStrategy.js","sourceRoot":"","sources":["../../../../src/material/location/strategy/FillGapStrategy.ts"],"names":[],"mappings":";;;AAGA;;;GAGG;AACH;IAGE,yBAAY,IAA2B;QAA3B,qBAAA,EAAA,UAA2B;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,iCAAO,GAAP,UAAQ,QAA2B,EAAE,IAAwB;QAA7D,iBASC;;QARC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YAC3C,IAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,QAAQ,CAAC,KAAI,CAAC,IAAI,CAAE,EAAzB,CAAyB,CAAC,CAAC,QAAQ,EAAE,CAAA;YACzE,IAAI,QAAQ,GAAG,CAAC,CAAA;YAChB,OAAO,CAAA,MAAA,KAAK,CAAC,QAAQ,CAAC,0CAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAK,QAAQ,EAAE,CAAC;gBACzD,QAAQ,EAAE,CAAA;YACZ,CAAC;YACD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAA;QACrC,CAAC;IACH,CAAC;IACH,sBAAC;AAAD,CAAC,AAjBD,IAiBC;AAjBY,0CAAe"}
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import { Material, MaterialItem } from '../../items';
|
|
2
|
+
/**
|
|
3
|
+
* A location strategy modifies the location of items when they are moved, created or deleted,
|
|
4
|
+
* based on the items that already exists in the same location area (see {@link isSameLocationArea}).
|
|
5
|
+
*/
|
|
2
6
|
export type LocationStrategy<P extends number = number, M extends number = number, L extends number = number> = {
|
|
7
|
+
/**
|
|
8
|
+
* Strategy to apply when an item is added to a location area
|
|
9
|
+
* @param material The material that exists in the same location area before the new item is added
|
|
10
|
+
* @param item The item that is going to be added
|
|
11
|
+
*/
|
|
3
12
|
addItem?(material: Material<P, M, L>, item: MaterialItem<P, L>): void;
|
|
13
|
+
/**
|
|
14
|
+
* Strategy to apply when an item is moved inside a location area (only x, y, z or rotation changes)
|
|
15
|
+
* @param material The material that exists in the same location area
|
|
16
|
+
* @param item The item that is going to move inside the location area
|
|
17
|
+
* @param index Index of the moved item in the Material
|
|
18
|
+
*/
|
|
4
19
|
moveItem?(material: Material<P, M, L>, item: MaterialItem<P, L>, index: number): void;
|
|
20
|
+
/**
|
|
21
|
+
* Strategy to apply when an item is moved inside a location area (only x, y, z or rotation changes)
|
|
22
|
+
* @param material The material that remain in the same location area after the item was removed
|
|
23
|
+
* @param item The item that was just removed from the location area, with the state it had before it was removed
|
|
24
|
+
*/
|
|
5
25
|
removeItem?(material: Material<P, M, L>, item: MaterialItem<P, L>): void;
|
|
6
26
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Material, MaterialItem } from '../../items';
|
|
2
2
|
import { LocationStrategy } from './LocationStrategy';
|
|
3
|
+
/**
|
|
4
|
+
* This strategy help to maintain a consecutive sequence of numbers starting with 0 for items at the same location,
|
|
5
|
+
* for example a deck or a hand of cards.
|
|
6
|
+
*/
|
|
3
7
|
export declare class PositiveSequenceStrategy<P extends number = number, M extends number = number, L extends number = number> implements LocationStrategy<P, M, L> {
|
|
4
8
|
axis: 'x' | 'y' | 'z';
|
|
5
9
|
constructor(axis?: 'x' | 'y' | 'z');
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PositiveSequenceStrategy = void 0;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* This strategy help to maintain a consecutive sequence of numbers starting with 0 for items at the same location,
|
|
6
|
+
* for example a deck or a hand of cards.
|
|
7
|
+
*/
|
|
8
|
+
var PositiveSequenceStrategy = /** @class */ (function () {
|
|
5
9
|
function PositiveSequenceStrategy(axis) {
|
|
6
10
|
if (axis === void 0) { axis = 'x'; }
|
|
7
11
|
this.axis = axis;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PositiveSequenceStrategy.js","sourceRoot":"","sources":["../../../../src/material/location/strategy/PositiveSequenceStrategy.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"PositiveSequenceStrategy.js","sourceRoot":"","sources":["../../../../src/material/location/strategy/PositiveSequenceStrategy.ts"],"names":[],"mappings":";;;AAGA;;;GAGG;AACH;IAGE,kCAAY,IAA2B;QAA3B,qBAAA,EAAA,UAA2B;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,0CAAO,GAAP,UAAQ,QAA2B,EAAE,IAAwB;QAC3D,IAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAA;QAC5C,CAAC;aAAM,CAAC;YACN,KAAmB,UAAmB,EAAnB,KAAA,QAAQ,CAAC,QAAQ,EAAE,EAAnB,cAAmB,EAAnB,IAAmB,EAAE,CAAC;gBAApC,IAAM,MAAI,SAAA;gBACb,IAAM,KAAK,GAAG,MAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACtC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;oBAC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AG,MAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACtC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;oBACtD,MAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAE,EAAE,CAAA;gBAC7B,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,6CAAU,GAAV,UAAW,QAA2B,EAAE,IAAwB;QAC9D,IAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,CAAC,KAAK,SAAS;YAAE,OAAM;QAC3B,KAAmB,UAAmB,EAAnB,KAAA,QAAQ,CAAC,QAAQ,EAAE,EAAnB,cAAmB,EAAnB,IAAmB,EAAE,CAAC;YAApC,IAAM,MAAI,SAAA;YACb,IAAM,KAAK,GAAG,MAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACtC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;gBACrC,MAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAE,EAAE,CAAA;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;IACH,+BAAC;AAAD,CAAC,AAvDD,IAuDC;AAvDY,4DAAwB"}
|
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
import { MaterialGame } from '../MaterialGame';
|
|
2
|
+
/**
|
|
3
|
+
* Utility class to manipulate the memory in a {@link MaterialGame}.
|
|
4
|
+
*/
|
|
2
5
|
export declare class GameMemory<Player extends number = number> {
|
|
3
6
|
private game;
|
|
7
|
+
/**
|
|
8
|
+
* @constructor
|
|
9
|
+
* @param {MaterialGame} game Current state of the game
|
|
10
|
+
*/
|
|
4
11
|
constructor(game: MaterialGame<Player>);
|
|
12
|
+
/**
|
|
13
|
+
* Save a new value inside the memory
|
|
14
|
+
* @param key The key to index the memorized value
|
|
15
|
+
* @param value Any JSON serializable value to store, or a function that takes previous stored value and returns the new value to store
|
|
16
|
+
*/
|
|
5
17
|
memorize<T = any>(key: keyof any, value: T | ((lastValue: T) => T)): void;
|
|
18
|
+
/**
|
|
19
|
+
* Get a value stored in the memory
|
|
20
|
+
* @param key The key to index the memorized value
|
|
21
|
+
* @returns the value stored (or undefined is nothing was stored under this key yet)
|
|
22
|
+
*/
|
|
6
23
|
remind<T = any>(key: keyof any): T;
|
|
24
|
+
/**
|
|
25
|
+
* Delete a value from the memory
|
|
26
|
+
* @param key Key of the value to delete
|
|
27
|
+
*/
|
|
7
28
|
forget(key: keyof any): void;
|
|
8
29
|
}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GameMemory = void 0;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Utility class to manipulate the memory in a {@link MaterialGame}.
|
|
6
|
+
*/
|
|
7
|
+
var GameMemory = /** @class */ (function () {
|
|
8
|
+
/**
|
|
9
|
+
* @constructor
|
|
10
|
+
* @param {MaterialGame} game Current state of the game
|
|
11
|
+
*/
|
|
5
12
|
function GameMemory(game) {
|
|
6
13
|
this.game = game;
|
|
7
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Save a new value inside the memory
|
|
17
|
+
* @param key The key to index the memorized value
|
|
18
|
+
* @param value Any JSON serializable value to store, or a function that takes previous stored value and returns the new value to store
|
|
19
|
+
*/
|
|
8
20
|
GameMemory.prototype.memorize = function (key, value) {
|
|
9
21
|
if (typeof value === 'function') {
|
|
10
22
|
this.game.memory[key] = value(this.game.memory[key]);
|
|
@@ -16,9 +28,18 @@ var GameMemory = (function () {
|
|
|
16
28
|
this.game.memory[key] = JSON.parse(JSON.stringify(this.game.memory[key]));
|
|
17
29
|
}
|
|
18
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Get a value stored in the memory
|
|
33
|
+
* @param key The key to index the memorized value
|
|
34
|
+
* @returns the value stored (or undefined is nothing was stored under this key yet)
|
|
35
|
+
*/
|
|
19
36
|
GameMemory.prototype.remind = function (key) {
|
|
20
37
|
return this.game.memory[key];
|
|
21
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Delete a value from the memory
|
|
41
|
+
* @param key Key of the value to delete
|
|
42
|
+
*/
|
|
22
43
|
GameMemory.prototype.forget = function (key) {
|
|
23
44
|
delete this.game.memory[key];
|
|
24
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GameMemory.js","sourceRoot":"","sources":["../../../src/material/memory/GameMemory.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"GameMemory.js","sourceRoot":"","sources":["../../../src/material/memory/GameMemory.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH;IACE;;;OAGG;IACH,oBAAoB,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;IAC9C,CAAC;IAED;;;;OAIG;IACH,6BAAQ,GAAR,UAAkB,GAAc,EAAE,KAAgC;QAChE,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;YAChC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAI,KAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;QAC/E,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QAC/B,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC9C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QAC3E,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,2BAAM,GAAN,UAAgB,GAAc;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC9B,CAAC;IAED;;;OAGG;IACH,2BAAM,GAAN,UAAO,GAAc;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC9B,CAAC;IACH,iBAAC;AAAD,CAAC,AAxCD,IAwCC;AAxCY,gCAAU"}
|
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
import { MaterialGame } from '../MaterialGame';
|
|
2
|
+
/**
|
|
3
|
+
* Utility class to manipulate a player's memory in a {@link MaterialGame}.
|
|
4
|
+
*/
|
|
2
5
|
export declare class PlayerMemory<Player extends number = number> {
|
|
3
6
|
private game;
|
|
4
7
|
private player;
|
|
8
|
+
/**
|
|
9
|
+
* @constructor
|
|
10
|
+
* @param {MaterialGame} game Current state of the game
|
|
11
|
+
* @param player The player to work with
|
|
12
|
+
*/
|
|
5
13
|
constructor(game: MaterialGame<Player>, player: Player);
|
|
14
|
+
/**
|
|
15
|
+
* Save a new value inside the memory
|
|
16
|
+
* @param key The key to index the memorized value
|
|
17
|
+
* @param value Any JSON serializable value to store, or a function that takes previous stored value and returns the new value to store
|
|
18
|
+
*/
|
|
6
19
|
memorize<T = any>(key: keyof any, value: T | ((lastValue: T) => T)): void;
|
|
20
|
+
/**
|
|
21
|
+
* Get a value stored in the memory
|
|
22
|
+
* @param key The key to index the memorized value
|
|
23
|
+
* @returns the value stored (or undefined is nothing was stored under this key yet)
|
|
24
|
+
*/
|
|
7
25
|
remind<T = any>(key: keyof any): T;
|
|
26
|
+
/**
|
|
27
|
+
* Delete a value from the memory
|
|
28
|
+
* @param key Key of the value to delete
|
|
29
|
+
*/
|
|
8
30
|
forget(key: keyof any): void;
|
|
9
31
|
}
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PlayerMemory = void 0;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Utility class to manipulate a player's memory in a {@link MaterialGame}.
|
|
6
|
+
*/
|
|
7
|
+
var PlayerMemory = /** @class */ (function () {
|
|
8
|
+
/**
|
|
9
|
+
* @constructor
|
|
10
|
+
* @param {MaterialGame} game Current state of the game
|
|
11
|
+
* @param player The player to work with
|
|
12
|
+
*/
|
|
5
13
|
function PlayerMemory(game, player) {
|
|
6
14
|
this.game = game;
|
|
7
15
|
this.player = player;
|
|
8
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Save a new value inside the memory
|
|
19
|
+
* @param key The key to index the memorized value
|
|
20
|
+
* @param value Any JSON serializable value to store, or a function that takes previous stored value and returns the new value to store
|
|
21
|
+
*/
|
|
9
22
|
PlayerMemory.prototype.memorize = function (key, value) {
|
|
10
23
|
if (!this.game.memory[key])
|
|
11
24
|
this.game.memory[key] = {};
|
|
@@ -19,10 +32,19 @@ var PlayerMemory = (function () {
|
|
|
19
32
|
this.game.memory[key][this.player] = JSON.parse(JSON.stringify(this.game.memory[key][this.player]));
|
|
20
33
|
}
|
|
21
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Get a value stored in the memory
|
|
37
|
+
* @param key The key to index the memorized value
|
|
38
|
+
* @returns the value stored (or undefined is nothing was stored under this key yet)
|
|
39
|
+
*/
|
|
22
40
|
PlayerMemory.prototype.remind = function (key) {
|
|
23
41
|
var _a;
|
|
24
42
|
return (_a = this.game.memory[key]) === null || _a === void 0 ? void 0 : _a[this.player];
|
|
25
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* Delete a value from the memory
|
|
46
|
+
* @param key Key of the value to delete
|
|
47
|
+
*/
|
|
26
48
|
PlayerMemory.prototype.forget = function (key) {
|
|
27
49
|
var _a;
|
|
28
50
|
(_a = this.game.memory[key]) === null || _a === void 0 ? true : delete _a[this.player];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlayerMemory.js","sourceRoot":"","sources":["../../../src/material/memory/PlayerMemory.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"PlayerMemory.js","sourceRoot":"","sources":["../../../src/material/memory/PlayerMemory.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH;IACE;;;;OAIG;IACH,sBAAoB,IAA0B,EAAU,MAAc;QAAlD,SAAI,GAAJ,IAAI,CAAsB;QAAU,WAAM,GAAN,MAAM,CAAQ;IACtE,CAAC;IAED;;;;OAIG;IACH,+BAAQ,GAAR,UAAkB,GAAc,EAAE,KAAgC;QAChE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;QACtD,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;YAChC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAI,KAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;QACzG,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAA;QAC5C,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC3D,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QACrG,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,6BAAM,GAAN,UAAgB,GAAc;;QAC5B,OAAO,MAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,0CAAG,IAAI,CAAC,MAAM,CAAC,CAAA;IAC7C,CAAC;IAED;;;OAGG;IACH,6BAAM,GAAN,UAAO,GAAc;;QACZ,MAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,+CAAG,IAAI,CAAC,MAAM,CAAC,CAAA;IAC7C,CAAC;IACH,mBAAC;AAAD,CAAC,AA1CD,IA0CC;AA1CY,oCAAY"}
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import { MoveKind } from './MoveKind';
|
|
2
2
|
import { MaterialMove } from './MaterialMove';
|
|
3
|
+
/**
|
|
4
|
+
* A custom move is a special kind of move that can be used when the other kind of move cannot be used to implement the game easily.
|
|
5
|
+
* Often used for actions like saying "I pass" or conceptual actions specific to a game.
|
|
6
|
+
* A custom move does nothing by default. You have to implement "onCustomMove" in {@link MaterialRulesPart} to memorize things of create consequences.
|
|
7
|
+
*/
|
|
3
8
|
export type CustomMove<Type extends number = number> = {
|
|
4
9
|
kind: typeof MoveKind.CustomMove;
|
|
5
10
|
type: Type;
|
|
6
11
|
data?: any;
|
|
7
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Type guard for {@link CustomMove}
|
|
15
|
+
* @param {MaterialMove} move The move to test
|
|
16
|
+
* @returns true if the move is a {@link CustomMove}
|
|
17
|
+
*/
|
|
8
18
|
export declare const isCustomMove: <T extends number = number, P extends number = number, M extends number = number, L extends number = number>(move: MaterialMove<P, M, L>) => move is CustomMove<T>;
|
|
19
|
+
/**
|
|
20
|
+
* Function that returns a type guard for a {@link CustomMove} of a specific type
|
|
21
|
+
* @param type The type of custom move to test
|
|
22
|
+
* @returns A type guard function
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* `if (isCustomMoveType(CustomMoveType.Pass)(move)) ...`
|
|
26
|
+
*/
|
|
9
27
|
export declare function isCustomMoveType<T extends number = number, P extends number = number, M extends number = number, L extends number = number>(type: T): (move: MaterialMove<P, M, L>) => move is CustomMove<T>;
|
|
@@ -2,8 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isCustomMoveType = exports.isCustomMove = void 0;
|
|
4
4
|
var MoveKind_1 = require("./MoveKind");
|
|
5
|
+
/**
|
|
6
|
+
* Type guard for {@link CustomMove}
|
|
7
|
+
* @param {MaterialMove} move The move to test
|
|
8
|
+
* @returns true if the move is a {@link CustomMove}
|
|
9
|
+
*/
|
|
5
10
|
var isCustomMove = function (move) { return move.kind === MoveKind_1.MoveKind.CustomMove; };
|
|
6
11
|
exports.isCustomMove = isCustomMove;
|
|
12
|
+
/**
|
|
13
|
+
* Function that returns a type guard for a {@link CustomMove} of a specific type
|
|
14
|
+
* @param type The type of custom move to test
|
|
15
|
+
* @returns A type guard function
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* `if (isCustomMoveType(CustomMoveType.Pass)(move)) ...`
|
|
19
|
+
*/
|
|
7
20
|
function isCustomMoveType(type) {
|
|
8
21
|
return function (move) { return (0, exports.isCustomMove)(move) && move.type === type; };
|
|
9
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomMove.js","sourceRoot":"","sources":["../../../src/material/moves/CustomMove.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;
|
|
1
|
+
{"version":3,"file":"CustomMove.js","sourceRoot":"","sources":["../../../src/material/moves/CustomMove.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;AAcrC;;;;GAIG;AACI,IAAM,YAAY,GAAG,UAC1B,IAA2B,IACD,OAAA,IAAI,CAAC,IAAI,KAAK,mBAAQ,CAAC,UAAU,EAAjC,CAAiC,CAAA;AAFhD,QAAA,YAAY,gBAEoC;AAE7D;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAC9B,IAAO;IAEP,OAAO,UAAC,IAA2B,IAA4B,OAAA,IAAA,oBAAY,EAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAxC,CAAwC,CAAA;AACzG,CAAC;AAJD,4CAIC"}
|
|
@@ -2,6 +2,15 @@ import { RuleMove } from './rules';
|
|
|
2
2
|
import { CustomMove } from './CustomMove';
|
|
3
3
|
import { ItemMove, ItemMoveRandomized, ItemMoveView } from './items';
|
|
4
4
|
import { LocalMove } from './local';
|
|
5
|
+
/**
|
|
6
|
+
* Common type of all the kind of moves that can exists in a game implemented with {@link MaterialRules}
|
|
7
|
+
*/
|
|
5
8
|
export type MaterialMove<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> = ItemMove<Player, MaterialType, LocationType> | RuleMove<Player> | CustomMove | LocalMove<Player, MaterialType, LocationType>;
|
|
9
|
+
/**
|
|
10
|
+
* A {@link MaterialMove} but after it is randomized (see {@link RandomMove})
|
|
11
|
+
*/
|
|
6
12
|
export type MaterialMoveRandomized<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> = ItemMoveRandomized<Player, MaterialType, LocationType> | RuleMove<Player> | CustomMove | LocalMove<Player, MaterialType, LocationType>;
|
|
13
|
+
/**
|
|
14
|
+
* A {@link MaterialMove} but after it is transformed to be sent to players (see {@link HiddenMaterialRules}).
|
|
15
|
+
*/
|
|
7
16
|
export type MaterialMoveView<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> = ItemMoveView<Player, MaterialType, LocationType> | RuleMove<Player> | CustomMove | LocalMove<Player, MaterialType, LocationType>;
|