Help implementing Chainer, Dementia Master

Can anyone help me with Chainer's reanimation ability? I have the return from the graveyard done, but am not sure how to set the creature's color to black and subtype to Nightmare. I looked at Ashiok, Nightmare Weaver's second ability, but am not sure how to work it into Chainer. Also with Chainer's exile ability, can I use the same filter, which uses FilterCreaturePermanent, or do I need to create a second filter using FilterPermanent in case some non-creature permanent has somehow gained the Nightmare subtype?
- Code: Select all
public class ChainerDementiaMaster extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Nightmare creatures");
static {
filter.add(new SubtypePredicate("Nightmare"));
}
public ChainerDementiaMaster(UUID ownerId) {
super(ownerId, 56, "Chainer, Dementia Master", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
this.expansionSetCode = "TOR";
this.supertype.add("Legendary");
this.subtype.add("Human");
this.subtype.add("Minion");
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Nightmare creatures get +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, false)));
// {B}{B}{B}, Pay 3 life: Put target creature card from a graveyard onto the battlefield under your control. That creature is black and is a Nightmare in addition to its other creature types.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect(), new ManaCostsImpl("{B}{B}{B}"));
ability.addCost(new PayLifeCost(3));
this.addAbility(ability);
// When Chainer, Dementia Master leaves the battlefield, exile all Nightmares.
Ability ability2 = new LeavesBattlefieldTriggeredAbility(new ExileAllEffect(filter), false);
this.addAbility(ability2);
}
public ChainerDementiaMaster(final ChainerDementiaMaster card) {
super(card);
}
@Override
public ChainerDementiaMaster copy() {
return new ChainerDementiaMaster(this);
}
}