mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
Fixed error I introduced in canTarget()
This commit is contained in:
parent
49c02387d4
commit
561a5a3d0e
1 changed files with 9 additions and 8 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue