Package mage.target.common

Examples of mage.target.common.TargetControlledPermanent.canChoose()


        for (UUID playerId : game.getOpponents(source.getControllerId())) {
            Player player = game.getPlayer(playerId);
            if (player != null) {
                int numTargets = Math.min(amount.calculate(game, source, this), game.getBattlefield().countAll(filter, player.getId(), game));
                TargetControlledPermanent target = new TargetControlledPermanent(numTargets, numTargets, filter, false);
                if (target.canChoose(player.getId(), game)) {
                    while (!target.isChosen() && player.isInGame()) {
                        player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
                    }
                    perms.addAll(target.getTargets());
                }
View Full Code Here


    @Override
    public boolean apply(Game game, Ability source) {
        TargetControlledPermanent target = new TargetControlledCreaturePermanent();
        Player player = game.getPlayer(source.getControllerId());
        if (target.canChoose(source.getControllerId(), game)) {
            player.choose(this.outcome, target, source.getSourceId(), game);
            Permanent permanent = game.getPermanent(target.getFirstTarget());
            if (permanent != null) {
                return permanent.sacrifice(source.getSourceId(), game);
            }
View Full Code Here

        Target target = new TargetControlledPermanent(amount, amount, filter, true);

        //A spell or ability could have removed the only legal target this player
        //had, if thats the case this ability should fizzle.
        if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) {
            boolean abilityApplied = false;
            while (!target.isChosen() && target.canChoose(player.getId(), game) && player.isInGame()) {
                player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
            }
View Full Code Here

        //A spell or ability could have removed the only legal target this player
        //had, if thats the case this ability should fizzle.
        if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) {
            boolean abilityApplied = false;
            while (!target.isChosen() && target.canChoose(player.getId(), game) && player.isInGame()) {
                player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
            }

            for ( int idx = 0; idx < target.getTargets().size(); idx++) {
                Permanent permanent = game.getPermanent((UUID)target.getTargets().get(idx));
View Full Code Here

            int amount = Math.min(count, game.getBattlefield().countAll(filter, player.getId(), game));
            Target target = new TargetControlledPermanent(amount, amount, filter, false);

            //A spell or ability could have removed the only legal target this player
            //had, if thats the case this ability should fizzle.
            if (target.canChoose(player.getId(), game)) {
                boolean abilityApplied = false;
                while (!target.isChosen() && target.canChoose(player.getId(), game) && player.isInGame()) {
                    player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
                }
View Full Code Here

            //A spell or ability could have removed the only legal target this player
            //had, if thats the case this ability should fizzle.
            if (target.canChoose(player.getId(), game)) {
                boolean abilityApplied = false;
                while (!target.isChosen() && target.canChoose(player.getId(), game) && player.isInGame()) {
                    player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
                }

                for (int idx = 0; idx < target.getTargets().size(); idx++) {
                    Permanent permanent = game.getPermanent((UUID) target.getTargets().get(idx));
View Full Code Here

        if (controller != null) {
            for (UUID playerId : controller.getInRange()) {
                Player player = game.getPlayer(playerId);

                Target target = new TargetControlledPermanent(1, 1, filter, false);
                if (target.canChoose(player.getId(), game)) {
                    while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) {
                        player.choose(Outcome.Benefit, target, source.getSourceId(), game);
                    }
                    Permanent permanent = game.getPermanent(target.getFirstTarget());
                    if (permanent != null) {
View Full Code Here

            for (UUID playerId : controller.getInRange()) {
                Player player = game.getPlayer(playerId);

                Target target = new TargetControlledPermanent(1, 1, filter, false);
                if (target.canChoose(player.getId(), game)) {
                    while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) {
                        player.choose(Outcome.Benefit, target, source.getSourceId(), game);
                    }
                    Permanent permanent = game.getPermanent(target.getFirstTarget());
                    if (permanent != null) {
                        chosen.add(permanent);
View Full Code Here

        }

        // sacrifice a creature
        Target target = new TargetControlledPermanent(1, 1, filterCreature, false);
        boolean sacrificed = false;
        if (target.canChoose(player.getId(), game)) {
            while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) {
                player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
            }

            for (int idx = 0; idx < target.getTargets().size(); idx++) {
View Full Code Here

        // sacrifice a creature
        Target target = new TargetControlledPermanent(1, 1, filterCreature, false);
        boolean sacrificed = false;
        if (target.canChoose(player.getId(), game)) {
            while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) {
                player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
            }

            for (int idx = 0; idx < target.getTargets().size(); idx++) {
                Permanent permanent = game.getPermanent((UUID) target.getTargets().get(idx));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.