Search in sources :

Example 1 with ManifestEffect

use of mage.abilities.effects.keyword.ManifestEffect in project mage by magefree.

the class WildcallEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Card card = controller.getLibrary().getFromTop(game);
        if (card != null) {
            new ManifestEffect(1).apply(game, source);
            int xValue = source.getManaCostsToPay().getX();
            if (xValue > 0) {
                Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(xValue));
                effect.setTargetPointer(new FixedTarget(card.getId()));
                return effect.apply(game, source);
            }
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) ManifestEffect(mage.abilities.effects.keyword.ManifestEffect) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) ManifestEffect(mage.abilities.effects.keyword.ManifestEffect) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) Card(mage.cards.Card)

Example 2 with ManifestEffect

use of mage.abilities.effects.keyword.ManifestEffect in project mage by magefree.

the class BecomesAuraAttachToManifestSourceEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent enchantment = game.getPermanent(source.getSourceId());
    if (controller != null && enchantment != null) {
        // manifest top card
        Card card = controller.getLibrary().getFromTop(game);
        if (card != null) {
            new ManifestEffect(1).apply(game, source);
            Permanent enchantedCreature = game.getPermanent(card.getId());
            if (enchantedCreature != null) {
                enchantedCreature.addAttachment(enchantment.getId(), source, game);
                FilterCreaturePermanent filter = new FilterCreaturePermanent();
                Target target = new TargetCreaturePermanent(filter);
                target.addTarget(enchantedCreature.getId(), source, game);
                game.addEffect(new BecomesAuraSourceEffect(target), source);
            }
        }
        return true;
    }
    return false;
}
Also used : TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) Player(mage.players.Player) Target(mage.target.Target) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) ManifestEffect(mage.abilities.effects.keyword.ManifestEffect) BecomesAuraSourceEffect(mage.abilities.effects.common.continuous.BecomesAuraSourceEffect) Card(mage.cards.Card)

Example 3 with ManifestEffect

use of mage.abilities.effects.keyword.ManifestEffect in project mage by magefree.

the class FierceInvocationEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Card card = controller.getLibrary().getFromTop(game);
        if (card != null) {
            new ManifestEffect(1).apply(game, source);
            Permanent permanent = game.getPermanent(card.getId());
            if (permanent != null) {
                Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(2));
                effect.setTargetPointer(new FixedTarget(permanent, game));
                return effect.apply(game, source);
            }
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) ManifestEffect(mage.abilities.effects.keyword.ManifestEffect) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) ManifestEffect(mage.abilities.effects.keyword.ManifestEffect) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) Card(mage.cards.Card)

Example 4 with ManifestEffect

use of mage.abilities.effects.keyword.ManifestEffect in project mage by magefree.

the class FormlessNurturingEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Card card = controller.getLibrary().getFromTop(game);
        if (card != null) {
            new ManifestEffect(1).apply(game, source);
            Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance());
            effect.setTargetPointer(new FixedTarget(card.getId()));
            return effect.apply(game, source);
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) ManifestEffect(mage.abilities.effects.keyword.ManifestEffect) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) ManifestEffect(mage.abilities.effects.keyword.ManifestEffect) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) Card(mage.cards.Card)

Example 5 with ManifestEffect

use of mage.abilities.effects.keyword.ManifestEffect in project mage by magefree.

the class WriteIntoBeingEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = game.getObject(source.getSourceId());
    if (sourceObject != null && controller != null) {
        Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 2));
        controller.lookAtCards(source, null, cards, game);
        Card cardToManifest = null;
        if (cards.size() > 1) {
            TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to manifest"));
            if (controller.chooseTarget(outcome, cards, target, source, game)) {
                cardToManifest = cards.get(target.getFirstTarget(), game);
            }
        } else {
            cardToManifest = cards.getRandom(game);
        }
        if (!controller.getLibrary().getFromTop(game).equals(cardToManifest)) {
            Card cardToPutBack = controller.getLibrary().removeFromTop(game);
            cardToManifest = controller.getLibrary().removeFromTop(game);
            controller.getLibrary().putOnTop(cardToPutBack, game);
            controller.getLibrary().putOnTop(cardToManifest, game);
        }
        new ManifestEffect(1).apply(game, source);
        if (controller.getLibrary().hasCards()) {
            Card cardToPutBack = controller.getLibrary().getFromTop(game);
            if (controller.chooseUse(Outcome.Detriment, "Put " + cardToPutBack.getName() + " on bottom of library?", source, game)) {
                controller.putCardsOnBottomOfLibrary(cardToPutBack, game, source, true);
            } else {
                controller.putCardsOnTopOfLibrary(cardToPutBack, game, source, true);
            }
        }
        return true;
    }
    return false;
}
Also used : FilterCard(mage.filter.FilterCard) Player(mage.players.Player) ManifestEffect(mage.abilities.effects.keyword.ManifestEffect) MageObject(mage.MageObject) TargetCard(mage.target.TargetCard) Cards(mage.cards.Cards) CardsImpl(mage.cards.CardsImpl) FilterCard(mage.filter.FilterCard) TargetCard(mage.target.TargetCard) Card(mage.cards.Card)

Aggregations

ManifestEffect (mage.abilities.effects.keyword.ManifestEffect)5 Card (mage.cards.Card)5 Player (mage.players.Player)5 Effect (mage.abilities.effects.Effect)3 OneShotEffect (mage.abilities.effects.OneShotEffect)3 AddCountersTargetEffect (mage.abilities.effects.common.counter.AddCountersTargetEffect)3 FixedTarget (mage.target.targetpointer.FixedTarget)3 Permanent (mage.game.permanent.Permanent)2 MageObject (mage.MageObject)1 BecomesAuraSourceEffect (mage.abilities.effects.common.continuous.BecomesAuraSourceEffect)1 Cards (mage.cards.Cards)1 CardsImpl (mage.cards.CardsImpl)1 FilterCard (mage.filter.FilterCard)1 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)1 Target (mage.target.Target)1 TargetCard (mage.target.TargetCard)1 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)1