Question about Save States and pre-determined moves/results
I'm currently playing a Pokemon Heartgold ROM and have run into something interesting that I've noticed for a while now. I've noticed that it seems the results of a certain move for a turn are determined before you ever even select that move. For example, if I were to use a move with a high hit-rate such as Ice Fang (95%) and it missed, then reload a save state from right before I used the move, it would miss again, and again, and again. I've tested this with a Raticate's Hyper Fang against a Girafarig in the route right above Mahogany town (before the Lake of Rage). Hyper Fang missed, and I continually loaded the Save State at least ten times, with it missing every time. Considering Hyper Fang has a 90% hit rate, it should never miss what would be ten times in a row.
The reason I find this so weird is that in previous generation games (at least Gen II and III since I haven't played Gen I on an emulator) the results would not be the same if I loaded a Save Point just before using a move. So I could use Hyper Fang and it may miss, but then I would load the Save State and it might hit that time, as it isn't determined until after the move is selected.
It also appears the result of the move is determined before the turn even begins, as I have tried also opening my bag, clicking on my pokemon inventory, and other things (that doesn't result in me losing a turn) after reloading the save and the results were always the same: Hyper Fang always missed.
I've also noticed this expands beyond just moves. For example, I would throw a pokeball and every time I loaded the Save State, the Pokemon would break out at the exact same time (one tick, two, none, whatever).
Now I'm not one to normally abuse this system that used to work in previous gens, but when I am trying to catch a pokemon I'll often use the Save States that way I don't have to carry and throw 80 Ultra balls on me, but rather just a few that I can use and then reuse if they fail the first time (some might call that abusing the system, but whatever).
It could always be the emulator though that resulted in this change (I'm using Desmume and obviously used VBA for gen III and before instead of Desmume) but I'm not certain. Either way, has anyone else experienced this? Also, does anyone know the exact moment the result of a move/item is determined? I haven't tested multiple turns to see if they result in the same thing (like a move missing the first turn, then a move landing a critical hit, then a move doing regular damage, then throwing a pokeball and it ticks just twice, then reloading to just before the first turn that resulted in a miss and seeing if the results of all the moves remain the same) so for all I know the results could be determined at the beginning of the fight, or for all I know every result in the game could've been determined way back when I first selected my pokemon. Although most likely the various results are determined before every individual turn begins.