-
Notifications
You must be signed in to change notification settings - Fork 4
/
dnd_monster_stat_display.py
executable file
·28 lines (26 loc) · 1.32 KB
/
dnd_monster_stat_display.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from databases.dnd5.dnd5_monster_db import get_monster_by_name, get_number_of_monsters_in_db, \
get_all_monsters_names_from_db, get_all_monsters_names_by_type, get_random_monster
def dnd_monster_stat_display():
print("Type 1 for finding a monster by name, Type 2 to find the list of monsters in the database, Type 3 to find "
"monsters of a type, type 4 for a random monster")
choice = input()
if choice == "1":
print("Please give the name of the monster you are looking for:")
monster_name = input().strip()
monster = get_monster_by_name(monster_name)
if monster is None:
print("No monster found with name: " + monster_name)
else:
monster.cli_display()
if choice == "2":
print("The database contains " + str(get_number_of_monsters_in_db()) + " monsters.")
print("The database contains the following monsters: ")
print(", ".join(get_all_monsters_names_from_db()))
if choice == "3":
print("Choose a type of monster")
monster_type = input().strip()
print("The database contains the following monsters of type " + monster_type + ".")
print(", ".join(get_all_monsters_names_by_type(monster_type)))
if choice == "4":
print("Find a random monster")
get_random_monster().cli_display()