Token copies of Undercover Operative causing rollback.
- Dominant language
- Java
- Stars
- 2.4k
- Forks
- 940
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 160
Description
`Caused by: java.lang.ClassCastException: mage.game.permanent.token.EmptyToken cannot be cast to mage.game.permanent.Permanent
at mage.cards.u.UndercoverOperativeApplier.apply(UndercoverOperative.java:59)
at mage.abilities.effects.common.CreateTokenCopyTargetEffect.apply(CreateTokenCopyTargetEffect.java:205)
at mage.abilities.AbilityImpl.resolveMode(AbilityImpl.java:200)
at mage.abilities.AbilityImpl.resolve(AbilityImpl.java:184)
at mage.abilities.TriggeredAbilityImpl.resolve(TriggeredAbilityImpl.java:150)
at mage.game.stack.StackAbility.resolve(StackAbility.java:89)
at mage.player.ai.ComputerPlayer6.resolve(ComputerPlayer6.java:414)
at mage.player.ai.ComputerPlayer6.addActions(ComputerPlayer6.java:254)
at mage.player.ai.ComputerPlayer6.simulatePriority(ComputerPlayer6.java:530)
at mage.player.ai.ComputerPlayer6.addActions(ComputerPlayer6.java:290)
at mage.player.ai.ComputerPlayer6.simulatePriority(ComputerPlayer6.java:530)
at mage.player.ai.ComputerPlayer6.addActions(ComputerPlayer6.java:290)
at mage.player.ai.ComputerPlayer6.simulatePriority(ComputerPlayer6.java:530)
at mage.player.ai.ComputerPlayer6.addActions(ComputerPlayer6.java:290)
at mage.player.ai.ComputerPlayer6$1.call(ComputerPlayer6.java:432)
at mage.player.ai.ComputerPlayer6$1.call(ComputerPlayer6.java:429)
... 4 more`
Steps to reproduce: I was playing against an AI, I played a [[Miirym, Sentinel Wyrm]], then [[Undercover Operative]] copying Miirym. I kept the original Miirym, allowing Undercover Operative to go to the graveyard due to legend rule, and then Miirym's triggered ability should result in a token Undercover Operative but resulted in this error instead.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with mage.cards.u.UndercoverOperativeApplier.apply in UndercoverOperative.java at line 59 and follow CreateTokenCopyTargetEffect.apply in CreateTokenCopyTargetEffect.java at line 205. Reproduce the Miirym and Undercover Operative sequence against the AI, then trace how the token copy is handled after the legend-rule choice. Done means the sequence completes without the ClassCastException or rollback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100