Package mage.game.stack

Examples of mage.game.stack.Spell


    }

    @Override
    public boolean applies(GameEvent event, Ability source, Game game) {
        if (event.getType() == GameEvent.EventType.COUNTER) {
            Spell spell = game.getStack().getSpell(event.getTargetId());
            if (spell != null && spell.getCardType().contains(CardType.CREATURE)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here


    }

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.SPELL_CAST) {
            Spell spell = game.getStack().getSpell(event.getTargetId());
            if (spell != null && spell.getColor().isRed()) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        MageObject sourceObject = game.getObject(source.getSourceId());
        if (sourceObject != null) {
            for (UUID targetId : getTargetPointer().getTargets(game, source) ) {
                Spell spell = game.getStack().getSpell(targetId);
                if (spell != null) {
                    game.getStack().counter(targetId, source.getSourceId(), game);
                    Player spellController = game.getPlayer(spell.getControllerId());
                    if (spellController != null) {
                        spellController.revealCards(sourceObject.getLogName(), spellController.getHand(), game);
                        Cards cardsToDiscard = new CardsImpl();
                        for (SpellAbility spellAbility : spell.getSpellAbilities()) {
                            if (spellAbility.getSpellAbilityType().equals(SpellAbilityType.SPLICE)) {
                                for (Card card: spellController.getHand().getCards(game)) {
                                    if (card.getName().equals(spellAbility.getCardName()) && !cardsToDiscard.contains(card.getId())) {
                                        cardsToDiscard.add(card);
                                    }
View Full Code Here

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == EventType.SPELL_CAST
                && event.getZone() == Zone.LIBRARY) {
            Spell spell = game.getStack().getSpell(event.getTargetId());
            if (spell != null
                    && spell.getControllerId().equals(super.getControllerId())
                    && (spell.getCardType().contains(CardType.INSTANT)
                    || spell.getCardType().contains(CardType.SORCERY))) {
                for (Effect effect : this.getEffects()) {
                    effect.setTargetPointer(new FixedTarget(event.getTargetId()));
                }
                return true;
            }
View Full Code Here

        return new PerplexingChimeraControlExchangeEffect(this);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
        Player controller = game.getPlayer(source.getControllerId());
        if (spell != null && controller != null) {
            Player spellCaster = game.getPlayer(spell.getControllerId());
            // controller gets controll of spell
            spell.setControllerId(controller.getId());
            // and chooses new targets
            spell.chooseNewTargets(game, controller.getId());
            game.informPlayers(new StringBuilder(controller.getName()).append(" got control of ").append(spell.getName()).append(" spell.").toString());
            // and spell controller get control of Perplexing Chimera
            if (spellCaster != null) {
                ContinuousEffect effect = new PerplexingChimeraControlEffect();
                effect.setTargetPointer(new FixedTarget(spellCaster.getId()));
                game.addEffect(effect, source);
View Full Code Here

        return new EchoMageEffect(this);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
        if (spell != null) {
            for (int i = 0; i < 2; i++) {
                Spell copy = spell.copySpell();
                copy.setControllerId(source.getControllerId());
                copy.setCopiedSpell(true);
                game.getStack().push(copy);
                copy.chooseNewTargets(game, source.getControllerId());
            }
            return true;
        }
        return false;
    }
View Full Code Here

    }

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.SPELL_CAST) {
            Spell spell = game.getStack().getSpell(event.getTargetId());
            if (spell != null
                    && !spell.getCardType().contains(CardType.CREATURE)) {
                for (Effect effect : this.getEffects()) {
                    effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
                }
                return true;
            }
View Full Code Here

    }

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if ( event.getType() == EventType.SPELL_CAST ) {
            Spell spell = (Spell)game.getObject(event.getTargetId());
            if ( this.getSourceId().equals(spell.getSourceId())) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

        if (stackObject != null && sourceObject != null) {
            Targets targets;
            Ability sourceAbility;
            MageObject oldTarget = null;
            if (stackObject instanceof Spell) {
                Spell spell = (Spell)stackObject;
                sourceAbility = spell.getSpellAbility();
                targets = spell.getSpellAbility().getTargets();
            } else if (stackObject instanceof StackAbility) {
                StackAbility stackAbility = (StackAbility)stackObject;
                sourceAbility = stackAbility;
                targets = stackAbility.getTargets();
            } else {
View Full Code Here

    }

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.SPELL_CAST) {
            Spell spell = game.getStack().getSpell(event.getTargetId());
            if (spell != null && spell.getColor().contains(ObjectColor.BLACK)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of mage.game.stack.Spell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.