>>42023063Battle systems, especially the ai, are the most difficult part of pokemon from a technical perspective. Let's break some of that down using a basic 1v1 battle:
You and the ai each send out a pokemon, this is not a wild battle - player selects fight, pokemon, or bag. If pokemon then they select their mon to view the summary - stats, moves, ect - there's no pokemon to switch with in this example, they go back and choose another option. If bag they go through their items then back out or try to use one - if use the game checks what kind it is, if ball it uses it but fails because trainer battle, if healing, battle, ect the player selects their pokemon to use it on then the game checks if it can/will do anything, if succeed it applies the effects, if fail it either has no effect and wastes the item and your turn or says you can't use that item and you have to either select a different item and repeat the process or chose a different menu option entirely. If fight then player can check the pokemon's moves or just select one. When a move is selected the game checks if pp>0, not disabled, ect - if not another must be selected or go back to main battle menu, the ai makes its decision, the game either lets the ai use its item if that was the ai's decision, determine which pokemon goes first based on which has more speed and if a priority move was used by either side and resolve ties, the selected pokemon moves first, the effects - damage, status buff/debuff, weather, ect happen, the other pokemon's turn does the same if they didn't use their turn for an item, post-turn effects like weather, wrap, poison, and leftovers happen, and the loop repeats until one pokemon has hp=<0 and the other wins. All throughout it has to check if abilities or held items need to activate, the ai makes the same set of decisions also basically using if-statements or other conditionals.
Can be done, but way harder than just letting two players make the decisions.