From abcd9aea579eafecc600f6139db85919a778d750 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 20 Aug 2019 14:49:32 +0200 Subject: [PATCH] Handle hardmode ores sometimes having an unknown value --- lihzahrd/world.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lihzahrd/world.py b/lihzahrd/world.py index a3ee400..608b08a 100644 --- a/lihzahrd/world.py +++ b/lihzahrd/world.py @@ -378,9 +378,21 @@ class World: rain = Rain(is_active=f.bool(), time_left=f.int4(), max_rain=f.single()) - hardmode_ore_1 = HardmodeTier1Ore(f.int4()) - hardmode_ore_2 = HardmodeTier2Ore(f.int4()) - hardmode_ore_3 = HardmodeTier3Ore(f.int4()) + try: + hardmode_ore_1 = HardmodeTier1Ore(f.int4()) + except ValueError: + hardmode_ore_1 = HardmodeTier1Ore.NOT_DETERMINED + + try: + hardmode_ore_2 = HardmodeTier2Ore(f.int4()) + except ValueError: + hardmode_ore_2 = HardmodeTier2Ore.NOT_DETERMINED + + try: + hardmode_ore_3 = HardmodeTier3Ore(f.int4()) + except ValueError: + hardmode_ore_3 = HardmodeTier3Ore.NOT_DETERMINED + altars_smashed = AltarsSmashed(count=smashed_altars_count, ore_tier1=hardmode_ore_1, ore_tier2=hardmode_ore_2,