Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. -- ## Data
  2. name = "ProTo's Catcher"
  3. author = "ProTo"
  4. description = [[ Nothing special, just a basic Catcher. ]]
  5. -- ##
  6.  
  7. -- ## Settings
  8. local PathFinder = require "Pathfinder/Maps_Pathfind"
  9. local map = nil
  10. AlwaysCatch = "Ditto"
  11. CatchUncaught = 0
  12. wildencounters = 0
  13. catchonlycounter = 0
  14. shinycounter = 0
  15. -- ##
  16.  
  17. PathFinder.disableDigPath()
  18.  
  19. -- ## GUI Settings
  20. tab = {"Catch Uncaught"}
  21. for i = 1, 1 do
  22. setOptionName(i, tab[i] .. "")
  23. setTextOptionName(1, "Place to level/farm ")
  24. setTextOption(1, getMapName())
  25. setTextOptionName(2, "Always catch this")
  26. setTextOption(2, AlwaysCatch)
  27. setTextOptionName(3, "Grass/Water/Custom")
  28. setTextOption(3, "Grass")
  29. end
  30. -- ##
  31.  
  32. -- ## Functions
  33. function onStart()
  34. log(" ")
  35. log(" - - Catcher - -")
  36. log("A basic Catcher by ProTo")
  37. log("Version 0.0.1")
  38. log("- - - - - - - - - -")
  39. log(" ")
  40. end
  41.  
  42. function onPause()
  43. log("Catcher | Paused")
  44. end
  45.  
  46. function onResume()
  47. log("Catcher | Resumed")
  48. end
  49.  
  50. function onPathAction()
  51. map = getMapName()
  52. if isPokemonUsable(1) then
  53. if getMapName() == getTextOption(1) then
  54. if getTextOption(3) == "Water" then
  55. moveToWater()
  56. elseif getTextOption(3) == "Custom" then
  57. moveToRectangle(MinX, MinY, MaxX, MaxY)
  58. else
  59. moveToGrass()
  60. end
  61. else
  62. PathFinder.moveTo(map, getTextOption(1))
  63. end
  64. elseif not isPokemonUsable(1) then
  65. PathFinder.useNearestPokecenter(map)
  66. end
  67. end
  68.  
  69. function onBattleAction()
  70. if isWildBattle() and (isOpponentShiny() or isAlreadyCaught() == false and getOption(1) == true) or getOpponentName() == getTextOption(2) then
  71. return useItem("Pokeball") or useItem("Great Ball") or useItem("Ultra Ball")
  72. else
  73. return attack() or run() or sendUsablePokemon() or sendAnyPokemon()
  74. end
  75. end
  76.  
  77. function onBattleMessage(wild)
  78. if stringContains(wild, "A Wild SHINY ") then
  79. shinycounter = shinyCounter + 1
  80. wildencounters = wildCounter + 1
  81. elseif stringContains(wild, "A Wild ") then
  82. wildencounters = wildencounters + 1
  83. elseif stringContains(wild, AlwaysCatch) then
  84. catchonlycounter = catchonlycounter + 1
  85. elseif stringContains(wild, "You have won the battle.") then
  86. log("- - Log - -")
  87. log("Pokemons encountered: " .. wildencounters)
  88. log("Shinies encountered: " .. shinycounter)
  89. log("Encounted desired poke: " .. catchonlycounter)
  90. log("- - - - - -")
  91. end
  92. end
  93. -- ##
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement