Merge branch 'master' into 'master'

Commander quest mode

See merge request core-developers/forge!1053
This commit is contained in:
Michael Kamensky
2018-11-10 16:18:16 +00:00
20 changed files with 565 additions and 37 deletions

View File

@@ -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;
}
}