Beispiel #1
0
 private Choice buildChoice(ManaCosts manaCosts, ManaCosts manaCostsSpell) {
   Choice choice = new ChoiceImpl();
   String creatureCosts = manaCosts.getText();
   String spellCosts = manaCostsSpell.getText();
   if (creatureCosts.contains("B") && spellCosts.contains("B")) {
     choice.getChoices().add("Black");
   }
   if (creatureCosts.contains("U") && spellCosts.contains("U")) {
     choice.getChoices().add("Blue");
   }
   if (creatureCosts.contains("G") && spellCosts.contains("G")) {
     choice.getChoices().add("Green");
   }
   if (creatureCosts.contains("R") && spellCosts.contains("R")) {
     choice.getChoices().add("Red");
   }
   if (creatureCosts.contains("W") && spellCosts.contains("W")) {
     choice.getChoices().add("White");
   }
   return choice;
 }
Beispiel #2
0
  @Override
  public String getRule(boolean all) {
    StringBuilder sbRule = threadLocalBuilder.get();
    if (all || this.abilityType != AbilityType.SPELL) {
      if (manaCosts.size() > 0) {
        sbRule.append(manaCosts.getText());
      }
      if (costs.size() > 0) {
        if (sbRule.length() > 0) {
          sbRule.append(",");
        }
        sbRule.append(costs.getText());
      }
      if (sbRule.length() > 0) {
        sbRule.append(": ");
      }
    }

    String ruleStart = sbRule.toString();
    String text = getModes().getText();
    String rule;
    if (!text.isEmpty()) {
      if (ruleStart.length() > 1) {
        String end = ruleStart.substring(ruleStart.length() - 2).trim();
        if (end.isEmpty() || end.equals(":") || end.equals(".")) {
          rule = ruleStart + Character.toUpperCase(text.charAt(0)) + text.substring(1);
        } else {
          rule = ruleStart + text;
        }
      } else {
        rule = ruleStart + text;
      }
    } else {
      rule = ruleStart;
    }
    if (abilityWord != null) {
      rule =
          "<i>"
              + abilityWord
              + "</i> &mdash; "
              + Character.toUpperCase(rule.charAt(0))
              + rule.substring(1);
    }
    return rule;
  }
Beispiel #3
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player player = game.getPlayer(source.getControllerId());
   if (player != null) {
     ManaCosts cost = new ManaCostsImpl("{5}{R}{R}");
     if (player.chooseUse(Outcome.Damage, "Pay " + cost.getText() + "?", game)) {
       cost.clearPaid();
       if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) {
         new UntapAllControllerEffect(new FilterAttackingCreature(), "").apply(game, source);
         game.getState()
             .getTurnMods()
             .add(new TurnMod(source.getControllerId(), Constants.TurnPhase.COMBAT, null, false));
         return true;
       }
     }
   }
   return false;
 }