Package mage.players

Examples of mage.players.Player.choose()


            if (cards.size() > 0) {
                TargetCard target2 = new TargetCard(Zone.PICK,
                        new FilterCard(
                        "card to put on the bottom of your library"));
                while (player.isInGame() && cards.size() > 1) {
                    player.choose(Outcome.Benefit, cards, target2,
                            game);
                    Card card = cards.get(target2.getFirstTarget(), game);
                    if (card != null) {
                        cards.remove(card);
                        player.getLibrary().putOnBottom(card, game);
View Full Code Here


    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            TargetControlledPermanent target = new TargetControlledPermanent(number, number, filter, true);
            if (player.choose(this.outcome, target, source.getSourceId(), game)) {
                for (UUID targetCreatureId : target.getTargets()) {
                    Permanent permanent = game.getPermanent(targetCreatureId);
                    if (permanent != null) {
                        player.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
                    }
View Full Code Here

            TargetCardInExile target2 = new TargetCardInExile(filter2, source.getSourceId());
            ExileZone scrollRackExileZone = game.getExile().getExileZone(source.getSourceId());
            if (scrollRackExileZone != null) {
                while (controller.isInGame() && scrollRackExileZone.count(filter, game) > 1) {
                    controller.lookAtCards("exiled cards with " + sourceObject.getLogName(), scrollRackExileZone, game);
                    controller.choose(Outcome.Neutral, scrollRackExileZone, target2, game);
                    Card card = game.getCard(target2.getFirstTarget());
                    if (card != null) {
                        game.getExile().removeCard(card, game);
                        controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.EXILED, true, false);
                    }
View Full Code Here

            if (choice.getChoices().size() > 0) {
                Player player = game.getPlayer(permanent.getControllerId());
                if (choice.getChoices().size() == 1) {
                    choice.setChoice(choice.getChoices().iterator().next());
                } else {
                    player.choose(outcome, choice, game);
                }
                if (choice.getChoice() == null) {
                    return false;
                }
                switch (choice.getChoice()) {
View Full Code Here

            if (player != null) {
                int numTargets = Math.min(amount.calculate(game, source, this), game.getBattlefield().countAll(filter, player.getId(), game));
                TargetControlledPermanent target = new TargetControlledPermanent(numTargets, numTargets, filter, false);
                if (target.canChoose(player.getId(), game)) {
                    while (!target.isChosen() && player.isInGame()) {
                        player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
                    }
                    perms.addAll(target.getTargets());
                }
            }
        }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        Permanent permanent = game.getPermanent(source.getSourceId());
        if (player != null && permanent != null) {
            ChoiceColor colorChoice = new ChoiceColor();
            if (player.choose(outcome, colorChoice, game)) {
                game.informPlayers(new StringBuilder(permanent.getLogName()).append(": ").append(player.getName()).append(" has chosen ").append(colorChoice.getChoice()).toString());
                game.getState().setValue(source.getSourceId() + "_color", colorChoice.getColor());
                permanent.addInfo("chosen color", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>");
            }
        }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        TargetControlledPermanent target = new TargetControlledCreaturePermanent();
        Player player = game.getPlayer(source.getControllerId());
        if (target.canChoose(source.getControllerId(), game)) {
            player.choose(this.outcome, target, source.getSourceId(), game);
            Permanent permanent = game.getPermanent(target.getFirstTarget());
            if (permanent != null) {
                return permanent.sacrifice(source.getSourceId(), game);
            }
        }
View Full Code Here

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

    public void mulligan(UUID playerId) {
        Player player = getPlayer(playerId);
        TargetCardInHand target = new TargetCardInHand(1, player.getHand().size(), new FilterCard("card to mulligan"));
        target.setNotTarget(true);
        target.setRequired(false);
        if (player.choose(Outcome.Exile, player.getHand(), target, this)){
            int numCards = target.getTargets().size();
            for(UUID uuid : target.getTargets()){
                Card card = player.getHand().get(uuid, this);
                if(card != null){
                    if(!mulliganedCards.containsKey(playerId)){
View Full Code Here

        Player player = game.getPlayer(source.getControllerId());
        Permanent permanent = game.getPermanent(source.getSourceId());
        if (player != null && permanent != null) {
            TargetOpponent target = new TargetOpponent();
            target.setNotTarget(true);
            if (player.choose(this.outcome, target, source.getSourceId(), game)) {
                Player chosenPlayer = game.getPlayer(target.getFirstTarget());
                if (chosenPlayer != null) {
                    game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + chosenPlayer.getName());
                    game.getState().setValue(permanent.getId() + "_player", target.getFirstTarget());
                    return true;
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.