Package mage.game.stack

Examples of mage.game.stack.Spell


            if (subtype != null) {
                if (event.getType() == GameEvent.EventType.SPELL_CAST) {
                    FilterSpell filter = new FilterSpell();
                    filter.add(new ControllerPredicate(TargetController.YOU));
                    filter.add(new SubtypePredicate(subtype));
                    Spell spell = game.getStack().getSpell(event.getTargetId());
                    if (spell != null && filter.match(spell, controllerId, game)) {
                        return true;
                    }
                }
            }
View Full Code Here


    public boolean canTarget(UUID id, Ability source, Game game) {
        // rule 114.4. A spell or ability on the stack is an illegal target for itself.
        if (source == null || source.getId().equals(id)) {
            return false;
        }
        Spell spell = game.getStack().getSpell(id);
        if (spell != null) {
            return filter.match(spell, source.getControllerId(), game);
        }
        return false;
    }
View Full Code Here

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        // Opponent casts spell during your turn
        if (event.getType() == GameEvent.EventType.SPELL_CAST) {
            Spell spell = game.getStack().getSpell(event.getTargetId());
            if (spell != null
                    && filter.match(spell,game)
                    && game.getOpponents(this.getControllerId()).contains(spell.getControllerId())
                    && game.getActivePlayerId().equals(this.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 = (Spell) game.getObject(event.getTargetId());
            if (this.getSourceId().equals(spell.getSourceId())) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

    }

    @Override
    public void watch(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.SPELL_CAST) {
            Spell spell = (Spell) game.getObject(event.getTargetId());
            if (spell.getCardType().contains(CardType.CREATURE)) {
                playerIds.add(spell.getControllerId());
            }
        }
    }
View Full Code Here

    }

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

    @Override
    public void watch(GameEvent event, Game game) {
        condition = false;
        if (event.getType() == EventType.SPELL_CAST && event.getPlayerId().equals(controllerId)) {
            Spell spell = game.getStack().getSpell(event.getTargetId());
            if (spell != null && spell.getCardType().contains(CardType.CREATURE)) {
                creatureSpellCount++;
                if (creatureSpellCount == 2)
                    condition = true;
            }
        }
View Full Code Here

    }

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == EventType.SPELL_CAST && event.getZone() == Zone.HAND) {
            Spell spell = game.getStack().getSpell(event.getTargetId());
            if (spell != null) {
                for (Effect effect : this.getEffects()) {
                    effect.setTargetPointer(new FixedTarget(event.getTargetId()));
                }
                return true;
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) {
            if (spell.moveToExile(source.getSourceId(), "Possibility Storm Exile", source.getSourceId(), game)) {
                Player player = game.getPlayer(spell.getControllerId());
                if (player != null && player.getLibrary().size() > 0) {
                    Library library = player.getLibrary();
                    Card card;
                    do {
                        card = library.removeFromTop(game);
                        if (card != null) {
                            card.moveToExile(source.getSourceId(), "Possibility Storm Exile", source.getSourceId(), game);
                        }
                    } while (library.size() > 0 && card != null && !sharesType(card, spell.getCardType()));

                    if (card != null && sharesType(card, spell.getCardType())) {
                        if(player.chooseUse(Outcome.PlayForFree, new StringBuilder("Cast ").append(card.getName()).append(" without paying cost?").toString(), game)) {
                            player.cast(card.getSpellAbility(), game, true);
                        }
                    }
View Full Code Here

        return new BloodlordOfVaasgothEffect(this);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Spell object = game.getStack().getSpell(targetPointer.getFirst(game, source));
        if (object != null) {
            Permanent permanent = game.getPermanent(object.getSourceId());
            if (permanent != null) {
                permanent.addAbility(ability, source.getSourceId(), game);
                return true;
            }
        } else {
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.