Search in sources :

Example 1 with ReturnFromGraveyardToHandTargetEffect

use of mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect in project mage by magefree.

the class CustomTestCard method addCustomEffect_ReturnFromAnyToHand.

/**
 * Return target card to hand that can be called by text "return from ..."
 *
 * @param controller
 */
protected void addCustomEffect_ReturnFromAnyToHand(TestPlayer controller) {
    // graveyard
    Ability ability = new SimpleActivatedAbility(new ReturnFromGraveyardToHandTargetEffect().setText("return from graveyard"), new ManaCostsImpl(""));
    ability.addTarget(new TargetCardInGraveyard(StaticFilters.FILTER_CARD));
    addCustomCardWithAbility("return from graveyard for " + controller.getName(), controller, ability);
    // exile
    ability = new SimpleActivatedAbility(new ReturnFromExileEffect(Zone.HAND).setText("return from exile"), new ManaCostsImpl(""));
    ability.addTarget(new TargetCardInExile(StaticFilters.FILTER_CARD));
    addCustomCardWithAbility("return from exile for " + controller.getName(), controller, ability);
    // library
    ability = new SimpleActivatedAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD)).setText("return from library"), new ManaCostsImpl(""));
    addCustomCardWithAbility("return from library for " + controller.getName(), controller, ability);
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SpellAbility(mage.abilities.SpellAbility) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) Ability(mage.abilities.Ability) TargetCardInGraveyard(mage.target.common.TargetCardInGraveyard) ReturnFromExileEffect(mage.abilities.effects.common.ReturnFromExileEffect) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) TargetCardInExile(mage.target.common.TargetCardInExile) SearchLibraryPutInHandEffect(mage.abilities.effects.common.search.SearchLibraryPutInHandEffect) ReturnFromGraveyardToHandTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) TargetCardInLibrary(mage.target.common.TargetCardInLibrary)

Example 2 with ReturnFromGraveyardToHandTargetEffect

use of mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect in project mage by magefree.

the class TianaShipsCaretakerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Card card = game.getCard(getTargetPointer().getFirst(game, source));
    if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
        Effect effect = new ReturnFromGraveyardToHandTargetEffect();
        effect.setTargetPointer(new FixedTarget(card, game));
        effect.setText("return that card to your hand at the beginning of the next end step");
        game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) OneShotEffect(mage.abilities.effects.OneShotEffect) ReturnFromGraveyardToHandTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect) Effect(mage.abilities.effects.Effect) ReturnFromGraveyardToHandTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect) Card(mage.cards.Card)

Example 3 with ReturnFromGraveyardToHandTargetEffect

use of mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect in project mage by magefree.

the class EdgarsAwakeningTriggeredAbility method makeAbility.

private static final ReflexiveTriggeredAbility makeAbility() {
    ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect(), false, "return target creature card from your graveyard to your hand");
    ability.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
    return ability;
}
Also used : ReflexiveTriggeredAbility(mage.abilities.common.delayed.ReflexiveTriggeredAbility) TargetCardInYourGraveyard(mage.target.common.TargetCardInYourGraveyard) ReturnFromGraveyardToHandTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect)

Example 4 with ReturnFromGraveyardToHandTargetEffect

use of mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect in project mage by magefree.

the class RienneAngelOfRebirthEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Card card = game.getCard(getTargetPointer().getFirst(game, source));
    if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
        Effect effect = new ReturnFromGraveyardToHandTargetEffect();
        effect.setTargetPointer(new FixedTarget(card, game));
        effect.setText("return that card to your hand at the beginning of the next end step");
        game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) OneShotEffect(mage.abilities.effects.OneShotEffect) ReturnFromGraveyardToHandTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect) Effect(mage.abilities.effects.Effect) BoostControlledEffect(mage.abilities.effects.common.continuous.BoostControlledEffect) ReturnFromGraveyardToHandTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect) Card(mage.cards.Card)

Aggregations

ReturnFromGraveyardToHandTargetEffect (mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect)4 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)2 Effect (mage.abilities.effects.Effect)2 OneShotEffect (mage.abilities.effects.OneShotEffect)2 Card (mage.cards.Card)2 FixedTarget (mage.target.targetpointer.FixedTarget)2 Ability (mage.abilities.Ability)1 SpellAbility (mage.abilities.SpellAbility)1 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)1 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)1 ReflexiveTriggeredAbility (mage.abilities.common.delayed.ReflexiveTriggeredAbility)1 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)1 ReturnFromExileEffect (mage.abilities.effects.common.ReturnFromExileEffect)1 BoostControlledEffect (mage.abilities.effects.common.continuous.BoostControlledEffect)1 SearchLibraryPutInHandEffect (mage.abilities.effects.common.search.SearchLibraryPutInHandEffect)1 TargetCardInExile (mage.target.common.TargetCardInExile)1 TargetCardInGraveyard (mage.target.common.TargetCardInGraveyard)1 TargetCardInLibrary (mage.target.common.TargetCardInLibrary)1 TargetCardInYourGraveyard (mage.target.common.TargetCardInYourGraveyard)1