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