Package mage.players

Examples of mage.players.Player.chooseTarget()


        if (opponent != null && controller != null) {
            Cards cardsInHand = new CardsImpl(Zone.PICK);
            cardsInHand.addAll(opponent.getHand());
            if (cardsInHand.size() > 0) {
                TargetCard target = new TargetCard(1, Zone.PICK, new FilterNonlandCard());
                if (controller.chooseTarget(outcome, cardsInHand, target, source, game)) {
                    Card card = game.getCard(target.getFirstTarget());
                    if (card != null) {
                        controller.cast(card.getSpellAbility(), game, true);
                    }
                }
View Full Code Here


            if (controller.getHand().size() > 0) {
                Card cardToReveal = null;
                if (controller.getHand().size() > 1) {
                    Target target = new TargetCardInHand(new FilterCard());
                    target.setNotTarget(true);
                    if (controller.chooseTarget(outcome, target, source, game)) {
                        cardToReveal = game.getCard(target.getFirstTarget());
                    }
                } else {
                    cardToReveal = controller.getHand().getRandom(game);
                }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            Target target = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, new FilterControlledCreaturePermanent(), true);
            player.chooseTarget(Outcome.Sacrifice, target, source, game);
            int numSacrificed = 0;
            for (UUID permanentId : target.getTargets()) {
                Permanent permanent = game.getPermanent(permanentId);
                if (permanent != null) {
                    if (permanent.sacrifice(source.getSourceId(), game)) {
View Full Code Here

        PlayerList playerList = game.getPlayerList().copy();
        playerList.setCurrent(game.getActivePlayerId());
        Player player = game.getPlayer(game.getActivePlayerId());
        do {
            target.clearChosen();
            if (player.chooseTarget(outcome, target, source, game)) {
                Permanent permanent = game.getPermanent(target.getFirstTarget());
                if (permanent != null) {
                    permanents.add(permanent);
                    game.informPlayers((new StringBuilder(player.getName()).append(" chooses ").append(permanent.getName()).toString()));
                }
View Full Code Here

            cardsInHand.addAll(opponent.getHand());
            opponent.revealCards("Opponents hand", cardsInHand, game);
            if (cardsInHand.size() > 0
                    && cardsInHand.getCards(new FilterNonlandCard(), game).size() > 0) {
                TargetCard target = new TargetCard(1, Zone.PICK, new FilterNonlandCard());
                if (you.chooseTarget(Outcome.PlayForFree, cardsInHand, target, source, game)) {
                    Card card = game.getCard(target.getFirstTarget());
                    if (card != null) {
                        you.cast(card.getSpellAbility(), game, true);
                    }
                }
View Full Code Here

                    filterNamedCards.add(Predicates.or(names));
                }
               
                // search cards in graveyard
                TargetCardInGraveyard targetCardsGraveyard = new TargetCardInGraveyard(0, Integer.MAX_VALUE, filterNamedCards);
                controller.chooseTarget(outcome, targetPlayer.getGraveyard(), targetCardsGraveyard, source, game);
                for(UUID cardId:  targetCardsGraveyard.getTargets()) {
                    Card card = game.getCard(cardId);
                    if (card != null) {
                        controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD);
                    }
View Full Code Here

                    }
                }
               
                // search cards in hand
                TargetCardInHand targetCardsHand = new TargetCardInHand(0, Integer.MAX_VALUE, filterNamedCards);
                controller.chooseTarget(outcome, targetPlayer.getGraveyard(), targetCardsHand, source, game);
                for(UUID cardId:  targetCardsHand.getTargets()) {
                    Card card = game.getCard(cardId);
                    if (card != null) {
                        controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.HAND);
                    }
View Full Code Here

        if (creature != null && controller != null) {
            Target target = new TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterPermanent(), true);
            if (!target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
                return false;
            }
            controller.chooseTarget(Outcome.Detriment, target, source, game);
            if (target.getTargets().size() > 0) {
                int sacrificedCreatures = target.getTargets().size();
                game.informPlayers(new StringBuilder(controller.getName()).append(" sacrifices ").append(sacrificedCreatures).append(" creatures for ").append(creature.getName()).toString());
                for (UUID targetId: target.getTargets()) {
                    Permanent targetCreature = game.getPermanent(targetId);
View Full Code Here

        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            Target target = new TargetCardInHand(new FilterArtifactCard("an artifact card from your hand"));
            if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
                    && controller.chooseUse(outcome, "Put an artifact from your hand to battlefield?", game)
                    && controller.chooseTarget(outcome, target, source, game)) {
                Card card = game.getCard(target.getFirstTarget());
                if (card != null) {
                     controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId());
                }
            }
View Full Code Here

        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            Target target = new TargetCardInGraveyard(new FilterCreatureCard());
            target.setNotTarget(true);
            if (target.canChoose(source.getSourceId(), source.getControllerId(), game) &&
                    player.chooseTarget(outcome, target, source, game)) {
                Card card = game.getCard(target.getFirstTarget());
                if (card != null) {
                    if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId())) {
                        ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
                        effect.setTargetPointer(new FixedTarget(card.getId()));
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.