Search in sources :

Example 6 with TransformSourceEffect

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

the class ProfaneProcessionEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    UUID exileId = CardUtil.getCardExileZoneId(game, source);
    MageObject sourceObject = source.getSourceObject(game);
    if (controller != null && exileId != null && sourceObject != null) {
        new ExileTargetEffect(exileId, sourceObject.getIdName()).setTargetPointer(targetPointer).apply(game, source);
        game.getState().processAction(game);
        ExileZone exileZone = game.getExile().getExileZone(exileId);
        if (exileZone != null && exileZone.size() > 2) {
            new TransformSourceEffect().apply(game, source);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) TransformSourceEffect(mage.abilities.effects.common.TransformSourceEffect) MageObject(mage.MageObject) ExileZone(mage.game.ExileZone) UUID(java.util.UUID) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect)

Example 7 with TransformSourceEffect

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

the class SearchForAzcantaLookLibraryEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = source.getSourceObject(game);
    if (controller != null && sourceObject != null) {
        if (controller.getLibrary().hasCards()) {
            Card card = controller.getLibrary().getFromTop(game);
            if (card != null) {
                controller.lookAtCards(sourceObject.getIdName(), new CardsImpl(card), game);
                if (controller.chooseUse(Outcome.Neutral, "Put that card into your graveyard?", source, game)) {
                    controller.moveCards(card, Zone.GRAVEYARD, source, game);
                }
                if (controller.getGraveyard().size() > 6 && controller.chooseUse(Outcome.Neutral, "Transform " + sourceObject.getLogName() + "?", source, game)) {
                    new TransformSourceEffect().apply(game, source);
                }
            }
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) TransformSourceEffect(mage.abilities.effects.common.TransformSourceEffect) MageObject(mage.MageObject) CardsImpl(mage.cards.CardsImpl) Card(mage.cards.Card)

Example 8 with TransformSourceEffect

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

the class SmolderingEggEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = source.getSourcePermanentIfItStillExists(game);
    if (permanent == null) {
        return false;
    }
    Spell spell = (Spell) getValue("spellCast");
    if (spell != null) {
        permanent.addCounters(CounterType.EMBER.createInstance(ManaPaidSourceWatcher.getTotalPaid(spell.getId(), game)), source.getControllerId(), source, game);
    }
    int counters = permanent.getCounters(game).getCount(CounterType.EMBER);
    if (counters < 7) {
        return true;
    }
    permanent.removeCounters(CounterType.EMBER.createInstance(counters), source, game);
    new TransformSourceEffect().apply(game, source);
    return true;
}
Also used : Permanent(mage.game.permanent.Permanent) TransformSourceEffect(mage.abilities.effects.common.TransformSourceEffect) Spell(mage.game.stack.Spell)

Example 9 with TransformSourceEffect

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

the class DelverOfSecretsEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
    if (player == null || sourcePermanent == null) {
        return false;
    }
    if (player.getLibrary().hasCards()) {
        Card card = player.getLibrary().getFromTop(game);
        if (card == null) {
            return false;
        }
        Cards cards = new CardsImpl();
        cards.add(card);
        player.lookAtCards(sourcePermanent.getName(), cards, game);
        if (player.chooseUse(Outcome.DrawCard, "Reveal the top card of your library?", source, game)) {
            player.revealCards(sourcePermanent.getName(), cards, game);
            if (filter.match(card, game)) {
                return new TransformSourceEffect().apply(game, source);
            }
        }
    }
    return true;
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) TransformSourceEffect(mage.abilities.effects.common.TransformSourceEffect) FilterCard(mage.filter.FilterCard) FilterInstantOrSorceryCard(mage.filter.common.FilterInstantOrSorceryCard)

Example 10 with TransformSourceEffect

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

the class AzorsGatewayEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    UUID exileId = CardUtil.getCardExileZoneId(game, source);
    MageObject sourceObject = source.getSourceObject(game);
    if (controller != null && exileId != null && sourceObject != null) {
        controller.drawCards(1, source, game);
        TargetCardInHand target = new TargetCardInHand();
        controller.choose(outcome, target, source.getSourceId(), game);
        Card cardToExile = game.getCard(target.getFirstTarget());
        if (cardToExile != null) {
            controller.moveCardsToExile(cardToExile, source, game, true, exileId, sourceObject.getIdName());
        }
        Set<Integer> usedCMC = new HashSet<>();
        ExileZone exileZone = game.getExile().getExileZone(exileId);
        if (exileZone != null) {
            for (Card card : exileZone.getCards(game)) {
                usedCMC.add(card.getManaValue());
            }
            if (usedCMC.size() > 4) {
                controller.gainLife(4, game, source);
                new UntapSourceEffect().apply(game, source);
                new TransformSourceEffect().apply(game, source);
            }
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) TargetCardInHand(mage.target.common.TargetCardInHand) TransformSourceEffect(mage.abilities.effects.common.TransformSourceEffect) MageObject(mage.MageObject) UntapSourceEffect(mage.abilities.effects.common.UntapSourceEffect) ExileZone(mage.game.ExileZone) UUID(java.util.UUID) Card(mage.cards.Card) HashSet(java.util.HashSet)

Aggregations

TransformSourceEffect (mage.abilities.effects.common.TransformSourceEffect)10 Player (mage.players.Player)8 Permanent (mage.game.permanent.Permanent)6 UUID (java.util.UUID)3 MageObject (mage.MageObject)3 Card (mage.cards.Card)2 ExileZone (mage.game.ExileZone)2 HashSet (java.util.HashSet)1 MageInt (mage.MageInt)1 Ability (mage.abilities.Ability)1 BeginningOfUpkeepTriggeredAbility (mage.abilities.common.BeginningOfUpkeepTriggeredAbility)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)1 UntapSourceEffect (mage.abilities.effects.common.UntapSourceEffect)1 FlyingAbility (mage.abilities.keyword.FlyingAbility)1 TransformAbility (mage.abilities.keyword.TransformAbility)1 CardImpl (mage.cards.CardImpl)1 CardSetInfo (mage.cards.CardSetInfo)1 CardsImpl (mage.cards.CardsImpl)1