Deokishisu
Mr. Magius
- 993
- Posts
- 19
- Years
- If I'm online, it's a safe bet I'm at a computer.
- Seen Apr 27, 2025
The routine that determines if the AI will switch is located at 08039C84, with the actual thinking happening at 08039A80. I have no idea how it works.
The routine that determines if the AI will use an item is located at 0803A1F4. It will identify the type of item at 0803A198:(see https://www.pokecommunity.com/posts/6745155/ for more info on battle items).Code:1 full restore 2 heal hp 3 restore status 4 increase stat 5 guard spec 6 other
Then, it will run checks based on the type of item - 1 (see the jump table at 0803A304). For example, it will use a full restore if the hp of the poke is less than 25% of its max hp.
If anyone wants to analyse those routines further, please do.
I find it interesting that the AI will attempt to use a Revival Herb (fruitlessly) if given one. Which check do you suppose allows for this? I would assume it's either heal hp, restore status, or other. It'd be interesting to see the logic that the game goes through to select a Revival Herb to use, with the obvious end goal being hacking the AI or battle scripts so that Revive-like items actually function for computer opponents. But damn, will that functionality be a nightmare for players when used by the wrong hackers.