>>54945878It’s not completely random, it just doesn’t take its attacking moves’ damage output into account
Status move logic is unaffected and it won’t use ineffective moves, but it won’t prioritize the move that would do the most damage to you over the others
Looking into the leaked source code we got our hands on in 2020 I found this was due to a part of the AI’s code being commented out (pic related). Uncommenting it makes the AI not use status moves whatsoever because it will always prioritize its highest damage offensive move, which is probably why they commented it out. But the bug is pretty obvious, instead of incrementing the highest damage move by one it should decrement all damage moves that aren’t the highest damage by one. I found that doing that fixed the bug.
While it does make the game normally easier because the AI won’t always use its strongest move when it could kill you, it actually makes it harder for things like speedruns and nuzlockes where you will often rely on predicting the opponent’s move (e.g. for a switch)