DeckManagers use DeckProxies

This commit is contained in:
Maxmtg
2014-01-21 09:32:36 +00:00
parent d97495ed41
commit 567ffe84cd
16 changed files with 239 additions and 180 deletions

View File

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