mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-10 14:44:58 +00:00
Added decent spacing to all scripts thanks to Rubocop
This commit is contained in:
@@ -2,27 +2,27 @@ class Battle
|
||||
#=============================================================================
|
||||
# Decrement effect counters
|
||||
#=============================================================================
|
||||
def pbEORCountDownBattlerEffect(priority,effect)
|
||||
def pbEORCountDownBattlerEffect(priority, effect)
|
||||
priority.each do |b|
|
||||
next if b.fainted? || b.effects[effect]==0
|
||||
next if b.fainted? || b.effects[effect] == 0
|
||||
b.effects[effect] -= 1
|
||||
yield b if block_given? && b.effects[effect]==0
|
||||
yield b if block_given? && b.effects[effect] == 0
|
||||
end
|
||||
end
|
||||
|
||||
def pbEORCountDownSideEffect(side,effect,msg)
|
||||
if @sides[side].effects[effect]>0
|
||||
def pbEORCountDownSideEffect(side, effect, msg)
|
||||
if @sides[side].effects[effect] > 0
|
||||
@sides[side].effects[effect] -= 1
|
||||
pbDisplay(msg) if @sides[side].effects[effect]==0
|
||||
pbDisplay(msg) if @sides[side].effects[effect] == 0
|
||||
end
|
||||
end
|
||||
|
||||
def pbEORCountDownFieldEffect(effect,msg)
|
||||
if @field.effects[effect]>0
|
||||
def pbEORCountDownFieldEffect(effect, msg)
|
||||
if @field.effects[effect] > 0
|
||||
@field.effects[effect] -= 1
|
||||
if @field.effects[effect]==0
|
||||
if @field.effects[effect] == 0
|
||||
pbDisplay(msg)
|
||||
if effect==PBEffects::MagicRoom
|
||||
if effect == PBEffects::MagicRoom
|
||||
pbPriority(true).each { |b| b.pbItemTerrainStatBoostCheck }
|
||||
end
|
||||
end
|
||||
@@ -36,9 +36,9 @@ class Battle
|
||||
# NOTE: Primordial weather doesn't need to be checked here, because if it
|
||||
# could wear off here, it will have worn off already.
|
||||
# Count down weather duration
|
||||
@field.weatherDuration -= 1 if @field.weatherDuration>0
|
||||
@field.weatherDuration -= 1 if @field.weatherDuration > 0
|
||||
# Weather wears off
|
||||
if @field.weatherDuration==0
|
||||
if @field.weatherDuration == 0
|
||||
case @field.weather
|
||||
when :Sun then pbDisplay(_INTL("The sunlight faded."))
|
||||
when :Rain then pbDisplay(_INTL("The rain stopped."))
|
||||
@@ -50,7 +50,7 @@ class Battle
|
||||
# Check for form changes caused by the weather changing
|
||||
allBattlers.each { |b| b.pbCheckFormOnWeatherChange }
|
||||
# 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
|
||||
end
|
||||
# Weather continues
|
||||
@@ -77,23 +77,23 @@ class Battle
|
||||
case b.effectiveWeather
|
||||
when :Sandstorm
|
||||
next if !b.takesSandstormDamage?
|
||||
pbDisplay(_INTL("{1} is buffeted by the sandstorm!",b.pbThis))
|
||||
pbDisplay(_INTL("{1} is buffeted by the sandstorm!", b.pbThis))
|
||||
@scene.pbDamageAnimation(b)
|
||||
b.pbReduceHP(b.totalhp/16,false)
|
||||
b.pbReduceHP(b.totalhp / 16, false)
|
||||
b.pbItemHPHealCheck
|
||||
b.pbFaint if b.fainted?
|
||||
when :Hail
|
||||
next if !b.takesHailDamage?
|
||||
pbDisplay(_INTL("{1} is buffeted by the hail!",b.pbThis))
|
||||
pbDisplay(_INTL("{1} is buffeted by the hail!", b.pbThis))
|
||||
@scene.pbDamageAnimation(b)
|
||||
b.pbReduceHP(b.totalhp/16,false)
|
||||
b.pbReduceHP(b.totalhp / 16, false)
|
||||
b.pbItemHPHealCheck
|
||||
b.pbFaint if b.fainted?
|
||||
when :ShadowSky
|
||||
next if !b.takesShadowSkyDamage?
|
||||
pbDisplay(_INTL("{1} is hurt by the shadow sky!",b.pbThis))
|
||||
pbDisplay(_INTL("{1} is hurt by the shadow sky!", b.pbThis))
|
||||
@scene.pbDamageAnimation(b)
|
||||
b.pbReduceHP(b.totalhp/16,false)
|
||||
b.pbReduceHP(b.totalhp / 16, false)
|
||||
b.pbItemHPHealCheck
|
||||
b.pbFaint if b.fainted?
|
||||
end
|
||||
@@ -105,7 +105,7 @@ class Battle
|
||||
#=============================================================================
|
||||
def pbEORTerrain
|
||||
# Count down terrain duration
|
||||
@field.terrainDuration -= 1 if @field.terrainDuration>0
|
||||
@field.terrainDuration -= 1 if @field.terrainDuration > 0
|
||||
# Terrain wears off
|
||||
if @field.terrain != :None && @field.terrainDuration == 0
|
||||
case @field.terrain
|
||||
@@ -149,7 +149,7 @@ class Battle
|
||||
if !singleBattle?
|
||||
swaps = [] # Each element is an array of two battler indices to swap
|
||||
for side in 0...2
|
||||
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
|
||||
anyNear = false
|
||||
allSameSideBattlers(side).each do |b|
|
||||
@@ -170,25 +170,25 @@ class Battle
|
||||
# Get the position to move to
|
||||
pos = -1
|
||||
case pbSideSize(side)
|
||||
when 2 then pos = [2,3,0,1][b.index] # The unoccupied position
|
||||
when 3 then pos = (side==0) ? 2 : 3 # The centre position
|
||||
when 2 then pos = [2, 3, 0, 1][b.index] # The unoccupied position
|
||||
when 3 then pos = (side == 0) ? 2 : 3 # The centre position
|
||||
end
|
||||
next if pos<0
|
||||
next if pos < 0
|
||||
# Can't move if the same trainer doesn't control both positions
|
||||
idxOwner = pbGetOwnerIndexFromBattlerIndex(b.index)
|
||||
next if pbGetOwnerIndexFromBattlerIndex(pos)!=idxOwner
|
||||
swaps.push([b.index,pos])
|
||||
next if pbGetOwnerIndexFromBattlerIndex(pos) != idxOwner
|
||||
swaps.push([b.index, pos])
|
||||
end
|
||||
end
|
||||
# Move battlers around
|
||||
swaps.each do |pair|
|
||||
next if pbSideSize(pair[0])==2 && swaps.length>1
|
||||
next if !pbSwapBattlers(pair[0],pair[1])
|
||||
next if pbSideSize(pair[0]) == 2 && swaps.length > 1
|
||||
next if !pbSwapBattlers(pair[0], pair[1])
|
||||
case pbSideSize(side)
|
||||
when 2
|
||||
pbDisplay(_INTL("{1} moved across!",@battlers[pair[1]].pbThis))
|
||||
pbDisplay(_INTL("{1} moved across!", @battlers[pair[1]].pbThis))
|
||||
when 3
|
||||
pbDisplay(_INTL("{1} moved to the center!",@battlers[pair[1]].pbThis))
|
||||
pbDisplay(_INTL("{1} moved to the center!", @battlers[pair[1]].pbThis))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -207,36 +207,36 @@ class Battle
|
||||
# Weather
|
||||
pbEORWeather(priority)
|
||||
# Future Sight/Doom Desire
|
||||
@positions.each_with_index do |pos,idxPos|
|
||||
next if !pos || pos.effects[PBEffects::FutureSightCounter]==0
|
||||
@positions.each_with_index do |pos, idxPos|
|
||||
next if !pos || pos.effects[PBEffects::FutureSightCounter] == 0
|
||||
pos.effects[PBEffects::FutureSightCounter] -= 1
|
||||
next if pos.effects[PBEffects::FutureSightCounter]>0
|
||||
next if pos.effects[PBEffects::FutureSightCounter] > 0
|
||||
next if !@battlers[idxPos] || @battlers[idxPos].fainted? # No target
|
||||
moveUser = nil
|
||||
allBattlers.each do |b|
|
||||
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
|
||||
break
|
||||
end
|
||||
next if moveUser && moveUser.index==idxPos # Target is the user
|
||||
next if moveUser && moveUser.index == idxPos # Target is the user
|
||||
if !moveUser # User isn't in battle, get it from the party
|
||||
party = pbParty(pos.effects[PBEffects::FutureSightUserIndex])
|
||||
pkmn = party[pos.effects[PBEffects::FutureSightUserPartyIndex]]
|
||||
if pkmn && pkmn.able?
|
||||
moveUser = Battler.new(self,pos.effects[PBEffects::FutureSightUserIndex])
|
||||
moveUser.pbInitDummyPokemon(pkmn,pos.effects[PBEffects::FutureSightUserPartyIndex])
|
||||
moveUser = Battler.new(self, pos.effects[PBEffects::FutureSightUserIndex])
|
||||
moveUser.pbInitDummyPokemon(pkmn, pos.effects[PBEffects::FutureSightUserPartyIndex])
|
||||
end
|
||||
end
|
||||
next if !moveUser # User is fainted
|
||||
move = pos.effects[PBEffects::FutureSightMove]
|
||||
pbDisplay(_INTL("{1} took the {2} attack!",@battlers[idxPos].pbThis,
|
||||
pbDisplay(_INTL("{1} took the {2} attack!", @battlers[idxPos].pbThis,
|
||||
GameData::Move.get(move).name))
|
||||
# NOTE: Future Sight failing against the target here doesn't count towards
|
||||
# Stomping Tantrum.
|
||||
userLastMoveFailed = moveUser.lastMoveFailed
|
||||
@futureSight = true
|
||||
moveUser.pbUseMoveSimple(move,idxPos)
|
||||
moveUser.pbUseMoveSimple(move, idxPos)
|
||||
@futureSight = false
|
||||
moveUser.lastMoveFailed = userLastMoveFailed
|
||||
@battlers[idxPos].pbFaint if @battlers[idxPos].fainted?
|
||||
@@ -246,20 +246,20 @@ class Battle
|
||||
pos.effects[PBEffects::FutureSightUserPartyIndex] = -1
|
||||
end
|
||||
# Wish
|
||||
@positions.each_with_index do |pos,idxPos|
|
||||
next if !pos || pos.effects[PBEffects::Wish]==0
|
||||
@positions.each_with_index do |pos, idxPos|
|
||||
next if !pos || pos.effects[PBEffects::Wish] == 0
|
||||
pos.effects[PBEffects::Wish] -= 1
|
||||
next if pos.effects[PBEffects::Wish]>0
|
||||
next if pos.effects[PBEffects::Wish] > 0
|
||||
next if !@battlers[idxPos] || !@battlers[idxPos].canHeal?
|
||||
wishMaker = pbThisEx(idxPos,pos.effects[PBEffects::WishMaker])
|
||||
wishMaker = pbThisEx(idxPos, pos.effects[PBEffects::WishMaker])
|
||||
@battlers[idxPos].pbRecoverHP(pos.effects[PBEffects::WishAmount])
|
||||
pbDisplay(_INTL("{1}'s wish came true!",wishMaker))
|
||||
pbDisplay(_INTL("{1}'s wish came true!", wishMaker))
|
||||
end
|
||||
# Sea of Fire damage (Fire Pledge + Grass Pledge combination)
|
||||
for side in 0...2
|
||||
next if sides[side].effects[PBEffects::SeaOfFire]==0
|
||||
@battle.pbCommonAnimation("SeaOfFire") if side==0
|
||||
@battle.pbCommonAnimation("SeaOfFireOpp") if side==1
|
||||
next if sides[side].effects[PBEffects::SeaOfFire] == 0
|
||||
@battle.pbCommonAnimation("SeaOfFire") if side == 0
|
||||
@battle.pbCommonAnimation("SeaOfFireOpp") if side == 1
|
||||
priority.each do |b|
|
||||
next if b.opposes?(side)
|
||||
next if !b.takesIndirectDamage? || b.pbHasType?(:FIRE)
|
||||
@@ -275,8 +275,8 @@ class Battle
|
||||
# Grassy Terrain (healing)
|
||||
if @field.terrain == :Grassy && b.affectedByTerrain? && b.canHeal?
|
||||
PBDebug.log("[Lingering effect] Grassy Terrain heals #{b.pbThis(true)}")
|
||||
b.pbRecoverHP(b.totalhp/16)
|
||||
pbDisplay(_INTL("{1}'s HP was restored.",b.pbThis))
|
||||
b.pbRecoverHP(b.totalhp / 16)
|
||||
pbDisplay(_INTL("{1}'s HP was restored.", b.pbThis))
|
||||
end
|
||||
# Healer, Hydration, Shed Skin
|
||||
Battle::AbilityEffects.triggerEndOfRoundHealing(b.ability, b, self) if b.abilityActive?
|
||||
@@ -309,27 +309,27 @@ class Battle
|
||||
priority.each do |b|
|
||||
next if !b.effects[PBEffects::AquaRing]
|
||||
next if !b.canHeal?
|
||||
hpGain = b.totalhp/16
|
||||
hpGain = (hpGain*1.3).floor if b.hasActiveItem?(:BIGROOT)
|
||||
hpGain = b.totalhp / 16
|
||||
hpGain = (hpGain * 1.3).floor if b.hasActiveItem?(:BIGROOT)
|
||||
b.pbRecoverHP(hpGain)
|
||||
pbDisplay(_INTL("Aqua Ring restored {1}'s HP!",b.pbThis(true)))
|
||||
pbDisplay(_INTL("Aqua Ring restored {1}'s HP!", b.pbThis(true)))
|
||||
end
|
||||
# Ingrain
|
||||
priority.each do |b|
|
||||
next if !b.effects[PBEffects::Ingrain]
|
||||
next if !b.canHeal?
|
||||
hpGain = b.totalhp/16
|
||||
hpGain = (hpGain*1.3).floor if b.hasActiveItem?(:BIGROOT)
|
||||
hpGain = b.totalhp / 16
|
||||
hpGain = (hpGain * 1.3).floor if b.hasActiveItem?(:BIGROOT)
|
||||
b.pbRecoverHP(hpGain)
|
||||
pbDisplay(_INTL("{1} absorbed nutrients with its roots!",b.pbThis))
|
||||
pbDisplay(_INTL("{1} absorbed nutrients with its roots!", b.pbThis))
|
||||
end
|
||||
# Leech Seed
|
||||
priority.each do |b|
|
||||
next if b.effects[PBEffects::LeechSeed]<0
|
||||
next if b.effects[PBEffects::LeechSeed] < 0
|
||||
next if !b.takesIndirectDamage?
|
||||
recipient = @battlers[b.effects[PBEffects::LeechSeed]]
|
||||
next if !recipient || recipient.fainted?
|
||||
pbCommonAnimation("LeechSeed",recipient,b)
|
||||
pbCommonAnimation("LeechSeed", recipient, b)
|
||||
b.pbTakeEffectDamage(b.totalhp / 8) { |hp_lost|
|
||||
recipient.pbRecoverHPFromDrain(hp_lost, b,
|
||||
_INTL("{1}'s health is sapped by Leech Seed!", b.pbThis))
|
||||
@@ -339,38 +339,38 @@ class Battle
|
||||
end
|
||||
# Damage from Hyper Mode (Shadow Pokémon)
|
||||
priority.each do |b|
|
||||
next if !b.inHyperMode? || @choices[b.index][0]!=:UseMove
|
||||
hpLoss = b.totalhp/24
|
||||
next if !b.inHyperMode? || @choices[b.index][0] != :UseMove
|
||||
hpLoss = b.totalhp / 24
|
||||
@scene.pbDamageAnimation(b)
|
||||
b.pbReduceHP(hpLoss,false)
|
||||
pbDisplay(_INTL("The Hyper Mode attack hurts {1}!",b.pbThis(true)))
|
||||
b.pbReduceHP(hpLoss, false)
|
||||
pbDisplay(_INTL("The Hyper Mode attack hurts {1}!", b.pbThis(true)))
|
||||
b.pbFaint if b.fainted?
|
||||
end
|
||||
# Damage from poisoning
|
||||
priority.each do |b|
|
||||
next if b.fainted?
|
||||
next if b.status != :POISON
|
||||
if b.statusCount>0
|
||||
if b.statusCount > 0
|
||||
b.effects[PBEffects::Toxic] += 1
|
||||
b.effects[PBEffects::Toxic] = 16 if b.effects[PBEffects::Toxic]>16
|
||||
b.effects[PBEffects::Toxic] = 16 if b.effects[PBEffects::Toxic] > 16
|
||||
end
|
||||
if b.hasActiveAbility?(:POISONHEAL)
|
||||
if b.canHeal?
|
||||
anim_name = GameData::Status.get(:POISON).animation
|
||||
pbCommonAnimation(anim_name, b) if anim_name
|
||||
pbShowAbilitySplash(b)
|
||||
b.pbRecoverHP(b.totalhp/8)
|
||||
b.pbRecoverHP(b.totalhp / 8)
|
||||
if Scene::USE_ABILITY_SPLASH
|
||||
pbDisplay(_INTL("{1}'s HP was restored.",b.pbThis))
|
||||
pbDisplay(_INTL("{1}'s HP was restored.", b.pbThis))
|
||||
else
|
||||
pbDisplay(_INTL("{1}'s {2} restored its HP.",b.pbThis,b.abilityName))
|
||||
pbDisplay(_INTL("{1}'s {2} restored its HP.", b.pbThis, b.abilityName))
|
||||
end
|
||||
pbHideAbilitySplash(b)
|
||||
end
|
||||
elsif b.takesIndirectDamage?
|
||||
b.droppedBelowHalfHP = false
|
||||
dmg = (b.statusCount==0) ? b.totalhp/8 : b.totalhp*b.effects[PBEffects::Toxic]/16
|
||||
b.pbContinueStatus { b.pbReduceHP(dmg,false) }
|
||||
dmg = (b.statusCount == 0) ? b.totalhp / 8 : b.totalhp * b.effects[PBEffects::Toxic] / 16
|
||||
b.pbContinueStatus { b.pbReduceHP(dmg, false) }
|
||||
b.pbItemHPHealCheck
|
||||
b.pbAbilitiesOnDamageTaken
|
||||
b.pbFaint if b.fainted?
|
||||
@@ -381,9 +381,9 @@ class Battle
|
||||
priority.each do |b|
|
||||
next if b.status != :BURN || !b.takesIndirectDamage?
|
||||
b.droppedBelowHalfHP = false
|
||||
dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
|
||||
dmg = (dmg/2.0).round if b.hasActiveAbility?(:HEATPROOF)
|
||||
b.pbContinueStatus { b.pbReduceHP(dmg,false) }
|
||||
dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp / 16 : b.totalhp / 8
|
||||
dmg = (dmg / 2.0).round if b.hasActiveAbility?(:HEATPROOF)
|
||||
b.pbContinueStatus { b.pbReduceHP(dmg, false) }
|
||||
b.pbItemHPHealCheck
|
||||
b.pbAbilitiesOnDamageTaken
|
||||
b.pbFaint if b.fainted?
|
||||
@@ -406,11 +406,11 @@ class Battle
|
||||
end
|
||||
# Trapping attacks (Bind/Clamp/Fire Spin/Magma Storm/Sand Tomb/Whirlpool/Wrap)
|
||||
priority.each do |b|
|
||||
next if b.fainted? || b.effects[PBEffects::Trapping]==0
|
||||
next if b.fainted? || b.effects[PBEffects::Trapping] == 0
|
||||
b.effects[PBEffects::Trapping] -= 1
|
||||
moveName = GameData::Move.get(b.effects[PBEffects::TrappingMove]).name
|
||||
if b.effects[PBEffects::Trapping]==0
|
||||
pbDisplay(_INTL("{1} was freed from {2}!",b.pbThis,moveName))
|
||||
if b.effects[PBEffects::Trapping] == 0
|
||||
pbDisplay(_INTL("{1} was freed from {2}!", b.pbThis, moveName))
|
||||
else
|
||||
case b.effects[PBEffects::TrappingMove]
|
||||
when :BIND then pbCommonAnimation("Bind", b)
|
||||
@@ -423,9 +423,9 @@ class Battle
|
||||
else pbCommonAnimation("Wrap", b)
|
||||
end
|
||||
if b.takesIndirectDamage?
|
||||
hpLoss = (Settings::MECHANICS_GENERATION >= 6) ? b.totalhp/8 : b.totalhp/16
|
||||
hpLoss = (Settings::MECHANICS_GENERATION >= 6) ? b.totalhp / 8 : b.totalhp / 16
|
||||
if @battlers[b.effects[PBEffects::TrappingUser]].hasActiveItem?(:BINDINGBAND)
|
||||
hpLoss = (Settings::MECHANICS_GENERATION >= 6) ? b.totalhp/6 : b.totalhp/8
|
||||
hpLoss = (Settings::MECHANICS_GENERATION >= 6) ? b.totalhp / 6 : b.totalhp / 8
|
||||
end
|
||||
@scene.pbDamageAnimation(b)
|
||||
b.pbTakeEffectDamage(hpLoss, false) { |hp_lost|
|
||||
@@ -443,18 +443,18 @@ class Battle
|
||||
b.pbItemOnStatDropped
|
||||
end
|
||||
# Taunt
|
||||
pbEORCountDownBattlerEffect(priority,PBEffects::Taunt) { |battler|
|
||||
pbDisplay(_INTL("{1}'s taunt wore off!",battler.pbThis))
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Taunt) { |battler|
|
||||
pbDisplay(_INTL("{1}'s taunt wore off!", battler.pbThis))
|
||||
}
|
||||
# Encore
|
||||
priority.each do |b|
|
||||
next if b.fainted? || b.effects[PBEffects::Encore]==0
|
||||
next if b.fainted? || b.effects[PBEffects::Encore] == 0
|
||||
idxEncoreMove = b.pbEncoredMoveIndex
|
||||
if idxEncoreMove>=0
|
||||
if idxEncoreMove >= 0
|
||||
b.effects[PBEffects::Encore] -= 1
|
||||
if b.effects[PBEffects::Encore]==0 || b.moves[idxEncoreMove].pp==0
|
||||
if b.effects[PBEffects::Encore] == 0 || b.moves[idxEncoreMove].pp == 0
|
||||
b.effects[PBEffects::Encore] = 0
|
||||
pbDisplay(_INTL("{1}'s encore ended!",b.pbThis))
|
||||
pbDisplay(_INTL("{1}'s encore ended!", b.pbThis))
|
||||
end
|
||||
else
|
||||
PBDebug.log("[End of effect] #{b.pbThis}'s encore ended (encored move no longer known)")
|
||||
@@ -463,29 +463,29 @@ class Battle
|
||||
end
|
||||
end
|
||||
# Disable/Cursed Body
|
||||
pbEORCountDownBattlerEffect(priority,PBEffects::Disable) { |battler|
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Disable) { |battler|
|
||||
battler.effects[PBEffects::DisableMove] = nil
|
||||
pbDisplay(_INTL("{1} is no longer disabled!",battler.pbThis))
|
||||
pbDisplay(_INTL("{1} is no longer disabled!", battler.pbThis))
|
||||
}
|
||||
# Magnet Rise
|
||||
pbEORCountDownBattlerEffect(priority,PBEffects::MagnetRise) { |battler|
|
||||
pbDisplay(_INTL("{1}'s electromagnetism wore off!",battler.pbThis))
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::MagnetRise) { |battler|
|
||||
pbDisplay(_INTL("{1}'s electromagnetism wore off!", battler.pbThis))
|
||||
}
|
||||
# Telekinesis
|
||||
pbEORCountDownBattlerEffect(priority,PBEffects::Telekinesis) { |battler|
|
||||
pbDisplay(_INTL("{1} was freed from the telekinesis!",battler.pbThis))
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Telekinesis) { |battler|
|
||||
pbDisplay(_INTL("{1} was freed from the telekinesis!", battler.pbThis))
|
||||
}
|
||||
# Heal Block
|
||||
pbEORCountDownBattlerEffect(priority,PBEffects::HealBlock) { |battler|
|
||||
pbDisplay(_INTL("{1}'s Heal Block wore off!",battler.pbThis))
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::HealBlock) { |battler|
|
||||
pbDisplay(_INTL("{1}'s Heal Block wore off!", battler.pbThis))
|
||||
}
|
||||
# Embargo
|
||||
pbEORCountDownBattlerEffect(priority,PBEffects::Embargo) { |battler|
|
||||
pbDisplay(_INTL("{1} can use items again!",battler.pbThis))
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Embargo) { |battler|
|
||||
pbDisplay(_INTL("{1} can use items again!", battler.pbThis))
|
||||
battler.pbItemTerrainStatBoostCheck
|
||||
}
|
||||
# Yawn
|
||||
pbEORCountDownBattlerEffect(priority,PBEffects::Yawn) { |battler|
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Yawn) { |battler|
|
||||
if battler.pbCanSleepYawn?
|
||||
PBDebug.log("[Lingering effect] #{battler.pbThis} fell asleep because of Yawn")
|
||||
battler.pbSleep
|
||||
@@ -494,59 +494,59 @@ class Battle
|
||||
# Perish Song
|
||||
perishSongUsers = []
|
||||
priority.each do |b|
|
||||
next if b.fainted? || b.effects[PBEffects::PerishSong]==0
|
||||
next if b.fainted? || b.effects[PBEffects::PerishSong] == 0
|
||||
b.effects[PBEffects::PerishSong] -= 1
|
||||
pbDisplay(_INTL("{1}'s perish count fell to {2}!",b.pbThis,b.effects[PBEffects::PerishSong]))
|
||||
if b.effects[PBEffects::PerishSong]==0
|
||||
pbDisplay(_INTL("{1}'s perish count fell to {2}!", b.pbThis, b.effects[PBEffects::PerishSong]))
|
||||
if b.effects[PBEffects::PerishSong] == 0
|
||||
perishSongUsers.push(b.effects[PBEffects::PerishSongUser])
|
||||
b.pbReduceHP(b.hp)
|
||||
end
|
||||
b.pbItemHPHealCheck
|
||||
b.pbFaint if b.fainted?
|
||||
end
|
||||
if perishSongUsers.length>0
|
||||
if perishSongUsers.length > 0
|
||||
# If all remaining Pokemon fainted by a Perish Song triggered by a single side
|
||||
if (perishSongUsers.find_all { |idxBattler| opposes?(idxBattler) }.length==perishSongUsers.length) ||
|
||||
(perishSongUsers.find_all { |idxBattler| !opposes?(idxBattler) }.length==perishSongUsers.length)
|
||||
if (perishSongUsers.find_all { |idxBattler| opposes?(idxBattler) }.length == perishSongUsers.length) ||
|
||||
(perishSongUsers.find_all { |idxBattler| !opposes?(idxBattler) }.length == perishSongUsers.length)
|
||||
pbJudgeCheckpoint(@battlers[perishSongUsers[0]])
|
||||
end
|
||||
end
|
||||
# Check for end of battle
|
||||
if @decision>0
|
||||
if @decision > 0
|
||||
pbGainExp
|
||||
return
|
||||
end
|
||||
for side in 0...2
|
||||
# Reflect
|
||||
pbEORCountDownSideEffect(side,PBEffects::Reflect,
|
||||
_INTL("{1}'s Reflect wore off!",@battlers[side].pbTeam))
|
||||
pbEORCountDownSideEffect(side, PBEffects::Reflect,
|
||||
_INTL("{1}'s Reflect wore off!", @battlers[side].pbTeam))
|
||||
# Light Screen
|
||||
pbEORCountDownSideEffect(side,PBEffects::LightScreen,
|
||||
_INTL("{1}'s Light Screen wore off!",@battlers[side].pbTeam))
|
||||
pbEORCountDownSideEffect(side, PBEffects::LightScreen,
|
||||
_INTL("{1}'s Light Screen wore off!", @battlers[side].pbTeam))
|
||||
# Safeguard
|
||||
pbEORCountDownSideEffect(side,PBEffects::Safeguard,
|
||||
_INTL("{1} is no longer protected by Safeguard!",@battlers[side].pbTeam))
|
||||
pbEORCountDownSideEffect(side, PBEffects::Safeguard,
|
||||
_INTL("{1} is no longer protected by Safeguard!", @battlers[side].pbTeam))
|
||||
# Mist
|
||||
pbEORCountDownSideEffect(side,PBEffects::Mist,
|
||||
_INTL("{1} is no longer protected by mist!",@battlers[side].pbTeam))
|
||||
pbEORCountDownSideEffect(side, PBEffects::Mist,
|
||||
_INTL("{1} is no longer protected by mist!", @battlers[side].pbTeam))
|
||||
# Tailwind
|
||||
pbEORCountDownSideEffect(side,PBEffects::Tailwind,
|
||||
_INTL("{1}'s Tailwind petered out!",@battlers[side].pbTeam))
|
||||
pbEORCountDownSideEffect(side, PBEffects::Tailwind,
|
||||
_INTL("{1}'s Tailwind petered out!", @battlers[side].pbTeam))
|
||||
# Lucky Chant
|
||||
pbEORCountDownSideEffect(side,PBEffects::LuckyChant,
|
||||
_INTL("{1}'s Lucky Chant wore off!",@battlers[side].pbTeam))
|
||||
pbEORCountDownSideEffect(side, PBEffects::LuckyChant,
|
||||
_INTL("{1}'s Lucky Chant wore off!", @battlers[side].pbTeam))
|
||||
# Pledge Rainbow
|
||||
pbEORCountDownSideEffect(side,PBEffects::Rainbow,
|
||||
_INTL("The rainbow on {1}'s side disappeared!",@battlers[side].pbTeam(true)))
|
||||
pbEORCountDownSideEffect(side, PBEffects::Rainbow,
|
||||
_INTL("The rainbow on {1}'s side disappeared!", @battlers[side].pbTeam(true)))
|
||||
# Pledge Sea of Fire
|
||||
pbEORCountDownSideEffect(side,PBEffects::SeaOfFire,
|
||||
_INTL("The sea of fire around {1} disappeared!",@battlers[side].pbTeam(true)))
|
||||
pbEORCountDownSideEffect(side, PBEffects::SeaOfFire,
|
||||
_INTL("The sea of fire around {1} disappeared!", @battlers[side].pbTeam(true)))
|
||||
# Pledge Swamp
|
||||
pbEORCountDownSideEffect(side,PBEffects::Swamp,
|
||||
_INTL("The swamp around {1} disappeared!",@battlers[side].pbTeam(true)))
|
||||
pbEORCountDownSideEffect(side, PBEffects::Swamp,
|
||||
_INTL("The swamp around {1} disappeared!", @battlers[side].pbTeam(true)))
|
||||
# Aurora Veil
|
||||
pbEORCountDownSideEffect(side,PBEffects::AuroraVeil,
|
||||
_INTL("{1}'s Aurora Veil wore off!",@battlers[side].pbTeam(true)))
|
||||
pbEORCountDownSideEffect(side, PBEffects::AuroraVeil,
|
||||
_INTL("{1}'s Aurora Veil wore off!", @battlers[side].pbTeam(true)))
|
||||
end
|
||||
# Trick Room
|
||||
pbEORCountDownFieldEffect(PBEffects::TrickRoom,
|
||||
@@ -572,27 +572,27 @@ class Battle
|
||||
next if b.fainted?
|
||||
# Hyper Mode (Shadow Pokémon)
|
||||
if b.inHyperMode?
|
||||
if pbRandom(100)<10
|
||||
if pbRandom(100) < 10
|
||||
b.pokemon.hyper_mode = false
|
||||
pbDisplay(_INTL("{1} came to its senses!",b.pbThis))
|
||||
pbDisplay(_INTL("{1} came to its senses!", b.pbThis))
|
||||
else
|
||||
pbDisplay(_INTL("{1} is in Hyper Mode!",b.pbThis))
|
||||
pbDisplay(_INTL("{1} is in Hyper Mode!", b.pbThis))
|
||||
end
|
||||
end
|
||||
# Uproar
|
||||
if b.effects[PBEffects::Uproar]>0
|
||||
if b.effects[PBEffects::Uproar] > 0
|
||||
b.effects[PBEffects::Uproar] -= 1
|
||||
if b.effects[PBEffects::Uproar]==0
|
||||
pbDisplay(_INTL("{1} calmed down.",b.pbThis))
|
||||
if b.effects[PBEffects::Uproar] == 0
|
||||
pbDisplay(_INTL("{1} calmed down.", b.pbThis))
|
||||
else
|
||||
pbDisplay(_INTL("{1} is making an uproar!",b.pbThis))
|
||||
pbDisplay(_INTL("{1} is making an uproar!", b.pbThis))
|
||||
end
|
||||
end
|
||||
# Slow Start's end message
|
||||
if b.effects[PBEffects::SlowStart]>0
|
||||
if b.effects[PBEffects::SlowStart] > 0
|
||||
b.effects[PBEffects::SlowStart] -= 1
|
||||
if b.effects[PBEffects::SlowStart]==0
|
||||
pbDisplay(_INTL("{1} finally got its act together!",b.pbThis))
|
||||
if b.effects[PBEffects::SlowStart] == 0
|
||||
pbDisplay(_INTL("{1} finally got its act together!", b.pbThis))
|
||||
end
|
||||
end
|
||||
# Bad Dreams, Moody, Speed Boost
|
||||
@@ -603,12 +603,12 @@ class Battle
|
||||
Battle::AbilityEffects.triggerEndOfRoundGainItem(b.ability, b, self) if b.abilityActive?
|
||||
end
|
||||
pbGainExp
|
||||
return if @decision>0
|
||||
return if @decision > 0
|
||||
# Form checks
|
||||
priority.each { |b| b.pbCheckForm(true) }
|
||||
# Switch Pokémon in if possible
|
||||
pbEORSwitch
|
||||
return if @decision>0
|
||||
return if @decision > 0
|
||||
# In battles with at least one side of size 3+, move battlers around if none
|
||||
# are near to any foes
|
||||
pbEORShiftDistantBattlers
|
||||
@@ -617,7 +617,7 @@ class Battle
|
||||
# Reset/count down battler-specific effects (no messages)
|
||||
allBattlers.each do |b|
|
||||
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::CounterTarget] = -1
|
||||
b.effects[PBEffects::Electrify] = false
|
||||
@@ -627,12 +627,12 @@ class Battle
|
||||
b.effects[PBEffects::FocusPunch] = false
|
||||
b.effects[PBEffects::FollowMe] = 0
|
||||
b.effects[PBEffects::HelpingHand] = false
|
||||
b.effects[PBEffects::HyperBeam] -= 1 if b.effects[PBEffects::HyperBeam]>0
|
||||
b.effects[PBEffects::HyperBeam] -= 1 if b.effects[PBEffects::HyperBeam] > 0
|
||||
b.effects[PBEffects::KingsShield] = false
|
||||
b.effects[PBEffects::LaserFocus] -= 1 if b.effects[PBEffects::LaserFocus]>0
|
||||
if b.effects[PBEffects::LockOn]>0 # Also Mind Reader
|
||||
b.effects[PBEffects::LaserFocus] -= 1 if b.effects[PBEffects::LaserFocus] > 0
|
||||
if b.effects[PBEffects::LockOn] > 0 # Also Mind Reader
|
||||
b.effects[PBEffects::LockOn] -= 1
|
||||
b.effects[PBEffects::LockOnPos] = -1 if b.effects[PBEffects::LockOn]==0
|
||||
b.effects[PBEffects::LockOnPos] = -1 if b.effects[PBEffects::LockOn] == 0
|
||||
end
|
||||
b.effects[PBEffects::MagicBounce] = false
|
||||
b.effects[PBEffects::MagicCoat] = false
|
||||
@@ -649,7 +649,7 @@ class Battle
|
||||
b.effects[PBEffects::Snatch] = 0
|
||||
b.effects[PBEffects::SpikyShield] = false
|
||||
b.effects[PBEffects::Spotlight] = 0
|
||||
b.effects[PBEffects::ThroatChop] -= 1 if b.effects[PBEffects::ThroatChop]>0
|
||||
b.effects[PBEffects::ThroatChop] -= 1 if b.effects[PBEffects::ThroatChop] > 0
|
||||
b.lastHPLost = 0
|
||||
b.lastHPLostFromFoe = 0
|
||||
b.droppedBelowHalfHP = false
|
||||
@@ -677,7 +677,7 @@ class Battle
|
||||
end
|
||||
# Reset/count down field-specific effects (no messages)
|
||||
@field.effects[PBEffects::IonDeluge] = false
|
||||
@field.effects[PBEffects::FairyLock] -= 1 if @field.effects[PBEffects::FairyLock]>0
|
||||
@field.effects[PBEffects::FairyLock] -= 1 if @field.effects[PBEffects::FairyLock] > 0
|
||||
@field.effects[PBEffects::FusionBolt] = false
|
||||
@field.effects[PBEffects::FusionFlare] = false
|
||||
@endOfRound = false
|
||||
|
||||
Reference in New Issue
Block a user