Battle AI
How trainers choose moves, when they switch, when they use items, and what Hard Mode changes.
Trainers think with the same AI as Emerald and FireRed: the game runs the cartridges' own AI scripts, bugs included, with each trainer's own AI settings. Wild Pokémon pick a random move that has PP left.
Choosing a move
Each move starts at a score of 100, and the trainer's AI settings add or take points:
| Setting | What it does |
|---|---|
| Check bad move | Avoids moves that would fail or do nothing, such as a status move on a Pokémon that already has a status |
| Try to faint | Prefers a move that would knock out the target, estimated with the game's own damage calculation |
| Check viability | Scores each move for the situation: healing at low HP, setting up when safe, and so on |
| Setup first turn | Favours stat-raising and field moves on the first turn |
| Risky | Favours high-risk moves such as Explosion |
| Prefer Baton Pass | Sets up, then passes the boosts on |
The highest score wins; a tie is broken at random. Moves added after Generation 3 are judged as the closest Generation 3 move.
Switching
In a single battle a trainer may switch out instead of attacking, using Emerald's rules:
- its Pokémon is about to faint from Perish Song;
- your last move was Electric, Water or Fire, and it has a Pokémon that absorbs that type (Volt Absorb, Water Absorb, Flash Fire);
- its Pokémon has no super-effective move, has not set up, and it has a Pokémon your moves cannot hurt or hurt only a little.
A trapped Pokémon never switches. In a double battle, trainers switch only when a Pokémon faints.
Items
Trainers use the items they carry, without any randomness:
- Full Restore and Potions below ¼ HP (Potions also when the damage taken is more than the Potion heals).
- Full Heal and the status cures when their Pokémon has that status.
- X items and Guard Spec. only on the first turn.
A trainer with several items saves the later ones until it is down to its last few Pokémon.
Hard Mode
On a Hard Mode character, every trainer also gets Check bad move, Try to faint and Check viability on top of its own settings.
Double battles
In a double battle, the AI scores each move against each target and picks the best pair. It avoids hitting its own partner with most moves.
Last updated on
As of v0.75.0 · engine 22ba612f