diff --git a/Mage.Sets/src/mage/cards/i/IlluminatedFolio.java b/Mage.Sets/src/mage/cards/i/IlluminatedFolio.java index 7c07f9e0e1..17c9345c3b 100644 --- a/Mage.Sets/src/mage/cards/i/IlluminatedFolio.java +++ b/Mage.Sets/src/mage/cards/i/IlluminatedFolio.java @@ -1,7 +1,5 @@ package mage.cards.i; -import mage.MageItem; -import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.RevealTargetFromHandCost; @@ -18,9 +16,8 @@ import mage.filter.predicate.mageobject.ColorlessPredicate; import mage.game.Game; import mage.target.common.TargetCardInHand; -import java.util.Set; +import java.util.List; import java.util.UUID; -import java.util.stream.Collectors; /** * @author TheElk801 @@ -65,52 +62,18 @@ class IlluminatedFolioTarget extends TargetCardInHand { super(target); } - @Override - public Set possibleTargets(UUID sourceControllerId, Game game) { - Set possibleTargets = super.possibleTargets(sourceControllerId, game); - if (this.getTargets().size() == 1) { - Card card = game.getCard(this.getTargets().get(0)); - possibleTargets.removeIf( - uuid -> game - .getCard(uuid) - .getColor(game) - .shares(card.getColor(game)) - ); - return possibleTargets; - } - if (possibleTargets.size() < 2) { - possibleTargets.clear(); - return possibleTargets; - } - Set allTargets = possibleTargets - .stream() - .map(game::getCard) - .collect(Collectors.toSet()); - possibleTargets.clear(); - for (ObjectColor color : ObjectColor.getAllColors()) { - Set inColor = allTargets - .stream() - .filter(card -> card.getColor(game).shares(color)) - .collect(Collectors.toSet()); - if (inColor.size() > 1) { - inColor.stream().map(MageItem::getId).forEach(possibleTargets::add); - } - if (possibleTargets.size() == allTargets.size()) { - break; - } - } - return possibleTargets; - } - @Override public boolean canTarget(UUID id, Game game) { if (!super.canTarget(id, game)) { return false; } + List targetList = this.getTargets(); + if (targetList.isEmpty()) { + return true; + } Card card = game.getCard(id); return card != null - && this - .getTargets() + && targetList .stream() .map(game::getCard) .anyMatch(c -> c.getColor(game).shares(card.getColor(game)));