I'm investigating an issue with the cards returning to hand having lingering pre-selected abilities on them, such as e.g. when you play
Far // Away and choose Away but cancel it right before paying the mana cost, it returns to your hand and then for the rest of the game you can only cast it as Away (you can't choose Far anymore). This issue seems to also cause e.g.
Genju of the Fields to become unplayable after it returns to hand from the graveyard when the enchanted
Plains is destroyed.
I have narrowed the issue down to the fact that the card is not fully cleared when it returns to hand on this line (125) in GameAction.java:
- Code: Select all
copied = c;
Essentially, if a card comes from the graveyard to hand (or from the stack to hand), it's copied by direct assignment, which seems to carry over all the information from the card including (for some reason) its chosen spell abilities.
Modifying line 125, for instance, this way:
- Code: Select all
copied = zoneTo.is(ZoneType.Hand) ? CardFactory.copyCard(c, false) : c;
solves the problem (both the split cards and
Genju of the Fields tests pass) because CardFactory.copyCard fully recreates the card from scratch and copies over only the relevant information, skipping the temporary information mentioned above. However, on line 122 there's a comment saying "copy only the cards leaving the battlefield" - so I'm assuming the call above may not be optimal. Does anyone have an idea how to best solve this issue? (it seems rather serious because it affects basically all cards that involve spell ability choice and can then be canceled, as well as certain cards returning to hand which may have lingering spell ability information on them). I'm assuming that calling copyCard there should not be necessary because it's probably only a certain element of cleanup that needs to be performed, but so far I can't identify what exactly needs to be cleared from the card in order for it to return to its normal state without having to fully recreate it with copyCard(c, false).
- Agetian