Name:Mindblaze
ManaCost:5 R
Types:Sorcery
A:SP$ NameCard | ValidCards$ Card.nonLand | ValidDescription$ nonland | SubAbility$ DBChooseNumber | SpellDescription$ Choose a nonland card name and a number greater than 0. Target player reveals their library. If that library contains exactly the chosen number of cards with the chosen name, CARDNAME deals 8 damage to that player. Then that player shuffles their library.
SVar:DBChooseNumber:DB$ ChooseNumber | Min$ 1 | SubAbility$ DBReveal
SVar:DBReveal:DB$ PeekAndReveal | PeekNum$ X | NoPeek$ True | ValidTgts$ Player | TgtPrompt$ Select target player | RememberRevealed$ True | SubAbility$ DBDamage
SVar:DBDamage:DB$ DealDamage | NumDmg$ 8 | Defined$ Targeted | ConditionDefined$ Remembered | ConditionPresent$ Card.NamedCard | ConditionCompare$ EQY | SubAbility$ DBShuffle
SVar:DBShuffle:DB$ Shuffle | Defined$ ParentTarget | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:TargetedPlayer$CardsInLibrary
SVar:Y:Count$ChosenNumber
AI:RemoveDeck:All
AI:RemoveDeck:Random
Oracle:Choose a nonland card name and a number greater than 0. Target player reveals their library. If that library contains exactly the chosen number of cards with the chosen name, Mindblaze deals 8 damage to that player. Then that player shuffles.
