Package mage.players

Examples of mage.players.Player.discard()


            if (randomDiscard) {
                int maxAmount = Math.min(amount.calculate(game, source, this), player.getHand().size());
                for (int i = 0; i < maxAmount; i++) {
                    Card card = player.getHand().getRandom(game);
                    if (card != null) {
                        player.discard(card, source, game);
                        if (setTargetPointer) {
                            for (Effect effect : source.getEffects()) {
                                effect.setTargetPointer(new FixedTarget(card.getId()));
                            }
                        }
View Full Code Here


                            }
                        }
                    }
                }
            } else {
                player.discard(amount.calculate(game, source, this), source, game);
            }

            return true;
        }
        return false;
View Full Code Here

                if(card != null){
                    if(card.getCardType().contains(CardType.LAND)){
                        card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false);
                    }
                    else{
                        player.discard(card, source, game);
                    }
                }
            }
           
        }  
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Permanent permanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
        if (permanent != null) {
            Player player = game.getPlayer(permanent.getControllerId());
            if (player != null) {
                player.discard(1, source, game);
                return true;
            }
        }
        return false;
    }
View Full Code Here

        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            for (UUID playerId: getTargetPointer().getTargets(game, source)) {
                Player player = game.getPlayer(playerId);               
                if (player != null) {
                    player.discard(player.getHand().size(), source, game);
                }
            }
            return true;
        }
        return false;
View Full Code Here

            Cards hand = player.getHand();
            player.revealCards("Trapfinder's Trick", hand, game);
            Set<Card> cards = hand.getCards(game);
            for (Card card : cards) {
                if (card != null && card.hasSubtype("Trap")) {
                    player.discard(card, source, game);
                }
            }
            return true;
        }
        return false;
View Full Code Here

    @Override
    public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
        Player player = game.getPlayer(controllerId);
        if (player != null) {
            for (Card card : player.getHand().getCards(game)) {
                player.discard(card, ability, game);
            }
            paid = true;
        }
        return paid;
    }
View Full Code Here

            int amount = this.getTargets().get(0).getMaxNumberOfTargets();
            int maxAmount = Math.min(amount, player.getHand().size());
            for (int i = 0; i < maxAmount; i++) {
                Card card = player.getHand().getRandom(game);
                if (card != null) {
                    paid |= player.discard(card, null, game);
                }
            }
        } else {
            if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) {
           
View Full Code Here

                    Card card = player.getHand().get(targetId, game);
                    if (card == null) {
                        return false;
                    }
                    this.cards.add(card.copy());
                    paid |= player.discard(card, ability, game);
                }
            }
        }
        return paid;
    }
View Full Code Here

    public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
        Player player = game.getPlayer(controllerId);
        if (player != null) {
            Card card = player.getHand().get(sourceId, game);
            if (card != null) {
                paid = player.discard(card, null, game);
            }
        }
        return paid;
    }
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.