From 6b808c33e34b1b0dc45d45660a6e4da6627be78f Mon Sep 17 00:00:00 2001 From: gamer147 Date: Thu, 23 Jul 2026 12:02:23 -0400 Subject: [PATCH] Decode EBINIT signed boss classes --- docs/global-reference.md | 2 +- docs/name-resolution.md | 17 +++++++++++++---- docs/phase-b-framework.md | 8 ++++++-- tools/test_extract_init.py | 11 +++++++++++ vm-map/globals.toml | 4 ++-- 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/docs/global-reference.md b/docs/global-reference.md index 5a78961..8016364 100644 --- a/docs/global-reference.md +++ b/docs/global-reference.md @@ -46,7 +46,7 @@ | `0x716de` | unit_icon_id | high | investigation | EBINIT icon selector populated for all 277 units. READICON returns it for unit ids; CHMENU, DRAWCHP, EXILE, SALLY, and SUMMON convert the value into icon-atlas page and cell coordinates. | | `0x71ac6` | unit_species_category | med | investigation | Broad EBINIT species/allegiance category for 198 units: value 1 covers humans and allied heroines, 2 covers demons including Emilio and Lily as well as many demonic monsters, and 3 covers other monsters, dragons, and elementals. CHMENU uses it for equipment restrictions, CALCDMG for category-sensitive effects, and INFOCH/INFOEN for display. | | `0x71eae` | unit_sex_category | high | investigation | EBINIT sex category for 251 units. Named character records establish the three values; CHMENU tests it against item_sex_restriction_mask, while INFOCH and INFOEN use the same category in unit presentation. | -| `0x72296` | unit_boss_class | med | investigation | Nonzero only for 112 bosses, special encounters, and map hazards. CALCDMG grants the boss adjustment, CALCILL uses it for condition immunity, and FIELD/MAGIC/USEMAGIC use it in special-unit targeting rules. Magnitude tracks increasing boss class; the distinction between positive and negative classes remains unresolved. | +| `0x72296` | unit_boss_class | med | investigation | Nonzero for 112 bosses, special encounters, summoned adds, and map hazards. CALCDMG grants every nonzero class the boss adjustment, CALCILL grants condition immunity, and FIELD/MAGIC/USEMAGIC exclude nonzero classes from ordinary-unit rules. On stages whose clear rule is defeat-boss targets, FIELD blocks victory only while a positive-class enemy remains; negative peers keep boss treatment but are ignored, as with Octavia beside Bridget, Deirdre's shadows, EX-8 adds beside Tiamat, and the final boss's three organs. Classes 1..3 are otherwise authoring categories with no distinct shipped-script branch. Either sign of class 4 selects the final-boss battle BGM and special tactical-map presentation. | | `0x7267e` | unit_canonical_id | high | investigation | Maps 106 alternate, boss, brainwashed, EX, and enemy variants back to their canonical character or recruitable archetype. For example all Estelle bosses map to 12, brainwashed Sylphine maps to 5, and ordinary/EX orcs map to recruitable orc 52. Setup, menus, inventory, dismissal, and combat normalize through this id. | | `0x72a66` | unit_capturable | high | investigation | Capture eligibility for 74 ordinary enemy archetypes. SELACT and FIELD allow the capture skill only when this flag is nonzero and the acting unit's capture power meets the target-level check; successful resolution displays the explicit 'Captured the enemy' message. | | `0x72e4e` | unit_roster_state_flag_base_index | high | investigation | Persistent roster-state block for seven recruitable heroines. SALLY's first three unit actions mark offsets 1, 2, and 0 respectively; UNITECH marks the offset selected by its recruitment mode; DELCH, REMOVECH, SALLY, and EXILE mark offset 3 when the unit is removed or released. The values are relative indices into the shared flag bank, not absolute global addresses. | diff --git a/docs/name-resolution.md b/docs/name-resolution.md index e6749fa..a6b255f 100644 --- a/docs/name-resolution.md +++ b/docs/name-resolution.md @@ -195,10 +195,19 @@ figures, CS status illustrations, CIC/CIN battle cut-ins, and a 30-slot OGG voic base experience, eight item-drop ids, and their paired percentage rolls; INFOEN independently renders the same drop-item ids. Third, explicit menu messages and state updates identify capture eligibility, enemy-info listing, summon unlock indices/knowledge thresholds/point costs, essence yield, automatic enemy level -scaling, and the large-battle-sprite layout flag. The signed `unit_boss_class` is intentionally only -medium-confidence: every nonzero row is a boss, hazard, or special encounter and all consumers treat it as -such, but the positive/negative class distinction remains unknown. AI and the remaining sparse flags stay -unnamed until comparable consumer evidence exists. +scaling, and the large-battle-sprite layout flag. The signed `unit_boss_class` remains medium-confidence as +an authoring vocabulary, but its runtime split is now concrete. Every nonzero value receives the shared +boss damage adjustment, condition immunity, targeting exclusions, and boss battle treatment. FIELD's +`stage_clear_rule == -2` path scans only living enemy units whose class is positive, so a positive class is +a required defeat-boss target while the matching negative class is a boss-treated add, decoy, or hazard +that does not delay victory. STINIT confirms the distinction in the same encounters: Bridget is positive +while Octavia and the boss orc are negative in stage 11; Deirdre is positive while her four shadows and +Laumakar are negative in stages 92/98; Tiamat is positive while the EX-8 boss roster is negative in stage +167; and the final heart is positive class 4 while its three organs are negative class 4. Absolute classes +1, 2, and 3 group named story characters, monster/special bosses, and demon-lord-class bosses respectively, +but the shipped scripts do not branch differently among those three values. Either sign of class 4 alone +selects the final-boss BGM and FIELD's special tactical-map presentation. AI and the remaining sparse flags +stay unnamed until comparable consumer evidence exists. The roster/event follow-up resolves five more EBINIT tables through SALLY's complete action path. A four-cell persistent-state block records recruitment/removal outcomes for seven heroines; a four-column diff --git a/docs/phase-b-framework.md b/docs/phase-b-framework.md index 929bfc5..2b9762f 100644 --- a/docs/phase-b-framework.md +++ b/docs/phase-b-framework.md @@ -745,8 +745,12 @@ SKINIT parallel field as the skill-change catalog inclusion flag and separates a skill-information visibility. The remaining item/skill work is refinement rather than an unnamed populated schema. -The remaining EBINIT unknowns are two isolated sparse writes into a runtime table and the signed refinement -within boss classes; enemy AI appears to live outside the static EBINIT schema. The former seven-value +The remaining EBINIT unknowns are two isolated sparse writes into a runtime table; enemy AI appears to live +outside the static EBINIT schema. The signed boss class is now behaviorally separated: all nonzero values +receive boss protections and targeting treatment, positive values alone count as required targets under +FIELD's defeat-boss clear rule, negative values are boss-treated adds/decoys/hazards that do not block +victory, and either sign of class 4 selects final-boss music and tactical-map presentation. Classes 1--3 +otherwise remain authoring categories rather than distinct runtime branches. The former seven-value `0x7843e` unknown is now a medium-confidence authoring-only `unit_power_tier`: it tracks unit cost, yield, caps, stats, and form/story strength but has no shipped script or native-index consumer. SALLY's four unlock requirements and eight event ids are fully joined to their contract, brainwash, reserved, form-dependent diff --git a/tools/test_extract_init.py b/tools/test_extract_init.py index 6f9d039..95fa5a3 100644 --- a/tools/test_extract_init.py +++ b/tools/test_extract_init.py @@ -346,6 +346,10 @@ def test_field_semantics() -> None: unit_semantics["0x7843e"] == "unit_power_tier", "EBINIT's authoring-only power tier joins by semantic name", ) + check( + unit_semantics["0x72296"] == "unit_boss_class", + "EBINIT's signed boss class joins by semantic name", + ) extract_init.attach_semantic_fields(units, unit_semantics) unit_by_id = {record["id"]: record for record in units} check( @@ -363,6 +367,13 @@ def test_field_semantics() -> None: ] == [2, 4, 6], "Lily's three forms preserve the correlated 2/4/6 power tiers", ) + check( + [ + unit_by_id[unit_id]["semantic_fields"]["unit_boss_class"] + for unit_id in (110, 115, 755, 756) + ] == [1, -1, 4, -4], + "paired story and final-boss records preserve victory-target sign", + ) stages, meta = extract_init.extract_mixed( sys4load.load(extract_init.resolve("STINIT")) diff --git a/vm-map/globals.toml b/vm-map/globals.toml index e45f79e..8764d8f 100644 --- a/vm-map/globals.toml +++ b/vm-map/globals.toml @@ -455,8 +455,8 @@ address = "0x72296" name = "unit_boss_class" category = "data-table" type = "int[1000]" -value_domain = "signed special/boss class -4..4; zero means ordinary unit" -usage = "Nonzero only for 112 bosses, special encounters, and map hazards. CALCDMG grants the boss adjustment, CALCILL uses it for condition immunity, and FIELD/MAGIC/USEMAGIC use it in special-unit targeting rules. Magnitude tracks increasing boss class; the distinction between positive and negative classes remains unresolved." +value_domain = "0=ordinary; signed boss class ±1..±4: 1=named/story character, 2=monster/special encounter, 3=demon-lord class, 4=final boss; positive values are defeat-boss victory targets and negative values are exempt" +usage = "Nonzero for 112 bosses, special encounters, summoned adds, and map hazards. CALCDMG grants every nonzero class the boss adjustment, CALCILL grants condition immunity, and FIELD/MAGIC/USEMAGIC exclude nonzero classes from ordinary-unit rules. On stages whose clear rule is defeat-boss targets, FIELD blocks victory only while a positive-class enemy remains; negative peers keep boss treatment but are ignored, as with Octavia beside Bridget, Deirdre's shadows, EX-8 adds beside Tiamat, and the final boss's three organs. Classes 1..3 are otherwise authoring categories with no distinct shipped-script branch. Either sign of class 4 selects the final-boss battle BGM and special tactical-map presentation." source = "investigation" confidence = "med"