Name:Underdark Beholder
ManaCost:4 B B
Types:Creature Beholder
PT:6/6
K:etbCounter:EYESTALK:10
R:Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ Card.Self | ReplaceWith$ Counters | Description$ If damage would be dealt to CARDNAME, instead remove that many eyestalk counters from it. If you can't, sacrifice it.
SVar:Counters:DB$ RemoveCounter | Defined$ ReplacedTarget | CounterType$ EYESTALK | CounterNum$ X | RememberRemoved$ True | SubAbility$ DBSac
SVar:DBSac:DB$ Sacrifice | SacValid$ Self | ConditionCheckSVar$ Y | ConditionSVarCompare$ LTX | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:ReplaceCount$DamageAmount
SVar:Y:Count$RememberedSize
SVar:Z:Count$CardCounters.EYESTALK
T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigDig | TriggerDescription$ Whenever CARDNAME attacks, reveal cards from the top of your library until you reveal an instant, sorcery, or enchantment card with converted mana cost less than the number of eyestalk counters on CARDNAME. You may cast it without paying its mana cost. Shuffle your library.
SVar:TrigDig:DB$ DigUntil | Defined$ You | Amount$ 1 | Valid$ Card.Instant+cmcLEZ,Card.Sorcery+cmcLEZ,Card.Enchantment+cmcLEZ | NoMoveRevealed$ True | RememberFound$ True | SubAbility$ CascadeCast
SVar:CascadeCast:DB$ Play | ValidSA$ Spell | Defined$ Remembered | WithoutManaCost$ True | Optional$ True | SubAbility$ Shuffle
SVar:Shuffle:DB$ Shuffle | SubAbility$ DBCleanup
SVar:HasAttackEffect:TRUE
DeckHas:Ability$Counters
DeckHints:Type$Instant|Sorcery|Enchantment
Oracle:Underdark Beholder enters with ten eyestalk counters on it.\nIf Underdark Beholder would be dealt damage, remove that many eyestalk counters from it instead. If you can't, sacrifice it.\nWhenever Underdark Beholder attacks, reveal cards from the top of your library until you reveal an instant, sorcery, or enchantment card with converted mana cost less than the number of eyestalk counters on Underdark Beholder. You may cast it without paying its mana cost. Shuffle your library.
