Package mage.players

Examples of mage.players.Player.discard()


        if (targetPlayer != null && !targetPlayer.getHand().isEmpty()) {
            TargetDiscard target = new TargetDiscard(targetPlayer.getId());
            targetPlayer.choose(Outcome.Discard, target, source.getSourceId(), game);
            Card card = targetPlayer.getHand().get(target.getFirstTarget(), game);
            if (card != null) {
                targetPlayer.discard(card, source, game);
                if (!card.getCardType().contains(CardType.LAND) && !targetPlayer.getHand().isEmpty()) {
                    targetPlayer.discard(1, source, game);
                }
                return true;
            }           
View Full Code Here


            targetPlayer.choose(Outcome.Discard, target, source.getSourceId(), game);
            Card card = targetPlayer.getHand().get(target.getFirstTarget(), game);
            if (card != null) {
                targetPlayer.discard(card, source, game);
                if (!card.getCardType().contains(CardType.LAND) && !targetPlayer.getHand().isEmpty()) {
                    targetPlayer.discard(1, source, game);
                }
                return true;
            }           
        }
        return false;
View Full Code Here

                TargetCard cardToDiscard = new TargetCard(Zone.PICK, new FilterCard("card to discard"));
                cardToDiscard.setNotTarget(true);
                if (player.choose(Outcome.Discard, drawnCards, cardToDiscard, game)) {
                    Card card = player.getHand().get(cardToDiscard.getFirstTarget(), game);
                    if (card != null) {
                        return player.discard(card, source, game);
                    }
                }
            }
           
            return true;
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Permanent blockingCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
        if (blockingCreature != null) {
            Player opponent = game.getPlayer(blockingCreature.getControllerId());
            if (opponent != null) {
                opponent.discard(1, source, game);
                return true;
            }
        }
        return false;
    }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            int amount = player.getHand().getCards(game).size();
            for (Card c : player.getHand().getCards(game)) {
                player.discard(c, source, game);
            }
            player.drawCards(amount, game);
            return true;
        }
        return false;
View Full Code Here

            TargetDiscard target = new TargetDiscard(player.getId());
            if (target.canChoose(source.getSourceId(), player.getId(), game)) {
                player.choose(Outcome.Discard, target, source.getSourceId(), game);
                Card card = player.getHand().get(target.getFirstTarget(), game);
                if (card != null) {
                    player.discard(card, source, game);
                    int damage = card.getManaCost().convertedManaCost();
                    Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
                    if (creature != null) {
                        creature.damage(damage, source.getSourceId(), game, false, true);
                        return true;
View Full Code Here

                effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
                effect.apply(game, source);
                return true;
            } else  {
                // discards a card instead. If the player discards a card this way, he or she draws a card.
                player.discard(1, source, game);
                return false; // because player draws a card, the draw event is kept
            }
        }
        return false;
    }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            int amountToKeep = source.getManaCostsToPay().getX();
            if (amountToKeep == 0) {
                player.discard(player.getHand().size(), source, game);
            }
            else if (amountToKeep < player.getHand().size()) {
                TargetCardInHand target = new TargetCardInHand(amountToKeep, new FilterCard());
                target.setTargetName("cards to keep");
                target.choose(Outcome.Benefit, player.getId(), source.getSourceId(), game);
View Full Code Here

                TargetCardInHand target = new TargetCardInHand(amountToKeep, new FilterCard());
                target.setTargetName("cards to keep");
                target.choose(Outcome.Benefit, player.getId(), source.getSourceId(), game);
                for (Card card : player.getHand().getCards(game)) {
                    if (!target.getTargets().contains(card.getId())) {
                        player.discard(card, source, game);
                    }
                }
            }
            return true;
        }
View Full Code Here

        for (UUID playerId : sourcePlayer.getInRange()) {
            Player player = game.getPlayer(playerId);
            if (player != null) {
                int discarded = 0;
                for (Card c : player.getHand().getCards(game)) {
                    if (player.discard(c, source, game))
                        discarded++;
                }
                if (discarded > maxDiscarded)
                    maxDiscarded = discarded;
            }
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.