@gamepark/rules-api 7.6.2 → 7.6.4
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/material/items/Material.d.ts +8 -295
- package/dist/material/items/Material.js +8 -532
- package/dist/material/items/Material.js.map +1 -1
- package/dist/material/items/MaterialBase.d.ts +306 -0
- package/dist/material/items/MaterialBase.js +548 -0
- package/dist/material/items/MaterialBase.js.map +1 -0
- package/dist/material/items/MaterialDeck.d.ts +4 -4
- package/dist/material/items/MaterialDeck.js +3 -3
- package/dist/material/items/MaterialDeck.js.map +1 -1
- package/dist/material/items/MaterialMoney.d.ts +3 -3
- package/dist/material/items/MaterialMoney.js +3 -3
- package/dist/material/items/MaterialMoney.js.map +1 -1
- package/dist/material/items/MaterialMutator.js +6 -0
- package/dist/material/items/MaterialMutator.js.map +1 -1
- package/dist/material/items/index.d.ts +1 -0
- package/dist/material/items/index.js +0 -1
- package/dist/material/items/index.js.map +1 -1
- package/dist/material/rules/MaterialRulesPart.d.ts +4 -4
- package/package.json +7 -7
|
@@ -1,544 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ItemMoveType, MoveKind } from '../moves';
|
|
5
|
-
import { MaterialDeck, MaterialMoney } from './index';
|
|
1
|
+
import { MaterialBase } from './MaterialBase';
|
|
2
|
+
import { MaterialDeck } from './MaterialDeck';
|
|
3
|
+
import { MaterialMoney } from './MaterialMoney';
|
|
6
4
|
/**
|
|
7
5
|
* The Material class is the core helper class that help manipulate the game items in a simple way.
|
|
8
6
|
* It includes two kind of functions: functions to filter items, and functions to build {@link ItemMove} objects.
|
|
9
7
|
* Filter function will all return a new instance of Material with only the filtered items. This class is designed to be immutable.
|
|
10
8
|
*
|
|
9
|
+
* All the filtering and move creation logic lives in {@link MaterialBase}; this class only adds the factory helpers
|
|
10
|
+
* ({@link deck} and {@link money}) that build specialised instances — keeping the dependency arrow one-way and
|
|
11
|
+
* avoiding a circular import with {@link MaterialDeck} / {@link MaterialMoney}.
|
|
12
|
+
*
|
|
11
13
|
* @typeparam P - identifier of a player. Either a number or a numeric enum (eg: PlayerColor)
|
|
12
14
|
* @typeparam M - Numeric enum of the types of material manipulated in the game
|
|
13
15
|
* @typeparam L - Numeric enum of the types of location in the game where the material can be located
|
|
14
16
|
*/
|
|
15
|
-
export class Material {
|
|
16
|
-
type;
|
|
17
|
-
items;
|
|
18
|
-
processMove;
|
|
19
|
-
entries;
|
|
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, items = [], processMove, entries = Array.from(items.entries()).filter(entry => entry[1].quantity !== 0)) {
|
|
28
|
-
this.type = type;
|
|
29
|
-
this.items = items;
|
|
30
|
-
this.processMove = processMove;
|
|
31
|
-
this.entries = entries;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Helper function to return a new instance of the same class (works also for children class)
|
|
35
|
-
* @param {ItemEntry[]} entries Filtered entries for the new class
|
|
36
|
-
* @returns {this} the new Material instance
|
|
37
|
-
* @protected
|
|
38
|
-
*/
|
|
39
|
-
new(entries) {
|
|
40
|
-
const Class = this.constructor;
|
|
41
|
-
return new Class(this.type, this.items, this.processMove, entries);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Use this function to collect all the items in the current Material instance.
|
|
45
|
-
* For example, you can filter then collect the matching items: this.material(type).location(locationType).getItems()
|
|
46
|
-
*
|
|
47
|
-
* @typeparam Id - Identifier of the items (item.id)
|
|
48
|
-
* @param {function} predicate If provided, only the items matching the predicate will be returned
|
|
49
|
-
* @returns {MaterialItem[]} the items in this Material instance
|
|
50
|
-
*/
|
|
51
|
-
getItems(predicate) {
|
|
52
|
-
const items = this.entries.map(entry => entry[1]);
|
|
53
|
-
return predicate ? items.filter(predicate) : items;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Use this function to collect this first item in the current Material instance.
|
|
57
|
-
* You can use {@link sort} to sort the items first.
|
|
58
|
-
*
|
|
59
|
-
* @param {number | function} arg Index of the item, or predicate function
|
|
60
|
-
* @returns {MaterialItem | undefined} the item, or undefined if none match
|
|
61
|
-
*/
|
|
62
|
-
getItem(arg) {
|
|
63
|
-
if (typeof arg === 'number') {
|
|
64
|
-
const entry = this.entries.find(entry => entry[0] === arg);
|
|
65
|
-
if (!entry)
|
|
66
|
-
throw new Error(`Could not find any item with index ${arg} for type ${this.type}`);
|
|
67
|
-
return entry[1];
|
|
68
|
-
}
|
|
69
|
-
else if (typeof arg === 'function') {
|
|
70
|
-
const entries = this.entries.filter(([, item]) => arg(item));
|
|
71
|
-
return entries.length ? entries[0][1] : undefined;
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
return this.entries.length ? this.entries[0][1] : undefined;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* @returns {number} index of the first item
|
|
79
|
-
*/
|
|
80
|
-
getIndex() {
|
|
81
|
-
return this.entries[0]?.[0] ?? -1;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* @returns {number[]} indexes of the items
|
|
85
|
-
*/
|
|
86
|
-
getIndexes() {
|
|
87
|
-
return this.entries.map(entry => entry[0]);
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Filter and return a new instance with only the items that match a specific index, or a specific index predicate
|
|
91
|
-
* @param {number | function} arg The index to keep, or the predicate matching the indexes to keep
|
|
92
|
-
*/
|
|
93
|
-
index(arg) {
|
|
94
|
-
switch (typeof arg) {
|
|
95
|
-
case 'function':
|
|
96
|
-
return this.filter((_, index) => arg(index));
|
|
97
|
-
case 'number':
|
|
98
|
-
const item = this.entries.find(([index]) => index === arg);
|
|
99
|
-
return this.new(item ? [item] : []);
|
|
100
|
-
case 'undefined':
|
|
101
|
-
return this.new([]);
|
|
102
|
-
default:
|
|
103
|
-
const items = this.entries.filter(([i]) => arg.includes(i));
|
|
104
|
-
return this.new(items);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* @deprecated Use {@link index} instead
|
|
109
|
-
*/
|
|
110
|
-
indexes(indexes) {
|
|
111
|
-
const items = this.entries.filter(([i]) => indexes.includes(i));
|
|
112
|
-
return this.new(items);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* @returns {number} number of items
|
|
116
|
-
*/
|
|
117
|
-
get length() {
|
|
118
|
-
return this.entries.length;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* @returns {boolean} true if there is at least one item
|
|
122
|
-
*/
|
|
123
|
-
get exists() {
|
|
124
|
-
return this.entries.length > 0;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* @returns {number} Sum of the quantity of all items
|
|
128
|
-
*/
|
|
129
|
-
getQuantity() {
|
|
130
|
-
return sumBy(this.entries, ([, item]) => item.quantity ?? 1);
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* This function filter the items and returns a new instance with only the filtered items.
|
|
134
|
-
* This function is the top level filtering function, but other function can be used to simplify the code:
|
|
135
|
-
* {@link player}, {@link location}, {@link rotation}, {@link id}, {@link locationId}...
|
|
136
|
-
*
|
|
137
|
-
* @param {function} predicate The predicate function. Takes every item and index, and keep the item if it returns true
|
|
138
|
-
* @returns {this} New instance with only the items that match the predicate
|
|
139
|
-
*/
|
|
140
|
-
filter(predicate) {
|
|
141
|
-
return this.new(this.entries.filter(([index, item]) => predicate(item, index)));
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Filters the items based on their ids.
|
|
145
|
-
*
|
|
146
|
-
* @param {function | string | number | Record} arg Id to keep, or predicate function to match the ids of the items to keep
|
|
147
|
-
* @returns {this} New instance with only the items which ids match the argument
|
|
148
|
-
*/
|
|
149
|
-
id(arg) {
|
|
150
|
-
return this.filter(({ id }) => typeof arg === 'function' ? arg(id) : isEqual(id, arg));
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Filters the items based on their location type, or their location.
|
|
154
|
-
*
|
|
155
|
-
* @param {function | number} arg Location type to keep, or predicate function to match the location of the items to keep
|
|
156
|
-
* @returns {this} New instance with only the items which locations match the argument
|
|
157
|
-
*/
|
|
158
|
-
location(arg) {
|
|
159
|
-
return this.filter(({ location }) => typeof arg === 'function' ? arg(location) : location.type === arg);
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Filters the items based on their rotation (item.location.rotation)
|
|
163
|
-
*
|
|
164
|
-
* @param {function | string | number | boolean | Record} arg rotation to keep, or predicate function to match the rotations of the items to keep
|
|
165
|
-
* @returns {this} New instance with only the items which rotation match the argument
|
|
166
|
-
*/
|
|
167
|
-
rotation(arg) {
|
|
168
|
-
return this.location(({ rotation }) => typeof arg === 'function' ? arg(rotation) : isEqual(rotation, arg));
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Filters the items based on their owner (item.location.player)
|
|
172
|
-
*
|
|
173
|
-
* @param {function | number} arg player id to keep, or predicate function to match the owner player of the items to keep
|
|
174
|
-
* @returns {this} New instance with only the items which owner match the argument
|
|
175
|
-
*/
|
|
176
|
-
player(arg) {
|
|
177
|
-
return this.location(({ player }) => typeof arg === 'function' ? arg(player) : player === arg);
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Filters the items based on their location's id (item.location.id)
|
|
181
|
-
*
|
|
182
|
-
* @param {function | number} arg location id to keep, or predicate function to match the location id of the items to keep
|
|
183
|
-
* @returns {this} New instance with only the items which location id match the argument
|
|
184
|
-
*/
|
|
185
|
-
locationId(arg) {
|
|
186
|
-
return this.location(({ id }) => typeof arg === 'function' ? arg(id) : isEqual(id, arg));
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Filters the items based on their location's parent (item.location.parent).
|
|
190
|
-
*
|
|
191
|
-
* @param {function | number} arg location parent to keep, or predicate function to match the location parent of the items to keep
|
|
192
|
-
* @returns {this} New instance with only the items which location parent match the argument
|
|
193
|
-
*/
|
|
194
|
-
parent(arg) {
|
|
195
|
-
return this.location(({ parent }) => typeof arg === 'function' ? arg(parent) : isEqual(parent, arg));
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Filters the items that are selected (item.selected).
|
|
199
|
-
*
|
|
200
|
-
* @param {number | boolean} selected The selected value to compare (default is true)
|
|
201
|
-
* @returns {this} New instance with only the items which are selected
|
|
202
|
-
*/
|
|
203
|
-
selected(selected = true) {
|
|
204
|
-
return this.filter(item => (item.selected ?? false) === selected);
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Keep only the item that has the minimum value returned by the selector argument.
|
|
208
|
-
* See {@link minBy} from Lodash
|
|
209
|
-
*
|
|
210
|
-
* @param {function} selector The function that evaluate the item's value
|
|
211
|
-
* @returns {this} New instance with only the item which has the minimum value
|
|
212
|
-
*/
|
|
213
|
-
minBy(selector) {
|
|
214
|
-
const min = minBy(this.entries, entry => selector(entry[1]));
|
|
215
|
-
return this.new(min ? [min] : []);
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Keep only the item that has the maximum value returned by the selector argument.
|
|
219
|
-
* See {@link maxBy} from Lodash
|
|
220
|
-
*
|
|
221
|
-
* @param {function} selector The function that evaluate the item's value
|
|
222
|
-
* @returns {this} New instance with only the item which has the maximum value
|
|
223
|
-
*/
|
|
224
|
-
maxBy(selector) {
|
|
225
|
-
const max = maxBy(this.entries, entry => selector(entry[1]));
|
|
226
|
-
return this.new(max ? [max] : []);
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Return a new material instance which items are ordered based on provided selector functions.
|
|
230
|
-
* See {@link orderBy} from Lodash
|
|
231
|
-
*
|
|
232
|
-
* @param {...function} selectors The function or functions that evaluate each item's value
|
|
233
|
-
* @returns {this} New instance with items ordered by the selector functions
|
|
234
|
-
*/
|
|
235
|
-
sort(...selectors) {
|
|
236
|
-
let orderedItems = orderBy(this.entries, selectors.map((s) => (entry) => s(entry[1])));
|
|
237
|
-
return this.new(orderedItems);
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Return a new material instance with only the first N items.
|
|
241
|
-
* You have to use {@link sort} first as the items are ordered initially by index, which is not relevant.
|
|
242
|
-
* Example: material.sort(item => !item.location.x!).limit(10)
|
|
243
|
-
*
|
|
244
|
-
* @param count Number of items to keep
|
|
245
|
-
* @returns {this} New instance with only the first "count" items
|
|
246
|
-
*/
|
|
247
|
-
limit(count) {
|
|
248
|
-
return this.new(this.entries.slice(0, count));
|
|
249
|
-
}
|
|
250
|
-
process(moves) {
|
|
251
|
-
if (this.processMove) {
|
|
252
|
-
for (const move of moves) {
|
|
253
|
-
this.processMove(move);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
return moves;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Prepare a move that will create a new item
|
|
260
|
-
* @param {MaterialItem} item The item to create
|
|
261
|
-
* @returns {CreateItem} the move that creates an item when executed
|
|
262
|
-
*/
|
|
263
|
-
createItem(item) {
|
|
264
|
-
return this.createItems([item])[0];
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Prepare a list of moves to create new items
|
|
268
|
-
* @param {MaterialItem[]} items The items to create
|
|
269
|
-
* @returns {CreateItem[]} the moves that creates the new items when executed
|
|
270
|
-
*/
|
|
271
|
-
createItems(items) {
|
|
272
|
-
return this.process(items.map(item => ({
|
|
273
|
-
kind: MoveKind.ItemMove,
|
|
274
|
-
type: ItemMoveType.Create,
|
|
275
|
-
itemType: this.type,
|
|
276
|
-
item
|
|
277
|
-
})));
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Prepare one move to create new items
|
|
281
|
-
* @param {MaterialItem[]} items The items to create
|
|
282
|
-
* @returns {CreateItemsAtOnce} the move that creates the new items when executed
|
|
283
|
-
*/
|
|
284
|
-
createItemsAtOnce(items) {
|
|
285
|
-
const move = { kind: MoveKind.ItemMove, type: ItemMoveType.CreateAtOnce, itemType: this.type, items };
|
|
286
|
-
return this.process([move])[0];
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Prepare a move that will delete current first item in this material instance
|
|
290
|
-
*
|
|
291
|
-
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to remove. If undefined, the item is completely removed
|
|
292
|
-
* @returns {DeleteItem} the move that delete the item, or a part of its quantity, when executed
|
|
293
|
-
*/
|
|
294
|
-
deleteItem(quantity) {
|
|
295
|
-
switch (this.length) {
|
|
296
|
-
case 0:
|
|
297
|
-
throw new Error('You are trying to delete an item that does not exists');
|
|
298
|
-
case 1:
|
|
299
|
-
return this.deleteItems(quantity)[0];
|
|
300
|
-
default:
|
|
301
|
-
return this.limit(1).deleteItems(quantity)[0];
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Prepare moves that will delete all the items in this material instance
|
|
306
|
-
*
|
|
307
|
-
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to remove. If undefined, the items are completely removed
|
|
308
|
-
* @returns {DeleteItem[]} the moves that delete the items, or a part of their quantity, when executed
|
|
309
|
-
*/
|
|
310
|
-
deleteItems(quantity) {
|
|
311
|
-
return this.process(this.entries.map(entry => {
|
|
312
|
-
const move = {
|
|
313
|
-
kind: MoveKind.ItemMove,
|
|
314
|
-
type: ItemMoveType.Delete,
|
|
315
|
-
itemType: this.type,
|
|
316
|
-
itemIndex: entry[0]
|
|
317
|
-
};
|
|
318
|
-
if (quantity)
|
|
319
|
-
move.quantity = quantity;
|
|
320
|
-
return move;
|
|
321
|
-
}));
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Prepare one move that will delete all the items in this material instance
|
|
325
|
-
*
|
|
326
|
-
* @returns {DeleteItemsAtOnce} the move that delete the items when executed
|
|
327
|
-
*/
|
|
328
|
-
deleteItemsAtOnce() {
|
|
329
|
-
const moves = { kind: MoveKind.ItemMove, type: ItemMoveType.DeleteAtOnce, itemType: this.type, indexes: this.getIndexes() };
|
|
330
|
-
return this.process([moves])[0];
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Prepare a move that will change the location of the current first item in this material instance
|
|
334
|
-
*
|
|
335
|
-
* @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.
|
|
336
|
-
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to move. If undefined, the item is completely moved.
|
|
337
|
-
* @returns {MoveItem} the move that will change the location of the item (or a part of its quantity) when executed
|
|
338
|
-
*/
|
|
339
|
-
moveItem(location, quantity) {
|
|
340
|
-
switch (this.length) {
|
|
341
|
-
case 0:
|
|
342
|
-
throw new Error('You are trying to move an item that does not exists');
|
|
343
|
-
case 1:
|
|
344
|
-
return this.moveItems(location, quantity)[0];
|
|
345
|
-
default:
|
|
346
|
-
return this.limit(1).moveItems(location, quantity)[0];
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Prepare moves that will change the location of all the items in this material instance
|
|
351
|
-
*
|
|
352
|
-
* @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.
|
|
353
|
-
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to move. If undefined, the items are completely moved.
|
|
354
|
-
* @returns {MoveItem[]} the moves that will change the location of the items (or a part of their quantity) when executed
|
|
355
|
-
*/
|
|
356
|
-
moveItems(location, quantity) {
|
|
357
|
-
const getLocation = typeof location === 'function' ? location : () => location;
|
|
358
|
-
return this.process(this.entries.map(entry => {
|
|
359
|
-
const location = getLocation(entry[1], entry[0]);
|
|
360
|
-
const move = {
|
|
361
|
-
kind: MoveKind.ItemMove,
|
|
362
|
-
type: ItemMoveType.Move,
|
|
363
|
-
itemType: this.type,
|
|
364
|
-
itemIndex: entry[0],
|
|
365
|
-
location
|
|
366
|
-
};
|
|
367
|
-
if (quantity)
|
|
368
|
-
move.quantity = quantity;
|
|
369
|
-
return move;
|
|
370
|
-
}));
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Prepare one move that will change the location of all the items in this material instance
|
|
374
|
-
*
|
|
375
|
-
* @param {Location} location The new location of the items. It can only be the same location for every item.
|
|
376
|
-
* @returns {MoveItemsAtOnce} the move that will change the location of the items when executed
|
|
377
|
-
*/
|
|
378
|
-
moveItemsAtOnce(location) {
|
|
379
|
-
const move = {
|
|
380
|
-
kind: MoveKind.ItemMove,
|
|
381
|
-
type: ItemMoveType.MoveAtOnce,
|
|
382
|
-
itemType: this.type,
|
|
383
|
-
indexes: this.entries.map(([index]) => index),
|
|
384
|
-
location
|
|
385
|
-
};
|
|
386
|
-
return this.process([move])[0];
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Prepare a move that will select current first item in this material instance
|
|
390
|
-
*
|
|
391
|
-
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to select. If undefined, the item is completely selected.
|
|
392
|
-
* @returns {SelectItem} the move that will select the item (or a part of its quantity) when executed
|
|
393
|
-
*/
|
|
394
|
-
selectItem(quantity) {
|
|
395
|
-
switch (this.length) {
|
|
396
|
-
case 0:
|
|
397
|
-
throw new Error('You are trying to select an item that does not exists');
|
|
398
|
-
case 1:
|
|
399
|
-
return this.selectItems(quantity)[0];
|
|
400
|
-
default:
|
|
401
|
-
return this.limit(1).selectItems(quantity)[0];
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Prepare a move that will select all the items in this material instance
|
|
406
|
-
*
|
|
407
|
-
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to select. If undefined, the items are completely selected.
|
|
408
|
-
* @returns {SelectItem[]} the moves that will select the items (or a part of their quantity) when executed
|
|
409
|
-
*/
|
|
410
|
-
selectItems(quantity) {
|
|
411
|
-
return this.process(this.entries.map(entry => {
|
|
412
|
-
const move = {
|
|
413
|
-
kind: MoveKind.ItemMove,
|
|
414
|
-
type: ItemMoveType.Select,
|
|
415
|
-
itemType: this.type,
|
|
416
|
-
itemIndex: entry[0]
|
|
417
|
-
};
|
|
418
|
-
if (quantity)
|
|
419
|
-
move.quantity = quantity;
|
|
420
|
-
return move;
|
|
421
|
-
}));
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* Prepare a move that will unselect current first item in this material instance
|
|
425
|
-
*
|
|
426
|
-
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to unselect. If undefined, the item is completely unselected.
|
|
427
|
-
* @returns {SelectItem} the move that will unselect the item (or a part of its quantity) when executed
|
|
428
|
-
*/
|
|
429
|
-
unselectItem(quantity) {
|
|
430
|
-
switch (this.length) {
|
|
431
|
-
case 0:
|
|
432
|
-
throw new Error('You are trying to select an item that does not exists');
|
|
433
|
-
case 1:
|
|
434
|
-
return this.unselectItems(quantity)[0];
|
|
435
|
-
default:
|
|
436
|
-
return this.limit(1).unselectItems(quantity)[0];
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Prepare a move that will unselect all the items in this material instance
|
|
441
|
-
*
|
|
442
|
-
* @param {number | undefined} quantity Optional: for items with a quantity, the number of items to unselect. If undefined, the items are completely unselected.
|
|
443
|
-
* @returns {SelectItem[]} the moves that will unselect the items (or a part of their quantity) when executed
|
|
444
|
-
*/
|
|
445
|
-
unselectItems(quantity) {
|
|
446
|
-
return this.process(this.entries.map(entry => {
|
|
447
|
-
const move = {
|
|
448
|
-
kind: MoveKind.ItemMove,
|
|
449
|
-
type: ItemMoveType.Select,
|
|
450
|
-
itemType: this.type,
|
|
451
|
-
itemIndex: entry[0],
|
|
452
|
-
selected: false
|
|
453
|
-
};
|
|
454
|
-
if (quantity)
|
|
455
|
-
move.quantity = quantity;
|
|
456
|
-
return move;
|
|
457
|
-
}));
|
|
458
|
-
}
|
|
459
|
-
/**
|
|
460
|
-
* Prepare a move that will rotate current first item in this material instance.
|
|
461
|
-
* This function creates a {@link MoveItem} but copies the existing location values, only replacing the rotation property.
|
|
462
|
-
*
|
|
463
|
-
* @param {string | number | boolean | Record | function | undefined} arg Value of the rotation to give to the item.
|
|
464
|
-
* In case of a function, process the value based on the item state.
|
|
465
|
-
* @returns {MoveItem} the move that will rotate the item when executed
|
|
466
|
-
*/
|
|
467
|
-
rotateItem(arg) {
|
|
468
|
-
switch (this.length) {
|
|
469
|
-
case 0:
|
|
470
|
-
throw new Error('You are trying to rotate an item that does not exists');
|
|
471
|
-
case 1:
|
|
472
|
-
return this.rotateItems(arg)[0];
|
|
473
|
-
default:
|
|
474
|
-
return this.limit(1).rotateItems(arg)[0];
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* Prepare a move that will rotate all the items in this material instance.
|
|
479
|
-
* This function creates an array of {@link MoveItem} but copies the existing locations values, only replacing the rotation property.
|
|
480
|
-
*
|
|
481
|
-
* @param {string | number | boolean | Record | function | undefined} arg Value of the rotation to give to the item.
|
|
482
|
-
* In case of a function, process the value based on the item state.
|
|
483
|
-
* @returns {MoveItem[]} the moves that will rotate the item when executed
|
|
484
|
-
*/
|
|
485
|
-
rotateItems(arg) {
|
|
486
|
-
return this.moveItems(item => {
|
|
487
|
-
const rotation = typeof arg === 'function' ? arg(item) : arg;
|
|
488
|
-
const { rotation: oldRotation, ...location } = item.location;
|
|
489
|
-
return rotation !== undefined ? ({ ...location, rotation }) : location;
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* Prepare a move that will shuffle all the items in the current material instance
|
|
494
|
-
* @returns {Shuffle} the move that shuffle the items when executed
|
|
495
|
-
*/
|
|
496
|
-
shuffle() {
|
|
497
|
-
if (process.env.NODE_ENV === 'development' && this.entries.some(e => !isSameLocationArea(e[1].location, this.entries[0][1].location))) {
|
|
498
|
-
console.warn('Calling shuffle on items with different location areas might be a mistake.');
|
|
499
|
-
}
|
|
500
|
-
return this.process([{
|
|
501
|
-
kind: MoveKind.ItemMove,
|
|
502
|
-
type: ItemMoveType.Shuffle,
|
|
503
|
-
itemType: this.type,
|
|
504
|
-
indexes: this.entries.map(entry => entry[0])
|
|
505
|
-
}])[0];
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* Prepare a move that will roll the current first item in this material instance. See {@link RollItem}.
|
|
509
|
-
*
|
|
510
|
-
* @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.
|
|
511
|
-
* @returns {RollItem} the move that rolls the item when executed
|
|
512
|
-
*/
|
|
513
|
-
rollItem(location) {
|
|
514
|
-
switch (this.length) {
|
|
515
|
-
case 0:
|
|
516
|
-
throw new Error('You are trying to roll an item that does not exists');
|
|
517
|
-
case 1:
|
|
518
|
-
return this.rollItems(location)[0];
|
|
519
|
-
default:
|
|
520
|
-
return this.limit(1).rollItems(location)[0];
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* Prepare a move that will roll all the items in this material instance. See {@link RollItem}.
|
|
525
|
-
*
|
|
526
|
-
* @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.
|
|
527
|
-
* @returns {RollItem[]} the moves that rolls the items when executed
|
|
528
|
-
*/
|
|
529
|
-
rollItems(location = (item) => item.location) {
|
|
530
|
-
const getLocation = typeof location === 'function' ? location : () => location;
|
|
531
|
-
return this.process(this.entries.map(entry => {
|
|
532
|
-
const location = getLocation(entry[1]);
|
|
533
|
-
return ({
|
|
534
|
-
kind: MoveKind.ItemMove,
|
|
535
|
-
type: ItemMoveType.Roll,
|
|
536
|
-
itemType: this.type,
|
|
537
|
-
itemIndex: entry[0],
|
|
538
|
-
location
|
|
539
|
-
});
|
|
540
|
-
}));
|
|
541
|
-
}
|
|
17
|
+
export class Material extends MaterialBase {
|
|
542
18
|
/**
|
|
543
19
|
* Return a new {@link MaterialDeck} helper class, to deal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