Advertisement
TechSkylander1518

Substitube Poké Ball Handlers Essentials v20

May 19th, 2023 (edited)
1,267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 15.29 KB | None | 0 0
  1. Battle::PokeBallEffects::OnFailCatch.add(:DEXBALL, proc { |ball, battle, battler|
  2.   if !battle.pbPlayer.owned?(battler.species)
  3.     battle.pbPlayer.pokedex.set_owned(battler.species)
  4.     if $player.has_pokedex
  5.       battle.pbDisplayPaused(_INTL("{1}'s data was added to the Pokédex.", battler.pokemon.speciesName))
  6.       battle.pbPlayer.pokedex.register_last_seen(battler.pokemon)
  7.       battle.scene.pbShowPokedex(battler.species)
  8.     end
  9.   end
  10. })
  11.  
  12. Battle::PokeBallEffects::OnFailCatch.add(:CYCLEBALL, proc { |ball, battle, battler|
  13.   if [:FROZEN,:SLEEP,:PARALYSIS].include?(battler.status)
  14.     $bag.add(:CYCLEBALL)
  15.     itemName = GameData::Item.get(:CYCLEBALL).name
  16.     battle.pbDisplay(_INTL("The {1} flew back to {2}!", itemName, battle.pbPlayer.name))
  17.   end
  18. })
  19.  
  20. Battle::PokeBallEffects::ModifyCatchRate.add(:DAWNBALL, proc { |ball, catchRate, battle, battler|
  21.   multiplier = (Settings::NEW_POKE_BALL_CATCH_RATES) ? 3 : 3.5
  22.   catchRate *= multiplier if battle.time == 0   # Daytime outside of caves
  23.   next catchRate
  24. })
  25.  
  26. Battle::PokeBallEffects::ModifyCatchRate.add(:LUCKBALL, proc { |ball, catchRate, battle, battler|
  27.   next rand(255)
  28. })
  29.  
  30. Battle::PokeBallEffects::ModifyCatchRate.add(:STATBALL, proc { |ball, catchRate, battle, battler|
  31.   catchRate *= 3 if battler.hasLoweredStatStages?
  32.   next catchRate
  33. })
  34.  
  35. Battle::PokeBallEffects::ModifyCatchRate.add(:EVOBALL, proc { |ball, catchRate, battle, battler|
  36.   catchRate *= 3 unless battler.pokemon.species_data.get_previous_species == battler.species
  37.   next catchRate
  38. })
  39.  
  40. Battle::PokeBallEffects::ModifyCatchRate.add(:SHINYBALL, proc { |ball, catchRate, battle, battler|
  41.   catchRate *= 3 if battler.shiny?
  42.   next catchRate
  43. })
  44.  
  45. Battle::PokeBallEffects::OnCatch.add(:VALUEBALL, proc { |ball, battle, pkmn|
  46.   stats = []
  47.   GameData::Stat.each_main { |s| stats.push(s.id) }
  48.   chosen_stats = stats.sample(3)
  49.   chosen_stats.each { |stat| pkmn.iv[stat] = 31 }
  50. })
  51.  
  52. Battle::PokeBallEffects::ModifyCatchRate.add(:SHRINKBALL, proc { |ball, catchRate, battle, battler|
  53.   next 0 if catchRate == 0
  54.   weight = battler.pbWeight
  55.   if Settings::NEW_POKE_BALL_CATCH_RATES
  56.     if weight <= 1000
  57.       catchRate += 30
  58.     elsif weight <= 2000
  59.       catchRate += 20
  60.     elsif weight > 3000
  61.       catchRate -= 20
  62.     end
  63.   else
  64.     if weight <= 2048
  65.       catchRate += 40
  66.     elsif weight <= 3072
  67.       catchRate += 30
  68.     elsif weight >= 4096
  69.       catchRate += 20
  70.     else
  71.       catchRate -= 20
  72.     end
  73.   end
  74.   catchRate += 40 if battler.effects[PBEffects::Minimize]
  75.   next catchRate.clamp(1, 255)
  76. })
  77.  
  78. Battle::PokeBallEffects::ModifyCatchRate.add(:TRAPBALL, proc { |ball, catchRate, battle, battler|
  79.   catchRate *= 3 if battler.effects[PBEffects::Trapping] > 0
  80.   next catchRate
  81. })
  82.  
  83. Battle::PokeBallEffects::ModifyCatchRate.add(:RAGEBALL, proc { |ball, catchRate, battle, battler|
  84.   lrf = battler.pbOpposingSide.effects[PBEffects::LastRoundFainted]
  85.   catchRate *= 3 if lrf >= 0 && lrf == battle.turnCount - 1
  86.   next catchRate
  87. })
  88.  
  89. Battle::PokeBallEffects::ModifyCatchRate.add(:EXECUTIVEBALL, proc { |ball, catchRate, battle, battler|
  90.   catchRate *= 3 if battle.trainerBattle?
  91.   next catchRate
  92. })
  93.  
  94. Battle::PokeBallEffects::ModifyCatchRate.add(:PARABALL, proc { |ball, catchRate, battle, battler|
  95.   catchRate *= 3 if battler.pbHasType?(:ELECTRIC) || battler.paralyzed?
  96.   next catchRate
  97. })
  98.  
  99. Battle::PokeBallEffects::ModifyCatchRate.add(:BURNBALL, proc { |ball, catchRate, battle, battler|
  100.   catchRate *= 3 if battler.pbHasType?(:FIRE) || battler.burned?
  101.   next catchRate
  102. })
  103.  
  104. Battle::PokeBallEffects::ModifyCatchRate.add(:POISONBALL, proc { |ball, catchRate, battle, battler|
  105.   catchRate *= 3 if battler.pbHasType?(:POISON) || battler.poisoned?
  106.   next catchRate
  107. })
  108.  
  109. Battle::PokeBallEffects::ModifyCatchRate.add(:FREEZEBALL, proc { |ball, catchRate, battle, battler|
  110.   catchRate *= 3 if battler.pbHasType?(:ICE) || battler.frozen?
  111.   next catchRate
  112. })
  113.  
  114. Battle::PokeBallEffects::ModifyCatchRate.add(:DIZZYBALL, proc { |ball, catchRate, battle, battler|
  115.   catchRate *= 3 if battler.pbHasType?(:PSYCHIC) || battler.effects[PBEffects::Confusion] > 0
  116.   next catchRate
  117. })
  118.  
  119. Battle::PokeBallEffects::ModifyCatchRate.add(:MINUSBALL, proc { |ball, catchRate, battle, battler|
  120.   catchRate *= [(5 - $bag.quantity(:MINUSBALL)),0].min
  121.   next catchRate
  122. })
  123.  
  124. Battle::PokeBallEffects::OnFailCatch.add(:DIVIDEBALL, proc { |ball, battle, battler|
  125.   battler.pbReduceHP((battler.hp / 2.0).round, false)
  126.   battle.pbDisplay(_INTL("{1}'s health was divided in half!", battler.pbThis))
  127. })
  128.  
  129. Battle::PokeBallEffects::OnFailCatch.add(:EQUALBALL, proc { |ball, battle, battler|
  130.   battler.pbRecoverHP(battler.totalhp)
  131.   battler.moves.length.times do |i|
  132.     pbBattleRestorePP(battler.pokemon, battler, i, battler.pokemon.moves[i].total_pp)
  133.   end
  134.   battle.pbDisplay(_INTL("{1}'s HP and PP were restored!", battler.pbThis))
  135. })
  136.  
  137. Battle::PokeBallEffects::OnFailCatch.add(:TAUNTBALL, proc { |ball, battle, battler|
  138.     unless battler.effects[PBEffects::Taunt] > 0
  139.       battler.effects[PBEffects::Taunt] = 4
  140.       battle.pbDisplay(_INTL("{1} fell for the taunt!", battler.pbThis))
  141.       battler.pbItemStatusCureCheck
  142.     end
  143. })
  144.  
  145. Battle::PokeBallEffects::OnFailCatch.add(:PENALTYBALL, proc { |ball, battle, battler|
  146.     unless battler.effects[PBEffects::Disable] > 0 || !battler.lastRegularMoveUsed
  147.       battler.effects[PBEffects::Disable]     = 5
  148.       battler.effects[PBEffects::DisableMove] = battler.lastRegularMoveUsed
  149.       battle.pbDisplay(_INTL("{1}'s {2} was disabled!", battler.pbThis,
  150.                               GameData::Move.get(battler.lastRegularMoveUsed).name))
  151.       battler.pbItemStatusCureCheck
  152.     end
  153. })
  154.  
  155. Battle::PokeBallEffects::OnFailCatch.add(:CONCUSSBALL, proc { |ball, battle, battler|
  156.   battler.pbFlinch
  157. })
  158.  
  159. Battle::PokeBallEffects::OnFailCatch.add(:DOWSEBALL, proc { |ball, battle, battler|
  160.   unless battler.effects[PBEffects::Foresight]
  161.     battler.effects[PBEffects::Foresight] = true
  162.     battle.pbDisplay(_INTL("{1} was identified!", battler.pbThis))
  163.   end
  164. })
  165.  
  166. Battle::PokeBallEffects::OnFailCatch.add(:CHOICEBALL, proc { |ball, battle, battler|
  167.     moveBlacklist = [
  168.       "DisableTargetUsingDifferentMove",   # Encore
  169.       # Struggle
  170.       "Struggle",   # Struggle
  171.       # Moves that affect the moveset
  172.       "ReplaceMoveThisBattleWithTargetLastMoveUsed",   # Mimic
  173.       "ReplaceMoveWithTargetLastMoveUsed",   # Sketch
  174.       "TransformUserIntoTarget",   # Transform
  175.       # Moves that call other moves (see also below)
  176.       "UseLastMoveUsedByTarget"   # Mirror Move
  177.     ]
  178.     if Settings::MECHANICS_GENERATION >= 7
  179.       moveBlacklist += [
  180.         # Moves that call other moves
  181. #        "UseLastMoveUsedByTarget",   # Mirror Move                 # See above
  182.         "UseLastMoveUsed",   # Copycat
  183.         "UseMoveTargetIsAboutToUse",   # Me First
  184.         "UseMoveDependingOnEnvironment",   # Nature Power
  185.         "UseRandomUserMoveIfAsleep",   # Sleep Talk
  186.         "UseRandomMoveFromUserParty",   # Assist
  187.         "UseRandomMove"   # Metronome
  188.       ]
  189.     end
  190.   unless battler.effects[PBEffects::Encore] > 0 || !battler.lastRegularMoveUsed ||
  191.     moveBlacklist.include?(GameData::Move.get(battler.lastRegularMoveUsed).function_code)
  192.       battler.effects[PBEffects::Encore]     = 4
  193.       battler.effects[PBEffects::EncoreMove] = battler.lastRegularMoveUsed
  194.       battle.pbDisplay(_INTL("{1} received an encore!", battler.pbThis))
  195.       battler.pbItemStatusCureCheck
  196.   end
  197. })
  198.  
  199. Battle::PokeBallEffects::OnFailCatch.add(:BERRYBALL, proc { |ball, battle, battler|
  200.   if battler.canHeal?
  201.     battler.pbRecoverHP(20)
  202.     itemName = GameData::Item.get(:BERRYBALL).name
  203.     battle.pbDisplay(_INTL("{1} ate the {2} and recovered HP!", battler.pbThis, itemName))
  204.   end
  205. })
  206.  
  207. Battle::PokeBallEffects::OnFailCatch.add(:LOCKBALL, proc { |ball, battle, battler|
  208.   unless battler.effects[PBEffects::Substitute] > 0 || battler.effects[PBEffects::MeanLook] >= 0 || (Settings::MORE_TYPE_EFFECTS && battler.pbHasType?(:GHOST))
  209.     battler.effects[PBEffects::MeanLook] = 999
  210.     battle.pbDisplay(_INTL("{1} can no longer escape!", battler.pbThis))
  211.   end
  212. })
  213.  
  214. Battle::PokeBallEffects::OnFailCatch.add(:VACUUMBALL, proc { |ball, battle, battler|
  215.   if battler.pbOwnSide.effects[PBEffects::LightScreen] > 0
  216.     battler.pbOwnSide.effects[PBEffects::LightScreen] = 0
  217.     battle.pbDisplay(_INTL("{1}'s Light Screen wore off!", battler.pbTeam))
  218.   end
  219.   if battler.pbOwnSide.effects[PBEffects::Reflect] > 0
  220.     battler.pbOwnSide.effects[PBEffects::Reflect] = 0
  221.     battle.pbDisplay(_INTL("{1}'s Reflect wore off!", battler.pbTeam))
  222.   end
  223.   if battler.pbOwnSide.effects[PBEffects::AuroraVeil] > 0
  224.     battler.pbOwnSide.effects[PBEffects::AuroraVeil] = 0
  225.     battle.pbDisplay(_INTL("{1}'s Aurora Veil wore off!", battler.pbTeam))
  226.   end
  227.   if battler.effects[PBEffects::Substitute] > 0
  228.     battler.effects[PBEffects::Substitute] = 0
  229.     battle.pbDisplay(_INTL("{1}'s substitute faded!", battler.pbThis))
  230.   end
  231.   if battler.pbOwnSide.effects[PBEffects::Safeguard] > 0
  232.     battler.pbOwnSide.effects[PBEffects::Safeguard] = 0
  233.     battle.pbDisplay(_INTL("{1}'s is no longer protected by Safeguard!", battler.pbTeam))
  234.   end
  235.   if battler.pbOwnSide.effects[PBEffects::Mist] > 0
  236.     battler.pbOwnSide.effects[PBEffects::Mist] = 0
  237.     battle.pbDisplay(_INTL("{1}'s is no longer protected by mist!", battler.pbTeam))
  238.   end
  239.   if battler.pbOwnSide.effects[PBEffects::LuckyChant] > 0
  240.     battler.pbOwnSide.effects[PBEffects::LuckyChant] = 0
  241.     battle.pbDisplay(_INTL("{1}'s Lucky Chant wore off!", battler.pbTeam))
  242.   end
  243.   if battler.pbOwnSide.effects[PBEffects::Tailwind] > 0
  244.     battler.pbOwnSide.effects[PBEffects::Tailwind] = 0
  245.     battle.pbDisplay(_INTL("{1}'s Tailwind petered out!", battler.pbTeam))
  246.   end
  247.   if battler.pbOwnSide.effects[PBEffects::Rainbow] > 0
  248.     battler.pbOwnSide.effects[PBEffects::Rainbow] = 0
  249.     battle.pbDisplay(_INTL("The rainbow on {1}'s side disappeared!", battler.pbTeam))
  250.   end
  251. })
  252.  
  253. Battle::PokeBallEffects::OnFailCatch.add(:RUSBALL, proc { |ball, battle, battler|
  254.   battler.pokemon.givePokerus if rand(65_536) < (Settings::POKERUS_CHANCE / 2)
  255. })
  256. Battle::PokeBallEffects::OnCatch.add(:RUSBALL, proc { |ball, battle, pkmn|
  257.   pkmn.givePokerus if rand(65_536) < (Settings::POKERUS_CHANCE / 2)
  258. })
  259.  
  260. Battle::PokeBallEffects::ModifyCatchRate.add(:CLEARBALL, proc { |ball, catchRate, battle, battler|
  261.   catchRate *= 3 if battler.pbHasType?(:NORMAL) || [:PROTEAN,:COLORCHANGE,:MULTITYPE,:RKSSYSTEM,:LIBERO,:MIMICRY].include?(battler.pokemon.ability)
  262.   next catchRate
  263. })
  264.  
  265. Battle::PokeBallEffects::ModifyCatchRate.add(:KNUCKLEBALL, proc { |ball, catchRate, battle, battler|
  266.   catchRate *= 3 if battler.pbHasType?(:FIGHTING) || battler.pbHasType?(:DARK)
  267.   next catchRate
  268. })
  269.  
  270. Battle::PokeBallEffects::ModifyCatchRate.add(:FLOATBALL, proc { |ball, catchRate, battle, battler|
  271.   catchRate *= 3 if battler.pbHasType?(:FLYING) || battler.pokemon.hasAbility?(:LEVITATE)
  272.   next catchRate
  273. })
  274.  
  275. Battle::PokeBallEffects::ModifyCatchRate.add(:YULEBALL, proc { |ball, catchRate, battle, battler|
  276.   catchRate *= 3 if battler.pbHasType?(:FAIRY) || battler.pbHasType?(:GRASS) || battler.pbHasType?(:ICE)
  277.   next catchRate
  278. })
  279.  
  280. Battle::PokeBallEffects::ModifyCatchRate.add(:MAGMABALL, proc { |ball, catchRate, battle, battler|
  281.   catchRate *= 3 if battler.pbHasType?(:FIRE) || battler.pbHasType?(:GROUND) || battler.pbHasType?(:ROCK)
  282.   next catchRate
  283. })
  284.  
  285. Battle::PokeBallEffects::ModifyCatchRate.add(:SPIRITBALL, proc { |ball, catchRate, battle, battler|
  286.   catchRate *= 3 if battler.pbHasType?(:GHOST) || battler.pbHasType?(:PSYCHIC)
  287.   next catchRate
  288. })
  289.  
  290. Battle::PokeBallEffects::ModifyCatchRate.add(:JUNKBALL, proc { |ball, catchRate, battle, battler|
  291.   catchRate *= 3 if battler.pbHasType?(:STEEL) || battler.pokemon.species_data.has_flag?("Inorganic")
  292.   next catchRate
  293. })
  294.  
  295. Battle::PokeBallEffects::ModifyCatchRate.add(:MEADOWBALL, proc { |ball, catchRate, battle, battler|
  296.   catchRate *= 3 if battle.field.terrain == :Grassy
  297.   next catchRate
  298. })
  299.  
  300. Battle::PokeBallEffects::ModifyCatchRate.add(:MISTBALL, proc { |ball, catchRate, battle, battler|
  301.   catchRate *= 3 if battle.field.terrain == :Misty
  302.   next catchRate
  303. })
  304.  
  305. Battle::PokeBallEffects::ModifyCatchRate.add(:STORMBALL, proc { |ball, catchRate, battle, battler|
  306.   catchRate *= 3 if battle.field.terrain == :Electric
  307.   next catchRate
  308. })
  309.  
  310. Battle::PokeBallEffects::ModifyCatchRate.add(:WARPBALL, proc { |ball, catchRate, battle, battler|
  311.   catchRate *= 3 if battle.field.terrain == :Psychic || battle.field.effects[PBEffects::TrickRoom] > 0 || battle.field.effects[PBEffects::WonderRoom] > 0 || battle.field.effects[PBEffects::MagicRoom] > 0
  312.   next catchRate
  313. })
  314.  
  315. Battle::PokeBallEffects::ModifyCatchRate.add(:SANDBALL, proc { |ball, catchRate, battle, battler|
  316.   catchRate *= 3 if [:Sandstorm].include?(battler.effectiveWeather)
  317.   next catchRate
  318. })
  319.  
  320. Battle::PokeBallEffects::ModifyCatchRate.add(:DRIZZLEBALL, proc { |ball, catchRate, battle, battler|
  321.   catchRate *= 3 if [:Rain, :HeavyRain].include?(battler.effectiveWeather)
  322.   next catchRate
  323. })
  324.  
  325. Battle::PokeBallEffects::ModifyCatchRate.add(:HAILBALL, proc { |ball, catchRate, battle, battler|
  326.   catchRate *= 3 if [:Hail, :Snow].include?(battler.effectiveWeather)
  327.   next catchRate
  328. })
  329.  
  330. Battle::PokeBallEffects::ModifyCatchRate.add(:DROUGHTBALL, proc { |ball, catchRate, battle, battler|
  331.   catchRate *= 3 if [:Sun, :HarshSun].include?(battler.effectiveWeather)
  332.   next catchRate
  333. })
  334.  
  335. Battle::PokeBallEffects::ModifyCatchRate.add(:KINBALL, proc { |ball, catchRate, battle, battler|
  336.   catchRate *= 3 if battler.pokemon.species_data.egg_groups.include?(:Humanlike) || battler.pokemon.species_data.egg_groups.include?(:Fairy)
  337.   next catchRate
  338. })
  339.  
  340. Battle::PokeBallEffects::ModifyCatchRate.add(:FIELDBALL, proc { |ball, catchRate, battle, battler|
  341.   catchRate *= 3 if battler.pokemon.species_data.egg_groups.include?(:Field)
  342.   next catchRate
  343. })
  344.  
  345. Battle::PokeBallEffects::ModifyCatchRate.add(:MORPHBALL, proc { |ball, catchRate, battle, battler|
  346.   catchRate *= 3 if battler.pokemon.species_data.egg_groups.include?(:Amorphous)
  347.   next catchRate
  348. })
  349.  
  350. Battle::PokeBallEffects::ModifyCatchRate.add(:NATUREBALL, proc { |ball, catchRate, battle, battler|
  351.   catchRate *= 3 if battler.pokemon.species_data.egg_groups.include?(:Bug) || battler.pokemon.species_data.egg_groups.include?(:Grass)
  352.   next catchRate
  353. })
  354.  
  355. Battle::PokeBallEffects::ModifyCatchRate.add(:OREBALL, proc { |ball, catchRate, battle, battler|
  356.   catchRate *= 3 if battler.pokemon.species_data.egg_groups.include?(:Mineral)
  357.   next catchRate
  358. })
  359.  
  360. Battle::PokeBallEffects::ModifyCatchRate.add(:MONSTERBALL, proc { |ball, catchRate, battle, battler|
  361.   catchRate *= 3 if battler.pokemon.species_data.egg_groups.include?(:Monster)
  362.   next catchRate
  363. })
  364.  
  365. Battle::PokeBallEffects::ModifyCatchRate.add(:ELDERBALL, proc { |ball, catchRate, battle, battler|
  366.   catchRate *= 3 if battler.pokemon.species_data.egg_groups.include?(:Dragon)
  367.   next catchRate
  368. })
  369.  
  370. Battle::PokeBallEffects::ModifyCatchRate.add(:UNOWNBALL, proc { |ball, catchRate, battle, battler|
  371.   catchRate *= 3 if battler.isSpecies?(:UNOWN)
  372.   next catchRate
  373. })
  374.  
  375. Battle::PokeBallEffects::ModifyCatchRate.add(:MYTHICBALL, proc { |ball, catchRate, battle, battler|
  376.   catchRate *= 3 if battler.pokemon.species_data.has_flag?("Mythic") || battler.pokemon.species_data.has_flag?("Legendary")
  377.   next catchRate
  378. })
  379.  
  380.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement