mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
[SHM] simplified Illuminated Folio a little more
This commit is contained in:
parent
1ac9a8d4e7
commit
4e8ec7d3ca
1 changed files with 6 additions and 43 deletions
|
@ -1,7 +1,5 @@
|
||||||
package mage.cards.i;
|
package mage.cards.i;
|
||||||
|
|
||||||
import mage.MageItem;
|
|
||||||
import mage.ObjectColor;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.common.RevealTargetFromHandCost;
|
import mage.abilities.costs.common.RevealTargetFromHandCost;
|
||||||
|
@ -18,9 +16,8 @@ import mage.filter.predicate.mageobject.ColorlessPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.target.common.TargetCardInHand;
|
import mage.target.common.TargetCardInHand;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
|
@ -65,52 +62,18 @@ class IlluminatedFolioTarget extends TargetCardInHand {
|
||||||
super(target);
|
super(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
|
|
||||||
Set<UUID> 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<Card> allTargets = possibleTargets
|
|
||||||
.stream()
|
|
||||||
.map(game::getCard)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
possibleTargets.clear();
|
|
||||||
for (ObjectColor color : ObjectColor.getAllColors()) {
|
|
||||||
Set<Card> 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
|
@Override
|
||||||
public boolean canTarget(UUID id, Game game) {
|
public boolean canTarget(UUID id, Game game) {
|
||||||
if (!super.canTarget(id, game)) {
|
if (!super.canTarget(id, game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
List<UUID> targetList = this.getTargets();
|
||||||
|
if (targetList.isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
Card card = game.getCard(id);
|
Card card = game.getCard(id);
|
||||||
return card != null
|
return card != null
|
||||||
&& this
|
&& targetList
|
||||||
.getTargets()
|
|
||||||
.stream()
|
.stream()
|
||||||
.map(game::getCard)
|
.map(game::getCard)
|
||||||
.anyMatch(c -> c.getColor(game).shares(card.getColor(game)));
|
.anyMatch(c -> c.getColor(game).shares(card.getColor(game)));
|
||||||
|
|
Loading…
Reference in a new issue