Optimize game.findCards.

(cherry picked from commit 7a80e7ed521bf8f54df35e715f026e91682e3164)
This commit is contained in:
Tipx-L 2023-08-24 06:34:39 -07:00
parent 57398a4ea4
commit 60a1d59aa4
1 changed files with 6 additions and 12 deletions

View File

@ -38803,18 +38803,12 @@
} }
return null; return null;
}, },
findCards:function(func,all){ findCards:(func,all)=>Object.keys(lib.card).filter(value=>{
var cards=[]; if(!lib.translate[`${value}_info`]) return false;
for(var i in lib.card){ if(lib.card[value].mode&&lib.card[value].mode.includes(lib.config.mode)==false) return false;
if(!lib.translate[i+'_info']) continue; if(!all&&!lib.inpile.includes(value)) return false;
if(lib.card[i].mode&&lib.card[i].mode.contains(lib.config.mode)==false) continue; return func(value,lib.card[value]);
if(!all&&!lib.inpile.contains(i)) continue; }),
if(func(i,lib.card[i])){
cards.push(i);
}
}
return cards;
},
countGroup:()=>{ countGroup:()=>{
const list=lib.group.slice(0); const list=lib.group.slice(0);
return game.countPlayer(current=>{ return game.countPlayer(current=>{