This page is a footnote for the trainer AI move selection page; see that if you haven't already for more context. Specifically, ensure you are familiar with the AI's effectiveness check and damage calculation. Damage calculation for the purposes of checking switch-ins ignores the move blacklist that the move selection procedures uses.
All trainers have the same AI that controls which Pokémon to send in after the current Pokémon faints or uses U-Turn. Trainers may also withdraw their active Pokémon in specific situations.
Trainers cannot withdraw their Pokémon if they are under the effect of a trapping move, Ingrained, or if a Pokémon on the opposing side has the ability Shadow Tag, Arena Trap, or (if the Pokémon is Steel type) Magnet Pull.
Trainer switching ignores the Shed Shell, and the immunity to Arena Trap that Flying type Pokémon and Pokémon with Levitate have.
Background: Switching type effectiveness check
The switching procedure has its own type effectiveness check, independent of the move selection type effectiveness check. This check is used frequently, but not all the time, within the switching procedures, yet is far less comprehensive than the move selection's version of the check.
It ignores if the move in question is damaging, may or may not account for variable typing of moves (depending upon how it is run), and takes into account these factors in addition to the basic type matchup table:
- Normalize
- Levitate
- Iron Ball
- Gravity
- Scrappy
- Wonder Guard
- Mold Breaker
Multiple times in the rest of the article, I will refer to either the "move selection type effectiveness check", the one described on the move selection page, and this switching-specific version, the "switching AI type effectiveness check".
Send-ins after the active Pokémon faints or uses U-Turn
Preliminarily, a random living foe is selected to be targetted and used for all following checks. If no foe is alive, a random fainted foe is selected instead.
First check: Type effectiveness
The party is searched for a Pokémon who's type(s) are the most damaging against the target's current type(s). Effectiveness multipliers for each of the party member's type are calculated using only the raw type check table (i.e. no corrections for Scrappy etc.), scores assigned for the multiplier, and then the two scores added together. If the party member only has one type, that type is counted twice (but not if the target only has one type). No other factor is included other than the type of the Pokémon.
The score for each effectiveness multiplier is:
Effectiveness | Score |
---|---|
4x | 160 |
2x | 80 |
1x | 40 |
1/2x | 20 |
1/4x | 10 |
0x | 0 |
For example, a Magcargo checked against an Arcticuno would get 4x for Rock and 2x for Fire, which would be scored at 160 and 80, which would be added together for a total of 240.
Due to an oversight, if the score would be 320 (when both types are 4x against the target), it instead overflows and results in a score of 64.
In the event of ties, the Pokémon towards the front of the party is preferred.
After the candidate with the highest score is found, that Pokémon is checked if it has a move that is supereffective against the target using the switching AI type effectiveness check. Variable-type moves use their correct type in this check, and whether the move deals damage or not is ignored. If a matching Pokémon is found, the AI is guaranteed to switch to it.
Second check: Most damage
If no switch candidate was found in the first check, a backup check using damage calculations is performed instead.
For all party Pokémon, all of their moves have their damage calculated against the target, using the move selection damage calculation. Variable-type moves use their base type in this check. Although this initial calculation does not apply type effectiveness (as that comes later), lack of type-correcting, for example, could cause Weather Ball in harsh sun to not activate Thick Fat. Any move that deals nonstandard damage, such a Low Kick, Return, Sheer Cold, Dragon Rage, etc. is not considered. This calculation is performed as if the Pokémon that just fainted (or was otherwise last active) is the attacker.
The damage value returned from the move selection damage calculation is then multiplied by the move selection effectiveness multiplier. This multiplier does correct for variable type, so the Weather Ball in the previous example will still be 4x against something like a Scizor.
The Pokémon that can deal the most damage to the target is returned as the Pokémon to switch to. Ties prefer the Pokémon toward the front of the party.
If no party Pokémon has a valid move to damage the target, this check fails.
Fallback: Sequential pick
If no Pokémon has been selected, then as a final backup procedure, the first Pokémon at the top of the party list that is able to switch in is selected.
Active Pokémon Withdrawals
The AI will withdraw its active Pokémon in 7 different situations. These situations are checked in order, and if any one triggers a switch, all subsequent ones are skipped.
-
The active Pokémon is about to faint to Perish Song
If the Perish Song counter will reach 0 at the end of the turn, it is guaranteed to switch to a Pokémon selected by the fainting switch-in procedure.
-
The active Pokémon is facing a foe with Wonder Guard and cannot hit it supereffectively
This check is skipped in double / multi battles. This check also reads the foe's ability directly, so even hacked Pokémon with Wonder Guard etc. will trigger this check.
First, all of the active Pokémon's moves are checked using the move selection type effectiveness check, using the supereffective results flag (so the check is not disrupted by Adaptability, Expert Belt, etc.). Variable-type moves use their correct type in this check. If any move can deal damage supereffectively, the check will fail.
Second, the party is searched for a Pokémon that knows a supereffective move according to the switching AI type effectiveness check. Variable-type moves use their correct type in this check. For each matching Pokémon found, there is a 66.6% chance the AI will opt to switch to it. Because this check ignores if the move is damaging, moves such as Taunt will trigger it, whereas moves that can actually damage a Shedinja without having a supereffective type, such as Sandstorm, will not.
-
All of the damaging moves the active Pokémon knows do not affect the target (or in doubles, all living targets)
If the active Pokémon knows 0 or 1 damaging moves, this check fails.
This check specifically is glitched and will always assume the player's side of the field is the foe's, and therefore will target itself and the player when the player is allied with an NPC.
First, all of the active Pokémon's damaging-dealing moves are checked against the foes using the move selection effectiveness check, using the immunity flag from the result. Variable-type moves use their correct type in this check. If any move can damage the target, or either target in doubles, the check will fail.
Second, the party is searched for a Pokémon that can hit a foe supereffectively. Each move is checked using the switching AI type effectiveness check, with an extra check also requiring the move must deal damage. Variable-type moves use their correct type in this check. For each Pokémon found that can hit a foe supereffectively:
-
In singles: 88.8% chance to switch to it
-
In doubles: 66.6% chance to switch to it if it can hit only one foe, 88.8% chance if it can hit both foes
If a switch was not made, it searches the party again in the same way, this time checking for a Pokémon that can damage any foe at all. For each one found:
-
In singles: 75% chance to switch to it
-
In doubles: 50% chance to switch to it if it can hit only one foe, 75% chance if it can hit both foes
-
-
The last move the active Pokémon was hit by in the last turn was Fire, Water, or Electric-type, and a party Pokémon has the ability Flash Fire, Water Absorb, or Volt Absorb, respectively
Note Motor Drive and Dry Skin are not included in this check. If active Pokémon already has the desired ability, this check will fail.
First, the currently active Pokémon is checked using the move selection type effectiveness check for if it can hit any foe supereffectively. Only moves that deal damage count, and variable-type moves use their correct type in this check. If a supereffective move is found, there is a 66.6% chance for the check to fail.
Second, the last move the active Pokémon was hit by in the last turn is examined; if it was not targeted with a move, or the move missed or failed, or the move was nondamaging, the check fails.
Third, if the move's base type was Fire, Water, or Electric-type (variable-type moves will be treated as their base type here), the party is searched for a Pokémon with the appropriate absorption ability. For each one found, there is a 50% chance the AI will opt to switch to it.
-
The active Pokémon is asleep and has the ability Natural Cure
The active Pokémon must be asleep; no other status condition is checked. This check will fail if the active Pokémon is under 50% HP.
First, the last move the active Pokémon was hit by in the previous turn is examined:
If the active Pokémon was not targeted with a move, or the move missed or failed, or the move was nondamaging, there is a 50% roll that the AI will opt to switch to a Pokémon selected by the fainting switch-in procedure. If not, the check continues on.
If the active Pokémon was hit by a damaging move in the previous turn, the party is searched for a Pokémon that is immune to the move, while also having a move (regardless if it deals damage) that is supereffective against the foe. Both of these checks use the switching AI type effectiveness check, and variable-type moves use their correct type in this check. If a matching Pokémon is found, the AI is guaranteed to switch to it.
If the active Pokémon was hit by a damaging move in the previous turn, and it did not find a Pokémon in the previous search, it searches the party again in the same way for a Pokémon that resists the previous move rather than being immune to it. If a matching Pokémon is found, it is guaranteed to switch to it.
Otherwise, there is another 50% chance for the AI to switch to a Pokémon selected by the fainting switch-in procedure.
Before checking the final two situations to switch, check if:
- The current active Pokémon is able to damage at least one foe supereffectively. This is checked by the move selection effectiveness check, with variable-type moves using their correct types. Only damaging moves count.
- The total number of positive stat boosts that the active Pokémon has, minus the total number of stat reductions that it has, is greater than or equal to 4.
If either of these two conditions are met, the final two situations are not checked and the AI will not switch.
-
A party member is immune to the previous attack and can hit the foe supereffectively
If the active Pokémon was hit by a damaging attack in the previous turn, the party is searched for a Pokémon that is immune to that attack, and has a move (regardless of if it is damaging) that is supereffective against the foe, using the same procedure as in check #5. For each one found, there is a 50% chance the AI will opt to switch to it.
-
A party member resists the previous attack and can hit the foe supereffectively
The same procedure from check #6 is run again, searching for a Pokémon that can resist the previous move rather than being immune to it. For each matching Pokémon found, there is a 33.3% chance the AI will opt to switch to it.