perf: use lambda refactor.

This commit is contained in:
Rintim 2023-10-13 01:25:54 +08:00
parent f49fc05864
commit 7920763001
No known key found for this signature in database
GPG Key ID: BE9E1EA615BACFCF
1 changed files with 3 additions and 9 deletions

View File

@ -58878,15 +58878,9 @@
population:identity=>identity==undefined? population:identity=>identity==undefined?
game.players.length+game.dead.length: game.players.length+game.dead.length:
game.players.filter(current=>current.identity==identity).length, game.players.filter(current=>current.identity==identity).length,
totalPopulation:identity=>{ totalPopulation:identity=>identity==undefined?
if(identity==undefined) return game.players.length+game.dead.length; game.players.length+game.dead.length:
var i,players=game.players.concat(game.dead); game.players.concat(game.dead).filter(current=>current.identity==identity).length,
var num=0;
for(i=0;i<players.length;i++){
if(players[i].identity==identity) num++;
}
return num;
},
cardtag:(item,tag)=>{ cardtag:(item,tag)=>{
if(item.cardid&&(get.itemtype(item)=='card'||!item.cards||!item.cards.length||item.name==item.cards[0].name)&&_status.cardtag&&_status.cardtag[tag]&&_status.cardtag[tag].contains(item.cardid)){ if(item.cardid&&(get.itemtype(item)=='card'||!item.cards||!item.cards.length||item.name==item.cards[0].name)&&_status.cardtag&&_status.cardtag[tag]&&_status.cardtag[tag].contains(item.cardid)){
return true; return true;