@gamepark/rules-api 6.24.2 → 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 +48 -0
- package/dist/material/HiddenMaterialRules.js +47 -1
- 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 +117 -1
- 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/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 +41 -4
- package/dist/utils/money.util.js +38 -1
- package/dist/utils/money.util.js.map +1 -1
- 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
|
@@ -3,52 +3,305 @@ import { CreateItem, CreateItemsAtOnce, DeleteItem, DeleteItemsAtOnce, ItemMove,
|
|
|
3
3
|
import { MaterialDeck } from './MaterialDeck';
|
|
4
4
|
import { MaterialItem } from './MaterialItem';
|
|
5
5
|
type ItemEntry<P extends number = number, L extends number = number> = [number, MaterialItem<P, L>];
|
|
6
|
+
/**
|
|
7
|
+
* The Material class is the core helper class that help manipulate the game items in a simple way.
|
|
8
|
+
* It includes two kind of functions: functions to filter items, and functions to build {@link ItemMove} objects.
|
|
9
|
+
* Filter function will all return a new instance of Material with only the filtered items. This class is designed to be immutable.
|
|
10
|
+
*
|
|
11
|
+
* @typeparam P - identifier of a player. Either a number or a numeric enum (eg: PlayerColor)
|
|
12
|
+
* @typeparam M - Numeric enum of the types of material manipulated in the game
|
|
13
|
+
* @typeparam L - Numeric enum of the types of location in the game where the material can be located
|
|
14
|
+
*/
|
|
6
15
|
export declare class Material<P extends number = number, M extends number = number, L extends number = number> {
|
|
7
16
|
readonly type: M;
|
|
8
17
|
readonly entries: ItemEntry<P, L>[];
|
|
9
18
|
protected readonly processMove?: ((move: ItemMove<P, M, L>) => void) | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Construct a new Material helper instance
|
|
21
|
+
* @param {number} type Type of items this instance will work on
|
|
22
|
+
* @param {ItemEntry[]} entries The list of items to work on. Each entry consists of an array with the index of the item, and the item
|
|
23
|
+
* @param {function} processMove if provided, this function will be executed on every move created with this instance
|
|
24
|
+
*/
|
|
10
25
|
constructor(type: M, entries: ItemEntry<P, L>[], processMove?: ((move: ItemMove<P, M, L>) => void) | undefined);
|
|
26
|
+
/**
|
|
27
|
+
* Helper function to return a new instance of the same class (works also for children class)
|
|
28
|
+
* @param {ItemEntry[]} entries Filtered entries for the new class
|
|
29
|
+
* @returns {this} the new Material instance
|
|
30
|
+
* @protected
|
|
31
|
+
*/
|
|
11
32
|
protected new(entries: ItemEntry<P, L>[]): this;
|
|
33
|
+
/**
|
|
34
|
+
* Use this function to collect all the items in the current Material instance.
|
|
35
|
+
* For example, you can filter then collect the matching items: this.material(type).location(locationType).getItems()
|
|
36
|
+
*
|
|
37
|
+
* @typeparam Id - Identifier of the items (item.id)
|
|
38
|
+
* @param {function} predicate If provided, only the items matching the predicate will be returned
|
|
39
|
+
* @returns {MaterialItem[]} the items in this Material instance
|
|
40
|
+
*/
|
|
12
41
|
getItems<Id = any>(predicate?: (item: MaterialItem<P, L, Id>) => boolean): MaterialItem<P, L, Id>[];
|
|
42
|
+
/**
|
|
43
|
+
* @overload
|
|
44
|
+
* Get the item at a specific index.
|
|
45
|
+
* @throws Error if there is no item at this index
|
|
46
|
+
*
|
|
47
|
+
* @param {number} index Index of the item
|
|
48
|
+
* @returns {MaterialItem} the item
|
|
49
|
+
*/
|
|
13
50
|
getItem<Id = any>(index: number): MaterialItem<P, L, Id>;
|
|
51
|
+
/**
|
|
52
|
+
* @overload
|
|
53
|
+
* @param predicate If provided, returns the first item matching the predicate
|
|
54
|
+
* @returns {MaterialItem | undefined} the item, or undefined if none match
|
|
55
|
+
*/
|
|
14
56
|
getItem<Id = any>(predicate?: (item: MaterialItem<P, L, Id>) => boolean): MaterialItem<P, L, Id> | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* @returns {number} index of the first item
|
|
59
|
+
*/
|
|
15
60
|
getIndex(): number;
|
|
61
|
+
/**
|
|
62
|
+
* @returns {number[]} indexes of the items
|
|
63
|
+
*/
|
|
16
64
|
getIndexes(): number[];
|
|
65
|
+
/**
|
|
66
|
+
* Filter and return a new instance with only the items that match a specific index, or a specific index predicate
|
|
67
|
+
* @param {number | function} arg The index to keep, or the predicate matching the indexes to keep
|
|
68
|
+
*/
|
|
17
69
|
index(arg?: number | number[] | ((index: number) => boolean)): this;
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated Use {@link index} instead
|
|
72
|
+
*/
|
|
18
73
|
indexes(indexes: number[]): this;
|
|
74
|
+
/**
|
|
75
|
+
* @returns {number} number of items
|
|
76
|
+
*/
|
|
19
77
|
get length(): number;
|
|
78
|
+
/**
|
|
79
|
+
* @returns {number} Sum of the quantity of all items
|
|
80
|
+
*/
|
|
20
81
|
getQuantity(): number;
|
|
82
|
+
/**
|
|
83
|
+
* This function filter the items and returns a new instance with only the filtered items.
|
|
84
|
+
* This function is the top level filtering function, but other function can be used to simplify the code:
|
|
85
|
+
* {@link player}, {@link location}, {@link rotation}, {@link id}, {@link locationId}...
|
|
86
|
+
*
|
|
87
|
+
* @param {function} predicate The predicate function. Takes every item and index, and keep the item if it returns true
|
|
88
|
+
* @returns {this} New instance with only the items that match the predicate
|
|
89
|
+
*/
|
|
21
90
|
filter(predicate: (item: MaterialItem<P, L>, index: number) => boolean): this;
|
|
91
|
+
/**
|
|
92
|
+
* Filters the items based on their ids.
|
|
93
|
+
*
|
|
94
|
+
* @param {function | string | number | Record} arg Id to keep, or predicate function to match the ids of the items to keep
|
|
95
|
+
* @returns {this} New instance with only the items which ids match the argument
|
|
96
|
+
*/
|
|
22
97
|
id<Id extends string | number | Record<string, any> | undefined>(arg?: Id | ((id: Id) => boolean)): this;
|
|
98
|
+
/**
|
|
99
|
+
* Filters the items based on their location type, or their location.
|
|
100
|
+
*
|
|
101
|
+
* @param {function | number} arg Location type to keep, or predicate function to match the location of the items to keep
|
|
102
|
+
* @returns {this} New instance with only the items which locations match the argument
|
|
103
|
+
*/
|
|
23
104
|
location(arg: L | ((location: Location<P, L>) => boolean)): this;
|
|
105
|
+
/**
|
|
106
|
+
* Filters the items based on their rotation (item.location.rotation)
|
|
107
|
+
*
|
|
108
|
+
* @param {function | string | number | boolean | Record} arg rotation to keep, or predicate function to match the rotations of the items to keep
|
|
109
|
+
* @returns {this} New instance with only the items which rotation match the argument
|
|
110
|
+
*/
|
|
24
111
|
rotation<R extends string | number | boolean | Record<string, any> | undefined>(arg?: R | ((rotation: R) => boolean)): this;
|
|
112
|
+
/**
|
|
113
|
+
* Filters the items based on their owner (item.location.player)
|
|
114
|
+
*
|
|
115
|
+
* @param {function | number} arg player id to keep, or predicate function to match the owner player of the items to keep
|
|
116
|
+
* @returns {this} New instance with only the items which owner match the argument
|
|
117
|
+
*/
|
|
25
118
|
player(arg?: P | ((player?: P) => boolean)): this;
|
|
119
|
+
/**
|
|
120
|
+
* Filters the items based on their location's id (item.location.id)
|
|
121
|
+
*
|
|
122
|
+
* @param {function | number} arg location id to keep, or predicate function to match the location id of the items to keep
|
|
123
|
+
* @returns {this} New instance with only the items which location id match the argument
|
|
124
|
+
*/
|
|
26
125
|
locationId<Id extends string | number | boolean | Record<string, any> | undefined>(arg: Id | ((id: Id) => boolean)): this;
|
|
126
|
+
/**
|
|
127
|
+
* Filters the items based on their location's parent (item.location.parent).
|
|
128
|
+
*
|
|
129
|
+
* @param {function | number} arg location parent to keep, or predicate function to match the location parent of the items to keep
|
|
130
|
+
* @returns {this} New instance with only the items which location parent match the argument
|
|
131
|
+
*/
|
|
27
132
|
parent(arg?: number | ((parent?: number) => boolean)): this;
|
|
133
|
+
/**
|
|
134
|
+
* Filters the items that are selected (item.selected).
|
|
135
|
+
*
|
|
136
|
+
* @param {number | boolean} selected The selected value to compare (default is true)
|
|
137
|
+
* @returns {this} New instance with only the items which are selected
|
|
138
|
+
*/
|
|
28
139
|
selected(selected?: number | boolean): this;
|
|
140
|
+
/**
|
|
141
|
+
* Keep only the item that has the minimum value returned by the selector argument.
|
|
142
|
+
* See {@link minBy} from Lodash
|
|
143
|
+
*
|
|
144
|
+
* @param {function} selector The function that evaluate the item's value
|
|
145
|
+
* @returns {this} New instance with only the item which has the minimum value
|
|
146
|
+
*/
|
|
29
147
|
minBy(selector: (item: MaterialItem<P, L>) => number): this;
|
|
148
|
+
/**
|
|
149
|
+
* Keep only the item that has the maximum value returned by the selector argument.
|
|
150
|
+
* See {@link maxBy} from Lodash
|
|
151
|
+
*
|
|
152
|
+
* @param {function} selector The function that evaluate the item's value
|
|
153
|
+
* @returns {this} New instance with only the item which has the maximum value
|
|
154
|
+
*/
|
|
30
155
|
maxBy(selector: (item: MaterialItem<P, L>) => number): this;
|
|
156
|
+
/**
|
|
157
|
+
* Return a new material instance which items are ordered based on provided selector functions.
|
|
158
|
+
* See {@link orderBy} from Lodash
|
|
159
|
+
*
|
|
160
|
+
* @param {...function} selectors The function or functions that evaluate each item's value
|
|
161
|
+
* @returns {this} New instance with items ordered by the selector functions
|
|
162
|
+
*/
|
|
31
163
|
sort(...selectors: ((item: MaterialItem<P, L>) => number)[]): this;
|
|
164
|
+
/**
|
|
165
|
+
* Return a new material instance with only the first N items.
|
|
166
|
+
* You have to use {@link sort} first as the items are ordered initially by index, which is not relevant.
|
|
167
|
+
* Example: material.sort(item => !item.location.x!).limit(10)
|
|
168
|
+
*
|
|
169
|
+
* @param count Number of items to keep
|
|
170
|
+
* @returns {this} New instance with only the first "count" items
|
|
171
|
+
*/
|
|
32
172
|
limit(count: number): this;
|
|
33
173
|
private process;
|
|
174
|
+
/**
|
|
175
|
+
* Prepare a move that will create a new item
|
|
176
|
+
* @param {MaterialItem} item The item to create
|
|
177
|
+
* @returns {CreateItem} the move that creates an item when executed
|
|
178
|
+
*/
|
|
34
179
|
createItem(item: MaterialItem<P, L>): CreateItem<P, M, L>;
|
|
180
|
+
/**
|
|
181
|
+
* Prepare a list of moves to create new items
|
|
182
|
+
* @param {MaterialItem[]} items The items to create
|
|
183
|
+
* @returns {CreateItem[]} the moves that creates the new items when executed
|
|
184
|
+
*/
|
|
35
185
|
createItems(items: MaterialItem<P, L>[]): CreateItem<P, M, L>[];
|
|
186
|
+
/**
|
|
187
|
+
* Prepare one move to create new items
|
|
188
|
+
* @param {MaterialItem[]} items The items to create
|
|
189
|
+
* @returns {CreateItemsAtOnce} the move that creates the new items when executed
|
|
190
|
+
*/
|
|
36
191
|
createItemsAtOnce(items: MaterialItem<P, L>[]): CreateItemsAtOnce<P, M, L>;
|
|
192
|
+
/**
|
|
193
|
+
* Prepare a move that will delete current first item in this material instance
|
|
194
|
+
*
|
|
195
|
+
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to remove. If undefined, the item is completely removed
|
|
196
|
+
* @returns {DeleteItem} the move that delete the item, or a part of its quantity, when executed
|
|
197
|
+
*/
|
|
37
198
|
deleteItem(quantity?: number): DeleteItem<M>;
|
|
199
|
+
/**
|
|
200
|
+
* Prepare moves that will delete all the items in this material instance
|
|
201
|
+
*
|
|
202
|
+
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to remove. If undefined, the items are completely removed
|
|
203
|
+
* @returns {DeleteItem[]} the moves that delete the items, or a part of their quantity, when executed
|
|
204
|
+
*/
|
|
38
205
|
deleteItems(quantity?: number): DeleteItem<M>[];
|
|
206
|
+
/**
|
|
207
|
+
* Prepare one move that will delete all the items in this material instance
|
|
208
|
+
*
|
|
209
|
+
* @returns {DeleteItemsAtOnce} the move that delete the items when executed
|
|
210
|
+
*/
|
|
39
211
|
deleteItemsAtOnce(): DeleteItemsAtOnce<M>;
|
|
212
|
+
/**
|
|
213
|
+
* Prepare a move that will change the location of the current first item in this material instance
|
|
214
|
+
*
|
|
215
|
+
* @param {Location | function} location The new location of the item. It can be a function to process the location based on the item current state.
|
|
216
|
+
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to move. If undefined, the item is completely moved.
|
|
217
|
+
* @returns {MoveItem} the move that will change the location of the item (or a part of its quantity) when executed
|
|
218
|
+
*/
|
|
40
219
|
moveItem(location: ((item: MaterialItem<P, L>) => Location<P, L>) | Location<P, L>, quantity?: number): MoveItem<P, M, L>;
|
|
220
|
+
/**
|
|
221
|
+
* Prepare moves that will change the location of all the items in this material instance
|
|
222
|
+
*
|
|
223
|
+
* @param {Location | function} location The new location of the items. It can be a function to process the location based on each item current state.
|
|
224
|
+
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to move. If undefined, the items are completely moved.
|
|
225
|
+
* @returns {MoveItem[]} the moves that will change the location of the items (or a part of their quantity) when executed
|
|
226
|
+
*/
|
|
41
227
|
moveItems(location: ((item: MaterialItem<P, L>, index: number) => Partial<Location<P, L>>) | Partial<Location<P, L>>, quantity?: number): MoveItem<P, M, L>[];
|
|
228
|
+
/**
|
|
229
|
+
* Prepare one move that will change the location of all the items in this material instance
|
|
230
|
+
*
|
|
231
|
+
* @param {Location | function} location The new location of the items. It can be a function to process the location based on each item current state.
|
|
232
|
+
* @returns {MoveItemsAtOnce} the move that will change the location of the items when executed
|
|
233
|
+
*/
|
|
42
234
|
moveItemsAtOnce(location: Partial<Location<P, L>>): MoveItemsAtOnce<P, M, L>;
|
|
235
|
+
/**
|
|
236
|
+
* Prepare a move that will select current first item in this material instance
|
|
237
|
+
*
|
|
238
|
+
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to select. If undefined, the item is completely selected.
|
|
239
|
+
* @returns {SelectItem} the move that will select the item (or a part of its quantity) when executed
|
|
240
|
+
*/
|
|
43
241
|
selectItem(quantity?: number): SelectItem<M>;
|
|
242
|
+
/**
|
|
243
|
+
* Prepare a move that will select all the items in this material instance
|
|
244
|
+
*
|
|
245
|
+
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to select. If undefined, the items are completely selected.
|
|
246
|
+
* @returns {SelectItem[]} the moves that will select the items (or a part of their quantity) when executed
|
|
247
|
+
*/
|
|
44
248
|
selectItems(quantity?: number): SelectItem<M>[];
|
|
249
|
+
/**
|
|
250
|
+
* Prepare a move that will unselect current first item in this material instance
|
|
251
|
+
*
|
|
252
|
+
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to unselect. If undefined, the item is completely unselected.
|
|
253
|
+
* @returns {SelectItem} the move that will unselect the item (or a part of its quantity) when executed
|
|
254
|
+
*/
|
|
45
255
|
unselectItem(quantity?: number): SelectItem<M>;
|
|
256
|
+
/**
|
|
257
|
+
* Prepare a move that will unselect all the items in this material instance
|
|
258
|
+
*
|
|
259
|
+
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to unselect. If undefined, the items are completely unselected.
|
|
260
|
+
* @returns {SelectItem[]} the moves that will unselect the items (or a part of their quantity) when executed
|
|
261
|
+
*/
|
|
46
262
|
unselectItems(quantity?: number): SelectItem<M>[];
|
|
263
|
+
/**
|
|
264
|
+
* Prepare a move that will rotate current first item in this material instance.
|
|
265
|
+
* This function creates a {@link MoveItem} but copies the existing location values, only replacing the rotation property.
|
|
266
|
+
*
|
|
267
|
+
* @param {string | number | boolean | Record | function | undefined} arg Value of the rotation to give to the item.
|
|
268
|
+
* In case of a function, process the value based on the item state.
|
|
269
|
+
* @returns {MoveItem} the move that will rotate the item when executed
|
|
270
|
+
*/
|
|
47
271
|
rotateItem<R extends string | number | boolean | Record<string, any> | undefined>(arg?: R | ((item: MaterialItem<P, L>) => R)): MoveItem<P, M, L>;
|
|
272
|
+
/**
|
|
273
|
+
* Prepare a move that will rotate all the items in this material instance.
|
|
274
|
+
* This function creates an array of {@link MoveItem} but copies the existing locations values, only replacing the rotation property.
|
|
275
|
+
*
|
|
276
|
+
* @param {string | number | boolean | Record | function | undefined} arg Value of the rotation to give to the item.
|
|
277
|
+
* In case of a function, process the value based on the item state.
|
|
278
|
+
* @returns {MoveItem[]} the moves that will rotate the item when executed
|
|
279
|
+
*/
|
|
48
280
|
rotateItems<R extends string | number | boolean | Record<string, any> | undefined>(arg?: R | ((item: MaterialItem<P, L>) => R | undefined)): MoveItem<P, M, L>[];
|
|
281
|
+
/**
|
|
282
|
+
* Prepare a move that will shuffle all the items in the current material instance
|
|
283
|
+
* @returns {Shuffle} the move that shuffle the items when executed
|
|
284
|
+
*/
|
|
49
285
|
shuffle(): Shuffle<M>;
|
|
286
|
+
/**
|
|
287
|
+
* Prepare a move that will roll the current first item in this material instance. See {@link RollItem}.
|
|
288
|
+
*
|
|
289
|
+
* @param {Location | function} location The new location of the item. It can be a function to process the location based on the item current state.
|
|
290
|
+
* @returns {RollItem} the move that rolls the item when executed
|
|
291
|
+
*/
|
|
50
292
|
rollItem(location?: ((item: MaterialItem<P, L>) => Location<P, L>) | Location<P, L>): RollItem<P, M, L>;
|
|
293
|
+
/**
|
|
294
|
+
* Prepare a move that will roll all the items in this material instance. See {@link RollItem}.
|
|
295
|
+
*
|
|
296
|
+
* @param {Location | function} location The new location of the items. It can be a function to process the location based on each item current state.
|
|
297
|
+
* @returns {RollItem[]} the moves that rolls the items when executed
|
|
298
|
+
*/
|
|
51
299
|
rollItems(location?: ((item: MaterialItem<P, L>) => Location<P, L>) | Location<P, L>): RollItem<P, M, L>[];
|
|
300
|
+
/**
|
|
301
|
+
* Return a new {@link MaterialDeck} helper class, to deal cards easily.
|
|
302
|
+
*
|
|
303
|
+
* @param selector The sort to apply on the deck. See {@link sort}. Defaults to -item.location.x
|
|
304
|
+
*/
|
|
52
305
|
deck(selector?: (item: MaterialItem<P, L>) => number): MaterialDeck<P, M, L>;
|
|
53
306
|
}
|
|
54
307
|
export {};
|