still cleaning on monsters.yaml

bradl/monsters-adult-gold-dragon
James Miller 2020-02-19 00:11:21 -06:00
parent 16f5934daa
commit c597e868a6
2 changed files with 53 additions and 13 deletions

View File

@ -9,7 +9,7 @@ def main():
counter = 0 counter = 0
for i in data: for i in data:
counter += 1 counter += 1
print("{}\t{}".format(counter, i['name'])) #print("{}\t{}".format(counter, i['name']))
# Set some data points before iteration # Set some data points before iteration
i['saves_special'] = {} i['saves_special'] = {}
@ -60,15 +60,15 @@ def main():
# clean up traits with trailing or leading whitespace # clean up traits with trailing or leading whitespace
traitslist = [] traitslist = []
print(i['traits']) #print(i['traits'])
for x in i['traits']: for x in i['traits']:
traitslist.append(x.strip()) traitslist.append(x.strip())
print(x.strip()) #print(x.strip())
print(traitslist) #print(traitslist)
i['traits'] = traitslist i['traits'] = traitslist
# clean up traits underneath proactive actions with trailing or leading whitespace # clean up traits underneath proactive actions with trailing or leading whitespace
print(i['proactive_abilities']) #print(i['proactive_abilities'])
for x in i['proactive_abilities']: for x in i['proactive_abilities']:
traitslist = [] traitslist = []
if x['traits'] != None: if x['traits'] != None:
@ -77,7 +77,7 @@ def main():
else: else:
for y in x['traits']: for y in x['traits']:
traitslist.append(y.strip()) traitslist.append(y.strip())
print(y.strip()) #print(y.strip())
x['traits'] = traitslist x['traits'] = traitslist
# clean up senses # clean up senses
@ -106,6 +106,46 @@ def main():
for x in i['innate_spells']: for x in i['innate_spells']:
x['level'] = int(x['level']) x['level'] = int(x['level'])
# clean up level
i['level'] = int(i['level'])
# clean up AC and HP and Perception
###print("AC:\t{}".format(i['ac']))
###print("HP:\t{}".format(i['hp']))
res = re.match('(\d+)', i['ac'].strip())
i['ac'] = int(res.group(1))
res = re.match('(\d+)', i['hp'].strip())
i['hp'] = int(res.group(1))
# clean up spell attack to hit
if 'spell_attack_to_hit' not in i:
i['spell_attack_to_hit'] = None
elif i['spell_attack_to_hit'] == "None":
i['spell_attack_to_hit'] = None
else:
res = re.search('(\d+)', i['spell_attack_to_hit'])
print("{}\t{}".format(counter, i['name']))
if res:
i['spell_attack_to_hit'] = int(res.group(1))
###if i['perception'] == None or i['perception'] == "":
### print("{}\t{}".format(counter, i['name']))
### print("\t\t\t\t{}".format(i['perception']))
if type(i['perception']) is str:
#print("{}\t{}".format(counter, i['name']))
res = re.match('(\d+)', i['perception'])
#print(res.group(1))
i['perception'] = int(res.group(1))
# clean up nulls for empty lists
if i['automatic_abilities'] == []:
i['automatic_abilities'] = None
if i['ranged'] == []:
i['ranged'] = None
if i['melee'] == []:
i['melee'] = None
# clean up resistances # clean up resistances

View File

@ -24066,7 +24066,7 @@
- "Medium" - "Medium"
- "Humanoid" - "Humanoid"
- "Lizardfolk" - "Lizardfolk"
perception: "" perception: 7
senses: null senses: null
skills: skills:
Acrobatics: "+5" Acrobatics: "+5"
@ -24154,7 +24154,7 @@
- "Medium" - "Medium"
- "Humanoid" - "Humanoid"
- "Lizardfolk" - "Lizardfolk"
perception: "" perception: 8
senses: null senses: null
skills: skills:
Acrobatics: "+6" Acrobatics: "+6"
@ -24249,7 +24249,7 @@
- "Medium" - "Medium"
- "Humanoid" - "Humanoid"
- "Lizardfolk" - "Lizardfolk"
perception: "" perception: 8
senses: null senses: null
skills: skills:
Diplomacy: "+4" Diplomacy: "+4"
@ -35524,7 +35524,7 @@
- "Medium" - "Medium"
- "Anadi" - "Anadi"
- "Humanoid" - "Humanoid"
perception: "" perception: 7
senses: null senses: null
skills: skills:
Acrobatics: "+8" Acrobatics: "+8"
@ -35622,7 +35622,7 @@
- "Medium" - "Medium"
- "Anadi" - "Anadi"
- "Humanoid" - "Humanoid"
perception: "" perception: 12
senses: null senses: null
skills: skills:
Athletics: "+6 " Athletics: "+6 "
@ -35725,7 +35725,7 @@
- "Medium" - "Medium"
- "Anadi" - "Anadi"
- "Humanoid" - "Humanoid"
perception: "" perception: 15
senses: null senses: null
skills: skills:
Athletics: "+12" Athletics: "+12"
@ -35931,7 +35931,7 @@
- "N" - "N"
- "Medium" - "Medium"
- "Animal" - "Animal"
perception: "" perception: 8
senses: null senses: null
skills: skills:
Acrobatics: "+9" Acrobatics: "+9"