Package mage.game.stack

Examples of mage.game.stack.Spell


    @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
                    && game.getOpponents(super.getControllerId()).contains(spell.getControllerId())
                    && game.getActivePlayerId().equals(super.getControllerId())) {
                return true;
            }
        }
        // Voice Of Resurgence Dies
View Full Code Here


            MageObject object = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
            if (object == null) {
                object = game.getLastKnownInformation(getTargetPointer().getFirst(game, source), Zone.STACK);
            }
            if (object != null && object instanceof Spell) {
                Spell spell = (Spell) object;
                Player spellController = game.getPlayer(spell.getControllerId());
                if (spellController != null) {
                    int damage = new ManacostVariableValue().calculate(game, source, this);
                    spellController.damage(damage, source.getSourceId(), game, false, true);
                }
                return true;
View Full Code Here

    @Override
    public void watch(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.SPELL_CAST) {
            if (isSavageSummoningSpellActive() && event.getPlayerId().equals(getControllerId())) {
                Spell spell = game.getStack().getSpell(event.getTargetId());
                if (spell != null && spell.getCardType().contains(CardType.CREATURE)) {                   
                    spellsCastWithSavageSummoning.put(spell.getId(), new HashSet<>(savageSummoningSpells));
                    String cardKey = new StringBuilder(spell.getCard().getId().toString()).append("_").append(spell.getCard().getZoneChangeCounter()).toString();
                    cardsCastWithSavageSummoning.put(cardKey, new HashSet<>(savageSummoningSpells));
                    savageSummoningSpells.clear();
                }
            }
        }
View Full Code Here

    }

    @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 && watcher.isSpellCastWithThisSavageSummoning(spell.getId(), source.getSourceId(), zoneChangeCounter)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

        return new PutAwayEffect(this);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Spell spell = game.getStack().getSpell(source.getFirstTarget());
        Card card = game.getCard(source.getTargets().get(1).getFirstTarget());
        Player you = game.getPlayer(source.getControllerId());
        if (spell != null
                && game.getStack().counter(spell.getId(), source.getSourceId(), game)) {
            countered = true;
        }
        if (you != null) {
            if (card != null
                    && you.chooseUse(Outcome.Benefit, "Do you wish to shuffle up to one target card from your graveyard into your library?", game)
View Full Code Here

    @Override
    public boolean applies(Ability abilityToModify, Ability source, Game game) {
        if ((abilityToModify instanceof SpellAbility)
                && abilityToModify.getControllerId().equals(source.getControllerId())) {
            Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
            return spell != null && BattlefieldThaumaturgeSpellsCostReductionEffect.filter.match(spell, game);
        }
        return false;
    }
View Full Code Here

            this.originalName = card.getName();
        }

        if (card instanceof Spell) {
            this.mageObjectType = MageObjectType.SPELL;
            Spell spell = (Spell) card;
            for (SpellAbility spellAbility: spell.getSpellAbilities()) {
                for(UUID modeId : spellAbility.getModes().getSelectedModes()) {
                    spellAbility.getModes().setMode(spellAbility.getModes().get(modeId));
                    if (spellAbility.getTargets().size() > 0) {
                        setTargets(spellAbility.getTargets());
                    }
                }
            }
            // show for modal spell, which mode was choosen
            if (spell.getSpellAbility().isModal()) {
                Modes modes = spell.getSpellAbility().getModes();
                for(UUID modeId : modes.getSelectedModes()) {
                    modes.setMode(modes.get(modeId));
                    this.rules.add("<span color='green'><i>Chosen mode: " + spell.getSpellAbility().getEffects().getText(modes.get(modeId))+"</i></span>");
                }
            }
        }      
    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
        if (controller != null && sourcePermanent != null) {
            Spell spell = (Spell) game.getStack().getStackObject(targetPointer.getFirst(game, source));
            if (spell != null) {
                Card topcard = controller.getLibrary().getFromTop(game);
                if (topcard != null) {
                    CardsImpl cards = new CardsImpl();
                    cards.add(topcard);
                    controller.revealCards(sourcePermanent.getName(), cards, game);
                    if (CardUtil.convertedManaCostsIsEqual(topcard, spell)) {
                        return game.getStack().counter(spell.getId(), source.getSourceId(), game);
                    }
                }
                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) {
            Player player = game.getPlayer(spell.getControllerId());
            if (player != null && player.getCounters().containsKey(CounterType.POISON))
                return game.getStack().counter(targetPointer.getFirst(game, source), source.getSourceId(), game);
        }
        return false;
    }
View Full Code Here

    }

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(this.controllerId)) {
            Spell spell = (Spell) game.getStack().getStackObject(event.getTargetId());
            if (spell != null) {
                for (ManaCost cost : spell.getCard().getManaCost()) {
                    if (cost instanceof PhyrexianManaCost) {
                        ((DamageTargetEffect)getEffects().get(0)).setAmount(new StaticValue(spell.getConvertedManaCost()));
                        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.