mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
DeckManagers use DeckProxies
This commit is contained in:
@@ -31,7 +31,6 @@ import java.util.TreeSet;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.StaticData;
|
||||
@@ -307,29 +306,4 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
|
||||
}
|
||||
return ColorSet.fromMask(colorProfile);
|
||||
}
|
||||
|
||||
//create predicate that applys a card predicate to all cards in deck
|
||||
public static final Predicate<Deck> createPredicate(final Predicate<PaperCard> cardPredicate) {
|
||||
return new Predicate<Deck>() {
|
||||
@Override
|
||||
public boolean apply(Deck input) {
|
||||
for (Entry<DeckSection, CardPool> deckEntry : input) {
|
||||
switch (deckEntry.getKey()) {
|
||||
case Main:
|
||||
case Sideboard:
|
||||
case Commander:
|
||||
for (Entry<PaperCard, Integer> poolEntry : deckEntry.getValue()) {
|
||||
if (!cardPredicate.apply(poolEntry.getKey())) {
|
||||
return false; //all cards in deck must pass card predicate to pass deck predicate
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break; //ignore other sections
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user