Search in sources :

Example 6 with BecomesCreatureTargetEffect

use of mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect in project mage by magefree.

the class MercurialTransformationEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    Token token;
    if (player.chooseUse(outcome, "1/1 Frog or 4/4 Octopus?", null, "Frog", "Octopus", source, game)) {
        token = new CreatureToken(1, 1).withColor("U").withSubType(SubType.FROG);
    } else {
        token = new CreatureToken(4, 4).withColor("U").withSubType(SubType.OCTOPUS);
    }
    game.addEffect(new BecomesCreatureTargetEffect(token, true, false, Duration.EndOfTurn), source);
    return true;
}
Also used : Player(mage.players.Player) BecomesCreatureTargetEffect(mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect) CreatureToken(mage.game.permanent.token.custom.CreatureToken) Token(mage.game.permanent.token.Token) CreatureToken(mage.game.permanent.token.custom.CreatureToken)

Example 7 with BecomesCreatureTargetEffect

use of mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect in project mage by magefree.

the class NissaOfShadowedBoughsCreatureEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null || !player.chooseUse(Outcome.BecomeCreature, "Have it become a creature?", source, game)) {
        return false;
    }
    game.addEffect(new BecomesCreatureTargetEffect(new CreatureToken(3, 3, "", SubType.ELEMENTAL).withAbility(HasteAbility.getInstance()).withAbility(new MenaceAbility()), false, true, Duration.EndOfTurn), source);
    return true;
}
Also used : Player(mage.players.Player) MenaceAbility(mage.abilities.keyword.MenaceAbility) BecomesCreatureTargetEffect(mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect) CreatureToken(mage.game.permanent.token.custom.CreatureToken)

Example 8 with BecomesCreatureTargetEffect

use of mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect in project mage by magefree.

the class NissaWorldwakerToken method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return false;
    }
    TargetCardInLibrary target = new TargetCardInLibrary(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_BASIC_LAND);
    if (controller.searchLibrary(target, source, game)) {
        if (!target.getTargets().isEmpty()) {
            for (UUID cardId : target.getTargets()) {
                Card card = controller.getLibrary().getCard(cardId, game);
                if (card != null) {
                    if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
                        Permanent land = game.getPermanent(card.getId());
                        if (land != null) {
                            ContinuousEffect effect = new BecomesCreatureTargetEffect(new NissaWorldwakerToken(), false, true, Duration.Custom);
                            effect.setTargetPointer(new FixedTarget(land, game));
                            game.addEffect(effect, source);
                        }
                    }
                }
            }
        }
    }
    controller.shuffleLibrary(source, game);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) FilterControlledLandPermanent(mage.filter.common.FilterControlledLandPermanent) TargetPermanent(mage.target.TargetPermanent) BecomesCreatureTargetEffect(mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) UUID(java.util.UUID) TargetCardInLibrary(mage.target.common.TargetCardInLibrary) Card(mage.cards.Card)

Example 9 with BecomesCreatureTargetEffect

use of mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect in project mage by magefree.

the class LifecraftAwakeningToken method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getTargets().getFirstTarget());
    if (!permanent.isCreature(game) && !permanent.hasSubtype(SubType.VEHICLE, game)) {
        ContinuousEffect continuousEffect = new BecomesCreatureTargetEffect(new LifecraftAwakeningToken(), false, true, Duration.Custom);
        continuousEffect.setTargetPointer(new FixedTarget(permanent, game));
        game.addEffect(continuousEffect, source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) TargetArtifactPermanent(mage.target.common.TargetArtifactPermanent) Permanent(mage.game.permanent.Permanent) FilterArtifactPermanent(mage.filter.common.FilterArtifactPermanent) BecomesCreatureTargetEffect(mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Example 10 with BecomesCreatureTargetEffect

use of mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect in project mage by magefree.

the class HuntingWildsToken method apply.

@Override
public boolean apply(Game game, Ability source) {
    for (Effect sourceEffect : source.getEffects()) {
        if (sourceEffect instanceof SearchLibraryPutInPlayEffect) {
            Cards foundCards = new CardsImpl(((SearchLibraryPutInPlayEffect) sourceEffect).getTargets());
            if (!foundCards.isEmpty()) {
                FixedTargets fixedTargets = new FixedTargets(foundCards, game);
                UntapTargetEffect untapEffect = new UntapTargetEffect();
                untapEffect.setTargetPointer(fixedTargets);
                untapEffect.apply(game, source);
                BecomesCreatureTargetEffect becomesCreatureEffect = new BecomesCreatureTargetEffect(new HuntingWildsToken(), false, true, Duration.Custom);
                becomesCreatureEffect.setTargetPointer(fixedTargets);
                game.addEffect(becomesCreatureEffect, source);
            }
            return true;
        }
    }
    return false;
}
Also used : FixedTargets(mage.target.targetpointer.FixedTargets) BecomesCreatureTargetEffect(mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect) ConditionalOneShotEffect(mage.abilities.decorator.ConditionalOneShotEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) BecomesCreatureTargetEffect(mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect) UntapTargetEffect(mage.abilities.effects.common.UntapTargetEffect) SearchLibraryPutInPlayEffect(mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect) Effect(mage.abilities.effects.Effect) UntapTargetEffect(mage.abilities.effects.common.UntapTargetEffect) Cards(mage.cards.Cards) CardsImpl(mage.cards.CardsImpl) SearchLibraryPutInPlayEffect(mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect)

Aggregations

BecomesCreatureTargetEffect (mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect)12 ContinuousEffect (mage.abilities.effects.ContinuousEffect)5 Permanent (mage.game.permanent.Permanent)4 Player (mage.players.Player)4 FixedTarget (mage.target.targetpointer.FixedTarget)4 CreatureToken (mage.game.permanent.token.custom.CreatureToken)3 TargetPermanent (mage.target.TargetPermanent)3 UUID (java.util.UUID)2 PermanentsOnBattlefieldCount (mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount)2 Effect (mage.abilities.effects.Effect)2 OneShotEffect (mage.abilities.effects.OneShotEffect)2 Card (mage.cards.Card)2 TargetCardInLibrary (mage.target.common.TargetCardInLibrary)2 ReflexiveTriggeredAbility (mage.abilities.common.delayed.ReflexiveTriggeredAbility)1 ConditionalOneShotEffect (mage.abilities.decorator.ConditionalOneShotEffect)1 UntapTargetEffect (mage.abilities.effects.common.UntapTargetEffect)1 AddCountersSourceEffect (mage.abilities.effects.common.counter.AddCountersSourceEffect)1 AddCountersTargetEffect (mage.abilities.effects.common.counter.AddCountersTargetEffect)1 SearchLibraryPutInPlayEffect (mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect)1 Hint (mage.abilities.hint.Hint)1