>>44854532Have the AI calculate damage.
Whichever offensive move would do the most damage, use it.
The AI calculates the strongest possible move that the player could be using, given the level and point in the game the AI is. I don't want the AI to actually read the player's moves because that would be a bit cheap. Maybe on hard mode.
If the player's mon can OHKO the AI's, the AI switches to the mon that would take the least damage from the strongest possible move.
If there's boosting moves, calculate if boosting and attacking would do more damage than just attacking twice).
If the player outspeeds the AI, the AI calculates if a speed boosting move will allow it to outspeed the player and then uses it.
If the AI has a defense boosting move and is faster than the player, it calculates if the player can do more than half damage to the AI. If not, then the AI uses the defense boosting move.
If the AI has a defense boosting move and is slower than the player, it calculates if the player can do more than a third damage to the AI. If not, then the AI uses the defense boosting move.
If the AI has status inducing moves, it uses them first, but doesn't use them if the player can be immune due to typing or possible abilities
If the player's mon isn't a physical attacker, the AI won't try to burn.
If the player's mon is slower than all of the AI's mons, the AI won't try to paralyze.
There's more I'd add, but I can't think of it all off the top of my head. Either way, the AI would follow a table of conditions based on what your mon could possibly do.
And none of this applies to wild mons. They just use moves at random because wild animals are dumb.