mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Merge branch 'master' into 'master'
Commander quest mode See merge request core-developers/forge!1053
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge.deck;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Lists;
|
||||
import forge.StaticData;
|
||||
import forge.card.CardDb;
|
||||
@@ -216,4 +217,17 @@ public class CardPool extends ItemPool<PaperCard> {
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a predicate to this CardPool's cards.
|
||||
* @param predicate the Predicate to apply to this CardPool
|
||||
* @return a new CardPool made from this CardPool with only the cards that agree with the provided Predicate
|
||||
*/
|
||||
public CardPool getFilteredPool(Predicate<PaperCard> predicate){
|
||||
CardPool filteredPool = new CardPool();
|
||||
for(PaperCard pc : this.items.keySet()){
|
||||
if(predicate.apply(pc)) filteredPool.add(pc);
|
||||
}
|
||||
return filteredPool;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user