Skip to content

Track native GBA Lock-On ownership through residuals and switches - #217

Closed
Roxas2712 wants to merge 41 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/gen3-lock-on
Closed

Roxas2712 wants to merge 41 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/gen3-lock-on

Conversation

@Roxas2712

@Roxas2712 Roxas2712 commented Oct 25, 2026 •

Copy link
Copy Markdown

Native GBA Lock-On/Mind Reader currently stores a one-use pointer on the attacker. The actual native path owns a two-residual-phase binding on the target, including its originating side/slot. Consequently repeated checks, subsequent attacks and switching expose different accuracy-hook behavior.

Add target-owned native state shared by the ordinary accuracy and OHKO paths. Run the producer's Substitute/accuracy/Protect/semi-invulnerability checks in the observed order. Expire through real residual processing, clear owner bindings on replacement, preserve unrelated partners, drop normal target replacements and retain the existing explicit Baton Pass switch-entry transfer semantics. Both direct primary assignment and placed/forced replacements participate. Older games and authored legacy pointer consumers keep their previous behavior.

Native command revision 2 enters full GBA fingerprints; an explicit revision guard also prevents custom fingerprints from admitting different native rules. Matching party codecs can still negotiate shared trade data. Include owned duration/side/slot in active-state components, canonicalized across host/guest coordinates.

This stacks on #216. Gen1 is an unchanged read-only reference; no Gen1 publication or code changes.

Validation on clean feature 0905dcd005d102c33d31fad12d2082290d76f56c:

  • 556 focused checks pass: 492 lifecycle checks and 64 ownership/link checks, plus the existing native protocol suite.
  • 84 workers / 59,820 paired observations agree with unchanged Gen1 535a5ec088c1ae1bf4d91dd3e35a56f64cf46d91. All prior modes remain. New cases invoke actual move resolvers, repeated accuracy checks, residual sweeps and switch functions, retaining raw ownership, PP/HP, every bounded RNG call/value and public accuracy/damage/move-event calls.
  • New cases cover both moves, singles/doubles/all four slots, override policies, refresh/ownership transfer, owner/partner/target replacement, explicit Baton Pass switch entry, two real damaging hits, Protect, Substitute/zero state, semi-invulnerability and Fissure's level/Sturdy/guard paths.
  • Clean Preserve native GBA party genetics across trades and link battles #216 completes all 213 new FireRed rows but differs in 207 observations, failing 103 assertions. The complete failing output is retained.
  • Two complete seeded link mirrors aim on turn one, then attack; both marks retain one phase and expire together, with every completed paired turn hash/component agreeing.
  • Full ROM-free feature run: 102/111 engine suites, SDK 3/3 and B30 pass. The exact Counter of all 25 inherited FAIL lines across nine suites equals clean Preserve native GBA party genetics across trades and link battles #216 (100/109). Their separate repairs are in the combined fork.
  • Actual imported FireRed/Emerald records select canonical LOCK_ON through the shared public enemy-action consumer, execute two Tackle hits and two actual end-of-turn sweeps. Ownership, one accuracy-hook call, duration retention and expiry pass. CPU-only; controlled HP avoids KO. No ROM/cache assets or saves are distributed.
  • Scoped StyLua, actionlint and whitespace checks pass. The raw native fixture changes from 2fd444270c3d90db to cf73a8e083fb8a54, independently audited with the unchanged Preserve native GBA party genetics across trades and link battles #216 hasher and only the explicit command-revision token. Non-GBA goldens remain unchanged.

Scope: this establishes native Lock-On command/state/switch-entry contracts. The full Baton Pass move/UI chooser, other side/volatile producers, native egg legality, global RNG/VBlank scheduling and live UI/full-playthrough acceptance remain separate. The explicit Baton Pass switch entry is tested without claiming its whole chooser lifecycle. See docs/native-gen3-lock-on.md for reproducible commands and limits.

Combined fork acceptance: runtime 244d2367da28e6205611fc79c5fd16093315d451 passes 226/226 engine suites, SDK 3/3 and B30, with all 84 workers / 59,820 paired observations still equal and the actual imported-record smoke passing. Integration preserves the fork's existing GBA item/residual scheduler, ticking the new state in gen3BattlerCountersTick rather than restoring the old monolithic sweep. The documented snapshot is pushed as c5a58284a82276da4134a2d1cac6f17fa445d07d to Roxas2712/Gen2Recomped:codex/portability-testing. Fork main remains 13af468b.

All seven hosted workflows currently require maintainer approval (action_required). The dedicated contract run has zero jobs; local acceptance does not claim hosted execution. The app's 100-artifact cap prevented an additional attachment; the regular PR remains published and linked.

# Conflicts:
#	src/mods/Loader.lua
# Conflicts:
#	docs/modding.md
#	src/mods/Loader.lua
#	src/world/WorldAPI.lua
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant