From 2a9f262e6db5906db445d465e500d7ba8c90fab3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 5 May 2021 09:44:50 -0400 Subject: Implemented additional commands --- parser/scrapeToJson.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'parser/scrapeToJson.py') 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 -- cgit v1.2.3