Optimize game.findPlayer.

(cherry picked from commit 9819bceb12a930c4be2f4a189def95ba0f0568ce)
This commit is contained in:
Tipx-L 2023-08-24 06:38:17 -07:00
parent 762ea0dc6c
commit d0e1063a9b
1 changed files with 1 additions and 9 deletions

View File

@ -38784,15 +38784,7 @@
if(typeof func!='function') func=lib.filter.all;
return list.addArray(game.players.concat(game.dead).filter(value=>(includeOut||!value.isOut())&&func(value)));
},
findPlayer:function(func,includeOut){
for(var i=0;i<game.players.length;i++){
if(!includeOut&&game.players[i].isOut()) continue;
if(func(game.players[i])){
return game.players[i];
}
}
return null;
},
findPlayer:(func,includeOut)=>game.players.find(value=>(includeOut||!value.isOut())&&func(value))||null,
findPlayer2:(func,includeOut)=>game.players.concat(game.dead).find(value=>(includeOut||!value.isOut())&&func(value))||null,
findCards:(func,all)=>Object.keys(lib.card).filter(value=>{
if(!lib.translate[`${value}_info`]) return false;