Skip to content

Align native GBA accuracy and post-hit chance commands - #215

Closed
Roxas2712 wants to merge 39 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/gen3-native-accuracy
Closed

Roxas2712 wants to merge 39 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/gen3-native-accuracy

Conversation

@Roxas2712

@Roxas2712 Roxas2712 commented Oct 25, 2026 •

Copy link
Copy Markdown

The native GBA battle path still uses the older byte accuracy/secondary model. This changes bounded RNG consumption, accuracy-stage arithmetic and public hook behavior; Thunder draws its post-hit chance in 0..255 rather than the native 0..99.

Add private native accuracy and secondary commands for GBA while preserving older-game behavior. Accuracy covers combined stages, ability/item floors, all-slot weather suppression, Protect/semi-invulnerability, native guaranteed-hit guards, absorption and the public battle.accuracy context. The ordinary secondary family shares native draw ordering, inclusive chance boundaries (including explicit zero), Serene Grace and effect-level guards. Authored effect handlers retain their policies. Real special Fire hits thaw after secondary processing; Substitute hits do not.

Preserve native strong-poison identity through API-3 reads/callback edits, battle construction, save serialization and party transport using the existing PSN plus boolean toxic marker. Bound callback edits update the owning toxic counter transactionally.

This stacks on #214 and its prerequisites. The Gen1 reference remains unchanged and read-only.

Validation on clean feature a6205dfce1b6d091e758238447db3b25462367f4:

  • 15,082 accuracy + 53,598 secondary + 156 protocol checks pass (68,836 total).
  • All 72 workers / 48,524 paired observations match unchanged reference 535a5ec088c1ae1bf4d91dd3e35a56f64cf46d91. The checker executes the actual reference commands and both move resolvers; every bounded RNG call/value, callback context, PP/HP/stage result and status event is retained.
  • Full ROM-free run: 98/107 engine suites, SDK 3/3 and B30 pass. The exact Counter of all 25 inherited FAIL lines across nine suites equals clean Create native Gen-3 preset parties with consistent identities #214 (95/104). The combined fork already carries their separate repairs.
  • Clean pre-secondary 184fdaaa retains 56 differing Thunder execution observations in the negative control; failing reports are preserved.
  • A CPU-only smoke runs imported Thunder through the public enemy-action/status-event path using actual local FireRed/Emerald records. Both profiles hit and apply paralysis using native ranges. No imported data/assets/saves are committed.
  • Scoped StyLua, actionlint and whitespace checks pass.

Link compatibility: add native GBA command revision 1 and hash native move index/effect, secondary chance, target, flags and Protect eligibility. Cache keys include runtime revision. Non-GBA fixture digests stay unchanged; no golden is reblessed. The audited raw GBA fixture changes from e33d251961f2a41d to 3a76cc5fce47a5c3. Actual handshake/controller tests stop older peers before battle, cover both roles and field mutations, and complete two seeded synthetic link mirrors with matching turn hashes/components and toxic markers.

Scope: this establishes command, hook and toxic-marker contracts. Full cartridge genetics transport, timed Lock-On/side/volatile producers, whole-game RNG/VBlank scheduling and demo controller playback remain separate. CPU fixtures do not certify live rendering or a full playthrough. See docs/native-gen3-hit-commands.md for reproducible commands and limits.

Combined fork acceptance: runtime 4a2f0d15de9820e897f6dfe895e204b3737a15d6 passes 222/222 engine suites, SDK 3/3 and B30. Its clean checkout also matches all 72 workers / 48,524 paired observations, and the actual imported FireRed/Emerald Thunder smoke passes on that runtime. The documented snapshot is pushed as f398caec15f2c8547a15c3928298f99ce2036057 to Roxas2712/Gen2Recomped:codex/portability-testing. Fork main stays at 13af468b.

All seven hosted workflows require maintainer approval (action_required). The dedicated contract run has zero jobs; local green acceptance does not claim hosted execution. The app's 100-artifact limit prevented an additional PR attachment; the regular PR is 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