Пример #1
0
  /**
   * Champion one or more creature types or if the subtype array is empty champion every creature.
   *
   * @param card
   * @param subtypes subtypes to champion with, if empty all creatures can be used
   * @param requiresCreature for cards that specifically require championing another creature
   */
  public ChampionAbility(Card card, String[] subtypes, boolean requiresCreature) {
    super(Zone.BATTLEFIELD, null);

    this.subtypes = subtypes;
    StringBuilder sb = new StringBuilder("another ");
    ArrayList<Predicate<MageObject>> subtypesPredicates = new ArrayList<>();
    if (!subtypes[0].isEmpty()) {
      int i = 0;
      for (String subtype : this.subtypes) {
        subtypesPredicates.add(new SubtypePredicate(subtype));
        if (i == 0) {
          sb.append(subtype);
        } else {
          sb.append(" or ").append(subtype);
        }
        i++;
      }
    } else {
      sb.append("creature");
    }
    this.objectDescription = sb.toString();
    FilterControlledPermanent filter = new FilterControlledPermanent(objectDescription);
    if (!subtypesPredicates.isEmpty()) {
      filter.add(Predicates.or(subtypesPredicates));
    }
    if (requiresCreature) {
      filter.add(new CardTypePredicate(CardType.CREATURE));
    }
    filter.add(new AnotherPredicate());

    // When this permanent enters the battlefield, sacrifice it unless you exile another [object]
    // you control.
    Ability ability1 =
        new EntersBattlefieldTriggeredAbility(
            new SacrificeSourceUnlessPaysEffect(
                new ChampionExileCost(
                    filter,
                    new StringBuilder(card.getName()).append(" championed permanents").toString())),
            false);
    ability1.setRuleVisible(false);
    addSubAbility(ability1);

    // When this permanent leaves the battlefield, return the exiled card to the battlefield under
    // its owner's control.
    Ability ability2 =
        new LeavesBattlefieldTriggeredAbility(
            new ReturnFromExileForSourceEffect(Zone.BATTLEFIELD), false);
    ability2.setRuleVisible(false);
    addSubAbility(ability2);
  }
Пример #2
0
 static {
   filter.add(new SubtypePredicate("Demon"));
 }
Пример #3
0
 static {
   filterCard.add(new SubtypePredicate("Myr"));
   filterMyr.add(new SubtypePredicate("Myr"));
 }
Пример #4
0
 static {
   filter.add(new SubtypePredicate("Goblin"));
 }
Пример #5
0
 static {
   filter.add(
       Predicates.or(new CardTypePredicate(CardType.CREATURE), new SubtypePredicate("Aura")));
 }
Пример #6
0
 static {
   filter.add(Predicates.not(new TappedPredicate()));
   filter.add(new SubtypePredicate("Elf"));
 }
Пример #7
0
 static {
   filterSacrificed.add(new CardTypePredicate(CardType.ARTIFACT));
   filterTargetedCreatures.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
 }
Пример #8
0
 static {
   filter.add(new ControllerPredicate(TargetController.YOU));
   filter.add(Predicates.not(new TokenPredicate()));
   filterClue.add(new SubtypePredicate("Clue"));
 }
Пример #9
0
 static {
   filter.add(new ColorPredicate(ObjectColor.GREEN));
 }
Пример #10
0
 static {
   filterElemental.add(new SubtypePredicate("Elemental"));
   filterGiant.add(new SubtypePredicate("Giant"));
 }
Пример #11
0
 static {
   filter.add(new SubtypePredicate("Swamp"));
 }
Пример #12
0
 static {
   filter.add(new SubtypePredicate("Island"));
   filter.add(new CardTypePredicate(CardType.LAND));
 }
Пример #13
0
 static {
   filter.add(new SubtypePredicate("Forest"));
 }
Пример #14
0
 static {
   flyingCreatureFilter.add(new AbilityPredicate(FlyingAbility.class));
   controlledElvesFilter.add(new SubtypePredicate("Elf"));
 }
Пример #15
0
 static {
   filter.add(new AnotherPredicate());
 }
Пример #16
0
 static {
   filter.add(new CardTypePredicate(CardType.LAND));
   filter.add(new SubtypePredicate("Swamp"));
 }
Пример #17
0
 static {
   filter.add(new SubtypePredicate("Mountain"));
   filter2.add(new SubtypePredicate("Forest"));
 }
Пример #18
0
 public ChampionExileCost(FilterControlledPermanent filter, String exileZone) {
   this.addTarget(new TargetControlledPermanent(1, 1, filter, true));
   this.text = "exile " + filter.getMessage() + " you control";
   this.exileZone = exileZone;
 }
Пример #19
0
 static {
   filter.add(new CardTypePredicate(CardType.ARTIFACT));
 }
Пример #20
0
 static {
   filter.add(Predicates.not(new TokenPredicate()));
   filter.add(new AnotherPredicate());
   filter2.add(new SubtypePredicate("Rat"));
 }