aboutsummaryrefslogtreecommitdiff
path: root/parser
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-05-05 09:44:50 -0400
committerYour Name <you@example.com>2021-05-05 09:44:50 -0400
commit2a9f262e6db5906db445d465e500d7ba8c90fab3 (patch)
tree34f850754b0c9114ede9d7b2bb8da90dffddc4fe /parser
parent8614137f7f32f2c9f3c11419110cd70dd7f3b505 (diff)
downloaddmtool-2a9f262e6db5906db445d465e500d7ba8c90fab3.tar.gz
dmtool-2a9f262e6db5906db445d465e500d7ba8c90fab3.tar.bz2
dmtool-2a9f262e6db5906db445d465e500d7ba8c90fab3.zip
Implemented additional commands
Diffstat (limited to 'parser')
-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