From 53c958f087fedf20d3932beead3de4b254e0b59e Mon Sep 17 00:00:00 2001 From: Trysdyn Black Date: Sun, 13 Oct 2024 02:34:33 -0700 Subject: [PATCH] Support MORPH fields in monster data --- main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.py b/main.py index f47d2f9..a236a75 100644 --- a/main.py +++ b/main.py @@ -72,6 +72,13 @@ class Parser: info["special"] = {special_name: special_desc} else: info["special"] = {} + # Morph results, with a percent chance in each one + elif line.startswith("MORPH"): + _, chance, items = line.split(" ", 2) + chance = int(chance[1:-3]) + items = items.split(", ") + if "morph" not in info: + info["morph"] = {"percent_chance": chance, "items": items} # Everything else is a simple k: v list where v is comma-delimited else: for k in ["immune", "auto", "skills", "steal", "drops", "location"]: