mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 06:04:59 +00:00
Added decent spacing to all scripts thanks to Rubocop
This commit is contained in:
@@ -4,7 +4,7 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
def pbBattleIntroAnimation
|
||||
# Make everything appear
|
||||
introAnim = Animation::Intro.new(@sprites,@viewport,@battle)
|
||||
introAnim = Animation::Intro.new(@sprites, @viewport, @battle)
|
||||
loop do
|
||||
introAnim.update
|
||||
pbUpdate
|
||||
@@ -19,8 +19,8 @@ class Battle::Scene
|
||||
# entrance animation. Be sure to set it up like a Pokémon entrance
|
||||
# animation, i.e. add them to @animations so that they can play out
|
||||
# while party lineups appear and messages show.
|
||||
pbShowPartyLineup(0,true)
|
||||
pbShowPartyLineup(1,true)
|
||||
pbShowPartyLineup(0, true)
|
||||
pbShowPartyLineup(1, true)
|
||||
return
|
||||
end
|
||||
# Wild battle: play wild Pokémon's intro animations (including cry), show
|
||||
@@ -28,14 +28,14 @@ class Battle::Scene
|
||||
# shiny animation(s)
|
||||
# Set up data box animation
|
||||
for i in 0...@battle.sideSizes[1]
|
||||
idxBattler = 2*i+1
|
||||
idxBattler = 2 * i + 1
|
||||
next if !@battle.battlers[idxBattler]
|
||||
dataBoxAnim = Animation::DataBoxAppear.new(@sprites,@viewport,idxBattler)
|
||||
dataBoxAnim = Animation::DataBoxAppear.new(@sprites, @viewport, idxBattler)
|
||||
@animations.push(dataBoxAnim)
|
||||
end
|
||||
# Set up wild Pokémon returning to normal colour and playing intro
|
||||
# animations (including cry)
|
||||
@animations.push(Animation::Intro2.new(@sprites,@viewport,@battle.sideSizes[1]))
|
||||
@animations.push(Animation::Intro2.new(@sprites, @viewport, @battle.sideSizes[1]))
|
||||
# Play all the animations
|
||||
while inPartyAnimation?
|
||||
pbUpdate
|
||||
@@ -43,7 +43,7 @@ class Battle::Scene
|
||||
# Show shiny animation for wild Pokémon
|
||||
if @battle.showAnims
|
||||
for i in 0...@battle.sideSizes[1]
|
||||
idxBattler = 2*i+1
|
||||
idxBattler = 2 * i + 1
|
||||
next if !@battle.battlers[idxBattler] || !@battle.battlers[idxBattler].shiny?
|
||||
if Settings::SUPER_SHINY && @battle.battlers[idxBattler].super_shiny?
|
||||
pbCommonAnimation("SuperShiny", @battle.battlers[idxBattler])
|
||||
@@ -57,9 +57,9 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Animates a party lineup appearing for the given side
|
||||
#=============================================================================
|
||||
def pbShowPartyLineup(side,fullAnim = false)
|
||||
@animations.push(Animation::LineupAppear.new(@sprites,@viewport,
|
||||
side,@battle.pbParty(side),@battle.pbPartyStarts(side),fullAnim))
|
||||
def pbShowPartyLineup(side, fullAnim = false)
|
||||
@animations.push(Animation::LineupAppear.new(@sprites, @viewport,
|
||||
side, @battle.pbParty(side), @battle.pbPartyStarts(side), fullAnim))
|
||||
if !fullAnim
|
||||
while inPartyAnimation?
|
||||
pbUpdate
|
||||
@@ -74,7 +74,7 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
def pbShowOpponent(idxTrainer)
|
||||
# Set up trainer appearing animation
|
||||
appearAnim = Animation::TrainerAppear.new(@sprites,@viewport,idxTrainer)
|
||||
appearAnim = Animation::TrainerAppear.new(@sprites, @viewport, idxTrainer)
|
||||
@animations.push(appearAnim)
|
||||
# Play the animation
|
||||
while inPartyAnimation?
|
||||
@@ -88,8 +88,8 @@ class Battle::Scene
|
||||
# animation for it if relevant.
|
||||
# sendOuts is an array; each element is itself an array: [idxBattler,pkmn]
|
||||
#=============================================================================
|
||||
def pbSendOutBattlers(sendOuts,startBattle = false)
|
||||
return if sendOuts.length==0
|
||||
def pbSendOutBattlers(sendOuts, startBattle = false)
|
||||
return if sendOuts.length == 0
|
||||
# If party balls are still appearing, wait for them to finish showing up, as
|
||||
# the FadeAnimation will make them disappear.
|
||||
while inPartyAnimation?
|
||||
@@ -99,29 +99,29 @@ class Battle::Scene
|
||||
# Make all trainers and party lineups disappear (player-side trainers may
|
||||
# animate throwing a Poké Ball)
|
||||
if @battle.opposes?(sendOuts[0][0])
|
||||
fadeAnim = Animation::TrainerFade.new(@sprites,@viewport,startBattle)
|
||||
fadeAnim = Animation::TrainerFade.new(@sprites, @viewport, startBattle)
|
||||
else
|
||||
fadeAnim = Animation::PlayerFade.new(@sprites,@viewport,startBattle)
|
||||
fadeAnim = Animation::PlayerFade.new(@sprites, @viewport, startBattle)
|
||||
end
|
||||
# For each battler being sent out, set the battler's sprite and create two
|
||||
# animations (the Poké Ball moving and battler appearing from it, and its
|
||||
# data box appearing)
|
||||
sendOutAnims = []
|
||||
sendOuts.each_with_index do |b,i|
|
||||
sendOuts.each_with_index do |b, i|
|
||||
pkmn = @battle.battlers[b[0]].effects[PBEffects::Illusion] || b[1]
|
||||
pbChangePokemon(b[0],pkmn)
|
||||
pbChangePokemon(b[0], pkmn)
|
||||
pbRefresh
|
||||
if @battle.opposes?(b[0])
|
||||
sendOutAnim = Animation::PokeballTrainerSendOut.new(@sprites,@viewport,
|
||||
@battle.pbGetOwnerIndexFromBattlerIndex(b[0])+1,
|
||||
@battle.battlers[b[0]],startBattle,i)
|
||||
sendOutAnim = Animation::PokeballTrainerSendOut.new(@sprites, @viewport,
|
||||
@battle.pbGetOwnerIndexFromBattlerIndex(b[0]) + 1,
|
||||
@battle.battlers[b[0]], startBattle, i)
|
||||
else
|
||||
sendOutAnim = Animation::PokeballPlayerSendOut.new(@sprites,@viewport,
|
||||
@battle.pbGetOwnerIndexFromBattlerIndex(b[0])+1,
|
||||
@battle.battlers[b[0]],startBattle,i)
|
||||
sendOutAnim = Animation::PokeballPlayerSendOut.new(@sprites, @viewport,
|
||||
@battle.pbGetOwnerIndexFromBattlerIndex(b[0]) + 1,
|
||||
@battle.battlers[b[0]], startBattle, i)
|
||||
end
|
||||
dataBoxAnim = Animation::DataBoxAppear.new(@sprites,@viewport,b[0])
|
||||
sendOutAnims.push([sendOutAnim,dataBoxAnim,false])
|
||||
dataBoxAnim = Animation::DataBoxAppear.new(@sprites, @viewport, b[0])
|
||||
sendOutAnims.push([sendOutAnim, dataBoxAnim, false])
|
||||
end
|
||||
# Play all animations
|
||||
loop do
|
||||
@@ -159,7 +159,7 @@ class Battle::Scene
|
||||
def pbRecall(idxBattler)
|
||||
@briefMessage = false
|
||||
# Recall animation
|
||||
recallAnim = Animation::BattlerRecall.new(@sprites,@viewport,idxBattler)
|
||||
recallAnim = Animation::BattlerRecall.new(@sprites, @viewport, idxBattler)
|
||||
loop do
|
||||
recallAnim.update if recallAnim
|
||||
pbUpdate
|
||||
@@ -167,7 +167,7 @@ class Battle::Scene
|
||||
end
|
||||
recallAnim.dispose
|
||||
# Data box disappear animation
|
||||
dataBoxAnim = Animation::DataBoxDisappear.new(@sprites,@viewport,idxBattler)
|
||||
dataBoxAnim = Animation::DataBoxDisappear.new(@sprites, @viewport, idxBattler)
|
||||
loop do
|
||||
dataBoxAnim.update
|
||||
pbUpdate
|
||||
@@ -181,10 +181,10 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
def pbShowAbilitySplash(battler)
|
||||
return if !USE_ABILITY_SPLASH
|
||||
side = battler.index%2
|
||||
side = battler.index % 2
|
||||
pbHideAbilitySplash(battler) if @sprites["abilityBar_#{side}"].visible
|
||||
@sprites["abilityBar_#{side}"].battler = battler
|
||||
abilitySplashAnim = Animation::AbilitySplashAppear.new(@sprites,@viewport,side)
|
||||
abilitySplashAnim = Animation::AbilitySplashAppear.new(@sprites, @viewport, side)
|
||||
loop do
|
||||
abilitySplashAnim.update
|
||||
pbUpdate
|
||||
@@ -195,9 +195,9 @@ class Battle::Scene
|
||||
|
||||
def pbHideAbilitySplash(battler)
|
||||
return if !USE_ABILITY_SPLASH
|
||||
side = battler.index%2
|
||||
side = battler.index % 2
|
||||
return if !@sprites["abilityBar_#{side}"].visible
|
||||
abilitySplashAnim = Animation::AbilitySplashDisappear.new(@sprites,@viewport,side)
|
||||
abilitySplashAnim = Animation::AbilitySplashDisappear.new(@sprites, @viewport, side)
|
||||
loop do
|
||||
abilitySplashAnim.update
|
||||
pbUpdate
|
||||
@@ -216,23 +216,23 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Shows a HP-changing common animation and animates a data box's HP bar.
|
||||
# Called by def pbReduceHP, def pbRecoverHP.
|
||||
def pbHPChanged(battler,oldHP,showAnim = false)
|
||||
def pbHPChanged(battler, oldHP, showAnim = false)
|
||||
@briefMessage = false
|
||||
if battler.hp>oldHP
|
||||
pbCommonAnimation("HealthUp",battler) if showAnim && @battle.showAnims
|
||||
elsif battler.hp<oldHP
|
||||
pbCommonAnimation("HealthDown",battler) if showAnim && @battle.showAnims
|
||||
if battler.hp > oldHP
|
||||
pbCommonAnimation("HealthUp", battler) if showAnim && @battle.showAnims
|
||||
elsif battler.hp < oldHP
|
||||
pbCommonAnimation("HealthDown", battler) if showAnim && @battle.showAnims
|
||||
end
|
||||
@sprites["dataBox_#{battler.index}"].animateHP(oldHP,battler.hp,battler.totalhp)
|
||||
@sprites["dataBox_#{battler.index}"].animateHP(oldHP, battler.hp, battler.totalhp)
|
||||
while @sprites["dataBox_#{battler.index}"].animatingHP
|
||||
pbUpdate
|
||||
end
|
||||
end
|
||||
|
||||
def pbDamageAnimation(battler,effectiveness = 0)
|
||||
def pbDamageAnimation(battler, effectiveness = 0)
|
||||
@briefMessage = false
|
||||
# Damage animation
|
||||
damageAnim = Animation::BattlerDamage.new(@sprites,@viewport,battler.index,effectiveness)
|
||||
damageAnim = Animation::BattlerDamage.new(@sprites, @viewport, battler.index, effectiveness)
|
||||
loop do
|
||||
damageAnim.update
|
||||
pbUpdate
|
||||
@@ -249,9 +249,9 @@ class Battle::Scene
|
||||
# Set up animations
|
||||
damageAnims = []
|
||||
targets.each do |t|
|
||||
anim = Animation::BattlerDamage.new(@sprites,@viewport,t[0].index,t[2])
|
||||
anim = Animation::BattlerDamage.new(@sprites, @viewport, t[0].index, t[2])
|
||||
damageAnims.push(anim)
|
||||
@sprites["dataBox_#{t[0].index}"].animateHP(t[1],t[0].hp,t[0].totalhp)
|
||||
@sprites["dataBox_#{t[0].index}"].animateHP(t[1], t[0].hp, t[0].totalhp)
|
||||
end
|
||||
# Update loop
|
||||
loop do
|
||||
@@ -278,13 +278,13 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Animates a data box's Exp bar
|
||||
#=============================================================================
|
||||
def pbEXPBar(battler,startExp,endExp,tempExp1,tempExp2)
|
||||
def pbEXPBar(battler, startExp, endExp, tempExp1, tempExp2)
|
||||
return if !battler || endExp == startExp
|
||||
startExpLevel = tempExp1-startExp
|
||||
endExpLevel = tempExp2-startExp
|
||||
expRange = endExp-startExp
|
||||
startExpLevel = tempExp1 - startExp
|
||||
endExpLevel = tempExp2 - startExp
|
||||
expRange = endExp - startExp
|
||||
dataBox = @sprites["dataBox_#{battler.index}"]
|
||||
dataBox.animateExp(startExpLevel,endExpLevel,expRange)
|
||||
dataBox.animateExp(startExpLevel, endExpLevel, expRange)
|
||||
while dataBox.animatingExp
|
||||
pbUpdate
|
||||
end
|
||||
@@ -293,14 +293,14 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Shows stats windows upon a Pokémon levelling up
|
||||
#=============================================================================
|
||||
def pbLevelUp(pkmn,_battler,oldTotalHP,oldAttack,oldDefense,oldSpAtk,oldSpDef,oldSpeed)
|
||||
def pbLevelUp(pkmn, _battler, oldTotalHP, oldAttack, oldDefense, oldSpAtk, oldSpDef, oldSpeed)
|
||||
pbTopRightWindow(
|
||||
_INTL("Max. HP<r>+{1}\r\nAttack<r>+{2}\r\nDefense<r>+{3}\r\nSp. Atk<r>+{4}\r\nSp. Def<r>+{5}\r\nSpeed<r>+{6}",
|
||||
pkmn.totalhp-oldTotalHP,pkmn.attack-oldAttack,pkmn.defense-oldDefense,
|
||||
pkmn.spatk-oldSpAtk,pkmn.spdef-oldSpDef,pkmn.speed-oldSpeed))
|
||||
pkmn.totalhp - oldTotalHP, pkmn.attack - oldAttack, pkmn.defense - oldDefense,
|
||||
pkmn.spatk - oldSpAtk, pkmn.spdef - oldSpDef, pkmn.speed - oldSpeed))
|
||||
pbTopRightWindow(
|
||||
_INTL("Max. HP<r>{1}\r\nAttack<r>{2}\r\nDefense<r>{3}\r\nSp. Atk<r>{4}\r\nSp. Def<r>{5}\r\nSpeed<r>{6}",
|
||||
pkmn.totalhp,pkmn.attack,pkmn.defense,pkmn.spatk,pkmn.spdef,pkmn.speed))
|
||||
pkmn.totalhp, pkmn.attack, pkmn.defense, pkmn.spatk, pkmn.spdef, pkmn.speed))
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -309,8 +309,8 @@ class Battle::Scene
|
||||
def pbFaintBattler(battler)
|
||||
@briefMessage = false
|
||||
# Pokémon plays cry and drops down, data box disappears
|
||||
faintAnim = Animation::BattlerFaint.new(@sprites,@viewport,battler.index,@battle)
|
||||
dataBoxAnim = Animation::DataBoxDisappear.new(@sprites,@viewport,battler.index)
|
||||
faintAnim = Animation::BattlerFaint.new(@sprites, @viewport, battler.index, @battle)
|
||||
dataBoxAnim = Animation::DataBoxDisappear.new(@sprites, @viewport, battler.index)
|
||||
loop do
|
||||
faintAnim.update
|
||||
dataBoxAnim.update
|
||||
@@ -324,10 +324,10 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Animates throwing a Poké Ball at a Pokémon in an attempt to catch it
|
||||
#=============================================================================
|
||||
def pbThrow(ball,shakes,critical,targetBattler,showPlayer = false)
|
||||
def pbThrow(ball, shakes, critical, targetBattler, showPlayer = false)
|
||||
@briefMessage = false
|
||||
captureAnim = Animation::PokeballThrowCapture.new(@sprites,@viewport,
|
||||
ball,shakes,critical,@battle.battlers[targetBattler],showPlayer)
|
||||
captureAnim = Animation::PokeballThrowCapture.new(@sprites, @viewport,
|
||||
ball, shakes, critical, @battle.battlers[targetBattler], showPlayer)
|
||||
loop do
|
||||
captureAnim.update
|
||||
pbUpdate
|
||||
@@ -343,7 +343,7 @@ class Battle::Scene
|
||||
i = 0
|
||||
loop do
|
||||
pbUpdate
|
||||
break if i>=Graphics.frame_rate*3.5 # 3.5 seconds
|
||||
break if i >= Graphics.frame_rate * 3.5 # 3.5 seconds
|
||||
i += 1
|
||||
end
|
||||
pbMEStop
|
||||
@@ -355,20 +355,20 @@ class Battle::Scene
|
||||
ball = @sprites["captureBall"]
|
||||
return if !ball
|
||||
# Data box disappear animation
|
||||
dataBoxAnim = Animation::DataBoxDisappear.new(@sprites,@viewport,idxBattler)
|
||||
dataBoxAnim = Animation::DataBoxDisappear.new(@sprites, @viewport, idxBattler)
|
||||
loop do
|
||||
dataBoxAnim.update
|
||||
ball.opacity -= 12*20/Graphics.frame_rate if ball.opacity>0
|
||||
ball.opacity -= 12 * 20 / Graphics.frame_rate if ball.opacity > 0
|
||||
pbUpdate
|
||||
break if dataBoxAnim.animDone? && ball.opacity<=0
|
||||
break if dataBoxAnim.animDone? && ball.opacity <= 0
|
||||
end
|
||||
dataBoxAnim.dispose
|
||||
end
|
||||
|
||||
def pbThrowAndDeflect(ball,idxBattler)
|
||||
def pbThrowAndDeflect(ball, idxBattler)
|
||||
@briefMessage = false
|
||||
throwAnim = Animation::PokeballThrowDeflect.new(@sprites,@viewport,
|
||||
ball,@battle.battlers[idxBattler])
|
||||
throwAnim = Animation::PokeballThrowDeflect.new(@sprites, @viewport,
|
||||
ball, @battle.battlers[idxBattler])
|
||||
loop do
|
||||
throwAnim.update
|
||||
pbUpdate
|
||||
@@ -403,17 +403,17 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
# Returns the animation ID to use for a given move/user. Returns nil if that
|
||||
# move has no animations defined for it.
|
||||
def pbFindMoveAnimDetails(move2anim,moveID,idxUser,hitNum = 0)
|
||||
def pbFindMoveAnimDetails(move2anim, moveID, idxUser, hitNum = 0)
|
||||
real_move_id = GameData::Move.get(moveID).id
|
||||
noFlip = false
|
||||
if (idxUser&1)==0 # On player's side
|
||||
if (idxUser & 1) == 0 # On player's side
|
||||
anim = move2anim[0][real_move_id]
|
||||
else # On opposing side
|
||||
anim = move2anim[1][real_move_id]
|
||||
noFlip = true if anim
|
||||
anim = move2anim[0][real_move_id] if !anim
|
||||
end
|
||||
return [anim+hitNum,noFlip] if anim
|
||||
return [anim + hitNum, noFlip] if anim
|
||||
return nil
|
||||
end
|
||||
|
||||
@@ -483,8 +483,8 @@ class Battle::Scene
|
||||
# Plays a move/common animation
|
||||
#=============================================================================
|
||||
# Plays a move animation.
|
||||
def pbAnimation(moveID,user,targets,hitNum = 0)
|
||||
animID = pbFindMoveAnimation(moveID,user.index,hitNum)
|
||||
def pbAnimation(moveID, user, targets, hitNum = 0)
|
||||
animID = pbFindMoveAnimation(moveID, user.index, hitNum)
|
||||
return if !animID
|
||||
anim = animID[0]
|
||||
target = (targets && targets.is_a?(Array)) ? targets[0] : targets
|
||||
@@ -492,27 +492,27 @@ class Battle::Scene
|
||||
return if !animations
|
||||
pbSaveShadows {
|
||||
if animID[1] # On opposing side and using OppMove animation
|
||||
pbAnimationCore(animations[anim],target,user,true)
|
||||
pbAnimationCore(animations[anim], target, user, true)
|
||||
else # On player's side, and/or using Move animation
|
||||
pbAnimationCore(animations[anim],user,target)
|
||||
pbAnimationCore(animations[anim], user, target)
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
# Plays a common animation.
|
||||
def pbCommonAnimation(animName,user = nil,target = nil)
|
||||
def pbCommonAnimation(animName, user = nil, target = nil)
|
||||
return if nil_or_empty?(animName)
|
||||
target = target[0] if target && target.is_a?(Array)
|
||||
animations = pbLoadBattleAnimations
|
||||
return if !animations
|
||||
animations.each do |a|
|
||||
next if !a || a.name!="Common:"+animName
|
||||
pbAnimationCore(a,user,(target!=nil) ? target : user)
|
||||
next if !a || a.name != "Common:" + animName
|
||||
pbAnimationCore(a, user, (target != nil) ? target : user)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
def pbAnimationCore(animation,user,target,oppMove = false)
|
||||
def pbAnimationCore(animation, user, target, oppMove = false)
|
||||
return if !animation
|
||||
@briefMessage = false
|
||||
userSprite = (user) ? @sprites["pokemon_#{user.index}"] : nil
|
||||
@@ -523,7 +523,7 @@ class Battle::Scene
|
||||
oldTargetX = (targetSprite) ? targetSprite.x : oldUserX
|
||||
oldTargetY = (targetSprite) ? targetSprite.y : oldUserY
|
||||
# Create the animation player
|
||||
animPlayer = PBAnimationPlayerX.new(animation,user,target,self,oppMove)
|
||||
animPlayer = PBAnimationPlayerX.new(animation, user, target, self, oppMove)
|
||||
# Apply a transformation to the animation based on where the user and target
|
||||
# actually are. Get the centres of each sprite.
|
||||
userHeight = (userSprite && userSprite.bitmap && !userSprite.bitmap.disposed?) ? userSprite.bitmap.height : 128
|
||||
|
||||
Reference in New Issue
Block a user