User:FIQ/Turn sequence

From SadisticMystic.

Entry effect order

  1. Poke Ball animations, cries, weight-based landing sounds
  2. Shiny star, contest ribbon effects
  3. Head turning (only with sufficient affection, in in-game battles where affection applies, and only at turn 1)
  4. Unnerve ability announces and takes effect
  5. Heal from Healing Wish, Lunar Dance, Z-Memento, or Z-Parting Shot if applicable
  6. Entry hazards
  7. Abilities with entry effects can announce, except Neutralizing Gas/Unnerve (earlier) and form-changing abilities (later) Intimidate, Pressure, Download, Trace, Frisk, Anticipation, Forewarn, Mold Breaker, Teravolt, Turboblaze, Imposter, Slow Start, Comatose, Drought, Drizzle, Sand Stream, Snow Warning, Desolate Land, Primordial Sea, Delta Stream, Air Lock, Cloud Nine, Fairy Aura, Dark Aura, Aura Break, Electric Surge, Misty Surge, Psychic Surge, Grassy Surge
  8. Air Balloon is announced, Berries/Berry Juice/White Herb/Mental Herb/terrain seeds can be consumed if applicable
  9. Forecast, Flower Gift, Shields Down, and Schooling abilities can announce themselves if applicable, and cause form changes
  10. Primal Reversion occurs

Speed processing order

  1. Start with the Pokemon's raw, untouched speed stat
  2. if boost rank (R) > 0, multiply speed by (2+R), truncate to 16 bits, divide by 2 and round down
  3. otherwise, multiply speed by 2, truncate to 16 bits, divide by (2-R) and round down
  4. set the default speed modifier to 4096
  5. if ability is activated Swift Swim, Chlorophyll, Slush Rush, Sand Rush, Surge Surfer, or Unburden, multiply modifier by 8192/4096
  6. if ability is activated Quick Feet, multiply modifier by 6144/4096
  7. if ability is Slow Start and has not expired yet, multiply modifier by 2048/4096
  8. if item is Quick Powder and species is Ditto (not transformed), multiply modifier by 8192/4096
  9. if item is Choice Scarf, multiply modifier by 6144/4096
  10. if item is Iron Ball, Macho Brace, or a Power EV item, multiply modifier by 2048/4096
  11. if Tailwind is in effect on this side, multiply modifier by 8192/4096
  12. if pledge swamp is in effect on this side, multiply modifier by 1024/4096
  13. multiply speed (last used in step 3) by modifier, divide by 4096, and round to nearest but ties round DOWN
  14. if paralyzed and not Quick Feet, multiply speed by 2048/4096 (G7) or 1024/4096 (G5-6), and round down
  15. if speed > 10000, set speed to 10000
  16. if Trick Room is active, set speed to (10000 - speed)
  17. if speed > 8191, set speed to (speed - 8192)

Turn processing order

  1. Quick Claw/Custap Berry announce their effects if applicable
  2. If wild battle, display "Got away safely!"/"Can't escape!" message; if trainer battle, forfeit and fade out
  3. Handle switches
  4. Handle rotation
  5. Item usage (in-game only)
  6. Mega Evolution, Ultra Burst
  7. Focus Punch, Beak Blast, Shell Trap charging effects
  8. Move usage in order
  9. End of turn effects

Move clearance

  1. check for sleep/freeze (unless using a move that can execute despite that status)
  2. check for disobedience
  3. check for Truant loafing turn
  4. if move is Focus Punch, check for prior damage this turn
  5. check for flinch
  6. check for confusion self-damage
  7. check for full paralysis
  8. check for attraction
  9. check if there was no PP left for the move
  10. if move is Z powered, display Z dance, and if move is status, APPLY Z effect
  11. if not Z powered, check if move is Disabled
  12. if not Z powered, check if move is blocked by Heal Block
  13. check if move is blocked by Gravity (applies even to Z moves)
  14. if not Z powered, check if sound move is blocked by Throat Chop
  15. (G7) check for move failure due to being Choice-locked into a different move
  16. if not Z powered, check if status move is blocked by Taunt
  17. if not Z powered, check if move is sealed by Imprison
  18. if user has a Choice item, LOCK into the chosen move
  19. if move can call another move (Metronome/Assist/etc.), REPLACE the running move and repeat steps 12-14
  20. if ability is Stance Change, CHANGE form if appropriate (in G6, move this before step 1)
  21. check for move type changing due to Aerilate/Pixilate/Refrigerate/Normalize/Galvanize/Liquid Voice
  22. set move type for Hidden Power/Judgment/Multi-Attack/Natural Gift/Revelation Dance/Techno Blast/Weather Ball/Z-Weather Ball
  23. check for move type changing due to Electrify/Ion Deluge/Plasma Fists
  24. check for target redirection by Lightning Rod/Storm Drain
  25. check for target redirection by Follow Me/Rage Powder/Spotlight/Z-Destiny Bond/Z-Grudge
  26. SUBTRACT the appropriate amount of PP from the move (if the move called another move at step 19, use the original move for PP subtraction)
  27. check for move condition failures, part 1
    1. Sucker Punch/Me First: target doesn't have an eligible move pending
    2. Burn Up: user is not Fire type
    3. Fake Out/First Impression/Mat Block: user has already performed an action
    4. protection moves: automatically fail if there are no other pending moves this turn, otherwise check for failure chance if repeated
    5. (G7) Destiny Bond: move is repeated and previous use was successful
    6. Fling/Natural Gift: Embargo or Magic Room are in effect, or ineligible held item
    7. Stockpile: existing Stockpile count is 3
    8. Swallow/Spit Up: existing Stockpile count is 0
    9. Bide: no energy to unleash
    10. Counter/Mirror Coat/Metal Burst: target hasn't hit with an eligible damaging move this turn
    11. Encore: target hasn't used a move, or has no PP left on the move, or move is exempt from the effect
    12. Hyperspace Fury/(G7) Dark Void: ineligible user
    13. Rest: user has full HP, or is already asleep (through Sleep Talk, or user's Comatose)
    14. Rest: user has Insomnia/Vital Spirit (this check happens after the previous one)
    15. Snore/Sleep Talk: user isn't asleep
    16. Future Sight/Doom Desire: target slot already has the future attack effect
  28. if move allows self-defrost, UNTHAW the user
  29. check if move is blocked by Primordial Sea/Desolate Land
  30. check for Fire move failure and backfire due to Powder
  31. if move is Future Sight/Doom Desire, CREATE the effect and EXIT (does not count as failing the move)
  32. if move is part 1 of an eligible Pledge combo, fail the current move and TRIGGER teammate to pick up the conclusion (they start over from step 1)
  33. check if move is blocked by Damp
  34. if ability is Protean and user can change type with it, CHANGE type to match with move
  35. if move requires charging, APPLY Defense boost if Skull Bash, and unless it's Solar Beam/Solar Blade in sun, or Power Herb can be consumed, SUSPEND the move until next turn (does not count as failing)
  36. check for move failure due to lack of target (includes Helping Hand/Ally Switch in singles)
  37. check if move is STOLEN by a pending Snatch (go back to step 12 for the Pokemon who snatched it)
  38. if move is Explosion/Self-Destruct/Mind Blown, LOSE 100/100/50% of own max HP respectively, but don't fail the move from user fainting
  39. check for move condition failures, part 2
    1. Rest: Uproar is in effect
    2. recovery moves other than Rest: user has full HP
    3. Substitute/Belly Drum: not enough HP to make one
    4. Conversion/Camouflage: user is already the type it would change to
    5. Conversion 2: no prior move, or all resistances to the move's type (if any) are already in user's own types
    6. Sky Drop: target is a teammate
  40. check for move failure due to target in Fly/Dig/Dive/Bounce/Sky Drop/Phantom Force/Shadow Force
  41. check if priority move is blocked by Dazzling/Queenly Majesty
  42. check if priority move is blocked by Psychic Terrain
  43. if move is Sky Drop, check for failure due to target too heavy (200kg)
  44. check if move is blocked by Quick Guard/Wide Guard/Crafty Shield (if Z powered attack, only 75% reduction)
  45. check if move is blocked by Protect/Detect/King's Shield/Spiky Shield/Baneful Bunker (if Z powered attack, only 75% reduction)
  46. check if move is reflected by Magic Coat
  47. if move is Telekinesis, check for failure vs. Diglett/Dugtrio/Sandygast/Palossand/Gengar-Mega, Smacked Down, or Ingrained target
  48. check if move is reflected by Magic Bounce
  49. check if move is blocked by Mat Block (if Z powered attack, only 75% reduction)
  50. check for ability-based immunities, part 1
    1. Sap Sipper: Grass type moves
    2. Flash Fire: Fire type moves
    3. Dry Skin, Storm Drain, Water Absorb: Water type moves
    4. Lightning Rod, Motor Drive, Volt Absorb: Electric type moves
    5. Soundproof: sound moves
    6. Telepathy: damaging moves from a teammate
    7. Wonder Guard: move is a type that isn't super effective
  51. if non-status move or Thunder Wave, and target does not hold Ring Target, check for type chart immunity (G6: move this check to step 41)
  52. check for Levitate immunity (G6: move this check to step 42)
  53. check for Magnet Rise/Telekinesis/Air Balloon immunity
  54. check for Overcoat immunity
  55. check for Safety Goggles immunity
  56. check for type-based move condition immunities
    1. powder moves: Grass type
    2. burning moves: Fire type
    3. poisoning moves: Poison/Steel type (unless user has Corrosion)
    4. paralysis moves: Electric type
    5. (G7) Sheer Cold: Ice type
    6. Mean Look/Spider Web/Block: Ghost type
    7. Sky Drop on the way down: Flying type
  57. check for other move condition immunities
    1. Synchronoise: non-matching type
    2. Dream Eater/Nightmare: target is awake
    3. Attract: gender failure
    4. Endeavor: target has less HP than user
    5. Fissure/Horn Drill/Guillotine/Sheer Cold: target has higher level than user
  58. check for ability-based immunities, part 2
    1. Sturdy: OHKO moves
    2. Sticky Hold: Trick/Switcheroo
    3. Bulletproof: bullet/bomb moves
    4. Oblivious: Attract/Captivate/Taunt
  59. if move is Captivate, check for gender immunity
  60. check for generic move failure due to redundancy
    1. status affliction when target already has one
    2. attempted creation of weather/field effect/pseudo-status that already exists
    3. stat changing moves that can't go any higher or lower
    4. Trick/Switcheroo/Bestow with no item, or unmovable item
    5. Instruct/Disable/Sketch vs. no move, or ineligible move (note that Encore is checked earlier)
    6. Electrify/Quash/After You when target already made a move this turn
    7. Healing Wish/Lunar Dance with no one to switch to
    8. various other moves whose effects would naturally do nothing etc.
  61. check if move is blocked by Safeguard
  62. check if move is blocked by Electric Terrain/Misty Terrain
  63. check if move is blocked by Sweet Veil or Comatose/Shields Down/Insomnia/Vital Spirit/Leaf Guard
  64. check for move accuracy
  65. check if move is blocked by target's Substitute
  66. check if move is blocked by Mist
  67. check for ability-based immunities, part 3
    1. Clear Body/White Smoke/Full Metal Body: all stat drop moves
    2. Hyper Cutter: attack drop moves
    3. Big Pecks: defense drop moves
    4. Keen Eye: accuracy drop moves
    5. Aroma Veil: Attract, Disable, Encore, Heal Block, Taunt, Torment
    6. Flower Veil: all stat drop moves, all status inflicting moves
    7. Water Veil, Water Bubble: burn moves
    8. Immunity: poisoning moves
    9. Limber: paralysis moves
    10. Own Tempo: confusion moves
    11. Suction Cups: Roar, Whirlwind
  68. if move is Roar or Whirlwind, check for failure due to Ingrain
  69. if move's priority was elevated due to Prankster, check for Dark type immunity
  70. if move is Brick Break/Psychic Fangs/Spectral Thief/Pay Day, APPLY its side effect now
  71. perform move


Move performance

  1. calculate damage (, presumably status effects like Nuzzle)
  2. stat changes, HP drain, Core Enforcer effect
  3. target's Rage, Enigma Berry, Beak Blast
  4. Incinerate, Clear Smog
  5. Grudge
  6. Aftermath, Innards Out
  7. Synchronize
  8. Iron Barbs, Rough Skin, Effect Spore, Poison Point, Static, Flame Body, Cute Charm, Mummy, Gooey, Tangling Hair, Cursed Body, Illusion, Stamina, Water Compaction, Justified, Rattled, Weak Armor, Rocky Helmet
  9. Disguise
  10. if a multi-hit move, go back to step 1 for the remaining hits
  11. faint animation
  12. Destiny Bond
  13. recoil damage, Rapid Spin, Fell Stinger
  14. Knock Off, Thief, Covet
  15. Dragon Tail, Circle Throw
  16. Smack Down, Thousand Arrows, Thousand Waves, binding moves
  17. Magician, Moxie, Beast Boost
  18. if Sheer Force applied to the move, skip to step 29 (U-Turn's switch is not a secondary effect)
  19. Color Change, Berserk
  20. Kee Berry, Maranga Berry
  21. Red Card, Eject Button
  22. pledge combo effect setup
  23. Relic Song/Battle Bond form changes
  24. Life Orb, Shell Bell
  25. Emergency Exit, Wimp Out
  26. U-turn, Volt Switch
  27. Pickpocket
  28. White Herb
  29. if move is Natural Gift, consume the berry
  30. Dancer