pattern match indirect knockouts specifically

This commit is contained in:
xeals 2023-04-03 20:34:12 +10:00
parent 25b80a71a1
commit 7138482b88
Signed by: xeals
GPG Key ID: A498C7AF27EC6B5C

View File

@ -207,12 +207,10 @@ def parse_log(game: str, log: str, into: sqlite3.Connection):
LOG.debug(f"{line} <- {last_move}")
last_status_set[(mon, cond)] = last_move[0]
case ["-damage", mon, *rest]:
# rest is new_hp and sometimes a source (if not from a move)
# in a knockout, new_hp is "0 fnt"
if rest[0] == "0 fnt" and len(rest) > 1:
case ["-damage", mon, "0 fnt", from_]:
# mon has fainted from an indirect damage source
LOG.debug(f"tracing source for {line}")
source = rest[1].replace("[from] ", "")
source = from_.replace("[from] ", "")
source_user = None
test_hazard = last_env_set.get((mon[0:1], source))