Name:Kindred Summons
ManaCost:5 G G
Types:Instant
A:SP$ ChooseType | Cost$ 5 G G | Defined$ You | Type$ Creature | SubAbility$ DBDigUntil | AILogic$ MostProminentComputerControls | SpellDescription$ Choose a creature type. Reveal cards from the top of your library until you reveal X creature cards of the chosen type, where X is the number of creatures you control of that type. Put those cards onto the battlefield, then shuffle the rest of the revealed cards into your library.
SVar:DBDigUntil:DB$ DigUntil | Amount$ X | ConditionCheckSVar$ X | ConditionSVarCompare$ GE1 | Valid$ Creature.ChosenType+YouOwn | ValidDescription$ creature with chosen type | RevealedDestination$ Library | RevealedLibraryPosition$ -1 | FoundDestination$ Battlefield | SubAbility$ DBShuffle
SVar:DBShuffle:DB$ Shuffle | Defined$ You
SVar:X:Count$Valid Creature.ChosenType+YouCtrl
AI:RemoveDeck:Random
#TODO: This could benefit from something like "Creature.YouCtrl+sharesCreatureTypeWithAnotherCreature" (doesn't exist in code yet)
SVar:NeedsToPlay:Creature.YouCtrl+inZoneBattlefield
SVar:Picture:http://www.wizards.com/global/images/magic/general/kindred_summons.jpg
Oracle:Choose a creature type. Reveal cards from the top of your library until you reveal X creature cards of the chosen type, where X is the number of creatures you control of that type. Put those cards onto the battlefield, then shuffle the rest of the revealed cards into your library.
