updated a few card type methods for companions

This commit is contained in:
Evan Kranzler 2021-08-24 09:43:33 -04:00
parent 3dff1783ac
commit 29835786c3
6 changed files with 7 additions and 7 deletions

View file

@ -67,6 +67,6 @@ enum KerugaCondition implements CompanionCondition {
@Override
public boolean isLegal(Set<Card> deck, int startingHandSize) {
return deck.stream().allMatch(card -> card.isLand() || card.getManaValue() >= 3);
return deck.stream().allMatch(card -> card.hasCardTypeForDeckbuilding(CardType.LAND) || card.getManaValue() >= 3);
}
}
}

View file

@ -69,7 +69,7 @@ enum LurrusOfTheDreamDenCompanionCondition implements CompanionCondition {
@Override
public boolean isLegal(Set<Card> deck, int startingHandSize) {
return deck.stream()
.filter(card -> card.isPermanent())
.filter(MageObject::isPermanent)
.mapToInt(MageObject::getManaValue)
.max()
.orElse(0) <= 2;

View file

@ -86,7 +86,7 @@ enum LutriTheSpellchaserCompanionCondition implements CompanionCondition {
public boolean isLegal(Set<Card> deck, int startingHandSize) {
Map<String, Integer> cardMap = new HashMap<>();
deck.stream()
.filter(card -> !card.isLand())
.filter(card -> !card.hasCardTypeForDeckbuilding(CardType.LAND))
.map(MageObject::getName)
.forEach(s -> {
cardMap.putIfAbsent(s, 0);

View file

@ -61,7 +61,7 @@ enum OboshThePreypiercerCompanionCondition implements CompanionCondition {
public boolean isLegal(Set<Card> deck, int startingHandSize) {
return deck
.stream()
.filter(card -> !card.isLand())
.filter(card -> !card.hasCardTypeForDeckbuilding(CardType.LAND))
.mapToInt(MageObject::getManaValue)
.map(i -> i % 2)
.allMatch(i -> i == 1);

View file

@ -68,7 +68,7 @@ enum UmoriCondition implements CompanionCondition {
Set<CardType> cardTypes = new HashSet<>();
for (Card card : deck) {
// Lands are fine.
if (card.isLand()) {
if (card.hasCardTypeForDeckbuilding(CardType.LAND)) {
continue;
}
// First nonland checked.

View file

@ -76,7 +76,7 @@ enum ZirdaTheDawnwakerCompanionCondition implements CompanionCondition {
public boolean isLegal(Set<Card> deck, int startingHandSize) {
return deck
.stream()
.filter(card -> card.isPermanent())
.filter(MageObject::isPermanent)
.map(MageObject::getAbilities)
.flatMap(Collection::stream)
.anyMatch(ActivatedAbility.class::isInstance);