Pokemon Ruby/Sapphire - Battle Timing
These are notes related to the battle timing process in the Ruby and Sapphire games.
Round Phases
A round consists of four phases done in order:
- Choosing commands
- Each player can use items as commands are chosen.
- Switching Pokemon for both players
- Attacks
- Post-round effects
Priority
In the attack phase of each round, the game first determines the priority for each Pokemon who chose a move for use in that round.
Priority Levels
Attacks in Ruby and Sapphire are categorized in ten priority levels.
- 5: Helping Hand
- 4: Magic Coat, Snatch
- 3: Protect, Detect, Endure, Follow Me
- 1: Quick Attack, Mach Punch, Extremespeed, Fake Out
- 0: All other attacks
- -1: Vital Throw
- -3: Focus Punch
- -4: Revenge
- -5: Counter, Mirror Coat
- -6: Whirlwind, Roar
Modifications to Speed
- Speed stat stage is applied.
- If Pokemon has Swift Swim, Speed is doubled in rain.
- If Pokemon has Chlorophyll, Speed is doubled during Sunny Day.
- If Pokemon is holding Macho Brace, Speed is halved.
- If Pokemon is paralyzed, Speed is multiplied by 1/4.
- In internal battles, if the player has the Dynamo Badge, the Speed of the player's team's Pokemon is multiplied by 1.1.
Calculating Priority
- Attacks with a higher priority level strike first.
- If two or more attacks have the same priority level, ties are broken using each active Pokemon's Speed. At a 20% chance, all holders of Quick Claw whose attacks have the same priority level will strike at a random order and before other Pokemon whose attacks have the same priority level.
- If there are still ties in priority or Speed, ties are broken at random.
The order in which attacks will strike is set just after all commands are chosen.
Obedience Check
In internal battles, if the Pokemon's ID and OT (Original Trainer) name are different from those of the player, and its level is greater than the player's "badge level", then this process is followed to determine whether the attack succeeds.
A = ((Level of Pokemon)+(Badge level))*(0~255)/256
if A is less than badge level
attack continues as usual, end here
if the attack ordered is Rage, the effect is canceled
if the attack is Snore or Sleep Talk while Pokemon is asleep:
"X ignored orders while asleep!"
B = ((Level of Pokemon)+(Badge level))*(0~255)/256
if B is less than badge level
Use a different move if possible
if B is greater than or equal to badge level
C=(Level of Pokemon)-B
R=(0~255)
if R is less than C and Pokemon does not have Vital Spirit or Insomnia and
Uproar is not in effect
"X took a snooze..."
R=R-C
if R is less than C
Deal confusion damage
Else
Display message "X ignored orders/turned away/is loafing around/pretended
to not notice."
The "badge level" depends on the badges the player has:
- No badges: Badge level=10
- Knuckle Badge/Cascade Badge: Badge level=30
- Heat Badge/Rainbow Badge: Badge level=50
- Feather Badge/Marsh Badge: Badge level=70
- Rain Badge/Earth Badge: Badge level=100
Accuracy Check
Attacks that "hit without fail" and that ignore this accuracy check are Swift, Faint Attack, Shadow Punch, Aerial Ace, Magical Leaf, Shock Wave, and Vital Throw, as well as Thunder during Rain Dance. The use of Protect and Detect can override these moves, though.
- The accuracy starts at its original value.
- If the attack is a one-hit KO attack:
- If the opponent's level is greater than the attacker's, the opponent is unaffected by the attack.
- The accuracy is increased by the difference between the attacker's level and the opponent's.
- If the opponent has Sturdy, the opponent is unaffected by the attack.
- Otherwise:
- If the attack is Thunder and the weather is sunny, the accuracy is 50.
- The attacker's Accuracy stat stage is reduced by the opponent's Evasion stat stage.
- The resulting Accuracy stat stage is modified so it is neither less than -6 nor greater than 6.
- The accuracy is multiplied by the respective multiplier for the resulting Accuracy stat stage.
- If the attacker has Compoundeyes, the accuracy is multiplied by 1.3.
- If the opponent has Sand Veil and the weather is a sandstorm, the accuracy is multiplied by 4/5.
- If the attacker has Hustle and the attack is a physical attack, the accuracy is multiplied by 4/5.
- If the opponent is holding Brightpowder, the accuracy is multiplied by 0.9.
- If the opponent is holding Lax Incense, the accuracy is multiplied by 0.95.
- If a random number from 1 through 100 is less than the accuracy, the attack hits.
Accuracy Stat Stage
Multipliers for the Accuracy stat stage. As described above, the Accuracy stat stage is reduced by the opponent's Evasion stat stage. After applying the multiplier, the result is rounded down.
- -6: 33/100
- -5: 36/100
- -4: 43/100
- -3: 50/100
- -2: 60/100
- -1: 75/100
- 0: 100/100
- 1: 133/100
- 2: 166/100
- 3: 2/1
- 4: 250/100
- 5: 133/50
- 6: 3/1
Attack Timing Process
- Sleep check
- If frozen, check if defrosted
- If attacker used Hyper Beam or a similar move last turn, display "X must recharge!" and end processing
- If Truant check succeeds, display "X is loafing around!" and end processing
- If attacker flinches, end processing
- Confusion check
- Paralysis check
- Attract check
- If frozen and Flame Wheel or Sacred Fire was chosen, defrost
- Use of attack ("X used [attack]!")
- PP is spent for this move
- For each opponent affected:
- Accuracy check
- For each hit, if neither opponent nor user faint; or if move is Explosion/Selfdestruct:
- Calculate damage
- Does attack miss?
- If so, "[Opponent] avoided the attack!" if more than one opponent is targeted, "[User]'s attack missed!" if only one opponent.
- Reduce HP or perform other effect
- At this point, if the opponent has a decoy and it was defeated, it breaks.
- At this point, this is the last hit if opponent is defeated.
- If not the last hit, show type effectiveness
- Recoil damage
-
If user now has 0 HP, it faints.
- Additional effect ("May...") if it affects user or if opponent isn't defeated
- Destiny Bond effect
-
If user now has 0 HP, it faints.
- If opponent is defeated and user isn't defeated, Grudge effect
- Opponent faints if defeated
- Resolve effects based on ability (Static, Synchronize, Rough Skin, Color Change, etc.)
-
If user now has 0 HP, it faints.
- Berry and Herb check (for all active Pokemon)
- User's Shell Bell effect
- User faints if Selfdestruct/Explosion was used
- Player's unfainted participants gain EXP if opponent faints, if it's the player's opponent
- Player's unfainted participants gain EXP if user faints, if it's the player's opponent
- Switch Pokemon if necessary, according to this round's priority.
Effects that change targets
These effects can change the target of moves and are applied in this order.
- Follow Me effect
- Lightningrod effect
- Magic Coat effect
Post-round effects
These effects are invoked at the end of a round, after each Pokemon's turn.
If an effect lasts "until the end of the round", it ends after each Pokemon's turn, just before these post-round effects are checked.
Applied for each Pokemon.
- End effect of Protect/Detect/Endure
- Hyper Beam
- Substitute breaks if it was defeated
Each step is applied for each side (player's side, then foe's side).
- Reflect
- Light Screen
- Mist
- Safeguard
Each step is applied for each unfainted Pokemon, according to the order in which they took their turns this round.
For each unfainted Pokemon, according to the order in which they took their turns this round, all of these steps are applied.
- Ingrain
- Rain Dish
- Speed Boost
- Truant
- Shed Skin
- Berry and Herb check 1
- Leech Seed
- HP loss due to Poison
- HP loss due to Toxic
- HP loss due to Burn
- Nightmare
- Curse
- Multi-turn attacks
- Uproar
- Outrage/Thrash/Petal Dance
- Decrement confusion count
- Decrement Disable count
- Encore
- Taunt/Lock-on/Mind Reader
- Yawn
- Berry and Herb check 2
Applied for each unfainted Pokemon according to the rules of priority.
- Drizzle/Sand Stream/Drought (no order between them)
Each step is applied for each unfainted Pokemon in this order: own first, opposing first, own second, and opposing second Pokemon.
- Intimidate, if not already applied
- Trace, if not already applied
- Speed Boost, if not already applied
- Forecast, if not already applied
Each step is applied for each unfainted Pokemon, according to the order in which they took their turns this round.
- Future Sight/Doom Desire
- Perish Song
Applied for each Pokemon.
- End effect of Protect/Detect/Endure
- Hyper Beam
- Substitute breaks if it was defeated