Re: Help implementing a card
Hello, I work as a developer and wanted to contribute to XMage. I decided I try to implement a card I use in my Rakdos, Lord of Riots EDH deck, Dread Cacodemon. I looked at cards programmed in XMage with similar effects, like Plague Wind for destroying all creatures you don't control, and Timbermare for tapping all other creatures. However, I'm not sure how to combine all of these to get the correct effect from the card.
This is what I have so far:
1) How to make the filter for "other creatures you control" - other than Dread Cacodemon.
2) How to add the TapAllEffect into the EntersBattlefieldTriggeredAbility function afterwords. Should I just add another ability variable with a new EBTA object for the tap all portion? I'm not sure what would happen with two EBTA functions on the same card? Perhaps that is the correct way to do it since the card reads "destroy all creatures your opponents control, then tap all other creatures you control." Then again, I need all those effects to be dependent on the card being cast from the hand.
Any help would be appreciated here. Thanks.
This is what I have so far:
- Code: Select all
private static final FilterCreaturePermanent filterCreaturesDontControl = new FilterCreaturePermanent("creatures you don't control");
static {
filterCreaturesDontControl.add(new ControllerPredicate(TargetController.NOT_YOU));
}
// perhaps way to filter for all other creatures you control?
private static final FilterCreaturePermanent filterOtherCreaturesYouControl = new FilterCreaturePermanent("other creatures you control");
static {
filterOtherCreaturesYouControl.add(new ControllerPredicate(TargetController.YOU));
// add predicate for Creature != Dread Cacodemon?
}
public DreadCacodemon(UUID ownerId) {
super(ownerId, 79, "Dread Cacodemon", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{7}{B}{B}{B}");
this.expansionSetCode = "CMD";
this.subtype.add("Demon");
this.power = new MageInt(8);
this.toughness = new MageInt(8);
// When Dread Cacodemon enters the battlefield,
// if you cast it from your hand, destroy all creatures your opponents control,
// then tap all other creatures you control.
Ability ability = new EntersBattlefieldTriggeredAbility(
new ConditionalOneShotEffect(new DestroyAllEffect(filterCreaturesDontControl, false), new CastFromHandCondition(),
" if you cast it from your hand, destroy all creatures your opponents control, then tap all other creatures you control."));
this.addAbility(ability, new CastFromHandWatcher());
/**
* perhaps? Once I get the filter right.
this.addAbility(new EntersBattlefieldTriggeredAbility(new TapAllEffect(filterOtherCreaturesYouControl)));
*/
}
1) How to make the filter for "other creatures you control" - other than Dread Cacodemon.
2) How to add the TapAllEffect into the EntersBattlefieldTriggeredAbility function afterwords. Should I just add another ability variable with a new EBTA object for the tap all portion? I'm not sure what would happen with two EBTA functions on the same card? Perhaps that is the correct way to do it since the card reads "destroy all creatures your opponents control, then tap all other creatures you control." Then again, I need all those effects to be dependent on the card being cast from the hand.
Any help would be appreciated here. Thanks.