working on clean up script, got saves and ability mods to display as int, add save_special fields

bradl/monsters-adult-gold-dragon
James Miller 2020-02-17 23:13:48 -06:00
parent c0cd513290
commit a256da0568
2 changed files with 49 additions and 3 deletions

View File

@ -0,0 +1,46 @@
import yaml
def main():
with open("monsters.yaml", 'r') as content_file:
data = yaml.full_load(content_file)
print(data[0]['ability_mods'])
for i in data:
i['saves_special'] = {}
for k, v in i['ability_mods'].items():
i['ability_mods'][k] = int(v)
# print(k, i['ability_mods'][k])
for k, v in i['saves'].items():
# print(k, v)
i['saves_special'][k] = None
if ',' in v:
# print("WE GOT A COMMA")
i['saves'][k] = v.replace(',', '')
if ';' in v:
# print("WE GOT A SPECIAL")
a = v.split('; ')
# print(a)
i['saves_special'][k] = a[1]
i['saves'][k] = a[0]
elif '(' in v:
print("we got a parentheses")
print(v)
a = v.split(' (')
# print(a)
i['saves_special'][k] = a[1]
i['saves'][k] = a[0]
i['saves'][k] = int(i['saves'][k])
# print(k, i['saves'][k])
final = yaml.safe_dump(data, allow_unicode=True)
with open("tmp-monsters.yaml", 'w') as f:
f.write(final)
if __name__ == "__main__":
main()

View File

@ -40,7 +40,7 @@
-
name: "Invisible"
traits: []
description: " An unseen servant is invisible, though it normally doesnt Sneak, so it is usually only hidden."
description: "An unseen servant is invisible, though it normally doesnt Sneak, so it is usually only hidden."
melee: []
ranged: []
spell_dc: "None"
@ -103,7 +103,7 @@
- "aura"
- "disease"
range: "5 feet"
description: " While underwater, an aboleth exudes a cloud of transparent slime. An air-breathing creature adjacent to an aboleth must succeed at a DC 25 Fortitude save each round or lose the ability to breathe air but gain the ability to breathe water for 3 hours."
description: "While underwater, an aboleth exudes a cloud of transparent slime. An air-breathing creature adjacent to an aboleth must succeed at a DC 25 Fortitude save each round or lose the ability to breathe air but gain the ability to breathe water for 3 hours."
melee:
-
name: "tentacle"
@ -37503,7 +37503,7 @@
name: "Sabosan"
type: "Creature"
level: "5"
description: "Sabosans are evil, intelligent, bat-like humanoids who live in warm forests and drink the blood of other creatures, particularly people. They have thin, emaciated torsos and broad, leathery wings that can reach a span of almost 20 feet. Sabosans heads, necks, shoulders, and upper chests are covered with red or dark-brown fur that barely obscures their stretched.thin flesh. Their ears are large and pointed like a batfs, and indeed they can echolocate to locate prey much like bats can, though their eyes are also capable of seeing in low light."
description: "Sabosans are evil, intelligent, bat-like humanoids who live in warm forests and drink the blood of other creatures, particularly people. They have thin, emaciated torsos and broad, leathery wings that can reach a span of almost 20 feet. Sabosans heads, necks, shoulders, and upper chests are covered with red or dark-brown fur that barely obscures their stretched.thin flesh. Their ears are large and pointed like a bat's, and indeed they can echolocate to locate prey much like bats can, though their eyes are also capable of seeing in low light."
speed:
land: "25 feet"
fly: "25 feet"