Search in sources :

Example 6 with ReturnToBattlefieldUnderYourControlTargetEffect

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

the class SirensRuseEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    boolean isPirate = false;
    Player player = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent != null && permanent.hasSubtype(SubType.PIRATE, game)) {
        isPirate = true;
    }
    if (super.apply(game, source)) {
        new ReturnToBattlefieldUnderYourControlTargetEffect(false).apply(game, source);
        if (isPirate && player != null) {
            player.drawCards(1, source, game);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) ReturnToBattlefieldUnderYourControlTargetEffect(mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect)

Example 7 with ReturnToBattlefieldUnderYourControlTargetEffect

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

the class ThunderkinAwakenerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Card creatureCard = game.getCard(this.getTargetPointer().getFirst(game, source));
    if (controller != null && creatureCard != null) {
        // Return that card to the battlefield tapped and attacking
        Effect effect = new ReturnToBattlefieldUnderYourControlTargetEffect(false, true, true);
        effect.setTargetPointer(new FixedTarget(creatureCard.getId()));
        effect.apply(game, source);
        Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
        if (permanent != null) {
            // Sacrifice it at the beginning of the next end step
            SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("Sacrifice " + permanent.getName(), source.getControllerId());
            sacrificeEffect.setTargetPointer(new FixedTarget(permanent, game));
            DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
            game.addDelayedTriggeredAbility(delayedAbility, source);
            // info
            InfoEffect.addInfoToPermanent(game, source, permanent, "<i><b>Warning</b>: It will be sacrificed at the beginning of the next end step<i>");
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) ObjectSourcePlayer(mage.filter.predicate.ObjectSourcePlayer) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) Permanent(mage.game.permanent.Permanent) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) DelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility) ReturnToBattlefieldUnderYourControlTargetEffect(mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect) ReturnToBattlefieldUnderYourControlTargetEffect(mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) InfoEffect(mage.abilities.effects.common.InfoEffect) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) FilterCreatureCard(mage.filter.common.FilterCreatureCard) Card(mage.cards.Card) FilterCard(mage.filter.FilterCard)

Example 8 with ReturnToBattlefieldUnderYourControlTargetEffect

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

the class MarchesaTheBlackRoseEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Card card = game.getCard(getTargetPointer().getFirst(game, source));
    if (card != null) {
        Effect effect = new ReturnToBattlefieldUnderYourControlTargetEffect();
        effect.setText("return that card to the battlefield under your control at the beginning of the next end step");
        DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
        delayedAbility.getEffects().get(0).setTargetPointer(getTargetPointer());
        game.addDelayedTriggeredAbility(delayedAbility, source);
        return true;
    }
    return false;
}
Also used : AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) DelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) ReturnToBattlefieldUnderYourControlTargetEffect(mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect) GainAbilityControlledEffect(mage.abilities.effects.common.continuous.GainAbilityControlledEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) ReturnToBattlefieldUnderYourControlTargetEffect(mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect) Effect(mage.abilities.effects.Effect) Card(mage.cards.Card)

Example 9 with ReturnToBattlefieldUnderYourControlTargetEffect

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

the class ArgentSphinxEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Permanent permanent = source.getSourcePermanentIfItStillExists(game);
    if (player == null || permanent == null) {
        return false;
    }
    Card card = permanent.getMainCard();
    player.moveCards(permanent, Zone.EXILED, source, game);
    // create delayed triggered ability
    game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnToBattlefieldUnderYourControlTargetEffect().setText("Return it to the battlefield under your control at the beginning of the next end step").setTargetPointer(new FixedTarget(card, game))), source);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) Permanent(mage.game.permanent.Permanent) ReturnToBattlefieldUnderYourControlTargetEffect(mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect) Card(mage.cards.Card)

Aggregations

ReturnToBattlefieldUnderYourControlTargetEffect (mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect)9 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)7 Permanent (mage.game.permanent.Permanent)7 FixedTarget (mage.target.targetpointer.FixedTarget)7 Player (mage.players.Player)6 Effect (mage.abilities.effects.Effect)5 OneShotEffect (mage.abilities.effects.OneShotEffect)5 Card (mage.cards.Card)4 FilterPermanent (mage.filter.FilterPermanent)3 TargetPermanent (mage.target.TargetPermanent)3 MageObject (mage.MageObject)2 DelayedTriggeredAbility (mage.abilities.DelayedTriggeredAbility)2 GetEmblemEffect (mage.abilities.effects.common.GetEmblemEffect)2 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)2 UUID (java.util.UUID)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 ExileTargetForSourceEffect (mage.abilities.effects.common.ExileTargetForSourceEffect)1 GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)1 InfoEffect (mage.abilities.effects.common.InfoEffect)1 LookLibraryAndPickControllerEffect (mage.abilities.effects.common.LookLibraryAndPickControllerEffect)1