Hi,
First of all, the card you cast can't be exiled inside effect because it will go to graveyard on resolution anyway. What you need in such cases is PostResolveEffect to be implemented that will exile it instead.
And for "exile {this}" effects there is PostResolveEffect already created so all you need is just to add:
- Code: Select all
this.getSpellAbility().addEffect(ExileSpellEffect.getInstance());
Take a look at
Temporal Mastery as an example.
Next is about the cards you target in graveyard, exile and copy.
Whenever you call card.copy() you create exact copy of the card. You don't create a clone copy, but just make another reference to it. So your code exiles the same card, but then you cast it that again according to rules puts it to the graveyard so that's why it looks like the exile effect doesn't work: but it works, the game just puts the same card back to graveyard.
What should be done in such cases is giving new id to the copied card and adding it to the game so it could track it:
- Code: Select all
if (cardTwo != null) {
cardTwo.moveToExile(null, "Exiled card from opponent's graveyard", source.getId(), game);
Card copyTwo = cardTwo.copy();
copyTwo.assignNewId();
copyTwo.setControllerId(source.getControllerId());
Set<Card> cards = new HashSet<Card>();
cards.add(copyTwo);
game.loadCards(cards, source.getControllerId());
you.cast(copyTwo.getSpellAbility(), game, true);
}
I'll add method to the Game interface for copying card, so it will be shorter and look like:
- Code: Select all
Card copyTwo = game.copyCard(cardTwo, source, newController);
Best Regards,
Noxx