This commit is contained in:
NikolajDanger
2020-03-31 01:37:31 +02:00
parent b389988a92
commit d9f1e23481
5 changed files with 48 additions and 14 deletions

View File

@ -7,6 +7,7 @@ from funcs import gwendolynFuncs as gf
logging.basicConfig(filename="gwendolyn.log", level=logging.INFO)
# Calculates D&D stat modifier
def modifier(statistic):
mods = math.floor((statistic-10)/2)
if mods >= 0:
@ -16,15 +17,19 @@ def modifier(statistic):
saves = ["strength_save","dexterity_save","constitution_save","intelligence_save","wisdom_save","charisma_save"]
abilities = ["acrobatics","animal_handling","arcana","athletics","deception","history","insight","intimidation","investigation","medicine","nature","perception","performance","persuasion","religion","sleight_of_hand","stealth","survival"]
# Looks up a monster
def monsterFunc(content):
command = gf.cap(content.lower().replace("!monster ",""))
print("Looking up "+command)
logging.info("Looking up "+command)
# 1-letter monsters don't exist
if len(content.lower().split()) < 2:
print("Monster doesn't exist in database\n")
logging.info("Monster doesn't exist in database\n")
return("I don't know that monster...","","","","","")
else:
# Opens "mensters.json"
data = json.load(open('resources/monsters.json', encoding = "utf8"))
for monster in data:
if str(command) == monster["name"]:
@ -124,10 +129,13 @@ def monsterFunc(content):
logging.info("Couldn't find monster")
return("I don't know that monster...","","","","","")
# Looks up a spell
def spellFunc(content):
command = gf.cap(content.lower().replace("!spell ",""))
print("Looking up "+command)
logging.info("Looking up "+command)
# Opens "spells.json"
data = json.load(open('resources/spells.json', encoding = "utf8"))
if str(command) in data:
print("Returning spell information")