#!/usr/bin/python3 import json import random from equipment import * from spells import * # functions def roll_dice(count, sides): return sum(random.randint(1,sides) for _ in range(count)) # Player Character Classes class Adventurer: def __init__(self, c_id: str, level=1, attributes={}) -> None: # using a get() method to pull an attribute else use a default value, https://python-academy.org/en/handbook/get self.identifier = c_id self.player_class = None self.level = level self.strength = attributes.get('strength', roll_dice(3,6)) self.intelligence = attributes.get('intelligence', roll_dice(3,6)) self.wisdom = attributes.get('wisdom', roll_dice(3,6)) self.dexterity = attributes.get('dexterity', roll_dice(3,6)) self.constitution = attributes.get('constitution', roll_dice(3,6)) self.charisma = attributes.get('charisma', roll_dice(3,6)) self.hp = 1 self.gold= roll_dice(3,6) self.torches = roll_dice(1,6) self.rations = roll_dice(1,6) self.equipment = self.roll_equipment() # all armor, individual classes may have overrides self.possible_armor = list(armor.keys()) # all weapons, individual classes may have overrides self.possible_weapons = weapons self.possible_melee_weapons = list(filter(lambda d: 'melee' in d['traits'], weapons)) self.possible_missile_weapons = list(filter(lambda d: 'missile' in d['traits'], weapons)) # each character should get 1 melee and 1 random (missle or melee) self.weapons = [ random.choice(self.possible_melee_weapons), random.choice(self.possible_weapons) ] self.armor = random.choice(self.possible_armor) # special abilities self.spells = None self.spell_book = None self.thief_skills = None self.turn_undead = None def __str__(self): return f"{self.player_class}" def get_subclass_dict(): subclasses = {} for subclass in Adventurer.__subclasses__(): subclasses[subclass.adv_class] = subclass return subclasses def get_json(self): char_dict = self.__dict__ char_json = json.dumps(char_dict) return char_dict def vertical_sheet(self): sheet = [] sheet.append('{0: <28}'.format(f"| {self.player_class.title()} - Level {self.level}")) for key, val in self.get_attributes().items(): key_string = "| " + '{0:16}'.format(f"{key}").capitalize() + f" {val}" sheet += ['{0: <28}'.format(key_string)] sheet.append('| ------------------------- ') sheet.append('{0: <28}'.format(f"| HP: {self.hp} AC: {self.ac}")) sheet.append('{0: <28}'.format(f"| Torches: {self.torches}")) sheet.append('{0: <28}'.format(f"| Rations: {self.rations}")) sheet.append('{0: <28}'.format(f"| Armor: {self.armor}")) sheet.append('{0: <28}'.format(f"| Weapons:")) sheet.append('{0: <28}'.format(f"| {self.weapons[0]['name'].title()}")) sheet.append('{0: <28}'.format(f"| {self.weapons[1]['name'].title()}")) sheet.append('{0: <28}'.format(f"| Equipment:")) for item in self.equipment: item_string = "| " + '{0:22}'.format(f"{item}").title() sheet += ['{0: <28}'.format(item_string)] sheet.append('{0: <28}'.format(f"| ")) sheet.append('{0: <28}'.format(f"| Gold: {self.gold}")) sheet.append('| ------------------------- ') for key, val in self.progression[self.level]['saves'].items(): key_string = "| " + '{0:22}'.format(f"{key}").title() + f" {val}" sheet += ['{0: <28}'.format(key_string)] sheet.append('| ------------------------- ') #if self.spells: # sheet.append('{0: <28}'.format("| Spellbook: ")) # sheet += ['{0: <28}'.format(f"| {spell.title()}") for spell in self.spell_book ] # append a | to each string, after the formatted whitespace sheet = [ line + "|" for line in sheet ] return sheet def get_attributes(self): attribute_list = ['strength', 'intelligence', 'wisdom', 'dexterity', 'constitution', 'charisma'] return {k: self.__dict__[k] for k in attribute_list} def get_best_prime_attribute(self): attribute_list = [ 'strength', 'intelligence', 'wisdom', 'dexterity' ] prime_attributes = {k: self.__dict__[k] for k in attribute_list} # return highest, found this at https://stackoverflow.com/a/280156 return max(prime_attributes, key=prime_attributes.get) def roll_equipment(self): equipment = [ 'backpack', 'tinderbox', 'waterskin' ] random_items = [ random.choice(adventuring_gear) for i in range(2) ] for item in random_items: equipment += item.split("+") while len(equipment) < 7: equipment.append("") return equipment def select_spells(self): spell_book = [] for spell_level, count in self.spells.items(): if count != "-": for i in range(count): random_spell = "" while random_spell not in spell_book: random_spell = random.choice(magic_user_spells[spell_level]) spell_book.append(random_spell) return spell_book def set_level(self, new_level): self.level = new_level class Fighter(Adventurer): adv_class = "fighter" prime_requisite = "strength" requirements = None progression = [ { "level" : 1, "xp" : 0, "hit-dice" : 1, "thac0" : 19, "saves" : { "death / poison" : 12, "wands" : 13, "paralysis / petrify" : 14, "breath attack" : 15, "spells / rods / staves" : 16 }}, { "level" : 2, "xp" : 2000, "hit-dice" : 2, "thac0" : 19, "saves" : { "death / poison" : 12, "wands" : 13, "paralysis / petrify" : 14, "breath attack" : 15, "spells / rods / staves" : 16 }}, { "level" : 3, "xp" : 4000, "hit-dice" : 3, "thac0" : 19, "saves" : { "death / poison" : 12, "wands" : 13, "paralysis / petrify" : 14, "breath attack" : 15, "spells / rods / staves" : 16 }}, { "level" : 4, "xp" : 8000, "hit-dice" : 4, "thac0" : 17, "saves" : { "death / poison" : 10, "wands" : 11, "paralysis / petrify" : 12, "breath attack" : 13, "spells / rods / staves" : 14 }}, { "level" : 5, "xp" : 16000, "hit-dice" : 5, "thac0" : 17, "saves" : { "death / poison" : 10, "wands" : 11, "paralysis / petrify" : 12, "breath attack" : 13, "spells / rods / staves" : 14 }}, { "level" : 6, "xp" : 32000, "hit-dice" : 6, "thac0" : 17, "saves" : { "death / poison" : 10, "wands" : 11, "paralysis / petrify" : 12, "breath attack" : 13, "spells / rods / staves" : 14 }}, { "level" : 7, "xp" : 64000, "hit-dice" : 7, "thac0" : 14, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 10, "breath attack" : 10, "spells / rods / staves" : 12 }}, { "level" : 8, "xp" : 120000, "hit-dice" : 8, "thac0" : 14, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 10, "breath attack" : 10, "spells / rods / staves" : 12 }}, { "level" : 9, "xp" : 240000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 10, "breath attack" : 10, "spells / rods / staves" : 12 }}, { "level" : 10, "xp" : 360000, "hit-dice" : 9, "thac0" : 12, "saves" : { "death / poison" : 6, "wands" : 7, "paralysis / petrify" : 8, "breath attack" : 8, "spells / rods / staves" : 10 }}, { "level" : 11, "xp" : 480000, "hit-dice" : 9, "thac0" : 12, "saves" : { "death / poison" : 6, "wands" : 7, "paralysis / petrify" : 8, "breath attack" : 8, "spells / rods / staves" : 10 }}, { "level" : 12, "xp" : 600000, "hit-dice" : 9, "thac0" : 12, "saves" : { "death / poison" : 6, "wands" : 7, "paralysis / petrify" : 8, "breath attack" : 8, "spells / rods / staves" : 10 }}, { "level" : 13, "xp" : 720000, "hit-dice" : 9, "thac0" : 10, "saves" : { "death / poison" : 4, "wands" : 5, "paralysis / petrify" : 6, "breath attack" : 5, "spells / rods / staves" : 8 }}, { "level" : 14, "xp" : 840000, "hit-dice" : 9, "thac0" : 10, "saves" : { "death / poison" : 4, "wands" : 5, "paralysis / petrify" : 6, "breath attack" : 5, "spells / rods / staves" : 8 }} ] def __init__(self, c_id, level, attributes={}) -> None: Adventurer.__init__(self, c_id, level, attributes) self.player_class = Fighter.adv_class self.progression = Fighter.progression self.hp = roll_dice(self.level, 8) self.ac = armor[self.armor] class MagicUser(Adventurer): adv_class = "magic user" prime_requisite = "intelligence" requirements = None progression = [ { "level" : 1, "xp" : 0, "hit-dice" : 1, "thac0" : 19, "saves" : { "death / poison" : 13, "wands" : 14, "paralysis / petrify" : 13, "breath attack" : 16, "spells / rods / staves" : 15 }}, { "level" : 2, "xp" : 2500, "hit-dice" : 2, "thac0" : 19, "saves" : { "death / poison" : 13, "wands" : 14, "paralysis / petrify" : 13, "breath attack" : 16, "spells / rods / staves" : 15 }}, { "level" : 3, "xp" : 5000, "hit-dice" : 3, "thac0" : 19, "saves" : { "death / poison" : 13, "wands" : 14, "paralysis / petrify" : 13, "breath attack" : 16, "spells / rods / staves" : 15 }}, { "level" : 4, "xp" : 10000, "hit-dice" : 4, "thac0" : 19, "saves" : { "death / poison" : 13, "wands" : 14, "paralysis / petrify" : 13, "breath attack" : 16, "spells / rods / staves" : 15 }}, { "level" : 5, "xp" : 20000, "hit-dice" : 5, "thac0" : 19, "saves" : { "death / poison" : 13, "wands" : 14, "paralysis / petrify" : 13, "breath attack" : 16, "spells / rods / staves" : 15 }}, { "level" : 6, "xp" : 40000, "hit-dice" : 6, "thac0" : 17, "saves" : { "death / poison" : 11, "wands" : 12, "paralysis / petrify" : 11, "breath attack" : 11, "spells / rods / staves" : 12 }}, { "level" : 7, "xp" : 80000, "hit-dice" : 7, "thac0" : 17, "saves" : { "death / poison" : 11, "wands" : 12, "paralysis / petrify" : 11, "breath attack" : 11, "spells / rods / staves" : 12 }}, { "level" : 8, "xp" : 150000, "hit-dice" : 8, "thac0" : 17, "saves" : { "death / poison" : 11, "wands" : 12, "paralysis / petrify" : 11, "breath attack" : 11, "spells / rods / staves" : 12 }}, { "level" : 9, "xp" : 300000, "hit-dice" : 9, "thac0" : 17, "saves" : { "death / poison" : 11, "wands" : 12, "paralysis / petrify" : 11, "breath attack" : 11, "spells / rods / staves" : 12 }}, { "level" : 10, "xp" : 450000, "hit-dice" : 9, "thac0" : 17, "saves" : { "death / poison" : 11, "wands" : 12, "paralysis / petrify" : 11, "breath attack" : 11, "spells / rods / staves" : 12 }}, { "level" : 11, "xp" : 600000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 8, "breath attack" : 8, "spells / rods / staves" : 8 }}, { "level" : 12, "xp" : 750000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 8, "breath attack" : 8, "spells / rods / staves" : 8 }}, { "level" : 13, "xp" : 900000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 8, "breath attack" : 8, "spells / rods / staves" : 8 }}, { "level" : 14, "xp" : 1050000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 8, "breath attack" : 8, "spells / rods / staves" : 8 }} ] spells = { 1: { 1: 1, 2: '-', 3: '-', 4: '-', 5: '-', 6: '-'}, 2: { 1: 2, 2: '-', 3: '-', 4: '-', 5: '-', 6: '-'}, 3: { 1: 2, 2: 1, 3: '-', 4: '-', 5: '-', 6: '-'}, 4: { 1: 2, 2: 2, 3: '-', 4: '-', 5: '-', 6: '-'}, 5: { 1: 2, 2: 2, 3: 1, 4: '-', 5: '-', 6: '-'}, 6: { 1: 2, 2: 2, 3: 2, 4: '-', 5: '-', 6: '-'}, 7: { 1: 3, 2: 2, 3: 2, 4: 1, 5: '-', 6: '-'}, 8: { 1: 3, 2: 3, 3: 2, 4: 2, 5: '-', 6: '-'}, 9: { 1: 3, 2: 3, 3: 3, 4: 2, 5: 1, 6: '-'}, 10: { 1: 3, 2: 3, 3: 3, 4: 3, 5: 2, 6: '-'}, 11: { 1: 4, 2: 3, 3: 3, 4: 3, 5: 2, 6: 1 }, 12: { 1: 4, 2: 4, 3: 3, 4: 3, 5: 2, 6: 1 }, 13: { 1: 4, 2: 4, 3: 4, 4: 3, 5: 3, 6: 3 }, 14: { 1: 4, 2: 4, 3: 4, 4: 4, 5: 3, 6: 3 } } def __init__(self,c_id, level, attributes={}) -> None: Adventurer.__init__(self, c_id, level, attributes) self.player_class = MagicUser.adv_class self.progression = MagicUser.progression self.hp = roll_dice(self.level, 4) self.armor = "None" self.ac = armor[self.armor] self.weapons = [ list(filter(lambda d: 'silver dagger' in d['name'],weapons))[0], { "name" : "" } ] self.spells = MagicUser.spells[self.level] self.spell_book = self.select_spells() class Cleric(Adventurer): adv_class = "cleric" prime_requisite = "wisdom" requirements = None progression = [ { "level" : 1, "xp" : 0, "hit-dice" : 1, "thac0" : 19, "saves" : { "death / poison" : 11, "wands" : 12, "paralysis / petrify" : 14, "breath attack" : 16, "spells / rods / staves" : 15 }}, { "level" : 2, "xp" : 1500, "hit-dice" : 2, "thac0" : 19, "saves" : { "death / poison" : 11, "wands" : 12, "paralysis / petrify" : 14, "breath attack" : 16, "spells / rods / staves" : 15 }}, { "level" : 3, "xp" : 3000, "hit-dice" : 3, "thac0" : 19, "saves" : { "death / poison" : 11, "wands" : 12, "paralysis / petrify" : 14, "breath attack" : 16, "spells / rods / staves" : 15 }}, { "level" : 4, "xp" : 6000, "hit-dice" : 4, "thac0" : 19, "saves" : { "death / poison" : 11, "wands" : 12, "paralysis / petrify" : 14, "breath attack" : 16, "spells / rods / staves" : 15 }}, { "level" : 5, "xp" : 12000, "hit-dice" : 5, "thac0" : 17, "saves" : { "death / poison" : 9, "wands" : 10, "paralysis / petrify" : 12, "breath attack" : 14, "spells / rods / staves" : 12 }}, { "level" : 6, "xp" : 25000, "hit-dice" : 6, "thac0" : 17, "saves" : { "death / poison" : 9, "wands" : 10, "paralysis / petrify" : 12, "breath attack" : 14, "spells / rods / staves" : 12 }}, { "level" : 7, "xp" : 50000, "hit-dice" : 7, "thac0" : 17, "saves" : { "death / poison" : 9, "wands" : 10, "paralysis / petrify" : 12, "breath attack" : 14, "spells / rods / staves" : 12 }}, { "level" : 8, "xp" : 100000, "hit-dice" : 8, "thac0" : 17, "saves" : { "death / poison" : 9, "wands" : 10, "paralysis / petrify" : 12, "breath attack" : 14, "spells / rods / staves" : 12 }}, { "level" : 9, "xp" : 200000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 6, "wands" : 7, "paralysis / petrify" : 9, "breath attack" : 14, "spells / rods / staves" : 9 }}, { "level" : 10, "xp" : 300000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 6, "wands" : 7, "paralysis / petrify" : 9, "breath attack" : 11, "spells / rods / staves" : 9 }}, { "level" : 11, "xp" : 400000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 6, "wands" : 7, "paralysis / petrify" : 9, "breath attack" : 11, "spells / rods / staves" : 9 }}, { "level" : 12, "xp" : 500000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 6, "wands" : 7, "paralysis / petrify" : 9, "breath attack" : 11, "spells / rods / staves" : 9 }}, { "level" : 13, "xp" : 600000, "hit-dice" : 9, "thac0" : 12, "saves" : { "death / poison" : 3, "wands" : 5, "paralysis / petrify" : 7, "breath attack" : 8, "spells / rods / staves" : 7 }}, { "level" : 14, "xp" : 700000, "hit-dice" : 9, "thac0" : 12, "saves" : { "death / poison" : 3, "wands" : 5, "paralysis / petrify" : 7, "breath attack" : 8, "spells / rods / staves" : 7 }} ] spells = { 1: { 1: '-', 2: '-', 3: '-', 4: '-', 5: '-'}, 2: { 1: 1, 2: '-', 3: '-', 4: '-', 5: '-'}, 3: { 1: 2, 2: '-', 3: '-', 4: '-', 5: '-'}, 4: { 1: 2, 2: 1, 3: '-', 4: '-', 5: '-'}, 5: { 1: 2, 2: 2, 3: '-', 4: '-', 5: '-'}, 6: { 1: 2, 2: 2, 3: 1, 4: 1, 5: '-'}, 7: { 1: 2, 2: 2, 3: 2, 4: 1, 5: 1 }, 8: { 1: 3, 2: 3, 3: 2, 4: 2, 5: 1 }, 9: { 1: 3, 2: 3, 3: 3, 4: 2, 5: 2 }, 10: { 1: 4, 2: 4, 3: 3, 4: 3, 5: 2 }, 11: { 1: 4, 2: 4, 3: 4, 4: 3, 5: 3 }, 12: { 1: 5, 2: 5, 3: 4, 4: 4, 5: 3 }, 13: { 1: 5, 2: 5, 3: 4, 4: 4, 5: 4 }, 14: { 1: 6, 2: 5, 3: 5, 4: 5, 5: 4 } } def __init__(self,c_id, level, attributes={}) -> None: Adventurer.__init__(self, c_id, level, attributes) self.player_class = Cleric.adv_class self.progression = Cleric.progression self.hp = roll_dice(self.level, 6) self.armor = random.choice(list(armor.keys())) self.ac = armor[self.armor] # clerics can only wield blunt weapons self.possible_melee_weapons = list(filter(lambda d: 'blunt' in d['traits'] and 'melee' in d['traits'], weapons)) self.possible_weapons = list(filter(lambda d: 'blunt' in d['traits'], weapons)) self.weapons = [ random.choice(self.possible_melee_weapons), random.choice(self.possible_weapons) ] self.spells = Cleric.spells[self.level] self.spell_book = self.select_spells() class Thief(Adventurer): adv_class = "thief" prime_requisite = "dexterity" requirements = None progression = [ { "level" : 1, "xp" : 0, "hit-dice" : 1, "thac0" : 19, "saves" : { "death / poison" : 13, "wands" : 14, "paralysis / petrify" : 13, "breath attack" : 16, "spells / rods / staves" : 15 }}, { "level" : 2, "xp" : 1200, "hit-dice" : 2, "thac0" : 19, "saves" : { "death / poison" : 13, "wands" : 14, "paralysis / petrify" : 13, "breath attack" : 16, "spells / rods / staves" : 15 }}, { "level" : 3, "xp" : 2400, "hit-dice" : 3, "thac0" : 19, "saves" : { "death / poison" : 13, "wands" : 14, "paralysis / petrify" : 13, "breath attack" : 16, "spells / rods / staves" : 15 }}, { "level" : 4, "xp" : 4800, "hit-dice" : 4, "thac0" : 19, "saves" : { "death / poison" : 13, "wands" : 14, "paralysis / petrify" : 13, "breath attack" : 16, "spells / rods / staves" : 15 }}, { "level" : 5, "xp" : 9600, "hit-dice" : 5, "thac0" : 17, "saves" : { "death / poison" : 12, "wands" : 13, "paralysis / petrify" : 11, "breath attack" : 14, "spells / rods / staves" : 13 }}, { "level" : 6, "xp" : 20000, "hit-dice" : 6, "thac0" : 17, "saves" : { "death / poison" : 12, "wands" : 13, "paralysis / petrify" : 11, "breath attack" : 14, "spells / rods / staves" : 13 }}, { "level" : 7, "xp" : 40000, "hit-dice" : 7, "thac0" : 17, "saves" : { "death / poison" : 12, "wands" : 13, "paralysis / petrify" : 11, "breath attack" : 14, "spells / rods / staves" : 13 }}, { "level" : 8, "xp" : 80000, "hit-dice" : 8, "thac0" : 17, "saves" : { "death / poison" : 12, "wands" : 13, "paralysis / petrify" : 11, "breath attack" : 14, "spells / rods / staves" : 13 }}, { "level" : 9, "xp" : 160000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 10, "wands" : 11, "paralysis / petrify" : 9, "breath attack" : 11, "spells / rods / staves" : 10 }}, { "level" : 10, "xp" : 280000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 10, "wands" : 11, "paralysis / petrify" : 9, "breath attack" : 11, "spells / rods / staves" : 10 }}, { "level" : 11, "xp" : 400000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 10, "wands" : 11, "paralysis / petrify" : 9, "breath attack" : 11, "spells / rods / staves" : 10 }}, { "level" : 12, "xp" : 520000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 10, "wands" : 11, "paralysis / petrify" : 9, "breath attack" : 11, "spells / rods / staves" : 10 }}, { "level" : 13, "xp" : 640000, "hit-dice" : 9, "thac0" : 12, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 7, "breath attack" : 10, "spells / rods / staves" : 8 }}, { "level" : 14, "xp" : 760000, "hit-dice" : 9, "thac0" : 12, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 7, "breath attack" : 10, "spells / rods / staves" : 8 }} ] def __init__(self,c_id, level, attributes={}) -> None: Adventurer.__init__(self, c_id, level, attributes) self.player_class = Thief.adv_class self.progression = Thief.progression self.hp = roll_dice(self.level, 4) self.armor = random.choice(list(armor.keys())) self.ac = armor[self.armor] class Dwarf(Adventurer): adv_class = "dwarf" prime_requisite = "strength" requirements = {'constitution' : 9 } progression = [ { "level" : 1, "xp" : 0, "hit-dice" : 1, "thac0" : 19, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 10, "breath attack" : 13, "spells / rods / staves" : 12 }}, { "level" : 2, "xp" : 2200, "hit-dice" : 2, "thac0" : 19, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 10, "breath attack" : 13, "spells / rods / staves" : 12 }}, { "level" : 3, "xp" : 4400, "hit-dice" : 3, "thac0" : 19, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 10, "breath attack" : 13, "spells / rods / staves" : 12 }}, { "level" : 4, "xp" : 8800, "hit-dice" : 4, "thac0" : 17, "saves" : { "death / poison" : 6, "wands" : 7, "paralysis / petrify" : 8, "breath attack" : 10, "spells / rods / staves" : 10 }}, { "level" : 5, "xp" : 17000, "hit-dice" : 5, "thac0" : 17, "saves" : { "death / poison" : 6, "wands" : 7, "paralysis / petrify" : 8, "breath attack" : 10, "spells / rods / staves" : 10 }}, { "level" : 6, "xp" : 35000, "hit-dice" : 6, "thac0" : 17, "saves" : { "death / poison" : 6, "wands" : 7, "paralysis / petrify" : 8, "breath attack" : 10, "spells / rods / staves" : 10 }}, { "level" : 7, "xp" : 70000, "hit-dice" : 7, "thac0" : 14, "saves" : { "death / poison" : 4, "wands" : 5, "paralysis / petrify" : 6, "breath attack" : 7, "spells / rods / staves" : 8 }}, { "level" : 8, "xp" : 140000, "hit-dice" : 8, "thac0" : 14, "saves" : { "death / poison" : 4, "wands" : 5, "paralysis / petrify" : 6, "breath attack" : 7, "spells / rods / staves" : 8 }}, { "level" : 9, "xp" : 270000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 4, "wands" : 5, "paralysis / petrify" : 6, "breath attack" : 7, "spells / rods / staves" : 8 }}, { "level" : 10, "xp" : 400000, "hit-dice" : 9, "thac0" : 12, "saves" : { "death / poison" : 2, "wands" : 3, "paralysis / petrify" : 4, "breath attack" : 4, "spells / rods / staves" : 6 }}, { "level" : 11, "xp" : 530000, "hit-dice" : 9, "thac0" : 12, "saves" : { "death / poison" : 2, "wands" : 3, "paralysis / petrify" : 4, "breath attack" : 4, "spells / rods / staves" : 6 }}, { "level" : 12, "xp" : 660000, "hit-dice" : 9, "thac0" : 12, "saves" : { "death / poison" : 2, "wands" : 3, "paralysis / petrify" : 4, "breath attack" : 4, "spells / rods / staves" : 6 }} ] def __init__(self,c_id, level, attributes={}) -> None: Adventurer.__init__(self, c_id, level, attributes) self.player_class = Dwarf.adv_class self.progression = Dwarf.progression self.hp = roll_dice(self.level, 8) self.armor = random.choice(list(armor.keys())) self.ac = armor[self.armor] class Elf(Adventurer): adv_class = "elf" prime_requisite = "intellgence" requirements = {'intelligence' : 9 } progression = [ { "level" : 1, "xp" : 0, "hit-dice" : 1, "thac0" : 19, "saves" : { "death / poison" : 12, "wands" : 13, "paralysis / petrify" : 13, "breath attack" : 15, "spells / rods / staves" : 15 }}, { "level" : 2, "xp" : 4000, "hit-dice" : 2, "thac0" : 19, "saves" : { "death / poison" : 12, "wands" : 13, "paralysis / petrify" : 13, "breath attack" : 15, "spells / rods / staves" : 15 }}, { "level" : 3, "xp" : 8000, "hit-dice" : 3, "thac0" : 19, "saves" : { "death / poison" : 12, "wands" : 13, "paralysis / petrify" : 13, "breath attack" : 15, "spells / rods / staves" : 15 }}, { "level" : 4, "xp" : 16000, "hit-dice" : 4, "thac0" : 17, "saves" : { "death / poison" : 10, "wands" : 11, "paralysis / petrify" : 11, "breath attack" : 13, "spells / rods / staves" : 12 }}, { "level" : 5, "xp" : 32000, "hit-dice" : 5, "thac0" : 17, "saves" : { "death / poison" : 10, "wands" : 11, "paralysis / petrify" : 11, "breath attack" : 13, "spells / rods / staves" : 12 }}, { "level" : 6, "xp" : 64000, "hit-dice" : 6, "thac0" : 17, "saves" : { "death / poison" : 10, "wands" : 11, "paralysis / petrify" : 11, "breath attack" : 13, "spells / rods / staves" : 12 }}, { "level" : 7, "xp" : 120000, "hit-dice" : 7, "thac0" : 14, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 9, "breath attack" : 10, "spells / rods / staves" : 10 }}, { "level" : 8, "xp" : 250000, "hit-dice" : 8, "thac0" : 14, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 9, "breath attack" : 10, "spells / rods / staves" : 10 }}, { "level" : 9, "xp" : 400000, "hit-dice" : 9, "thac0" : 14, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 9, "breath attack" : 10, "spells / rods / staves" : 10 }}, { "level" : 10, "xp" : 600000, "hit-dice" : 9, "thac0" : 12, "saves" : { "death / poison" : 6, "wands" : 7, "paralysis / petrify" : 8, "breath attack" : 8, "spells / rods / staves" : 8 }} ] spells = { 1: { 1: 1, 2: '-', 3: '-', 4: '-', 5: '-', 6: '-'}, 2: { 1: 2, 2: '-', 3: '-', 4: '-', 5: '-', 6: '-'}, 3: { 1: 2, 2: 1, 3: '-', 4: '-', 5: '-', 6: '-'}, 4: { 1: 2, 2: 2, 3: '-', 4: '-', 5: '-', 6: '-'}, 5: { 1: 2, 2: 2, 3: 1, 4: '-', 5: '-', 6: '-'}, 6: { 1: 2, 2: 2, 3: 2, 4: '-', 5: '-', 6: '-'}, 7: { 1: 3, 2: 2, 3: 2, 4: 1, 5: '-', 6: '-'}, 8: { 1: 3, 2: 3, 3: 2, 4: 2, 5: '-', 6: '-'}, 9: { 1: 3, 2: 3, 3: 3, 4: 2, 5: 1, 6: '-'}, 10: { 1: 3, 2: 3, 3: 3, 4: 3, 5: 2, 6: '-'} } def __init__(self,c_id, level, attributes={}) -> None: Adventurer.__init__(self, c_id, level, attributes) self.player_class = Elf.adv_class self.progression = Elf.progression self.hp = roll_dice(self.level, 6) self.armor = random.choice(list(armor.keys())) self.ac = armor[self.armor] self.spells = Elf.spells[self.level] self.spell_book = self.select_spells() class Halfling(Adventurer): adv_class = "halfling" prime_requisite = "dexterity" requirements = {'constitution' : 9, 'dexterity' : 9 } progression = [ { "level" : 1, "xp" : 0, "hit-dice" : 1, "thac0" : 19, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 10, "breath attack" : 13, "spells / rods / staves" : 12 }}, { "level" : 2, "xp" : 2000, "hit-dice" : 2, "thac0" : 19, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 10, "breath attack" : 13, "spells / rods / staves" : 12 }}, { "level" : 3, "xp" : 4000, "hit-dice" : 3, "thac0" : 19, "saves" : { "death / poison" : 8, "wands" : 9, "paralysis / petrify" : 10, "breath attack" : 13, "spells / rods / staves" : 12 }}, { "level" : 4, "xp" : 8000, "hit-dice" : 4, "thac0" : 17, "saves" : { "death / poison" : 6, "wands" : 7, "paralysis / petrify" : 8, "breath attack" : 10, "spells / rods / staves" : 10 }}, { "level" : 5, "xp" : 16000, "hit-dice" : 5, "thac0" : 17, "saves" : { "death / poison" : 6, "wands" : 7, "paralysis / petrify" : 8, "breath attack" : 10, "spells / rods / staves" : 10 }}, { "level" : 6, "xp" : 32000, "hit-dice" : 6, "thac0" : 17, "saves" : { "death / poison" : 6, "wands" : 7, "paralysis / petrify" : 8, "breath attack" : 10, "spells / rods / staves" : 10 }}, { "level" : 7, "xp" : 64000, "hit-dice" : 7, "thac0" : 14, "saves" : { "death / poison" : 4, "wands" : 5, "paralysis / petrify" : 6, "breath attack" : 7, "spells / rods / staves" : 8 }}, { "level" : 8, "xp" : 120000, "hit-dice" : 8, "thac0" : 14, "saves" : { "death / poison" : 4, "wands" : 5, "paralysis / petrify" : 6, "breath attack" : 7, "spells / rods / staves" : 8 }}, ] def __init__(self,c_id, level, attributes={}) -> None: Adventurer.__init__(self, c_id, level, attributes) self.player_class = Halfling.adv_class self.progression = Halfling.progression self.hp = roll_dice(self.level, 6) self.armor = random.choice(list(armor.keys())) self.ac = armor[self.armor]