Auto-translated
The computer attacks archers first, then flyers, and then melee units, prioritizing based on the hit points of each unit. For example, if you have 1 Titan and 59 Centaurs, the computer will attack the Titans. However, if you have 61 Centaurs, it will attack the Centaurs. I don't remember what happens when the hit points are equal.
As for magic, the computer attacks the archer it can kill with one spell. If it can't kill any archers, it seems to attack based on hit points as well.