Package mage.players

Examples of mage.players.Player.discard()


    @Override
    public boolean apply(Game game, Ability source) {
        Player targetPlayer = game.getPlayer(source.getFirstTarget());
        if (targetPlayer != null) {
            int count = Math.min(2, targetPlayer.getHand().size());
            targetPlayer.discard(2, source, game);
            targetPlayer.drawCards(count, game);
            return true;
        }
        return false;
    }
View Full Code Here


    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
        if (player != null) {
            player.drawCards(cardsToDraw, game);
            player.discard(cardsToDiscard, source, game);
            return true;
        }
        return false;
    }
View Full Code Here

  @Override
  public boolean apply(Game game, Ability source) {
    for (UUID playerId: game.getOpponents(source.getControllerId())) {
      Player player = game.getPlayer(playerId);
      player.discard(1, source, game);
    }
    return true;
  }

  @Override
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        for (UUID opponentId : game.getOpponents(source.getControllerId())) {
            Player opponent = game.getPlayer(opponentId);
            for (Card c : opponent.getHand().getCards(game)) {
                opponent.discard(c, source, game);
            }
        }
        return true;
    }
View Full Code Here

        if (controller != null) {
            for (UUID playerId : controller.getInRange()) {
                Player player = game.getPlayer(playerId);
                if (player != null) {
                    for (Card card : player.getHand().getCards(game)) {
                        player.discard(card, source, game);
                    }

                    player.drawCards(7, game);
                }
            }
View Full Code Here

                while (player.getHand().size() > 1) {
                    for (UUID uuid : player.getHand()) {
                        if (!uuid.equals(target.getFirstTarget())) {
                            Card card = player.getHand().get(uuid, game);
                            if (card != null) {
                                player.discard(card, source, game);
                                break;
                            }
                        }
                    }
                }
View Full Code Here

                        break COSTS;
                    }
                }
            }
            if (power > 0) {
                targetPlayer.discard(power, source, game);
            }
            return true;
        }
        return false;
    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player you = game.getPlayer(source.getControllerId());
        if (you != null) {
            you.discard(1, source, game);
            if (you.drawCards(1, game) > 0) {
                return true;
            }
        }
        return false;
View Full Code Here

        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            // Discard X cards
            int amount = source.getManaCostsToPay().getX();
            int discarded = Math.min(amount, player.getHand().size());
            player.discard(amount, source, game);
           
            // then return a card from your graveyard to your hand for each card discarded this way
            TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(discarded, new FilterCard());
            target.choose(Outcome.ReturnToHand, player.getId(), source.getSourceId(), game);
            for (UUID targetId : target.getTargets()) {
View Full Code Here

            }
           
            if (!creatureCardsInHand.isEmpty()) {
                Card card = creatureCardsInHand.getRandom(game);
                if (card != null) {
                    player.discard(card, source, 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.