Skip to content

Align ordinary native GBA multi-hit execution and RNG boundaries - #222

Closed
Roxas2712 wants to merge 61 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/gen3-multi-hit
Closed

Roxas2712 wants to merge 61 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/gen3-multi-hit

Conversation

@Roxas2712

@Roxas2712 Roxas2712 commented Oct 25, 2026 •

Copy link
Copy Markdown

Ordinary GBA multi-hit moves currently draw hit count before accuracy, reuse one damage calculation for all strikes and stop when Substitute breaks. Mods therefore observe different RNG calls, damage events and live continuation than the native reference. The underlying critical helper also exposes 1..denominator rather than native 0..denominator-1.

Correct ordinary native effects 29, 44 and 77: draw count after accuracy using the native two-stage 0..3 opcode, calculate each reached strike independently, continue against real HP after Substitute, and stop on actual Endure/sleep/faint/immunity conditions. Preserve explicit count/damage handlers, builtin delegation, called PP and the Sleep Talk caller boundary. Suppress Twineedle's native chance command after a later immunity. Keep scripted Beat Up's distinct eligibility and Endure continuation intact; older generations retain their existing policies.

Install generation-aware builtin adapters per dataset before mods capture public callbacks. Include native command revision 6 (party codec stays 1) so older peers cannot enter party exchange. Independently audit raw fixture da62fe7b50f40107 → a7db0874db78aec0 with the unchanged #220 hasher and only the revision token changed. No older-generation golden was reblessed.

Stacks on #220. This is the ordinary multi-hit prerequisite found during native Rage work; Rage itself remains a separate next change. Gen1 stays an unchanged read-only reference, without Gen1 development or publication.

Validation at clean feature runtime 00e67c40abcb224ff693e4f543a4d018014edf73 (later commit documents acceptance):

  • 17,974 focused checks pass: 17,856 native command/continuation, 68 public builtin composition/caller/legacy, 50 actual link/compatibility. Native protocol also passes.
  • Both clean feature and combined runtime match Gen1 535a5ec088c1ae1bf4d91dd3e35a56f64cf46d91 in 100 workers / 74,496 paired observations. The new mode contributes 5,760 observations per FireRed/Emerald profile, retaining every raw RNG bound/value, per-hit public event, all battler HP/PP/status/substitute HP/last move/stage. Covers all four slots/count words/critical stages, Substitute/Endure/Focus Band/KO, accuracy/Protect/hidden/type immunity, Twineedle chance, called PP and live sleep/type/faint changes.
  • Public events are detached views. Fixture continuation probes mutate their owned live battlers when events arrive and assert the changes; they do not claim event-view write-through.
  • Full feature: 119/128 engine suites, SDK 3/3, B30. The exact Counter of all 25 inherited FAIL lines across nine suites equals clean Implement native GBA Disable identity and queued move interruption #220 (116/125), without additions. The full command retains its nonzero exit.
  • Combined runtime 1a20cb1f104972c46c756ba6a55e814fc27619c8: 240/240 engine suites, SDK 3/3, B30 and the same full reference comparison. Existing Beat Up contracts remain green.
  • Unchanged Implement native GBA Disable identity and queued move interruption #220 fails 1,524 focused assertions of the exact accepted fixture. 5,088 of its 5,760 FireRed observations differ from unchanged Gen1; fixture SHA-256 matches the source report. Raw negative/exploratory outputs and the first integration's Beat Up regressions remain retained.
  • Two actual link roles complete three native turns (variable multi-hit, double-hit and Twineedle); every paired completed hash/component and learned-slot PP agrees. Revision 5 is refused before party selection.
  • 18 CPU-only scenarios with actual local FireRed/Emerald imports pass canonical public enemy-action selection and execution for DoubleSlap, Double Kick and Twineedle, each ordinary/with breaking Substitute/with Endure. Imported accuracy/type/power/PP are preserved with a controlled valid hit roll. No ROM/cache/save data is distributed or normal SAVE issued.
  • Scoped StyLua, actionlint and whitespace pass.

See docs/native-gen3-multi-hit.md for commands, mappings and scope. Triple Kick's dedicated accuracy/power script, Ruby/Sapphire move-end scheduling, full Sleep Talk selection/status controllers, complete ability interactions, Rage, whole-game RNG/VBlank, animations and full playthroughs remain separate. Existing prepared-input boundaries are retained; no differing observations or RNG calls are filtered from the checker.

The feature branch is pushed to Roxas2712/Gen2Recomped:codex/gen3-multi-hit. Combined fork publication and hosted CI are tracked separately from local acceptance.

Published combined snapshot: Roxas2712/Gen2Recomped:codex/portability-testing at fa3b8a6475af4ce418569bc0795c547456ffb0ec. Changes after the tested combined runtime only add validation/publication documentation. Fork main remains 13af468b97dc37015d14ad5c71d7f067c3ee810d.

All eight hosted workflows currently require maintainer approval (action_required). The dedicated contract run has zero jobs, verified separately; local acceptance does not claim hosted execution. The app's 100-artifact identity cap rejected attachment, but 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