Exarion

Sapphire AI theory

Aug 26th, 2016
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. Example: Roxanne's Nosepass on its first turn, with 39/39 HP Mudkip
  2.  
  3. Code checks in order:
  4. 1. Kill range
  5. 2. Rock Tomb speed drop effect
  6. 3. Harden (setup move)
  7. 4. Damaging moves
  8.  
  9. 1. Kill range
  10. - Is Mudkip in kill range? Since no, skip this step
  11.  
  12. 2. Rock Tomb speed drop effect
  13. - Is Mudkip faster than Nosepass? Since yes, roll a number between 1 and 100
  14. > If number is 1-70, +2 to Rock Tomb
  15. > If number is 71-100, +0 to Rock Tomb
  16.  
  17. 3. Harden (setup move)
  18. - Is this Nosepass' first turn? Since yes, roll a number between 1 and 100
  19. > If number is 1-80, +2 to Harden
  20. > If number is 81-100, +0 to Harden
  21.  
  22. 4. Most damaging move
  23. - Use the damage formula to calculate rolls for each move (example: Rock Tomb 13, Rock Throw 14, Tackle 6)
  24. > Give +2 to the move(s) that do the most damage
  25.  
  26. Use the move with the highest priority (for example, if check #2 rolls 50, check #3 rolls 50, and check #4 rolls 14/14/6 dmg, Rock Tomb would always be used because it has +4, Harden has +2, Rock Throw has +2 and Tackle has 0)
  27.  
  28. MANUAL TEST (save states):
  29. Harden 19/50
  30. Rock Tomb 28/50
  31. Rock Throw 3/50
  32.  
  33. -----
  34.  
  35. SOURCES:
  36. - https://github.com/pret/pokeruby/blob/master/data/trainers.s
  37. - https://github.com/pret/pokeruby/blob/master/data/battle_ai_scripts.s
Add Comment
Please, Sign In to add comment