Exemplo n.º 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);
  }
Exemplo n.º 2
0
 static {
   filter.add(new SubtypePredicate("Demon"));
 }
Exemplo n.º 3
0
 static {
   filterCard.add(new SubtypePredicate("Myr"));
   filterMyr.add(new SubtypePredicate("Myr"));
 }
Exemplo n.º 4
0
 static {
   filter.add(new SubtypePredicate("Goblin"));
 }
Exemplo n.º 5
0
 static {
   filter.add(
       Predicates.or(new CardTypePredicate(CardType.CREATURE), new SubtypePredicate("Aura")));
 }
Exemplo n.º 6
0
 static {
   filter.add(Predicates.not(new TappedPredicate()));
   filter.add(new SubtypePredicate("Elf"));
 }
Exemplo n.º 7
0
 static {
   filterSacrificed.add(new CardTypePredicate(CardType.ARTIFACT));
   filterTargetedCreatures.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
 }
Exemplo n.º 8
0
 static {
   filter.add(new ControllerPredicate(TargetController.YOU));
   filter.add(Predicates.not(new TokenPredicate()));
   filterClue.add(new SubtypePredicate("Clue"));
 }
Exemplo n.º 9
0
 static {
   filter.add(new ColorPredicate(ObjectColor.GREEN));
 }
Exemplo n.º 10
0
 static {
   filterElemental.add(new SubtypePredicate("Elemental"));
   filterGiant.add(new SubtypePredicate("Giant"));
 }
Exemplo n.º 11
0
 static {
   filter.add(new SubtypePredicate("Swamp"));
 }
Exemplo n.º 12
0
 static {
   filter.add(new SubtypePredicate("Island"));
   filter.add(new CardTypePredicate(CardType.LAND));
 }
Exemplo n.º 13
0
 static {
   filter.add(new SubtypePredicate("Forest"));
 }
Exemplo n.º 14
0
 static {
   flyingCreatureFilter.add(new AbilityPredicate(FlyingAbility.class));
   controlledElvesFilter.add(new SubtypePredicate("Elf"));
 }
Exemplo n.º 15
0
 static {
   filter.add(new AnotherPredicate());
 }
Exemplo n.º 16
0
 static {
   filter.add(new CardTypePredicate(CardType.LAND));
   filter.add(new SubtypePredicate("Swamp"));
 }
Exemplo n.º 17
0
 static {
   filter.add(new SubtypePredicate("Mountain"));
   filter2.add(new SubtypePredicate("Forest"));
 }
Exemplo n.º 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;
 }
Exemplo n.º 19
0
 static {
   filter.add(new CardTypePredicate(CardType.ARTIFACT));
 }
Exemplo n.º 20
0
 static {
   filter.add(Predicates.not(new TokenPredicate()));
   filter.add(new AnotherPredicate());
   filter2.add(new SubtypePredicate("Rat"));
 }