Ejemplo n.º 1
0
 public TargetCardInExile(
     int minNumTargets, int maxNumTargets, FilterCard filter, UUID zoneId, boolean allExileZones) {
   super(minNumTargets, maxNumTargets, Zone.EXILED, filter);
   this.zoneId = zoneId;
   this.allExileZones = allExileZones;
   this.targetName = filter.getMessage();
 }
  private String setText() {
    StringBuilder sb = new StringBuilder("Target ");
    switch (targetController) {
      case OPPONENT:
        sb.append("opponent");
        break;
      case ANY:
        sb.append("player");
        break;
      default:
        throw new UnsupportedOperationException("target controller not supported");
    }
    if (revealAllCards) {
      sb.append(" reveals his or her hand");
    } else {
      if (numberCardsToReveal instanceof StaticValue) {
        sb.append(" reveales ");
        sb.append(numberCardsToReveal.getMessage());
        sb.append(" from his or her hand");
      } else {
        sb.append(" reveals a number of cards from his or her hand equal to ");
        sb.append(numberCardsToReveal.getMessage());
      }
    }
    sb.append(". You choose ");
    boolean discardMultipleCards = !numberCardsToDiscard.toString().equals("1");
    if (discardMultipleCards) {
      sb.append(numberCardsToDiscard).append(" ");
    } else {
      if (!filter.getMessage().startsWith("a ") && !filter.getMessage().startsWith("an ")) {
        sb.append("a ");
      }
    }
    sb.append(filter.getMessage());
    if (revealAllCards) {
      sb.append(" from it.");
    } else {
      sb.append(" of them.");
    }

    sb.append(" That player discards ")
        .append(discardMultipleCards ? "those cards" : "that card")
        .toString();
    return sb.toString();
  }
Ejemplo n.º 3
0
 public SpellsCostReductionAllEffect(FilterCard filter, int amount) {
   super(Duration.WhileOnBattlefield, Outcome.Benefit);
   this.filter = filter;
   this.amount = amount;
   this.staticText =
       new StringBuilder(filter.getMessage())
           .append(" cost {")
           .append(amount)
           .append("} less to cast")
           .toString();
 }
 public SpellsCostReductionControllerEffect(FilterCard filter, int amount, boolean upTo) {
   super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
   this.filter = filter;
   this.amount = amount;
   this.upTo = upTo;
   this.staticText =
       filter.getMessage()
           + " you cast cost "
           + (upTo ? "up to " : "")
           + "{"
           + amount
           + "} less to cast";
 }
  public SpellsCostReductionControllerEffect(
      FilterCard filter, ManaCosts<ManaCost> manaCostsToReduce) {
    super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
    this.filter = filter;
    this.amount = 0;
    this.manaCostsToReduce = manaCostsToReduce;
    this.upTo = false;

    StringBuilder sb = new StringBuilder();
    sb.append(filter.getMessage()).append(" you cast cost ");
    for (String manaSymbol : manaCostsToReduce.getSymbols()) {
      sb.append(manaSymbol);
    }
    sb.append(" less to cast. This effect reduces only the amount of colored mana you pay.");
    this.staticText = sb.toString();
  }
Ejemplo n.º 6
0
  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = source.getSourceObject(game);
    if (controller != null && sourceObject != null) {
      if (controller.chooseUse(Outcome.Benefit, choiceText, source, game)) {
        Set<Card> sideboard = controller.getSideboard().getCards(filter, game);
        List<Card> exile = game.getExile().getAllCards(game);
        Cards filteredCards = new CardsImpl();
        Card card = null;

        for (Card sideboardCard : sideboard) {
          filteredCards.add(sideboardCard.getId());
        }
        for (Card exileCard : exile) {
          if (exileCard.getOwnerId().equals(source.getControllerId())
              && exileCard.hasSubtype("Eldrazi")) {
            filteredCards.add(exileCard);
          }
        }

        if (filteredCards.isEmpty()) {
          game.informPlayer(
              controller,
              "You have no "
                  + filter.getMessage()
                  + " outside the game (your sideboard) or in exile.");
        } else {
          TargetCard target = new TargetCard(Zone.OUTSIDE, filter);
          target.setNotTarget(true);
          if (controller.choose(outcome, filteredCards, target, game)) {
            card = controller.getSideboard().get(target.getFirstTarget(), game);
            if (card == null) {
              card = game.getCard(target.getFirstTarget());
            }
          }
        }

        if (card != null) {
          card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
          controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
        }
      }
      return true;
    }
    return false;
  }
Ejemplo n.º 7
0
 @Override
 public String getMessage() {
   return filter.getMessage() + " in all graveyards";
 }