Name:Elkin Lair
ManaCost:3 R
Types:World Enchantment
T:Mode$ Phase | Phase$ Upkeep | TriggerZones$ Battlefield | Execute$ TrigChangeZone | TriggerDescription$ At the beginning of each player's upkeep, that player exiles a card at random from their hand. The player may play that card this turn. At the beginning of the next end step, if the player hasn't played the card, they put it into their graveyard.
SVar:TrigChangeZone:DB$ ChangeZone | Origin$ Hand | Destination$ Exile | ChangeType$ Card | DefinedPlayer$ TriggeredPlayer | ChangeNum$ 1 | Hidden$ True | Mandatory$ True | AtRandom$ True | RememberChanged$ True | SubAbility$ ElkinEffect
SVar:ElkinEffect:DB$ Effect | StaticAbilities$ ElkinPlay | Duration$ Permanent | ExileOnMoved$ Exile | RememberObjects$ RememberedCard | Triggers$ TrigReturn,TrigDuration | SubAbility$ DBResetSVar
SVar:ElkinPlay:Mode$ Continuous | Affected$ Card.IsRemembered | MayPlay$ True | MayPlayPlayer$ CardOwner | EffectZone$ Command | AffectedZone$ Exile | CheckSVar$ ElkinSVar | Description$ The player may play that card this turn.
# Even though the Effect is "Permanent", it's not really permanent
SVar:DBResetSVar:DB$ StoreSVar | SVar$ ElkinSVar | Type$ Number | Expression$ 1 | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:ElkinSVar:Number$1
# Turn off the duration at the beginning of the next turn statically, just in case its somehow still there
SVar:TrigDuration:Mode$ TurnBegin | ValidPlayer$ Player | Static$ True | TriggerZones$ Command | Execute$ DBDuration
SVar:DBDuration:DB$ StoreSVar | SVar$ ElkinSVar | Type$ Number | Expression$ 0
# Return the card as a normal trigger
SVar:TrigReturn:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ Player | TriggerZones$ Command | Execute$ DBReturn | OneOff$ True | TriggerDescription$ At the beginning of the next end step, if the player hasn't played the card, they put it into their graveyard.
SVar:DBReturn:DB$ ChangeZone | Defined$ Remembered | Origin$ Exile | Destination$ Graveyard
AI:RemoveDeck:Random
Oracle:At the beginning of each player's upkeep, that player exiles a card at random from their hand. The player may play that card this turn. At the beginning of the next end step, if the player hasn't played the card, they put it into their graveyard.
