mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +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 mage.target.common.TargetCardInLibrary;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
|
@ -91,20 +90,21 @@ class YasharnImplacableEarthTarget extends TargetCardInLibrary {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> possibleTargets(UUID sourceId, UUID playerId, Game game) {
|
public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) {
|
||||||
Set<UUID> possibleTargets = super.possibleTargets(sourceId, playerId, game);
|
if (!super.canTarget(playerId, id, source, game)) {
|
||||||
Set<SubType> subTypes = this.getTargets()
|
return false;
|
||||||
|
}
|
||||||
|
Card card = game.getCard(id);
|
||||||
|
return card != null
|
||||||
|
&& this
|
||||||
|
.getTargets()
|
||||||
.stream()
|
.stream()
|
||||||
.map(game::getCard)
|
.map(game::getCard)
|
||||||
.map(card -> card.getSubtype(game))
|
.filter(Objects::nonNull)
|
||||||
|
.map(c -> c.getSubtype(game))
|
||||||
.flatMap(Collection::stream)
|
.flatMap(Collection::stream)
|
||||||
.collect(Collectors.toSet());
|
.filter(subType -> subType == SubType.FOREST || subType == SubType.PLAINS)
|
||||||
subTypes.removeIf(subType -> subType != SubType.FOREST && subType != SubType.PLAINS);
|
.noneMatch(subType -> card.hasSubtype(subType, game));
|
||||||
possibleTargets.removeIf(uuid -> {
|
|
||||||
Card card = game.getCard(uuid);
|
|
||||||
return card != null && subTypes.stream().anyMatch(subType -> card.hasSubtype(subType, game));
|
|
||||||
});
|
|
||||||
return possibleTargets;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue