Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Battle::PokeBallEffects::OnFailCatch.add(:DEXBALL, proc { |ball, battle, battler|
- if !battle.pbPlayer.owned?(battler.species)
- battle.pbPlayer.pokedex.set_owned(battler.species)
- if $player.has_pokedex
- battle.pbDisplayPaused(_INTL("{1}'s data was added to the Pokédex.", battler.pokemon.speciesName))
- battle.pbPlayer.pokedex.register_last_seen(battler.pokemon)
- battle.scene.pbShowPokedex(battler.species)
- end
- end
- })
- Battle::PokeBallEffects::OnFailCatch.add(:CYCLEBALL, proc { |ball, battle, battler|
- if [:FROZEN,:SLEEP,:PARALYSIS].include?(battler.status)
- $bag.add(:CYCLEBALL)
- itemName = GameData::Item.get(:CYCLEBALL).name
- battle.pbDisplay(_INTL("The {1} flew back to {2}!", itemName, battle.pbPlayer.name))
- end
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:DAWNBALL, proc { |ball, catchRate, battle, battler|
- multiplier = (Settings::NEW_POKE_BALL_CATCH_RATES) ? 3 : 3.5
- catchRate *= multiplier if battle.time == 0 # Daytime outside of caves
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:LUCKBALL, proc { |ball, catchRate, battle, battler|
- next rand(255)
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:STATBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.hasLoweredStatStages?
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:EVOBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 unless battler.pokemon.species_data.get_previous_species == battler.species
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:SHINYBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.shiny?
- next catchRate
- })
- Battle::PokeBallEffects::OnCatch.add(:VALUEBALL, proc { |ball, battle, pkmn|
- stats = []
- GameData::Stat.each_main { |s| stats.push(s.id) }
- chosen_stats = stats.sample(3)
- chosen_stats.each { |stat| pkmn.iv[stat] = 31 }
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:SHRINKBALL, proc { |ball, catchRate, battle, battler|
- next 0 if catchRate == 0
- weight = battler.pbWeight
- if Settings::NEW_POKE_BALL_CATCH_RATES
- if weight <= 1000
- catchRate += 30
- elsif weight <= 2000
- catchRate += 20
- elsif weight > 3000
- catchRate -= 20
- end
- else
- if weight <= 2048
- catchRate += 40
- elsif weight <= 3072
- catchRate += 30
- elsif weight >= 4096
- catchRate += 20
- else
- catchRate -= 20
- end
- end
- catchRate += 40 if battler.effects[PBEffects::Minimize]
- next catchRate.clamp(1, 255)
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:TRAPBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.effects[PBEffects::Trapping] > 0
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:RAGEBALL, proc { |ball, catchRate, battle, battler|
- lrf = battler.pbOpposingSide.effects[PBEffects::LastRoundFainted]
- catchRate *= 3 if lrf >= 0 && lrf == battle.turnCount - 1
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:EXECUTIVEBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battle.trainerBattle?
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:PARABALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pbHasType?(:ELECTRIC) || battler.paralyzed?
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:BURNBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pbHasType?(:FIRE) || battler.burned?
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:POISONBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pbHasType?(:POISON) || battler.poisoned?
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:FREEZEBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pbHasType?(:ICE) || battler.frozen?
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:DIZZYBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pbHasType?(:PSYCHIC) || battler.effects[PBEffects::Confusion] > 0
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:MINUSBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= [(5 - $bag.quantity(:MINUSBALL)),0].min
- next catchRate
- })
- Battle::PokeBallEffects::OnFailCatch.add(:DIVIDEBALL, proc { |ball, battle, battler|
- battler.pbReduceHP((battler.hp / 2.0).round, false)
- battle.pbDisplay(_INTL("{1}'s health was divided in half!", battler.pbThis))
- })
- Battle::PokeBallEffects::OnFailCatch.add(:EQUALBALL, proc { |ball, battle, battler|
- battler.pbRecoverHP(battler.totalhp)
- battler.moves.length.times do |i|
- pbBattleRestorePP(battler.pokemon, battler, i, battler.pokemon.moves[i].total_pp)
- end
- battle.pbDisplay(_INTL("{1}'s HP and PP were restored!", battler.pbThis))
- })
- Battle::PokeBallEffects::OnFailCatch.add(:TAUNTBALL, proc { |ball, battle, battler|
- unless battler.effects[PBEffects::Taunt] > 0
- battler.effects[PBEffects::Taunt] = 4
- battle.pbDisplay(_INTL("{1} fell for the taunt!", battler.pbThis))
- battler.pbItemStatusCureCheck
- end
- })
- Battle::PokeBallEffects::OnFailCatch.add(:PENALTYBALL, proc { |ball, battle, battler|
- unless battler.effects[PBEffects::Disable] > 0 || !battler.lastRegularMoveUsed
- battler.effects[PBEffects::Disable] = 5
- battler.effects[PBEffects::DisableMove] = battler.lastRegularMoveUsed
- battle.pbDisplay(_INTL("{1}'s {2} was disabled!", battler.pbThis,
- GameData::Move.get(battler.lastRegularMoveUsed).name))
- battler.pbItemStatusCureCheck
- end
- })
- Battle::PokeBallEffects::OnFailCatch.add(:CONCUSSBALL, proc { |ball, battle, battler|
- battler.pbFlinch
- })
- Battle::PokeBallEffects::OnFailCatch.add(:DOWSEBALL, proc { |ball, battle, battler|
- unless battler.effects[PBEffects::Foresight]
- battler.effects[PBEffects::Foresight] = true
- battle.pbDisplay(_INTL("{1} was identified!", battler.pbThis))
- end
- })
- Battle::PokeBallEffects::OnFailCatch.add(:CHOICEBALL, proc { |ball, battle, battler|
- moveBlacklist = [
- "DisableTargetUsingDifferentMove", # Encore
- # Struggle
- "Struggle", # Struggle
- # Moves that affect the moveset
- "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic
- "ReplaceMoveWithTargetLastMoveUsed", # Sketch
- "TransformUserIntoTarget", # Transform
- # Moves that call other moves (see also below)
- "UseLastMoveUsedByTarget" # Mirror Move
- ]
- if Settings::MECHANICS_GENERATION >= 7
- moveBlacklist += [
- # Moves that call other moves
- # "UseLastMoveUsedByTarget", # Mirror Move # See above
- "UseLastMoveUsed", # Copycat
- "UseMoveTargetIsAboutToUse", # Me First
- "UseMoveDependingOnEnvironment", # Nature Power
- "UseRandomUserMoveIfAsleep", # Sleep Talk
- "UseRandomMoveFromUserParty", # Assist
- "UseRandomMove" # Metronome
- ]
- end
- unless battler.effects[PBEffects::Encore] > 0 || !battler.lastRegularMoveUsed ||
- moveBlacklist.include?(GameData::Move.get(battler.lastRegularMoveUsed).function_code)
- battler.effects[PBEffects::Encore] = 4
- battler.effects[PBEffects::EncoreMove] = battler.lastRegularMoveUsed
- battle.pbDisplay(_INTL("{1} received an encore!", battler.pbThis))
- battler.pbItemStatusCureCheck
- end
- })
- Battle::PokeBallEffects::OnFailCatch.add(:BERRYBALL, proc { |ball, battle, battler|
- if battler.canHeal?
- battler.pbRecoverHP(20)
- itemName = GameData::Item.get(:BERRYBALL).name
- battle.pbDisplay(_INTL("{1} ate the {2} and recovered HP!", battler.pbThis, itemName))
- end
- })
- Battle::PokeBallEffects::OnFailCatch.add(:LOCKBALL, proc { |ball, battle, battler|
- unless battler.effects[PBEffects::Substitute] > 0 || battler.effects[PBEffects::MeanLook] >= 0 || (Settings::MORE_TYPE_EFFECTS && battler.pbHasType?(:GHOST))
- battler.effects[PBEffects::MeanLook] = 999
- battle.pbDisplay(_INTL("{1} can no longer escape!", battler.pbThis))
- end
- })
- Battle::PokeBallEffects::OnFailCatch.add(:VACUUMBALL, proc { |ball, battle, battler|
- if battler.pbOwnSide.effects[PBEffects::LightScreen] > 0
- battler.pbOwnSide.effects[PBEffects::LightScreen] = 0
- battle.pbDisplay(_INTL("{1}'s Light Screen wore off!", battler.pbTeam))
- end
- if battler.pbOwnSide.effects[PBEffects::Reflect] > 0
- battler.pbOwnSide.effects[PBEffects::Reflect] = 0
- battle.pbDisplay(_INTL("{1}'s Reflect wore off!", battler.pbTeam))
- end
- if battler.pbOwnSide.effects[PBEffects::AuroraVeil] > 0
- battler.pbOwnSide.effects[PBEffects::AuroraVeil] = 0
- battle.pbDisplay(_INTL("{1}'s Aurora Veil wore off!", battler.pbTeam))
- end
- if battler.effects[PBEffects::Substitute] > 0
- battler.effects[PBEffects::Substitute] = 0
- battle.pbDisplay(_INTL("{1}'s substitute faded!", battler.pbThis))
- end
- if battler.pbOwnSide.effects[PBEffects::Safeguard] > 0
- battler.pbOwnSide.effects[PBEffects::Safeguard] = 0
- battle.pbDisplay(_INTL("{1}'s is no longer protected by Safeguard!", battler.pbTeam))
- end
- if battler.pbOwnSide.effects[PBEffects::Mist] > 0
- battler.pbOwnSide.effects[PBEffects::Mist] = 0
- battle.pbDisplay(_INTL("{1}'s is no longer protected by mist!", battler.pbTeam))
- end
- if battler.pbOwnSide.effects[PBEffects::LuckyChant] > 0
- battler.pbOwnSide.effects[PBEffects::LuckyChant] = 0
- battle.pbDisplay(_INTL("{1}'s Lucky Chant wore off!", battler.pbTeam))
- end
- if battler.pbOwnSide.effects[PBEffects::Tailwind] > 0
- battler.pbOwnSide.effects[PBEffects::Tailwind] = 0
- battle.pbDisplay(_INTL("{1}'s Tailwind petered out!", battler.pbTeam))
- end
- if battler.pbOwnSide.effects[PBEffects::Rainbow] > 0
- battler.pbOwnSide.effects[PBEffects::Rainbow] = 0
- battle.pbDisplay(_INTL("The rainbow on {1}'s side disappeared!", battler.pbTeam))
- end
- })
- Battle::PokeBallEffects::OnFailCatch.add(:RUSBALL, proc { |ball, battle, battler|
- battler.pokemon.givePokerus if rand(65_536) < (Settings::POKERUS_CHANCE / 2)
- })
- Battle::PokeBallEffects::OnCatch.add(:RUSBALL, proc { |ball, battle, pkmn|
- pkmn.givePokerus if rand(65_536) < (Settings::POKERUS_CHANCE / 2)
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:CLEARBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pbHasType?(:NORMAL) || [:PROTEAN,:COLORCHANGE,:MULTITYPE,:RKSSYSTEM,:LIBERO,:MIMICRY].include?(battler.pokemon.ability)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:KNUCKLEBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pbHasType?(:FIGHTING) || battler.pbHasType?(:DARK)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:FLOATBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pbHasType?(:FLYING) || battler.pokemon.hasAbility?(:LEVITATE)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:YULEBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pbHasType?(:FAIRY) || battler.pbHasType?(:GRASS) || battler.pbHasType?(:ICE)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:MAGMABALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pbHasType?(:FIRE) || battler.pbHasType?(:GROUND) || battler.pbHasType?(:ROCK)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:SPIRITBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pbHasType?(:GHOST) || battler.pbHasType?(:PSYCHIC)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:JUNKBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pbHasType?(:STEEL) || battler.pokemon.species_data.has_flag?("Inorganic")
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:MEADOWBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battle.field.terrain == :Grassy
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:MISTBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battle.field.terrain == :Misty
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:STORMBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battle.field.terrain == :Electric
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:WARPBALL, proc { |ball, catchRate, battle, battler|
- 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
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:SANDBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if [:Sandstorm].include?(battler.effectiveWeather)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:DRIZZLEBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if [:Rain, :HeavyRain].include?(battler.effectiveWeather)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:HAILBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if [:Hail, :Snow].include?(battler.effectiveWeather)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:DROUGHTBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if [:Sun, :HarshSun].include?(battler.effectiveWeather)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:KINBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pokemon.species_data.egg_groups.include?(:Humanlike) || battler.pokemon.species_data.egg_groups.include?(:Fairy)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:FIELDBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pokemon.species_data.egg_groups.include?(:Field)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:MORPHBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pokemon.species_data.egg_groups.include?(:Amorphous)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:NATUREBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pokemon.species_data.egg_groups.include?(:Bug) || battler.pokemon.species_data.egg_groups.include?(:Grass)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:OREBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pokemon.species_data.egg_groups.include?(:Mineral)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:MONSTERBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pokemon.species_data.egg_groups.include?(:Monster)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:ELDERBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pokemon.species_data.egg_groups.include?(:Dragon)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:UNOWNBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.isSpecies?(:UNOWN)
- next catchRate
- })
- Battle::PokeBallEffects::ModifyCatchRate.add(:MYTHICBALL, proc { |ball, catchRate, battle, battler|
- catchRate *= 3 if battler.pokemon.species_data.has_flag?("Mythic") || battler.pokemon.species_data.has_flag?("Legendary")
- next catchRate
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement