From 84fb0fc62c317d1c7d5925dd8c62d89dd941f1db Mon Sep 17 00:00:00 2001 From: gamer147 Date: Wed, 22 Jul 2026 22:46:21 -0400 Subject: [PATCH] Map EB roster events and critical chance --- docs/global-reference.md | 16 ++++++------ docs/name-resolution.md | 15 +++++++++++ docs/phase-b-framework.md | 9 ++++--- vm-map/globals.toml | 54 +++++++++++++++++++++++++++++++++++++-- 4 files changed, 81 insertions(+), 13 deletions(-) diff --git a/docs/global-reference.md b/docs/global-reference.md index 2155f91..05791da 100644 --- a/docs/global-reference.md +++ b/docs/global-reference.md @@ -1,7 +1,7 @@ # Global Variable Reference (generated) -5023 globals (139 curated, 4884 auto shape-inferred). Source of truth: `vm-map/globals.toml`. +5023 globals (144 curated, 4879 auto shape-inferred). Source of truth: `vm-map/globals.toml`. ## choice-output @@ -43,6 +43,11 @@ | `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. | | `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. | +| `0x73236` | unit_sally_action_unlock_requirements | high | investigation | Availability requirements for SALLY's first four per-unit actions. While constructing the action mask, SALLY keeps a positive entry only when flag_bank[value - 1] equals 1, keeps -1 as unconditional, and clears an action whose entry is zero. The table covers the seven principal recruitable heroines plus 29 summonable archetypes. | +| `0x741d6` | unit_sally_event_ids | high | investigation | Eight-slot event table for SALLY's unit actions. A populated slot is copied to scjump_decision_out and translated through the SCJUMP resource table at 0x87a57 into next_script_resource_id, handing control to the corresponding scene. Principal heroines populate all eight actions; other eligible units populate the three form-dependent event slots. EXILE also tests slot 7 when deciding whether a unit can be released. | +| `0x76116` | unit_roster_variant_ids | high | investigation | Roster-form mapping for 36 recruitable units. Column 0 maps the summonable archetypes and principal heroines to their normal unit id; column 1 maps seven heroines to EBINIT ids 21..27, whose names explicitly identify their brainwashed states. SALLY replaces the selected party unit with the action-selected form, and UNITECH recruitment modes 3/4 select the same two columns. | +| `0x768e6` | unit_sex_magic_bonus_item_id | high | investigation | Item awarded by SALLY after the three form-dependent intimate-event actions for 22 eligible units. SALLY passes the value directly to USEITEM and then displays the selected character name followed by the literal message 'sex magic bonus' and the resolved item description. Principal heroines yield planetary stones; the remaining rows resolve to recovery items and rare materials. | | `0x76cce` | unit_essence_yield | high | investigation | Essence returned by SALLY's unit-conversion/release actions for 187 units. The normal path adds this value to current essence and the special path adds five times it, clamps to the essence cap, then applies the corresponding alignment adjustment; it is distinct from unit_deployment_cost_base. | | `0x770b6` | unit_summon_unlock_flag_index | high | investigation | Summoning-stone/unlock flag index for the 29 recruitable monster archetypes. SUMMON and SALLY subtract one and test the corresponding cell in the shared flag bank at 0x6d3 before listing or advancing the unit; GAMESTART uses presence of this mapping when restoring party slots. | | `0x7749e` | unit_summon_knowledge_threshold | high | investigation | Per-archetype familiarity threshold for 19 summonable units. SUMMON divides accumulated progress by it for the displayed percentage and treats zero-threshold units as limited to one copy; SALLY awards the corresponding summoning item and 'deepened understanding' message when accumulated progress reaches the threshold. | @@ -75,7 +80,7 @@ | `0x906f9` | item_status_delta_levels | high | investigation | Sparse ITINIT row-major table consumed by USEITEM and CALCILL when applying an item's effects. Positive values inflict or drain; -5 removes a condition (for example paralysis-removal item 108 stores -5 in column 8). Confirmed columns are 2 HP drain, 3 SP drain, 4 FS drain, 5 curse, 6 charm, 7 confusion, 8 paralysis, 9 poison, 10 water-flow, and 11 fear. | | `0x97c29` | item_equipped_status_levels | high | investigation | Sparse ITINIT row-major table added to a unit's 30-column condition state by CALCREVISE. Item descriptions identify populated columns 9 poison, 11 fear, 13 regeneration, and 14 exaltation; these are passive equipped effects, distinct from item_status_delta_levels. | | `0x9f159` | item_granted_skill_id | high | investigation | Populated for 85 equipment items. Values cross-resolve to SKINIT (for example flying bracelet=1 Flying, transfer bracelet=21 Transfer, thief key=22 Lockpick, ropes=156 Capture Attack); CALCREVISE applies the linked skill and UI scripts display it. | -| `0x9f541` | item_stat_modifiers | high | investigation | ITINIT row-major equipment modifiers added directly to the unit's 14-column stat record by CALCREVISE. Descriptions and consumers establish columns 0 accuracy, 1 evasion, 2 physical attack, 3 physical defense, 4 magic attack, 5 magic defense, 6 speed, 7 luck, 9 capture power, 10 movement, 11 max HP, 12 max SP, and 13 max FS; column 8 remains unnamed. | +| `0x9f541` | item_stat_modifiers | high | investigation | ITINIT row-major equipment modifiers added directly to the unit's 14-column stat record by CALCREVISE. Descriptions and consumers establish columns 0 accuracy, 1 evasion, 2 physical attack, 3 physical defense, 4 magic attack, 5 magic defense, 6 speed, 7 luck, 8 critical chance, 9 capture power, 10 movement, 11 max HP, 12 max SP, and 13 max FS. CALCBTPARAM adds columns 7 and 8 into the action's critical percentage, and CALCDMG compares the clamped result with a random-modulo-100 roll. | | `0xa2bf1` | item_tuning_curve_ids | high | investigation | ITINIT row-major table selecting an equipment-growth curve for each of the ten tunable fields. TUNE, IMPROVE, DRAWTIP, and CALCREVISE combine each nonzero curve id with the item's corresponding tuning level and index the shared curve-value table at 0xab6fa. Columns align with item_stat_modifiers columns 0..9. | | `0xa5301` | item_resource_recovery_amounts | high | investigation | Sparse ITINIT row-major consumable table. USEITEM applies columns 0, 1, and 2 to the matching three-column unit resource record; descriptions prove these are HP, SP, and FS respectively (for example item 101 stores HP 30, and item 107 stores 999/99/99 for full recovery). | | `0xa62a1` | item_essence_recovery_amount | high | investigation | Sparse ITINIT consumable field. Item 106, Blood Price Healing Hand, describes essence recovery 50 and stores 50 here; USEITEM follows the dedicated essence-recovery path and scales the value before updating the selected unit. | @@ -88,7 +93,7 @@ | `0xa7436` | skill_attack_element | high | investigation | Populated for 60 elemental attacks and spells. Values match the Japanese descriptions and the same eight-value attack-element enum used by item_attack_element; CALCSCOPE, CALCBTPARAM, and SELACT consume it. | | `0xa7562` | skill_status_levels | high | investigation | Sparse SKINIT row-major condition table consumed by CALCILL when applying a skill's effects to the target unit. Skill names and descriptions identify columns 1 instant death, 6 charm, 7 confusion, 8 paralysis, 9 poison, 10 water-flow, and 11 fear; the column layout matches item_status_delta_levels. | | `0xa988a` | skill_icon_id | high | investigation | SKINIT icon id for all 131 skills. CHMENU and INFOIT translate it into the shared icon atlas; the six ids group movement, defense, utility, passive, physical-special, and magic icons. | -| `0xa99b6` | skill_combat_stat_deltas | high | investigation | Sparse SKINIT row-major table applied by CALCBTPARAM for the selected action. Descriptions directly establish columns 0 accuracy, 2 physical attack, 3 physical defense, 4 magic attack, and 9 capture power; columns 1, 5, 6, and 8 share the unit combat-stat layout but need final display-name confirmation. | +| `0xa99b6` | skill_combat_stat_deltas | high | investigation | Sparse SKINIT row-major table applied by CALCBTPARAM for the selected action. Descriptions and combat consumers establish columns 0 accuracy, 1 evasion, 2 physical attack, 3 physical defense, 4 magic attack, 5 magic defense, 6 speed, 7 luck, 8 critical chance, and 9 capture power. Column 7 is unpopulated in shipped SKINIT; CALCBTPARAM adds any luck and critical modifiers into the critical percentage that CALCDMG rolls after the hit check. | | `0xaa56e` | skill_resource_deltas | high | investigation | Sparse SKINIT resource table used throughout skill selection and resolution. Column 0 is HP recovery for the three healing spells; column 1 is the negative SP cost for all 95 active skills, exactly matching each description. Column 2 is unpopulated in the shipped table. | | `0xaa8f2` | skill_proc_chance_percent | high | investigation | Probability for 14 passive skills. CALCDMG compares random-modulo 100 against this value; examples include Re-action 20, Double Action 100, Counter 10, and Resurrection 50. | | `0xaaa1e` | skill_battle_animation_id | high | investigation | Populated for 101 combat skills. BTL and CALCDMG place this value in the battle-animation selector before calling BTANINIT; most skills reuse their own id, while related skills deliberately share an animation and passive reactions use ids 801..808. | @@ -4978,11 +4983,6 @@ | `0x6638b` | — | med | auto-shape | record-table[stride 15] | | `0x66713` | — | low | auto-shape | index/counter? | | `0x66715` | — | med | auto-shape | current-entity-index? | -| `0x72e4e` | — | low | auto-shape | unit-field? | -| `0x73236` | — | med | auto-shape | record-table[stride 4] | -| `0x741d6` | — | med | auto-shape | record-table[stride 8] | -| `0x76116` | — | med | auto-shape | record-table[stride 2] | -| `0x768e6` | — | low | auto-shape | unit-field? | | `0x7843e` | — | med | auto-shape | unit-field | | `0x81c96` | — | med | auto-shape | record-table[stride 3] | | `0x8284e` | — | med | auto-shape | record-table[stride 3] | diff --git a/docs/name-resolution.md b/docs/name-resolution.md index 856d0f6..f778695 100644 --- a/docs/name-resolution.md +++ b/docs/name-resolution.md @@ -200,6 +200,21 @@ medium-confidence: every nonzero row is a boss, hazard, or special encounter and such, but the positive/negative class distinction remains unknown. 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 +requirement table gates actions against the shared flag bank; and an eight-column event table feeds +`scjump_decision_out` before SCJUMP resolves the next script. A two-column unit-id table selects normal and +explicitly named brainwashed variants, while the final item-id field is passed to USEITEM under SALLY's +literal “sex magic bonus” message. This is roster and event routing data rather than enemy AI. The adjacent +`0x7843e` enum remains unnamed because no non-EBINIT script references it, directly or through a detected +table operation. + +The same consumer trace closes the last unnamed item/skill combat-stat column. CALCBTPARAM adds stat column +7 (luck) and column 8 into a clamped percentage; CALCDMG compares it with `random-modulo 100` immediately +after the hit check and selects the critical-result state on success. Column 8 is therefore critical chance +for both `item_stat_modifiers` and `skill_combat_stat_deltas`; the skill descriptions and matching item +columns also confirm evasion, magic defense, and speed. + ### The curated registry — `vm-map/globals.toml` (2026-07-07) The v1 auto map (`build/global-var-map.json`) infers *shapes* but cannot recover branch-flag diff --git a/docs/phase-b-framework.md b/docs/phase-b-framework.md index 31b60fe..36ed888 100644 --- a/docs/phase-b-framework.md +++ b/docs/phase-b-framework.md @@ -724,9 +724,12 @@ SKINIT contributes skill category/order/icon/handler, encoded range, element, st proc chance, and battle animation. EBINIT now contributes unit order/icon, sex and provisional species, elements, attacks/equipment/skills, level/cost/base/growth data, canonical variants, CP/CA/CB/CS/cut-in and voice assets, XP/drops, capture and compendium flags, summoning economy, essence yield, and level scaling. -Its linked-table shapes are 18 SKINIT and 84 EBINIT populated columns. Next work should resolve the remaining -condition/stat columns and EBINIT's AI, route/evolution, and sparse-flag tables; STINIT's bespoke parser -remains a separate extraction task. +Its linked-table shapes are 18 SKINIT and 84 EBINIT populated columns. The next EB tranche identifies roster +state flags, per-action unlock requirements, SCJUMP event ids, normal/brainwashed unit variants, and SALLY's +per-unit bonus item. Combat tracing also names the shared column-8 item/skill modifier as critical chance. +The remaining EBINIT unknowns are now the unread `0x7843e` enum and the signed meaning within boss classes; +enemy AI appears to live outside the static EBINIT schema. STINIT's bespoke parser remains a separate +extraction task. Once the natural spine and first gameplay loop are trustworthy, broaden in independent tracks: diff --git a/vm-map/globals.toml b/vm-map/globals.toml index 2b36939..220b8f6 100644 --- a/vm-map/globals.toml +++ b/vm-map/globals.toml @@ -162,7 +162,7 @@ name = "item_stat_modifiers" category = "data-table" type = "int[1000][14]" value_domain = "signed additive stat values; observed -15..200" -usage = "ITINIT row-major equipment modifiers added directly to the unit's 14-column stat record by CALCREVISE. Descriptions and consumers establish columns 0 accuracy, 1 evasion, 2 physical attack, 3 physical defense, 4 magic attack, 5 magic defense, 6 speed, 7 luck, 9 capture power, 10 movement, 11 max HP, 12 max SP, and 13 max FS; column 8 remains unnamed." +usage = "ITINIT row-major equipment modifiers added directly to the unit's 14-column stat record by CALCREVISE. Descriptions and consumers establish columns 0 accuracy, 1 evasion, 2 physical attack, 3 physical defense, 4 magic attack, 5 magic defense, 6 speed, 7 luck, 8 critical chance, 9 capture power, 10 movement, 11 max HP, 12 max SP, and 13 max FS. CALCBTPARAM adds columns 7 and 8 into the action's critical percentage, and CALCDMG compares the clamped result with a random-modulo-100 roll." source = "investigation" confidence = "high" @@ -272,7 +272,7 @@ name = "skill_combat_stat_deltas" category = "data-table" type = "int[300][10]" value_domain = "signed combat parameter deltas; observed -99..999" -usage = "Sparse SKINIT row-major table applied by CALCBTPARAM for the selected action. Descriptions directly establish columns 0 accuracy, 2 physical attack, 3 physical defense, 4 magic attack, and 9 capture power; columns 1, 5, 6, and 8 share the unit combat-stat layout but need final display-name confirmation." +usage = "Sparse SKINIT row-major table applied by CALCBTPARAM for the selected action. Descriptions and combat consumers establish columns 0 accuracy, 1 evasion, 2 physical attack, 3 physical defense, 4 magic attack, 5 magic defense, 6 speed, 7 luck, 8 critical chance, and 9 capture power. Column 7 is unpopulated in shipped SKINIT; CALCBTPARAM adds any luck and critical modifiers into the critical percentage that CALCDMG rolls after the hit check." source = "investigation" confidence = "high" @@ -416,6 +416,56 @@ usage = "Capture eligibility for 74 ordinary enemy archetypes. SELACT and FIELD source = "investigation" confidence = "high" +[[global]] +address = "0x72e4e" +name = "unit_roster_state_flag_base_index" +category = "data-table" +type = "int[1000]" +value_domain = "relative index 921..951 into the persistent flag bank at 0x6d3; four consecutive flags per mapped unit" +usage = "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." +source = "investigation" +confidence = "high" + +[[global]] +address = "0x73236" +name = "unit_sally_action_unlock_requirements" +category = "data-table" +type = "int[1000][4]" +value_domain = "-1 means unconditional, 0 means unavailable, positive values 1744..1915 are one-based indices into the flag bank at 0x6d3" +usage = "Availability requirements for SALLY's first four per-unit actions. While constructing the action mask, SALLY keeps a positive entry only when flag_bank[value - 1] equals 1, keeps -1 as unconditional, and clears an action whose entry is zero. The table covers the seven principal recruitable heroines plus 29 summonable archetypes." +source = "investigation" +confidence = "high" + +[[global]] +address = "0x741d6" +name = "unit_sally_event_ids" +category = "data-table" +type = "int[1000][8]" +value_domain = "SCJUMP event/decision ids 1200..1366; zero means no scripted event for that action" +usage = "Eight-slot event table for SALLY's unit actions. A populated slot is copied to scjump_decision_out and translated through the SCJUMP resource table at 0x87a57 into next_script_resource_id, handing control to the corresponding scene. Principal heroines populate all eight actions; other eligible units populate the three form-dependent event slots. EXILE also tests slot 7 when deciding whether a unit can be released." +source = "investigation" +confidence = "high" + +[[global]] +address = "0x76116" +name = "unit_roster_variant_ids" +category = "data-table" +type = "int[1000][2]" +value_domain = "EBINIT unit ids; column 0 normal/recruitable form, column 1 brainwashed heroine form" +usage = "Roster-form mapping for 36 recruitable units. Column 0 maps the summonable archetypes and principal heroines to their normal unit id; column 1 maps seven heroines to EBINIT ids 21..27, whose names explicitly identify their brainwashed states. SALLY replaces the selected party unit with the action-selected form, and UNITECH recruitment modes 3/4 select the same two columns." +source = "investigation" +confidence = "high" + +[[global]] +address = "0x768e6" +name = "unit_sex_magic_bonus_item_id" +category = "data-table" +type = "int[1000]" +value_domain = "ITINIT item ids 101..710" +usage = "Item awarded by SALLY after the three form-dependent intimate-event actions for 22 eligible units. SALLY passes the value directly to USEITEM and then displays the selected character name followed by the literal message 'sex magic bonus' and the resolved item description. Principal heroines yield planetary stones; the remaining rows resolve to recovery items and rare materials." +source = "investigation" +confidence = "high" + [[global]] address = "0x76cce" name = "unit_essence_yield"