Package mage.target.common

Examples of mage.target.common.TargetDiscard


  }

  @Override
  public void discardToMax(Game game) {
    while (hand.size() > this.maxHandSize) {
      TargetDiscard target = new TargetDiscard(playerId);
      chooseTarget(Outcome.Discard, target, null, game);
      discard(hand.get(target.getFirstTarget(), game), null, game);
    }
  }
View Full Code Here


      }
      game.fireInformEvent(name + " discards " + Integer.toString(discardAmount) + " card" + (discardAmount > 1?"s":""));
      return;
    }
    for (int i = 0; i < amount; i++) {
      TargetDiscard target = new TargetDiscard(playerId);
      choose(Outcome.Discard, target, game);
      discard(hand.get(target.getFirstTarget(), game), source, game);
    }
    game.fireInformEvent(name + " discards " + Integer.toString(amount) + " card" + (amount > 1?"s":""));
  }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        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

                            if (!cards.contains(card.getId())) {
                                cards.add(card);
                            }
                        }
                    } else {
                        Target target = new TargetDiscard(numberOfCardsToDiscard, numberOfCardsToDiscard, new FilterCard(), playerId);
                        player.chooseTarget(outcome, target, source, game);
                        cards.addAll(target.getTargets());
                    }
                    cardsToDiscard.put(playerId, cards);
                }
            }
            // discard all choosen cards
View Full Code Here

    @Override
    public void discardToMax(Game game) {
        if (hand.size() > this.maxHandSize) {
            game.informPlayers(new StringBuilder(getName()).append(" discards down to ").append(this.maxHandSize).append(this.maxHandSize == 1?" hand card":" hand cards").toString());
            while (isInGame() && hand.size() > this.maxHandSize) {
                TargetDiscard target = new TargetDiscard(playerId);
                target.setTargetName(new StringBuilder(" card to discard (").append(hand.size() - this.maxHandSize).append(" in total)").toString());
                choose(Outcome.Discard, target, null, game);
                discard(hand.get(target.getFirstTarget(), game), null, game);
            }
        }
    }
View Full Code Here

        int numDiscarded = 0;
        while (isInGame() && numDiscarded < amount) {
            if (hand.size() == 0) {
                break;
            }
            TargetDiscard target = new TargetDiscard(playerId);
            choose(Outcome.Discard, target, source.getSourceId(), game);
            Card card = hand.get(target.getFirstTarget(), game);
            if (card != null) {
                numDiscarded++;
                discard(card, source, game);
            }
        }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            player.drawCards(1, game);
            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);
                if (card.getCardType().contains(CardType.CREATURE)) {
                    Permanent permanent = game.getPermanent(source.getSourceId());
                    if (permanent != null) {
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player you = game.getPlayer(source.getControllerId());
        Permanent dragon = game.getPermanent(source.getSourceId());
        you.drawCards(1, game);
        TargetDiscard target = new TargetDiscard(you.getId());
        you.choose(Outcome.Discard, target, source.getSourceId(), game);
        Card card = you.getHand().get(target.getFirstTarget(), game);
        if (card != null && you.discard(card, source, game)) {
            int cmc = card.getManaCost().convertedManaCost();
            if (dragon != null) {
                game.addEffect(new BoostSourceEffect(cmc, 0, Duration.EndOfTurn), source);
                return true;
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(targetPointer.getFirst(game, source));
        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;
            }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
        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);
                }
View Full Code Here

TOP

Related Classes of mage.target.common.TargetDiscard

Copyright © 2018 www.massapicom. 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.