Package mage.players

Examples of mage.players.Player.discard()


        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


            for (UUID playerId : controller.getInRange()) {
                Player player = game.getPlayer(playerId);
                if (player != null) {
                    int cards = player.getHand().size();
                    if (cards > 0) {
                        player.discard(cards, source, game);
                        player.drawCards(cards, game);
                    }
                }
            }
            return true;
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getFirstTarget());
        int handCount = player.getHand().count(new FilterCard(), game);
        player.drawCards(handCount, game);
        player.discard(handCount, source, game);
        return false;
    }
}
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player attacker = game.getPlayer(this.getTargetPointer().getFirst(game, source));
        if (attacker != null) {
            if (attacker.getHand().size() > 0 && attacker.chooseUse(outcome, "Discard a card and draw a card?", game)){
                attacker.discard(1, source, game);
                attacker.drawCards(1, game);
            }
            return true;
        }
        return false;
View Full Code Here

        if (player != null && targetPlayer != null) {
            targetPlayer.revealCards("Gruesome Discovery", targetPlayer.getHand(), game);

            if (targetPlayer.getHand().size() <= 2) {
                targetPlayer.discard(2, source, game);
            }

            TargetCard target = new TargetCard(2, Zone.PICK, new FilterCard());
            if (player.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) {
                List<UUID> targets = target.getTargets();
View Full Code Here

            if (player.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) {
                List<UUID> targets = target.getTargets();
                for (UUID targetId : targets) {
                    Card card = targetPlayer.getHand().get(targetId, game);
                    if (card != null) {
                        targetPlayer.discard(card, source, game);
                    }
                }
            }
            return true;
        }
View Full Code Here

        if (player != null) {
            TargetDiscard target = new TargetDiscard(player.getId());
            player.choose(Outcome.Discard, target, source.getSourceId(), game);
            Card card = player.getHand().get(target.getFirstTarget(), game);
            if (card != null) {
                player.discard(card, source, game);
                game.getState().setValue(source.getSourceId().toString(), card);
                return true;
            }
        }
        return false;
View Full Code Here

            for (UUID targetId: targets.get(0).getTargets()) {
                card = player.getHand().get(targetId, game);
                if (card == null) {
                    return false;
                }
                paid |= player.discard(card, null, game);

            }
        }
        return paid;
    }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            int sacrificeNumber = controller.getHand().size();
            if (sacrificeNumber > 0) {
                controller.discard(sacrificeNumber, source, game);
                for (UUID opponentId : game.getOpponents(controller.getId())) {
                    Player opponent = game.getPlayer(opponentId);
                    if (opponent != null) {
                        for (int i = 0; i < sacrificeNumber; i++) {
                            Target target = new TargetControlledPermanent(new FilterControlledCreaturePermanent());
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player you = game.getPlayer(source.getControllerId());
        Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source));
        if (damagedPlayer != null) {
            damagedPlayer.discard(1, source, game);
        }
        if (you != null) {
            you.drawCards(1, game);
        }
        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.