Examples of canChoose()


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

        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

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

        //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

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

            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

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

            //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

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

        int tappedAmount = 0;
        Player you = game.getPlayer(source.getControllerId());
        TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
        while (true) {
            target.clearChosen();
            if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) {
                UUID creature = target.getFirstTarget();
                if (creature != null) {
                    game.getPermanent(creature).tap(game);
                    tappedAmount++;
                }
View Full Code Here

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

    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            player.drawCards(3, game);
            TargetDiscard target = new TargetDiscard(player.getId());
            if (target.canChoose(source.getSourceId(), player.getId(), game)) {
                player.choose(Outcome.Discard, target, source.getSourceId(), game);
                Card card = player.getHand().get(target.getFirstTarget(), game);
                if (card != null) {
                    player.discard(card, source, game);
                    int damage = card.getManaCost().convertedManaCost();
View Full Code Here

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

    }

    @Override
    public boolean apply(Game game, Ability source) {
        TargetLandPermanent target = new TargetLandPermanent(0, amount, new FilterLandPermanent(), true);
        if (target.canChoose(source.getControllerId(), game)) {
            if (target.choose(Outcome.Untap, source.getControllerId(), source.getSourceId(), game)) {
                for (Object targetId : target.getTargets()) {
                    Permanent p = game.getPermanent((UUID) targetId);
                    if (p.isTapped())
                        p.untap(game);
View Full Code Here

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

    @Override
    public boolean apply(Game game, Ability source) {
        TargetOpponent target = new TargetOpponent();
        Player you = game.getPlayer(source.getControllerId());
        if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
            you.chooseTarget(Outcome.DrawCard, target, source, game);
            Player opponent = game.getPlayer(target.getFirstTarget());
            if (opponent != null) {
                you.drawCards(opponent.getHand().size(), game);
                return true;
View Full Code Here

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

        Player controller = game.getPlayer(source.getControllerId());
        Target target = new TargetPermanentOrPlayerWithCounter(0, Integer.MAX_VALUE, true);

        //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(controller.getId(), game)) {
            boolean abilityApplied = false;
            Map<String, Serializable> options = new HashMap<>();
            options.put("UI.right.btn.text", "Done");
            while (target.canChoose(controller.getId(), game)) {
                if (controller.choose(Outcome.Benefit, target, source.getSourceId(), game, options)) {
View Full Code Here

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

        //had, if thats the case this ability should fizzle.
        if (target.canChoose(controller.getId(), game)) {
            boolean abilityApplied = false;
            Map<String, Serializable> options = new HashMap<>();
            options.put("UI.right.btn.text", "Done");
            while (target.canChoose(controller.getId(), game)) {
                if (controller.choose(Outcome.Benefit, target, source.getSourceId(), game, options)) {
                    break;
                }
            }
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.