From 323f5b16f9d9ad8c4be617ab710391ade1320bf0 Mon Sep 17 00:00:00 2001 From: Christopher Toth Date: Sun, 26 Jul 2026 20:45:04 -0600 Subject: [PATCH] Fix constants fidelity: add FORMS.INSTANT_DECAY (bit D), rename RIST_L to WRIST_L FORMS skipped bit 8 (ROM's FORM_INSTANT_DECAY in merc.h), so a mob with that form bit parsed but rendered unnamed. enum.auto() members are unaffected: UNUSED1 stays at 32 (next power of two above OTHER=16). WEAR_LOCATIONS.RIST_L was a typo for WRIST_L; the correct name is now canonical with RIST_L kept as a deprecated alias for any external importers. Fixes #9 Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01F8kWxXQUY73XMXyeUYhkLd --- area_reader/constants.py | 4 +++- test_area_reader.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/area_reader/constants.py b/area_reader/constants.py index 7c72bf3..70f9978 100644 --- a/area_reader/constants.py +++ b/area_reader/constants.py @@ -213,6 +213,7 @@ class FORMS(enum.IntFlag): EDIBLE = BITFLAGS['A'] POISON = BITFLAGS['B'] MAGICAL = BITFLAGS['C'] + INSTANT_DECAY = BITFLAGS['D'] OTHER = BITFLAGS['E'] # defined by material bit UNUSED1 = enum.auto() # actual form @@ -284,7 +285,8 @@ class WEAR_LOCATIONS(enum.Enum): SHIELD = 11 ABOUT = 12 WAIST = 13 - RIST_L = 14 + WRIST_L = 14 + RIST_L = 14 # deprecated alias for WRIST_L (historical typo) WRIST_R = 15 WIELD = 16 HOLD = 17 diff --git a/test_area_reader.py b/test_area_reader.py index 679394f..7af54d3 100644 --- a/test_area_reader.py +++ b/test_area_reader.py @@ -39,6 +39,22 @@ def test_dice_roll_negative_sides_rolls_one_per_die(): assert area_reader.Dice(number=3, sides=-4, bonus=2).roll() == 5 +def test_forms_instant_decay_is_bit_d(): + from area_reader.constants import FORMS + + assert FORMS.INSTANT_DECAY.value == 8 + assert FORMS(8) is FORMS.INSTANT_DECAY + assert FORMS(12) == FORMS.MAGICAL | FORMS.INSTANT_DECAY + assert FORMS.OTHER.value == 16 + + +def test_wear_location_wrist_l_named_with_alias(): + from area_reader.constants import WEAR_LOCATIONS + + assert WEAR_LOCATIONS(14) is WEAR_LOCATIONS.WRIST_L + assert WEAR_LOCATIONS.RIST_L is WEAR_LOCATIONS.WRIST_L + + reset_command = st.sampled_from(["M", "O", "P", "G", "E", "D", "R"]) small_int = st.integers(min_value=0, max_value=9999) rom_source_dir = Path(r"C:\Users\Q\src\Rom24b6\area")