mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Refactored ability/item/ball battle handlers, added "UltraBeast" species flag for Beast Ball
This commit is contained in:
@@ -171,8 +171,3 @@ end
|
||||
def nil_or_empty?(string)
|
||||
return string.nil? || !string.is_a?(String) || string.size == 0
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# This is only here to make the battle classes easier to define later.
|
||||
#===============================================================================
|
||||
class Battle; end
|
||||
|
||||
@@ -87,8 +87,6 @@ class Battle
|
||||
attr_accessor :moldBreaker # True if Mold Breaker applies
|
||||
attr_reader :struggle # The Struggle move
|
||||
|
||||
include Battle::Common
|
||||
|
||||
def pbRandom(x); return rand(x); end
|
||||
|
||||
#=============================================================================
|
||||
@@ -703,7 +701,7 @@ class Battle
|
||||
@field.weather = newWeather
|
||||
duration = (fixedDuration) ? 5 : -1
|
||||
if duration>0 && user && user.itemActive?
|
||||
duration = BattleHandlers.triggerWeatherExtenderItem(user.item,
|
||||
duration = Battle::ItemEffects.triggerWeatherExtender(user.item,
|
||||
@field.weather,duration,user,self)
|
||||
end
|
||||
@field.weatherDuration = duration
|
||||
@@ -781,7 +779,7 @@ class Battle
|
||||
@field.terrain = newTerrain
|
||||
duration = (fixedDuration) ? 5 : -1
|
||||
if duration>0 && user && user.itemActive?
|
||||
duration = BattleHandlers.triggerTerrainExtenderItem(user.item,
|
||||
duration = Battle::ItemEffects.triggerTerrainExtender(user.item,
|
||||
newTerrain,duration,user,self)
|
||||
end
|
||||
@field.terrainDuration = duration
|
||||
@@ -478,7 +478,7 @@ class Battle
|
||||
@battlers.each do |b|
|
||||
next if !b
|
||||
pbCancelChoice(b.index) # Restore unused items to Bag
|
||||
BattleHandlers.triggerAbilityOnSwitchOut(b.ability,b,true) if b.abilityActive?
|
||||
Battle::AbilityEffects.triggerOnSwitchOut(b.ability, b, true) if b.abilityActive?
|
||||
end
|
||||
pbParty(0).each_with_index do |pkmn,i|
|
||||
next if !pkmn
|
||||
@@ -63,8 +63,8 @@ class Battle
|
||||
evTotal = 0
|
||||
GameData::Stat.each_main { |s| evTotal += pkmn.ev[s.id] }
|
||||
# Modify EV yield based on pkmn's held item
|
||||
if !BattleHandlers.triggerEVGainModifierItem(pkmn.item,pkmn,evYield)
|
||||
BattleHandlers.triggerEVGainModifierItem(@initialItems[0][idxParty],pkmn,evYield)
|
||||
if !Battle::ItemEffects.triggerEVGainModifier(pkmn.item, pkmn, evYield)
|
||||
Battle::ItemEffects.triggerEVGainModifier(@initialItems[0][idxParty], pkmn, evYield)
|
||||
end
|
||||
# Double EV gain because of Pokérus
|
||||
if pkmn.pokerusStage>=1 # Infected or cured
|
||||
@@ -147,9 +147,9 @@ class Battle
|
||||
# Exp. Charm increases Exp gained
|
||||
exp = exp * 3 / 2 if $bag.has?(:EXPCHARM)
|
||||
# Modify Exp gain based on pkmn's held item
|
||||
i = BattleHandlers.triggerExpGainModifierItem(pkmn.item,pkmn,exp)
|
||||
i = Battle::ItemEffects.triggerExpGainModifier(pkmn.item, pkmn, exp)
|
||||
if i<0
|
||||
i = BattleHandlers.triggerExpGainModifierItem(@initialItems[0][idxParty],pkmn,exp)
|
||||
i = Battle::ItemEffects.triggerExpGainModifier(@initialItems[0][idxParty], pkmn, exp)
|
||||
end
|
||||
exp = i if i>=0
|
||||
# Boost Exp gained with high affection
|
||||
@@ -155,7 +155,7 @@ class Battle
|
||||
move = @choices[b.index][2]
|
||||
pri = move.pbPriority(b)
|
||||
if b.abilityActive?
|
||||
pri = BattleHandlers.triggerPriorityChangeAbility(b.ability,b,move,pri)
|
||||
pri = Battle::AbilityEffects.triggerPriorityChange(b.ability, b, move, pri)
|
||||
end
|
||||
bArray[3] = pri
|
||||
@choices[b.index][4] = pri
|
||||
@@ -167,8 +167,7 @@ class Battle
|
||||
subPri = 0
|
||||
# Abilities (Stall)
|
||||
if b.abilityActive?
|
||||
newSubPri = BattleHandlers.triggerPriorityBracketChangeAbility(b.ability,
|
||||
b,subPri,self)
|
||||
newSubPri = Battle::AbilityEffects.triggerPriorityBracketChange(b.ability, b, subPri, self)
|
||||
if subPri!=newSubPri
|
||||
subPri = newSubPri
|
||||
b.effects[PBEffects::PriorityAbility] = true
|
||||
@@ -177,8 +176,7 @@ class Battle
|
||||
end
|
||||
# Items (Quick Claw, Custap Berry, Lagging Tail, Full Incense)
|
||||
if b.itemActive?
|
||||
newSubPri = BattleHandlers.triggerPriorityBracketChangeItem(b.item,
|
||||
b,subPri,self)
|
||||
newSubPri = Battle::ItemEffects.triggerPriorityBracketChange(b.item, b, subPri, self)
|
||||
if subPri!=newSubPri
|
||||
subPri = newSubPri
|
||||
b.effects[PBEffects::PriorityAbility] = false
|
||||
@@ -56,12 +56,12 @@ class Battle
|
||||
return true if battler.fainted?
|
||||
# Ability/item effects that allow switching no matter what
|
||||
if battler.abilityActive?
|
||||
if BattleHandlers.triggerCertainSwitchingUserAbility(battler.ability,battler,self)
|
||||
if Battle::AbilityEffects.triggerCertainSwitching(battler.ability, battler, self)
|
||||
return true
|
||||
end
|
||||
end
|
||||
if battler.itemActive?
|
||||
if BattleHandlers.triggerCertainSwitchingUserItem(battler.item,battler,self)
|
||||
if Battle::ItemEffects.triggerCertainSwitching(battler.item, battler, self)
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -75,7 +75,7 @@ class Battle
|
||||
# Trapping abilities/items
|
||||
allOtherSideBattlers(idxBattler).each do |b|
|
||||
next if !b.abilityActive?
|
||||
if BattleHandlers.triggerTrappingTargetAbility(b.ability,battler,b,self)
|
||||
if Battle::AbilityEffects.triggerTrappingByTarget(b.ability, battler, b, self)
|
||||
partyScene.pbDisplay(_INTL("{1}'s {2} prevents switching!",
|
||||
b.pbThis,b.abilityName)) if partyScene
|
||||
return false
|
||||
@@ -83,7 +83,7 @@ class Battle
|
||||
end
|
||||
allOtherSideBattlers(idxBattler).each do |b|
|
||||
next if !b.itemActive?
|
||||
if BattleHandlers.triggerTrappingTargetItem(b.item,battler,b,self)
|
||||
if Battle::ItemEffects.triggerTrappingByTarget(b.item,battler,b,self)
|
||||
partyScene.pbDisplay(_INTL("{1}'s {2} prevents switching!",
|
||||
b.pbThis,b.itemName)) if partyScene
|
||||
return false
|
||||
@@ -353,12 +353,12 @@ class Battle
|
||||
b.pbContinualAbilityChecks(true)
|
||||
# Abilities that trigger upon switching in
|
||||
if (!b.fainted? && b.unstoppableAbility?) || b.abilityActive?
|
||||
BattleHandlers.triggerAbilityOnSwitchIn(b.ability, b, self)
|
||||
Battle::AbilityEffects.triggerOnSwitchIn(b.ability, b, self)
|
||||
end
|
||||
pbEndPrimordialWeather # Checking this again just in case
|
||||
# Items that trigger upon switching in (Air Balloon message)
|
||||
if b.itemActive?
|
||||
BattleHandlers.triggerItemOnSwitchIn(b.item, b, self)
|
||||
Battle::ItemEffects.triggerOnSwitchIn(b.item, b, self)
|
||||
end
|
||||
# Berry check, status-curing ability check
|
||||
b.pbHeldItemTriggerCheck
|
||||
@@ -8,15 +8,15 @@ class Battle
|
||||
return false if !@canRun && !battler.opposes?
|
||||
return true if battler.pbHasType?(:GHOST) && Settings::MORE_TYPE_EFFECTS
|
||||
return true if battler.abilityActive? &&
|
||||
BattleHandlers.triggerRunFromBattleAbility(battler.ability,battler)
|
||||
Battle::AbilityEffects.triggerCertainEscapeFromBattle(battler.ability, battler)
|
||||
return true if battler.itemActive? &&
|
||||
BattleHandlers.triggerRunFromBattleItem(battler.item,battler)
|
||||
Battle::ItemEffects.triggerCertainEscapeFromBattle(battler.item, battler)
|
||||
return false if battler.trappedInBattle?
|
||||
allOtherSideBattlers(idxBattler).each do |b|
|
||||
return false if b.abilityActive? &&
|
||||
BattleHandlers.triggerTrappingTargetAbility(b.ability,battler,b,self)
|
||||
Battle::AbilityEffects.triggerTrappingByTarget(b.ability, battler, b, self)
|
||||
return false if b.itemActive? &&
|
||||
BattleHandlers.triggerTrappingTargetItem(b.item,battler,b,self)
|
||||
Battle::ItemEffects.triggerTrappingByTarget(b.item, battler, b, self)
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -76,7 +76,7 @@ class Battle
|
||||
end
|
||||
# Abilities that guarantee escape
|
||||
if battler.abilityActive?
|
||||
if BattleHandlers.triggerRunFromBattleAbility(battler.ability,battler)
|
||||
if Battle::AbilityEffects.triggerCertainEscapeFromBattle(battler.ability, battler)
|
||||
pbShowAbilitySplash(battler,true)
|
||||
pbHideAbilitySplash(battler)
|
||||
pbSEPlay("Battle flee")
|
||||
@@ -87,10 +87,9 @@ class Battle
|
||||
end
|
||||
# Held items that guarantee escape
|
||||
if battler.itemActive?
|
||||
if BattleHandlers.triggerRunFromBattleItem(battler.item,battler)
|
||||
if Battle::ItemEffects.triggerCertainEscapeFromBattle(battler.item, battler)
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplayPaused(_INTL("{1} fled using its {2}!",
|
||||
battler.pbThis,battler.itemName))
|
||||
pbDisplayPaused(_INTL("{1} fled using its {2}!", battler.pbThis,battler.itemName))
|
||||
@decision = 3
|
||||
return 1
|
||||
end
|
||||
@@ -103,14 +102,14 @@ class Battle
|
||||
# Trapping abilities/items
|
||||
allOtherSideBattlers(idxBattler).each do |b|
|
||||
next if !b.abilityActive?
|
||||
if BattleHandlers.triggerTrappingTargetAbility(b.ability,battler,b,self)
|
||||
if Battle::AbilityEffects.triggerTrappingByTarget(b.ability, battler, b, self)
|
||||
pbDisplayPaused(_INTL("{1} prevents escape with {2}!",b.pbThis,b.abilityName))
|
||||
return 0
|
||||
end
|
||||
end
|
||||
allOtherSideBattlers(idxBattler).each do |b|
|
||||
next if !b.itemActive?
|
||||
if BattleHandlers.triggerTrappingTargetItem(b.item,battler,b,self)
|
||||
if Battle::ItemEffects.triggerTrappingByTarget(b.item, battler, b, self)
|
||||
pbDisplayPaused(_INTL("{1} prevents escape with {2}!",b.pbThis,b.itemName))
|
||||
return 0
|
||||
end
|
||||
@@ -132,7 +132,7 @@ class Battle
|
||||
old_ability = battler.ability_id
|
||||
# Break Illusion
|
||||
if battler.hasActiveAbility?(:ILLUSION)
|
||||
BattleHandlers.triggerTargetAbilityOnHit(battler.ability,nil,battler,nil,self)
|
||||
Battle::AbilityEffects.triggerOnBeingHit(battler.ability, nil, battler, nil, self)
|
||||
end
|
||||
# Mega Evolve
|
||||
case battler.pokemon.megaMessage
|
||||
@@ -6,9 +6,9 @@ class Battle
|
||||
def pbAttackPhasePriorityChangeMessages
|
||||
pbPriority.each do |b|
|
||||
if b.effects[PBEffects::PriorityAbility] && b.abilityActive?
|
||||
BattleHandlers.triggerPriorityBracketUseAbility(b.ability,b,self)
|
||||
Battle::AbilityEffects.triggerPriorityBracketUse(b.ability, b, self)
|
||||
elsif b.effects[PBEffects::PriorityItem] && b.itemActive?
|
||||
BattleHandlers.triggerPriorityBracketUseItem(b.item,b,self)
|
||||
Battle::ItemEffects.triggerPriorityBracketUse(b.item, b, self)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -70,7 +70,7 @@ class Battle
|
||||
priority.each do |b|
|
||||
# Weather-related abilities
|
||||
if b.abilityActive?
|
||||
BattleHandlers.triggerEORWeatherAbility(b.ability, b.effectiveWeather, b, self)
|
||||
Battle::AbilityEffects.triggerEndOfRoundWeather(b.ability, b.effectiveWeather, b, self)
|
||||
b.pbFaint if b.fainted?
|
||||
end
|
||||
# Weather damage
|
||||
@@ -279,9 +279,9 @@ class Battle
|
||||
pbDisplay(_INTL("{1}'s HP was restored.",b.pbThis))
|
||||
end
|
||||
# Healer, Hydration, Shed Skin
|
||||
BattleHandlers.triggerEORHealingAbility(b.ability,b,self) if b.abilityActive?
|
||||
Battle::AbilityEffects.triggerEndOfRoundHealing(b.ability, b, self) if b.abilityActive?
|
||||
# Black Sludge, Leftovers
|
||||
BattleHandlers.triggerEORHealingItem(b.item,b,self) if b.itemActive?
|
||||
Battle::ItemEffects.triggerEndOfRoundHealing(b.item, b, self) if b.itemActive?
|
||||
end
|
||||
# Self-curing of status due to affection
|
||||
if Settings::AFFECTION_EFFECTS && @internalBattle
|
||||
@@ -597,11 +597,11 @@ class Battle
|
||||
end
|
||||
end
|
||||
# Bad Dreams, Moody, Speed Boost
|
||||
BattleHandlers.triggerEOREffectAbility(b.ability,b,self) if b.abilityActive?
|
||||
Battle::AbilityEffects.triggerEndOfRoundEffect(b.ability, b, self) if b.abilityActive?
|
||||
# Flame Orb, Sticky Barb, Toxic Orb
|
||||
BattleHandlers.triggerEOREffectItem(b.item,b,self) if b.itemActive?
|
||||
Battle::ItemEffects.triggerEndOfRoundEffect(b.item, b, self) if b.itemActive?
|
||||
# Harvest, Pickup, Ball Fetch
|
||||
BattleHandlers.triggerEORGainItemAbility(b.ability,b,self) if b.abilityActive?
|
||||
Battle::AbilityEffects.triggerEndOfRoundGainItem(b.ability, b, self) if b.abilityActive?
|
||||
end
|
||||
pbGainExp
|
||||
return if @decision>0
|
||||
@@ -248,11 +248,11 @@ class Battle::Battler
|
||||
speedMult = 1.0
|
||||
# Ability effects that alter calculated Speed
|
||||
if abilityActive?
|
||||
speedMult = BattleHandlers.triggerSpeedCalcAbility(self.ability,self,speedMult)
|
||||
speedMult = Battle::AbilityEffects.triggerSpeedCalc(self.ability, self, speedMult)
|
||||
end
|
||||
# Item effects that alter calculated Speed
|
||||
if itemActive?
|
||||
speedMult = BattleHandlers.triggerSpeedCalcItem(self.item,self,speedMult)
|
||||
speedMult = Battle::ItemEffects.triggerSpeedCalc(self.item, self, speedMult)
|
||||
end
|
||||
# Other effects
|
||||
speedMult *= 2 if pbOwnSide.effects[PBEffects::Tailwind]>0
|
||||
@@ -275,10 +275,10 @@ class Battle::Battler
|
||||
ret += @effects[PBEffects::WeightChange]
|
||||
ret = 1 if ret<1
|
||||
if abilityActive? && !@battle.moldBreaker
|
||||
ret = BattleHandlers.triggerWeightCalcAbility(self.ability,self,ret)
|
||||
ret = Battle::AbilityEffects.triggerWeightCalc(self.ability, self, ret)
|
||||
end
|
||||
if itemActive?
|
||||
ret = BattleHandlers.triggerWeightCalcItem(self.item,self,ret)
|
||||
ret = Battle::ItemEffects.triggerWeightCalc(self.item, self, ret)
|
||||
end
|
||||
return [ret,1].max
|
||||
end
|
||||
|
||||
@@ -9,14 +9,14 @@ class Battle::Battler
|
||||
# "counts as having that status", which includes Comatose which can't be
|
||||
# cured.
|
||||
def pbHasStatus?(checkStatus)
|
||||
if BattleHandlers.triggerStatusCheckAbilityNonIgnorable(self.ability,self,checkStatus)
|
||||
if Battle::AbilityEffects.triggerStatusCheckNonIgnorable(self.ability, self, checkStatus)
|
||||
return true
|
||||
end
|
||||
return @status==checkStatus
|
||||
end
|
||||
|
||||
def pbHasAnyStatus?
|
||||
if BattleHandlers.triggerStatusCheckAbilityNonIgnorable(self.ability,self,nil)
|
||||
if Battle::AbilityEffects.triggerStatusCheckNonIgnorable(self.ability, self, nil)
|
||||
return true
|
||||
end
|
||||
return @status != :NONE
|
||||
@@ -102,15 +102,15 @@ class Battle::Battler
|
||||
# Ability immunity
|
||||
immuneByAbility = false
|
||||
immAlly = nil
|
||||
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability,self,newStatus)
|
||||
if Battle::AbilityEffects.triggerStatusImmunityNonIgnorable(self.ability, self, newStatus)
|
||||
immuneByAbility = true
|
||||
elsif selfInflicted || !@battle.moldBreaker
|
||||
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability,self,newStatus)
|
||||
if abilityActive? && Battle::AbilityEffects.triggerStatusImmunity(self.ability, self, newStatus)
|
||||
immuneByAbility = true
|
||||
else
|
||||
allAllies.each do |b|
|
||||
next if !b.abilityActive?
|
||||
next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability,self,newStatus)
|
||||
next if !Battle::AbilityEffects.triggerStatusImmunityFromAlly(b.ability, self, newStatus)
|
||||
immuneByAbility = true
|
||||
immAlly = b
|
||||
break
|
||||
@@ -192,15 +192,15 @@ class Battle::Battler
|
||||
end
|
||||
return false if hasImmuneType
|
||||
# Ability immunity
|
||||
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability,self,newStatus)
|
||||
if Battle::AbilityEffects.triggerStatusImmunityNonIgnorable(self.ability, self, newStatus)
|
||||
return false
|
||||
end
|
||||
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability,self,newStatus)
|
||||
if abilityActive? && Battle::AbilityEffects.triggerStatusImmunity(self.ability, self, newStatus)
|
||||
return false
|
||||
end
|
||||
allAllies.each do |b|
|
||||
next if !b.abilityActive?
|
||||
next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability,self,newStatus)
|
||||
next if !Battle::AbilityEffects.triggerStatusImmunityFromAlly(b.ability, self, newStatus)
|
||||
return false
|
||||
end
|
||||
# Safeguard immunity
|
||||
@@ -252,7 +252,7 @@ class Battle::Battler
|
||||
pbCheckFormOnStatusChange
|
||||
# Synchronize
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerAbilityOnStatusInflicted(self.ability,self,user,newStatus)
|
||||
Battle::AbilityEffects.triggerOnStatusInflicted(self.ability, self, user, newStatus)
|
||||
end
|
||||
# Status cures
|
||||
pbItemStatusCureCheck
|
||||
@@ -287,18 +287,18 @@ class Battle::Battler
|
||||
if !hasActiveAbility?(:SOUNDPROOF)
|
||||
return false if @battle.allBattlers.any? { |b| b.effects[PBEffects::Uproar] > 0 }
|
||||
end
|
||||
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability, self, :SLEEP)
|
||||
if Battle::AbilityEffects.triggerStatusImmunityNonIgnorable(self.ability, self, :SLEEP)
|
||||
return false
|
||||
end
|
||||
# NOTE: Bulbapedia claims that Flower Veil shouldn't prevent sleep due to
|
||||
# drowsiness, but I disagree because that makes no sense. Also, the
|
||||
# comparable Sweet Veil does prevent sleep due to drowsiness.
|
||||
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability, self, :SLEEP)
|
||||
if abilityActive? && Battle::AbilityEffects.triggerStatusImmunity(self.ability, self, :SLEEP)
|
||||
return false
|
||||
end
|
||||
allAllies.each do |b|
|
||||
next if !b.abilityActive?
|
||||
next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability, self, :SLEEP)
|
||||
next if !Battle::AbilityEffects.triggerStatusImmunityFromAlly(b.ability, self, :SLEEP)
|
||||
return false
|
||||
end
|
||||
# NOTE: Bulbapedia claims that Safeguard shouldn't prevent sleep due to
|
||||
|
||||
@@ -59,7 +59,7 @@ class Battle::Battler
|
||||
@battle.pbDisplay(arrStatTexts[[increment-1,2].min])
|
||||
# Trigger abilities upon stat gain
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerAbilityOnStatGain(self.ability,self,stat,user)
|
||||
Battle::AbilityEffects.triggerOnStatGain(self.ability, self, stat, user)
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -88,7 +88,7 @@ class Battle::Battler
|
||||
@battle.pbDisplay(arrStatTexts[[increment-1,2].min])
|
||||
# Trigger abilities upon stat gain
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerAbilityOnStatGain(self.ability,self,stat,user)
|
||||
Battle::AbilityEffects.triggerOnStatGain(self.ability, self, stat, user)
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -138,15 +138,15 @@ class Battle::Battler
|
||||
return false
|
||||
end
|
||||
if abilityActive?
|
||||
return false if BattleHandlers.triggerStatLossImmunityAbility(
|
||||
return false if Battle::AbilityEffects.triggerStatLossImmunity(
|
||||
self.ability,self,stat,@battle,showFailMsg) if !@battle.moldBreaker
|
||||
return false if BattleHandlers.triggerStatLossImmunityAbilityNonIgnorable(
|
||||
return false if Battle::AbilityEffects.triggerStatLossImmunityNonIgnorable(
|
||||
self.ability,self,stat,@battle,showFailMsg)
|
||||
end
|
||||
if !@battle.moldBreaker
|
||||
allAllies.each do |b|
|
||||
next if !b.abilityActive?
|
||||
return false if BattleHandlers.triggerStatLossImmunityAllyAbility(
|
||||
return false if Battle::AbilityEffects.triggerStatLossImmunityFromAlly(
|
||||
b.ability,b,self,stat,@battle,showFailMsg)
|
||||
end
|
||||
end
|
||||
@@ -218,7 +218,7 @@ class Battle::Battler
|
||||
@battle.pbDisplay(arrStatTexts[[increment-1,2].min])
|
||||
# Trigger abilities upon stat loss
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerAbilityOnStatLoss(self.ability,self,stat,user)
|
||||
Battle::AbilityEffects.triggerOnStatLoss(self.ability, self, stat, user)
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -264,7 +264,7 @@ class Battle::Battler
|
||||
@battle.pbDisplay(arrStatTexts[[increment-1,2].min])
|
||||
# Trigger abilities upon stat loss
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerAbilityOnStatLoss(self.ability,self,stat,user)
|
||||
Battle::AbilityEffects.triggerOnStatLoss(self.ability, self, stat, user)
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -320,8 +320,8 @@ class Battle::Battler
|
||||
return false
|
||||
end
|
||||
if abilityActive?
|
||||
if BattleHandlers.triggerStatLossImmunityAbility(self.ability,self,:ATTACK,@battle,false) ||
|
||||
BattleHandlers.triggerStatLossImmunityAbilityNonIgnorable(self.ability,self,:ATTACK,@battle,false)
|
||||
if Battle::AbilityEffects.triggerStatLossImmunity(self.ability, self, :ATTACK, @battle, false) ||
|
||||
Battle::AbilityEffects.triggerStatLossImmunityNonIgnorable(self.ability, self, :ATTACK, @battle, false)
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} prevented {3}'s {4} from working!",
|
||||
pbThis,abilityName,user.pbThis(true),user.abilityName))
|
||||
return false
|
||||
@@ -329,7 +329,7 @@ class Battle::Battler
|
||||
end
|
||||
allAllies.each do |b|
|
||||
next if !b.abilityActive?
|
||||
if BattleHandlers.triggerStatLossImmunityAllyAbility(b.ability,b,self,:ATTACK,@battle,false)
|
||||
if Battle::AbilityEffects.triggerStatLossImmunityFromAlly(b.ability, b, self, :ATTACK, @battle, false)
|
||||
@battle.pbDisplay(_INTL("{1} is protected from {2}'s {3} by {4}'s {5}!",
|
||||
pbThis,user.pbThis(true),user.abilityName,b.pbThis(true),b.abilityName))
|
||||
return false
|
||||
|
||||
@@ -4,7 +4,7 @@ class Battle::Battler
|
||||
#=============================================================================
|
||||
def pbAbilitiesOnSwitchOut
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerAbilityOnSwitchOut(self.ability,self,false)
|
||||
Battle::AbilityEffects.triggerOnSwitchOut(self.ability, self, false)
|
||||
end
|
||||
# Reset form
|
||||
@battle.peer.pbOnLeavingBattle(@battle,@pokemon,@battle.usedInBattle[idxOwnSide][@index/2])
|
||||
@@ -22,11 +22,11 @@ class Battle::Battler
|
||||
# Self fainted; check all other battlers to see if their abilities trigger
|
||||
@battle.pbPriority(true).each do |b|
|
||||
next if !b || !b.abilityActive?
|
||||
BattleHandlers.triggerAbilityChangeOnBattlerFainting(b.ability,b,self,@battle)
|
||||
Battle::AbilityEffects.triggerChangeOnBattlerFainting(b.ability, b, self, @battle)
|
||||
end
|
||||
@battle.pbPriority(true).each do |b|
|
||||
next if !b || !b.abilityActive?
|
||||
BattleHandlers.triggerAbilityOnBattlerFainting(b.ability,b,self,@battle)
|
||||
Battle::AbilityEffects.triggerOnBattlerFainting(b.ability, b, self, @battle)
|
||||
end
|
||||
pbAbilitiesOnNeutralizingGasEnding if hasActiveAbility?(:NEUTRALIZINGGAS, true)
|
||||
pbItemsOnUnnerveEnding if hasActiveAbility?(:UNNERVE, true)
|
||||
@@ -36,18 +36,18 @@ class Battle::Battler
|
||||
def pbAbilitiesOnDamageTaken(move_user = nil)
|
||||
return false if !@droppedBelowHalfHP
|
||||
return false if !abilityActive?
|
||||
return BattleHandlers.triggerAbilityOnHPDroppedBelowHalf(self.ability, self, move_user, @battle)
|
||||
return Battle::AbilityEffects.triggerOnHPDroppedBelowHalf(self.ability, self, move_user, @battle)
|
||||
end
|
||||
|
||||
def pbAbilityOnTerrainChange(ability_changed = false)
|
||||
return if !abilityActive?
|
||||
BattleHandlers.triggerAbilityOnTerrainChange(self.ability, self, @battle, ability_changed)
|
||||
Battle::AbilityEffects.triggerOnTerrainChange(self.ability, self, @battle, ability_changed)
|
||||
end
|
||||
|
||||
# Used for Rattled's Gen 8 effect. Called when Intimidate is triggered.
|
||||
def pbAbilitiesOnIntimidated
|
||||
return if !abilityActive?
|
||||
BattleHandlers.triggerAbilityOnIntimidated(self.ability, self, @battle)
|
||||
Battle::AbilityEffects.triggerOnIntimidated(self.ability, self, @battle)
|
||||
end
|
||||
|
||||
def pbAbilitiesOnNeutralizingGasEnding
|
||||
@@ -57,7 +57,7 @@ class Battle::Battler
|
||||
@battle.pbPriority(true).each do |b|
|
||||
next if b.fainted?
|
||||
next if !b.unstoppableAbility? && !b.abilityActive?
|
||||
BattleHandlers.triggerAbilityOnSwitchIn(b.ability, b, @battle)
|
||||
Battle::AbilityEffects.triggerOnSwitchIn(b.ability, b, @battle)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -84,7 +84,7 @@ class Battle::Battler
|
||||
@battle.pbDisplay(_INTL("{1} traced {2}'s {3}!",pbThis,choice.pbThis(true),choice.abilityName))
|
||||
@battle.pbHideAbilitySplash(self)
|
||||
if !onSwitchIn && (unstoppableAbility? || abilityActive?)
|
||||
BattleHandlers.triggerAbilityOnSwitchIn(self.ability,self,@battle)
|
||||
Battle::AbilityEffects.triggerOnSwitchIn(self.ability, self, @battle)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -96,7 +96,7 @@ class Battle::Battler
|
||||
# Cures status conditions, confusion and infatuation.
|
||||
def pbAbilityStatusCureCheck
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerStatusCureAbility(self.ability,self)
|
||||
Battle::AbilityEffects.triggerStatusCure(self.ability, self)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -195,7 +195,7 @@ class Battle::Battler
|
||||
pbContinualAbilityChecks(true) # Don't trigger Traced ability as it's triggered below
|
||||
# Abilities that trigger upon switching in
|
||||
if (!fainted? && unstoppableAbility?) || abilityActive?
|
||||
BattleHandlers.triggerAbilityOnSwitchIn(self.ability, self, @battle)
|
||||
Battle::AbilityEffects.triggerOnSwitchIn(self.ability, self, @battle)
|
||||
end
|
||||
# Status-curing ability check
|
||||
pbAbilityStatusCureCheck
|
||||
@@ -300,7 +300,7 @@ class Battle::Battler
|
||||
# when forcibly consumed by Pluck/Fling.
|
||||
if item_to_use
|
||||
itm = item_to_use || self.item
|
||||
if BattleHandlers.triggerTargetItemOnHitPositiveBerry(itm, self, @battle, true)
|
||||
if Battle::ItemEffects.triggerOnBeingHitPositiveBerry(itm, self, @battle, true)
|
||||
pbHeldItemTriggered(itm, false, fling)
|
||||
end
|
||||
end
|
||||
@@ -311,7 +311,7 @@ class Battle::Battler
|
||||
def pbItemHPHealCheck(item_to_use = nil, fling = false)
|
||||
return if !item_to_use && !itemActive?
|
||||
itm = item_to_use || self.item
|
||||
if BattleHandlers.triggerHPHealItem(itm, self, @battle, !item_to_use.nil?)
|
||||
if Battle::ItemEffects.triggerHPHeal(itm, self, @battle, !item_to_use.nil?)
|
||||
pbHeldItemTriggered(itm, item_to_use.nil?, fling)
|
||||
elsif !item_to_use
|
||||
pbItemTerrainStatBoostCheck
|
||||
@@ -326,7 +326,7 @@ class Battle::Battler
|
||||
return if fainted?
|
||||
return if !item_to_use && !itemActive?
|
||||
itm = item_to_use || self.item
|
||||
if BattleHandlers.triggerStatusCureItem(itm, self, @battle, !item_to_use.nil?)
|
||||
if Battle::ItemEffects.triggerStatusCure(itm, self, @battle, !item_to_use.nil?)
|
||||
pbHeldItemTriggered(itm, item_to_use.nil?, fling)
|
||||
end
|
||||
end
|
||||
@@ -338,9 +338,9 @@ class Battle::Battler
|
||||
return if fainted?
|
||||
return if !item_to_use && !itemActive?
|
||||
itm = item_to_use || self.item
|
||||
if BattleHandlers.triggerEndOfMoveItem(itm, self, @battle, !item_to_use.nil?)
|
||||
if Battle::ItemEffects.triggerOnEndOfUsingMove(itm, self, @battle, !item_to_use.nil?)
|
||||
pbHeldItemTriggered(itm, item_to_use.nil?, fling)
|
||||
elsif BattleHandlers.triggerEndOfMoveStatRestoreItem(itm, self, @battle, !item_to_use.nil?)
|
||||
elsif Battle::ItemEffects.triggerOnEndOfUsingMoveStatRestore(itm, self, @battle, !item_to_use.nil?)
|
||||
pbHeldItemTriggered(itm, item_to_use.nil?, fling)
|
||||
end
|
||||
end
|
||||
@@ -354,7 +354,7 @@ class Battle::Battler
|
||||
return if fainted?
|
||||
return if !item_to_use && !itemActive?
|
||||
itm = item_to_use || self.item
|
||||
if BattleHandlers.triggerEndOfMoveStatRestoreItem(itm, self, @battle, !item_to_use.nil?)
|
||||
if Battle::ItemEffects.triggerOnEndOfUsingMoveStatRestore(itm, self, @battle, !item_to_use.nil?)
|
||||
pbHeldItemTriggered(itm, item_to_use.nil?, fling)
|
||||
end
|
||||
end
|
||||
@@ -362,7 +362,7 @@ class Battle::Battler
|
||||
# Called when the battle terrain changes and when a Pokémon loses HP.
|
||||
def pbItemTerrainStatBoostCheck
|
||||
return if !itemActive?
|
||||
if BattleHandlers.triggerTerrainStatBoostItem(self.item, self, @battle)
|
||||
if Battle::ItemEffects.triggerTerrainStatBoost(self.item, self, @battle)
|
||||
pbHeldItemTriggered(self.item)
|
||||
end
|
||||
end
|
||||
@@ -371,7 +371,7 @@ class Battle::Battler
|
||||
# Intimidate has no effect on the Pokémon).
|
||||
def pbItemOnIntimidatedCheck
|
||||
return if !itemActive?
|
||||
if BattleHandlers.triggerItemOnIntimidated(self.item, self, @battle)
|
||||
if Battle::ItemEffects.triggerOnIntimidated(self.item, self, @battle)
|
||||
pbHeldItemTriggered(self.item)
|
||||
end
|
||||
end
|
||||
@@ -380,7 +380,7 @@ class Battle::Battler
|
||||
def pbItemOnStatDropped(move_user = nil)
|
||||
return false if !@statsDropped
|
||||
return false if !itemActive?
|
||||
return BattleHandlers.triggerItemOnStatDropped(self.item, self, move_user, @battle)
|
||||
return Battle::ItemEffects.triggerOnStatLoss(self.item, self, move_user, @battle)
|
||||
end
|
||||
|
||||
def pbItemsOnUnnerveEnding
|
||||
|
||||
@@ -281,7 +281,7 @@ class Battle::Battler
|
||||
# Dazzling/Queenly Majesty make the move fail here
|
||||
@battle.pbPriority(true).each do |b|
|
||||
next if !b || !b.abilityActive?
|
||||
if BattleHandlers.triggerMoveBlockingAbility(b.ability,b,user,targets,move,@battle)
|
||||
if Battle::AbilityEffects.triggerMoveBlocking(b.ability, b, user, targets, move, @battle)
|
||||
@battle.pbDisplayBrief(_INTL("{1} used {2}!",user.pbThis,move.name))
|
||||
@battle.pbShowAbilitySplash(b)
|
||||
@battle.pbDisplay(_INTL("{1} cannot use {2}!",user.pbThis,move.name))
|
||||
@@ -603,7 +603,7 @@ class Battle::Battler
|
||||
next if !b.damageState.missed || b.damageState.magicCoat
|
||||
pbMissMessage(move,user,b)
|
||||
if user.itemActive?
|
||||
BattleHandlers.triggerUserItemOnMissing(user.item, user, b, move, hitNum, @battle)
|
||||
Battle::ItemEffects.triggerOnMissingTarget(user.item, user, b, move, hitNum, @battle)
|
||||
end
|
||||
break if move.pbRepeatHit? # Dragon Darts only shows one failure message
|
||||
end
|
||||
@@ -649,7 +649,7 @@ class Battle::Battler
|
||||
next if !b.damageState.missed
|
||||
pbMissMessage(move, user, b)
|
||||
if user.itemActive?
|
||||
BattleHandlers.triggerUserItemOnMissing(user.item, user, b, move, hitNum, @battle)
|
||||
Battle::ItemEffects.triggerOnMissingTarget(user.item, user, b, move, hitNum, @battle)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -243,7 +243,7 @@ class Battle::Battler
|
||||
if @effects[PBEffects::Flinch]
|
||||
@battle.pbDisplay(_INTL("{1} flinched and couldn't move!",pbThis))
|
||||
if abilityActive?
|
||||
BattleHandlers.triggerAbilityOnFlinch(self.ability,self,@battle)
|
||||
Battle::AbilityEffects.triggerOnFlinch(self.ability, self, @battle)
|
||||
end
|
||||
@lastMoveFailed = true
|
||||
return false
|
||||
|
||||
@@ -7,7 +7,7 @@ class Battle::Battler
|
||||
# Target's ability
|
||||
if target.abilityActive?(true)
|
||||
oldHP = user.hp
|
||||
BattleHandlers.triggerTargetAbilityOnHit(target.ability,user,target,move,@battle)
|
||||
Battle::AbilityEffects.triggerOnBeingHit(target.ability, user, target, move, @battle)
|
||||
user.pbItemHPHealCheck if user.hp<oldHP
|
||||
end
|
||||
# Cramorant - Gulp Missile
|
||||
@@ -32,13 +32,13 @@ class Battle::Battler
|
||||
end
|
||||
# User's ability
|
||||
if user.abilityActive?(true)
|
||||
BattleHandlers.triggerUserAbilityOnHit(user.ability,user,target,move,@battle)
|
||||
Battle::AbilityEffects.triggerOnDealingHit(user.ability, user, target, move, @battle)
|
||||
user.pbItemHPHealCheck
|
||||
end
|
||||
# Target's item
|
||||
if target.itemActive?(true)
|
||||
oldHP = user.hp
|
||||
BattleHandlers.triggerTargetItemOnHit(target.item,user,target,move,@battle)
|
||||
Battle::ItemEffects.triggerOnBeingHit(target.item, user, target, move, @battle)
|
||||
user.pbItemHPHealCheck if user.hp<oldHP
|
||||
end
|
||||
end
|
||||
@@ -111,7 +111,7 @@ class Battle::Battler
|
||||
end
|
||||
# User's ability
|
||||
if user.abilityActive?
|
||||
BattleHandlers.triggerUserAbilityEndOfMove(user.ability,user,targets,move,@battle)
|
||||
Battle::AbilityEffects.triggerOnEndOfUsingMove(user.ability, user, targets, move, @battle)
|
||||
end
|
||||
# Greninja - Battle Bond
|
||||
if !user.fainted? && !user.effects[PBEffects::Transform] &&
|
||||
@@ -182,7 +182,7 @@ class Battle::Battler
|
||||
@battle.pbPriority(true).each do |b|
|
||||
if targets.any? { |targetB| targetB.index==b.index }
|
||||
if !b.damageState.unaffected && b.damageState.calcDamage > 0 && b.itemActive?
|
||||
BattleHandlers.triggerTargetItemAfterMoveUse(b.item, b, user, move, switched_battlers, @battle)
|
||||
Battle::ItemEffects.triggerAfterMoveUseFromTarget(b.item, b, user, move, switched_battlers, @battle)
|
||||
end
|
||||
end
|
||||
# Target's Eject Pack
|
||||
@@ -194,13 +194,13 @@ class Battle::Battler
|
||||
end
|
||||
# User's held item (Life Orb, Shell Bell, Throat Spray, Eject Pack)
|
||||
if !switched_battlers.include?(user.index) && user.itemActive? # Only if user hasn't switched out
|
||||
BattleHandlers.triggerUserItemAfterMoveUse(user.item,user,targets,move,numHits,@battle)
|
||||
Battle::ItemEffects.triggerAfterMoveUseFromUser(user.item, user, targets, move, numHits, @battle)
|
||||
end
|
||||
# Target's ability (Berserk, Color Change, Emergency Exit, Pickpocket, Wimp Out)
|
||||
@battle.pbPriority(true).each do |b|
|
||||
if targets.any? { |targetB| targetB.index==b.index }
|
||||
if !b.damageState.unaffected && !switched_battlers.include?(b.index) && b.abilityActive?
|
||||
BattleHandlers.triggerTargetAbilityAfterMoveUse(b.ability, b, user, move, switched_battlers, @battle)
|
||||
Battle::AbilityEffects.triggerAfterMoveUseFromTarget(b.ability, b, user, move, switched_battlers, @battle)
|
||||
end
|
||||
end
|
||||
# Target's Emergency Exit, Wimp Out (including for Pokémon hurt by Flame Burst)
|
||||
|
||||
@@ -86,7 +86,7 @@ class Battle::Move
|
||||
return false if @battle.moldBreaker
|
||||
ret = false
|
||||
if target.abilityActive?
|
||||
ret = BattleHandlers.triggerMoveImmunityTargetAbility(target.ability,
|
||||
ret = Battle::AbilityEffects.triggerMoveImmunity(target.ability,
|
||||
user, target, self, @calcType, @battle, show_message)
|
||||
end
|
||||
return ret
|
||||
|
||||
@@ -5,7 +5,7 @@ class Battle::Move
|
||||
def pbBaseType(user)
|
||||
ret = @type
|
||||
if ret && user.abilityActive?
|
||||
ret = BattleHandlers.triggerMoveBaseTypeModifierAbility(user.ability,user,self,ret)
|
||||
ret = Battle::AbilityEffects.triggerModifyMoveBaseType(user.ability, user, self, ret)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
@@ -130,25 +130,25 @@ class Battle::Move
|
||||
def pbCalcAccuracyModifiers(user,target,modifiers)
|
||||
# Ability effects that alter accuracy calculation
|
||||
if user.abilityActive?
|
||||
BattleHandlers.triggerAccuracyCalcUserAbility(user.ability,
|
||||
Battle::AbilityEffects.triggerAccuracyCalcFromUser(user.ability,
|
||||
modifiers,user,target,self,@calcType)
|
||||
end
|
||||
user.allAllies.each do |b|
|
||||
next if !b.abilityActive?
|
||||
BattleHandlers.triggerAccuracyCalcUserAllyAbility(b.ability,
|
||||
Battle::AbilityEffects.triggerAccuracyCalcFromAlly(b.ability,
|
||||
modifiers,user,target,self,@calcType)
|
||||
end
|
||||
if target.abilityActive? && !@battle.moldBreaker
|
||||
BattleHandlers.triggerAccuracyCalcTargetAbility(target.ability,
|
||||
Battle::AbilityEffects.triggerAccuracyCalcFromTarget(target.ability,
|
||||
modifiers,user,target,self,@calcType)
|
||||
end
|
||||
# Item effects that alter accuracy calculation
|
||||
if user.itemActive?
|
||||
BattleHandlers.triggerAccuracyCalcUserItem(user.item,
|
||||
Battle::ItemEffects.triggerAccuracyCalcFromUser(user.item,
|
||||
modifiers,user,target,self,@calcType)
|
||||
end
|
||||
if target.itemActive?
|
||||
BattleHandlers.triggerAccuracyCalcTargetItem(target.item,
|
||||
Battle::ItemEffects.triggerAccuracyCalcFromTarget(target.item,
|
||||
modifiers,user,target,self,@calcType)
|
||||
end
|
||||
# Other effects, inc. ones that set accuracy_multiplier or evasion_stage to
|
||||
@@ -181,17 +181,17 @@ class Battle::Move
|
||||
c = 0
|
||||
# Ability effects that alter critical hit rate
|
||||
if c>=0 && user.abilityActive?
|
||||
c = BattleHandlers.triggerCriticalCalcUserAbility(user.ability,user,target,c)
|
||||
c = Battle::AbilityEffects.triggerCriticalCalcFromUser(user.ability, user, target, c)
|
||||
end
|
||||
if c>=0 && target.abilityActive? && !@battle.moldBreaker
|
||||
c = BattleHandlers.triggerCriticalCalcTargetAbility(target.ability,user,target,c)
|
||||
c = Battle::AbilityEffects.triggerCriticalCalcFromTarget(target.ability, user, target, c)
|
||||
end
|
||||
# Item effects that alter critical hit rate
|
||||
if c>=0 && user.itemActive?
|
||||
c = BattleHandlers.triggerCriticalCalcUserItem(user.item,user,target,c)
|
||||
c = Battle::ItemEffects.triggerCriticalCalcFromUser(user.item, user, target, c)
|
||||
end
|
||||
if c>=0 && target.itemActive?
|
||||
c = BattleHandlers.triggerCriticalCalcTargetItem(target.item,user,target,c)
|
||||
c = Battle::ItemEffects.triggerCriticalCalcFromTarget(target.item, user, target, c)
|
||||
end
|
||||
return false if c<0
|
||||
# Move-specific "always/never a critical hit" effects
|
||||
@@ -294,7 +294,7 @@ class Battle::Move
|
||||
end
|
||||
# Ability effects that alter damage
|
||||
if user.abilityActive?
|
||||
BattleHandlers.triggerDamageCalcUserAbility(user.ability,
|
||||
Battle::AbilityEffects.triggerDamageCalcFromUser(user.ability,
|
||||
user,target,self,multipliers,baseDmg,type)
|
||||
end
|
||||
if !@battle.moldBreaker
|
||||
@@ -303,28 +303,28 @@ class Battle::Move
|
||||
# how it works.
|
||||
user.allAllies.each do |b|
|
||||
next if !b.abilityActive?
|
||||
BattleHandlers.triggerDamageCalcUserAllyAbility(b.ability,
|
||||
Battle::AbilityEffects.triggerDamageCalcFromAlly(b.ability,
|
||||
user,target,self,multipliers,baseDmg,type)
|
||||
end
|
||||
if target.abilityActive?
|
||||
BattleHandlers.triggerDamageCalcTargetAbility(target.ability,
|
||||
Battle::AbilityEffects.triggerDamageCalcFromTarget(target.ability,
|
||||
user,target,self,multipliers,baseDmg,type) if !@battle.moldBreaker
|
||||
BattleHandlers.triggerDamageCalcTargetAbilityNonIgnorable(target.ability,
|
||||
Battle::AbilityEffects.triggerDamageCalcFromTargetNonIgnorable(target.ability,
|
||||
user,target,self,multipliers,baseDmg,type)
|
||||
end
|
||||
target.allAllies.each do |b|
|
||||
next if !b.abilityActive?
|
||||
BattleHandlers.triggerDamageCalcTargetAllyAbility(b.ability,
|
||||
Battle::AbilityEffects.triggerDamageCalcFromTargetAlly(b.ability,
|
||||
user,target,self,multipliers,baseDmg,type)
|
||||
end
|
||||
end
|
||||
# Item effects that alter damage
|
||||
if user.itemActive?
|
||||
BattleHandlers.triggerDamageCalcUserItem(user.item,
|
||||
Battle::ItemEffects.triggerDamageCalcFromUser(user.item,
|
||||
user,target,self,multipliers,baseDmg,type)
|
||||
end
|
||||
if target.itemActive?
|
||||
BattleHandlers.triggerDamageCalcTargetItem(target.item,
|
||||
Battle::ItemEffects.triggerDamageCalcFromTarget(target.item,
|
||||
user,target,self,multipliers,baseDmg,type)
|
||||
end
|
||||
# Parental Bond's second attack
|
||||
|
||||
@@ -338,14 +338,14 @@ class Battle::AI
|
||||
break
|
||||
end
|
||||
if canCheck
|
||||
BattleHandlers.triggerDamageCalcUserAbility(user.ability,
|
||||
Battle::AbilityEffects.triggerDamageCalcFromUser(user.ability,
|
||||
user,target,move,multipliers,baseDmg,type)
|
||||
end
|
||||
end
|
||||
if skill>=PBTrainerAI.mediumSkill && !moldBreaker
|
||||
user.allAllies.each do |b|
|
||||
next if !b.abilityActive?
|
||||
BattleHandlers.triggerDamageCalcUserAllyAbility(b.ability,
|
||||
Battle::AbilityEffects.triggerDamageCalcFromAlly(b.ability,
|
||||
user,target,move,multipliers,baseDmg,type)
|
||||
end
|
||||
end
|
||||
@@ -360,14 +360,14 @@ class Battle::AI
|
||||
break
|
||||
end
|
||||
if canCheck
|
||||
BattleHandlers.triggerDamageCalcTargetAbility(target.ability,
|
||||
Battle::AbilityEffects.triggerDamageCalcFromTarget(target.ability,
|
||||
user,target,move,multipliers,baseDmg,type)
|
||||
end
|
||||
end
|
||||
if skill>=PBTrainerAI.bestSkill && !moldBreaker
|
||||
target.allAllies.each do |b|
|
||||
next if !b.abilityActive?
|
||||
BattleHandlers.triggerDamageCalcTargetAllyAbility(b.ability,
|
||||
Battle::AbilityEffects.triggerDamageCalcFromTargetAlly(b.ability,
|
||||
user,target,move,multipliers,baseDmg,type)
|
||||
end
|
||||
end
|
||||
@@ -379,7 +379,7 @@ class Battle::AI
|
||||
# round.
|
||||
itemBlacklist = [:EXPERTBELT,:LIFEORB]
|
||||
if !itemBlacklist.include?(user.item_id)
|
||||
BattleHandlers.triggerDamageCalcUserItem(user.item,
|
||||
Battle::ItemEffects.triggerDamageCalcFromUser(user.item,
|
||||
user,target,move,multipliers,baseDmg,type)
|
||||
end
|
||||
end
|
||||
@@ -387,7 +387,7 @@ class Battle::AI
|
||||
# NOTE: Type-weakening berries aren't suitable for checking at the start
|
||||
# of the round.
|
||||
if target.item && !target.item.is_berry?
|
||||
BattleHandlers.triggerDamageCalcTargetItem(target.item,
|
||||
Battle::ItemEffects.triggerDamageCalcFromTarget(target.item,
|
||||
user,target,move,multipliers,baseDmg,type)
|
||||
end
|
||||
end
|
||||
@@ -560,20 +560,20 @@ class Battle::AI
|
||||
c = 0
|
||||
# Ability effects that alter critical hit rate
|
||||
if c>=0 && user.abilityActive?
|
||||
c = BattleHandlers.triggerCriticalCalcUserAbility(user.ability,user,target,c)
|
||||
c = Battle::AbilityEffects.triggerCriticalCalcFromUser(user.ability, user, target, c)
|
||||
end
|
||||
if skill>=PBTrainerAI.bestSkill
|
||||
if c>=0 && !moldBreaker && target.abilityActive?
|
||||
c = BattleHandlers.triggerCriticalCalcTargetAbility(target.ability,user,target,c)
|
||||
c = Battle::AbilityEffects.triggerCriticalCalcFromTarget(target.ability, user, target, c)
|
||||
end
|
||||
end
|
||||
# Item effects that alter critical hit rate
|
||||
if c>=0 && user.itemActive?
|
||||
c = BattleHandlers.triggerCriticalCalcUserItem(user.item,user,target,c)
|
||||
c = Battle::ItemEffects.triggerCriticalCalcFromUser(user.item, user, target, c)
|
||||
end
|
||||
if skill>=PBTrainerAI.bestSkill
|
||||
if c>=0 && target.itemActive?
|
||||
c = BattleHandlers.triggerCriticalCalcTargetItem(target.item,user,target,c)
|
||||
c = Battle::ItemEffects.triggerCriticalCalcFromTarget(target.item, user, target, c)
|
||||
end
|
||||
end
|
||||
# Other efffects
|
||||
@@ -638,31 +638,31 @@ class Battle::AI
|
||||
# Ability effects that alter accuracy calculation
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
if user.abilityActive?
|
||||
BattleHandlers.triggerAccuracyCalcUserAbility(user.ability,
|
||||
Battle::AbilityEffects.triggerAccuracyCalcFromUser(user.ability,
|
||||
modifiers,user,target,move,type)
|
||||
end
|
||||
user.allAllies.each do |b|
|
||||
next if !b.abilityActive?
|
||||
BattleHandlers.triggerAccuracyCalcUserAllyAbility(b.ability,
|
||||
Battle::AbilityEffects.triggerAccuracyCalcFromAlly(b.ability,
|
||||
modifiers,user,target,move,type)
|
||||
end
|
||||
end
|
||||
if skill>=PBTrainerAI.bestSkill
|
||||
if target.abilityActive? && !moldBreaker
|
||||
BattleHandlers.triggerAccuracyCalcTargetAbility(target.ability,
|
||||
Battle::AbilityEffects.triggerAccuracyCalcFromTarget(target.ability,
|
||||
modifiers,user,target,move,type)
|
||||
end
|
||||
end
|
||||
# Item effects that alter accuracy calculation
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
if user.itemActive?
|
||||
BattleHandlers.triggerAccuracyCalcUserItem(user.item,
|
||||
Battle::ItemEffects.triggerAccuracyCalcFromUser(user.item,
|
||||
modifiers,user,target,move,type)
|
||||
end
|
||||
end
|
||||
if skill>=PBTrainerAI.bestSkill
|
||||
if target.itemActive?
|
||||
BattleHandlers.triggerAccuracyCalcTargetItem(target.item,
|
||||
Battle::ItemEffects.triggerAccuracyCalcFromTarget(target.item,
|
||||
modifiers,user,target,move,type)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module Battle::Common
|
||||
module Battle::CatchAndStoreMixin
|
||||
#=============================================================================
|
||||
# Store caught Pokémon
|
||||
#=============================================================================
|
||||
@@ -107,16 +107,16 @@ module Battle::Common
|
||||
case numShakes
|
||||
when 0
|
||||
pbDisplay(_INTL("Oh no! The Pokémon broke free!"))
|
||||
BallHandlers.onFailCatch(ball,self,battler)
|
||||
Battle::PokeBallEffects.onFailCatch(ball, self, battler)
|
||||
when 1
|
||||
pbDisplay(_INTL("Aww! It appeared to be caught!"))
|
||||
BallHandlers.onFailCatch(ball,self,battler)
|
||||
Battle::PokeBallEffects.onFailCatch(ball, self, battler)
|
||||
when 2
|
||||
pbDisplay(_INTL("Aargh! Almost had it!"))
|
||||
BallHandlers.onFailCatch(ball,self,battler)
|
||||
Battle::PokeBallEffects.onFailCatch(ball, self, battler)
|
||||
when 3
|
||||
pbDisplay(_INTL("Gah! It was so close, too!"))
|
||||
BallHandlers.onFailCatch(ball,self,battler)
|
||||
Battle::PokeBallEffects.onFailCatch(ball, self, battler)
|
||||
when 4
|
||||
pbDisplayBrief(_INTL("Gotcha! {1} was caught!",pkmn.name))
|
||||
@scene.pbThrowSuccess # Play capture success jingle
|
||||
@@ -135,7 +135,7 @@ module Battle::Common
|
||||
if GameData::Item.get(ball).is_snag_ball?
|
||||
pkmn.owner = Pokemon::Owner.new_from_trainer(pbPlayer)
|
||||
end
|
||||
BallHandlers.onCatch(ball,self,pkmn)
|
||||
Battle::PokeBallEffects.onCatch(ball, self, pkmn)
|
||||
pkmn.poke_ball = ball
|
||||
pkmn.makeUnmega if pkmn.mega?
|
||||
pkmn.makeUnprimal
|
||||
@@ -163,11 +163,8 @@ module Battle::Common
|
||||
# Get a catch rate if one wasn't provided
|
||||
catch_rate = pkmn.species_data.catch_rate if !catch_rate
|
||||
# Modify catch_rate depending on the Poké Ball's effect
|
||||
ultraBeast = [:NIHILEGO, :BUZZWOLE, :PHEROMOSA, :XURKITREE, :CELESTEELA,
|
||||
:KARTANA, :GUZZLORD, :POIPOLE, :NAGANADEL, :STAKATAKA,
|
||||
:BLACEPHALON].include?(pkmn.species)
|
||||
if !ultraBeast || ball == :BEASTBALL
|
||||
catch_rate = BallHandlers.modifyCatchRate(ball,catch_rate,self,battler,ultraBeast)
|
||||
if !pkmn.species_data.has_flag?("UltraBeast") || ball == :BEASTBALL
|
||||
catch_rate = Battle::PokeBallEffects.modifyCatchRate(ball, catch_rate, self, battler)
|
||||
else
|
||||
catch_rate /= 10
|
||||
end
|
||||
@@ -184,7 +181,7 @@ module Battle::Common
|
||||
x = x.floor
|
||||
x = 1 if x<1
|
||||
# Definite capture, no need to perform randomness checks
|
||||
return 4 if x>=255 || BallHandlers.isUnconditional?(ball,self,battler)
|
||||
return 4 if x>=255 || Battle::PokeBallEffects.isUnconditional?(ball, self, battler)
|
||||
# Second half of the shakes calculation
|
||||
y = ( 65536 / ((255.0/x)**0.1875) ).floor
|
||||
# Critical capture check
|
||||
@@ -220,3 +217,10 @@ module Battle::Common
|
||||
return numShakes
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle
|
||||
include Battle::CatchAndStoreMixin
|
||||
end
|
||||
@@ -1,498 +0,0 @@
|
||||
module BattleHandlers
|
||||
# Battler's speed calculation
|
||||
SpeedCalcAbility = AbilityHandlerHash.new
|
||||
SpeedCalcItem = ItemHandlerHash.new
|
||||
# Battler's weight calculation
|
||||
WeightCalcAbility = AbilityHandlerHash.new
|
||||
WeightCalcItem = ItemHandlerHash.new # Float Stone
|
||||
# Battler's HP/stat changed
|
||||
HPHealItem = ItemHandlerHash.new
|
||||
AbilityOnHPDroppedBelowHalf = AbilityHandlerHash.new
|
||||
ItemOnStatDropped = ItemHandlerHash.new
|
||||
# Battler's status problem
|
||||
StatusCheckAbilityNonIgnorable = AbilityHandlerHash.new # Comatose
|
||||
StatusImmunityAbility = AbilityHandlerHash.new
|
||||
StatusImmunityAbilityNonIgnorable = AbilityHandlerHash.new
|
||||
StatusImmunityAllyAbility = AbilityHandlerHash.new
|
||||
AbilityOnStatusInflicted = AbilityHandlerHash.new # Synchronize
|
||||
StatusCureItem = ItemHandlerHash.new
|
||||
StatusCureAbility = AbilityHandlerHash.new
|
||||
# Battler's stat stages
|
||||
StatLossImmunityAbility = AbilityHandlerHash.new
|
||||
StatLossImmunityAbilityNonIgnorable = AbilityHandlerHash.new # Full Metal Body
|
||||
StatLossImmunityAllyAbility = AbilityHandlerHash.new # Flower Veil
|
||||
AbilityOnStatGain = AbilityHandlerHash.new # None!
|
||||
AbilityOnStatLoss = AbilityHandlerHash.new
|
||||
# Priority and turn order
|
||||
PriorityChangeAbility = AbilityHandlerHash.new
|
||||
PriorityBracketChangeAbility = AbilityHandlerHash.new # Stall
|
||||
PriorityBracketChangeItem = ItemHandlerHash.new
|
||||
PriorityBracketUseAbility = AbilityHandlerHash.new # None!
|
||||
PriorityBracketUseItem = ItemHandlerHash.new
|
||||
# Move usage failures
|
||||
AbilityOnFlinch = AbilityHandlerHash.new # Steadfast
|
||||
MoveBlockingAbility = AbilityHandlerHash.new
|
||||
MoveImmunityTargetAbility = AbilityHandlerHash.new
|
||||
UserItemOnMissing = ItemHandlerHash.new # Blunder Policy
|
||||
# Move usage
|
||||
MoveBaseTypeModifierAbility = AbilityHandlerHash.new
|
||||
# Accuracy calculation
|
||||
AccuracyCalcUserAbility = AbilityHandlerHash.new
|
||||
AccuracyCalcUserAllyAbility = AbilityHandlerHash.new # Victory Star
|
||||
AccuracyCalcTargetAbility = AbilityHandlerHash.new
|
||||
AccuracyCalcUserItem = ItemHandlerHash.new
|
||||
AccuracyCalcTargetItem = ItemHandlerHash.new
|
||||
# Damage calculation
|
||||
DamageCalcUserAbility = AbilityHandlerHash.new
|
||||
DamageCalcUserAllyAbility = AbilityHandlerHash.new
|
||||
DamageCalcTargetAbility = AbilityHandlerHash.new
|
||||
DamageCalcTargetAbilityNonIgnorable = AbilityHandlerHash.new
|
||||
DamageCalcTargetAllyAbility = AbilityHandlerHash.new
|
||||
DamageCalcUserItem = ItemHandlerHash.new
|
||||
DamageCalcTargetItem = ItemHandlerHash.new
|
||||
# Critical hit calculation
|
||||
CriticalCalcUserAbility = AbilityHandlerHash.new
|
||||
CriticalCalcTargetAbility = AbilityHandlerHash.new
|
||||
CriticalCalcUserItem = ItemHandlerHash.new
|
||||
CriticalCalcTargetItem = ItemHandlerHash.new # None!
|
||||
# Upon a move hitting a target
|
||||
TargetAbilityOnHit = AbilityHandlerHash.new
|
||||
UserAbilityOnHit = AbilityHandlerHash.new # Poison Touch
|
||||
TargetItemOnHit = ItemHandlerHash.new
|
||||
TargetItemOnHitPositiveBerry = ItemHandlerHash.new
|
||||
# Abilities/items that trigger at the end of using a move
|
||||
UserAbilityEndOfMove = AbilityHandlerHash.new
|
||||
TargetItemAfterMoveUse = ItemHandlerHash.new
|
||||
UserItemAfterMoveUse = ItemHandlerHash.new
|
||||
TargetAbilityAfterMoveUse = AbilityHandlerHash.new
|
||||
EndOfMoveItem = ItemHandlerHash.new # Leppa Berry
|
||||
EndOfMoveStatRestoreItem = ItemHandlerHash.new # White Herb
|
||||
# Experience and EV gain
|
||||
ExpGainModifierItem = ItemHandlerHash.new # Lucky Egg
|
||||
EVGainModifierItem = ItemHandlerHash.new
|
||||
# Weather and terrin
|
||||
WeatherExtenderItem = ItemHandlerHash.new
|
||||
TerrainExtenderItem = ItemHandlerHash.new # Terrain Extender
|
||||
TerrainStatBoostItem = ItemHandlerHash.new
|
||||
# End Of Round
|
||||
EORWeatherAbility = AbilityHandlerHash.new
|
||||
EORHealingAbility = AbilityHandlerHash.new
|
||||
EORHealingItem = ItemHandlerHash.new
|
||||
EOREffectAbility = AbilityHandlerHash.new
|
||||
EOREffectItem = ItemHandlerHash.new
|
||||
EORGainItemAbility = AbilityHandlerHash.new
|
||||
# Switching and fainting
|
||||
CertainSwitchingUserAbility = AbilityHandlerHash.new # None!
|
||||
CertainSwitchingUserItem = ItemHandlerHash.new # Shed Shell
|
||||
TrappingTargetAbility = AbilityHandlerHash.new
|
||||
TrappingTargetItem = ItemHandlerHash.new # None!
|
||||
AbilityOnSwitchIn = AbilityHandlerHash.new
|
||||
ItemOnSwitchIn = ItemHandlerHash.new # Air Balloon
|
||||
ItemOnIntimidated = ItemHandlerHash.new # Adrenaline Orb
|
||||
AbilityOnSwitchOut = AbilityHandlerHash.new
|
||||
AbilityChangeOnBattlerFainting = AbilityHandlerHash.new
|
||||
AbilityOnBattlerFainting = AbilityHandlerHash.new # Soul-Heart
|
||||
AbilityOnTerrainChange = AbilityHandlerHash.new # Mimicry
|
||||
AbilityOnIntimidated = AbilityHandlerHash.new # Rattled (Gen 8)
|
||||
# Running from battle
|
||||
RunFromBattleAbility = AbilityHandlerHash.new # Run Away
|
||||
RunFromBattleItem = ItemHandlerHash.new # Smoke Ball
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerSpeedCalcAbility(ability,battler,mult)
|
||||
ret = SpeedCalcAbility.trigger(ability,battler,mult)
|
||||
return (ret!=nil) ? ret : mult
|
||||
end
|
||||
|
||||
def self.triggerSpeedCalcItem(item,battler,mult)
|
||||
ret = SpeedCalcItem.trigger(item,battler,mult)
|
||||
return (ret!=nil) ? ret : mult
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerWeightCalcAbility(ability,battler,w)
|
||||
ret = WeightCalcAbility.trigger(ability,battler,w)
|
||||
return (ret!=nil) ? ret : w
|
||||
end
|
||||
|
||||
def self.triggerWeightCalcItem(item,battler,w)
|
||||
ret = WeightCalcItem.trigger(item,battler,w)
|
||||
return (ret!=nil) ? ret : w
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerHPHealItem(item,battler,battle,forced)
|
||||
ret = HPHealItem.trigger(item,battler,battle,forced)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerAbilityOnHPDroppedBelowHalf(ability, user, move_user, battle)
|
||||
ret = AbilityOnHPDroppedBelowHalf.trigger(ability, user, move_user, battle)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerItemOnStatDropped(item, user, move_user, battle)
|
||||
ret = ItemOnStatDropped.trigger(item, user, move_user, battle)
|
||||
return (ret != nil) ? ret : false
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerStatusCheckAbilityNonIgnorable(ability,battler,status)
|
||||
ret = StatusCheckAbilityNonIgnorable.trigger(ability,battler,status)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerStatusImmunityAbility(ability,battler,status)
|
||||
ret = StatusImmunityAbility.trigger(ability,battler,status)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerStatusImmunityAbilityNonIgnorable(ability,battler,status)
|
||||
ret = StatusImmunityAbilityNonIgnorable.trigger(ability,battler,status)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerStatusImmunityAllyAbility(ability,battler,status)
|
||||
ret = StatusImmunityAllyAbility.trigger(ability,battler,status)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerAbilityOnStatusInflicted(ability,battler,user,status)
|
||||
AbilityOnStatusInflicted.trigger(ability,battler,user,status)
|
||||
end
|
||||
|
||||
def self.triggerStatusCureItem(item,battler,battle,forced)
|
||||
ret = StatusCureItem.trigger(item,battler,battle,forced)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerStatusCureAbility(ability,battler)
|
||||
ret = StatusCureAbility.trigger(ability,battler)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerStatLossImmunityAbility(ability,battler,stat,battle,showMessages)
|
||||
ret = StatLossImmunityAbility.trigger(ability,battler,stat,battle,showMessages)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerStatLossImmunityAbilityNonIgnorable(ability,battler,stat,battle,showMessages)
|
||||
ret = StatLossImmunityAbilityNonIgnorable.trigger(ability,battler,stat,battle,showMessages)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerStatLossImmunityAllyAbility(ability,bearer,battler,stat,battle,showMessages)
|
||||
ret = StatLossImmunityAllyAbility.trigger(ability,bearer,battler,stat,battle,showMessages)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerAbilityOnStatGain(ability,battler,stat,user)
|
||||
AbilityOnStatGain.trigger(ability,battler,stat,user)
|
||||
end
|
||||
|
||||
def self.triggerAbilityOnStatLoss(ability,battler,stat,user)
|
||||
AbilityOnStatLoss.trigger(ability,battler,stat,user)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerPriorityChangeAbility(ability,battler,move,pri)
|
||||
ret = PriorityChangeAbility.trigger(ability,battler,move,pri)
|
||||
return (ret!=nil) ? ret : pri
|
||||
end
|
||||
|
||||
def self.triggerPriorityBracketChangeAbility(ability,battler,subPri,battle)
|
||||
ret = PriorityBracketChangeAbility.trigger(ability,battler,subPri,battle)
|
||||
return (ret!=nil) ? ret : subPri
|
||||
end
|
||||
|
||||
def self.triggerPriorityBracketChangeItem(item,battler,subPri,battle)
|
||||
ret = PriorityBracketChangeItem.trigger(item,battler,subPri,battle)
|
||||
return (ret!=nil) ? ret : subPri
|
||||
end
|
||||
|
||||
def self.triggerPriorityBracketUseAbility(ability,battler,battle)
|
||||
PriorityBracketUseAbility.trigger(ability,battler,battle)
|
||||
end
|
||||
|
||||
def self.triggerPriorityBracketUseItem(item,battler,battle)
|
||||
PriorityBracketUseItem.trigger(item,battler,battle)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerAbilityOnFlinch(ability,battler,battle)
|
||||
AbilityOnFlinch.trigger(ability,battler,battle)
|
||||
end
|
||||
|
||||
def self.triggerMoveBlockingAbility(ability,bearer,user,targets,move,battle)
|
||||
ret = MoveBlockingAbility.trigger(ability,bearer,user,targets,move,battle)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerMoveImmunityTargetAbility(ability, user, target, move, type, battle, show_message)
|
||||
ret = MoveImmunityTargetAbility.trigger(ability, user, target, move, type, battle, show_message)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerUserItemOnMissing(item, user, target, move, hit_num, battle)
|
||||
UserItemOnMissing.trigger(item, user, target, move, hit_num, battle)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerMoveBaseTypeModifierAbility(ability,user,move,type)
|
||||
ret = MoveBaseTypeModifierAbility.trigger(ability,user,move,type)
|
||||
return (ret!=nil) ? ret : type
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerAccuracyCalcUserAbility(ability,mods,user,target,move,type)
|
||||
AccuracyCalcUserAbility.trigger(ability,mods,user,target,move,type)
|
||||
end
|
||||
|
||||
def self.triggerAccuracyCalcUserAllyAbility(ability,mods,user,target,move,type)
|
||||
AccuracyCalcUserAllyAbility.trigger(ability,mods,user,target,move,type)
|
||||
end
|
||||
|
||||
def self.triggerAccuracyCalcTargetAbility(ability,mods,user,target,move,type)
|
||||
AccuracyCalcTargetAbility.trigger(ability,mods,user,target,move,type)
|
||||
end
|
||||
|
||||
def self.triggerAccuracyCalcUserItem(item,mods,user,target,move,type)
|
||||
AccuracyCalcUserItem.trigger(item,mods,user,target,move,type)
|
||||
end
|
||||
|
||||
def self.triggerAccuracyCalcTargetItem(item,mods,user,target,move,type)
|
||||
AccuracyCalcTargetItem.trigger(item,mods,user,target,move,type)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerDamageCalcUserAbility(ability,user,target,move,mults,baseDmg,type)
|
||||
DamageCalcUserAbility.trigger(ability,user,target,move,mults,baseDmg,type)
|
||||
end
|
||||
|
||||
def self.triggerDamageCalcUserAllyAbility(ability,user,target,move,mults,baseDmg,type)
|
||||
DamageCalcUserAllyAbility.trigger(ability,user,target,move,mults,baseDmg,type)
|
||||
end
|
||||
|
||||
def self.triggerDamageCalcTargetAbility(ability,user,target,move,mults,baseDmg,type)
|
||||
DamageCalcTargetAbility.trigger(ability,user,target,move,mults,baseDmg,type)
|
||||
end
|
||||
|
||||
def self.triggerDamageCalcTargetAbilityNonIgnorable(ability,user,target,move,mults,baseDmg,type)
|
||||
DamageCalcTargetAbilityNonIgnorable.trigger(ability,user,target,move,mults,baseDmg,type)
|
||||
end
|
||||
|
||||
def self.triggerDamageCalcTargetAllyAbility(ability,user,target,move,mults,baseDmg,type)
|
||||
DamageCalcTargetAllyAbility.trigger(ability,user,target,move,mults,baseDmg,type)
|
||||
end
|
||||
|
||||
def self.triggerDamageCalcUserItem(item,user,target,move,mults,baseDmg,type)
|
||||
DamageCalcUserItem.trigger(item,user,target,move,mults,baseDmg,type)
|
||||
end
|
||||
|
||||
def self.triggerDamageCalcTargetItem(item,user,target,move,mults,baseDmg,type)
|
||||
DamageCalcTargetItem.trigger(item,user,target,move,mults,baseDmg,type)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerCriticalCalcUserAbility(ability,user,target,c)
|
||||
ret = CriticalCalcUserAbility.trigger(ability,user,target,c)
|
||||
return (ret!=nil) ? ret : c
|
||||
end
|
||||
|
||||
def self.triggerCriticalCalcTargetAbility(ability,user,target,c)
|
||||
ret = CriticalCalcTargetAbility.trigger(ability,user,target,c)
|
||||
return (ret!=nil) ? ret : c
|
||||
end
|
||||
|
||||
def self.triggerCriticalCalcUserItem(item,user,target,c)
|
||||
ret = CriticalCalcUserItem.trigger(item,user,target,c)
|
||||
return (ret!=nil) ? ret : c
|
||||
end
|
||||
|
||||
def self.triggerCriticalCalcTargetItem(item,user,target,c)
|
||||
ret = CriticalCalcTargetItem.trigger(item,user,target,c)
|
||||
return (ret!=nil) ? ret : c
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerTargetAbilityOnHit(ability,user,target,move,battle)
|
||||
TargetAbilityOnHit.trigger(ability,user,target,move,battle)
|
||||
end
|
||||
|
||||
def self.triggerUserAbilityOnHit(ability,user,target,move,battle)
|
||||
UserAbilityOnHit.trigger(ability,user,target,move,battle)
|
||||
end
|
||||
|
||||
def self.triggerTargetItemOnHit(item,user,target,move,battle)
|
||||
TargetItemOnHit.trigger(item,user,target,move,battle)
|
||||
end
|
||||
|
||||
def self.triggerTargetItemOnHitPositiveBerry(item,battler,battle,forced)
|
||||
ret = TargetItemOnHitPositiveBerry.trigger(item,battler,battle,forced)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerUserAbilityEndOfMove(ability,user,targets,move,battle)
|
||||
UserAbilityEndOfMove.trigger(ability,user,targets,move,battle)
|
||||
end
|
||||
|
||||
def self.triggerTargetItemAfterMoveUse(item, battler, user, move, switched_battlers, battle)
|
||||
TargetItemAfterMoveUse.trigger(item, battler, user, move, switched_battlers, battle)
|
||||
end
|
||||
|
||||
def self.triggerUserItemAfterMoveUse(item,user,targets,move,numHits,battle)
|
||||
UserItemAfterMoveUse.trigger(item,user,targets,move,numHits,battle)
|
||||
end
|
||||
|
||||
def self.triggerTargetAbilityAfterMoveUse(ability, target, user, move, switched_battlers, battle)
|
||||
TargetAbilityAfterMoveUse.trigger(ability, target, user, move, switched_battlers, battle)
|
||||
end
|
||||
|
||||
def self.triggerEndOfMoveItem(item,battler,battle,forced)
|
||||
ret = EndOfMoveItem.trigger(item,battler,battle,forced)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerEndOfMoveStatRestoreItem(item,battler,battle,forced)
|
||||
ret = EndOfMoveStatRestoreItem.trigger(item,battler,battle,forced)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerExpGainModifierItem(item,battler,exp)
|
||||
ret = ExpGainModifierItem.trigger(item,battler,exp)
|
||||
return (ret!=nil) ? ret : -1
|
||||
end
|
||||
|
||||
def self.triggerEVGainModifierItem(item,battler,evarray)
|
||||
return false if !EVGainModifierItem[item]
|
||||
EVGainModifierItem.trigger(item,battler,evarray)
|
||||
return true
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerWeatherExtenderItem(item,weather,duration,battler,battle)
|
||||
ret = WeatherExtenderItem.trigger(item,weather,duration,battler,battle)
|
||||
return (ret!=nil) ? ret : duration
|
||||
end
|
||||
|
||||
def self.triggerTerrainExtenderItem(item,terrain,duration,battler,battle)
|
||||
ret = TerrainExtenderItem.trigger(item,terrain,duration,battler,battle)
|
||||
return (ret!=nil) ? ret : duration
|
||||
end
|
||||
|
||||
def self.triggerTerrainStatBoostItem(item,battler,battle)
|
||||
ret = TerrainStatBoostItem.trigger(item,battler,battle)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerEORWeatherAbility(ability,weather,battler,battle)
|
||||
EORWeatherAbility.trigger(ability,weather,battler,battle)
|
||||
end
|
||||
|
||||
def self.triggerEORHealingAbility(ability,battler,battle)
|
||||
EORHealingAbility.trigger(ability,battler,battle)
|
||||
end
|
||||
|
||||
def self.triggerEORHealingItem(item,battler,battle)
|
||||
EORHealingItem.trigger(item,battler,battle)
|
||||
end
|
||||
|
||||
def self.triggerEOREffectAbility(ability,battler,battle)
|
||||
EOREffectAbility.trigger(ability,battler,battle)
|
||||
end
|
||||
|
||||
def self.triggerEOREffectItem(item,battler,battle)
|
||||
EOREffectItem.trigger(item,battler,battle)
|
||||
end
|
||||
|
||||
def self.triggerEORGainItemAbility(ability,battler,battle)
|
||||
EORGainItemAbility.trigger(ability,battler,battle)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerCertainSwitchingUserAbility(ability,switcher,battle)
|
||||
ret = CertainSwitchingUserAbility.trigger(ability,switcher,battle)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerCertainSwitchingUserItem(item,switcher,battle)
|
||||
ret = CertainSwitchingUserItem.trigger(item,switcher,battle)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerTrappingTargetAbility(ability,switcher,bearer,battle)
|
||||
ret = TrappingTargetAbility.trigger(ability,switcher,bearer,battle)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerTrappingTargetItem(item,switcher,bearer,battle)
|
||||
ret = TrappingTargetItem.trigger(item,switcher,bearer,battle)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerAbilityOnSwitchIn(ability,battler,battle)
|
||||
AbilityOnSwitchIn.trigger(ability,battler,battle)
|
||||
end
|
||||
|
||||
def self.triggerItemOnSwitchIn(item,battler,battle)
|
||||
ItemOnSwitchIn.trigger(item,battler,battle)
|
||||
end
|
||||
|
||||
def self.triggerItemOnIntimidated(item,battler,battle)
|
||||
ret = ItemOnIntimidated.trigger(item,battler,battle)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerAbilityOnSwitchOut(ability,battler,endOfBattle)
|
||||
AbilityOnSwitchOut.trigger(ability,battler,endOfBattle)
|
||||
end
|
||||
|
||||
def self.triggerAbilityChangeOnBattlerFainting(ability,battler,fainted,battle)
|
||||
AbilityChangeOnBattlerFainting.trigger(ability,battler,fainted,battle)
|
||||
end
|
||||
|
||||
def self.triggerAbilityOnBattlerFainting(ability,battler,fainted,battle)
|
||||
AbilityOnBattlerFainting.trigger(ability,battler,fainted,battle)
|
||||
end
|
||||
|
||||
def self.triggerAbilityOnTerrainChange(ability, battler, battle, ability_changed)
|
||||
AbilityOnTerrainChange.trigger(ability, battler, battle, ability_changed)
|
||||
end
|
||||
|
||||
def self.triggerAbilityOnIntimidated(ability,battler,battle)
|
||||
AbilityOnIntimidated.trigger(ability,battler,battle)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def self.triggerRunFromBattleAbility(ability,battler)
|
||||
ret = RunFromBattleAbility.trigger(ability,battler)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.triggerRunFromBattleItem(item,battler)
|
||||
ret = RunFromBattleItem.trigger(item,battler)
|
||||
return (ret!=nil) ? ret : false
|
||||
end
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,38 +1,36 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module BallHandlers
|
||||
module Battle::PokeBallEffects
|
||||
IsUnconditional = ItemHandlerHash.new
|
||||
ModifyCatchRate = ItemHandlerHash.new
|
||||
OnCatch = ItemHandlerHash.new
|
||||
OnFailCatch = ItemHandlerHash.new
|
||||
|
||||
def self.isUnconditional?(ball,battle,battler)
|
||||
ret = IsUnconditional.trigger(ball,battle,battler)
|
||||
return (ret!=nil) ? ret : false
|
||||
def self.isUnconditional?(ball, battle, battler)
|
||||
ret = IsUnconditional.trigger(ball, battle, battler)
|
||||
return (ret != nil) ? ret : false
|
||||
end
|
||||
|
||||
def self.modifyCatchRate(ball,catchRate,battle,battler,ultraBeast)
|
||||
ret = ModifyCatchRate.trigger(ball,catchRate,battle,battler,ultraBeast)
|
||||
return (ret!=nil) ? ret : catchRate
|
||||
def self.modifyCatchRate(ball, catchRate, battle, battler)
|
||||
ret = ModifyCatchRate.trigger(ball, catchRate, battle, battler)
|
||||
return (ret != nil) ? ret : catchRate
|
||||
end
|
||||
|
||||
def self.onCatch(ball,battle,pkmn)
|
||||
OnCatch.trigger(ball,battle,pkmn)
|
||||
def self.onCatch(ball, battle, pkmn)
|
||||
OnCatch.trigger(ball, battle, pkmn)
|
||||
end
|
||||
|
||||
def self.onFailCatch(ball,battle,battler)
|
||||
def self.onFailCatch(ball, battle, battler)
|
||||
$stats.failed_poke_ball_count += 1
|
||||
OnFailCatch.trigger(ball,battle,battler)
|
||||
OnFailCatch.trigger(ball, battle, battler)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# IsUnconditional
|
||||
#===============================================================================
|
||||
BallHandlers::IsUnconditional.add(:MASTERBALL,proc { |ball,battle,battler|
|
||||
Battle::PokeBallEffects::IsUnconditional.add(:MASTERBALL, proc { |ball, battle, battler|
|
||||
next true
|
||||
})
|
||||
|
||||
@@ -42,67 +40,67 @@ BallHandlers::IsUnconditional.add(:MASTERBALL,proc { |ball,battle,battler|
|
||||
# Ball is a Beast Ball). In this case, all Balls' catch rates are set
|
||||
# elsewhere to 0.1x.
|
||||
#===============================================================================
|
||||
BallHandlers::ModifyCatchRate.add(:GREATBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
next catchRate*1.5
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:GREATBALL, proc { |ball, catchRate, battle, battler|
|
||||
next catchRate * 1.5
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:ULTRABALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
next catchRate*2
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:ULTRABALL, proc { |ball, catchRate, battle, battler|
|
||||
next catchRate * 2
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:SAFARIBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
next catchRate*1.5
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:SAFARIBALL, proc { |ball, catchRate, battle, battler|
|
||||
next catchRate * 1.5
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:NETBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:NETBALL, proc { |ball, catchRate, battle, battler|
|
||||
multiplier = (Settings::NEW_POKE_BALL_CATCH_RATES) ? 3.5 : 3
|
||||
catchRate *= multiplier if battler.pbHasType?(:BUG) || battler.pbHasType?(:WATER)
|
||||
next catchRate
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:DIVEBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:DIVEBALL, proc { |ball, catchRate, battle, battler|
|
||||
catchRate *= 3.5 if battle.environment == :Underwater
|
||||
next catchRate
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:NESTBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:NESTBALL, proc { |ball, catchRate, battle, battler|
|
||||
if battler.level <= 30
|
||||
catchRate *= [(41 - battler.level) / 10.0, 1].max
|
||||
end
|
||||
next catchRate
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:REPEATBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:REPEATBALL, proc { |ball, catchRate, battle, battler|
|
||||
multiplier = (Settings::NEW_POKE_BALL_CATCH_RATES) ? 3.5 : 3
|
||||
catchRate *= multiplier if battle.pbPlayer.owned?(battler.species)
|
||||
next catchRate
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:TIMERBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
multiplier = [1+(0.3*battle.turnCount),4].min
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:TIMERBALL, proc { |ball, catchRate, battle, battler|
|
||||
multiplier = [1 + (0.3 * battle.turnCount), 4].min
|
||||
catchRate *= multiplier
|
||||
next catchRate
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:DUSKBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:DUSKBALL, proc { |ball, catchRate, battle, battler|
|
||||
multiplier = (Settings::NEW_POKE_BALL_CATCH_RATES) ? 3 : 3.5
|
||||
catchRate *= multiplier if battle.time==2
|
||||
catchRate *= multiplier if battle.time == 2 # Night or in cave
|
||||
next catchRate
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:QUICKBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
catchRate *= 5 if battle.turnCount==0
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:QUICKBALL, proc { |ball, catchRate, battle, battler|
|
||||
catchRate *= 5 if battle.turnCount == 0
|
||||
next catchRate
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:FASTBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:FASTBALL, proc { |ball, catchRate, battle, battler|
|
||||
baseStats = battler.pokemon.baseStats
|
||||
baseSpeed = baseStats[:SPEED]
|
||||
catchRate *= 4 if baseSpeed >= 100
|
||||
next [catchRate, 255].min
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:LEVELBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:LEVELBALL, proc { |ball, catchRate, battle, battler|
|
||||
maxlevel = 0
|
||||
battle.allSameSideBattlers.each { |b| maxlevel = b.level if b.level > maxlevel }
|
||||
if maxlevel >= battler.level * 4
|
||||
@@ -112,17 +110,17 @@ BallHandlers::ModifyCatchRate.add(:LEVELBALL,proc { |ball,catchRate,battle,battl
|
||||
elsif maxlevel > battler.level
|
||||
catchRate *= 2
|
||||
end
|
||||
next [catchRate,255].min
|
||||
next [catchRate, 255].min
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:LUREBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:LUREBALL, proc { |ball, catchRate, battle, battler|
|
||||
multiplier = (Settings::NEW_POKE_BALL_CATCH_RATES) ? 5 : 3
|
||||
catchRate *= multiplier if GameData::EncounterType.get($game_temp.encounter_type).type == :fishing
|
||||
next [catchRate,255].min
|
||||
next [catchRate, 255].min
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:HEAVYBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
next 0 if catchRate==0
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:HEAVYBALL, proc { |ball, catchRate, battle, battler|
|
||||
next 0 if catchRate == 0
|
||||
weight = battler.pokemon.species_data.base_stats[:SPEED]
|
||||
if Settings::NEW_POKE_BALL_CATCH_RATES
|
||||
if weight >= 3000
|
||||
@@ -143,21 +141,21 @@ BallHandlers::ModifyCatchRate.add(:HEAVYBALL,proc { |ball,catchRate,battle,battl
|
||||
catchRate -= 20
|
||||
end
|
||||
end
|
||||
catchRate = [catchRate,1].max
|
||||
next [catchRate,255].min
|
||||
catchRate = [catchRate, 1].max
|
||||
next [catchRate, 255].min
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:LOVEBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:LOVEBALL, proc { |ball, catchRate, battle, battler|
|
||||
battle.allSameSideBattlers.each do |b|
|
||||
next if b.species!=battler.species
|
||||
next if b.gender==battler.gender || b.gender==2 || battler.gender==2
|
||||
next if b.species != battler.species
|
||||
next if b.gender == battler.gender || b.gender == 2 || battler.gender == 2
|
||||
catchRate *= 8
|
||||
break
|
||||
end
|
||||
next [catchRate,255].min
|
||||
next [catchRate, 255].min
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:MOONBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:MOONBALL, proc { |ball, catchRate, battle, battler|
|
||||
# NOTE: Moon Ball cares about whether any species in the target's evolutionary
|
||||
# family can evolve with the Moon Stone, not whether the target itself
|
||||
# can immediately evolve with the Moon Stone.
|
||||
@@ -168,17 +166,17 @@ BallHandlers::ModifyCatchRate.add(:MOONBALL,proc { |ball,catchRate,battle,battle
|
||||
next [catchRate, 255].min
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:SPORTBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
next catchRate*1.5
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:SPORTBALL, proc { |ball, catchRate, battle, battler|
|
||||
next catchRate * 1.5
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:DREAMBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:DREAMBALL, proc { |ball, catchRate, battle, battler|
|
||||
catchRate *= 4 if battler.asleep?
|
||||
next catchRate
|
||||
})
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:BEASTBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
if ultraBeast
|
||||
Battle::PokeBallEffects::ModifyCatchRate.add(:BEASTBALL, proc { |ball, catchRate, battle, battler|
|
||||
if battler.pokemon.species_data.has_flag?("UltraBeast")
|
||||
catchRate *= 5
|
||||
else
|
||||
catchRate /= 10
|
||||
@@ -189,10 +187,10 @@ BallHandlers::ModifyCatchRate.add(:BEASTBALL,proc { |ball,catchRate,battle,battl
|
||||
#===============================================================================
|
||||
# OnCatch
|
||||
#===============================================================================
|
||||
BallHandlers::OnCatch.add(:HEALBALL,proc { |ball,battle,pkmn|
|
||||
Battle::PokeBallEffects::OnCatch.add(:HEALBALL, proc { |ball, battle, pkmn|
|
||||
pkmn.heal
|
||||
})
|
||||
|
||||
BallHandlers::OnCatch.add(:FRIENDBALL,proc { |ball,battle,pkmn|
|
||||
Battle::PokeBallEffects::OnCatch.add(:FRIENDBALL, proc { |ball, battle, pkmn|
|
||||
pkmn.happiness = 200
|
||||
})
|
||||
@@ -304,7 +304,7 @@ class SafariBattle
|
||||
attr_accessor :rules
|
||||
attr_accessor :ballCount
|
||||
|
||||
include Battle::Common
|
||||
include Battle::CatchAndStoreMixin
|
||||
|
||||
def pbRandom(x); return rand(x); end
|
||||
|
||||
|
||||
@@ -20784,6 +20784,7 @@ Shape = Multiped
|
||||
Category = Parasite
|
||||
Pokedex = One of several mysterious Ultra Beasts. People on the street report observing those infested by it suddenly becoming violent.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[BUZZWOLE]
|
||||
Name = Buzzwole
|
||||
@@ -20808,6 +20809,7 @@ Shape = Multiped
|
||||
Category = Swollen
|
||||
Pokedex = This Ultra Beast appeared from another world. It shows off its body, but whether that display is a boast or a threat remains unclear.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[PHEROMOSA]
|
||||
Name = Pheromosa
|
||||
@@ -20832,6 +20834,7 @@ Shape = Bipedal
|
||||
Category = Lissome
|
||||
Pokedex = One of the Ultra Beasts. It refuses to touch anything, perhaps because it senses some uncleanness in this world.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[XURKITREE]
|
||||
Name = Xurkitree
|
||||
@@ -20855,6 +20858,7 @@ Shape = BipedalTail
|
||||
Category = Glowing
|
||||
Pokedex = One of the mysterious life-forms known as Ultra Beasts. Astonishing electric shocks emanate from its entire body, according to witnesses.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[CELESTEELA]
|
||||
Name = Celesteela
|
||||
@@ -20879,6 +20883,7 @@ Shape = Bipedal
|
||||
Category = Launch
|
||||
Pokedex = One kind of Ultra Beast. Witnesses have seen it burn down a forest by expelling gas from its two arms.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[KARTANA]
|
||||
Name = Kartana
|
||||
@@ -20903,6 +20908,7 @@ Shape = Bipedal
|
||||
Category = Drawn Sword
|
||||
Pokedex = One of the Ultra Beast life-forms, it was observed cutting down a gigantic steel tower with one stroke of its blade.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[GUZZLORD]
|
||||
Name = Guzzlord
|
||||
@@ -20927,6 +20933,7 @@ Shape = BipedalTail
|
||||
Category = Junkivore
|
||||
Pokedex = A dangerous Ultra Beast, it appears to be eating constantly, but for some reason its droppings have never been found.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[NECROZMA]
|
||||
Name = Necrozma
|
||||
@@ -21021,6 +21028,7 @@ Shape = BipedalTail
|
||||
Category = Poison Pin
|
||||
Pokedex = An Ultra Beast that lives in a different world, it cackles wildly as it sprays its opponents with poison from the needles on its head.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
Evolutions = NAGANADEL,HasMove,DRAGONPULSE
|
||||
#-------------------------------
|
||||
[NAGANADEL]
|
||||
@@ -21046,6 +21054,7 @@ Shape = Winged
|
||||
Category = Poison Pin
|
||||
Pokedex = One kind of Ultra Beast, it fires a glowing, venomous liquid from its needles. This liquid is also immensely adhesive.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[STAKATAKA]
|
||||
Name = Stakataka
|
||||
@@ -21070,6 +21079,7 @@ Shape = Quadruped
|
||||
Category = Rampart
|
||||
Pokedex = When stone walls started moving and attacking, the brute's true identity was this mysterious life-form, which brings to mind an Ultra Beast.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[BLACEPHALON]
|
||||
Name = Blacephalon
|
||||
@@ -21094,6 +21104,7 @@ Shape = Bipedal
|
||||
Category = Fireworks
|
||||
Pokedex = It slithers toward people. Then, without warning, it triggers the explosion of its own head. It's apparently one kind of Ultra Beast.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[ZERAORA]
|
||||
Name = Zeraora
|
||||
|
||||
@@ -20787,6 +20787,7 @@ Shape = Multiped
|
||||
Category = Parasite
|
||||
Pokedex = One of several mysterious Ultra Beasts. People on the street report observing those infested by it suddenly becoming violent.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[BUZZWOLE]
|
||||
Name = Buzzwole
|
||||
@@ -20811,6 +20812,7 @@ Shape = Multiped
|
||||
Category = Swollen
|
||||
Pokedex = This Ultra Beast appeared from another world. It shows off its body, but whether that display is a boast or a threat remains unclear.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[PHEROMOSA]
|
||||
Name = Pheromosa
|
||||
@@ -20835,6 +20837,7 @@ Shape = Bipedal
|
||||
Category = Lissome
|
||||
Pokedex = One of the Ultra Beasts. It refuses to touch anything, perhaps because it senses some uncleanness in this world.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[XURKITREE]
|
||||
Name = Xurkitree
|
||||
@@ -20858,6 +20861,7 @@ Shape = BipedalTail
|
||||
Category = Glowing
|
||||
Pokedex = One of the mysterious life-forms known as Ultra Beasts. Astonishing electric shocks emanate from its entire body, according to witnesses.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[CELESTEELA]
|
||||
Name = Celesteela
|
||||
@@ -20882,6 +20886,7 @@ Shape = Bipedal
|
||||
Category = Launch
|
||||
Pokedex = One kind of Ultra Beast. Witnesses have seen it burn down a forest by expelling gas from its two arms.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[KARTANA]
|
||||
Name = Kartana
|
||||
@@ -20906,6 +20911,7 @@ Shape = Bipedal
|
||||
Category = Drawn Sword
|
||||
Pokedex = One of the Ultra Beast life-forms, it was observed cutting down a gigantic steel tower with one stroke of its blade.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[GUZZLORD]
|
||||
Name = Guzzlord
|
||||
@@ -20930,6 +20936,7 @@ Shape = BipedalTail
|
||||
Category = Junkivore
|
||||
Pokedex = A dangerous Ultra Beast, it appears to be eating constantly, but for some reason its droppings have never been found.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[NECROZMA]
|
||||
Name = Necrozma
|
||||
@@ -21024,6 +21031,7 @@ Shape = BipedalTail
|
||||
Category = Poison Pin
|
||||
Pokedex = An Ultra Beast that lives in a different world, it cackles wildly as it sprays its opponents with poison from the needles on its head.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
Evolutions = NAGANADEL,HasMove,DRAGONPULSE
|
||||
#-------------------------------
|
||||
[NAGANADEL]
|
||||
@@ -21049,6 +21057,7 @@ Shape = Winged
|
||||
Category = Poison Pin
|
||||
Pokedex = One kind of Ultra Beast, it fires a glowing, venomous liquid from its needles. This liquid is also immensely adhesive.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[STAKATAKA]
|
||||
Name = Stakataka
|
||||
@@ -21073,6 +21082,7 @@ Shape = Quadruped
|
||||
Category = Rampart
|
||||
Pokedex = When stone walls started moving and attacking, the brute's true identity was this mysterious life-form, which brings to mind an Ultra Beast.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[BLACEPHALON]
|
||||
Name = Blacephalon
|
||||
@@ -21097,6 +21107,7 @@ Shape = Bipedal
|
||||
Category = Fireworks
|
||||
Pokedex = It slithers toward people. Then, without warning, it triggers the explosion of its own head. It's apparently one kind of Ultra Beast.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[ZERAORA]
|
||||
Name = Zeraora
|
||||
|
||||
@@ -20787,6 +20787,7 @@ Shape = Multiped
|
||||
Category = Parasite
|
||||
Pokedex = One of several mysterious Ultra Beasts. People on the street report observing those infested by it suddenly becoming violent.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[BUZZWOLE]
|
||||
Name = Buzzwole
|
||||
@@ -20811,6 +20812,7 @@ Shape = Multiped
|
||||
Category = Swollen
|
||||
Pokedex = This Ultra Beast appeared from another world. It shows off its body, but whether that display is a boast or a threat remains unclear.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[PHEROMOSA]
|
||||
Name = Pheromosa
|
||||
@@ -20835,6 +20837,7 @@ Shape = Bipedal
|
||||
Category = Lissome
|
||||
Pokedex = One of the Ultra Beasts. It refuses to touch anything, perhaps because it senses some uncleanness in this world.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[XURKITREE]
|
||||
Name = Xurkitree
|
||||
@@ -20858,6 +20861,7 @@ Shape = BipedalTail
|
||||
Category = Glowing
|
||||
Pokedex = One of the mysterious life-forms known as Ultra Beasts. Astonishing electric shocks emanate from its entire body, according to witnesses.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[CELESTEELA]
|
||||
Name = Celesteela
|
||||
@@ -20882,6 +20886,7 @@ Shape = Bipedal
|
||||
Category = Launch
|
||||
Pokedex = One kind of Ultra Beast. Witnesses have seen it burn down a forest by expelling gas from its two arms.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[KARTANA]
|
||||
Name = Kartana
|
||||
@@ -20906,6 +20911,7 @@ Shape = Bipedal
|
||||
Category = Drawn Sword
|
||||
Pokedex = One of the Ultra Beast life-forms, it was observed cutting down a gigantic steel tower with one stroke of its blade.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[GUZZLORD]
|
||||
Name = Guzzlord
|
||||
@@ -20930,6 +20936,7 @@ Shape = BipedalTail
|
||||
Category = Junkivore
|
||||
Pokedex = A dangerous Ultra Beast, it appears to be eating constantly, but for some reason its droppings have never been found.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[NECROZMA]
|
||||
Name = Necrozma
|
||||
@@ -21024,6 +21031,7 @@ Shape = BipedalTail
|
||||
Category = Poison Pin
|
||||
Pokedex = An Ultra Beast that lives in a different world, it cackles wildly as it sprays its opponents with poison from the needles on its head.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
Evolutions = NAGANADEL,HasMove,DRAGONPULSE
|
||||
#-------------------------------
|
||||
[NAGANADEL]
|
||||
@@ -21049,6 +21057,7 @@ Shape = Winged
|
||||
Category = Poison Pin
|
||||
Pokedex = One kind of Ultra Beast, it fires a glowing, venomous liquid from its needles. This liquid is also immensely adhesive.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[STAKATAKA]
|
||||
Name = Stakataka
|
||||
@@ -21073,6 +21082,7 @@ Shape = Quadruped
|
||||
Category = Rampart
|
||||
Pokedex = When stone walls started moving and attacking, the brute's true identity was this mysterious life-form, which brings to mind an Ultra Beast.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[BLACEPHALON]
|
||||
Name = Blacephalon
|
||||
@@ -21097,6 +21107,7 @@ Shape = Bipedal
|
||||
Category = Fireworks
|
||||
Pokedex = It slithers toward people. Then, without warning, it triggers the explosion of its own head. It's apparently one kind of Ultra Beast.
|
||||
Generation = 7
|
||||
Flags = UltraBeast
|
||||
#-------------------------------
|
||||
[ZERAORA]
|
||||
Name = Zeraora
|
||||
|
||||
Reference in New Issue
Block a user