mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
[ZNR] fixed Yasharn, Implacable Earth (#7046)
This commit is contained in:
parent
c60a01b2fc
commit
ab318ad55a
1 changed files with 13 additions and 13 deletions
|
@ -23,9 +23,8 @@ import mage.players.Player;
|
|||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
|
@ -91,20 +90,21 @@ class YasharnImplacableEarthTarget extends TargetCardInLibrary {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceId, UUID playerId, Game game) {
|
||||
Set<UUID> possibleTargets = super.possibleTargets(sourceId, playerId, game);
|
||||
Set<SubType> subTypes = this.getTargets()
|
||||
public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) {
|
||||
if (!super.canTarget(playerId, id, source, game)) {
|
||||
return false;
|
||||
}
|
||||
Card card = game.getCard(id);
|
||||
return card != null
|
||||
&& this
|
||||
.getTargets()
|
||||
.stream()
|
||||
.map(game::getCard)
|
||||
.map(card -> card.getSubtype(game))
|
||||
.filter(Objects::nonNull)
|
||||
.map(c -> c.getSubtype(game))
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toSet());
|
||||
subTypes.removeIf(subType -> subType != SubType.FOREST && subType != SubType.PLAINS);
|
||||
possibleTargets.removeIf(uuid -> {
|
||||
Card card = game.getCard(uuid);
|
||||
return card != null && subTypes.stream().anyMatch(subType -> card.hasSubtype(subType, game));
|
||||
});
|
||||
return possibleTargets;
|
||||
.filter(subType -> subType == SubType.FOREST || subType == SubType.PLAINS)
|
||||
.noneMatch(subType -> card.hasSubtype(subType, game));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue