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