@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.
Files changed (167) 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 +17 -0
  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 +49 -3
  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 +67 -1
  40. package/dist/material/MaterialGameSetup.js.map +1 -1
  41. package/dist/material/MaterialRules.d.ts +125 -0
  42. package/dist/material/MaterialRules.js +122 -3
  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 +253 -0
  48. package/dist/material/items/Material.js +248 -1
  49. package/dist/material/items/Material.js.map +1 -1
  50. package/dist/material/items/MaterialDeck.d.ts +33 -0
  51. package/dist/material/items/MaterialDeck.js +34 -1
  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/MaterialMutator.d.ts +39 -0
  55. package/dist/material/items/MaterialMutator.js +41 -2
  56. package/dist/material/items/MaterialMutator.js.map +1 -1
  57. package/dist/material/items/index.js +1 -1
  58. package/dist/material/items/index.js.map +1 -1
  59. package/dist/material/location/Location.d.ts +28 -0
  60. package/dist/material/location/Location.js +5 -0
  61. package/dist/material/location/Location.js.map +1 -1
  62. package/dist/material/location/LocationBuilder.js +1 -1
  63. package/dist/material/location/strategy/FillGapStrategy.d.ts +4 -0
  64. package/dist/material/location/strategy/FillGapStrategy.js +5 -1
  65. package/dist/material/location/strategy/FillGapStrategy.js.map +1 -1
  66. package/dist/material/location/strategy/LocationStrategy.d.ts +20 -0
  67. package/dist/material/location/strategy/PositiveSequenceStrategy.d.ts +4 -0
  68. package/dist/material/location/strategy/PositiveSequenceStrategy.js +5 -1
  69. package/dist/material/location/strategy/PositiveSequenceStrategy.js.map +1 -1
  70. package/dist/material/memory/GameMemory.d.ts +21 -0
  71. package/dist/material/memory/GameMemory.js +22 -1
  72. package/dist/material/memory/GameMemory.js.map +1 -1
  73. package/dist/material/memory/PlayerMemory.d.ts +22 -0
  74. package/dist/material/memory/PlayerMemory.js +23 -1
  75. package/dist/material/memory/PlayerMemory.js.map +1 -1
  76. package/dist/material/moves/CustomMove.d.ts +18 -0
  77. package/dist/material/moves/CustomMove.js +13 -0
  78. package/dist/material/moves/CustomMove.js.map +1 -1
  79. package/dist/material/moves/MaterialMove.d.ts +9 -0
  80. package/dist/material/moves/MaterialMoveBuilder.d.ts +36 -0
  81. package/dist/material/moves/MaterialMoveBuilder.js +36 -0
  82. package/dist/material/moves/MaterialMoveBuilder.js.map +1 -1
  83. package/dist/material/moves/MoveKind.d.ts +3 -0
  84. package/dist/material/moves/MoveKind.js +3 -0
  85. package/dist/material/moves/MoveKind.js.map +1 -1
  86. package/dist/material/moves/items/CreateItem.d.ts +13 -0
  87. package/dist/material/moves/items/CreateItem.js +10 -0
  88. package/dist/material/moves/items/CreateItem.js.map +1 -1
  89. package/dist/material/moves/items/CreateItemsAtOnce.d.ts +14 -0
  90. package/dist/material/moves/items/CreateItemsAtOnce.js +10 -0
  91. package/dist/material/moves/items/CreateItemsAtOnce.js.map +1 -1
  92. package/dist/material/moves/items/DeleteItem.d.ts +18 -0
  93. package/dist/material/moves/items/DeleteItem.js +11 -0
  94. package/dist/material/moves/items/DeleteItem.js.map +1 -1
  95. package/dist/material/moves/items/DeleteItemsAtOnce.d.ts +17 -0
  96. package/dist/material/moves/items/DeleteItemsAtOnce.js +10 -0
  97. package/dist/material/moves/items/DeleteItemsAtOnce.js.map +1 -1
  98. package/dist/material/moves/items/ItemMove.d.ts +12 -0
  99. package/dist/material/moves/items/ItemMoveType.d.ts +3 -0
  100. package/dist/material/moves/items/ItemMoveType.js +3 -0
  101. package/dist/material/moves/items/ItemMoveType.js.map +1 -1
  102. package/dist/material/moves/items/MoveItem.d.ts +20 -0
  103. package/dist/material/moves/items/MoveItem.js +11 -0
  104. package/dist/material/moves/items/MoveItem.js.map +1 -1
  105. package/dist/material/moves/items/MoveItemsAtOnce.d.ts +20 -0
  106. package/dist/material/moves/items/MoveItemsAtOnce.js +10 -0
  107. package/dist/material/moves/items/MoveItemsAtOnce.js.map +1 -1
  108. package/dist/material/moves/items/RollItem.d.ts +19 -0
  109. package/dist/material/moves/items/RollItem.js +10 -0
  110. package/dist/material/moves/items/RollItem.js.map +1 -1
  111. package/dist/material/moves/items/SelectItem.d.ts +20 -0
  112. package/dist/material/moves/items/SelectItem.js +11 -0
  113. package/dist/material/moves/items/SelectItem.js.map +1 -1
  114. package/dist/material/moves/items/Shuffle.d.ts +26 -0
  115. package/dist/material/moves/items/Shuffle.js +15 -0
  116. package/dist/material/moves/items/Shuffle.js.map +1 -1
  117. package/dist/material/moves/local/CloseTutorialPopup.d.ts +8 -0
  118. package/dist/material/moves/local/CloseTutorialPopup.js +5 -0
  119. package/dist/material/moves/local/CloseTutorialPopup.js.map +1 -1
  120. package/dist/material/moves/local/DisplayHelp.d.ts +18 -0
  121. package/dist/material/moves/local/DisplayHelp.js +3 -0
  122. package/dist/material/moves/local/DisplayHelp.js.map +1 -1
  123. package/dist/material/moves/local/DropItem.d.ts +9 -0
  124. package/dist/material/moves/local/LocalMove.d.ts +6 -0
  125. package/dist/material/moves/local/LocalMove.js +3 -0
  126. package/dist/material/moves/local/LocalMove.js.map +1 -1
  127. package/dist/material/moves/local/SetTutorialStep.d.ts +8 -0
  128. package/dist/material/moves/local/SetTutorialStep.js +5 -0
  129. package/dist/material/moves/local/SetTutorialStep.js.map +1 -1
  130. package/dist/material/rules/MaterialRulesPart.d.ts +76 -0
  131. package/dist/material/rules/MaterialRulesPart.js +74 -1
  132. package/dist/material/rules/MaterialRulesPart.js.map +1 -1
  133. package/dist/material/rules/PlayerTurnRule.d.ts +19 -0
  134. package/dist/material/rules/PlayerTurnRule.js +20 -1
  135. package/dist/material/rules/PlayerTurnRule.js.map +1 -1
  136. package/dist/material/rules/RuleStep.d.ts +3 -0
  137. package/dist/material/rules/SimultaneousRule.d.ts +25 -0
  138. package/dist/material/rules/SimultaneousRule.js +21 -1
  139. package/dist/material/rules/SimultaneousRule.js.map +1 -1
  140. package/dist/material/tutorial/TutorialState.d.ts +7 -0
  141. package/dist/options/OptionsValidationError.js +1 -1
  142. package/dist/options/PlayerEnumOption.js +3 -0
  143. package/dist/options/PlayerEnumOption.js.map +1 -1
  144. package/dist/utils/action-view.util.js +2 -0
  145. package/dist/utils/action-view.util.js.map +1 -1
  146. package/dist/utils/enum.util.d.ts +27 -0
  147. package/dist/utils/enum.util.js +24 -0
  148. package/dist/utils/enum.util.js.map +1 -1
  149. package/dist/utils/grid.squares.util.d.ts +26 -0
  150. package/dist/utils/grid.squares.util.js +26 -0
  151. package/dist/utils/grid.squares.util.js.map +1 -1
  152. package/dist/utils/grid.util.d.ts +8 -0
  153. package/dist/utils/grid.util.js +5 -0
  154. package/dist/utils/grid.util.js.map +1 -1
  155. package/dist/utils/index.d.ts +1 -0
  156. package/dist/utils/index.js +1 -0
  157. package/dist/utils/index.js.map +1 -1
  158. package/dist/utils/listing.util.d.ts +12 -0
  159. package/dist/utils/listing.util.js +12 -0
  160. package/dist/utils/listing.util.js.map +1 -1
  161. package/dist/utils/money.util.d.ts +48 -0
  162. package/dist/utils/money.util.js +174 -0
  163. package/dist/utils/money.util.js.map +1 -0
  164. package/dist/utils/random.util.d.ts +11 -0
  165. package/dist/utils/random.util.js +11 -0
  166. package/dist/utils/random.util.js.map +1 -1
  167. package/package.json +1 -1
@@ -33,20 +33,56 @@ var orderBy_1 = __importDefault(require("lodash/orderBy"));
33
33
  var sumBy_1 = __importDefault(require("lodash/sumBy"));
34
34
  var moves_1 = require("../moves");
35
35
  var MaterialDeck_1 = require("./MaterialDeck");
36
- var Material = (function () {
36
+ /**
37
+ * The Material class is the core helper class that help manipulate the game items in a simple way.
38
+ * It includes two kind of functions: functions to filter items, and functions to build {@link ItemMove} objects.
39
+ * Filter function will all return a new instance of Material with only the filtered items. This class is designed to be immutable.
40
+ *
41
+ * @typeparam P - identifier of a player. Either a number or a numeric enum (eg: PlayerColor)
42
+ * @typeparam M - Numeric enum of the types of material manipulated in the game
43
+ * @typeparam L - Numeric enum of the types of location in the game where the material can be located
44
+ */
45
+ var Material = /** @class */ (function () {
46
+ /**
47
+ * Construct a new Material helper instance
48
+ * @param {number} type Type of items this instance will work on
49
+ * @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
50
+ * @param {function} processMove if provided, this function will be executed on every move created with this instance
51
+ */
37
52
  function Material(type, entries, processMove) {
38
53
  this.type = type;
39
54
  this.entries = entries;
40
55
  this.processMove = processMove;
41
56
  }
57
+ /**
58
+ * Helper function to return a new instance of the same class (works also for children class)
59
+ * @param {ItemEntry[]} entries Filtered entries for the new class
60
+ * @returns {this} the new Material instance
61
+ * @protected
62
+ */
42
63
  Material.prototype.new = function (entries) {
43
64
  var Class = this.constructor;
44
65
  return new Class(this.type, entries, this.processMove);
45
66
  };
67
+ /**
68
+ * Use this function to collect all the items in the current Material instance.
69
+ * For example, you can filter then collect the matching items: this.material(type).location(locationType).getItems()
70
+ *
71
+ * @typeparam Id - Identifier of the items (item.id)
72
+ * @param {function} predicate If provided, only the items matching the predicate will be returned
73
+ * @returns {MaterialItem[]} the items in this Material instance
74
+ */
46
75
  Material.prototype.getItems = function (predicate) {
47
76
  var items = this.entries.map(function (entry) { return entry[1]; });
48
77
  return predicate ? items.filter(predicate) : items;
49
78
  };
79
+ /**
80
+ * Use this function to collect this first item in the current Material instance.
81
+ * You can use {@link sort} to sort the items first.
82
+ *
83
+ * @param {number | function} arg Index of the item, or predicate function
84
+ * @returns {MaterialItem | undefined} the item, or undefined if none match
85
+ */
50
86
  Material.prototype.getItem = function (arg) {
51
87
  if (typeof arg === 'number') {
52
88
  var entry = this.entries.find(function (entry) { return entry[0] === arg; });
@@ -65,13 +101,23 @@ var Material = (function () {
65
101
  return this.entries.length ? this.entries[0][1] : undefined;
66
102
  }
67
103
  };
104
+ /**
105
+ * @returns {number} index of the first item
106
+ */
68
107
  Material.prototype.getIndex = function () {
69
108
  var _a, _b;
70
109
  return (_b = (_a = this.entries[0]) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : -1;
71
110
  };
111
+ /**
112
+ * @returns {number[]} indexes of the items
113
+ */
72
114
  Material.prototype.getIndexes = function () {
73
115
  return this.entries.map(function (entry) { return entry[0]; });
74
116
  };
117
+ /**
118
+ * Filter and return a new instance with only the items that match a specific index, or a specific index predicate
119
+ * @param {number | function} arg The index to keep, or the predicate matching the indexes to keep
120
+ */
75
121
  Material.prototype.index = function (arg) {
76
122
  switch (typeof arg) {
77
123
  case 'function':
@@ -92,6 +138,9 @@ var Material = (function () {
92
138
  return this.new(items);
93
139
  }
94
140
  };
141
+ /**
142
+ * @deprecated Use {@link index} instead
143
+ */
95
144
  Material.prototype.indexes = function (indexes) {
96
145
  var items = this.entries.filter(function (_a) {
97
146
  var i = _a[0];
@@ -100,12 +149,18 @@ var Material = (function () {
100
149
  return this.new(items);
101
150
  };
102
151
  Object.defineProperty(Material.prototype, "length", {
152
+ /**
153
+ * @returns {number} number of items
154
+ */
103
155
  get: function () {
104
156
  return this.entries.length;
105
157
  },
106
158
  enumerable: false,
107
159
  configurable: true
108
160
  });
161
+ /**
162
+ * @returns {number} Sum of the quantity of all items
163
+ */
109
164
  Material.prototype.getQuantity = function () {
110
165
  return (0, sumBy_1.default)(this.entries, function (_a) {
111
166
  var _b;
@@ -113,60 +168,131 @@ var Material = (function () {
113
168
  return (_b = item.quantity) !== null && _b !== void 0 ? _b : 1;
114
169
  });
115
170
  };
171
+ /**
172
+ * This function filter the items and returns a new instance with only the filtered items.
173
+ * This function is the top level filtering function, but other function can be used to simplify the code:
174
+ * {@link player}, {@link location}, {@link rotation}, {@link id}, {@link locationId}...
175
+ *
176
+ * @param {function} predicate The predicate function. Takes every item and index, and keep the item if it returns true
177
+ * @returns {this} New instance with only the items that match the predicate
178
+ */
116
179
  Material.prototype.filter = function (predicate) {
117
180
  return this.new(this.entries.filter(function (_a) {
118
181
  var index = _a[0], item = _a[1];
119
182
  return predicate(item, index);
120
183
  }));
121
184
  };
185
+ /**
186
+ * Filters the items based on their ids.
187
+ *
188
+ * @param {function | string | number | Record} arg Id to keep, or predicate function to match the ids of the items to keep
189
+ * @returns {this} New instance with only the items which ids match the argument
190
+ */
122
191
  Material.prototype.id = function (arg) {
123
192
  return this.filter(function (_a) {
124
193
  var id = _a.id;
125
194
  return typeof arg === 'function' ? arg(id) : (0, isEqual_1.default)(id, arg);
126
195
  });
127
196
  };
197
+ /**
198
+ * Filters the items based on their location type, or their location.
199
+ *
200
+ * @param {function | number} arg Location type to keep, or predicate function to match the location of the items to keep
201
+ * @returns {this} New instance with only the items which locations match the argument
202
+ */
128
203
  Material.prototype.location = function (arg) {
129
204
  return this.filter(function (_a) {
130
205
  var location = _a.location;
131
206
  return typeof arg === 'function' ? arg(location) : location.type === arg;
132
207
  });
133
208
  };
209
+ /**
210
+ * Filters the items based on their rotation (item.location.rotation)
211
+ *
212
+ * @param {function | string | number | boolean | Record} arg rotation to keep, or predicate function to match the rotations of the items to keep
213
+ * @returns {this} New instance with only the items which rotation match the argument
214
+ */
134
215
  Material.prototype.rotation = function (arg) {
135
216
  return this.location(function (_a) {
136
217
  var rotation = _a.rotation;
137
218
  return typeof arg === 'function' ? arg(rotation) : (0, isEqual_1.default)(rotation, arg);
138
219
  });
139
220
  };
221
+ /**
222
+ * Filters the items based on their owner (item.location.player)
223
+ *
224
+ * @param {function | number} arg player id to keep, or predicate function to match the owner player of the items to keep
225
+ * @returns {this} New instance with only the items which owner match the argument
226
+ */
140
227
  Material.prototype.player = function (arg) {
141
228
  return this.location(function (_a) {
142
229
  var player = _a.player;
143
230
  return typeof arg === 'function' ? arg(player) : player === arg;
144
231
  });
145
232
  };
233
+ /**
234
+ * Filters the items based on their location's id (item.location.id)
235
+ *
236
+ * @param {function | number} arg location id to keep, or predicate function to match the location id of the items to keep
237
+ * @returns {this} New instance with only the items which location id match the argument
238
+ */
146
239
  Material.prototype.locationId = function (arg) {
147
240
  return this.location(function (_a) {
148
241
  var id = _a.id;
149
242
  return typeof arg === 'function' ? arg(id) : (0, isEqual_1.default)(id, arg);
150
243
  });
151
244
  };
245
+ /**
246
+ * Filters the items based on their location's parent (item.location.parent).
247
+ *
248
+ * @param {function | number} arg location parent to keep, or predicate function to match the location parent of the items to keep
249
+ * @returns {this} New instance with only the items which location parent match the argument
250
+ */
152
251
  Material.prototype.parent = function (arg) {
153
252
  return this.location(function (_a) {
154
253
  var parent = _a.parent;
155
254
  return typeof arg === 'function' ? arg(parent) : (0, isEqual_1.default)(parent, arg);
156
255
  });
157
256
  };
257
+ /**
258
+ * Filters the items that are selected (item.selected).
259
+ *
260
+ * @param {number | boolean} selected The selected value to compare (default is true)
261
+ * @returns {this} New instance with only the items which are selected
262
+ */
158
263
  Material.prototype.selected = function (selected) {
159
264
  if (selected === void 0) { selected = true; }
160
265
  return this.filter(function (item) { var _a; return ((_a = item.selected) !== null && _a !== void 0 ? _a : false) === selected; });
161
266
  };
267
+ /**
268
+ * Keep only the item that has the minimum value returned by the selector argument.
269
+ * See {@link minBy} from Lodash
270
+ *
271
+ * @param {function} selector The function that evaluate the item's value
272
+ * @returns {this} New instance with only the item which has the minimum value
273
+ */
162
274
  Material.prototype.minBy = function (selector) {
163
275
  var min = (0, minBy_1.default)(this.entries, function (entry) { return selector(entry[1]); });
164
276
  return this.new(min ? [min] : []);
165
277
  };
278
+ /**
279
+ * Keep only the item that has the maximum value returned by the selector argument.
280
+ * See {@link maxBy} from Lodash
281
+ *
282
+ * @param {function} selector The function that evaluate the item's value
283
+ * @returns {this} New instance with only the item which has the maximum value
284
+ */
166
285
  Material.prototype.maxBy = function (selector) {
167
286
  var max = (0, maxBy_1.default)(this.entries, function (entry) { return selector(entry[1]); });
168
287
  return this.new(max ? [max] : []);
169
288
  };
289
+ /**
290
+ * Return a new material instance which items are ordered based on provided selector functions.
291
+ * See {@link orderBy} from Lodash
292
+ *
293
+ * @param {...function} selectors The function or functions that evaluate each item's value
294
+ * @returns {this} New instance with items ordered by the selector functions
295
+ */
170
296
  Material.prototype.sort = function () {
171
297
  var selectors = [];
172
298
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -175,6 +301,14 @@ var Material = (function () {
175
301
  var orderedItems = (0, orderBy_1.default)(this.entries, selectors.map(function (s) { return function (entry) { return s(entry[1]); }; }));
176
302
  return this.new(orderedItems);
177
303
  };
304
+ /**
305
+ * Return a new material instance with only the first N items.
306
+ * You have to use {@link sort} first as the items are ordered initially by index, which is not relevant.
307
+ * Example: material.sort(item => !item.location.x!).limit(10)
308
+ *
309
+ * @param count Number of items to keep
310
+ * @returns {this} New instance with only the first "count" items
311
+ */
178
312
  Material.prototype.limit = function (count) {
179
313
  return this.new(this.entries.slice(0, count));
180
314
  };
@@ -187,9 +321,19 @@ var Material = (function () {
187
321
  }
188
322
  return moves;
189
323
  };
324
+ /**
325
+ * Prepare a move that will create a new item
326
+ * @param {MaterialItem} item The item to create
327
+ * @returns {CreateItem} the move that creates an item when executed
328
+ */
190
329
  Material.prototype.createItem = function (item) {
191
330
  return this.createItems([item])[0];
192
331
  };
332
+ /**
333
+ * Prepare a list of moves to create new items
334
+ * @param {MaterialItem[]} items The items to create
335
+ * @returns {CreateItem[]} the moves that creates the new items when executed
336
+ */
193
337
  Material.prototype.createItems = function (items) {
194
338
  var _this = this;
195
339
  return this.process(items.map(function (item) { return ({
@@ -199,10 +343,21 @@ var Material = (function () {
199
343
  item: item
200
344
  }); }));
201
345
  };
346
+ /**
347
+ * Prepare one move to create new items
348
+ * @param {MaterialItem[]} items The items to create
349
+ * @returns {CreateItemsAtOnce} the move that creates the new items when executed
350
+ */
202
351
  Material.prototype.createItemsAtOnce = function (items) {
203
352
  var move = { kind: moves_1.MoveKind.ItemMove, type: moves_1.ItemMoveType.CreateAtOnce, itemType: this.type, items: items };
204
353
  return this.process([move])[0];
205
354
  };
355
+ /**
356
+ * Prepare a move that will delete current first item in this material instance
357
+ *
358
+ * @param {number | undefined} quantity Optional: for items with a quantity, the number of items to remove. If undefined, the item is completely removed
359
+ * @returns {DeleteItem} the move that delete the item, or a part of its quantity, when executed
360
+ */
206
361
  Material.prototype.deleteItem = function (quantity) {
207
362
  switch (this.length) {
208
363
  case 0:
@@ -213,6 +368,12 @@ var Material = (function () {
213
368
  return this.limit(1).deleteItems(quantity)[0];
214
369
  }
215
370
  };
371
+ /**
372
+ * Prepare moves that will delete all the items in this material instance
373
+ *
374
+ * @param {number | undefined} quantity Optional: for items with a quantity, the number of items to remove. If undefined, the items are completely removed
375
+ * @returns {DeleteItem[]} the moves that delete the items, or a part of their quantity, when executed
376
+ */
216
377
  Material.prototype.deleteItems = function (quantity) {
217
378
  var _this = this;
218
379
  return this.process(this.entries.map(function (entry) {
@@ -227,10 +388,22 @@ var Material = (function () {
227
388
  return move;
228
389
  }));
229
390
  };
391
+ /**
392
+ * Prepare one move that will delete all the items in this material instance
393
+ *
394
+ * @returns {DeleteItemsAtOnce} the move that delete the items when executed
395
+ */
230
396
  Material.prototype.deleteItemsAtOnce = function () {
231
397
  var moves = { kind: moves_1.MoveKind.ItemMove, type: moves_1.ItemMoveType.DeleteAtOnce, itemType: this.type, indexes: this.getIndexes() };
232
398
  return this.process([moves])[0];
233
399
  };
400
+ /**
401
+ * Prepare a move that will change the location of the current first item in this material instance
402
+ *
403
+ * @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.
404
+ * @param {number | undefined} quantity Optional: for items with a quantity, the number of items to move. If undefined, the item is completely moved.
405
+ * @returns {MoveItem} the move that will change the location of the item (or a part of its quantity) when executed
406
+ */
234
407
  Material.prototype.moveItem = function (location, quantity) {
235
408
  switch (this.length) {
236
409
  case 0:
@@ -241,6 +414,13 @@ var Material = (function () {
241
414
  return this.limit(1).moveItems(location, quantity)[0];
242
415
  }
243
416
  };
417
+ /**
418
+ * Prepare moves that will change the location of all the items in this material instance
419
+ *
420
+ * @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.
421
+ * @param {number | undefined} quantity Optional: for items with a quantity, the number of items to move. If undefined, the items are completely moved.
422
+ * @returns {MoveItem[]} the moves that will change the location of the items (or a part of their quantity) when executed
423
+ */
244
424
  Material.prototype.moveItems = function (location, quantity) {
245
425
  var _this = this;
246
426
  var getLocation = typeof location === 'function' ? location : function () { return location; };
@@ -258,6 +438,12 @@ var Material = (function () {
258
438
  return move;
259
439
  }));
260
440
  };
441
+ /**
442
+ * Prepare one move that will change the location of all the items in this material instance
443
+ *
444
+ * @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.
445
+ * @returns {MoveItemsAtOnce} the move that will change the location of the items when executed
446
+ */
261
447
  Material.prototype.moveItemsAtOnce = function (location) {
262
448
  var move = {
263
449
  kind: moves_1.MoveKind.ItemMove,
@@ -271,6 +457,12 @@ var Material = (function () {
271
457
  };
272
458
  return this.process([move])[0];
273
459
  };
460
+ /**
461
+ * Prepare a move that will select current first item in this material instance
462
+ *
463
+ * @param {number | undefined} quantity Optional: for items with a quantity, the number of items to select. If undefined, the item is completely selected.
464
+ * @returns {SelectItem} the move that will select the item (or a part of its quantity) when executed
465
+ */
274
466
  Material.prototype.selectItem = function (quantity) {
275
467
  switch (this.length) {
276
468
  case 0:
@@ -281,6 +473,12 @@ var Material = (function () {
281
473
  return this.limit(1).selectItems(quantity)[0];
282
474
  }
283
475
  };
476
+ /**
477
+ * Prepare a move that will select all the items in this material instance
478
+ *
479
+ * @param {number | undefined} quantity Optional: for items with a quantity, the number of items to select. If undefined, the items are completely selected.
480
+ * @returns {SelectItem[]} the moves that will select the items (or a part of their quantity) when executed
481
+ */
284
482
  Material.prototype.selectItems = function (quantity) {
285
483
  var _this = this;
286
484
  return this.process(this.entries.map(function (entry) {
@@ -295,6 +493,12 @@ var Material = (function () {
295
493
  return move;
296
494
  }));
297
495
  };
496
+ /**
497
+ * Prepare a move that will unselect current first item in this material instance
498
+ *
499
+ * @param {number | undefined} quantity Optional: for items with a quantity, the number of items to unselect. If undefined, the item is completely unselected.
500
+ * @returns {SelectItem} the move that will unselect the item (or a part of its quantity) when executed
501
+ */
298
502
  Material.prototype.unselectItem = function (quantity) {
299
503
  switch (this.length) {
300
504
  case 0:
@@ -305,6 +509,12 @@ var Material = (function () {
305
509
  return this.limit(1).unselectItems(quantity)[0];
306
510
  }
307
511
  };
512
+ /**
513
+ * Prepare a move that will unselect all the items in this material instance
514
+ *
515
+ * @param {number | undefined} quantity Optional: for items with a quantity, the number of items to unselect. If undefined, the items are completely unselected.
516
+ * @returns {SelectItem[]} the moves that will unselect the items (or a part of their quantity) when executed
517
+ */
308
518
  Material.prototype.unselectItems = function (quantity) {
309
519
  var _this = this;
310
520
  return this.process(this.entries.map(function (entry) {
@@ -320,6 +530,14 @@ var Material = (function () {
320
530
  return move;
321
531
  }));
322
532
  };
533
+ /**
534
+ * Prepare a move that will rotate current first item in this material instance.
535
+ * This function creates a {@link MoveItem} but copies the existing location values, only replacing the rotation property.
536
+ *
537
+ * @param {string | number | boolean | Record | function | undefined} arg Value of the rotation to give to the item.
538
+ * In case of a function, process the value based on the item state.
539
+ * @returns {MoveItem} the move that will rotate the item when executed
540
+ */
323
541
  Material.prototype.rotateItem = function (arg) {
324
542
  switch (this.length) {
325
543
  case 0:
@@ -330,6 +548,14 @@ var Material = (function () {
330
548
  return this.limit(1).rotateItems(arg)[0];
331
549
  }
332
550
  };
551
+ /**
552
+ * Prepare a move that will rotate all the items in this material instance.
553
+ * This function creates an array of {@link MoveItem} but copies the existing locations values, only replacing the rotation property.
554
+ *
555
+ * @param {string | number | boolean | Record | function | undefined} arg Value of the rotation to give to the item.
556
+ * In case of a function, process the value based on the item state.
557
+ * @returns {MoveItem[]} the moves that will rotate the item when executed
558
+ */
333
559
  Material.prototype.rotateItems = function (arg) {
334
560
  return this.moveItems(function (item) {
335
561
  var rotation = typeof arg === 'function' ? arg(item) : arg;
@@ -337,6 +563,10 @@ var Material = (function () {
337
563
  return rotation !== undefined ? (__assign(__assign({}, location), { rotation: rotation })) : location;
338
564
  });
339
565
  };
566
+ /**
567
+ * Prepare a move that will shuffle all the items in the current material instance
568
+ * @returns {Shuffle} the move that shuffle the items when executed
569
+ */
340
570
  Material.prototype.shuffle = function () {
341
571
  return this.process([{
342
572
  kind: moves_1.MoveKind.ItemMove,
@@ -345,6 +575,12 @@ var Material = (function () {
345
575
  indexes: this.entries.map(function (entry) { return entry[0]; })
346
576
  }])[0];
347
577
  };
578
+ /**
579
+ * Prepare a move that will roll the current first item in this material instance. See {@link RollItem}.
580
+ *
581
+ * @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.
582
+ * @returns {RollItem} the move that rolls the item when executed
583
+ */
348
584
  Material.prototype.rollItem = function (location) {
349
585
  switch (this.length) {
350
586
  case 0:
@@ -355,6 +591,12 @@ var Material = (function () {
355
591
  return this.limit(1).rollItems(location)[0];
356
592
  }
357
593
  };
594
+ /**
595
+ * Prepare a move that will roll all the items in this material instance. See {@link RollItem}.
596
+ *
597
+ * @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.
598
+ * @returns {RollItem[]} the moves that rolls the items when executed
599
+ */
358
600
  Material.prototype.rollItems = function (location) {
359
601
  var _this = this;
360
602
  if (location === void 0) { location = function (item) { return item.location; }; }
@@ -370,6 +612,11 @@ var Material = (function () {
370
612
  });
371
613
  }));
372
614
  };
615
+ /**
616
+ * Return a new {@link MaterialDeck} helper class, to deal cards easily.
617
+ *
618
+ * @param selector The sort to apply on the deck. See {@link sort}. Defaults to -item.location.x
619
+ */
373
620
  Material.prototype.deck = function (selector) {
374
621
  if (selector === void 0) { selector = function (item) { return -item.location.x; }; }
375
622
  return new MaterialDeck_1.MaterialDeck(this.type, this.entries, this.processMove).sort(selector);
@@ -1 +1 @@
1
- {"version":3,"file":"Material.js","sourceRoot":"","sources":["../../../src/material/items/Material.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAoC;AACpC,uDAAgC;AAChC,uDAAgC;AAChC,2DAAoC;AACpC,uDAAgC;AAEhC,kCAaiB;AACjB,+CAA6C;AAc7C;IAQE,kBACW,IAAO,EACP,OAA0B,EAChB,WAA+C;Q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CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACnF,CAAC;IACH,eAAC;AAAD,CAAC,AAjkBD,IAikBC;AAjkBY,4BAAQ"}
@@ -2,8 +2,41 @@ import { Location } from '../location';
2
2
  import { MoveItem } from '../moves';
3
3
  import { Material } from './Material';
4
4
  import { MaterialItem } from './MaterialItem';
5
+ /**
6
+ * This subclass of {@link Material} is design to solve one major issue: when creating moves, the material items remains unchanged (Material is immutable),
7
+ * so you cannot easily deal cards to multiple players at once: you will deal the first X cards all the time if you try to move items multiple time one
8
+ * the same Material instance.
9
+ *
10
+ * MaterialDeck is designed to mutate every time the {@link deal}, {@link dealOne} or {@link dealAtOnce} function are executed, allowing to deal cards
11
+ * successively to the players, without having to remove the previously dealt card all the time.
12
+ *
13
+ * @example
14
+ * In this example, we deal the first 5 cards to the player 1, then the next 5 cards to player 2.
15
+ * Using "move" instead of "deal" would give the 5 same cards to both players,
16
+ * so player 1 would get the cards for a very short time, then player 2 would receive them.
17
+ * ```
18
+ * const deck = this.material(MaterialType.Card).deck()
19
+ * return [
20
+ * deck.deal({type: LocationType.PlayerHand, player: player1}, 5)
21
+ * deck.deal({type: LocationType.PlayerHand, player: player2}, 5)
22
+ * ]
23
+ * ```
24
+ */
5
25
  export declare class MaterialDeck<P extends number = number, M extends number = number, L extends number = number> extends Material<P, M, L> {
26
+ /**
27
+ * Prepare moves that will change the location of the first X items AND mutate this MaterialDeck instance to remove the items that will move.
28
+ *
29
+ * @param {Location | function} arg The new location of the item. It can be a function to process the location based on the item current state.
30
+ * @param quantity The number of items to move
31
+ * @returns {MoveItem[]} the move that will change the location of the item (or a part of its quantity) when executed
32
+ */
6
33
  deal(arg: ((item: MaterialItem<P, L>) => Location<P, L>) | Location<P, L>, quantity?: number): MoveItem<P, M, L>[];
34
+ /**
35
+ * Prepare a move that will change the location of the first item AND mutate this MaterialDeck instance to remove this items
36
+ *
37
+ * @param {Location | function} arg The new location of the item. It can be a function to process the location based on the item current state.
38
+ * @returns {MoveItem} the move that will change the location of the item (or a part of its quantity) when executed
39
+ */
7
40
  dealOne(arg: ((item: MaterialItem<P, L>) => Location<P, L>) | Location<P, L>): MoveItem<P, M, L>;
8
41
  dealAtOnce(arg: Location<P, L>, quantity?: number): import("../moves").MoveItemsAtOnce<P, M, L>;
9
42
  }
@@ -17,15 +17,48 @@ var __extends = (this && this.__extends) || (function () {
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.MaterialDeck = void 0;
19
19
  var Material_1 = require("./Material");
20
- var MaterialDeck = (function (_super) {
20
+ /**
21
+ * This subclass of {@link Material} is design to solve one major issue: when creating moves, the material items remains unchanged (Material is immutable),
22
+ * so you cannot easily deal cards to multiple players at once: you will deal the first X cards all the time if you try to move items multiple time one
23
+ * the same Material instance.
24
+ *
25
+ * MaterialDeck is designed to mutate every time the {@link deal}, {@link dealOne} or {@link dealAtOnce} function are executed, allowing to deal cards
26
+ * successively to the players, without having to remove the previously dealt card all the time.
27
+ *
28
+ * @example
29
+ * In this example, we deal the first 5 cards to the player 1, then the next 5 cards to player 2.
30
+ * Using "move" instead of "deal" would give the 5 same cards to both players,
31
+ * so player 1 would get the cards for a very short time, then player 2 would receive them.
32
+ * ```
33
+ * const deck = this.material(MaterialType.Card).deck()
34
+ * return [
35
+ * deck.deal({type: LocationType.PlayerHand, player: player1}, 5)
36
+ * deck.deal({type: LocationType.PlayerHand, player: player2}, 5)
37
+ * ]
38
+ * ```
39
+ */
40
+ var MaterialDeck = /** @class */ (function (_super) {
21
41
  __extends(MaterialDeck, _super);
22
42
  function MaterialDeck() {
23
43
  return _super !== null && _super.apply(this, arguments) || this;
24
44
  }
45
+ /**
46
+ * Prepare moves that will change the location of the first X items AND mutate this MaterialDeck instance to remove the items that will move.
47
+ *
48
+ * @param {Location | function} arg The new location of the item. It can be a function to process the location based on the item current state.
49
+ * @param quantity The number of items to move
50
+ * @returns {MoveItem[]} the move that will change the location of the item (or a part of its quantity) when executed
51
+ */
25
52
  MaterialDeck.prototype.deal = function (arg, quantity) {
26
53
  if (quantity === void 0) { quantity = 1; }
27
54
  return this.new(this.entries.splice(0, quantity)).moveItems(arg);
28
55
  };
56
+ /**
57
+ * Prepare a move that will change the location of the first item AND mutate this MaterialDeck instance to remove this items
58
+ *
59
+ * @param {Location | function} arg The new location of the item. It can be a function to process the location based on the item current state.
60
+ * @returns {MoveItem} the move that will change the location of the item (or a part of its quantity) when executed
61
+ */
29
62
  MaterialDeck.prototype.dealOne = function (arg) {
30
63
  var deal = this.deal(arg);
31
64
  if (deal.length === 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialDeck.js","sourceRoot":"","sources":["../../../src/material/items/MaterialDeck.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,uCAAqC;AAuBrC;IAAmH,gCAAiB;IAApI;;IA6BA,CAAC;IArBC,2BAAI,GAAJ,UAAK,GAAoE,EAAE,QAAoB;QAApB,yBAAA,EAAA,YAAoB;QAC7F,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IAClE,CAAC;IAQD,8BAAO,GAAP,UAAQ,GAAoE;QAC1E,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC3B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;QACvE,CAAC;QACD,OAAO,IAAI,CAAC,CAAC,CAAC,CAAA;IAChB,CAAC;IAED,iCAAU,GAAV,UAAW,GAAmB,EAAE,QAAoB;QAApB,yBAAA,EAAA,YAAoB;QAClD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,CAAA;IACxE,CAAC;IACH,mBAAC;AAAD,CAAC,AA7BD,CAAmH,mBAAQ,GA6B1H;AA7BY,oCAAY"}
1
+ {"version":3,"file":"MaterialDeck.js","sourceRoot":"","sources":["../../../src/material/items/MaterialDeck.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,uCAAqC;AAGrC;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAAmH,gCAAiB;IAApI;;IA6BA,CAAC;IA5BC;;;;;;OAMG;IACH,2BAAI,GAAJ,UAAK,GAAoE,EAAE,QAAoB;QAApB,yBAAA,EAAA,YAAoB;QAC7F,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IAClE,CAAC;IAED;;;;;OAKG;IACH,8BAAO,GAAP,UAAQ,GAAoE;QAC1E,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC3B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;QACvE,CAAC;QACD,OAAO,IAAI,CAAC,CAAC,CAAC,CAAA;IAChB,CAAC;IAED,iCAAU,GAAV,UAAW,GAAmB,EAAE,QAAoB;QAApB,yBAAA,EAAA,YAAoB;QAClD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,CAAA;IACxE,CAAC;IACH,mBAAC;AAAD,CAAC,AA7BD,CAAmH,mBAAQ,GA6B1H;AA7BY,oCAAY"}
@@ -1,4 +1,16 @@
1
1
  import { Location } from '../location';
2
+ /**
3
+ * A material item is a piece of material in a game
4
+ *
5
+ * @typeparam P - identifier of a player. Either a number or a numeric enum (eg: PlayerColor)
6
+ * @typeparam L - 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 item. Must be JSON serializable.
8
+ *
9
+ * @property id Optional item identifier. Meant to identify the item, but not in a unique way. For example, two identical cards in a game should have the same id.
10
+ * @property quantity Quantity of the item. An item without a quantity will be considered to have a quantity of 1.
11
+ * @property {Location} location Location of the item in the game (in a player's hand, on the table...). See {@link Location}.
12
+ * @property {number | boolean | undefined} selected Flag the item if selected. Items with a quantity can be partially selected using a number of select items.
13
+ */
2
14
  export type MaterialItem<P extends number = number, L extends number = number, Id = any> = {
3
15
  id?: Id;
4
16
  quantity?: number;