diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/QuicksilverGeyser.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/QuicksilverGeyser.java new file mode 100644 index 0000000000..4b30e65ce7 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/QuicksilverGeyser.java @@ -0,0 +1,62 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * 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.sets.mirrodinbesieged; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.cards.CardImpl; +import mage.target.common.TargetNonlandPermanent; + +/** + * + * @author anonymous + */ +public class QuicksilverGeyser extends CardImpl { + + public QuicksilverGeyser(UUID ownerId) { + super(ownerId, 30, "Quicksilver Geyser", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{4}{U}"); + this.expansionSetCode = "MBS"; + + this.color.setBlue(true); + + // Return up to two target nonland permanents to their owners' hands. + this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()); + this.getSpellAbility().addTarget(new TargetNonlandPermanent(0, 2, false)); + } + + public QuicksilverGeyser(final QuicksilverGeyser card) { + super(card); + } + + @Override + public QuicksilverGeyser copy() { + return new QuicksilverGeyser(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/ReturnToHandTargetEffect.java b/Mage/src/mage/abilities/effects/common/ReturnToHandTargetEffect.java index 6e996aac03..9e682001df 100644 --- a/Mage/src/mage/abilities/effects/common/ReturnToHandTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/ReturnToHandTargetEffect.java @@ -37,50 +37,55 @@ import mage.cards.Card; import mage.game.Game; import mage.game.permanent.Permanent; +import java.util.UUID; + /** - * * @author BetaSteward_at_googlemail.com */ public class ReturnToHandTargetEffect extends OneShotEffect { - public ReturnToHandTargetEffect() { - super(Outcome.ReturnToHand); - } + public ReturnToHandTargetEffect() { + super(Outcome.ReturnToHand); + } - public ReturnToHandTargetEffect(final ReturnToHandTargetEffect effect) { - super(effect); - } + public ReturnToHandTargetEffect(final ReturnToHandTargetEffect effect) { + super(effect); + } - @Override - public ReturnToHandTargetEffect copy() { - return new ReturnToHandTargetEffect(this); - } + @Override + public ReturnToHandTargetEffect copy() { + return new ReturnToHandTargetEffect(this); + } - @Override - public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { - switch (source.getTargets().get(0).getZone()) { - case BATTLEFIELD: - Permanent permanent = game.getPermanent(source.getFirstTarget()); - if (permanent != null) { - return permanent.moveToZone(Zone.HAND, source.getId(), game, false); - } - break; - case GRAVEYARD: - Card card = game.getCard(source.getFirstTarget()); - if (card != null) { - return card.moveToZone(Zone.HAND, source.getId(), game, true); - } - break; - } - } - return false; - } + @Override + public boolean apply(Game game, Ability source) { + boolean result = false; + for (UUID id : targetPointer.getTargets(source)) { + switch (game.getZone(id)) { + case BATTLEFIELD: + Permanent permanent = game.getPermanent(id); + if (permanent != null) { + result |= permanent.moveToZone(Zone.HAND, source.getId(), game, false); + } + break; + case GRAVEYARD: + Card card = game.getCard(id); + if (card != null) { + result |= card.moveToZone(Zone.HAND, source.getId(), game, true); + } + break; + } + } + return result; + } - @Override - public String getText(Mode mode) { - return "Return target " + mode.getTargets().get(0).getTargetName() + " to it's owner's hand"; + @Override + public String getText(Mode mode) { + if (mode.getTargets().get(0).getNumberOfTargets() == 0 && mode.getTargets().get(0).getMaxNumberOfTargets() > 0) { + return "Return up to " + mode.getTargets().get(0).getMaxNumberOfTargets() +" target " + mode.getTargets().get(0).getTargetName() + " to their owners' hand"; + } else { + return "Return target " + mode.getTargets().get(0).getTargetName() + " to it's owner's hand"; + } + } - } - }