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