Simplification calcul de difficulté alchimie
This commit is contained in:
parent
3691775da0
commit
3d866e343b
@ -44,20 +44,13 @@ export class RdDAlchimie {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static getDifficulte( aspects ) {
|
static getDifficulte(aspects) {
|
||||||
let aspectsArray = aspects.split('-');
|
let elements = aspects.split('-');
|
||||||
let diff = 0;
|
let composantes = elements.length;
|
||||||
let nbDifferent = 0;
|
let distincts = Object.keys(Misc.classifyFirst(elements, it => it)).length;
|
||||||
let aspectsHash = {}
|
if (distincts == 1) {
|
||||||
for (let colconst of aspectsArray) {
|
composantes--;
|
||||||
if ( aspectsHash[colconst] ){ // Deja present, augmente difficulté de 1
|
|
||||||
diff -= 1;
|
|
||||||
} else {
|
|
||||||
nbDifferent++;
|
|
||||||
aspectsHash[colconst] = colconst; // Keep track
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
diff = diff - ((nbDifferent>1) ? nbDifferent : 0); // Ca doit marcher ....
|
return Math.min(0, -composantes);
|
||||||
return Math.min(0, diff); // Pour être sur
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user