def manual_stat_entry(): abilities = primary_abilities() rtndict = {} for i in abilities.values(): rtndict[i] = validate_choice( 18, message="Enter value for {} stat: ".format(i)) return rtndict
def __init__(self, character_name): super(Dragonborn, self).__init__() self.name = 'Dragonborn' self.strength += 2 self.charisma += 1 self.speed = 30 self.age = [15, 80] self.height = [66, 96] self.weight = [220, 280] self.skin = [ 'Brass', 'Bronze', 'Scarlet', 'Rust', 'Gold', 'Copper-Green' ] self.hair = [] self.eyes = ['Blue', 'Black', 'Brown', 'Green', 'Hazel', 'Amber'] self.abilities = ["DAMAGE RESISTANCE"] clearscreen() print("What type of Dragonborn is {}".format(character_name)) for key, value in draconic_lines().items(): print(key, value) x = validate_choice(len(draconic_lines().items())) if x <= 5: xtype = "5 by 30 ft. line (Dex Save)" else: xtype = "15 ft. Cone (Dex Save)" self.attacks = ["BREATH WEAPON" + xtype] self.language.append("Draconic")
def process_selection(argument): complete = False rtnlist = [] if len(argument) > 6: while complete is False: a = argument x = validate_choice(len(argument), message='Select Traits (1 of 2)') y = validate_choice(len(argument), message='Select Traits (2 of 2)') if x == y: complete = False else: complete = True rtnlist.append(a.get(x)) rtnlist.append(a.get(y)) else: a = argument x = validate_choice(len(argument), message='Select one trait') rtnlist.append(a[x]) return rtnlist
def single_spell_select(user_class, spell_level): spells = [] x = get_spells(user_class, spell_level) for xkey in x: print(xkey, x[xkey]) item = str(validate_choice(len(x))) try: spells.append(x[int(item)]) except KeyError: single_spell_select(user_class, spell_level) return spells
def simple_ranged_names(): names = { 1: "Crossbow, light", 2: "Dart", 3: "Shortbow", 4: "Sling", } for key, value in names.items(): print(key, value) a = validate_choice(len(names.items())) return names.get(a)
def tool(selection): x = selection rtnlist = [] selldict = {} count = 1 for key, value in x.items(): print(count, key) selldict[count] = key count += 1 a = validate_choice(len(x.items()), message='Choose an item: ') return selldict.get(a)
def martial_ranged_names(): names = { 1: "Blowgun", 2: "Crossbow, hand", 3: "Crossbow, heavy", 4: "Longbow", 5: "Net", } for key, value in names.items(): print(key, value) a = validate_choice(len(names.items())) return names.get(a)
def armor_names(): names = { 1: "Light Padded Armor", 2: "Light Leather Armor", 3: "Light Studded Leather Armor", 4: "Medium Hide Armor", 5: "Medium Chain Shirt Armor", 6: "Medium Scale Mail Armor", 7: "Heavy Ring Mail Armor", 8: "Heavy Chain Mail Armor", } for key, value in names.items(): print(key, value) a = validate_choice(len(names.items())) return names.get(a)
def simple_melee_names(): names = { 1: "Club", 2: "Dagger", 3: "Greatclub", 4: "Handaxe", 5: "Javelin", 6: "Light Hammer", 7: "Mace", 8: "Quarterstaff", 9: "Sickle", 10: "Spear" } for key, value in names.items(): print(key, value) a = validate_choice(len(names.items())) return names.get(a)
def musical_instruments_names(): names = { 1: "Bagpipes", 2: "Drum", 3: "Dulcimer", 4: "Flute", 5: "Lute", 6: "Lyre", 7: "Horn", 8: "Pan Flute", 9: "Shawm", 10: "Viol", 11: "Didgeridoo" } for key, value in names.items(): print(key, value) a = validate_choice(len(names.items())) return names.get(a)
def spell_queue(user_class, level, **kwargs): slots = None spells = [] if user_class == "Bard": slots = bard_slots(level) elif user_class == "Cleric": slots = cleric_slots(level) elif user_class == "Druid": slots = druid_slots(level) elif user_class == "Paladin": slots = paladin_slots(level) elif user_class == "Ranger": slots = ranger_slots(level) elif user_class == "Sorcerer": slots = sorcerer_slots(level) elif user_class == "Wizard": slots = wizard_slots(level) elif user_class == "Warlock": return get_warlock_spells(level) elif user_class == "Rogue": slots = rogue_slots(level) user_class = "Wizard" for key, value in slots.items(): if value > 0: print("Level", key) x = get_spells(user_class, key, **kwargs) for xkey in x: print(xkey, x[xkey]) for i in range(value): valid = False while valid is not True: item = str(validate_choice(len(x), message="Level " + str(key) + ": " + "Select number " + str(i+1) + " of " + str(value) + ": ")) if x[int(item)] in spells: valid = False print(BColors.FAIL + "You already have that Spell, Pick Another.") print(BColors.ENDC) else: spells.append(x[int(item)]) valid = True return spells
def artisan_tools_names(): names = { 1: "Alchemist's Supplies", 2: "Brewer's Supplies", 3: "Calligrapher's Tools", 4: "Carpenter's Tools", 5: "Cartographer's Tools", 6: "Cobbler's Tools", 7: "Cook's Utensils", 8: "Glassblower's Tools", 9: "Jeweler's Tools", 10: "Leatherworker's Tool", 11: "Mason's Tools", 12: "Painter's Supplies", 13: "Potter's Tools", 14: "Smith's Tools", 15: "Tinker's Tools", 16: "Weaver's Tools", 17: "Woodcarver's Tools" } for key, value in names.items(): print(key, value) a = validate_choice(len(names.items())) return names.get(a)
def martial_melee_names(): names = { 1: "Battleaxe", 2: "Flail", 3: "Glaive", 4: "Greataxe", 5: "Greatsword", 6: "Halberd", 7: "Lance", 8: "Longsword", 9: "Maul", 10: "Morningstar", 11: "Pike", 12: "Rapier", 13: "Scimitar", 14: "Trident", 15: "War Pick", 16: "Warhammer", 17: "Whip", } for key, value in names.items(): print(key, value) a = validate_choice(len(names.items())) return names.get(a)
def starting_equipment(klass, background, proficiencies): clearscreen() print('Choose Starting Equipment for your Class:' + str(klass)) equipment_list = [] # BARBARIAN if klass == "Barbarian": print('1: A Greataxe') print('2: Any Martial Melee Weapon') a = validate_choice(2, message="Enter 1 or 2:") if a == 1: equipment_list.append("Greataxe") print('Greataxe added to inventory') else: x = martial_melee_names() equipment_list.append(x) print("{} added to inventory".format(x)) for i in packs().get("Explorer's Pack"): equipment_list.append(i) equipment_list.append('Javelin') equipment_list.append('Javelin') equipment_list.append('Javelin') equipment_list.append('Javelin') # BARD if klass == "Bard": print('1: A Rapier') print('2: Longsword') print('3: Any Simple Weapon') a = validate_choice(3) if a == 1: equipment_list.append("Rapier") print('Rapier added to inventory') if a == 2: equipment_list.append("Longsword") print('Longsword added to inventory') if a == 3: x = simple_melee_names() equipment_list.append(x) print("{} added to inventory".format(x)) clearscreen() print("1: Diplomat\'s Pack") print("2: Entertainer's Pack") a = validate_choice(2) if a == 1: for i in packs().get("Diplomat's Pack"): equipment_list.append(i) else: for i in packs().get("Entertainer's Pack"): equipment_list.append(i) clearscreen() print("1: Lute") print("2: Any Other Musical Instrument") a = validate_choice(2) if a == 1: equipment_list.append("Lute") else: x = musical_instruments_names() equipment_list.append(x) equipment_list.append("Light Leather Armor") equipment_list.append("Dagger") # CLERIC if klass == "Cleric": if "-Warhammer" in proficiencies: print('1: A Mace') print('2: A Warhammer') a = validate_choice(2) if a == 1: equipment_list.append('Mace') else: equipment_list.append('Warhammer') else: equipment_list.append("Mace") clearscreen() if "-Heavy Armor" in proficiencies: print('1: Scale Mail') print('2: Leather Armor') print('3: Chain Mail') a = validate_choice(3) if a == 1: equipment_list.append('Medium Scale Mail Armor') if a == 2: equipment_list.append('Light Leather Armor') else: equipment_list.append('Heavy Chain Mail Armor') else: print('1: Scale Mail') print('2: Leather Armor') a = validate_choice(2) if a == 1: equipment_list.append('Medium Scale Mail Armor') if a == 2: equipment_list.append('Light Leather Armor') clearscreen() print('1: Light Crossbow and 20 Bolts') print('2: Any Simple Weapon') a = validate_choice(2) if a == 1: equipment_list.append('Crossbow, light') equipment_list.append('20 bolts') if a == 2: x = simple_melee_names() equipment_list.append(x) clearscreen() print("1: Priest's Pack") print("2: Explorer's Pack") a = validate_choice(2) if a == 1: for i in packs().get("Priest's Pack"): equipment_list.append(i) if a == 2: for i in packs().get("Explorer's Pack"): equipment_list.append(i) equipment_list.append("Shield") equipment_list.append("Holy Symbol") # DRUID if klass == 'Druid': print("1: Wooden Shield") print("2: Any Simple Melee Weapon") print("3: Any Simple Ranged Weapon") a = validate_choice(3) if a == 1: equipment_list.append("Wooden Shield") if a == 2: x = simple_melee_names() equipment_list.append(x) if a == 3: x = simple_ranged_names() equipment_list.append(x) clearscreen() print("1: A Scimitar") print("2: Any Simple Melee Weapon") a = validate_choice(2) if a == 1: equipment_list.append("Scimitar") if a == 2: x = simple_melee_names() equipment_list.append(x) equipment_list.append("Light Leather Armor") equipment_list.append("Druidic Focus") for i in packs().get("Explorer's Pack"): equipment_list.append(i) # FIGHTER if klass == 'Fighter': print("1: Chain Mail") print("2: Leather Armor, Longbow, 20 Arrows") a = validate_choice(2) if a == 1: equipment_list.append("Heavy Chain Mail Armor") if a == 2: equipment_list.append("Light Leather Armor") equipment_list.append("Longbow") equipment_list.append("20 Arrows") clearscreen() print("1: A Martial Ranged Weapon and a Shield") print("2: A Martial Melee Weapon and a Shield") print("3: Two Martial Melee Weapons") print("4: Two Martial Ranged Weapons") print("5: A Martial Ranged and A Martial Melee Weapon") a = validate_choice(5) if a == 1: equipment_list.append("Metal Shield") x = martial_ranged_names() equipment_list.append(x) if a == 2: equipment_list.append("Metal Shield") x = martial_melee_names() equipment_list.append(x) if a == 3: x = martial_melee_names() y = martial_melee_names() equipment_list.append(x) equipment_list.append(y) if a == 4: x = martial_ranged_names() y = martial_ranged_names() equipment_list.append(x) equipment_list.append(y) if a == 5: x = martial_ranged_names() y = martial_melee_names() equipment_list.append(x) equipment_list.append(y) clearscreen() print("1: A Light Crossbow and 20 bolts") print("2: 2 Handaxes") a = validate_choice(2) if a == 1: equipment_list.append("Crossbow, light") equipment_list.append("20 bolts") if a == 2: equipment_list.append("Handaxe") equipment_list.append("Handaxe") clearscreen() print("1: Dungeoneer's Pack") print("2: Explorer's Pack") a = validate_choice(2) if a == 1: for i in packs().get("Dungeoneer's Pack"): equipment_list.append(i) if a == 2: for i in packs().get("Explorer's Pack"): equipment_list.append(i) clearscreen() # MONK if klass == 'Monk': print("1: A Shortsword") print("2: Any Simple Melee Weapon") print("3: Any Simple Ranged Weapon") a = validate_choice(3) if a == 1: equipment_list.append("Shortsword") if a == 2: x = simple_melee_names() equipment_list.append(x) if a == 3: x = simple_ranged_names() equipment_list.append(x) clearscreen() print("1: Dungeoneer's Pack") print("2: Explorer's Pack") a = validate_choice(2) if a == 1: for i in packs().get("Dungeoneer's Pack"): equipment_list.append(i) if a == 2: for i in packs().get("Explorer's Pack"): equipment_list.append(i) for i in range(10): equipment_list.append("Dart") # PALADIN if klass == "Paladin": print("1: A Martial Ranged Weapon and a Shield") print("2: A Martial Melee Weapon and a Shield") print("3: Two Martial Melee Weapons") print("4: Two Martial Ranged Weapons") print("5: A Martial Ranged and A Martial Melee Weapon") a = validate_choice(5) if a == 1: equipment_list.append("Metal Shield") x = martial_ranged_names() equipment_list.append(x) if a == 2: equipment_list.append("Metal Shield") x = martial_melee_names() equipment_list.append(x) if a == 3: x = martial_melee_names() y = martial_melee_names() equipment_list.append(x) equipment_list.append(y) if a == 4: x = martial_ranged_names() y = martial_ranged_names() equipment_list.append(x) equipment_list.append(y) if a == 5: x = martial_ranged_names() y = martial_melee_names() equipment_list.append(x) equipment_list.append(y) clearscreen() print("1: 5 Javelins") print("2: Any Simple Melee Weapon") a = validate_choice(2) if a == 1: for i in range(5): equipment_list.append("Javelin") if a == 2: x = simple_melee_names() equipment_list.append(x) clearscreen() print("1: Priest's Pack") print("2: Explorer's Pack") a = validate_choice(2) if a == 1: for i in packs().get("Priest's Pack"): equipment_list.append(i) if a == 2: for i in packs().get("Explorer's Pack"): equipment_list.append(i) equipment_list.append("Heavy Chain Mail Armor") equipment_list.append("Holy Symbol") # RANGER if klass == 'Ranger': print("1: Scale Mail") print("2: Leather Armor") a = validate_choice(2) if a == 1: equipment_list.append("Medium Scale Mail Armor") if a == 2: equipment_list.append("Light Leather Armor") clearscreen() print("1: 2 Shortswords") print("2: 2 Simple Melee Weapons") a = validate_choice(2) if a == 1: equipment_list.append("Shortsword") equipment_list.append("Shortsword") if a == 2: x = simple_melee_names() y = simple_melee_names() equipment_list.append(x) equipment_list.append(y) clearscreen() print("1: Dungeoneer's Pack") print("2: Explorer's Pack") a = validate_choice(2) if a == 1: for i in packs().get("Dungeoneer's Pack"): equipment_list.append(i) if a == 2: for i in packs().get("Explorer's Pack"): equipment_list.append(i) equipment_list.append("Longbow") equipment_list.append("20 Arrows") # ROGUE if klass == 'Rogue': print("1: Rapier") print("2: Shortsword") a = validate_choice(2) if a == 1: equipment_list.append("Rapier") if a == 2: equipment_list.append("Shortsword") clearscreen() print("1: Dungeoneer's Pack") print("2: Explorer's Pack") print("3: Burglar's Pack") a = validate_choice(3) if a == 1: for i in packs().get("Dungeoneer's Pack"): equipment_list.append(i) if a == 2: for i in packs().get("Explorer's Pack"): equipment_list.append(i) if a == 3: for i in packs().get("Burglar's Pack"): equipment_list.append(i) equipment_list.append("Light Leather Armor") equipment_list.append("Dagger") equipment_list.append("Dagger") # SORCERER if klass == 'Sorcerer': print("1: A Light Crossbow and 20 bolts") print("2: Any Simple Melee Weapon") print("3: Any Simple Ranged Weapon") a = validate_choice(3) if a == 1: equipment_list.append("Crossbow, light") equipment_list.append("20 bolts") if a == 2: x = simple_melee_names() equipment_list.append(x) if a == 3: x = simple_ranged_names() equipment_list.append(x) clearscreen() print("1: A Component Pouch") print("2: An Arcane Focus") a = validate_choice(2) if a == 1: equipment_list.append("Component Pouch") if a == 2: equipment_list.append("Arcane Focus") clearscreen() print("1: Dungeoneer's Pack") print("2: Explorer's Pack") a = validate_choice(2) if a == 1: for i in packs().get("Dungeoneer's Pack"): equipment_list.append(i) if a == 2: for i in packs().get("Explorer's Pack"): equipment_list.append(i) equipment_list.append("Dagger") equipment_list.append("Dagger") # WARLOCK if klass == 'Warlock': print("1: A Light Crossbow and 20 bolts") print("2: Any Simple Melee Weapon") print("3: Any Simple Ranged Weapon") a = validate_choice(3) if a == 1: equipment_list.append("Crossbow, light") equipment_list.append("20 bolts") if a == 2: x = simple_melee_names() equipment_list.append(x) if a == 3: x = simple_ranged_names() equipment_list.append(x) clearscreen() print("1: A Component Pouch") print("2: An Arcane Focus") a = validate_choice(2) if a == 1: equipment_list.append("Component Pouch") if a == 2: equipment_list.append("Arcane Focus") clearscreen() print("1: Dungeoneer's Pack") print("2: Scholar's Pack") a = validate_choice(2) if a == 1: for i in packs().get("Dungeoneer's Pack"): equipment_list.append(i) if a == 2: for i in packs().get("Scholar's Pack"): equipment_list.append(i) equipment_list.append("Light Leather Armor") equipment_list.append("Dagger") equipment_list.append("Dagger") print("1: Simple Melee Weapon") print("2: Simple Ranged Weapon") a = validate_choice(2) if a == 1: x = simple_melee_names() equipment_list.append(x) if a == 2: x = simple_ranged_names() equipment_list.append(x) # WIZARD if klass == "Wizard": print("1: A Quarterstaff") print("2: A Dagger") a = validate_choice(2) if a == 1: equipment_list.append("Quarterstaff") if a == 2: equipment_list.append("Dagger") clearscreen() print("1: A Component Pouch") print("2: An Arcane Focus") a = validate_choice(2) if a == 1: equipment_list.append("Component Pouch") if a == 2: equipment_list.append("Arcane Focus") clearscreen() print("1: Dungeoneer's Pack") print("2: Scholar's Pack") a = validate_choice(2) if a == 1: for i in packs().get("Dungeoneer's Pack"): equipment_list.append(i) if a == 2: for i in packs().get("Scholar's Pack"): equipment_list.append(i) equipment_list.append("Spellbook") # ACOLYTE if background == "Acolyte": equipment_list.append("Holy Symbol") equipment_list.append("Prayer Book or Prayer Wheel") equipment_list.append("5 Sticks of Incense") equipment_list.append("vestments") equipment_list.append("Set of Common Clothes") equipment_list.append("Pouch containing 15gp") # CHARLATAN if background == "Charlatan": equipment_list.append("Set of Fine Clothes") equipment_list.append("Disguise Kit") print("1: Ten Stoppered Bottles Filled with Colored liquid") print("2: A Set of Weighted Dice") print("3: A Deck of Marked Cards") print("4: A Signet Ring of an Imaginary Duke") a = validate_choice(4) if a == 1: equipment_list.append( "Ten Stoppered Bottles Filled with Colored Liquid") if a == 2: equipment_list.append("Set of Weighted Dice") if a == 3: equipment_list.append("Deck of Marked Cards") if a == 4: equipment_list.append("Signet Ring of an Imaginary Duke") equipment_list.append("Poucn containing 15gp") # CRIMINAL if background == "Criminal / Spy": equipment_list.append("Crowbar") equipment_list.append("Set of Dark Common Clothes including a Hood") equipment_list.append("a pouch containing 15gp") # ENTERTAINER if background == "Entertainer": x = musical_instruments_names() equipment_list.append(x) equipment_list.append("Favor of an Admirer") equipment_list.append("Costume") equipment_list.append("a pouch containing 15gp") # GUILD ARTISAN if background == "Guild Artisan": x = artisan_tools_names() equipment_list.append(x) equipment_list.append("A Letter of Introduction from your Guild") equipment_list.append("A Set of Traveler's Clothes") equipment_list.append("a pouch containing 15gp") # HERMIT if background == "Hermit": equipment_list.append( "A scroll case stuffed full of notes from your studies or prayers") equipment_list.append("A Winter Blanket") equipment_list.append("Set of Common Clothes") equipment_list.append("An Herbalism Kit") equipment_list.append("5gp") # NOBLE if background == "Noble": equipment_list.append("Set of Fine Clothes") equipment_list.append("Signet Ring") equipment_list.append("Scroll of Pedigree") equipment_list.append("Purse containing 25gp") # OUTLANDER if background == "Outlander": equipment_list.append("Staff") equipment_list.append("Hunting Trap") equipment_list.append("Trophy from an animal you killed") equipment_list.append("Set of Traveler's Clothes") equipment_list.append("Pouch containing 10gp") # SAGE if background == "Sage": equipment_list.append("Bottle of Black Ink") equipment_list.append("Quill") equipment_list.append("Small Knife") equipment_list.append( "Letter from a dead colleague posing a question you have not yet been able to answer" ) equipment_list.append("Set of Common Clothes") equipment_list.append("Pouch containing 10gp") # SAILOR if (background == "Sailor") or (background == "Pirate"): equipment_list.append("Club") equipment_list.append("50 Feet of Silk Rope") equipment_list.append("Lucky Charm") equipment_list.append("Set of Common Clothes") equipment_list.append("Pouch containing 10gp") # SOLDIER if background == "Soldier": equipment_list.append("Insignia of Rank") equipment_list.append("A trophy taken from a fallen enemy") equipment_list.append("A set of bone dice or deck of cards") equipment_list.append("A set of Common Clothes") equipment_list.append("Pouch containing 10gp") # URCHIN if background == "Urchin": equipment_list.append("Small Knife") equipment_list.append("Map of the city you grew up in") equipment_list.append("Pet Mouse") equipment_list.append("Token to remember your parents by") equipment_list.append("Set of Common Clothes") equipment_list.append("Pouch containing 10gp") return equipment_list
def stat_selection(classname, highest): # abilities = primary_abilities() yesno = {1: 'Re-roll', 2: 'Save'} manualentry = False # display choices mode = {1: "Roll Stats", 2: "Manually Enter Stats"} for key, value in mode.items(): print(key, value) mychoice = validate_choice(2, message="Choose a method for choosing stats") if mychoice == 2: manualentry = True if manualentry == True: rtndict = manual_stat_entry() return rtndict else: roll = [] reroll = True complete = False rtndict = {} while reroll is not False: roll = [] for i in range(6): roll.append(initial_diceroll()) roll.sort(reverse=True) print(roll) for key, value in yesno.items(): print(key, value) accept = validate_choice(2, message='Re-Roll?') if accept == 1: reroll = True elif accept == 2: reroll = False else: reroll = True clearscreen() print('Values are sorted highest first, as a {classname}, \n ' 'your highest stat should be {highest}\n'.format( classname=BColors.HEADER + classname + BColors.ENDC, highest=BColors.HEADER + highest + BColors.ENDC)) print(BColors.ENDC) yesno = {1: 'Re-Assign', 2: 'Save'} while complete is False: try: abilities = primary_abilities() print(roll) for i in roll: print(BColors.OKGREEN + str(i)) print(BColors.ENDC) for key, value in abilities.items(): print(key, value) valid = False while valid is not True: x = validate_choice( 6, message= 'Choose a Primary Ability to Assign this Roll To.') if abilities[x] in rtndict.values(): valid = False else: rtndict[abilities[x]] = i abilities.pop(x) valid = True for key, value in rtndict.items(): print(key, value) print('\n') for key, value in yesno.items(): print(key, value) a = validate_choice(2, message='') if a == 1: complete = False elif a == 2: complete = True else: complete = False except KeyError: print('ENTER A VALID NUMBER') complete = False except ValueError: print('ENTER A VALID NUMBER') complete = False return rtndict
def set_alignment(self): for key, value in alignment().items(): print(key, value) a = validate_choice(len(alignment().items()), message='Choose your character\'s alignment: ') self.alignment = alignment().get(a)