aboutsummaryrefslogtreecommitdiff
path: root/parser/scrapeToJson.py
diff options
context:
space:
mode:
Diffstat (limited to 'parser/scrapeToJson.py')
-rwxr-xr-xparser/scrapeToJson.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/parser/scrapeToJson.py b/parser/scrapeToJson.py
index 21758d0..9128190 100755
--- a/parser/scrapeToJson.py
+++ b/parser/scrapeToJson.py
@@ -15,19 +15,22 @@ def processMonster(data, weapons, armors, spells):
desc[name] = ""
for name in ['d_resistances', 'd_vulnerabilities', 'd_immunities', 'c_immunities']:
# Formatted a, b, c[; d, e, and f from nonmagical attacks[ that aren't g]]
+ # Blerg. Also can be "not made with g weapons"
# Maybe without the a, b, c part
parts = [desc[name]]
if '; ' in desc[name]:
parts = desc[name].split('; ')
desc[name] = []
for part in parts:
- part = part.strip()
+ part = part.strip().lower()
# Look for "nonmagical", and "that aren't x"
qualifiers = []
if 'nonmagical' in part:
qualifiers.append('nonmagical')
if 'that aren\'t' in part:
qualifiers.append('non-' + re.search('(?<=that aren\'t ).*$', part).group(0))
+ if 'not made with ' in part:
+ qualifiers.append('non-' + re.search('(?<=not made with )\w*', part).group(0))
for typ in re.findall('([a-z]+(?=,)|^[a-z]+$|(?<=, )[a-z]+$|(?<=and )[a-z]+(?= from)|(?<=and )[a-z]+(?= \(from))', part):
desc[name].append({'type': typ, 'qualifiers': qualifiers})
# Calc things about hp