Search in sources :

Example 1 with AdventureCardSpell

use of mage.cards.AdventureCardSpell in project mage by magefree.

the class AdventureCastFromExileEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Spell spell = game.getStack().getSpell(source.getId());
        if (spell != null) {
            Card spellCard = spell.getCard();
            if (spellCard instanceof AdventureCardSpell) {
                UUID exileId = adventureExileId(controller.getId(), game);
                game.getExile().createZone(exileId, "On an Adventure from " + controller.getName());
                AdventureCardSpell adventureSpellCard = (AdventureCardSpell) spellCard;
                Card parentCard = adventureSpellCard.getParentCard();
                if (controller.moveCardsToExile(parentCard, source, game, true, exileId, "On an Adventure from " + controller.getName())) {
                    ContinuousEffect effect = new AdventureCastFromExileEffect();
                    effect.setTargetPointer(new FixedTarget(parentCard, game));
                    game.addEffect(effect, source);
                }
            }
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) AdventureCardSpell(mage.cards.AdventureCardSpell) ContinuousEffect(mage.abilities.effects.ContinuousEffect) UUID(java.util.UUID) Spell(mage.game.stack.Spell) AdventureCardSpell(mage.cards.AdventureCardSpell) Card(mage.cards.Card)

Aggregations

UUID (java.util.UUID)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 AdventureCardSpell (mage.cards.AdventureCardSpell)1 Card (mage.cards.Card)1 Spell (mage.game.stack.Spell)1 Player (mage.players.Player)1 FixedTarget (mage.target.targetpointer.FixedTarget)1