PartnerWith: extended DeckFormat Predicate

This commit is contained in:
Hanmac
2018-05-27 15:52:18 +02:00
parent ef96037555
commit e031ac8176
2 changed files with 9 additions and 1 deletions

View File

@@ -563,6 +563,12 @@ public final class CardRulesPredicates {
return subject.canBeCommander();
}
};
public static final Predicate<CardRules> CAN_BE_PARTNER_COMMANDER = new Predicate<CardRules>() {
@Override
public boolean apply(final CardRules subject) {
return subject.canBePartnerCommander();
}
};
public static final Predicate<CardRules> IS_PLANESWALKER = CardRulesPredicates.coreType(true, CardType.CoreType.Planeswalker);
public static final Predicate<CardRules> IS_INSTANT = CardRulesPredicates.coreType(true, CardType.CoreType.Instant);

View File

@@ -513,6 +513,8 @@ public enum DeckFormat {
for (final PaperCard p : commanders) {
cmdCI |= p.getRules().getColorIdentity().getColor();
}
return Predicates.compose(Predicates.or(CardRulesPredicates.hasColorIdentity(cmdCI), CardRulesPredicates.hasKeyword("Partner")), PaperCard.FN_GET_RULES);
// TODO : check commander what kind of Partner it needs
return Predicates.compose(Predicates.or(CardRulesPredicates.hasColorIdentity(cmdCI),
CardRulesPredicates.Presets.CAN_BE_PARTNER_COMMANDER), PaperCard.FN_GET_RULES);
}
}