Attempt at Rebound

So I am currently poking at the Rebound keyword and,well, so far so good. The card exiles properly without going to the graveyard and gets cast again your next upkeep. There is a problem I've been banging my head on for a while,though, namely that the card keeps it's target (I've been testing with Staggershock) for the second casting. i.e. if I target an Ornithopter and send it to the graveyard, at my next upkeep it will cast for free and try to target the same Ornithopter(still in the graveyard) without setting a targeting input state. I've been trawling through the SpellAbility,Target and GameActionUtil classes to figure out why it skips the input state or how I can reset the targeting.I would greatly appreciate it if anyone with more insight into those classes has any ideas to share.
The code so far:
GameActionUtil.java:
The code so far:
GameActionUtil.java:
- Code: Select all
public static CardList Rebounded_Human = new CardList();
public static CardList Rebounded_AI = new CardList();
public static void executeUpkeepEffects() {
if(AllZone.GameAction.isPlayerTurn(AllZone.HumanPlayer))
{
for(Card c : Rebounded_Human)
{
AllZone.GameAction.playCardNoCost(c); //Same method that cascade uses
}
Rebounded_Human.clear();
}
else
{
for(Card c : Rebounded_AI)
{
if(c.getSpellAbility()[0].canPlayAI())
{
AllZone.GameAction.playCardNoCost(c);
}
}
Rebounded_AI.clear();
}
...Nothing changed afterwards...
- Code: Select all
if(hasKeyword(card,"Rebound") != -1) {
final Command graveyardReplacer = new Command() {
private static final long serialVersionUID = 1489845860231758299L;
public void execute() {
AllZone.GameAction.exile(card);
if(card.getController() == AllZone.HumanPlayer)
{
GameActionUtil.Rebounded_Human.add(card);
}
else
{
GameActionUtil.Rebounded_AI.add(card);
}
card.clearReplaceMoveToGraveyardCommandList();
}
};
card.addReplaceMoveToGraveyardCommand(graveyardReplacer);
}
- Code: Select all
Name:Staggershock
ManaCost:2 R
Types:Instant
Text:no text
A:SP$DealDamage|Cost$2 R|Tgt$TgtCP|NumDmg$2|SpellDescription$CARDNAME deals 2 damage to target creature or player.
K:Rebound
End