From a256da056803fdfe283a6a79889d08591173ffc7 Mon Sep 17 00:00:00 2001
From: James Miller <james.ryland.miller@gmail.com>
Date: Mon, 17 Feb 2020 23:13:48 -0600
Subject: [PATCH] working on clean up script, got saves and ability mods to
 display as int, add save_special fields

---
 data/yaml/clean-up-monsters.py | 46 ++++++++++++++++++++++++++++++++++
 data/yaml/monsters.yaml        |  6 ++---
 2 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/data/yaml/clean-up-monsters.py b/data/yaml/clean-up-monsters.py
index e69de29..33bf3a8 100644
--- a/data/yaml/clean-up-monsters.py
+++ b/data/yaml/clean-up-monsters.py
@@ -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()
+
+
diff --git a/data/yaml/monsters.yaml b/data/yaml/monsters.yaml
index 95d4468..6c73ea8 100644
--- a/data/yaml/monsters.yaml
+++ b/data/yaml/monsters.yaml
@@ -40,7 +40,7 @@
       - 
         name: "Invisible"
         traits: []
-        description: "  An unseen servant is invisible, though it normally doesn’t Sneak, so it is usually only hidden."
+        description: "An unseen servant is invisible, though it normally doesn’t 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"