from dnd.roll import roll

from random import sample,choice



class Spell():
    def __init__(self, name, spell_class, level):
        self.name = name
        self.role = spell_class
        self.level = level
        
    def __str__(self):
        spell_class = ''
        if self.role == 'M':
            spell_class = 'Magic-User'
        elif self.role == 'I':
            spell_class = 'Illusionist'
        elif self.role == 'C':
            spell_class = 'Cleric'
        elif self.role == 'D':
            spell_class = 'Druid'
        
        
        ret = '{} ({} Lvl {})'.format(self.name,spell_class,self.level)
        return ret

    def __lt__(self,other):
        if self.level < other.level:
            return True
        elif self.level > other.level:
            return False
        else:
            if self.name.lower() < other.name.lower():
                return True
            else:
                return False
    
    def __eq__(self,other):
        if (self.name == other.name and
            self.level == other.level and
            self.role == other.role):
            return True
        else: return False
        
def randomSpellScroll(num,mu_min,mu_max,cl_min=0,cl_max=0):
    #Set cleric range to mu_range if cl_min/max are not given
    if (not cl_min): cl_min = mu_min
    if (not cl_max): cl_max = mu_max
    
    spells = ''

    r = roll(100)
    if r > 70:
        r = roll(100)
        if r > 75:
            spells = [s for s in druid_spells 
                if s.level >= cl_min and s.level <= cl_max]
        else:
            spells = [s for s in cleric_spells 
                if s.level >= cl_min and s.level <= cl_max]
    else:
        r = roll(100)
        if r > 90:
            spells = [s for s in illusionist_spells
                if s.level >= mu_min and s.level <= mu_max]
        else:
            spells = [s for s in mu_spells
                if s.level >= mu_min and s.level <= mu_max]
    
    spells = sample(spells, num)
    spells = sorted(spells, key=lambda spell: spell.level)
    spells = [str(s) for s in spells]
    return spells

cleric_spells = [
    Spell('Bless','C',1),
    Spell('Ceremony','C',1),
    Spell('Combine','C',1),
    Spell('Command','C',1),
    Spell('Create Water','C',1),
    Spell('Cure Light Wounds','C',1),
    Spell('Detect Evil','C',1),
    Spell('Detect Magic','C',1),
    Spell('Endure Cold/Heat','C',1),
    Spell('Invisibility to Undead','C',1),
    Spell('Light','C',1),
    Spell('Magic Stone','C',1),
    Spell('Penetrate Disguise','C',1),
    Spell('Portent','C',1),
    Spell('Precipitation','C',1),
    Spell('Protection From Evil','C',1),
    Spell('Purify Food & Drink','C',1),
    Spell('Remove Fear','C',1),
    Spell('Resist Cold','C',1),
    Spell('Sanctuary','C',1),
    Spell('Aid','C',2),
    Spell('Augury','C',2),
    Spell('Chant','C',2),
    Spell('Detect Charm','C',2),
    Spell('Detect Life','C',2),
    Spell('Dust Devil','C',2),
    Spell('Enthrall','C',2),
    Spell('Find Traps','C',2),
    Spell('Hold Person','C',2),
    Spell('Holy Symbol','C',2),
    Spell('Know Allignment','C',2),
    Spell('Messenger','C',2),
    Spell('Resist Fire','C',2),
    Spell('Silence 15\' Radius','C',2),
    Spell('Slow Poison','C',2),
    Spell('Snake Charm','C',2),
    Spell('Speak With Animals','C',2),
    Spell('Spiritual Hammer','C',2),
    Spell('Withdraw','C',2),
    Spell('Wyvern Watch','C',2),
    Spell('Animate Dead','C',3),
    Spell('Cloudburst','C',3),
    Spell('Continual Light','C',3),
    Spell('Create Food & Water','C',3),
    Spell('Cure Blindness','C',3),
    Spell('Cure Disease','C',3),
    Spell('Death\'s Door','C',3),
    Spell('Dispel Magic','C',3),
    Spell('Feign Death','C',3),
    Spell('Flame Walk','C',3),
    Spell('Glyph of Warding','C',3),
    Spell('Locate Object','C',3),
    Spell('Magical Vestment','C',3),
    Spell('Meld Into Stone','C',3),
    Spell('Negative Plane Protection','C',3),
    Spell('Prayer','C',3),
    Spell('Remove Curse','C',3),
    Spell('Remove Paralysis','C',3),
    Spell('Speak With Dead','C',3),
    Spell('Water Walk','C',3),
    Spell('Abjure','C',4),
    Spell('Cloak of Fear','C',4),
    Spell('Cure Serious Wounds','C',4),
    Spell('Detect Lie','C',4),
    Spell('Divination','C',4),
    Spell('Exorcise','C',4),
    Spell('Giant Insect','C',4),
    Spell('Imbue With Spell Ability','C',4),
    Spell('Lower Water','C',4),
    Spell('Neutralize Poison','C',4),
    Spell('Protection From Evil 10\' Radius','C',4),
    Spell('Speak With Plants','C',4),
    Spell('Spell Immunity','C',4),
    Spell('Spike Stones','C',4),
    Spell('Sticks to Snakes','C',4),
    Spell('Tongues','C',4),
    Spell('Air Walk','C',5),
    Spell('Animate Dead Monsters','C',5),
    Spell('Atonement','C',5),
    Spell('Commune','C',5),
    Spell('Cure Critical Wounds','C',5),
    Spell('Dispel Evil','C',5),
    Spell('Flame Strike','C',5),
    Spell('Golem','C',5),
    Spell('Insect Plague','C',5),
    Spell('Magic Font','C',5),
    Spell('Plane Shift','C',5),
    Spell('Quest','C',5),
    Spell('Rainbow','C',5),
    Spell('Raise Dead','C',5),
    Spell('Spike Growth','C',5),
    Spell('True Seeing','C',5),
    Spell('Aerial Servant','C',6),
    Spell('Animate Object','C',6),
    Spell('Blade Barrier','C',6),
    Spell('Conjure Animal','C',6),
    Spell('Find The Path','C',6),
    Spell('Forbiddance','C',6),
    Spell('Heal','C',6),
    Spell('Heroes\' Feast','C',6),
    Spell('Part Water','C',6),
    Spell('Speak With Monsters','C',6),
    Spell('Stone Tell','C',6),
    Spell('Word of Recall','C',6),
    Spell('Astral Spell','C',7),
    Spell('Control Weather','C',7),
    Spell('Earthquake','C',7),
    Spell('Exaction','C',7),
    Spell('Gate','C',7),
    Spell('Holy (Unholy) Word','C',7),
    Spell('Regenerate','C',7),
    Spell('Restoration','C',7),
    Spell('Resurrection','C',7),
    Spell('Succor','C',7),
    Spell('Symbol','C',7),
    Spell('Wind Walk','C',7)]
    
druid_spells = [
    Spell('Animal Friendship','D',1),
    Spell('Ceremony','D',1),
    Spell('Detect Balance','D',1),
    Spell('Detect Magic','D',1),
    Spell('Detect Poison','D',1),
    Spell('Detect Snares & Pits','D',1),
    Spell('Entangle','D',1),
    Spell('Faerie Fire','D',1),
    Spell('Invisibility to Animals','D',1),
    Spell('Locate Animals','D',1),
    Spell('Pass Without Trace','D',1),
    Spell('Precipitation','D',1),
    Spell('Predict Weather','D',1),
    Spell('Purify Water','D',1),
    Spell('Shillelagh','D',1),
    Spell('Speak With Animals','D',1),
    Spell('Barkskin','D',2),
    Spell('Charm Person Or Mammal','D',2),
    Spell('Create Water','D',2),
    Spell('Cure Light Wounds','D',2),
    Spell('Feign Death','D',2),
    Spell('Fire Trap','D',2),
    Spell('Flame Blade','D',2),
    Spell('Goodberry','D',2),
    Spell('Heat Metal','D',2),
    Spell('Locate Plants','D',2),
    Spell('Obscurement','D',2),
    Spell('Produce Flame','D',2),
    Spell('Reflecting Pool','D',2),
    Spell('Slow Poison','D',2),
    Spell('Trip','D',2),
    Spell('Warp Wood','D',2),
    Spell('Call Lightning','D',3),
    Spell('Cloudburst','D',3),
    Spell('Cure Disease','D',3),
    Spell('Hold Animal','D',3),
    Spell('Know Alignment','D',3),
    Spell('Neutralize Poison','D',3),
    Spell('Plant Growth','D',3),
    Spell('Protection From Fire','D',3),
    Spell('Pyrotechnics','D',3),
    Spell('Snare','D',3),
    Spell('Spike Growth','D',3),
    Spell('Starshine','D',3),
    Spell('Stone Shape','D',3),
    Spell('Summon Insects','D',3),
    Spell('Tree','D',3),
    Spell('Water Breathing','D',3),
    Spell('Animal Summoning I','D',4),
    Spell('Call Woodland Beings','D',4),
    Spell('Control Temperature','D',4),
    Spell('Cure Serious Wounds','D',4),
    Spell('Dispel Magic','D',4),
    Spell('Hallucinatory Forest','D',4),
    Spell('Hold Plant','D',4),
    Spell('Plant Door','D',4),
    Spell('Produce Fire','D',4),
    Spell('Protection From Lightning','D',4),
    Spell('Repel Insects','D',4),
    Spell('Speak With Plants','D',4),
    Spell('Animal Growth','D',5),
    Spell('Animal Summoning II','D',5),
    Spell('Anti-Plant Shell 10\' Radius','D',5),
    Spell('Commune With Nature','D',5),
    Spell('Control Winds','D',5),
    Spell('Insect Plague','D',5),
    Spell('Moonbeam','D',5),
    Spell('Pass Plant','D',5),
    Spell('Spike Stones','D',5),
    Spell('Sticks To Snakes','D',5),
    Spell('Transmute Rock To Mud','D',5),
    Spell('Wall of Fire','D',5),
    Spell('Animal Summoning III','D',6),
    Spell('Anti-Animal Shell','D',6),
    Spell('Conjure Fire Elemental','D',6),
    Spell('Cure Critical Wounds','D',6),
    Spell('Feeblemind','D',6),
    Spell('Fire Seeds','D',6),
    Spell('Liveoak','D',6),
    Spell('Transmute Water To Dust','D',6),
    Spell('Transport Via Plants','D',6),
    Spell('Turn Wood','D',6),
    Spell('Wall of Thorns','D',6),
    Spell('Weather Summoning','D',6),
    Spell('Animate Rock','D',7),
    Spell('Changestaff','D',7),
    Spell('Chariot of Sustarre','D',7),
    Spell('Confusion','D',7),
    Spell('Conjure Earth Elemental','D',7),
    Spell('Control Weather','D',7),
    Spell('Creeping Doom','D',7),
    Spell('Finger of Death','D',7),
    Spell('Fire Storm','D',7),
    Spell('Reincarnate','D',7),
    Spell('Sunray','D',7),
    Spell('Transmute Metal To Wood','D',7)]
    
mu_spells = [
    Spell('Affect Normal Fires','M',1),
    Spell('Alarm','M',1),
    Spell('Armor','M',1),
    Spell('Burning Hands','M',1),
    Spell('Charm Person','M',1),
    Spell('Comprehend Languages','M',1),
    Spell('Dancing Lights','M',1),
    Spell('Detect Magic','M',1),
    Spell('Enlarge','M',1),
    Spell('Erase','M',1),
    Spell('Feather Fall','M',1),
    Spell('Find Familiar','M',1),
    Spell('Firewater','M',1),
    Spell('Friends','M',1),
    Spell('Grease','M',1),
    Spell('Hold Portal','M',1),
    Spell('Identify','M',1),
    Spell('Jump','M',1),
    Spell('Light','M',1),
    Spell('Magic Missile','M',1),
    Spell('Melt','M',1),
    Spell('Mending','M',1),
    Spell('Message','M',1),
    Spell('Mount','M',1),
    Spell('Nystul\'s Magic Aura','M',1),
    Spell('Precipitation','M',1),
    Spell('Protection From Evil','M',1),
    Spell('Push','M',1),
    Spell('Read Magic','M',1),
    Spell('Run','M',1),
    Spell('Shield','M',1),
    Spell('Shocking Grasp','M',1),
    Spell('Sleep','M',1),
    Spell('Spider Climb','M',1),
    Spell('Taunt','M',1),
    Spell('Tenser\'s Floating Disc','M',1),
    Spell('Unseen Servant','M',1),
    Spell('Ventriloquism','M',1),
    Spell('Wizard Mark','M',1),
    Spell('Write','M',1),
    Spell('Audible Glamer','M',2),
    Spell('Bind','M',2),
    Spell('Continual Light','M',2),
    Spell('Darkness 15\' Radius','M',2),
    Spell('Deeppockets','M',2),
    Spell('Detect Evil','M',2),
    Spell('Detect Invisibility','M',2),
    Spell('ESP','M',2),
    Spell('Flaming Sphere','M',2),
    Spell('Fools Gold','M',2),
    Spell('Forget','M',2),
    Spell('Invisibility','M',2),
    Spell('Irritation','M',2),
    Spell('Knock','M',2),
    Spell('Know Alignment','M',2),
    Spell('Leomund\'s Trap','M',2),
    Spell('Levitate','M',2),
    Spell('Locate Object','M',2),
    Spell('Magic Mouth','M',2),
    Spell('Melf\'s Acid Arrow','M',2),
    Spell('Mirror Image','M',2),
    Spell('Preserve','M',2),
    Spell('Protection From Cantrips','M',2),
    Spell('Pyrotechnics','M',2),
    Spell('Ray of Enfeeblement','M',2),
    Spell('Rope Trick','M',2),
    Spell('Scare','M',2),
    Spell('Shatter','M',2),
    Spell('Stinking Cloud','M',2),
    Spell('Strength','M',2),
    Spell('Tasha\'s Uncontrollable Hideous Laughter','M',2),
    Spell('Vocalize','M',2),
    Spell('Web','M',2),
    Spell('Whip','M',2),
    Spell('Wizard Lock','M',2),
    Spell('Zephyr','M',2),
    Spell('Blink','M',3),
    Spell('Clairaudience','M',3),
    Spell('Clairvoyance','M',3),
    Spell('Cloudburst','M',3),
    Spell('Detect Illusion','M',3),
    Spell('Dispel Magic','M',3),
    Spell('Explosive Runes','M',3),
    Spell('Feign Death','M',3),
    Spell('Fireball','M',3),
    Spell('Flame Arrow','M',3),
    Spell('Fly','M',3),
    Spell('Gust of Wind','M',3),
    Spell('Haste','M',3),
    Spell('Hold Person','M',3),
    Spell('Infravision','M',3),
    Spell('Invisibility 10\' Radius','M',3),
    Spell('Item','M',3),
    Spell('Leomund\'s Tiny Hut','M',3),
    Spell('Lightning Bolt','M',3),
    Spell('Material','M',3),
    Spell('Melf\'s Minute Meteor','M',3),
    Spell('Monster Summoning I','M',3),
    Spell('Phantasmal Force','M',3),
    Spell('Protection From Evil 10\' Radius','M',3),
    Spell('Protection From Normal Missiles','M',3),
    Spell('Secret Page','M',3),
    Spell('Sepia Snake Sigil','M',3),
    Spell('Slow','M',3),
    Spell('Suggestion','M',3),
    Spell('Tongues','M',3),
    Spell('Water Breathing','M',3),
    Spell('Wind Wall','M',3),
    Spell('Charm Monster','M',4),
    Spell('Confusion','M',4),
    Spell('Dig','M',4),
    Spell('Dimension Door','M',4),
    Spell('Dispel Illusion','M',4),
    Spell('Enchanted Weapon','M',4),
    Spell('Evard\'s Black Tentacles','M',4),
    Spell('Extension I','M',4),
    Spell('Fear','M',4),
    Spell('Fire Charm','M',4),
    Spell('Fire Shield','M',4),
    Spell('Fire Trap','M',4),
    Spell('Fumble','M',4),
    Spell('Hallucinatory Terrain','M',4),
    Spell('Ice Storm','M',4),
    Spell('Leomund\'s Secure Shelter','M',4),
    Spell('Magic Mirror','M',4),
    Spell('Massmorph','M',4),
    Spell('Minor Globe of Invulnerability','M',4),
    Spell('Monster Summoning II','M',4),
    Spell('Otiluke\'s Resilient Sphere','M',4),
    Spell('Plant Growth','M',4),
    Spell('Polymorph Other','M',4),
    Spell('Polymorph Self','M',4),
    Spell('Rary\'s Mnemonic Enhancer','M',4),
    Spell('Remove Curse','M',4),
    Spell('Shout','M',4),
    Spell('Stoneskin','M',4),
    Spell('Ultravision','M',4),
    Spell('Wall of Fire','M',4),
    Spell('Wall of Ice','M',4),
    Spell('Wizard Eye','M',4),
    Spell('Airy Water','M',5),
    Spell('Animal Growth','M',5),
    Spell('Animate Dead','M',5),
    Spell('Avoidance','M',5),
    Spell('Bigby\'s Interposing Hand','M',5),
    Spell('Cloudkill','M',5),
    Spell('Conjure Elemental','M',5),
    Spell('Cone of Cold','M',5),
    Spell('Contact Other Plane','M',5),
    Spell('Dismissal','M',5),
    Spell('Distance Distortion','M',5),
    Spell('Dolor','M',5),
    Spell('Extension II','M',5),
    Spell('Fabricate','M',5),
    Spell('Feeblemind','M',5),
    Spell('Hold Monster','M',5),
    Spell('Leomund\'s Lamentable Belabourment','M',5),
    Spell('Leomund\'s Secret Chest','M',5),
    Spell('Magic Jar','M',5),
    Spell('Monster Summoning III','M',5),
    Spell('Mordenkainen\'s Faithful Hound','M',5),
    Spell('Passwall','M',5),
    Spell('Sending','M',5),
    Spell('Stone Shape','M',5),
    Spell('Telekinesis','M',5),
    Spell('Teleport','M',5),
    Spell('Transmute Rock To Mud','M',5),
    Spell('Wall of Force','M',5),
    Spell('Wall of Iron','M',5),
    Spell('Wall of Stone','M',5),
    Spell('Anti-Magic Shell','M',6),
    Spell('Bigby\'s Forceful Hand','M',6),
    Spell('Chain Lightning','M',6),
    Spell('Contingency','M',6),
    Spell('Control Weather','M',6),
    Spell('Death Spell','M',6),
    Spell('Disintegrate','M',6),
    Spell('Enchant An Item','M',6),
    Spell('Ensnarement','M',6),
    Spell('Extension III','M',6),
    Spell('Eyebite','M',6),
    Spell('Geas','M',6),
    Spell('Glassee','M',6),
    Spell('Globe of Invulnerability','M',6),
    Spell('Guards and Wards','M',6),
    Spell('Invisible Stalker','M',6),
    Spell('Legend Lore','M',6),
    Spell('Lower Water','M',6),
    Spell('Monster Summoning IV','M',6),
    Spell('Mordenkainen\'s Lucubration','M',6),
    Spell('Move Earth','M',6),
    Spell('Otiluke\'s Freezing Sphere','M',6),
    Spell('Part Water','M',6),
    Spell('Project Image','M',6),
    Spell('Reincarnation','M',6),
    Spell('Repulsion','M',6),
    Spell('Spiritwrack','M',6),
    Spell('Stone To Flesh','M',6),
    Spell('Tenser\'s Transformation','M',6),
    Spell('Transmute Water To Dust','M',6),
    Spell('Banishment','M',7),
    Spell('Bigby\'s Grasping Hand','M',7),
    Spell('Cacodemon','M',7),
    Spell('Charm Plants','M',7),
    Spell('Delayed Blast Fireball','M',7),
    Spell('Drawmij\'s Instant Summons','M',7),
    Spell('Duo-Dimension','M',7),
    Spell('Forcecage','M',7),
    Spell('Limited Wish','M',7),
    Spell('Mass Invisibility','M',7),
    Spell('Monster Summoning V','M',7),
    Spell('Mordenkainen\'s Magnificent Mansion','M',7),
    Spell('Mordenkainen\'s Sword','M',7),
    Spell('Phase Door','M',7),
    Spell('Power Word, Stun','M',7),
    Spell('Reverse Gravity','M',7),
    Spell('Sequester','M',7),
    Spell('Simulacrum','M',7),
    Spell('Statue','M',7),
    Spell('Teleport Without Error','M',7),
    Spell('Torment','M',7),
    Spell('Truename','M',7),
    Spell('Vanish','M',7),
    Spell('Volley','M',7),
    Spell('Antipathy/Sympathy','M',8),
    Spell('Bigby\'s Clenched Fist','M',8),
    Spell('Binding','M',8),
    Spell('Clone','M',8),
    Spell('Demand','M',8),
    Spell('Glassteel','M',8),
    Spell('Incendiary Cloud','M',8),
    Spell('Mass Charm','M',8),
    Spell('Maze','M',8),
    Spell('Mind Blank','M',8),
    Spell('Monster Summoning VI','M',8),
    Spell('Otiluke\'s Telekinetc Sphere','M',8),
    Spell('Otto\'s Irresistible Dance','M',8),
    Spell('Permanency','M',8),
    Spell('Polymorph Any Object','M',8),
    Spell('Power Word, Blind','M',8),
    Spell('Serten\'s Spell Immunity','M',8),
    Spell('Sink','M',8),
    Spell('Symbol','M',8),
    Spell('Trap The Soul','M',8),
    Spell('Astral Spell','M',9),
    Spell('Bigby\'s Crushing Hand','M',9),
    Spell('Crystalbrittle','M',9),
    Spell('Energy Drain','M',9),
    Spell('Gate','M',9),
    Spell('Imprisonment','M',9),
    Spell('Meteor Swarm','M',9),
    Spell('Monster Summoning VII','M',9),
    Spell('Mordenkainen\'s Disjunction','M',9),
    Spell('Power Word, Kill','M',9),
    Spell('Prismatic Sphere','M',9),
    Spell('Shape Change','M',9),
    Spell('Succor','M',9),
    Spell('Temporal Stasis','M',9),
    Spell('Time Stop','M',9),
    Spell('Wish','M',9)]
    
illusionist_spells = [
    Spell('Audible Glamer','I',1),
    Spell('Change Self','I',1),
    Spell('Chromatic Orb','I',1),
    Spell('Color Spray','I',1),
    Spell('Dancing Lights','I',1),
    Spell('Darkness','I',1),
    Spell('Detect Illusion','I',1),
    Spell('Detect Invisibility','I',1),
    Spell('Gaze Reflection','I',1),
    Spell('Hypnotism','I',1),
    Spell('Light','I',1),
    Spell('Phantasmal Force','I',1),
    Spell('Phantom Armor','I',1),
    Spell('Read Illusionist Magic','I',1),
    Spell('Spook','I',1),
    Spell('Wall of Fog','I',1),
    Spell('Alter Self','I',2),
    Spell('Blindness','I',2),
    Spell('Blur','I',2),
    Spell('Deafness','I',2),
    Spell('Detect Magic','I',2),
    Spell('Fascinate','I',2),
    Spell('Fog Cloud','I',2),
    Spell('Hypnotic Pattern','I',2),
    Spell('Improved Phantasmal Force','I',2),
    Spell('Invisibility','I',2),
    Spell('Magic Mouth','I',2),
    Spell('Mirror Image','I',2),
    Spell('Misdirection','I',2),
    Spell('Ultravision','I',2),
    Spell('Ventriloquism','I',2),
    Spell('Whispering Wind','I',2),
    Spell('Continual Darkness','I',3),
    Spell('Continual Light','I',3),
    Spell('Delude','I',3),
    Spell('Dispel Illusion','I',3),
    Spell('Fear','I',3),
    Spell('Hallucinatory Terrain','I',3),
    Spell('Illusionary Script','I',3),
    Spell('Invisibility 10\' Radius','I',3),
    Spell('Non-detection','I',3),
    Spell('Paralyzation','I',3),
    Spell('Phantom Steed','I',3),
    Spell('Phantom Wind','I',3),
    Spell('Rope Trick','I',3),
    Spell('Spectral Force','I',3),
    Spell('Suggestion','I',3),
    Spell('Wraithform','I',3),
    Spell('Confusion','I',4),
    Spell('Dispel Exhaustion','I',4),
    Spell('Dispel Magic','I',4),
    Spell('Emotion','I',4),
    Spell('Improved Invisibility','I',4),
    Spell('Massmorph','I',4),
    Spell('Minor Creation','I',4),
    Spell('Phantasmal Killer','I',4),
    Spell('Rainbow Pattern','I',4),
    Spell('Shadow Monsters','I',4),
    Spell('Solid Fog','I',4),
    Spell('Vacancy','I',4),
    Spell('Advanced Illusion','I',5),
    Spell('Chaos','I',5),
    Spell('Demi-Shadow Monsters','I',5),
    Spell('Dream','I',5),
    Spell('Magic Mirror','I',5),
    Spell('Major Creation','I',5),
    Spell('Maze','I',5),
    Spell('Projected Image','I',5),
    Spell('Shadow Door','I',5),
    Spell('Shadow Magic','I',5),
    Spell('Summon Shadow','I',5),
    Spell('Tempus Fugit','I',5),
    Spell('Conjure Animals','I',6),
    Spell('Death Fog','I',6),
    Spell('Demi-Shadow Magic','I',6),
    Spell('Mass Suggestion','I',6),
    Spell('Mirage Arcane','I',6),
    Spell('Mislead','I',6),
    Spell('Permanent Illusion','I',6),
    Spell('Phantasmagoria','I',6),
    Spell('Programmed Illusion','I',6),
    Spell('Shades','I',6),
    Spell('True Sight','I',6),
    Spell('Veil','I',6),
    Spell('Alter Reality','I',7),
    Spell('Astral Spell','I',7),
    Spell('Prismatic Spray','I',7),
    Spell('Prismatic Wall','I',7),
    Spell('Shadow Walk','I',7),
    Spell('Vision','I',7),
    Spell('Weird','I',7),   
    Spell('First Level Magic-User Spells','I',7)]

all_spells = (cleric_spells + druid_spells 
            + mu_spells + illusionist_spells)

def randomSpell():
    return choice(all_spells)
    
def randomIllusionistSpells(num=1,level=None):
    if not level:
        return sample(illusionist_spells, num)
    else:
        spells = [s for s in illusionist_spells if s.level == level]
        return sample(spells, num)
