for i in range(num_monsters):
#choose random spot for this monster
x = libtcod.random_get_int(0, room.x1+1, room.x2-1)
y = libtcod.random_get_int(0, room.y1+1, room.y2-1)
if not is_blocked(x, y):
choice = random_choice(monster_chances)
if choice == 'nurgle_mini':
#create a nurgling
fighter_component = Fighter(0, 5, hp=random.randint(30, 50), defense=0, power=30, xp=15, aim=0, death_function=monster_death, desc='A small creature, covered in festering boils and rotting flesh. Nurgle\'s worshippers tend to find them adorable. Most people think they\'re anything but.')
ai_component = BasicMonster()
monster = Object(x, y, 'n', 'nurgling', libtcod.desaturated_green, blocks=True, fighter=fighter_component, ai=ai_component)
elif choice == 'nurgle_cult':
#create a nurgle cultist
fighter_component = Fighter(2, 10, hp=random.randint(120,140), defense=random.randint(8,10), power=40, xp=55, aim=0, dropchance=20, drops={'ragged robes' : 20, 'weapon' : 20}, death_function=monster_death, desc='A cultist of Nurgle, clad in sickly green robes and exuding vile pestilence. They smile unnervingly as they praise their Plaguefather, and clutch a makeshift weapon in one disease-ridden hand.')
ai_component = BasicMonster()
monster = Object(x, y, 'c', 'Nurgle cultist', libtcod.green,blocks=True, fighter=fighter_component, ai=ai_component)
elif choice == 'khorne_cult':
#create a khornate cultist
fighter_component = Fighter(-1, 10, hp=random.randint(90,100), defense=random.randint(4,8), power=75, xp=60, aim=0, dropchance=20, drops={'chainsword': 20}, death_function=monster_death, desc='A cultist of Khorne, clad in bright red robes and adorned with grisly trophies from those they have slain. They shout and snarl as they ready themselves for a bloodbath.')
ai_component = BasicMonster()
monster = Object(x, y, 'c', 'Khornate cultist', libtcod.dark_red, blocks=True, fighter=fighter_component, ai=ai_component)
elif choice == 'chaos_spawn':
#create a chaos spawn
spawnval = random.randint(100, 200)
fighter_component = Fighter(-5, 10, hp=spawnval, defense=0, power=spawnval-25, xp=spawnval-10, aim=0, death_function=monster_death, desc='A writhing mass of organic matter, its shifting features and unnatural cries marking it as a creature of Chaos. Mindless, it wanders aimlessly and lashes out at those who venture too close.')
ai_component = ChaosSpawn()
monster = Object(x, y, 's', 'chaos spawn', libtcod.pink, blocks=True, fighter=fighter_component, ai=ai_component)
elif choice == 'berserker':
fighter_component = Fighter(-1, 10, hp=random.randint(120,160), defense=random.randint(5,9), power=115, xp=190, aim=0, death_function=monster_death, desc='A cultist of Khorne, overtaken by unnatural fury. Swinging their weapon in a mad frenzy as they seek out victims, the berserker shrugs off injuries and smashes aside all in its way, shrieking "BLOOD FOR THE BLOOD GOD!"')
ai_component = Berserker()
monster = Object(x, y, 'C', 'Berserk Khornate cultist', libtcod.dark_red, blocks=True, fighter=fighter_component, ai=ai_component)
elif choice == 'weak_mutant':
fighter_component = Fighter(-1, 9, hp=random.randint(100, 130), defense=random.randint(10, 12), power=45, xp=60, aim=0, death_function=monster_death, desc='A mutant, driven mad by Chaos. They snarl and growl like an animal as they seek out conflict.')
ai_component = Berserker()
monster = Object(x, y, 'm', 'savage mutant', libtcod.lightest_red, blocks=True, fighter=fighter_component, ai=ai_component)
elif choice == 'nurgle_lesser':
fighter_component = Fighter(+1, 10, hp=random.randint(190,210), defense=random.randint(10,14), power=80, xp=200, aim=0, death_function=monster_death, desc='A lesser daemon of Nurgle, this shambling cyclopean mass of rot and plague feels no pain as it spreads its pestilence to those yet untainted by Chaos.')
ai_component = BasicMonster()
monster = Object(x, y, 'P', 'plaguebearer', libtcod.light_green, blocks=True, fighter=fighter_component, ai=ai_component)
elif choice == 'khorne_lesser':
fighter_component = Fighter(-1, 10, hp=random.randint(150, 170), defense=random.randint(5,12), power=130, xp=200, aim=0, death_function=monster_death, desc='A lesser daemon of Khorne, this creature nonetheless cuts an imposing figure: a red, horned humanoid menacing with spikes and carrying a vicious, bloodstained weapon.')
ai_component = BasicMonster()
monster = Object(x, y, 'B', 'bloodletter', libtcod.darker_red, blocks=True, fighter=fighter_component, ai=ai_component)
elif choice == 'ripper':
fighter_component = Fighter(-1, 9, hp=random.randint(30, 50), defense=0, power=55, xp=20, aim=0, death_function=monster_death, desc='A Tyranid bio-organism with a small, worm-like body and a mouth with rows upon rows of sharp teeth. Normally found in swarms, they are - mercifully - weak individually.')
ai_component = BasicMonster()
monster = Object(x, y, 'r', 'ripper', libtcod.lighter_violet, blocks=True, fighter=fighter_component, ai=ai_component)
elif choice == 'termagant':
fighter_component = Fighter(-1, 9, hp=random.randint(100, 130), defense=random.randint(4, 8), power=75, xp=65, aim=0, death_function=monster_death, desc='One of the most numerous Tyranid bio-organisms. The lowest form of Tyranid besides Rippers, they are nonetheless dangerous to an unarmoured or unskilled foe.')
ai_component = BasicMonster()
monster = Object(x, y, 't', 'termagant', libtcod.light_violet, blocks=True, fighter=fighter_component, ai=ai_component)
elif choice == 'gene_hybrid':
fighter_component = Fighter(-1, 9, hp=random.randint(120, 170), defense=12, power=95, xp=100, aim=0, death_function=monster_death, desc='One of the hybrid offspring of a Tyranid Genestealer, this part-human creature still looks more like a Tyranid than its mundane progenitor, albeit with a glint of muderous intelligence in its eyes.')
ai_component = BasicMonster()
monster = Object(x, y, 'g', 'genestealer hybrid', libtcod.lightest_red, blocks=True, fighter=fighter_component, ai=ai_component)
elif choice == 'claw_termagant':
fighter_component = Fighter(-1, 9, hp=random.randint(150, 180), defense=random.randint(6, 10), power=110, xp=130, aim=0, death_function=monster_death, desc='One of the most numerous Tyranid bio-organisms. The lowest form of Tyranid besides Rippers, they are nonetheless dangerous to an unarmoured or unskilled foe.\n \nThis Termagant has a pronounced pair of scything claws.')
ai_component = BasicMonster()
monster = Object(x, y, 't', 'clawed termagant', libtcod.violet, blocks=True, fighter=fighter_component, ai=ai_component)
objects.append(monster)
That's just the bit of the code that places monsters, just to show how defining them works.