From 88d66784dfdf010c3f16f27000860823c652f3bd Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 15 Jul 2016 14:25:25 +0200 Subject: [PATCH] * Crop Sigil - Fixed that it can't be activated without both a creature and land in the graveyard (fixes #2079 ). --- .../src/mage/sets/eldritchmoon/CropSigil.java | 8 +++---- .../src/main/java/mage/target/TargetCard.java | 23 ++++++++++--------- Mage/src/main/java/mage/target/Targets.java | 2 +- .../common/TargetCardInYourGraveyard.java | 7 ++---- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/Mage.Sets/src/mage/sets/eldritchmoon/CropSigil.java b/Mage.Sets/src/mage/sets/eldritchmoon/CropSigil.java index 75c61fd2103..66e8358a08b 100644 --- a/Mage.Sets/src/mage/sets/eldritchmoon/CropSigil.java +++ b/Mage.Sets/src/mage/sets/eldritchmoon/CropSigil.java @@ -43,7 +43,7 @@ import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.events.GameEvent; -import mage.target.common.TargetCardInGraveyard; +import mage.target.common.TargetCardInYourGraveyard; /** * @@ -71,10 +71,10 @@ public class CropSigil extends CardImpl { Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(true, true), new ManaCostsImpl<>("{2}{G}"), DeliriumCondition.getInstance(), "Delirium — {2}{G}, Sacrifice {this}: Return up to one target creature card and up to one target land card from your graveyard to your hand. " - + "Activate this ability only if there are four or more card types among cards in your graveyard"); + + "Activate this ability only if there are four or more card types among cards in your graveyard"); ability.addCost(new SacrificeSourceCost()); - ability.addTarget(new TargetCardInGraveyard(0, 1, filterCreature)); - ability.addTarget(new TargetCardInGraveyard(0, 1, filterLand)); + ability.addTarget(new TargetCardInYourGraveyard(0, 1, filterCreature)); + ability.addTarget(new TargetCardInYourGraveyard(0, 1, filterLand)); this.addAbility(ability); } diff --git a/Mage/src/main/java/mage/target/TargetCard.java b/Mage/src/main/java/mage/target/TargetCard.java index 92d00489275..04885dd42e5 100644 --- a/Mage/src/main/java/mage/target/TargetCard.java +++ b/Mage/src/main/java/mage/target/TargetCard.java @@ -24,21 +24,19 @@ * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. -*/ - + */ package mage.target; -import mage.constants.Zone; -import mage.cards.Card; -import mage.cards.Cards; -import mage.filter.FilterCard; -import mage.game.Game; -import mage.players.Player; - import java.util.HashSet; import java.util.Set; import java.util.UUID; +import mage.cards.Card; +import mage.cards.Cards; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.game.Game; import mage.game.events.GameEvent; +import mage.players.Player; /** * @@ -87,9 +85,12 @@ public class TargetCard extends TargetObject { @Override public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) { int possibleTargets = 0; - for (UUID playerId: game.getState().getPlayersInRange(sourceControllerId, game)) { + for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) { Player player = game.getPlayer(playerId); if (player != null) { + if (this.minNumberOfTargets == 0) { + return true; + } switch (zone) { case HAND: for (Card card : player.getHand().getCards(filter, sourceId, sourceControllerId, game)) { @@ -200,7 +201,7 @@ public class TargetCard extends TargetObject { public Set possibleTargets(UUID sourceControllerId, Cards cards, Game game) { Set possibleTargets = new HashSet<>(); - for (Card card: cards.getCards(filter, game)) { + for (Card card : cards.getCards(filter, game)) { possibleTargets.add(card.getId()); } return possibleTargets; diff --git a/Mage/src/main/java/mage/target/Targets.java b/Mage/src/main/java/mage/target/Targets.java index c29f1932d90..be2bbe1d6e8 100644 --- a/Mage/src/main/java/mage/target/Targets.java +++ b/Mage/src/main/java/mage/target/Targets.java @@ -121,7 +121,7 @@ public class Targets extends ArrayList { } } // it is legal when either there is no target or not all targets are illegal - return this.size() == 0 || this.size() != illegalCount; + return this.isEmpty() || this.size() != illegalCount; } /** diff --git a/Mage/src/main/java/mage/target/common/TargetCardInYourGraveyard.java b/Mage/src/main/java/mage/target/common/TargetCardInYourGraveyard.java index eba50fb268d..de6b3863873 100644 --- a/Mage/src/main/java/mage/target/common/TargetCardInYourGraveyard.java +++ b/Mage/src/main/java/mage/target/common/TargetCardInYourGraveyard.java @@ -30,10 +30,10 @@ package mage.target.common; import java.util.HashSet; import java.util.Set; import java.util.UUID; -import mage.constants.Zone; import mage.abilities.Ability; import mage.cards.Card; import mage.cards.Cards; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.game.Game; import mage.game.events.GameEvent; @@ -122,10 +122,7 @@ public class TargetCardInYourGraveyard extends TargetCard { */ @Override public boolean canChoose(UUID sourceControllerId, Game game) { - if (game.getPlayer(sourceControllerId).getGraveyard().count(filter, game) >= this.minNumberOfTargets) { - return true; - } - return false; + return game.getPlayer(sourceControllerId).getGraveyard().count(filter, game) >= this.minNumberOfTargets; } @Override