Package mage.target.common

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


                // create cost for sacrificing a human
                Player player = game.getPlayer(source.getControllerId());
                if (player != null) {
                    TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false);
                    // if they can pay the cost, then they must pay
                    if (target.canChoose(player.getId(), game)) {
                        player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
                        Permanent humanSacrifice = game.getPermanent(target.getFirstTarget());
                        if (humanSacrifice != null) {
                            // sacrifice the chosen card
                            return humanSacrifice.sacrifice(source.getSourceId(), game);
View Full Code Here


                if (opponent != null) {
                    FilterControlledPermanent filter = new FilterControlledPermanent("creature to sacrifice");
                    filter.add(new CardTypePredicate(CardType.CREATURE));
                    filter.add(new ControllerPredicate(TargetController.YOU));
                    TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false);
                    if (target.canChoose(opponent.getId(), game)) {
                        if (opponent.chooseUse(Outcome.AIDontUseIt, new StringBuilder("Sacrifice a creature to tap ").append(descrationDemon.getName()).append("and put a +1/+1 counter on it?").toString(), game))
                        {
                            opponent.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
                            Permanent permanent = game.getPermanent(target.getFirstTarget());
                            if (permanent != null) {
View Full Code Here

                if (playerId != source.getControllerId()) {
                    Player player = game.getPlayer(playerId);
                    if (player != null) {
                        TargetControlledPermanent target = new TargetControlledPermanent(filter);
                        target.setNotTarget(true);
                        if (target.canChoose(source.getSourceId(), playerId, game) &&
                                player.chooseTarget(outcome, target, source, game)) {
                            Permanent permanent = game.getPermanent(target.getFirstTarget());
                            if (permanent != null) {
                                permanent.sacrifice(source.getSourceId(), game);
                            }
View Full Code Here

        FilterCreaturePermanent filter = new FilterCreaturePermanent();
        filter.add(new ControllerPredicate(TargetController.YOU));
        Target target = new TargetControlledPermanent(1, 1, filter, true);

        if (target.canChoose(player.getId(), game)) {
            while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) {
                player.chooseTarget(Outcome.ReturnToHand, target, source, game);
            }

            for (UUID targetId: target.getTargets()) {
View Full Code Here

        FilterCreaturePermanent filter = new FilterCreaturePermanent();
        filter.add(new ControllerPredicate(TargetController.YOU));
        Target target = new TargetControlledPermanent(1, 1, filter, true);

        if (target.canChoose(player.getId(), game)) {
            while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) {
                player.chooseTarget(Outcome.ReturnToHand, target, source, game);
            }

            for (UUID targetId: target.getTargets()) {
                Permanent permanent = game.getPermanent(targetId);
View Full Code Here

        if (player == null) {
            return false;
        }

        Target target = new TargetControlledPermanent(new FilterControlledCreaturePermanent());
        if (target.canChoose(player.getId(), game) && player.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) {
            Permanent permanent = game.getPermanent(target.getFirstTarget());
            if (permanent != null) {
                return permanent.sacrifice(source.getSourceId(), game);
            }
        }
View Full Code Here

        filter.add(new ControllerIdPredicate(player.getId()));
        TargetControlledPermanent target = new TargetControlledPermanent(1, 1, 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)) {
            player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
            Permanent permanent = game.getPermanent(target.getFirstTarget());
            if (permanent != null) {
                permanent.sacrifice(source.getSourceId(), game);
                if (filterGoblin.match(permanent, game)) {
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.