Package mage.game.stack

Examples of mage.game.stack.Spell


                    default:
                        //logger.warning("moveToZone, not fully implemented: from="+event.getFromZone() + ", to="+event.getToZone());
                }
                game.rememberLKI(objectId, event.getFromZone(), this);
            }
            game.getStack().push(new Spell(this, ability.copy(), controllerId, event.getFromZone()));
            game.setZone(objectId, event.getToZone());
            game.fireEvent(event);
            return game.getState().getZone(objectId) == Zone.STACK;
        }
        return false;
View Full Code Here


        super(effect);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Spell spell = (Spell) this.getValue("StormSpell");
        if (spell != null) {
            CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher");

            for (int i = 0; i < watcher.getSpellOrder(spell) - 1; 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

                }
            }
        } else {
            Card card = null;
            if (((ZoneChangeEvent)event).getFromZone().equals(Zone.STACK)) {
                Spell spell = game.getStack().getSpell(event.getTargetId());
                if (spell != null) {
                    card = game.getCard(spell.getSourceId());
                }
            }
            if (card == null) {
                card = game.getCard(event.getTargetId());
            }          
View Full Code Here

                ((ZoneChangeEvent)event).getToZone() == Zone.EXILED ||
                (alsoLibrary && ((ZoneChangeEvent)event).getToZone() == Zone.LIBRARY))
                ) {
            if (commanderId != null) {
                if (((ZoneChangeEvent)event).getFromZone().equals(Zone.STACK)) {
                    Spell spell = game.getStack().getSpell(event.getTargetId());
                    if (spell != null) {
                        if (commanderId.equals(spell.getSourceId())) {
                            return true;
                        }
                    }
                }
                if(commanderId.equals(event.getTargetId())){
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 && filter.match(spell, getControllerId(), game)) {
                if (rememberSource) {
                    this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId()));
                }
                return true;
            }
        }
        return false;
View Full Code Here

    }

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.SPELL_CAST && game.getPlayer(this.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
            Spell spell = game.getStack().getSpell(event.getTargetId());
            if (spell != null && filter.match(spell, game)) {
                if (!setTargetPointer.equals(SetTargetPointer.NONE)) {
                    for (Effect effect: this.getEffects()) {
                        switch (setTargetPointer) {
                            case SPELL:
View Full Code Here

    }

    @Override
    public void watch(GameEvent event, Game game) {
         if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.HAND) {
            Spell spell = (Spell) game.getObject(event.getTargetId());
            if (this.getSourceId().equals(spell.getSourceId())) {
               condition = true;
            }
        }
    }
View Full Code Here

    }

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

    }

    @Override
    public boolean applies(GameEvent event, Ability source, Game game) {
        if (event.getType() == EventType.COUNTER) {
            Spell spell = game.getStack().getSpell(event.getTargetId());
            if (spell != null && spell.getControllerId().equals(source.getControllerId())
                    && filterTarget.match(spell, game)) {
                if (filterSource == null) {
                    return true;
                } else {
                    MageObject sourceObject = game.getObject(source.getSourceId());
View Full Code Here

        super(effect);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
        if (spell == null) {
            spell = (Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK);
        }
        if (spell != null) {
            Spell copy = spell.copySpell();
            copy.setControllerId(source.getControllerId());
            copy.setCopiedSpell(true);
            game.getStack().push(copy);
            copy.chooseNewTargets(game, source.getControllerId());
            Player player = game.getPlayer(source.getControllerId());
            String activateMessage = copy.getActivatedMessage(game);
            if (activateMessage.startsWith(" casts ")) {
                activateMessage = activateMessage.substring(6);
            }
            game.informPlayers(player.getName() + " copies " + activateMessage);
            return true;
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.