Quicksilver Geyser

This commit is contained in:
Loki 2011-08-05 21:16:34 +03:00
parent 024c506522
commit 87a6273a06
2 changed files with 103 additions and 36 deletions

View file

@ -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<QuicksilverGeyser> {
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);
}
}

View file

@ -37,50 +37,55 @@ import mage.cards.Card;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import java.util.UUID;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class ReturnToHandTargetEffect extends OneShotEffect<ReturnToHandTargetEffect> { public class ReturnToHandTargetEffect extends OneShotEffect<ReturnToHandTargetEffect> {
public ReturnToHandTargetEffect() { public ReturnToHandTargetEffect() {
super(Outcome.ReturnToHand); super(Outcome.ReturnToHand);
} }
public ReturnToHandTargetEffect(final ReturnToHandTargetEffect effect) { public ReturnToHandTargetEffect(final ReturnToHandTargetEffect effect) {
super(effect); super(effect);
} }
@Override @Override
public ReturnToHandTargetEffect copy() { public ReturnToHandTargetEffect copy() {
return new ReturnToHandTargetEffect(this); return new ReturnToHandTargetEffect(this);
} }
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
if (source.getTargets().size() > 0) { boolean result = false;
switch (source.getTargets().get(0).getZone()) { for (UUID id : targetPointer.getTargets(source)) {
case BATTLEFIELD: switch (game.getZone(id)) {
Permanent permanent = game.getPermanent(source.getFirstTarget()); case BATTLEFIELD:
if (permanent != null) { Permanent permanent = game.getPermanent(id);
return permanent.moveToZone(Zone.HAND, source.getId(), game, false); if (permanent != null) {
} result |= permanent.moveToZone(Zone.HAND, source.getId(), game, false);
break; }
case GRAVEYARD: break;
Card card = game.getCard(source.getFirstTarget()); case GRAVEYARD:
if (card != null) { Card card = game.getCard(id);
return card.moveToZone(Zone.HAND, source.getId(), game, true); if (card != null) {
} result |= card.moveToZone(Zone.HAND, source.getId(), game, true);
break; }
} break;
} }
return false; }
} return result;
}
@Override @Override
public String getText(Mode mode) { public String getText(Mode mode) {
return "Return target " + mode.getTargets().get(0).getTargetName() + " to it's owner's hand"; 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";
}
}
} }