Package mage.players

Examples of mage.players.Player.discard()


      Player player = game.getPlayer(controllerId);
      for (UUID targetId: targets.get(0).getTargets()) {
        Card card = player.getHand().get(targetId, game);
        if (card == null)
          return false;
        paid |= player.discard(card, null, game);
      }
    }
    return paid;
  }
View Full Code Here


  @Override
  public boolean pay(Game game, UUID sourceId, UUID controllerId, boolean noMana) {
    Player player = game.getPlayer(controllerId);
    Card card = player.getHand().get(sourceId, game);
    return player.discard(card, null, game);
  }

  @Override
  public String getText() {
    return "Discard {this}";
View Full Code Here

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getFirstTarget());
    if (player != null) {
      player.discard(amount, source, game);
      return true;
    }
    return false;
  }
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);
                source.getEffects().get(1).setValue("discardedCard", card);
                game.getState().setValue(source.getSourceId().toString(), card);
                return true;
            }
        }
View Full Code Here

                    Cards cardsPlayer = cardsToDiscard.get(playerId);
                    if (cardsPlayer != null) {
                        for (UUID cardId : cardsPlayer) {
                            Card card = game.getCard(cardId);
                            if (card != null) {
                                player.discard(card, source, game);
                            }
                        }
                    }
                }
            }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            if (!optional || player.chooseUse(outcome, "User draw, then discard effect?", game)) {
                player.drawCards(cardsToDraw, game);
                player.discard(cardsToDiscard, source, game);
            }
            return true;
        }
        return false;
    }
View Full Code Here

        for (UUID playerId : sourcePlayer.getInRange()) {
            Player player = game.getPlayer(playerId);
            if (player != null) {
                Set<Card> cards = player.getHand().getCards(game);
                for (Card card : cards) {
                    player.discard(card, source, game);
                }
            }
  }
        return true;
    }
View Full Code Here

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

            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) {
                        result |= player.discard(card, source, game);
                    }
                }
            } else {
                player.discard(amount.calculate(game, source, this), source, game);
                result = true;
View Full Code Here

                    if (card != null) {
                        result |= player.discard(card, source, game);
                    }
                }
            } else {
                player.discard(amount.calculate(game, source, this), source, game);
                result = true;
            }
        }
        return result;
    }
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.