If you look at the official cards,
Cast Through Time has
- Code: Select all
Object():SetResolutionZone( ZONE_REMOVED_FROM_GAME )
inside the rebound ability it grants. So you should achieve the desired result by granting the following ability to the spell while it is on the stack:
- Code: Select all
<SPELL_ABILITY resource_id="1" active_zone="ZONE_STACK">
<RESOLUTION_TIME_ACTION>
Object():SetResolutionZone( ZONE_REMOVED_FROM_GAME )
</RESOLUTION_TIME_ACTION>
</SPELL_ABILITY>
There's still one thing to decide: how to grant this ability. It's not obvious because you select the target in the graveyard, so it goes through a zone change before getting to the stack. Hopefully, a Protect_CardPtr should be enough by making the main SPELL_ABILITY like this:
- Code: Select all
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil then
EffectDC():Get_Targets(0):Protect_CardPtr(0)
target:PlayFreeFromAnywhere( EffectController() )
end
</RESOLUTION_TIME_ACTION>
<CONTINUOUS_ACTION layer="6">
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil then
target:GetCurrentCharacteristics():GrantAbility(1)
end
</CONTINUOUS_ACTION>
<DURATION>
return EffectDC():Get_Targets(0):Get_CardPtr(0) == nil
</DURATION>
(Target definition, determination and choice omitted.)
Be aware that I'm not sure if it works as expected. Let me know.
P.S.: just in case you need it in the future, remember that instants and sorceries give no problems, but casting permanent cards belonging to another player doesn't work well: even if you are the one who casts the spell, the permanent will enter the battlefield under its owner's control anyway. This prevented me from coding
Silent-Blade Oni. Maybe we could invent some trick to make it work, but PlayFreeFromAnywhere has this limit on its own.