View Full Version : D/P/Pt Battle RNG research
Jul 16th, 2010, 10:26 PM
I am a TAS speedrunner looking to try and complete D/P/Pt games as fast as possible, but would like some info on what RAM addresses to look at regarding the battle RNGs of the games - stuff related to critical hits, accuracy of attacks, Quick Claw activation, and so on. The notable breakpoints page mentions a lot of invaluable addresses to look at, but almost nothing on the battle system at all. Any help would be appreciated in this area.
Thanks in advance
Apr 16th, 2011, 11:58 PM
I remember a long time ago when I was poking around in RAM I found a value that effected "hax" in battles. Freezing it at 0 caused everything to always fail baring moves with 100% accuracy from landing, and setting it to 0xFFFFFFFF caused everything that could happen to happen.
I didn't save the offset, but I can try to look for it again.
Apr 17th, 2011, 12:13 AM
Super old bump there Kazo ;)
The Battle RNG calculations probably carried over from gen 3, which you can see at TASVideos by FractalFusion (http://tasvideos.org/GameResources/GBx/Pokemon/RNG.html).
In battle: Accuracy
The game determines attack accuracy right before it says "X used attack", if the attack does damage. If the attack does not do damage, the game determines it after it says "X used attack".
When the game rolls for attack accuracy, the game will cycle the RNG 3 times on that frame.
aaaaxxxx Attack hit: aaaa mod 100 < acc% otherwise miss
In battle: Critical hits
The game determines critical hits a few frames after the message "X used attack", provided that the attack does damage, and the attack did not miss, and it is not a tutorial battle where the game forbids critical hits.
When the game rolls for critical hits, the game will cycle the RNG 3 times on that frame.
xxxaxxxx Critical hit: a==0
This assumes a 1/16 chance of a critical hit. It does not describe situations where the critical hit ratio is raised to be greater than 1/16, or the target has the ability Battle Armor (no critical hits).
In battle: Damage variation
For almost all attacks, the amount of damage that an attack does varies between about 85% and 100%. The game determines damage variation three frames after it checks for critical hit.
When the game rolls for damage variation, the game will cycle the RNG 3 times on that frame.
xxxaxxxx Damage variation, max: a==0 min: a==15
The lower the number, the more damage the attack does.
It is not known for certain if 0000 is the only value that does max damage (a property in the first two generations where only the "best" value yields max damage).
Gen 3 used the main LCRNG for the battle determinations, and iirc so did gen 4.
Gen 5 uses a new seed generated when the battle scene is loaded (after the flash), so it'd be much harder to cheat with.
%100 and *100 respectively for accuracy, %16 and *16 for everything not a multiple of 5%.
Apr 17th, 2011, 01:38 PM
Super old bump there Kazo ;)
oops sorry, should have paid attention to the date.
Powered by vBulletin™ Version 4.0.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.