Optimize game.filterSkills.
(cherry picked from commit 570a9935d734c82ef986841f4ad43095053e8ddb)
This commit is contained in:
parent
b6ca7b534e
commit
940b0086d5
15
game/game.js
15
game/game.js
|
@ -38686,17 +38686,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
filterSkills:function(skills,player,exclude){
|
filterSkills:(skills,player,exclude)=>{
|
||||||
var out=skills.slice(0);
|
const out=skills.slice().removeArray(Object.keys(player.disabledSkills));
|
||||||
for(var i in player.disabledSkills){
|
if(!player.storage.skill_blocker||!player.storage.skill_blocker.length) return out;
|
||||||
out.remove(i);
|
return out.filter(value=>exclude&&exclude.includes(value)||!get.is.blocked(value,player));
|
||||||
}
|
|
||||||
if(player.storage.skill_blocker&&player.storage.skill_blocker.length){
|
|
||||||
for(var i=0;i<out.length;i++){
|
|
||||||
if((!exclude||!exclude.contains(out[i]))&&get.is.blocked(out[i],player)) out.splice(i--,1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
},
|
},
|
||||||
expandSkills:skills=>skills.addArray(skills.reduce((previousValue,currentValue)=>{
|
expandSkills:skills=>skills.addArray(skills.reduce((previousValue,currentValue)=>{
|
||||||
const info=get.info(currentValue);
|
const info=get.info(currentValue);
|
||||||
|
|
Loading…
Reference in New Issue