mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
Obsoleted battle methods that yield battlers in favour of ones that return all of them at once
This commit is contained in:
@@ -608,7 +608,7 @@ class PokeBattle_Battler
|
|||||||
return true if @effects[PBEffects::Trapping] > 0
|
return true if @effects[PBEffects::Trapping] > 0
|
||||||
return true if @effects[PBEffects::MeanLook] >= 0
|
return true if @effects[PBEffects::MeanLook] >= 0
|
||||||
return true if @effects[PBEffects::JawLock] >= 0
|
return true if @effects[PBEffects::JawLock] >= 0
|
||||||
@battle.eachBattler { |b| return true if b.effects[PBEffects::JawLock] == @index }
|
return true if @battle.allBattlers.any? { |b| b.effects[PBEffects::JawLock] == @index }
|
||||||
return true if @effects[PBEffects::Octolock] >= 0
|
return true if @effects[PBEffects::Octolock] >= 0
|
||||||
return true if @effects[PBEffects::Ingrain]
|
return true if @effects[PBEffects::Ingrain]
|
||||||
return true if @effects[PBEffects::NoRetreat]
|
return true if @effects[PBEffects::NoRetreat]
|
||||||
@@ -728,17 +728,29 @@ class PokeBattle_Battler
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Yields each unfainted ally Pokémon.
|
# Yields each unfainted ally Pokémon.
|
||||||
|
# Unused
|
||||||
def eachAlly
|
def eachAlly
|
||||||
@battle.battlers.each do |b|
|
@battle.battlers.each do |b|
|
||||||
yield b if b && !b.fainted? && !b.opposes?(@index) && b.index!=@index
|
yield b if b && !b.fainted? && !b.opposes?(@index) && b.index!=@index
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns an array containing all unfainted ally Pokémon.
|
||||||
|
def allAllies
|
||||||
|
return @battle.allSameSideBattlers(@index).select { |b| b.index != @index }
|
||||||
|
end
|
||||||
|
|
||||||
# Yields each unfainted opposing Pokémon.
|
# Yields each unfainted opposing Pokémon.
|
||||||
|
# Unused
|
||||||
def eachOpposing
|
def eachOpposing
|
||||||
@battle.battlers.each { |b| yield b if b && !b.fainted? && b.opposes?(@index) }
|
@battle.battlers.each { |b| yield b if b && !b.fainted? && b.opposes?(@index) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns an array containing all unfainted opposing Pokémon.
|
||||||
|
def allOpposing
|
||||||
|
return @battle.allOtherSideBattlers(@index)
|
||||||
|
end
|
||||||
|
|
||||||
# Returns the battler that is most directly opposite to self. unfaintedOnly is
|
# Returns the battler that is most directly opposite to self. unfaintedOnly is
|
||||||
# whether it should prefer to return a non-fainted battler.
|
# whether it should prefer to return a non-fainted battler.
|
||||||
def pbDirectOpposing(unfaintedOnly=false)
|
def pbDirectOpposing(unfaintedOnly=false)
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ class PokeBattle_Battler
|
|||||||
@movesUsed = []
|
@movesUsed = []
|
||||||
@turnCount = 0
|
@turnCount = 0
|
||||||
@effects[PBEffects::Attract] = -1
|
@effects[PBEffects::Attract] = -1
|
||||||
@battle.eachBattler do |b| # Other battlers no longer attracted to self
|
@battle.allBattlers.each do |b| # Other battlers no longer attracted to self
|
||||||
b.effects[PBEffects::Attract] = -1 if b.effects[PBEffects::Attract]==@index
|
b.effects[PBEffects::Attract] = -1 if b.effects[PBEffects::Attract]==@index
|
||||||
end
|
end
|
||||||
@effects[PBEffects::BanefulBunker] = false
|
@effects[PBEffects::BanefulBunker] = false
|
||||||
@@ -210,11 +210,11 @@ class PokeBattle_Battler
|
|||||||
@effects[PBEffects::Instruct] = false
|
@effects[PBEffects::Instruct] = false
|
||||||
@effects[PBEffects::Instructed] = false
|
@effects[PBEffects::Instructed] = false
|
||||||
@effects[PBEffects::JawLock] = -1
|
@effects[PBEffects::JawLock] = -1
|
||||||
@battle.eachBattler do |b| # Other battlers no longer blocked by self
|
@battle.allBattlers.each do |b| # Other battlers no longer blocked by self
|
||||||
b.effects[PBEffects::JawLock] = -1 if b.effects[PBEffects::JawLock] == @index
|
b.effects[PBEffects::JawLock] = -1 if b.effects[PBEffects::JawLock] == @index
|
||||||
end
|
end
|
||||||
@effects[PBEffects::KingsShield] = false
|
@effects[PBEffects::KingsShield] = false
|
||||||
@battle.eachBattler do |b| # Other battlers lose their lock-on against self
|
@battle.allBattlers.each do |b| # Other battlers lose their lock-on against self
|
||||||
next if b.effects[PBEffects::LockOn]==0
|
next if b.effects[PBEffects::LockOn]==0
|
||||||
next if b.effects[PBEffects::LockOnPos]!=@index
|
next if b.effects[PBEffects::LockOnPos]!=@index
|
||||||
b.effects[PBEffects::LockOn] = 0
|
b.effects[PBEffects::LockOn] = 0
|
||||||
@@ -223,7 +223,7 @@ class PokeBattle_Battler
|
|||||||
@effects[PBEffects::MagicBounce] = false
|
@effects[PBEffects::MagicBounce] = false
|
||||||
@effects[PBEffects::MagicCoat] = false
|
@effects[PBEffects::MagicCoat] = false
|
||||||
@effects[PBEffects::MeanLook] = -1
|
@effects[PBEffects::MeanLook] = -1
|
||||||
@battle.eachBattler do |b| # Other battlers no longer blocked by self
|
@battle.allBattlers.each do |b| # Other battlers no longer blocked by self
|
||||||
b.effects[PBEffects::MeanLook] = -1 if b.effects[PBEffects::MeanLook]==@index
|
b.effects[PBEffects::MeanLook] = -1 if b.effects[PBEffects::MeanLook]==@index
|
||||||
end
|
end
|
||||||
@effects[PBEffects::MeFirst] = false
|
@effects[PBEffects::MeFirst] = false
|
||||||
@@ -239,7 +239,7 @@ class PokeBattle_Battler
|
|||||||
@effects[PBEffects::NoRetreat] = false
|
@effects[PBEffects::NoRetreat] = false
|
||||||
@effects[PBEffects::Obstruct] = false
|
@effects[PBEffects::Obstruct] = false
|
||||||
@effects[PBEffects::Octolock] = -1
|
@effects[PBEffects::Octolock] = -1
|
||||||
@battle.eachBattler do |b| # Other battlers no longer locked by self
|
@battle.allBattlers.each do |b| # Other battlers no longer locked by self
|
||||||
b.effects[PBEffects::Octolock] = -1 if b.effects[PBEffects::Octolock] == @index
|
b.effects[PBEffects::Octolock] = -1 if b.effects[PBEffects::Octolock] == @index
|
||||||
end
|
end
|
||||||
@effects[PBEffects::Outrage] = 0
|
@effects[PBEffects::Outrage] = 0
|
||||||
@@ -260,7 +260,7 @@ class PokeBattle_Battler
|
|||||||
@effects[PBEffects::Rollout] = 0
|
@effects[PBEffects::Rollout] = 0
|
||||||
@effects[PBEffects::Roost] = false
|
@effects[PBEffects::Roost] = false
|
||||||
@effects[PBEffects::SkyDrop] = -1
|
@effects[PBEffects::SkyDrop] = -1
|
||||||
@battle.eachBattler do |b| # Other battlers no longer Sky Dropped by self
|
@battle.allBattlers.each do |b| # Other battlers no longer Sky Dropped by self
|
||||||
b.effects[PBEffects::SkyDrop] = -1 if b.effects[PBEffects::SkyDrop]==@index
|
b.effects[PBEffects::SkyDrop] = -1 if b.effects[PBEffects::SkyDrop]==@index
|
||||||
end
|
end
|
||||||
@effects[PBEffects::SlowStart] = 0
|
@effects[PBEffects::SlowStart] = 0
|
||||||
@@ -281,7 +281,7 @@ class PokeBattle_Battler
|
|||||||
@effects[PBEffects::Trapping] = 0
|
@effects[PBEffects::Trapping] = 0
|
||||||
@effects[PBEffects::TrappingMove] = nil
|
@effects[PBEffects::TrappingMove] = nil
|
||||||
@effects[PBEffects::TrappingUser] = -1
|
@effects[PBEffects::TrappingUser] = -1
|
||||||
@battle.eachBattler do |b| # Other battlers no longer trapped by self
|
@battle.allBattlers.each do |b| # Other battlers no longer trapped by self
|
||||||
next if b.effects[PBEffects::TrappingUser]!=@index
|
next if b.effects[PBEffects::TrappingUser]!=@index
|
||||||
b.effects[PBEffects::Trapping] = 0
|
b.effects[PBEffects::Trapping] = 0
|
||||||
b.effects[PBEffects::TrappingUser] = -1
|
b.effects[PBEffects::TrappingUser] = -1
|
||||||
@@ -336,7 +336,7 @@ class PokeBattle_Battler
|
|||||||
# Update which Pokémon will gain Exp if this battler is defeated.
|
# Update which Pokémon will gain Exp if this battler is defeated.
|
||||||
def pbUpdateParticipants
|
def pbUpdateParticipants
|
||||||
return if fainted? || !@battle.opposes?(@index)
|
return if fainted? || !@battle.opposes?(@index)
|
||||||
eachOpposing do |b|
|
allOpposing.each do |b|
|
||||||
@participants.push(b.pokemonIndex) if !@participants.include?(b.pokemonIndex)
|
@participants.push(b.pokemonIndex) if !@participants.include?(b.pokemonIndex)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -76,10 +76,7 @@ class PokeBattle_Battler
|
|||||||
self.statusCount = 0
|
self.statusCount = 0
|
||||||
# Lose happiness
|
# Lose happiness
|
||||||
if @pokemon && @battle.internalBattle
|
if @pokemon && @battle.internalBattle
|
||||||
badLoss = false
|
badLoss = @battle.allOtherSideBattlers(@index).any? { |b| b.level >= self.level + 30 }
|
||||||
@battle.eachOtherSideBattler(@index) do |b|
|
|
||||||
badLoss = true if b.level>=self.level+30
|
|
||||||
end
|
|
||||||
@pokemon.changeHappiness((badLoss) ? "faintbad" : "faint")
|
@pokemon.changeHappiness((badLoss) ? "faintbad" : "faint")
|
||||||
end
|
end
|
||||||
# Reset form
|
# Reset form
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class PokeBattle_Battler
|
|||||||
end
|
end
|
||||||
# Uproar immunity
|
# Uproar immunity
|
||||||
if newStatus == :SLEEP && !(hasActiveAbility?(:SOUNDPROOF) && !@battle.moldBreaker)
|
if newStatus == :SLEEP && !(hasActiveAbility?(:SOUNDPROOF) && !@battle.moldBreaker)
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
next if b.effects[PBEffects::Uproar]==0
|
next if b.effects[PBEffects::Uproar]==0
|
||||||
@battle.pbDisplay(_INTL("But the uproar kept {1} awake!",pbThis(true))) if showMessages
|
@battle.pbDisplay(_INTL("But the uproar kept {1} awake!",pbThis(true))) if showMessages
|
||||||
return false
|
return false
|
||||||
@@ -108,7 +108,7 @@ class PokeBattle_Battler
|
|||||||
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability,self,newStatus)
|
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability,self,newStatus)
|
||||||
immuneByAbility = true
|
immuneByAbility = true
|
||||||
else
|
else
|
||||||
eachAlly do |b|
|
allAllies.each do |b|
|
||||||
next if !b.abilityActive?
|
next if !b.abilityActive?
|
||||||
next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability,self,newStatus)
|
next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability,self,newStatus)
|
||||||
immuneByAbility = true
|
immuneByAbility = true
|
||||||
@@ -198,7 +198,7 @@ class PokeBattle_Battler
|
|||||||
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability,self,newStatus)
|
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability,self,newStatus)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
eachAlly do |b|
|
allAllies.each do |b|
|
||||||
next if !b.abilityActive?
|
next if !b.abilityActive?
|
||||||
next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability,self,newStatus)
|
next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability,self,newStatus)
|
||||||
return false
|
return false
|
||||||
@@ -285,9 +285,7 @@ class PokeBattle_Battler
|
|||||||
return false if [:Electric, :Misty].include?(@battle.field.terrain)
|
return false if [:Electric, :Misty].include?(@battle.field.terrain)
|
||||||
end
|
end
|
||||||
if !hasActiveAbility?(:SOUNDPROOF)
|
if !hasActiveAbility?(:SOUNDPROOF)
|
||||||
@battle.eachBattler do |b|
|
return false if @battle.allBattlers.any? { |b| b.effects[PBEffects::Uproar] > 0 }
|
||||||
return false if b.effects[PBEffects::Uproar]>0
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability, self, :SLEEP)
|
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability, self, :SLEEP)
|
||||||
return false
|
return false
|
||||||
@@ -298,7 +296,7 @@ class PokeBattle_Battler
|
|||||||
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability, self, :SLEEP)
|
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability, self, :SLEEP)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
eachAlly do |b|
|
allAllies.each do |b|
|
||||||
next if !b.abilityActive?
|
next if !b.abilityActive?
|
||||||
next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability, self, :SLEEP)
|
next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability, self, :SLEEP)
|
||||||
return false
|
return false
|
||||||
@@ -531,7 +529,7 @@ class PokeBattle_Battler
|
|||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
eachAlly do |b|
|
allAllies.each do |b|
|
||||||
next if !b.hasActiveAbility?(:AROMAVEIL)
|
next if !b.hasActiveAbility?(:AROMAVEIL)
|
||||||
if showMessages
|
if showMessages
|
||||||
@battle.pbShowAbilitySplash(self)
|
@battle.pbShowAbilitySplash(self)
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ class PokeBattle_Battler
|
|||||||
self.ability,self,stat,@battle,showFailMsg)
|
self.ability,self,stat,@battle,showFailMsg)
|
||||||
end
|
end
|
||||||
if !@battle.moldBreaker
|
if !@battle.moldBreaker
|
||||||
eachAlly do |b|
|
allAllies.each do |b|
|
||||||
next if !b.abilityActive?
|
next if !b.abilityActive?
|
||||||
return false if BattleHandlers.triggerStatLossImmunityAllyAbility(
|
return false if BattleHandlers.triggerStatLossImmunityAllyAbility(
|
||||||
b.ability,b,self,stat,@battle,showFailMsg)
|
b.ability,b,self,stat,@battle,showFailMsg)
|
||||||
@@ -327,7 +327,7 @@ class PokeBattle_Battler
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
eachAlly do |b|
|
allAllies.each do |b|
|
||||||
next if !b.abilityActive?
|
next if !b.abilityActive?
|
||||||
if BattleHandlers.triggerStatLossImmunityAllyAbility(b.ability,b,self,:ATTACK,@battle,false)
|
if BattleHandlers.triggerStatLossImmunityAllyAbility(b.ability,b,self,:ATTACK,@battle,false)
|
||||||
@battle.pbDisplay(_INTL("{1} is protected from {2}'s {3} by {4}'s {5}!",
|
@battle.pbDisplay(_INTL("{1} is protected from {2}'s {3} by {4}'s {5}!",
|
||||||
|
|||||||
@@ -73,11 +73,10 @@ class PokeBattle_Battler
|
|||||||
# up later. Essentials ignores this, and allows Trace to trigger
|
# up later. Essentials ignores this, and allows Trace to trigger
|
||||||
# whenever it can even in the old battle mechanics.
|
# whenever it can even in the old battle mechanics.
|
||||||
choices = []
|
choices = []
|
||||||
@battle.eachOtherSideBattler(@index) do |b|
|
choices = @battle.allOtherSideBattlers(@index).select { |b|
|
||||||
next if b.ungainableAbility? ||
|
next !b.ungainableAbility? &&
|
||||||
[:POWEROFALCHEMY, :RECEIVER, :TRACE].include?(b.ability_id)
|
![:POWEROFALCHEMY, :RECEIVER, :TRACE].include?(b.ability_id)
|
||||||
choices.push(b)
|
}
|
||||||
end
|
|
||||||
if choices.length>0
|
if choices.length>0
|
||||||
choice = choices[@battle.pbRandom(choices.length)]
|
choice = choices[@battle.pbRandom(choices.length)]
|
||||||
@battle.pbShowAbilitySplash(self)
|
@battle.pbShowAbilitySplash(self)
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class PokeBattle_Battler
|
|||||||
@effects[PBEffects::Charge] = 0 if @effects[PBEffects::Charge]==1
|
@effects[PBEffects::Charge] = 0 if @effects[PBEffects::Charge]==1
|
||||||
@effects[PBEffects::GemConsumed] = nil
|
@effects[PBEffects::GemConsumed] = nil
|
||||||
@effects[PBEffects::ShellTrap] = false
|
@effects[PBEffects::ShellTrap] = false
|
||||||
@battle.eachBattler { |b| b.pbContinualAbilityChecks } # Trace, end primordial weathers
|
@battle.allBattlers.each { |b| b.pbContinualAbilityChecks } # Trace, end primordial weathers
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbConfusionDamage(msg)
|
def pbConfusionDamage(msg)
|
||||||
@@ -271,7 +271,7 @@ class PokeBattle_Battler
|
|||||||
user.pbReducePP(move)
|
user.pbReducePP(move)
|
||||||
end
|
end
|
||||||
if move.pbTarget(user).affects_foe_side
|
if move.pbTarget(user).affects_foe_side
|
||||||
@battle.eachOtherSideBattler(user) do |b|
|
@battle.allOtherSideBattlers(user).each do |b|
|
||||||
next unless b.hasActiveAbility?(:PRESSURE)
|
next unless b.hasActiveAbility?(:PRESSURE)
|
||||||
PBDebug.log("[Ability triggered] #{b.pbThis}'s #{b.abilityName}")
|
PBDebug.log("[Ability triggered] #{b.pbThis}'s #{b.abilityName}")
|
||||||
user.pbReducePP(move)
|
user.pbReducePP(move)
|
||||||
@@ -384,7 +384,7 @@ class PokeBattle_Battler
|
|||||||
user.lastMoveFailed = true
|
user.lastMoveFailed = true
|
||||||
else # We have targets, or move doesn't use targets
|
else # We have targets, or move doesn't use targets
|
||||||
# Reset whole damage state, perform various success checks (not accuracy)
|
# Reset whole damage state, perform various success checks (not accuracy)
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
b.droppedBelowHalfHP = false
|
b.droppedBelowHalfHP = false
|
||||||
b.statsDropped = false
|
b.statsDropped = false
|
||||||
end
|
end
|
||||||
@@ -499,7 +499,7 @@ class PokeBattle_Battler
|
|||||||
user.pbFaint if user.fainted?
|
user.pbFaint if user.fainted?
|
||||||
# External/general effects after all hits. Eject Button, Shell Bell, etc.
|
# External/general effects after all hits. Eject Button, Shell Bell, etc.
|
||||||
pbEffectsAfterMove(user,targets,move,realNumHits)
|
pbEffectsAfterMove(user,targets,move,realNumHits)
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
b.droppedBelowHalfHP = false
|
b.droppedBelowHalfHP = false
|
||||||
b.statsDropped = false
|
b.statsDropped = false
|
||||||
end
|
end
|
||||||
@@ -509,13 +509,13 @@ class PokeBattle_Battler
|
|||||||
# Gain Exp
|
# Gain Exp
|
||||||
@battle.pbGainExp
|
@battle.pbGainExp
|
||||||
# Battle Arena only - update skills
|
# Battle Arena only - update skills
|
||||||
@battle.eachBattler { |b| @battle.successStates[b.index].updateSkill }
|
@battle.allBattlers.each { |b| @battle.successStates[b.index].updateSkill }
|
||||||
# Shadow Pokémon triggering Hyper Mode
|
# Shadow Pokémon triggering Hyper Mode
|
||||||
pbHyperMode if @battle.choices[@index][0]!=:None # Not if self is replaced
|
pbHyperMode if @battle.choices[@index][0]!=:None # Not if self is replaced
|
||||||
# End of move usage
|
# End of move usage
|
||||||
pbEndTurn(choice)
|
pbEndTurn(choice)
|
||||||
# Instruct
|
# Instruct
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
next if !b.effects[PBEffects::Instruct] || !b.lastMoveUsed
|
next if !b.effects[PBEffects::Instruct] || !b.lastMoveUsed
|
||||||
b.effects[PBEffects::Instruct] = false
|
b.effects[PBEffects::Instruct] = false
|
||||||
idxMove = -1
|
idxMove = -1
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class PokeBattle_Battler
|
|||||||
if move.statusMove? && move.canSnatch?
|
if move.statusMove? && move.canSnatch?
|
||||||
newUser = nil
|
newUser = nil
|
||||||
strength = 100
|
strength = 100
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
next if b.effects[PBEffects::Snatch]==0 ||
|
next if b.effects[PBEffects::Snatch]==0 ||
|
||||||
b.effects[PBEffects::Snatch]>=strength
|
b.effects[PBEffects::Snatch]>=strength
|
||||||
next if b.effects[PBEffects::SkyDrop]>=0
|
next if b.effects[PBEffects::SkyDrop]>=0
|
||||||
@@ -49,12 +49,12 @@ class PokeBattle_Battler
|
|||||||
pbAddTarget(targets,user,user,move,true,true)
|
pbAddTarget(targets,user,user,move,true,true)
|
||||||
end
|
end
|
||||||
when :AllAllies
|
when :AllAllies
|
||||||
@battle.eachSameSideBattler(user.index) do |b|
|
@battle.allSameSideBattlers(user.index).each do |b|
|
||||||
pbAddTarget(targets,user,b,move,false,true) if b.index != user.index
|
pbAddTarget(targets,user,b,move,false,true) if b.index != user.index
|
||||||
end
|
end
|
||||||
when :UserAndAllies
|
when :UserAndAllies
|
||||||
pbAddTarget(targets,user,user,move,true,true)
|
pbAddTarget(targets,user,user,move,true,true)
|
||||||
@battle.eachSameSideBattler(user.index) { |b| pbAddTarget(targets,user,b,move,false,true) }
|
@battle.allSameSideBattlers(user.index).each { |b| pbAddTarget(targets, user, b, move, false, true) }
|
||||||
when :NearFoe, :NearOther
|
when :NearFoe, :NearOther
|
||||||
targetBattler = (preTarget>=0) ? @battle.battlers[preTarget] : nil
|
targetBattler = (preTarget>=0) ? @battle.battlers[preTarget] : nil
|
||||||
if !pbAddTarget(targets,user,targetBattler,move)
|
if !pbAddTarget(targets,user,targetBattler,move)
|
||||||
@@ -67,7 +67,7 @@ class PokeBattle_Battler
|
|||||||
when :RandomNearFoe
|
when :RandomNearFoe
|
||||||
pbAddTargetRandomFoe(targets,user,move)
|
pbAddTargetRandomFoe(targets,user,move)
|
||||||
when :AllNearFoes
|
when :AllNearFoes
|
||||||
@battle.eachOtherSideBattler(user.index) { |b| pbAddTarget(targets,user,b,move) }
|
@battle.allOtherSideBattlers(user.index).each { |b| pbAddTarget(targets,user,b,move) }
|
||||||
when :Foe, :Other
|
when :Foe, :Other
|
||||||
targetBattler = (preTarget>=0) ? @battle.battlers[preTarget] : nil
|
targetBattler = (preTarget>=0) ? @battle.battlers[preTarget] : nil
|
||||||
if !pbAddTarget(targets,user,targetBattler,move,false)
|
if !pbAddTarget(targets,user,targetBattler,move,false)
|
||||||
@@ -78,11 +78,11 @@ class PokeBattle_Battler
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
when :AllFoes
|
when :AllFoes
|
||||||
@battle.eachOtherSideBattler(user.index) { |b| pbAddTarget(targets,user,b,move,false) }
|
@battle.allOtherSideBattlers(user.index).each { |b| pbAddTarget(targets,user,b,move,false) }
|
||||||
when :AllNearOthers
|
when :AllNearOthers
|
||||||
@battle.eachBattler { |b| pbAddTarget(targets,user,b,move) }
|
@battle.allBattlers.each { |b| pbAddTarget(targets, user, b, move) }
|
||||||
when :AllBattlers
|
when :AllBattlers
|
||||||
@battle.eachBattler { |b| pbAddTarget(targets,user,b,move,false,true) }
|
@battle.allBattlers.each { |b| pbAddTarget(targets, user, b, move, false, true) }
|
||||||
else
|
else
|
||||||
# Used by Counter/Mirror Coat/Metal Burst/Bide
|
# Used by Counter/Mirror Coat/Metal Burst/Bide
|
||||||
move.pbAddTarget(targets,user) # Move-specific pbAddTarget, not the def below
|
move.pbAddTarget(targets,user) # Move-specific pbAddTarget, not the def below
|
||||||
@@ -181,7 +181,7 @@ class PokeBattle_Battler
|
|||||||
|
|
||||||
def pbAddTargetRandomAlly(targets, user, move, nearOnly = true)
|
def pbAddTargetRandomAlly(targets, user, move, nearOnly = true)
|
||||||
choices = []
|
choices = []
|
||||||
user.eachAlly do |b|
|
user.allAllies.each do |b|
|
||||||
next if nearOnly && !user.near?(b)
|
next if nearOnly && !user.near?(b)
|
||||||
pbAddTarget(choices, user, b, move, nearOnly)
|
pbAddTarget(choices, user, b, move, nearOnly)
|
||||||
end
|
end
|
||||||
@@ -192,7 +192,7 @@ class PokeBattle_Battler
|
|||||||
|
|
||||||
def pbAddTargetRandomFoe(targets, user, move, nearOnly =true)
|
def pbAddTargetRandomFoe(targets, user, move, nearOnly =true)
|
||||||
choices = []
|
choices = []
|
||||||
user.eachOpposing do |b|
|
user.allOpposing.each do |b|
|
||||||
next if nearOnly && !user.near?(b)
|
next if nearOnly && !user.near?(b)
|
||||||
pbAddTarget(choices, user, b, move, nearOnly)
|
pbAddTarget(choices, user, b, move, nearOnly)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -76,8 +76,7 @@ class PokeBattle_Battler
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
# Imprison
|
# Imprison
|
||||||
@battle.eachOtherSideBattler(@index) do |b|
|
if @battle.allOtherSideBattlers(@index).any? { |b| b.effects[PBEffects::Imprison] && b.pbHasMove?(move.id) }
|
||||||
next if !b.effects[PBEffects::Imprison] || !b.pbHasMove?(move.id)
|
|
||||||
if showMessages
|
if showMessages
|
||||||
msg = _INTL("{1} can't use its sealed {2}!",pbThis,move.name)
|
msg = _INTL("{1} can't use its sealed {2}!",pbThis,move.name)
|
||||||
(commandPhase) ? @battle.pbDisplayPaused(msg) : @battle.pbDisplay(msg)
|
(commandPhase) ? @battle.pbDisplayPaused(msg) : @battle.pbDisplay(msg)
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ class PokeBattle_Battler
|
|||||||
end
|
end
|
||||||
# Room Service
|
# Room Service
|
||||||
if move.function == "StartSlowerBattlersActFirst" && @battle.field.effects[PBEffects::TrickRoom] > 0
|
if move.function == "StartSlowerBattlersActFirst" && @battle.field.effects[PBEffects::TrickRoom] > 0
|
||||||
@battle.battlers.each do |b|
|
@battle.allBattlers.each do |b|
|
||||||
next if !b.hasActiveItem?(:ROOMSERVICE)
|
next if !b.hasActiveItem?(:ROOMSERVICE)
|
||||||
next if !b.pbCanLowerStatStage?(:SPEED)
|
next if !b.pbCanLowerStatStage?(:SPEED)
|
||||||
@battle.pbCommonAnimation("UseItem", b)
|
@battle.pbCommonAnimation("UseItem", b)
|
||||||
@@ -172,7 +172,7 @@ class PokeBattle_Battler
|
|||||||
pbEffectsAfterMove3(user, targets, move, numHits, switched_battlers)
|
pbEffectsAfterMove3(user, targets, move, numHits, switched_battlers)
|
||||||
end
|
end
|
||||||
if numHits>0
|
if numHits>0
|
||||||
@battle.eachBattler { |b| b.pbItemEndOfMoveCheck }
|
@battle.allBattlers.each { |b| b.pbItemEndOfMoveCheck }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -101,14 +101,11 @@ class PokeBattle_Move
|
|||||||
def pbFailsAgainstTarget?(user, target, show_message); return false; end
|
def pbFailsAgainstTarget?(user, target, show_message); return false; end
|
||||||
|
|
||||||
def pbMoveFailedLastInRound?(user, showMessage = true)
|
def pbMoveFailedLastInRound?(user, showMessage = true)
|
||||||
unmoved = false
|
unmoved = @battle.allBattlers.any? { |b|
|
||||||
@battle.eachBattler do |b|
|
next b.index != user.index &&
|
||||||
next if b.index==user.index
|
[:UseMove, :Shift].include?(@battle.choices[b.index][0]) &&
|
||||||
next if @battle.choices[b.index][0]!=:UseMove && @battle.choices[b.index][0]!=:Shift
|
!b.movedThisRound?
|
||||||
next if b.movedThisRound?
|
}
|
||||||
unmoved = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if !unmoved
|
if !unmoved
|
||||||
@battle.pbDisplay(_INTL("But it failed!")) if showMessage
|
@battle.pbDisplay(_INTL("But it failed!")) if showMessage
|
||||||
return true
|
return true
|
||||||
@@ -140,7 +137,7 @@ class PokeBattle_Move
|
|||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
target.eachAlly do |b|
|
target.allAllies.each do |b|
|
||||||
next if !b.hasActiveAbility?(:AROMAVEIL)
|
next if !b.hasActiveAbility?(:AROMAVEIL)
|
||||||
if showMessage
|
if showMessage
|
||||||
@battle.pbShowAbilitySplash(target)
|
@battle.pbShowAbilitySplash(target)
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ class PokeBattle_Move
|
|||||||
BattleHandlers.triggerAccuracyCalcUserAbility(user.ability,
|
BattleHandlers.triggerAccuracyCalcUserAbility(user.ability,
|
||||||
modifiers,user,target,self,@calcType)
|
modifiers,user,target,self,@calcType)
|
||||||
end
|
end
|
||||||
user.eachAlly do |b|
|
user.allAllies.each do |b|
|
||||||
next if !b.abilityActive?
|
next if !b.abilityActive?
|
||||||
BattleHandlers.triggerAccuracyCalcUserAllyAbility(b.ability,
|
BattleHandlers.triggerAccuracyCalcUserAllyAbility(b.ability,
|
||||||
modifiers,user,target,self,@calcType)
|
modifiers,user,target,self,@calcType)
|
||||||
@@ -285,7 +285,7 @@ class PokeBattle_Move
|
|||||||
# NOTE: It's odd that the user's Mold Breaker prevents its partner's
|
# NOTE: It's odd that the user's Mold Breaker prevents its partner's
|
||||||
# beneficial abilities (i.e. Flower Gift boosting Atk), but that's
|
# beneficial abilities (i.e. Flower Gift boosting Atk), but that's
|
||||||
# how it works.
|
# how it works.
|
||||||
user.eachAlly do |b|
|
user.allAllies.each do |b|
|
||||||
next if !b.abilityActive?
|
next if !b.abilityActive?
|
||||||
BattleHandlers.triggerDamageCalcUserAllyAbility(b.ability,
|
BattleHandlers.triggerDamageCalcUserAllyAbility(b.ability,
|
||||||
user,target,self,multipliers,baseDmg,type)
|
user,target,self,multipliers,baseDmg,type)
|
||||||
@@ -296,7 +296,7 @@ class PokeBattle_Move
|
|||||||
BattleHandlers.triggerDamageCalcTargetAbilityNonIgnorable(target.ability,
|
BattleHandlers.triggerDamageCalcTargetAbilityNonIgnorable(target.ability,
|
||||||
user,target,self,multipliers,baseDmg,type)
|
user,target,self,multipliers,baseDmg,type)
|
||||||
end
|
end
|
||||||
target.eachAlly do |b|
|
target.allAllies.each do |b|
|
||||||
next if !b.abilityActive?
|
next if !b.abilityActive?
|
||||||
BattleHandlers.triggerDamageCalcTargetAllyAbility(b.ability,
|
BattleHandlers.triggerDamageCalcTargetAllyAbility(b.ability,
|
||||||
user,target,self,multipliers,baseDmg,type)
|
user,target,self,multipliers,baseDmg,type)
|
||||||
@@ -327,10 +327,8 @@ class PokeBattle_Move
|
|||||||
end
|
end
|
||||||
# Mud Sport
|
# Mud Sport
|
||||||
if type == :ELECTRIC
|
if type == :ELECTRIC
|
||||||
@battle.eachBattler do |b|
|
if @Battle.allBattlers.any? { |b| b.effects[PBEffects::MudSport] }
|
||||||
next if !b.effects[PBEffects::MudSport]
|
|
||||||
multipliers[:base_damage_multiplier] /= 3
|
multipliers[:base_damage_multiplier] /= 3
|
||||||
break
|
|
||||||
end
|
end
|
||||||
if @battle.field.effects[PBEffects::MudSportField]>0
|
if @battle.field.effects[PBEffects::MudSportField]>0
|
||||||
multipliers[:base_damage_multiplier] /= 3
|
multipliers[:base_damage_multiplier] /= 3
|
||||||
@@ -338,10 +336,8 @@ class PokeBattle_Move
|
|||||||
end
|
end
|
||||||
# Water Sport
|
# Water Sport
|
||||||
if type == :FIRE
|
if type == :FIRE
|
||||||
@battle.eachBattler do |b|
|
if @Battle.allBattlers.any? { |b| b.effects[PBEffects::WaterSport] }
|
||||||
next if !b.effects[PBEffects::WaterSport]
|
|
||||||
multipliers[:base_damage_multiplier] /= 3
|
multipliers[:base_damage_multiplier] /= 3
|
||||||
break
|
|
||||||
end
|
end
|
||||||
if @battle.field.effects[PBEffects::WaterSportField]>0
|
if @battle.field.effects[PBEffects::WaterSportField]>0
|
||||||
multipliers[:base_damage_multiplier] /= 3
|
multipliers[:base_damage_multiplier] /= 3
|
||||||
|
|||||||
@@ -698,7 +698,7 @@ class PokeBattle_PledgeMove < PokeBattle_Move
|
|||||||
end
|
end
|
||||||
return if @pledgeCombo
|
return if @pledgeCombo
|
||||||
# Check whether this is the setup of a combo move
|
# Check whether this is the setup of a combo move
|
||||||
user.eachAlly do |b|
|
user.allAllies.each do |b|
|
||||||
next if @battle.choices[b.index][0]!=:UseMove || b.movedThisRound?
|
next if @battle.choices[b.index][0]!=:UseMove || b.movedThisRound?
|
||||||
move = @battle.choices[b.index][2]
|
move = @battle.choices[b.index][2]
|
||||||
next if !move
|
next if !move
|
||||||
|
|||||||
@@ -24,12 +24,7 @@ class PokeBattle_Move_DoesNothingFailsIfNoAlly < PokeBattle_Move
|
|||||||
def ignoresSubstitute?(user); return true; end
|
def ignoresSubstitute?(user); return true; end
|
||||||
|
|
||||||
def pbMoveFailed?(user,targets)
|
def pbMoveFailed?(user,targets)
|
||||||
hasAlly = false
|
if user.allAllies.length == 0
|
||||||
user.eachAlly do |_b|
|
|
||||||
hasAlly = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if !hasAlly
|
|
||||||
@battle.pbDisplay(_INTL("But it failed!"))
|
@battle.pbDisplay(_INTL("But it failed!"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -665,7 +660,7 @@ class PokeBattle_Move_UserSwapsPositionsWithAlly < PokeBattle_Move
|
|||||||
numTargets = 0
|
numTargets = 0
|
||||||
@idxAlly = -1
|
@idxAlly = -1
|
||||||
idxUserOwner = @battle.pbGetOwnerIndexFromBattlerIndex(user.index)
|
idxUserOwner = @battle.pbGetOwnerIndexFromBattlerIndex(user.index)
|
||||||
user.eachAlly do |b|
|
user.allAllies.each do |b|
|
||||||
next if @battle.pbGetOwnerIndexFromBattlerIndex(b.index)!=idxUserOwner
|
next if @battle.pbGetOwnerIndexFromBattlerIndex(b.index)!=idxUserOwner
|
||||||
next if !b.near?(user)
|
next if !b.near?(user)
|
||||||
numTargets += 1
|
numTargets += 1
|
||||||
|
|||||||
@@ -1405,7 +1405,7 @@ class PokeBattle_Move_RaiseUserAndAlliesAtkDef1 < PokeBattle_Move
|
|||||||
|
|
||||||
def pbMoveFailed?(user, targets)
|
def pbMoveFailed?(user, targets)
|
||||||
@validTargets = []
|
@validTargets = []
|
||||||
@battle.eachSameSideBattler(user) do |b|
|
@battle.allSameSideBattlers(user).each do |b|
|
||||||
next if b.index == user.index
|
next if b.index == user.index
|
||||||
next if !b.pbCanRaiseStatStage?(:ATTACK, user, self) &&
|
next if !b.pbCanRaiseStatStage?(:ATTACK, user, self) &&
|
||||||
!b.pbCanRaiseStatStage?(:DEFENSE, user, self)
|
!b.pbCanRaiseStatStage?(:DEFENSE, user, self)
|
||||||
@@ -1454,7 +1454,7 @@ class PokeBattle_Move_RaisePlusMinusUserAndAlliesAtkSpAtk1 < PokeBattle_Move
|
|||||||
|
|
||||||
def pbMoveFailed?(user,targets)
|
def pbMoveFailed?(user,targets)
|
||||||
@validTargets = []
|
@validTargets = []
|
||||||
@battle.eachSameSideBattler(user) do |b|
|
@battle.allSameSideBattlers(user).each do |b|
|
||||||
next if !b.hasActiveAbility?([:MINUS,:PLUS])
|
next if !b.hasActiveAbility?([:MINUS,:PLUS])
|
||||||
next if !b.pbCanRaiseStatStage?(:ATTACK,user,self) &&
|
next if !b.pbCanRaiseStatStage?(:ATTACK,user,self) &&
|
||||||
!b.pbCanRaiseStatStage?(:SPECIAL_ATTACK,user,self)
|
!b.pbCanRaiseStatStage?(:SPECIAL_ATTACK,user,self)
|
||||||
@@ -1509,7 +1509,7 @@ class PokeBattle_Move_RaisePlusMinusUserAndAlliesDefSpDef1 < PokeBattle_Move
|
|||||||
|
|
||||||
def pbMoveFailed?(user,targets)
|
def pbMoveFailed?(user,targets)
|
||||||
@validTargets = []
|
@validTargets = []
|
||||||
@battle.eachSameSideBattler(user) do |b|
|
@battle.allSameSideBattlers(user).each do |b|
|
||||||
next if !b.hasActiveAbility?([:MINUS,:PLUS])
|
next if !b.hasActiveAbility?([:MINUS,:PLUS])
|
||||||
next if !b.pbCanRaiseStatStage?(:DEFENSE,user,self) &&
|
next if !b.pbCanRaiseStatStage?(:DEFENSE,user,self) &&
|
||||||
!b.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,user,self)
|
!b.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,user,self)
|
||||||
@@ -1554,7 +1554,7 @@ end
|
|||||||
class PokeBattle_Move_RaiseGroundedGrassBattlersAtkSpAtk1 < PokeBattle_Move
|
class PokeBattle_Move_RaiseGroundedGrassBattlersAtkSpAtk1 < PokeBattle_Move
|
||||||
def pbMoveFailed?(user,targets)
|
def pbMoveFailed?(user,targets)
|
||||||
@validTargets = []
|
@validTargets = []
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
next if !b.pbHasType?(:GRASS)
|
next if !b.pbHasType?(:GRASS)
|
||||||
next if b.airborne? || b.semiInvulnerable?
|
next if b.airborne? || b.semiInvulnerable?
|
||||||
next if !b.pbCanRaiseStatStage?(:ATTACK,user,self) &&
|
next if !b.pbCanRaiseStatStage?(:ATTACK,user,self) &&
|
||||||
@@ -1596,7 +1596,7 @@ end
|
|||||||
class PokeBattle_Move_RaiseGrassBattlersDef1 < PokeBattle_Move
|
class PokeBattle_Move_RaiseGrassBattlersDef1 < PokeBattle_Move
|
||||||
def pbMoveFailed?(user,targets)
|
def pbMoveFailed?(user,targets)
|
||||||
@validTargets = []
|
@validTargets = []
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
next if !b.pbHasType?(:GRASS)
|
next if !b.pbHasType?(:GRASS)
|
||||||
next if b.semiInvulnerable?
|
next if b.semiInvulnerable?
|
||||||
next if !b.pbCanRaiseStatStage?(:DEFENSE,user,self)
|
next if !b.pbCanRaiseStatStage?(:DEFENSE,user,self)
|
||||||
@@ -1788,12 +1788,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
class PokeBattle_Move_ResetAllBattlersStatStages < PokeBattle_Move
|
class PokeBattle_Move_ResetAllBattlersStatStages < PokeBattle_Move
|
||||||
def pbMoveFailed?(user,targets)
|
def pbMoveFailed?(user,targets)
|
||||||
failed = true
|
if @battle.allBattlers.none? { |b| b.hasAlteredStatStages? }
|
||||||
@battle.eachBattler do |b|
|
|
||||||
failed = false if b.hasAlteredStatStages?
|
|
||||||
break if !failed
|
|
||||||
end
|
|
||||||
if failed
|
|
||||||
@battle.pbDisplay(_INTL("But it failed!"))
|
@battle.pbDisplay(_INTL("But it failed!"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -1801,7 +1796,7 @@ class PokeBattle_Move_ResetAllBattlersStatStages < PokeBattle_Move
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbEffectGeneral(user)
|
def pbEffectGeneral(user)
|
||||||
@battle.eachBattler { |b| b.pbResetStatStages }
|
@battle.allBattlers.each { |b| b.pbResetStatStages }
|
||||||
@battle.pbDisplay(_INTL("All stat changes were eliminated!"))
|
@battle.pbDisplay(_INTL("All stat changes were eliminated!"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -342,20 +342,11 @@ class PokeBattle_Move_CureUserPartyStatus < PokeBattle_Move
|
|||||||
def worksWithNoTargets?; return true; end
|
def worksWithNoTargets?; return true; end
|
||||||
|
|
||||||
def pbMoveFailed?(user,targets)
|
def pbMoveFailed?(user,targets)
|
||||||
failed = true
|
has_effect = @battle.allSameSideBattlers(user).any? { |b| b.status != :NONE }
|
||||||
@battle.eachSameSideBattler(user) do |b|
|
if !has_effect
|
||||||
next if b.status == :NONE
|
has_effect = @battle.pbParty(user.index).any? { |pkmn| pkmn && pkmn.able? && pkmn.status != :NONE }
|
||||||
failed = false
|
|
||||||
break
|
|
||||||
end
|
end
|
||||||
if failed
|
if !has_effect
|
||||||
@battle.pbParty(user.index).each do |pkmn|
|
|
||||||
next if !pkmn || !pkmn.able? || pkmn.status == :NONE
|
|
||||||
failed = false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if failed
|
|
||||||
@battle.pbDisplay(_INTL("But it failed!"))
|
@battle.pbDisplay(_INTL("But it failed!"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -398,9 +389,8 @@ class PokeBattle_Move_CureUserPartyStatus < PokeBattle_Move
|
|||||||
# Cure all Pokémon in battle on the user's side. For the benefit of the Gen
|
# Cure all Pokémon in battle on the user's side. For the benefit of the Gen
|
||||||
# 5 version of this move, to make Pokémon out in battle get cured first.
|
# 5 version of this move, to make Pokémon out in battle get cured first.
|
||||||
if pbTarget(user) == :UserSide
|
if pbTarget(user) == :UserSide
|
||||||
@battle.eachSameSideBattler(user) do |b|
|
@battle.allSameSideBattlers(user).each do |b|
|
||||||
next if b.status == :NONE
|
pbAromatherapyHeal(b.pokemon, b) if b.status != :NONE
|
||||||
pbAromatherapyHeal(b.pokemon,b)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Cure all Pokémon in the user's and partner trainer's party.
|
# Cure all Pokémon in the user's and partner trainer's party.
|
||||||
@@ -1237,7 +1227,7 @@ class PokeBattle_Move_StartGravity < PokeBattle_Move
|
|||||||
def pbEffectGeneral(user)
|
def pbEffectGeneral(user)
|
||||||
@battle.field.effects[PBEffects::Gravity] = 5
|
@battle.field.effects[PBEffects::Gravity] = 5
|
||||||
@battle.pbDisplay(_INTL("Gravity intensified!"))
|
@battle.pbDisplay(_INTL("Gravity intensified!"))
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
showMessage = false
|
showMessage = false
|
||||||
if b.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
|
if b.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
|
||||||
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
|
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ end
|
|||||||
class PokeBattle_Move_DamageTargetAlly < PokeBattle_Move
|
class PokeBattle_Move_DamageTargetAlly < PokeBattle_Move
|
||||||
def pbEffectWhenDealingDamage(user,target)
|
def pbEffectWhenDealingDamage(user,target)
|
||||||
hitAlly = []
|
hitAlly = []
|
||||||
target.eachAlly do |b|
|
target.allAllies.each do |b|
|
||||||
next if !b.near?(target.index)
|
next if !b.near?(target.index)
|
||||||
next if !b.takesIndirectDamage?
|
next if !b.takesIndirectDamage?
|
||||||
hitAlly.push([b.index,b.hp])
|
hitAlly.push([b.index,b.hp])
|
||||||
@@ -711,8 +711,7 @@ class PokeBattle_Move_StartWeakenElectricMoves < PokeBattle_Move
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@battle.eachBattler do |b|
|
if @battle.allBattlers.any? { |b| b.effects[PBEffects::MudSport] }
|
||||||
next if !b.effects[PBEffects::MudSport]
|
|
||||||
@battle.pbDisplay(_INTL("But it failed!"))
|
@battle.pbDisplay(_INTL("But it failed!"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -741,8 +740,7 @@ class PokeBattle_Move_StartWeakenFireMoves < PokeBattle_Move
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@battle.eachBattler do |b|
|
if @battle.allBattlers.any? { |b| b.effects[PBEffects::WaterSport] }
|
||||||
next if !b.effects[PBEffects::WaterSport]
|
|
||||||
@battle.pbDisplay(_INTL("But it failed!"))
|
@battle.pbDisplay(_INTL("But it failed!"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class PokeBattle_Move_HitTwoTimesTargetThenTargetAlly < PokeBattle_Move
|
|||||||
def pbModifyTargets(targets, user)
|
def pbModifyTargets(targets, user)
|
||||||
return if targets.length != 1
|
return if targets.length != 1
|
||||||
choices = []
|
choices = []
|
||||||
targets[0].eachAlly { |b| user.pbAddTarget(choices, user, b, self) }
|
targets[0].allAllies.each { |b| user.pbAddTarget(choices, user, b, self) }
|
||||||
return if choices.length == 0
|
return if choices.length == 0
|
||||||
idxChoice = (choices.length > 1) ? @battle.pbRandom(choices.length) : 0
|
idxChoice = (choices.length > 1) ? @battle.pbRandom(choices.length) : 0
|
||||||
user.pbAddTarget(targets, user, choices[idxChoice], self, !pbTarget(user).can_choose_distant_target?)
|
user.pbAddTarget(targets, user, choices[idxChoice], self, !pbTarget(user).can_choose_distant_target?)
|
||||||
|
|||||||
@@ -210,13 +210,7 @@ class PokeBattle_Move_HealUserAndAlliesQuarterOfTotalHP < PokeBattle_Move
|
|||||||
def healingMove?; return true; end
|
def healingMove?; return true; end
|
||||||
|
|
||||||
def pbMoveFailed?(user, targets)
|
def pbMoveFailed?(user, targets)
|
||||||
failed = true
|
if @battle.allSameSideBattlers(user).none? { |b| b.canHeal? }
|
||||||
@battle.eachSameSideBattler(user) do |b|
|
|
||||||
next if !b.canHeal?
|
|
||||||
failed = false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if failed
|
|
||||||
@battle.pbDisplay(_INTL("But it failed!"))
|
@battle.pbDisplay(_INTL("But it failed!"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -241,13 +235,7 @@ class PokeBattle_Move_HealUserAndAlliesQuarterOfTotalHPCureStatus < PokeBattle_M
|
|||||||
def healingMove?; return true; end
|
def healingMove?; return true; end
|
||||||
|
|
||||||
def pbMoveFailed?(user, targets)
|
def pbMoveFailed?(user, targets)
|
||||||
failed = true
|
if @battle.allSameSideBattlers(user).none? { |b| b.canHeal? || b.status != :NONE }
|
||||||
@battle.eachSameSideBattler(user) do |b|
|
|
||||||
next if b.status == :NONE && !b.canHeal?
|
|
||||||
failed = false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if failed
|
|
||||||
@battle.pbDisplay(_INTL("But it failed!"))
|
@battle.pbDisplay(_INTL("But it failed!"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
class PokeBattle_Move_RedirectAllMovesToUser < PokeBattle_Move
|
class PokeBattle_Move_RedirectAllMovesToUser < PokeBattle_Move
|
||||||
def pbEffectGeneral(user)
|
def pbEffectGeneral(user)
|
||||||
user.effects[PBEffects::FollowMe] = 1
|
user.effects[PBEffects::FollowMe] = 1
|
||||||
user.eachAlly do |b|
|
user.allAllies.each do |b|
|
||||||
next if b.effects[PBEffects::FollowMe]<user.effects[PBEffects::FollowMe]
|
next if b.effects[PBEffects::FollowMe]<user.effects[PBEffects::FollowMe]
|
||||||
user.effects[PBEffects::FollowMe] = b.effects[PBEffects::FollowMe]+1
|
user.effects[PBEffects::FollowMe] = b.effects[PBEffects::FollowMe]+1
|
||||||
end
|
end
|
||||||
@@ -23,7 +23,7 @@ class PokeBattle_Move_RedirectAllMovesToTarget < PokeBattle_Move
|
|||||||
|
|
||||||
def pbEffectAgainstTarget(user,target)
|
def pbEffectAgainstTarget(user,target)
|
||||||
target.effects[PBEffects::Spotlight] = 1
|
target.effects[PBEffects::Spotlight] = 1
|
||||||
target.eachAlly do |b|
|
target.allAllies.each do |b|
|
||||||
next if b.effects[PBEffects::Spotlight]<target.effects[PBEffects::Spotlight]
|
next if b.effects[PBEffects::Spotlight]<target.effects[PBEffects::Spotlight]
|
||||||
target.effects[PBEffects::Spotlight] = b.effects[PBEffects::Spotlight]+1
|
target.effects[PBEffects::Spotlight] = b.effects[PBEffects::Spotlight]+1
|
||||||
end
|
end
|
||||||
@@ -1202,7 +1202,7 @@ end
|
|||||||
class PokeBattle_Move_StealAndUseBeneficialStatusMove < PokeBattle_Move
|
class PokeBattle_Move_StealAndUseBeneficialStatusMove < PokeBattle_Move
|
||||||
def pbEffectGeneral(user)
|
def pbEffectGeneral(user)
|
||||||
user.effects[PBEffects::Snatch] = 1
|
user.effects[PBEffects::Snatch] = 1
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
next if b.effects[PBEffects::Snatch]<user.effects[PBEffects::Snatch]
|
next if b.effects[PBEffects::Snatch]<user.effects[PBEffects::Snatch]
|
||||||
user.effects[PBEffects::Snatch] = b.effects[PBEffects::Snatch]+1
|
user.effects[PBEffects::Snatch] = b.effects[PBEffects::Snatch]+1
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ class PokeBattle_Move_UsedAfterAllyRoundWithDoublePower < PokeBattle_Move
|
|||||||
|
|
||||||
def pbEffectGeneral(user)
|
def pbEffectGeneral(user)
|
||||||
user.pbOwnSide.effects[PBEffects::Round] = true
|
user.pbOwnSide.effects[PBEffects::Round] = true
|
||||||
user.eachAlly do |b|
|
user.allAllies.each do |b|
|
||||||
next if @battle.choices[b.index][0]!=:UseMove || b.movedThisRound?
|
next if @battle.choices[b.index][0]!=:UseMove || b.movedThisRound?
|
||||||
next if @battle.choices[b.index][2].function!=@function
|
next if @battle.choices[b.index][2].function!=@function
|
||||||
b.effects[PBEffects::MoveNext] = true
|
b.effects[PBEffects::MoveNext] = true
|
||||||
@@ -509,7 +509,7 @@ class PokeBattle_Move_TargetActsLast < PokeBattle_Move
|
|||||||
end
|
end
|
||||||
# Target is already maximally Quashed and will move last anyway
|
# Target is already maximally Quashed and will move last anyway
|
||||||
highestQuash = 0
|
highestQuash = 0
|
||||||
@battle.battlers.each do |b|
|
@battle.allBattlers.each do |b|
|
||||||
next if b.effects[PBEffects::Quash]<=highestQuash
|
next if b.effects[PBEffects::Quash]<=highestQuash
|
||||||
highestQuash = b.effects[PBEffects::Quash]
|
highestQuash = b.effects[PBEffects::Quash]
|
||||||
end
|
end
|
||||||
@@ -527,7 +527,7 @@ class PokeBattle_Move_TargetActsLast < PokeBattle_Move
|
|||||||
|
|
||||||
def pbEffectAgainstTarget(user,target)
|
def pbEffectAgainstTarget(user,target)
|
||||||
highestQuash = 0
|
highestQuash = 0
|
||||||
@battle.battlers.each do |b|
|
@battle.allBattlers.each do |b|
|
||||||
next if b.effects[PBEffects::Quash]<=highestQuash
|
next if b.effects[PBEffects::Quash]<=highestQuash
|
||||||
highestQuash = b.effects[PBEffects::Quash]
|
highestQuash = b.effects[PBEffects::Quash]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -72,12 +72,7 @@ module PokeBattle_BattleCommon
|
|||||||
else
|
else
|
||||||
battler = @battlers[idxBattler].pbDirectOpposing(true)
|
battler = @battlers[idxBattler].pbDirectOpposing(true)
|
||||||
end
|
end
|
||||||
if battler.fainted?
|
battler = battler.allAllies[0] if battler.fainted?
|
||||||
battler.eachAlly do |b|
|
|
||||||
battler = b
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
# Messages
|
# Messages
|
||||||
itemName = GameData::Item.get(ball).name
|
itemName = GameData::Item.get(ball).name
|
||||||
if battler.fainted?
|
if battler.fainted?
|
||||||
|
|||||||
@@ -327,8 +327,7 @@ class PokeBattle_Battle
|
|||||||
|
|
||||||
def pbAbleNonActiveCount(idxBattler=0)
|
def pbAbleNonActiveCount(idxBattler=0)
|
||||||
party = pbParty(idxBattler)
|
party = pbParty(idxBattler)
|
||||||
inBattleIndices = []
|
inBattleIndices = allSameSideBattlers(idxBattler).map { |b| b.pokemonIndex }
|
||||||
eachSameSideBattler(idxBattler) { |b| inBattleIndices.push(b.pokemonIndex) }
|
|
||||||
count = 0
|
count = 0
|
||||||
party.each_with_index do |pkmn,idxParty|
|
party.each_with_index do |pkmn,idxParty|
|
||||||
next if !pkmn || !pkmn.able?
|
next if !pkmn || !pkmn.able?
|
||||||
@@ -343,8 +342,7 @@ class PokeBattle_Battle
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbTeamAbleNonActiveCount(idxBattler = 0)
|
def pbTeamAbleNonActiveCount(idxBattler = 0)
|
||||||
inBattleIndices = []
|
inBattleIndices = allSameSideBattlers(idxBattler).map { |b| b.pokemonIndex }
|
||||||
eachSameSideBattler(idxBattler) { |b| inBattleIndices.push(b.pokemonIndex) }
|
|
||||||
count = 0
|
count = 0
|
||||||
eachInTeamFromBattlerIndex(idxBattler) do |pkmn, i|
|
eachInTeamFromBattlerIndex(idxBattler) do |pkmn, i|
|
||||||
next if !pkmn || !pkmn.able?
|
next if !pkmn || !pkmn.able?
|
||||||
@@ -434,46 +432,57 @@ class PokeBattle_Battle
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Iterate through battlers
|
# Iterate through battlers
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
# Unused
|
||||||
def eachBattler
|
def eachBattler
|
||||||
@battlers.each { |b| yield b if b && !b.fainted? }
|
@battlers.each { |b| yield b if b && !b.fainted? }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def allBattlers
|
||||||
|
return @battlers.select { |b| b && !b.fainted? }
|
||||||
|
end
|
||||||
|
|
||||||
|
# Unused
|
||||||
def eachSameSideBattler(idxBattler=0)
|
def eachSameSideBattler(idxBattler=0)
|
||||||
idxBattler = idxBattler.index if idxBattler.respond_to?("index")
|
idxBattler = idxBattler.index if idxBattler.respond_to?("index")
|
||||||
@battlers.each { |b| yield b if b && !b.fainted? && !b.opposes?(idxBattler) }
|
@battlers.each { |b| yield b if b && !b.fainted? && !b.opposes?(idxBattler) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def allSameSideBattlers(idxBattler = 0)
|
||||||
|
idxBattler = idxBattler.index if idxBattler.respond_to?("index")
|
||||||
|
return @battlers.select { |b| b && !b.fainted? && !b.opposes?(idxBattler) }
|
||||||
|
end
|
||||||
|
|
||||||
|
# Unused
|
||||||
def eachOtherSideBattler(idxBattler=0)
|
def eachOtherSideBattler(idxBattler=0)
|
||||||
idxBattler = idxBattler.index if idxBattler.respond_to?("index")
|
idxBattler = idxBattler.index if idxBattler.respond_to?("index")
|
||||||
@battlers.each { |b| yield b if b && !b.fainted? && b.opposes?(idxBattler) }
|
@battlers.each { |b| yield b if b && !b.fainted? && b.opposes?(idxBattler) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def allOtherSideBattlers(idxBattler = 0)
|
||||||
|
idxBattler = idxBattler.index if idxBattler.respond_to?("index")
|
||||||
|
return @battlers.select { |b| b && !b.fainted? && b.opposes?(idxBattler) }
|
||||||
|
end
|
||||||
|
|
||||||
def pbSideBattlerCount(idxBattler=0)
|
def pbSideBattlerCount(idxBattler=0)
|
||||||
ret = 0
|
return allSameSideBattlers(idxBattler).length
|
||||||
eachSameSideBattler(idxBattler) { |_b| ret += 1 }
|
|
||||||
return ret
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbOpposingBattlerCount(idxBattler=0)
|
def pbOpposingBattlerCount(idxBattler=0)
|
||||||
ret = 0
|
return allOtherSideBattlers(idxBattler).length
|
||||||
eachOtherSideBattler(idxBattler) { |_b| ret += 1 }
|
|
||||||
return ret
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# This method only counts the player's Pokémon, not a partner trainer's.
|
# This method only counts the player's Pokémon, not a partner trainer's.
|
||||||
def pbPlayerBattlerCount
|
def pbPlayerBattlerCount
|
||||||
ret = 0
|
return allSameSideBattlers(idxBattler).select { |b| b.pbOwnedByPlayer? }.length
|
||||||
eachSameSideBattler { |b| ret += 1 if b.pbOwnedByPlayer? }
|
|
||||||
return ret
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCheckGlobalAbility(abil)
|
def pbCheckGlobalAbility(abil)
|
||||||
eachBattler { |b| return b if b.hasActiveAbility?(abil) }
|
allBattlers.each { |b| return b if b.hasActiveAbility?(abil) }
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCheckOpposingAbility(abil,idxBattler=0,nearOnly=false)
|
def pbCheckOpposingAbility(abil,idxBattler=0,nearOnly=false)
|
||||||
eachOtherSideBattler(idxBattler) do |b|
|
allOtherSideBattlers(idxBattler).each do |b|
|
||||||
next if nearOnly && !b.near?(idxBattler)
|
next if nearOnly && !b.near?(idxBattler)
|
||||||
return b if b.hasActiveAbility?(abil)
|
return b if b.hasActiveAbility?(abil)
|
||||||
end
|
end
|
||||||
@@ -608,7 +617,7 @@ class PokeBattle_Battle
|
|||||||
PBEffects::Octolock,
|
PBEffects::Octolock,
|
||||||
PBEffects::SkyDrop,
|
PBEffects::SkyDrop,
|
||||||
PBEffects::TrappingUser]
|
PBEffects::TrappingUser]
|
||||||
eachBattler do |b|
|
allBattlers.each do |b|
|
||||||
for i in effectsToSwap
|
for i in effectsToSwap
|
||||||
next if b.effects[i]!=idxA && b.effects[i]!=idxB
|
next if b.effects[i]!=idxA && b.effects[i]!=idxB
|
||||||
b.effects[i] = (b.effects[i]==idxA) ? idxB : idxA
|
b.effects[i] = (b.effects[i]==idxA) ? idxB : idxA
|
||||||
@@ -623,7 +632,7 @@ class PokeBattle_Battle
|
|||||||
# Returns the battler representing the Pokémon at index idxParty in its party,
|
# Returns the battler representing the Pokémon at index idxParty in its party,
|
||||||
# on the same side as a battler with battler index of idxBattlerOther.
|
# on the same side as a battler with battler index of idxBattlerOther.
|
||||||
def pbFindBattler(idxParty,idxBattlerOther=0)
|
def pbFindBattler(idxParty,idxBattlerOther=0)
|
||||||
eachSameSideBattler(idxBattlerOther) { |b| return b if b.pokemonIndex==idxParty }
|
allSameSideBattlers(idxBattlerOther).each { |b| return b if b.pokemonIndex==idxParty }
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -681,7 +690,7 @@ class PokeBattle_Battle
|
|||||||
|
|
||||||
# Returns the effective weather (note that weather effects can be negated)
|
# Returns the effective weather (note that weather effects can be negated)
|
||||||
def pbWeather
|
def pbWeather
|
||||||
eachBattler { |b| return :None if b.hasActiveAbility?([:CLOUDNINE, :AIRLOCK]) }
|
return :None if allBattlers.any? { |b| b.hasActiveAbility?([:CLOUDNINE, :AIRLOCK]) }
|
||||||
return @field.weather
|
return @field.weather
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -709,7 +718,7 @@ class PokeBattle_Battle
|
|||||||
when :ShadowSky then pbDisplay(_INTL("A shadow sky appeared!"))
|
when :ShadowSky then pbDisplay(_INTL("A shadow sky appeared!"))
|
||||||
end
|
end
|
||||||
# Check for end of primordial weather, and weather-triggered form changes
|
# Check for end of primordial weather, and weather-triggered form changes
|
||||||
eachBattler { |b| b.pbCheckFormOnWeatherChange }
|
allBattlers.each { |b| b.pbCheckFormOnWeatherChange }
|
||||||
pbEndPrimordialWeather
|
pbEndPrimordialWeather
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -735,7 +744,7 @@ class PokeBattle_Battle
|
|||||||
end
|
end
|
||||||
if @field.weather!=oldWeather
|
if @field.weather!=oldWeather
|
||||||
# Check for form changes caused by the weather changing
|
# Check for form changes caused by the weather changing
|
||||||
eachBattler { |b| b.pbCheckFormOnWeatherChange }
|
allBattlers.each { |b| b.pbCheckFormOnWeatherChange }
|
||||||
# Start up the default weather
|
# Start up the default weather
|
||||||
pbStartWeather(nil,@field.defaultWeather) if @field.defaultWeather != :None
|
pbStartWeather(nil,@field.defaultWeather) if @field.defaultWeather != :None
|
||||||
end
|
end
|
||||||
@@ -770,8 +779,8 @@ class PokeBattle_Battle
|
|||||||
pbDisplay(_INTL("The battlefield got weird!"))
|
pbDisplay(_INTL("The battlefield got weird!"))
|
||||||
end
|
end
|
||||||
# Check for abilities/items that trigger upon the terrain changing
|
# Check for abilities/items that trigger upon the terrain changing
|
||||||
eachBattler { |b| b.pbAbilityOnTerrainChange }
|
allBattlers.each { |b| b.pbAbilityOnTerrainChange }
|
||||||
eachBattler { |b| b.pbItemTerrainStatBoostCheck }
|
allBattlers.each { |b| b.pbItemTerrainStatBoostCheck }
|
||||||
end
|
end
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class PokeBattle_Battle
|
|||||||
return false if !pbCanSwitchLax?(idxBattler,idxParty,partyScene)
|
return false if !pbCanSwitchLax?(idxBattler,idxParty,partyScene)
|
||||||
# Make sure another battler isn't already choosing to switch to the party
|
# Make sure another battler isn't already choosing to switch to the party
|
||||||
# Pokémon
|
# Pokémon
|
||||||
eachSameSideBattler(idxBattler) do |b|
|
allSameSideBattlers(idxBattler).each do |b|
|
||||||
next if choices[b.index][0]!=:SwitchOut || choices[b.index][1]!=idxParty
|
next if choices[b.index][0]!=:SwitchOut || choices[b.index][1]!=idxParty
|
||||||
partyScene.pbDisplay(_INTL("{1} has already been selected.",
|
partyScene.pbDisplay(_INTL("{1} has already been selected.",
|
||||||
pbParty(idxBattler)[idxParty].name)) if partyScene
|
pbParty(idxBattler)[idxParty].name)) if partyScene
|
||||||
@@ -73,7 +73,7 @@ class PokeBattle_Battle
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
# Trapping abilities/items
|
# Trapping abilities/items
|
||||||
eachOtherSideBattler(idxBattler) do |b|
|
allOtherSideBattlers(idxBattler).each do |b|
|
||||||
next if !b.abilityActive?
|
next if !b.abilityActive?
|
||||||
if BattleHandlers.triggerTrappingTargetAbility(b.ability,battler,b,self)
|
if BattleHandlers.triggerTrappingTargetAbility(b.ability,battler,b,self)
|
||||||
partyScene.pbDisplay(_INTL("{1}'s {2} prevents switching!",
|
partyScene.pbDisplay(_INTL("{1}'s {2} prevents switching!",
|
||||||
@@ -81,7 +81,7 @@ class PokeBattle_Battle
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
eachOtherSideBattler(idxBattler) do |b|
|
allOtherSideBattlers(idxBattler).each do |b|
|
||||||
next if !b.itemActive?
|
next if !b.itemActive?
|
||||||
if BattleHandlers.triggerTrappingTargetItem(b.item,battler,b,self)
|
if BattleHandlers.triggerTrappingTargetItem(b.item,battler,b,self)
|
||||||
partyScene.pbDisplay(_INTL("{1}'s {2} prevents switching!",
|
partyScene.pbDisplay(_INTL("{1}'s {2} prevents switching!",
|
||||||
@@ -306,11 +306,11 @@ class PokeBattle_Battle
|
|||||||
def pbOnAllBattlersEnteringBattle
|
def pbOnAllBattlersEnteringBattle
|
||||||
pbCalculatePriority(true)
|
pbCalculatePriority(true)
|
||||||
battler_indices = []
|
battler_indices = []
|
||||||
eachBattler { |b| battler_indices.push(b.index) }
|
allBattlers.each { |b| battler_indices.push(b.index) }
|
||||||
pbOnBattlerEnteringBattle(battler_indices)
|
pbOnBattlerEnteringBattle(battler_indices)
|
||||||
pbCalculatePriority
|
pbCalculatePriority
|
||||||
# Check forms are correct
|
# Check forms are correct
|
||||||
eachBattler { |b| b.pbCheckForm }
|
allBattlers.each { |b| b.pbCheckForm }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Called when one or more Pokémon switch in. Does a lot of things, including
|
# Called when one or more Pokémon switch in. Does a lot of things, including
|
||||||
@@ -326,7 +326,7 @@ class PokeBattle_Battle
|
|||||||
# this resetting would prevent that from happening, so it is skipped
|
# this resetting would prevent that from happening, so it is skipped
|
||||||
# and instead done earlier in def pbAttackPhaseSwitch.
|
# and instead done earlier in def pbAttackPhaseSwitch.
|
||||||
if !skip_event_reset
|
if !skip_event_reset
|
||||||
eachBattler do |b|
|
allBattlers.each do |b|
|
||||||
b.droppedBelowHalfHP = false
|
b.droppedBelowHalfHP = false
|
||||||
b.statsDropped = false
|
b.statsDropped = false
|
||||||
end
|
end
|
||||||
@@ -370,7 +370,7 @@ class PokeBattle_Battle
|
|||||||
break if b.pbItemOnStatDropped
|
break if b.pbItemOnStatDropped
|
||||||
break if b.pbAbilitiesOnDamageTaken
|
break if b.pbAbilitiesOnDamageTaken
|
||||||
end
|
end
|
||||||
eachBattler do |b|
|
allBattlers.each do |b|
|
||||||
b.droppedBelowHalfHP = false
|
b.droppedBelowHalfHP = false
|
||||||
b.statsDropped = false
|
b.statsDropped = false
|
||||||
end
|
end
|
||||||
@@ -382,7 +382,7 @@ class PokeBattle_Battle
|
|||||||
@field.effects[PBEffects::AmuletCoin] = true
|
@field.effects[PBEffects::AmuletCoin] = true
|
||||||
end
|
end
|
||||||
# Update battlers' participants (who will gain Exp/EVs when a battler faints)
|
# Update battlers' participants (who will gain Exp/EVs when a battler faints)
|
||||||
eachBattler { |b| b.pbUpdateParticipants }
|
allBattlers.each { |b| b.pbUpdateParticipants }
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbMessagesOnBattlerEnteringBattle(battler)
|
def pbMessagesOnBattlerEnteringBattle(battler)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class PokeBattle_Battle
|
|||||||
return true if battler.itemActive? &&
|
return true if battler.itemActive? &&
|
||||||
BattleHandlers.triggerRunFromBattleItem(battler.item,battler)
|
BattleHandlers.triggerRunFromBattleItem(battler.item,battler)
|
||||||
return false if battler.trappedInBattle?
|
return false if battler.trappedInBattle?
|
||||||
eachOtherSideBattler(idxBattler) do |b|
|
allOtherSideBattlers(idxBattler).each do |b|
|
||||||
return false if b.abilityActive? &&
|
return false if b.abilityActive? &&
|
||||||
BattleHandlers.triggerTrappingTargetAbility(b.ability,battler,b,self)
|
BattleHandlers.triggerTrappingTargetAbility(b.ability,battler,b,self)
|
||||||
return false if b.itemActive? &&
|
return false if b.itemActive? &&
|
||||||
@@ -101,14 +101,14 @@ class PokeBattle_Battle
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
# Trapping abilities/items
|
# Trapping abilities/items
|
||||||
eachOtherSideBattler(idxBattler) do |b|
|
allOtherSideBattlers(idxBattler).each do |b|
|
||||||
next if !b.abilityActive?
|
next if !b.abilityActive?
|
||||||
if BattleHandlers.triggerTrappingTargetAbility(b.ability,battler,b,self)
|
if BattleHandlers.triggerTrappingTargetAbility(b.ability,battler,b,self)
|
||||||
pbDisplayPaused(_INTL("{1} prevents escape with {2}!",b.pbThis,b.abilityName))
|
pbDisplayPaused(_INTL("{1} prevents escape with {2}!",b.pbThis,b.abilityName))
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
eachOtherSideBattler(idxBattler) do |b|
|
allOtherSideBattlers(idxBattler).each do |b|
|
||||||
next if !b.itemActive?
|
next if !b.itemActive?
|
||||||
if BattleHandlers.triggerTrappingTargetItem(b.item,battler,b,self)
|
if BattleHandlers.triggerTrappingTargetItem(b.item,battler,b,self)
|
||||||
pbDisplayPaused(_INTL("{1} prevents escape with {2}!",b.pbThis,b.itemName))
|
pbDisplayPaused(_INTL("{1} prevents escape with {2}!",b.pbThis,b.itemName))
|
||||||
@@ -122,7 +122,7 @@ class PokeBattle_Battle
|
|||||||
@runCommand += 1 if !duringBattle # Make it easier to flee next time
|
@runCommand += 1 if !duringBattle # Make it easier to flee next time
|
||||||
speedPlayer = @battlers[idxBattler].speed
|
speedPlayer = @battlers[idxBattler].speed
|
||||||
speedEnemy = 1
|
speedEnemy = 1
|
||||||
eachOtherSideBattler(idxBattler) do |b|
|
allOtherSideBattlers(idxBattler).each do |b|
|
||||||
speed = b.speed
|
speed = b.speed
|
||||||
speedEnemy = speed if speedEnemy<speed
|
speedEnemy = speed if speedEnemy<speed
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class PokeBattle_Battle
|
|||||||
pbPursuit(b.index)
|
pbPursuit(b.index)
|
||||||
return if @decision>0
|
return if @decision>0
|
||||||
# Switch Pokémon
|
# Switch Pokémon
|
||||||
eachBattler do |b|
|
allBattlers.each do |b|
|
||||||
b.droppedBelowHalfHP = false
|
b.droppedBelowHalfHP = false
|
||||||
b.statsDropped = false
|
b.statsDropped = false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class PokeBattle_Battle
|
|||||||
end
|
end
|
||||||
@field.weather = :None
|
@field.weather = :None
|
||||||
# Check for form changes caused by the weather changing
|
# Check for form changes caused by the weather changing
|
||||||
eachBattler { |b| b.pbCheckFormOnWeatherChange }
|
allBattlers.each { |b| b.pbCheckFormOnWeatherChange }
|
||||||
# Start up the default weather
|
# Start up the default weather
|
||||||
pbStartWeather(nil,@field.defaultWeather) if @field.defaultWeather != :None
|
pbStartWeather(nil,@field.defaultWeather) if @field.defaultWeather != :None
|
||||||
return if @field.weather == :None
|
return if @field.weather == :None
|
||||||
@@ -119,12 +119,12 @@ class PokeBattle_Battle
|
|||||||
pbDisplay(_INTL("The weirdness disappeared from the battlefield!"))
|
pbDisplay(_INTL("The weirdness disappeared from the battlefield!"))
|
||||||
end
|
end
|
||||||
@field.terrain = :None
|
@field.terrain = :None
|
||||||
eachBattler { |b| b.pbAbilityOnTerrainChange }
|
allBattlers.each { |b| b.pbAbilityOnTerrainChange }
|
||||||
# Start up the default terrain
|
# Start up the default terrain
|
||||||
if @field.defaultTerrain != :None
|
if @field.defaultTerrain != :None
|
||||||
pbStartTerrain(nil, @field.defaultTerrain, false)
|
pbStartTerrain(nil, @field.defaultTerrain, false)
|
||||||
eachBattler { |b| b.pbAbilityOnTerrainChange }
|
allBattlers.each { |b| b.pbAbilityOnTerrainChange }
|
||||||
eachBattler { |b| b.pbItemTerrainStatBoostCheck }
|
allBattlers.each { |b| b.pbItemTerrainStatBoostCheck }
|
||||||
end
|
end
|
||||||
return if @field.terrain == :None
|
return if @field.terrain == :None
|
||||||
end
|
end
|
||||||
@@ -152,12 +152,8 @@ class PokeBattle_Battle
|
|||||||
next if pbSideSize(side)==1 # Only battlers on sides of size 2+ need to move
|
next if pbSideSize(side)==1 # Only battlers on sides of size 2+ need to move
|
||||||
# Check if any battler on this side is near any battler on the other side
|
# Check if any battler on this side is near any battler on the other side
|
||||||
anyNear = false
|
anyNear = false
|
||||||
eachSameSideBattler(side) do |b|
|
allSameSideBattlers(side).each do |b|
|
||||||
eachOtherSideBattler(b) do |otherB|
|
anyNear = allOtherSideBattlers(b).any? { |otherB| nearBattlers?(otherB.index, b.index) }
|
||||||
next if !nearBattlers?(otherB.index,b.index)
|
|
||||||
anyNear = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
break if anyNear
|
break if anyNear
|
||||||
end
|
end
|
||||||
break if anyNear
|
break if anyNear
|
||||||
@@ -170,7 +166,7 @@ class PokeBattle_Battle
|
|||||||
# this code will need revising to account for that, as well as to
|
# this code will need revising to account for that, as well as to
|
||||||
# add more complex code to ensure battlers will end up near each
|
# add more complex code to ensure battlers will end up near each
|
||||||
# other.
|
# other.
|
||||||
eachSameSideBattler(side) do |b|
|
allSameSideBattlers(side).each do |b|
|
||||||
# Get the position to move to
|
# Get the position to move to
|
||||||
pos = -1
|
pos = -1
|
||||||
case pbSideSize(side)
|
case pbSideSize(side)
|
||||||
@@ -217,7 +213,7 @@ class PokeBattle_Battle
|
|||||||
next if pos.effects[PBEffects::FutureSightCounter]>0
|
next if pos.effects[PBEffects::FutureSightCounter]>0
|
||||||
next if !@battlers[idxPos] || @battlers[idxPos].fainted? # No target
|
next if !@battlers[idxPos] || @battlers[idxPos].fainted? # No target
|
||||||
moveUser = nil
|
moveUser = nil
|
||||||
eachBattler do |b|
|
allBattlers.each do |b|
|
||||||
next if b.opposes?(pos.effects[PBEffects::FutureSightUserIndex])
|
next if b.opposes?(pos.effects[PBEffects::FutureSightUserIndex])
|
||||||
next if b.pokemonIndex!=pos.effects[PBEffects::FutureSightUserPartyIndex]
|
next if b.pokemonIndex!=pos.effects[PBEffects::FutureSightUserPartyIndex]
|
||||||
moveUser = b
|
moveUser = b
|
||||||
@@ -598,7 +594,7 @@ class PokeBattle_Battle
|
|||||||
# Try to make Trace work, check for end of primordial weather
|
# Try to make Trace work, check for end of primordial weather
|
||||||
priority.each { |b| b.pbContinualAbilityChecks }
|
priority.each { |b| b.pbContinualAbilityChecks }
|
||||||
# Reset/count down battler-specific effects (no messages)
|
# Reset/count down battler-specific effects (no messages)
|
||||||
eachBattler do |b|
|
allBattlers.each do |b|
|
||||||
b.effects[PBEffects::BanefulBunker] = false
|
b.effects[PBEffects::BanefulBunker] = false
|
||||||
b.effects[PBEffects::Charge] -= 1 if b.effects[PBEffects::Charge]>0
|
b.effects[PBEffects::Charge] -= 1 if b.effects[PBEffects::Charge]>0
|
||||||
b.effects[PBEffects::Counter] = -1
|
b.effects[PBEffects::Counter] = -1
|
||||||
|
|||||||
@@ -1003,10 +1003,8 @@ BattleHandlers::DamageCalcUserAbility.add(:MEGALAUNCHER,
|
|||||||
BattleHandlers::DamageCalcUserAbility.add(:MINUS,
|
BattleHandlers::DamageCalcUserAbility.add(:MINUS,
|
||||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||||
next if !move.specialMove?
|
next if !move.specialMove?
|
||||||
user.eachAlly do |b|
|
if user.allAllies.any? { |b| b.hasActiveAbility?([:MINUS, :PLUS]) }
|
||||||
next if !b.hasActiveAbility?([:MINUS, :PLUS])
|
|
||||||
mults[:attack_multiplier] *= 1.5
|
mults[:attack_multiplier] *= 1.5
|
||||||
break
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -1416,15 +1414,9 @@ BattleHandlers::TargetAbilityOnHit.add(:ANGERPOINT,
|
|||||||
|
|
||||||
BattleHandlers::TargetAbilityOnHit.add(:COTTONDOWN,
|
BattleHandlers::TargetAbilityOnHit.add(:COTTONDOWN,
|
||||||
proc { |ability, user, target, move, battle|
|
proc { |ability, user, target, move, battle|
|
||||||
has_effect = false
|
next if battle.allBattlers.none? { |b| b.pbCanLowerStatStage?(:DEFENSE, target) }
|
||||||
battle.eachBattler do |b|
|
|
||||||
next if !b.pbCanLowerStatStage?(:DEFENSE, target)
|
|
||||||
has_effect = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
next if !has_effect
|
|
||||||
battle.pbShowAbilitySplash(battler)
|
battle.pbShowAbilitySplash(battler)
|
||||||
battle.eachBattler do |b|
|
battle.allBattlers.each do |b|
|
||||||
b.pbLowerStatStageByAbility(:SPEED, 1, target, false)
|
b.pbLowerStatStageByAbility(:SPEED, 1, target, false)
|
||||||
end
|
end
|
||||||
battle.pbHideAbilitySplash(battler)
|
battle.pbHideAbilitySplash(battler)
|
||||||
@@ -2047,7 +2039,7 @@ BattleHandlers::EORWeatherAbility.add(:SOLARPOWER,
|
|||||||
BattleHandlers::EORHealingAbility.add(:HEALER,
|
BattleHandlers::EORHealingAbility.add(:HEALER,
|
||||||
proc { |ability,battler,battle|
|
proc { |ability,battler,battle|
|
||||||
next unless battle.pbRandom(100)<30
|
next unless battle.pbRandom(100)<30
|
||||||
battler.eachAlly do |b|
|
battler.allAllies.each do |b|
|
||||||
next if b.status == :NONE
|
next if b.status == :NONE
|
||||||
battle.pbShowAbilitySplash(battler)
|
battle.pbShowAbilitySplash(battler)
|
||||||
oldStatus = b.status
|
oldStatus = b.status
|
||||||
@@ -2127,7 +2119,7 @@ BattleHandlers::EORHealingAbility.add(:SHEDSKIN,
|
|||||||
|
|
||||||
BattleHandlers::EOREffectAbility.add(:BADDREAMS,
|
BattleHandlers::EOREffectAbility.add(:BADDREAMS,
|
||||||
proc { |ability,battler,battle|
|
proc { |ability,battler,battle|
|
||||||
battle.eachOtherSideBattler(battler.index) do |b|
|
battle.allOtherSideBattlers(battler.index).each do |b|
|
||||||
next if !b.near?(battler) || !b.asleep?
|
next if !b.near?(battler) || !b.asleep?
|
||||||
battle.pbShowAbilitySplash(battler)
|
battle.pbShowAbilitySplash(battler)
|
||||||
next if !b.takesIndirectDamage?(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
|
next if !b.takesIndirectDamage?(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
|
||||||
@@ -2228,7 +2220,7 @@ BattleHandlers::EORGainItemAbility.add(:PICKUP,
|
|||||||
foundItem = nil
|
foundItem = nil
|
||||||
fromBattler = nil
|
fromBattler = nil
|
||||||
use = 0
|
use = 0
|
||||||
battle.eachBattler do |b|
|
battle.allBattlers.each do |b|
|
||||||
next if b.index==battler.index
|
next if b.index==battler.index
|
||||||
next if b.effects[PBEffects::PickupUse]<=use
|
next if b.effects[PBEffects::PickupUse]<=use
|
||||||
foundItem = b.effects[PBEffects::PickupItem]
|
foundItem = b.effects[PBEffects::PickupItem]
|
||||||
@@ -2304,7 +2296,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:ANTICIPATION,
|
|||||||
type2 = battlerTypes[1] || type1
|
type2 = battlerTypes[1] || type1
|
||||||
type3 = battlerTypes[2] || type2
|
type3 = battlerTypes[2] || type2
|
||||||
found = false
|
found = false
|
||||||
battle.eachOtherSideBattler(battler.index) do |b|
|
battle.allOtherSideBattlers(battler.index).each do |b|
|
||||||
b.eachMove do |m|
|
b.eachMove do |m|
|
||||||
next if m.statusMove?
|
next if m.statusMove?
|
||||||
if type1
|
if type1
|
||||||
@@ -2365,15 +2357,9 @@ BattleHandlers::AbilityOnSwitchIn.add(:COMATOSE,
|
|||||||
|
|
||||||
BattleHandlers::AbilityOnSwitchIn.add(:CURIOUSMEDICINE,
|
BattleHandlers::AbilityOnSwitchIn.add(:CURIOUSMEDICINE,
|
||||||
proc { |ability, battler, battle|
|
proc { |ability, battler, battle|
|
||||||
has_effect = false
|
next if battler.allAllies.none? { |b| b.hasAlteredStatStages? }
|
||||||
battler.eachAlly do |b|
|
|
||||||
next if !b.hasAlteredStatStages?
|
|
||||||
has_effect = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
next if !has_effect
|
|
||||||
battle.pbShowAbilitySplash(battler)
|
battle.pbShowAbilitySplash(battler)
|
||||||
battler.eachAlly do |b|
|
battler.allAllies.each do |b|
|
||||||
next if !b.hasAlteredStatStages?
|
next if !b.hasAlteredStatStages?
|
||||||
b.pbResetStatStages
|
b.pbResetStatStages
|
||||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||||
@@ -2416,7 +2402,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:DESOLATELAND,
|
|||||||
BattleHandlers::AbilityOnSwitchIn.add(:DOWNLOAD,
|
BattleHandlers::AbilityOnSwitchIn.add(:DOWNLOAD,
|
||||||
proc { |ability,battler,battle|
|
proc { |ability,battler,battle|
|
||||||
oDef = oSpDef = 0
|
oDef = oSpDef = 0
|
||||||
battle.eachOtherSideBattler(battler.index) do |b|
|
battle.allOtherSideBattlers(battler.index).each do |b|
|
||||||
oDef += b.defense
|
oDef += b.defense
|
||||||
oSpDef += b.spdef
|
oSpDef += b.spdef
|
||||||
end
|
end
|
||||||
@@ -2459,7 +2445,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:FOREWARN,
|
|||||||
next if !battler.pbOwnedByPlayer?
|
next if !battler.pbOwnedByPlayer?
|
||||||
highestPower = 0
|
highestPower = 0
|
||||||
forewarnMoves = []
|
forewarnMoves = []
|
||||||
battle.eachOtherSideBattler(battler.index) do |b|
|
battle.allOtherSideBattlers(battler.index).each do |b|
|
||||||
b.eachMove do |m|
|
b.eachMove do |m|
|
||||||
power = m.baseDamage
|
power = m.baseDamage
|
||||||
power = 160 if ["OHKO", "OHKOIce", "OHKOHitsUndergroundTarget"].include?(m.function)
|
power = 160 if ["OHKO", "OHKOIce", "OHKOHitsUndergroundTarget"].include?(m.function)
|
||||||
@@ -2509,10 +2495,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:FOREWARN,
|
|||||||
BattleHandlers::AbilityOnSwitchIn.add(:FRISK,
|
BattleHandlers::AbilityOnSwitchIn.add(:FRISK,
|
||||||
proc { |ability,battler,battle|
|
proc { |ability,battler,battle|
|
||||||
next if !battler.pbOwnedByPlayer?
|
next if !battler.pbOwnedByPlayer?
|
||||||
foes = []
|
foes = battle.allOtherSideBattlers(battler.index).select { |b| b.item }
|
||||||
battle.eachOtherSideBattler(battler.index) do |b|
|
|
||||||
foes.push(b) if b.item
|
|
||||||
end
|
|
||||||
if foes.length>0
|
if foes.length>0
|
||||||
battle.pbShowAbilitySplash(battler)
|
battle.pbShowAbilitySplash(battler)
|
||||||
if Settings::MECHANICS_GENERATION >= 6
|
if Settings::MECHANICS_GENERATION >= 6
|
||||||
@@ -2573,7 +2556,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:IMPOSTER,
|
|||||||
BattleHandlers::AbilityOnSwitchIn.add(:INTIMIDATE,
|
BattleHandlers::AbilityOnSwitchIn.add(:INTIMIDATE,
|
||||||
proc { |ability,battler,battle|
|
proc { |ability,battler,battle|
|
||||||
battle.pbShowAbilitySplash(battler)
|
battle.pbShowAbilitySplash(battler)
|
||||||
battle.eachOtherSideBattler(battler.index) do |b|
|
battle.allOtherSideBattlers(battler.index).each do |b|
|
||||||
next if !b.near?(battler)
|
next if !b.near?(battler)
|
||||||
check_item = true
|
check_item = true
|
||||||
if b.hasActiveAbility?(:CONTRARY)
|
if b.hasActiveAbility?(:CONTRARY)
|
||||||
@@ -2624,7 +2607,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:NEUTRALIZINGGAS,
|
|||||||
battle.pbShowAbilitySplash(battler, true)
|
battle.pbShowAbilitySplash(battler, true)
|
||||||
battle.pbHideAbilitySplash(battler)
|
battle.pbHideAbilitySplash(battler)
|
||||||
battle.pbDisplay(_INTL("Neutralizing gas filled the area!"))
|
battle.pbDisplay(_INTL("Neutralizing gas filled the area!"))
|
||||||
battle.eachBattler do |b|
|
battle.allBattlers.each do |b|
|
||||||
# Slow Start - end all turn counts
|
# Slow Start - end all turn counts
|
||||||
b.effects[PBEffects::SlowStart] = 0
|
b.effects[PBEffects::SlowStart] = 0
|
||||||
# Truant - let b move on its first turn after Neutralizing Gas disappears
|
# Truant - let b move on its first turn after Neutralizing Gas disappears
|
||||||
@@ -2648,15 +2631,9 @@ BattleHandlers::AbilityOnSwitchIn.add(:NEUTRALIZINGGAS,
|
|||||||
|
|
||||||
BattleHandlers::AbilityOnSwitchIn.add(:PASTELVEIL,
|
BattleHandlers::AbilityOnSwitchIn.add(:PASTELVEIL,
|
||||||
proc { |ability, battler, battle|
|
proc { |ability, battler, battle|
|
||||||
has_effect = false
|
next if battler.allAllies.none? { |b| b.status == :POISON }
|
||||||
battler.eachAlly do |b|
|
|
||||||
next if b.status != :POISON
|
|
||||||
has_effect = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
next if !has_effect
|
|
||||||
battle.pbShowAbilitySplash(battler)
|
battle.pbShowAbilitySplash(battler)
|
||||||
battler.eachAlly do |b|
|
battler.allAllies.each do |b|
|
||||||
next if b.status != :POISON
|
next if b.status != :POISON
|
||||||
b.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
|
b.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
|
||||||
if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class PokeBattle_AI
|
|||||||
if idxEncoredMove>=0
|
if idxEncoredMove>=0
|
||||||
scoreSum = 0
|
scoreSum = 0
|
||||||
scoreCount = 0
|
scoreCount = 0
|
||||||
battler.eachOpposing do |b|
|
battler.allOpposing.each do |b|
|
||||||
scoreSum += pbGetMoveScore(battler.moves[idxEncoredMove],battler,b,skill)
|
scoreSum += pbGetMoveScore(battler.moves[idxEncoredMove],battler,b,skill)
|
||||||
scoreCount += 1
|
scoreCount += 1
|
||||||
end
|
end
|
||||||
@@ -167,7 +167,7 @@ class PokeBattle_AI
|
|||||||
sum = 0
|
sum = 0
|
||||||
pkmn.moves.each do |m|
|
pkmn.moves.each do |m|
|
||||||
next if m.base_damage == 0
|
next if m.base_damage == 0
|
||||||
@battle.battlers[idxBattler].eachOpposing do |b|
|
@battle.battlers[idxBattler].allOpposing.each do |b|
|
||||||
bTypes = b.pbTypes(true)
|
bTypes = b.pbTypes(true)
|
||||||
sum += Effectiveness.calculate(m.type, bTypes[0], bTypes[1], bTypes[2])
|
sum += Effectiveness.calculate(m.type, bTypes[0], bTypes[1], bTypes[2])
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ class PokeBattle_AI
|
|||||||
if target_data.num_targets > 1
|
if target_data.num_targets > 1
|
||||||
# If move affects multiple battlers and you don't choose a particular one
|
# If move affects multiple battlers and you don't choose a particular one
|
||||||
totalScore = 0
|
totalScore = 0
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
next if !@battle.pbMoveCanTarget?(user.index,b.index,target_data)
|
next if !@battle.pbMoveCanTarget?(user.index,b.index,target_data)
|
||||||
score = pbGetMoveScore(move,user,b,skill)
|
score = pbGetMoveScore(move,user,b,skill)
|
||||||
totalScore += ((user.opposes?(b)) ? score : -score)
|
totalScore += ((user.opposes?(b)) ? score : -score)
|
||||||
@@ -135,7 +135,7 @@ class PokeBattle_AI
|
|||||||
else
|
else
|
||||||
# If move affects one battler and you have to choose which one
|
# If move affects one battler and you have to choose which one
|
||||||
scoresAndTargets = []
|
scoresAndTargets = []
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
next if !@battle.pbMoveCanTarget?(user.index,b.index,target_data)
|
next if !@battle.pbMoveCanTarget?(user.index,b.index,target_data)
|
||||||
next if target_data.targets_foe && !user.opposes?(b)
|
next if target_data.targets_foe && !user.opposes?(b)
|
||||||
score = pbGetMoveScore(move,user,b,skill)
|
score = pbGetMoveScore(move,user,b,skill)
|
||||||
|
|||||||
@@ -1157,7 +1157,7 @@ class PokeBattle_AI
|
|||||||
when "ResetAllBattlersStatStages"
|
when "ResetAllBattlersStatStages"
|
||||||
if skill>=PBTrainerAI.mediumSkill
|
if skill>=PBTrainerAI.mediumSkill
|
||||||
stages = 0
|
stages = 0
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
totalStages = 0
|
totalStages = 0
|
||||||
GameData::Stat.each_battle { |s| totalStages += b.stages[s.id] }
|
GameData::Stat.each_battle { |s| totalStages += b.stages[s.id] }
|
||||||
if b.opposes?(user)
|
if b.opposes?(user)
|
||||||
@@ -1583,7 +1583,7 @@ class PokeBattle_AI
|
|||||||
score -= 90 if target.effects[PBEffects::HyperBeam]>0
|
score -= 90 if target.effects[PBEffects::HyperBeam]>0
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "DamageTargetAlly"
|
when "DamageTargetAlly"
|
||||||
target.eachAlly do |b|
|
target.allAllies.each do |b|
|
||||||
next if !b.near?(target)
|
next if !b.near?(target)
|
||||||
score += 10
|
score += 10
|
||||||
end
|
end
|
||||||
@@ -1629,7 +1629,7 @@ class PokeBattle_AI
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "UsedAfterAllyRoundWithDoublePower"
|
when "UsedAfterAllyRoundWithDoublePower"
|
||||||
if skill>=PBTrainerAI.mediumSkill
|
if skill>=PBTrainerAI.mediumSkill
|
||||||
user.eachAlly do |b|
|
user.allAllies.each do |b|
|
||||||
next if !b.pbHasMove?(move.id)
|
next if !b.pbHasMove?(move.id)
|
||||||
score += 20
|
score += 20
|
||||||
end
|
end
|
||||||
@@ -1690,7 +1690,7 @@ class PokeBattle_AI
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "PowerUpAllyMove"
|
when "PowerUpAllyMove"
|
||||||
hasAlly = false
|
hasAlly = false
|
||||||
user.eachAlly do |b|
|
user.allAllies.each do |b|
|
||||||
hasAlly = true
|
hasAlly = true
|
||||||
score += 30
|
score += 30
|
||||||
break
|
break
|
||||||
@@ -2252,15 +2252,9 @@ class PokeBattle_AI
|
|||||||
if user.pbOpposingSide.effects[PBEffects::Spikes]>=3
|
if user.pbOpposingSide.effects[PBEffects::Spikes]>=3
|
||||||
score -= 90
|
score -= 90
|
||||||
else
|
else
|
||||||
canChoose = false
|
if user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) }
|
||||||
user.eachOpposing do |b|
|
|
||||||
next if !@battle.pbCanChooseNonActive?(b.index)
|
|
||||||
canChoose = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if !canChoose
|
|
||||||
# Opponent can't switch in any Pokemon
|
# Opponent can't switch in any Pokemon
|
||||||
score -= 90
|
score -= 90
|
||||||
else
|
else
|
||||||
score += 10*@battle.pbAbleNonActiveCount(user.idxOpposingSide)
|
score += 10*@battle.pbAbleNonActiveCount(user.idxOpposingSide)
|
||||||
score += [40,26,13][user.pbOpposingSide.effects[PBEffects::Spikes]]
|
score += [40,26,13][user.pbOpposingSide.effects[PBEffects::Spikes]]
|
||||||
@@ -2271,13 +2265,7 @@ class PokeBattle_AI
|
|||||||
if user.pbOpposingSide.effects[PBEffects::ToxicSpikes]>=2
|
if user.pbOpposingSide.effects[PBEffects::ToxicSpikes]>=2
|
||||||
score -= 90
|
score -= 90
|
||||||
else
|
else
|
||||||
canChoose = false
|
if user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) }
|
||||||
user.eachOpposing do |b|
|
|
||||||
next if !@battle.pbCanChooseNonActive?(b.index)
|
|
||||||
canChoose = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if !canChoose
|
|
||||||
# Opponent can't switch in any Pokemon
|
# Opponent can't switch in any Pokemon
|
||||||
score -= 90
|
score -= 90
|
||||||
else
|
else
|
||||||
@@ -2290,13 +2278,7 @@ class PokeBattle_AI
|
|||||||
if user.pbOpposingSide.effects[PBEffects::StealthRock]
|
if user.pbOpposingSide.effects[PBEffects::StealthRock]
|
||||||
score -= 90
|
score -= 90
|
||||||
else
|
else
|
||||||
canChoose = false
|
if user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) }
|
||||||
user.eachOpposing do |b|
|
|
||||||
next if !@battle.pbCanChooseNonActive?(b.index)
|
|
||||||
canChoose = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if !canChoose
|
|
||||||
# Opponent can't switch in any Pokemon
|
# Opponent can't switch in any Pokemon
|
||||||
score -= 90
|
score -= 90
|
||||||
else
|
else
|
||||||
@@ -2412,12 +2394,7 @@ class PokeBattle_AI
|
|||||||
when "FailsIfTargetActed"
|
when "FailsIfTargetActed"
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "RedirectAllMovesToUser"
|
when "RedirectAllMovesToUser"
|
||||||
hasAlly = false
|
score -= 90 if user.allAllies.length == 0
|
||||||
user.eachAlly do |b|
|
|
||||||
hasAlly = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
score -= 90 if !hasAlly
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "StartGravity"
|
when "StartGravity"
|
||||||
if @battle.field.effects[PBEffects::Gravity]>0
|
if @battle.field.effects[PBEffects::Gravity]>0
|
||||||
@@ -2538,7 +2515,7 @@ class PokeBattle_AI
|
|||||||
when "RaisePlusMinusUserAndAlliesDefSpDef1"
|
when "RaisePlusMinusUserAndAlliesDefSpDef1"
|
||||||
hasEffect = user.statStageAtMax?(:DEFENSE) &&
|
hasEffect = user.statStageAtMax?(:DEFENSE) &&
|
||||||
user.statStageAtMax?(:SPECIAL_DEFENSE)
|
user.statStageAtMax?(:SPECIAL_DEFENSE)
|
||||||
user.eachAlly do |b|
|
user.allAllies.each do |b|
|
||||||
next if b.statStageAtMax?(:DEFENSE) && b.statStageAtMax?(:SPECIAL_DEFENSE)
|
next if b.statStageAtMax?(:DEFENSE) && b.statStageAtMax?(:SPECIAL_DEFENSE)
|
||||||
hasEffect = true
|
hasEffect = true
|
||||||
score -= b.stages[:DEFENSE]*10
|
score -= b.stages[:DEFENSE]*10
|
||||||
@@ -2600,7 +2577,7 @@ class PokeBattle_AI
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "RaiseGroundedGrassBattlersAtkSpAtk1"
|
when "RaiseGroundedGrassBattlersAtkSpAtk1"
|
||||||
count = 0
|
count = 0
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
if b.pbHasType?(:GRASS) && !b.airborne? &&
|
if b.pbHasType?(:GRASS) && !b.airborne? &&
|
||||||
(!b.statStageAtMax?(:ATTACK) || !b.statStageAtMax?(:SPECIAL_ATTACK))
|
(!b.statStageAtMax?(:ATTACK) || !b.statStageAtMax?(:SPECIAL_ATTACK))
|
||||||
count += 1
|
count += 1
|
||||||
@@ -2616,7 +2593,7 @@ class PokeBattle_AI
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "RaiseGrassBattlersDef1"
|
when "RaiseGrassBattlersDef1"
|
||||||
count = 0
|
count = 0
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
if b.pbHasType?(:GRASS) && !b.statStageAtMax?(:DEFENSE)
|
if b.pbHasType?(:GRASS) && !b.statStageAtMax?(:DEFENSE)
|
||||||
count += 1
|
count += 1
|
||||||
if user.opposes?(b)
|
if user.opposes?(b)
|
||||||
@@ -2630,7 +2607,7 @@ class PokeBattle_AI
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "LowerPoisonedTargetAtkSpAtkSpd1"
|
when "LowerPoisonedTargetAtkSpAtkSpd1"
|
||||||
count=0
|
count=0
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
if b.poisoned? &&
|
if b.poisoned? &&
|
||||||
(!b.statStageAtMin?(:ATTACK) ||
|
(!b.statStageAtMin?(:ATTACK) ||
|
||||||
!b.statStageAtMin?(:SPECIAL_ATTACK) ||
|
!b.statStageAtMin?(:SPECIAL_ATTACK) ||
|
||||||
@@ -2822,7 +2799,7 @@ class PokeBattle_AI
|
|||||||
when "RaisePlusMinusUserAndAlliesAtkSpAtk1"
|
when "RaisePlusMinusUserAndAlliesAtkSpAtk1"
|
||||||
hasEffect = user.statStageAtMax?(:ATTACK) &&
|
hasEffect = user.statStageAtMax?(:ATTACK) &&
|
||||||
user.statStageAtMax?(:SPECIAL_ATTACK)
|
user.statStageAtMax?(:SPECIAL_ATTACK)
|
||||||
user.eachAlly do |b|
|
user.allAllies.each do |b|
|
||||||
next if b.statStageAtMax?(:ATTACK) && b.statStageAtMax?(:SPECIAL_ATTACK)
|
next if b.statStageAtMax?(:ATTACK) && b.statStageAtMax?(:SPECIAL_ATTACK)
|
||||||
hasEffect = true
|
hasEffect = true
|
||||||
score -= b.stages[:ATTACK]*10
|
score -= b.stages[:ATTACK]*10
|
||||||
@@ -2931,12 +2908,7 @@ class PokeBattle_AI
|
|||||||
when "TypeIsUserFirstType"
|
when "TypeIsUserFirstType"
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "RedirectAllMovesToTarget"
|
when "RedirectAllMovesToTarget"
|
||||||
hasAlly = false
|
score -= 90 if user.allAllies.length == 0
|
||||||
target.eachAlly do |b|
|
|
||||||
hasAlly = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
score -= 90 if !hasAlly
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "TargetUsesItsLastUsedMoveAgain"
|
when "TargetUsesItsLastUsedMoveAgain"
|
||||||
if skill>=PBTrainerAI.mediumSkill
|
if skill>=PBTrainerAI.mediumSkill
|
||||||
@@ -3098,7 +3070,7 @@ class PokeBattle_AI
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "RaiseUserAndAlliesAtkDef1"
|
when "RaiseUserAndAlliesAtkDef1"
|
||||||
has_ally = false
|
has_ally = false
|
||||||
user.eachAlly do |b|
|
user.allAllies.each do |b|
|
||||||
next if !b.pbCanLowerStatStage?(:ATTACK, user) &&
|
next if !b.pbCanLowerStatStage?(:ATTACK, user) &&
|
||||||
!b.pbCanLowerStatStage?(:SPECIAL_ATTACK, user)
|
!b.pbCanLowerStatStage?(:SPECIAL_ATTACK, user)
|
||||||
has_ally = true
|
has_ally = true
|
||||||
@@ -3185,7 +3157,7 @@ class PokeBattle_AI
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "CannotBeRedirected"
|
when "CannotBeRedirected"
|
||||||
redirection = false
|
redirection = false
|
||||||
user.eachOpposing do |b|
|
user.allOpposing.each do |b|
|
||||||
next if b.index == target.index
|
next if b.index == target.index
|
||||||
if b.effects[PBEffects::RagePowder] ||
|
if b.effects[PBEffects::RagePowder] ||
|
||||||
b.effects[PBEffects::Spotlight] > 0 ||
|
b.effects[PBEffects::Spotlight] > 0 ||
|
||||||
@@ -3228,7 +3200,7 @@ class PokeBattle_AI
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "HealUserAndAlliesQuarterOfTotalHP"
|
when "HealUserAndAlliesQuarterOfTotalHP"
|
||||||
ally_amt = 30
|
ally_amt = 30
|
||||||
@battle.eachSameSideBattler(user.index) do |b|
|
@battle.allSameSideBattlers(user.index).each do |b|
|
||||||
if b.hp == b.totalhp || (skill >= PBTrainerAI.mediumSkill && !b.canHeal?)
|
if b.hp == b.totalhp || (skill >= PBTrainerAI.mediumSkill && !b.canHeal?)
|
||||||
score -= ally_amt / 2
|
score -= ally_amt / 2
|
||||||
elsif b.hp < b.totalhp * 3 / 4
|
elsif b.hp < b.totalhp * 3 / 4
|
||||||
@@ -3238,7 +3210,7 @@ class PokeBattle_AI
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
when "HealUserAndAlliesQuarterOfTotalHPCureStatus"
|
when "HealUserAndAlliesQuarterOfTotalHPCureStatus"
|
||||||
ally_amt = 80 / @battle.pbSideSize(user.index)
|
ally_amt = 80 / @battle.pbSideSize(user.index)
|
||||||
@battle.eachSameSideBattler(user.index) do |b|
|
@battle.allSameSideBattlers(user.index).each do |b|
|
||||||
if b.hp == b.totalhp || (skill >= PBTrainerAI.mediumSkill && !b.canHeal?)
|
if b.hp == b.totalhp || (skill >= PBTrainerAI.mediumSkill && !b.canHeal?)
|
||||||
score -= ally_amt
|
score -= ally_amt
|
||||||
elsif b.hp < b.totalhp * 3 / 4
|
elsif b.hp < b.totalhp * 3 / 4
|
||||||
@@ -3307,7 +3279,7 @@ class PokeBattle_AI
|
|||||||
:MARANGABERRY, :PECHABERRY, :PERSIMBERRY, :PETAYABERRY,
|
:MARANGABERRY, :PECHABERRY, :PERSIMBERRY, :PETAYABERRY,
|
||||||
:RAWSTBERRY, :SALACBERRY, :STARFBERRY, :WIKIBERRY
|
:RAWSTBERRY, :SALACBERRY, :STARFBERRY, :WIKIBERRY
|
||||||
]
|
]
|
||||||
@battle.eachSameSideBattler(user.index) do |b|
|
@battle.allSameSideBattlers(user.index).each do |b|
|
||||||
if !b.item || !b.item.is_berry? || !b.itemActive?
|
if !b.item || !b.item.is_berry? || !b.itemActive?
|
||||||
score -= 100 / @battle.pbSideSize(user.index)
|
score -= 100 / @battle.pbSideSize(user.index)
|
||||||
else
|
else
|
||||||
@@ -3325,7 +3297,7 @@ class PokeBattle_AI
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if skill >= PBTrainerAI.highSkill
|
if skill >= PBTrainerAI.highSkill
|
||||||
@battle.eachOtherSideBattler(user.index) do |b|
|
@battle.allOtherSideBattlers(user.index).each do |b|
|
||||||
amt = 10 / @battle.pbSideSize(target.index)
|
amt = 10 / @battle.pbSideSize(target.index)
|
||||||
score -= amt if b.hasActiveItem?(useful_berries)
|
score -= amt if b.hasActiveItem?(useful_berries)
|
||||||
score -= amt if b.canHeal? && b.hp < b.totalhp / 3 && b.hasActiveAbility?(:CHEEKPOUCH)
|
score -= amt if b.canHeal? && b.hp < b.totalhp / 3 && b.hasActiveAbility?(:CHEEKPOUCH)
|
||||||
|
|||||||
@@ -8,17 +8,17 @@ class PokeBattle_AI
|
|||||||
num_targets = 0
|
num_targets = 0
|
||||||
case target_data.id
|
case target_data.id
|
||||||
when :AllAllies
|
when :AllAllies
|
||||||
@battle.eachSameSideBattler(user) { |b| num_targets += 1 if b.index != user.index }
|
@battle.allSameSideBattlers(user).each { |b| num_targets += 1 if b.index != user.index }
|
||||||
when :UserAndAllies
|
when :UserAndAllies
|
||||||
@battle.eachSameSideBattler(user) { |_b| num_targets += 1 }
|
@battle.allSameSideBattlers(user).each { |_b| num_targets += 1 }
|
||||||
when :AllNearFoes
|
when :AllNearFoes
|
||||||
@battle.eachOtherSideBattler(user) { |b| num_targets += 1 if b.near?(user) }
|
@battle.allOtherSideBattlers(user).each { |b| num_targets += 1 if b.near?(user) }
|
||||||
when :AllFoes
|
when :AllFoes
|
||||||
@battle.eachOtherSideBattler(user) { |_b| num_targets += 1 }
|
@battle.allOtherSideBattlers(user).each { |_b| num_targets += 1 }
|
||||||
when :AllNearOthers
|
when :AllNearOthers
|
||||||
@battle.eachBattler { |b| num_targets += 1 if b.near?(user) }
|
@battle.allBattlers.each { |b| num_targets += 1 if b.near?(user) }
|
||||||
when :AllBattlers
|
when :AllBattlers
|
||||||
@battle.eachBattler { |_b| num_targets += 1 }
|
@battle.allBattlers.each { |_b| num_targets += 1 }
|
||||||
end
|
end
|
||||||
return num_targets > 1
|
return num_targets > 1
|
||||||
end
|
end
|
||||||
@@ -343,7 +343,7 @@ class PokeBattle_AI
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if skill>=PBTrainerAI.mediumSkill && !moldBreaker
|
if skill>=PBTrainerAI.mediumSkill && !moldBreaker
|
||||||
user.eachAlly do |b|
|
user.allAllies.each do |b|
|
||||||
next if !b.abilityActive?
|
next if !b.abilityActive?
|
||||||
BattleHandlers.triggerDamageCalcUserAllyAbility(b.ability,
|
BattleHandlers.triggerDamageCalcUserAllyAbility(b.ability,
|
||||||
user,target,move,multipliers,baseDmg,type)
|
user,target,move,multipliers,baseDmg,type)
|
||||||
@@ -365,7 +365,7 @@ class PokeBattle_AI
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if skill>=PBTrainerAI.bestSkill && !moldBreaker
|
if skill>=PBTrainerAI.bestSkill && !moldBreaker
|
||||||
target.eachAlly do |b|
|
target.allAllies.each do |b|
|
||||||
next if !b.abilityActive?
|
next if !b.abilityActive?
|
||||||
BattleHandlers.triggerDamageCalcTargetAllyAbility(b.ability,
|
BattleHandlers.triggerDamageCalcTargetAllyAbility(b.ability,
|
||||||
user,target,move,multipliers,baseDmg,type)
|
user,target,move,multipliers,baseDmg,type)
|
||||||
@@ -418,20 +418,16 @@ class PokeBattle_AI
|
|||||||
# Mud Sport and Water Sport
|
# Mud Sport and Water Sport
|
||||||
if skill>=PBTrainerAI.mediumSkill
|
if skill>=PBTrainerAI.mediumSkill
|
||||||
if type == :ELECTRIC
|
if type == :ELECTRIC
|
||||||
@battle.eachBattler do |b|
|
if @battle.allBattlers.any? { |b| b.effects[PBEffects::MudSport] }
|
||||||
next if !b.effects[PBEffects::MudSport]
|
|
||||||
multipliers[:base_damage_multiplier] /= 3
|
multipliers[:base_damage_multiplier] /= 3
|
||||||
break
|
|
||||||
end
|
end
|
||||||
if @battle.field.effects[PBEffects::MudSportField]>0
|
if @battle.field.effects[PBEffects::MudSportField]>0
|
||||||
multipliers[:base_damage_multiplier] /= 3
|
multipliers[:base_damage_multiplier] /= 3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if type == :FIRE
|
if type == :FIRE
|
||||||
@battle.eachBattler do |b|
|
if @battle.allBattlers.any? { |b| b.effects[PBEffects::WaterSport] }
|
||||||
next if !b.effects[PBEffects::WaterSport]
|
|
||||||
multipliers[:base_damage_multiplier] /= 3
|
multipliers[:base_damage_multiplier] /= 3
|
||||||
break
|
|
||||||
end
|
end
|
||||||
if @battle.field.effects[PBEffects::WaterSportField]>0
|
if @battle.field.effects[PBEffects::WaterSportField]>0
|
||||||
multipliers[:base_damage_multiplier] /= 3
|
multipliers[:base_damage_multiplier] /= 3
|
||||||
@@ -645,7 +641,7 @@ class PokeBattle_AI
|
|||||||
BattleHandlers.triggerAccuracyCalcUserAbility(user.ability,
|
BattleHandlers.triggerAccuracyCalcUserAbility(user.ability,
|
||||||
modifiers,user,target,move,type)
|
modifiers,user,target,move,type)
|
||||||
end
|
end
|
||||||
user.eachAlly do |b|
|
user.allAllies.each do |b|
|
||||||
next if !b.abilityActive?
|
next if !b.abilityActive?
|
||||||
BattleHandlers.triggerAccuracyCalcUserAllyAbility(b.ability,
|
BattleHandlers.triggerAccuracyCalcUserAllyAbility(b.ability,
|
||||||
modifiers,user,target,move,type)
|
modifiers,user,target,move,type)
|
||||||
|
|||||||
@@ -103,9 +103,7 @@ BallHandlers::ModifyCatchRate.add(:FASTBALL,proc { |ball,catchRate,battle,battle
|
|||||||
|
|
||||||
BallHandlers::ModifyCatchRate.add(:LEVELBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
BallHandlers::ModifyCatchRate.add(:LEVELBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||||
maxlevel = 0
|
maxlevel = 0
|
||||||
battle.eachSameSideBattler do |b|
|
battle.allSameSideBattlers.each { |b| maxlevel = b.level if b.level > maxlevel }
|
||||||
maxlevel = b.level if b.level>maxlevel
|
|
||||||
end
|
|
||||||
if maxlevel >= battler.level * 4
|
if maxlevel >= battler.level * 4
|
||||||
catchRate *= 8
|
catchRate *= 8
|
||||||
elsif maxlevel >= battler.level * 2
|
elsif maxlevel >= battler.level * 2
|
||||||
@@ -149,7 +147,7 @@ BallHandlers::ModifyCatchRate.add(:HEAVYBALL,proc { |ball,catchRate,battle,battl
|
|||||||
})
|
})
|
||||||
|
|
||||||
BallHandlers::ModifyCatchRate.add(:LOVEBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
BallHandlers::ModifyCatchRate.add(:LOVEBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||||
battle.eachSameSideBattler do |b|
|
battle.allSameSideBattlers.each do |b|
|
||||||
next if b.species!=battler.species
|
next if b.species!=battler.species
|
||||||
next if b.gender==battler.gender || b.gender==2 || battler.gender==2
|
next if b.gender==battler.gender || b.gender==2 || battler.gender==2
|
||||||
catchRate *= 8
|
catchRate *= 8
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ class PokeBattle_Scene
|
|||||||
when 4 # Use on opposing battler (Poké Balls)
|
when 4 # Use on opposing battler (Poké Balls)
|
||||||
idxTarget = -1
|
idxTarget = -1
|
||||||
if @battle.pbOpposingBattlerCount(idxBattler)==1
|
if @battle.pbOpposingBattlerCount(idxBattler)==1
|
||||||
@battle.eachOtherSideBattler(idxBattler) { |b| idxTarget = b.index }
|
@battle.allOtherSideBattlers(idxBattler).each { |b| idxTarget = b.index }
|
||||||
break if yield item.id, useType, idxTarget, -1, itemScene
|
break if yield item.id, useType, idxTarget, -1, itemScene
|
||||||
else
|
else
|
||||||
wasTargeting = true
|
wasTargeting = true
|
||||||
@@ -351,12 +351,12 @@ class PokeBattle_Scene
|
|||||||
def pbFirstTarget(idxBattler,target_data)
|
def pbFirstTarget(idxBattler,target_data)
|
||||||
case target_data.id
|
case target_data.id
|
||||||
when :NearAlly
|
when :NearAlly
|
||||||
@battle.eachSameSideBattler(idxBattler) do |b|
|
@battle.allSameSideBattlers(idxBattler).each do |b|
|
||||||
next if b.index==idxBattler || !@battle.nearBattlers?(b,idxBattler)
|
next if b.index==idxBattler || !@battle.nearBattlers?(b,idxBattler)
|
||||||
next if b.fainted?
|
next if b.fainted?
|
||||||
return b.index
|
return b.index
|
||||||
end
|
end
|
||||||
@battle.eachSameSideBattler(idxBattler) do |b|
|
@battle.allSameSideBattlers(idxBattler).each do |b|
|
||||||
next if b.index==idxBattler || !@battle.nearBattlers?(b,idxBattler)
|
next if b.index==idxBattler || !@battle.nearBattlers?(b,idxBattler)
|
||||||
return b.index
|
return b.index
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ class PokeBattle_BattlePalace < PokeBattle_Battle
|
|||||||
def pbEndOfRoundPhase
|
def pbEndOfRoundPhase
|
||||||
super
|
super
|
||||||
return if @decision != 0
|
return if @decision != 0
|
||||||
eachBattler { |b| pbPinchChange(b) }
|
allBattlers.each { |b| pbPinchChange(b) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -65,10 +65,9 @@ class PokeBattle_DebugSceneNoLogging
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbChooseTarget(idxBattler,target_data,visibleSprites=nil)
|
def pbChooseTarget(idxBattler,target_data,visibleSprites=nil)
|
||||||
targets = []
|
targets = @battle.allOtherSideBattlers(idxBattler).map { |b| b.index }
|
||||||
@battle.eachOtherSideBattler(idxBattler) { |b| targets.push(b.index) }
|
|
||||||
return -1 if targets.length==0
|
return -1 if targets.length==0
|
||||||
return targets[rand(targets.length)]
|
return targets.sample
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbPartyScreen(idxBattler,canCancel=false)
|
def pbPartyScreen(idxBattler,canCancel=false)
|
||||||
|
|||||||
@@ -279,13 +279,7 @@ ItemHandlers::CanUseInBattle.add(:DIREHIT3,proc { |item,pokemon,battler,move,fir
|
|||||||
})
|
})
|
||||||
|
|
||||||
ItemHandlers::CanUseInBattle.add(:POKEFLUTE,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
|
ItemHandlers::CanUseInBattle.add(:POKEFLUTE,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
|
||||||
anyAsleep = false
|
if battle.allBattlers.none? { |b| b.status == :SLEEP && !b.hasActiveAbility?(:SOUNDPROOF) }
|
||||||
battle.eachBattler do |b|
|
|
||||||
next if b.status != :SLEEP || b.hasActiveAbility?(:SOUNDPROOF)
|
|
||||||
anyAsleep = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if !anyAsleep
|
|
||||||
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
|
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
@@ -310,9 +304,8 @@ ItemHandlers::UseInBattle.add(:POKEDOLL,proc { |item,battler,battle|
|
|||||||
ItemHandlers::UseInBattle.copy(:POKEDOLL,:FLUFFYTAIL,:POKETOY)
|
ItemHandlers::UseInBattle.copy(:POKEDOLL,:FLUFFYTAIL,:POKETOY)
|
||||||
|
|
||||||
ItemHandlers::UseInBattle.add(:POKEFLUTE,proc { |item,battler,battle|
|
ItemHandlers::UseInBattle.add(:POKEFLUTE,proc { |item,battler,battle|
|
||||||
battle.eachBattler do |b|
|
battle.allBattlers.each do |b|
|
||||||
next if b.status != :SLEEP || b.hasActiveAbility?(:SOUNDPROOF)
|
b.pbCureStatus(false) if b.status == :SLEEP && !b.hasActiveAbility?(:SOUNDPROOF)
|
||||||
b.pbCureStatus(false)
|
|
||||||
end
|
end
|
||||||
battle.pbDisplay(_INTL("All Pokémon were roused by the tune!"))
|
battle.pbDisplay(_INTL("All Pokémon were roused by the tune!"))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -317,13 +317,7 @@ ItemHandlers::BattleUseOnBattler.add(:VIVIDSCENT,proc { |item,battler,scene|
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
class PokeBattle_Move_AllBattlersLoseHalfHPUserSkipsNextTurn < PokeBattle_Move
|
class PokeBattle_Move_AllBattlersLoseHalfHPUserSkipsNextTurn < PokeBattle_Move
|
||||||
def pbMoveFailed?(user,targets)
|
def pbMoveFailed?(user,targets)
|
||||||
failed = true
|
if @battle.allBattlers.none? { |b| b.hp > 1 }
|
||||||
@battle.eachBattler do |b|
|
|
||||||
next if b.hp==1
|
|
||||||
failed = false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if failed
|
|
||||||
@battle.pbDisplay(_INTL("But it failed!"))
|
@battle.pbDisplay(_INTL("But it failed!"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -331,12 +325,11 @@ class PokeBattle_Move_AllBattlersLoseHalfHPUserSkipsNextTurn < PokeBattle_Move
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbEffectGeneral(user)
|
def pbEffectGeneral(user)
|
||||||
@battle.eachBattler do |b|
|
@battle.allBattlers.each do |b|
|
||||||
next if b.hp==1
|
b.pbReduceHP(b.hp / 2, false) if b.hp > 1
|
||||||
b.pbReduceHP(b.hp / 2, false)
|
|
||||||
end
|
end
|
||||||
@battle.pbDisplay(_INTL("Each Pokémon's HP was halved!"))
|
@battle.pbDisplay(_INTL("Each Pokémon's HP was halved!"))
|
||||||
@battle.eachBattler { |b| b.pbItemHPHealCheck }
|
@battle.allBattlers.each { |b| b.pbItemHPHealCheck }
|
||||||
user.effects[PBEffects::HyperBeam] = 2
|
user.effects[PBEffects::HyperBeam] = 2
|
||||||
user.currentMove = @id
|
user.currentMove = @id
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user