mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
- ReturnFromGraveyardToHandTargetEffect() will now check to verify the target card is still in the graveyard.
This commit is contained in:
parent
087c437658
commit
d8a928051a
2 changed files with 12 additions and 40 deletions
|
@ -47,40 +47,4 @@ public final class GreenwardenOfMurasa extends CardImpl {
|
|||
public GreenwardenOfMurasa copy() {
|
||||
return new GreenwardenOfMurasa(this);
|
||||
}
|
||||
}
|
||||
|
||||
//class GreenwardenOfMurasaEffect extends OneShotEffect {
|
||||
//
|
||||
// public GreenwardenOfMurasaEffect() {
|
||||
// super(Outcome.Benefit);
|
||||
// this.staticText = "you may exile it. If you do, return target card from your graveyard to your hand";
|
||||
// }
|
||||
//
|
||||
// public GreenwardenOfMurasaEffect(final GreenwardenOfMurasaEffect effect) {
|
||||
// super(effect);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public GreenwardenOfMurasaEffect copy() {
|
||||
// return new GreenwardenOfMurasaEffect(this);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean apply(Game game, Ability source) {
|
||||
// Player controller = game.getPlayer(source.getControllerId());
|
||||
// MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
// Card targetCard = game.getCard(getTargetPointer().getFirst(game, source));
|
||||
// if (controller != null && sourceObject != null && targetCard != null) {
|
||||
// if (controller.chooseUse(outcome, "Exile " + sourceObject.getLogName() + " to return card from your graveyard to your hand?", source, game)) {
|
||||
// // Setting the fixed target prevents to return Greenwarden of Murasa itself (becuase it's exiled meanwhile),
|
||||
// // but of course you can target it as the ability triggers I guess
|
||||
// Effect effect = new ReturnToHandTargetEffect();
|
||||
// effect.setTargetPointer(new FixedTarget(targetCard.getId(), targetCard.getZoneChangeCounter(game)));
|
||||
// new ExileSourceEffect().apply(game, source);
|
||||
// return effect.apply(game, source);
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
|
@ -34,8 +35,15 @@ public class ReturnFromGraveyardToHandTargetEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
return controller.moveCards(new CardsImpl(getTargetPointer().getTargets(game, source)), Zone.HAND, source, game);
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cardsInGraveyard = new CardsImpl(getTargetPointer().getTargets(game, source));
|
||||
for (Card card : cardsInGraveyard.getCards(game)) {
|
||||
if (card != null
|
||||
&& game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
|
||||
controller.moveCards(card, Zone.HAND, source, game); //verify the target card is still in the graveyard
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue