Gestion attaques v2 et initiative
This commit is contained in:
@@ -34,9 +34,13 @@ export class Misc {
|
||||
return ((n % m) + m) % m;
|
||||
}
|
||||
|
||||
static inRange(value, min,max){
|
||||
static inRange(value, min, max) {
|
||||
if (min > max) {
|
||||
return Misc.inRange(value, max, min)
|
||||
}
|
||||
return Math.max(min, Math.min(value, max))
|
||||
}
|
||||
|
||||
static sum() {
|
||||
return (a, b) => Number(a) + Number(b);
|
||||
}
|
||||
@@ -111,6 +115,10 @@ export class Misc {
|
||||
list.forEach(it => addToObj(obj, it))
|
||||
return obj;
|
||||
}
|
||||
static indexed(list, index = 'index') {
|
||||
let i = 0;
|
||||
return list.map(it => { it[index] = i++; return it })
|
||||
}
|
||||
|
||||
static concat(lists) {
|
||||
return lists.reduce((a, b) => a.concat(b), []);
|
||||
|
||||
Reference in New Issue
Block a user