mirror of
https://github.com/correl/mage.git
synced 2025-04-09 01:01:06 -09:00
fixed some issues with targets that require different names
This commit is contained in:
parent
fbfb55f99c
commit
1c4e8db236
2 changed files with 26 additions and 20 deletions
Mage.Sets/src/mage/cards
|
@ -17,7 +17,10 @@ import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
import mage.target.common.TargetCardInYourGraveyard;
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
|
@ -90,18 +93,18 @@ class EerieUltimatumTarget extends TargetCardInYourGraveyard {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
public Set<UUID> possibleTargets(UUID sourceId, UUID playerId, Game game) {
|
||||||
if (!super.canTarget(controllerId, id, source, game)) {
|
Set<UUID> possibleTargets = super.possibleTargets(sourceId, playerId, game);
|
||||||
return false;
|
Set<String> names = this.getTargets()
|
||||||
}
|
|
||||||
Card card = game.getCard(id);
|
|
||||||
if (card == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return this.getTargets()
|
|
||||||
.stream()
|
.stream()
|
||||||
.map(game::getCard)
|
.map(game::getCard)
|
||||||
.map(MageObject::getName)
|
.map(MageObject::getName)
|
||||||
.noneMatch(card.getName()::equals);
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
possibleTargets.removeIf(uuid -> {
|
||||||
|
Card card = game.getCard(uuid);
|
||||||
|
return card != null && names.contains(card.getName());
|
||||||
|
});
|
||||||
|
return possibleTargets;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,10 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInHand;
|
import mage.target.common.TargetCardInHand;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
|
@ -127,18 +130,18 @@ class OrmosArchiveKeeperTarget extends TargetCardInHand {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
public Set<UUID> possibleTargets(UUID sourceId, UUID playerId, Game game) {
|
||||||
if (!super.canTarget(controllerId, id, source, game)) {
|
Set<UUID> possibleTargets = super.possibleTargets(sourceId, playerId, game);
|
||||||
return false;
|
Set<String> names = this.getTargets()
|
||||||
}
|
|
||||||
Card card = game.getCard(id);
|
|
||||||
if (card == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return this.getTargets()
|
|
||||||
.stream()
|
.stream()
|
||||||
.map(game::getCard)
|
.map(game::getCard)
|
||||||
.map(MageObject::getName)
|
.map(MageObject::getName)
|
||||||
.noneMatch(card.getName()::equals);
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
possibleTargets.removeIf(uuid -> {
|
||||||
|
Card card = game.getCard(uuid);
|
||||||
|
return card != null && names.contains(card.getName());
|
||||||
|
});
|
||||||
|
return possibleTargets;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue