Utilisation nullish / chaining

Simplifie certaines expressions complexes avec operateur ternaire

- Nullish coalescing operator (??)
- Relationship with the optional chaining operator (?.)

- Math.min / Math.max / Math.ceil
This commit is contained in:
Vincent Vandemeulebrouck
2021-01-04 14:10:21 +01:00
parent 0ef119f59c
commit e3439953f9
6 changed files with 27 additions and 33 deletions

View File

@ -673,10 +673,8 @@ export class RdDUtility {
/* -------------------------------------------- */
static currentFatigueMalus( value, max)
{
max = (max < 16) ? 16 : max;
max = (max > 30) ? 30 : max;
value = (value > max*2) ? max*2 : value;
value = (value < 0) ? 0 : value;
max = Math.min(1, Math.max(max, 60));
value = Math.min(max*2, Math.max(0, value));
let fatigueTab = fatigueMatrix[max];
let fatigueRem = value;