Examples of canChoose()


Examples of mage.target.Target.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.Target.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.Target.canChoose()

        if (player == null || !(ability instanceof SpellAbility)) {
            return;
        }
        Target target = new TargetCardInYourGraveyard(1, Integer.MAX_VALUE, new FilterCard());
        target.setTargetName("cards to delve from your graveyard");
        if (!target.canChoose(sourceId, controllerId, game)) {
            return;
        }
        if (!CardUtil.isCheckPlayableMode(ability) && player.chooseUse(Outcome.Detriment, "Delve cards from your graveyard?", game)) {
            player.chooseTarget(Outcome.Detriment, target, ability, game);
            if (target.getTargets().size() > 0) {
View Full Code Here

Examples of mage.target.Target.canChoose()

    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            Target target = new TargetCardInHand(new FilterLandCard("land card"));
            if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
                    && controller.choose(outcome, target, source.getSourceId(), game)) {
                Card card = game.getCard(target.getFirstTarget());
                if (card != null) {
                    controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId(), tapped);
                }
View Full Code Here

Examples of mage.target.Target.canChoose()

        Permanent creature = game.getPermanent(event.getTargetId());
        Player controller = game.getPlayer(source.getControllerId());
        if (creature != null && controller != null) {
            Target target = new TargetControlledCreaturePermanent(1, Integer.MAX_VALUE, filter, true);
            target.setRequired(false);
            if (!target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
                return false;
            }
            if (controller.chooseUse(Outcome.Detriment, "Devour creatures?", game)) {
                controller.chooseTarget(Outcome.Detriment, target, source, game);
                if (target.getTargets().size() > 0) {
View Full Code Here

Examples of mage.target.Target.canChoose()

                    uuidPredicates.add(new PermanentIdPredicate(uuid));
                }
                filter.add(Predicates.not(Predicates.or(uuidPredicates)));                   
               
                target = new TargetControlledPermanent(0, 1, filter, true);
                if (target.canChoose(player.getId(), game)
                        && player.choose(Outcome.Exile, target, source.getSourceId(), game)) {               
                    for (UUID targetId : target.getTargets()) {
                        if (!selectedObjects.contains(targetId)) {
                            Permanent chosen = game.getPermanent(targetId);
                            if (chosen != null) {
View Full Code Here

Examples of mage.target.TargetCard.canChoose()

                    List<CardIdPredicate> uuidPredicates = new ArrayList<>();
                    for (UUID uuid :selectedObjects) {
                        uuidPredicates.add(new CardIdPredicate(uuid));
                    }
                    filterInHand.add(Predicates.not(Predicates.or(uuidPredicates)));                   
                    if (targetInHand.canChoose(player.getId(), game) &&
                            player.choose(Outcome.Exile, player.getHand(), targetInHand, game)) {

                        Card card = player.getHand().get(targetInHand.getFirstTarget(), game);
                        if (card != null) {
                            selectedObjects.add(targetInHand.getFirstTarget());
View Full Code Here

Examples of mage.target.TargetPermanent.canChoose()

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            Target target = new TargetPermanent(filter);
            if (target.canChoose(source.getControllerId(), game)) {
                player.choose(Outcome.Copy, target, source.getSourceId(), game);
                Permanent tokenToCopy = game.getPermanent(target.getFirstTarget());
                if (tokenToCopy != null) {
                    game.informPlayers("Token selected for populate: " + tokenToCopy.getLogName());
                    Effect effect = new PutTokenOntoBattlefieldCopyTargetEffect();
View Full Code Here

Examples of mage.target.TargetPermanent.canChoose()

                TargetPermanent target = new TargetControlledPermanent(1, 1, filter, false);
                target.setNotTarget(true);

                // you always go first
                if (target.canChoose(you.getId(), game)) {
                    while (you.isInGame() && !target.isChosen() && target.canChoose(you.getId(), game)) {
                        you.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
                    }
                    Permanent permanent = game.getPermanent(target.getFirstTarget());
                    if (permanent != null) {
View Full Code Here

Examples of mage.target.TargetPermanent.canChoose()

                TargetPermanent target = new TargetControlledPermanent(1, 1, filter, false);
                target.setNotTarget(true);

                // you always go first
                if (target.canChoose(you.getId(), game)) {
                    while (you.isInGame() && !target.isChosen() && target.canChoose(you.getId(), game)) {
                        you.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
                    }
                    Permanent permanent = game.getPermanent(target.getFirstTarget());
                    if (permanent != null) {
                        chosen.add(permanent);
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.