Package mage.players

Examples of mage.players.Player.chooseTarget()


    private UUID getOpponentId(UUID playerId, Ability source, Game game) {
        if (opponentId == null) {
            TargetOpponent target = new TargetOpponent();
            Player player = game.getPlayer(playerId);
            if (player != null) {
                if (player.chooseTarget(Outcome.Detriment, target, source, game)) {
                    opponentId = target.getFirstTarget();
                }
            }
        }
        return opponentId;
View Full Code Here


                    this.addTarget(((UUID) it.next()), source, game);
                } else {
                    return chosen;
                }
            } else {
                if (!player.chooseTarget(outcome, this, source, game)) {
                    return chosen;
                }
            }
            chosen = targets.size() >= minNumberOfTargets;
        }
View Full Code Here

                cards.add(card);
            }
        }
        if(cards.getCards(new FilterCreatureCard(), game).size() > 0){
            TargetCard target = new TargetCard(Zone.EXILED, new FilterCreatureCard());
            if(controller.chooseTarget(Outcome.PutCreatureInPlay, cards, target, source, game)){
                Card card = cards.get(target.getFirstTarget(), game);
                if(card != null){
                    card.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), source.getControllerId());
                }
            }
View Full Code Here

                    }
                }
                int numberOfTargets = Math.min(2, cards.size());
                if (numberOfTargets > 0) {
                    TargetCardInHand target = new TargetCardInHand(numberOfTargets, new FilterCard(new StringBuilder(numberOfTargets).append(" cards of cards drawn this turn").toString()));
                    controller.chooseTarget(outcome, cards, target, source, game);

                    Cards cardsPutBack = new CardsImpl();
                    for (UUID cardId :target.getTargets()) {
                        Card card = cards.get(cardId, game);
                        if (card != null) {
View Full Code Here

        Player player = game.getPlayer(source.getControllerId());
        Permanent permanent = game.getPermanent(source.getSourceId());
        if (player.getGraveyard().size() > 0) {

            TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, new FilterCreatureCard("creature cards from your graveyard"));
            if (player.chooseTarget(Outcome.Benefit, target, source, game)) {
                int count = 0;
                for (UUID uuid : target.getTargets()) {
                    Card card = player.getGraveyard().get(uuid, game);
                    if (card != null) {
                        card.moveToExile(getId(), "Sutured Ghoul", source.getSourceId(), game);
View Full Code Here

                int count = Math.min(cardsInHand.size(), payLife);

                TargetCard target = new TargetCard(count, Zone.HAND, new FilterCard());
                Cards revealedCards = new CardsImpl();

                if (targetPlayer.chooseTarget(Outcome.Discard, cardsInHand, target, source, game)) {
                    List<UUID> targets = target.getTargets();
                    for (UUID targetId : targets) {
                        Card card = game.getCard(targetId);
                        if (card != null) {
                            revealedCards.add(card);
View Full Code Here

        if (player == null){
            return false;
        }
        int amount = 0;
        TargetControlledPermanent sacrificeLand = new TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterControlledLandPermanent("lands you control"), true);
        if(player.chooseTarget(Outcome.Sacrifice, sacrificeLand, source, game)){
            for(Object uuid : sacrificeLand.getTargets()){
                Permanent land = game.getPermanent((UUID)uuid);
                if(land != null){
                    land.sacrifice(source.getSourceId(), game);
                    amount++;
View Full Code Here

            int count = Math.min(cardsInHand.size(), 3);

            TargetCard target = new TargetCard(count, Zone.HAND, new FilterCard());
            Cards revealedCards = new CardsImpl();

            if (targetPlayer.chooseTarget(Outcome.Discard, cardsInHand, target, source, game)) {
                List<UUID> targets = target.getTargets();
                for (UUID targetId : targets) {
                    Card card = game.getCard(targetId);
                    if (card != null) {
                        revealedCards.add(card);
View Full Code Here

        }
        //Sacrifice an artifact.
        int convertedManaCost = 0;
        boolean sacrifice = false;
        TargetControlledPermanent targetArtifact = new TargetControlledPermanent(new FilterControlledArtifactPermanent());
        if(controller.chooseTarget(Outcome.Sacrifice, targetArtifact, source, game)){
            Permanent permanent = game.getPermanent(targetArtifact.getFirstTarget());
            if(permanent != null){
                convertedManaCost = permanent.getManaCost().convertedManaCost();
                sacrifice = permanent.sacrifice(source.getSourceId(), game);
            }
View Full Code Here

            for (String landName : new String[] {"Forest","Island","Mountain","Plains","Swamp"}) {
                FilterLandPermanent filter = new FilterLandPermanent(new StringBuilder(landName).append(" to destroy").toString());
                filter.add(new SubtypePredicate(landName));
                Target target = new TargetLandPermanent(1,1, filter, true);
                if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
                    controller.chooseTarget(outcome, target, source, game);
                    lands.add(target.getFirstTarget());
                }

            }
            if (!lands.isEmpty()) {
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.