Fixed error I introduced in canTarget()

This commit is contained in:
Alex Vasile 2022-05-25 23:18:01 -06:00
parent 49c02387d4
commit 561a5a3d0e

View file

@ -31,16 +31,17 @@ public class TargetCardInASingleGraveyard extends TargetCard {
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
UUID firstTarget = this.getFirstTarget();
if (firstTarget == null) {
return false;
}
Card card = game.getCard(firstTarget);
Card targetCard = game.getCard(id);
if (card == null || targetCard == null || !card.isOwnedBy(targetCard.getOwnerId())) {
return false;
// If a card is already targeted, ensure that this new target has the same owner as currently chosen target
if (firstTarget != null) {
Card card = game.getCard(firstTarget);
Card targetCard = game.getCard(id);
if (card == null || targetCard == null || !card.isOwnedBy(targetCard.getOwnerId())) {
return false;
}
}
// If it has the same owner (or no target picked) check that it's a valid target with super
return super.canTarget(id, source, game);
}