Package mage.watchers.common

Examples of mage.watchers.common.CastSpellLastTurnWatcher


        return fInstance;
    }

    @Override
    public boolean apply(Game game, Ability source) {
        CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher");
        // if any player cast spell, return false
        for (Integer count : watcher.getAmountOfSpellsCastOnPrevTurn().values()) {
            if (count > 0) {
                return false;
            }
        }
        // no one cast spell this turn
View Full Code Here


    @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());
View Full Code Here

                    Permanent attachment = game.getPermanent(source.getSourceId());
                    if (attachment == null || !attachment.getAttachedTo().equals(event.getPlayerId())) {
                        return false;
                    }                   
            }
            CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher");
            if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId())> 0) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

        return fInstance;
    }

    @Override
    public boolean apply(Game game, Ability source) {
        CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher");
        // if any player cast more than two spells, return true
        for (Integer count : watcher.getAmountOfSpellsCastOnPrevTurn().values()) {
            if (count >= 2) {
                return true;
            }
        }
        // no one cast two or more spells last turn
View Full Code Here

        // add watchers
        for (UUID playerId : state.getPlayerList(startingPlayerId)) {
            state.getWatchers().add(new PlayerDamagedBySourceWatcher(playerId));
        }
        state.getWatchers().add(new MorbidWatcher());
        state.getWatchers().add(new CastSpellLastTurnWatcher());
        state.getWatchers().add(new SoulbondWatcher());
        state.getWatchers().add(new PlayerLostLifeWatcher());
        state.getWatchers().add(new BlockedAttackerWatcher());

        //20100716 - 103.5
View Full Code Here

class SecondSpellPredicate implements Predicate<Spell> {

    @Override
    public boolean apply(Spell input, Game game) {
        CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher");

        if (watcher.getSpellOrder(input) == 2) {
            return true;
        }

        return false;
    }
View Full Code Here

    }

    @Override
    public boolean applies(Permanent permanent, Ability source, Game game) {
        if (game.getActivePlayerId().equals(permanent.getControllerId()) && game.getOpponents(source.getControllerId()).contains(permanent.getControllerId())) {
            CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher");
            if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(permanent.getControllerId()) > 0) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

    }

    @Override
    public boolean applies(GameEvent event, Ability source, Game game) {
       if (event.getType() == GameEvent.EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) {
           CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher");
           if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId()) == 0) {
               return true;
           }
       }
       return false;
View Full Code Here

        if (event.getType() == GameEvent.EventType.CAST_SPELL) {
            Permanent enchantment = game.getPermanent(source.getSourceId());
            if (enchantment != null && enchantment.getAttachedTo() != null) {
                Player player = game.getPlayer(enchantment.getAttachedTo());
                if (player != null && event.getPlayerId().equals(player.getId())) {
                    CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher");
                    if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) > 0) {
                        return true;
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of mage.watchers.common.CastSpellLastTurnWatcher

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.