Optimize game.hasPlayer2.
(cherry picked from commit ba85e81ecf38f41039295bcf440b1c6a89d4067e)
This commit is contained in:
parent
674f45e8b8
commit
0a544d01b3
|
@ -38731,14 +38731,7 @@
|
|||
}
|
||||
return false;
|
||||
},
|
||||
hasPlayer2:function(func,includeOut){
|
||||
var players=game.players.slice(0).concat(game.dead);
|
||||
for(var i=0;i<players.length;i++){
|
||||
if(!includeOut&&players[i].isOut()) continue;
|
||||
if(func(players[i])) return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
hasPlayer2:(func,includeOut)=>game.players.concat(game.dead).some(value=>(includeOut||!value.isOut())&&func(value)),
|
||||
countPlayer:(func,includeOut)=>{
|
||||
if(typeof func!='function') func=lib.filter.all;
|
||||
return game.players.reduce((previousValue,currentValue)=>{
|
||||
|
|
Loading…
Reference in New Issue