/** * 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); }
static { filter.add(new SubtypePredicate("Demon")); }
static { filterCard.add(new SubtypePredicate("Myr")); filterMyr.add(new SubtypePredicate("Myr")); }
static { filter.add(new SubtypePredicate("Goblin")); }
static { filter.add( Predicates.or(new CardTypePredicate(CardType.CREATURE), new SubtypePredicate("Aura"))); }
static { filter.add(Predicates.not(new TappedPredicate())); filter.add(new SubtypePredicate("Elf")); }
static { filterSacrificed.add(new CardTypePredicate(CardType.ARTIFACT)); filterTargetedCreatures.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); }
static { filter.add(new ControllerPredicate(TargetController.YOU)); filter.add(Predicates.not(new TokenPredicate())); filterClue.add(new SubtypePredicate("Clue")); }
static { filter.add(new ColorPredicate(ObjectColor.GREEN)); }
static { filterElemental.add(new SubtypePredicate("Elemental")); filterGiant.add(new SubtypePredicate("Giant")); }
static { filter.add(new SubtypePredicate("Swamp")); }
static { filter.add(new SubtypePredicate("Island")); filter.add(new CardTypePredicate(CardType.LAND)); }
static { filter.add(new SubtypePredicate("Forest")); }
static { flyingCreatureFilter.add(new AbilityPredicate(FlyingAbility.class)); controlledElvesFilter.add(new SubtypePredicate("Elf")); }
static { filter.add(new AnotherPredicate()); }
static { filter.add(new CardTypePredicate(CardType.LAND)); filter.add(new SubtypePredicate("Swamp")); }
static { filter.add(new SubtypePredicate("Mountain")); filter2.add(new SubtypePredicate("Forest")); }
public ChampionExileCost(FilterControlledPermanent filter, String exileZone) { this.addTarget(new TargetControlledPermanent(1, 1, filter, true)); this.text = "exile " + filter.getMessage() + " you control"; this.exileZone = exileZone; }
static { filter.add(new CardTypePredicate(CardType.ARTIFACT)); }
static { filter.add(Predicates.not(new TokenPredicate())); filter.add(new AnotherPredicate()); filter2.add(new SubtypePredicate("Rat")); }