Package mage.game

Examples of mage.game.Controllable


        this.controller = controller;
    }

    @Override
    public boolean apply(ObjectPlayer<Controllable> input, Game game) {
        Controllable object = input.getObject();
        UUID playerId = input.getPlayerId();

        switch (controller) {
            case YOU:
                PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource",playerId);
                if (watcher != null ) {
                    return watcher.hasSourceDoneDamage(object.getId(), game);
                }
                break;
            case OPPONENT:
                for (UUID opponentId : game.getOpponents(playerId)) {
                    watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource",opponentId);
                    if (watcher != null ) {
                        return watcher.hasSourceDoneDamage(object.getId(), game);
                    }
                }
                break;
            case NOT_YOU:
                Player you = game.getPlayer(playerId);
                if (you != null) {
                    for (UUID notYouId : you.getInRange()) {
                        if (!notYouId.equals(playerId)) {
                            watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource",notYouId);
                            if (watcher != null ) {
                                return watcher.hasSourceDoneDamage(object.getId(), game);
                            }
                        }
                    }
                }
                break;
            case ANY:
                you = game.getPlayer(playerId);
                if (you != null) {
                    for (UUID anyId : you.getInRange()) {
                        watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource",anyId);
                        if (watcher != null ) {
                            return watcher.hasSourceDoneDamage(object.getId(), game);
                        }
                    }
                }
                return true;
        }
View Full Code Here


        this.controller = controller;
    }

    @Override
    public boolean apply(ObjectPlayer<Controllable> input, Game game) {
        Controllable object = input.getObject();
        UUID playerId = input.getPlayerId();

        switch (controller) {
            case YOU:
                if (object.getControllerId().equals(playerId)) {
                    return true;
                }
                break;
            case OPPONENT:
                if (!object.getControllerId().equals(playerId) &&
                        game.getPlayer(playerId).hasOpponent(object.getControllerId(), game)) {
                    return true;
                }
                break;
            case NOT_YOU:
                if (!object.getControllerId().equals(playerId)) {
                    return true;
                }
                break;
            case ANY:
                return true;
View Full Code Here

TOP

Related Classes of mage.game.Controllable

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.