Search in sources :

Example 1 with LandfallAbility

use of mage.abilities.common.LandfallAbility in project mage by magefree.

the class EmeriaShepherdReturnToHandTargetEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent triggeringLand = ((LandfallAbility) source).getTriggeringPermanent();
    if (controller == null || triggeringLand == null) {
        return false;
    }
    Zone toZone = Zone.HAND;
    if (triggeringLand.hasSubtype(SubType.PLAINS, game) && controller.chooseUse(Outcome.PutCardInPlay, "Put the card to battlefield instead?", source, game)) {
        toZone = Zone.BATTLEFIELD;
    }
    return controller.moveCards(new CardsImpl(targetPointer.getTargets(game, source)), toZone, source, game);
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) Zone(mage.constants.Zone) LandfallAbility(mage.abilities.common.LandfallAbility) CardsImpl(mage.cards.CardsImpl)

Aggregations

LandfallAbility (mage.abilities.common.LandfallAbility)1 CardsImpl (mage.cards.CardsImpl)1 Zone (mage.constants.Zone)1 Permanent (mage.game.permanent.Permanent)1 Player (mage.players.Player)1