mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 14:14:59 +00:00
Yet more Rubocopping
This commit is contained in:
@@ -112,24 +112,24 @@ class Battle::Scene
|
||||
end
|
||||
|
||||
def pbFrameUpdate(cw = nil)
|
||||
cw.update if cw
|
||||
cw&.update
|
||||
@battle.battlers.each_with_index do |b, i|
|
||||
next if !b
|
||||
@sprites["dataBox_#{i}"].update(@frameCounter) if @sprites["dataBox_#{i}"]
|
||||
@sprites["pokemon_#{i}"].update(@frameCounter) if @sprites["pokemon_#{i}"]
|
||||
@sprites["shadow_#{i}"].update(@frameCounter) if @sprites["shadow_#{i}"]
|
||||
@sprites["dataBox_#{i}"]&.update(@frameCounter)
|
||||
@sprites["pokemon_#{i}"]&.update(@frameCounter)
|
||||
@sprites["shadow_#{i}"]&.update(@frameCounter)
|
||||
end
|
||||
end
|
||||
|
||||
def pbRefresh
|
||||
@battle.battlers.each_with_index do |b, i|
|
||||
next if !b
|
||||
@sprites["dataBox_#{i}"].refresh if @sprites["dataBox_#{i}"]
|
||||
@sprites["dataBox_#{i}"]&.refresh
|
||||
end
|
||||
end
|
||||
|
||||
def pbRefreshOne(idxBattler)
|
||||
@sprites["dataBox_#{idxBattler}"].refresh if @sprites["dataBox_#{idxBattler}"]
|
||||
@sprites["dataBox_#{idxBattler}"]&.refresh
|
||||
end
|
||||
|
||||
def pbRefreshEverything
|
||||
|
||||
@@ -70,7 +70,7 @@ class Battle::Scene
|
||||
cw = @sprites["fightWindow"]
|
||||
cw.battler = battler
|
||||
moveIndex = 0
|
||||
if battler.moves[@lastMove[idxBattler]] && battler.moves[@lastMove[idxBattler]].id
|
||||
if battler.moves[@lastMove[idxBattler]]&.id
|
||||
moveIndex = @lastMove[idxBattler]
|
||||
end
|
||||
cw.shiftMode = (@battle.pbCanShift?(idxBattler)) ? 1 : 0
|
||||
@@ -98,14 +98,14 @@ class Battle::Scene
|
||||
if Input.trigger?(Input::LEFT)
|
||||
cw.index -= 1 if (cw.index & 1) == 1
|
||||
elsif Input.trigger?(Input::RIGHT)
|
||||
if battler.moves[cw.index + 1] && battler.moves[cw.index + 1].id
|
||||
cw.index += 1 if (cw.index & 1) == 0
|
||||
if battler.moves[cw.index + 1]&.id && (cw.index & 1) == 0
|
||||
cw.index += 1
|
||||
end
|
||||
elsif Input.trigger?(Input::UP)
|
||||
cw.index -= 2 if (cw.index & 2) == 2
|
||||
elsif Input.trigger?(Input::DOWN)
|
||||
if battler.moves[cw.index + 2] && battler.moves[cw.index + 2].id
|
||||
cw.index += 2 if (cw.index & 2) == 0
|
||||
if battler.moves[cw.index + 2]&.id && (cw.index & 2) == 0
|
||||
cw.index += 2
|
||||
end
|
||||
end
|
||||
pbPlayCursorSE if cw.index != oldIndex
|
||||
|
||||
@@ -137,8 +137,8 @@ class Battle::Scene
|
||||
a[2] = true if a[1].animDone?
|
||||
end
|
||||
pbUpdate
|
||||
if !inPartyAnimation?
|
||||
break if !sendOutAnims.any? { |a| !a[2] }
|
||||
if !inPartyAnimation? && !sendOutAnims.any? { |a| !a[2] }
|
||||
break
|
||||
end
|
||||
end
|
||||
fadeAnim.dispose
|
||||
@@ -165,7 +165,7 @@ class Battle::Scene
|
||||
# Recall animation
|
||||
recallAnim = Animation::BattlerRecall.new(@sprites, @viewport, idxBattler)
|
||||
loop do
|
||||
recallAnim.update if recallAnim
|
||||
recallAnim&.update
|
||||
pbUpdate
|
||||
break if recallAnim.animDone?
|
||||
end
|
||||
@@ -495,7 +495,7 @@ class Battle::Scene
|
||||
animID = pbFindMoveAnimation(moveID, user.index, hitNum)
|
||||
return if !animID
|
||||
anim = animID[0]
|
||||
target = (targets && targets.is_a?(Array)) ? targets[0] : targets
|
||||
target = (targets.is_a?(Array)) ? targets[0] : targets
|
||||
animations = pbLoadBattleAnimations
|
||||
return if !animations
|
||||
pbSaveShadows {
|
||||
@@ -510,7 +510,7 @@ class Battle::Scene
|
||||
# Plays a common animation.
|
||||
def pbCommonAnimation(animName, user = nil, target = nil)
|
||||
return if nil_or_empty?(animName)
|
||||
target = target[0] if target && target.is_a?(Array)
|
||||
target = target[0] if target.is_a?(Array)
|
||||
animations = pbLoadBattleAnimations
|
||||
return if !animations
|
||||
animations.each do |a|
|
||||
@@ -534,7 +534,7 @@ class Battle::Scene
|
||||
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
|
||||
userHeight = (userSprite&.bitmap && !userSprite.bitmap.disposed?) ? userSprite.bitmap.height : 128
|
||||
if targetSprite
|
||||
targetHeight = (targetSprite.bitmap && !targetSprite.bitmap.disposed?) ? targetSprite.bitmap.height : 128
|
||||
else
|
||||
|
||||
@@ -161,7 +161,7 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase
|
||||
|
||||
def dispose
|
||||
super
|
||||
@buttonBitmap.dispose if @buttonBitmap
|
||||
@buttonBitmap&.dispose
|
||||
end
|
||||
|
||||
def z=(value)
|
||||
@@ -191,7 +191,7 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase
|
||||
|
||||
def refresh
|
||||
@msgBox.refresh
|
||||
@cmdWindow.refresh if @cmdWindow
|
||||
@cmdWindow&.refresh
|
||||
refreshButtons
|
||||
end
|
||||
end
|
||||
@@ -310,10 +310,10 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
|
||||
|
||||
def dispose
|
||||
super
|
||||
@buttonBitmap.dispose if @buttonBitmap
|
||||
@typeBitmap.dispose if @typeBitmap
|
||||
@megaEvoBitmap.dispose if @megaEvoBitmap
|
||||
@shiftBitmap.dispose if @shiftBitmap
|
||||
@buttonBitmap&.dispose
|
||||
@typeBitmap&.dispose
|
||||
@megaEvoBitmap&.dispose
|
||||
@shiftBitmap&.dispose
|
||||
end
|
||||
|
||||
def z=(value)
|
||||
@@ -510,7 +510,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase
|
||||
|
||||
def dispose
|
||||
super
|
||||
@buttonBitmap.dispose if @buttonBitmap
|
||||
@buttonBitmap&.dispose
|
||||
end
|
||||
|
||||
def z=(value)
|
||||
|
||||
@@ -52,7 +52,7 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
bgFilename = ["Graphics/Pictures/Battle/databox_thin",
|
||||
"Graphics/Pictures/Battle/databox_thin_foe"][@battler.index % 2]
|
||||
end
|
||||
@databoxBitmap.dispose if @databoxBitmap
|
||||
@databoxBitmap&.dispose
|
||||
@databoxBitmap = AnimatedBitmap.new(bgFilename)
|
||||
# Determine the co-ordinates of the data box and the left edge padding width
|
||||
if onPlayerSide
|
||||
@@ -500,7 +500,7 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
|
||||
end
|
||||
|
||||
def dispose
|
||||
@_iconBitmap.dispose if @_iconBitmap
|
||||
@_iconBitmap&.dispose
|
||||
@_iconBitmap = nil
|
||||
self.bitmap = nil if !self.disposed?
|
||||
super
|
||||
@@ -552,7 +552,7 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
|
||||
|
||||
def setPokemonBitmap(pkmn, back = false)
|
||||
@pkmn = pkmn
|
||||
@_iconBitmap.dispose if @_iconBitmap
|
||||
@_iconBitmap&.dispose
|
||||
@_iconBitmap = GameData::Species.sprite_bitmap_from_pokemon(@pkmn, back)
|
||||
self.bitmap = (@_iconBitmap) ? @_iconBitmap.bitmap : nil
|
||||
pbSetPosition
|
||||
@@ -563,7 +563,7 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
|
||||
# recommendation is to create a PictureEx animation and push it into
|
||||
# the @battleAnimations array.
|
||||
def pbPlayIntroAnimation(pictureEx = nil)
|
||||
@pkmn.play_cry if @pkmn
|
||||
@pkmn&.play_cry
|
||||
end
|
||||
|
||||
QUARTER_ANIM_PERIOD = Graphics.frame_rate * 3 / 20
|
||||
@@ -617,7 +617,7 @@ class Battle::Scene::BattlerShadowSprite < RPG::Sprite
|
||||
end
|
||||
|
||||
def dispose
|
||||
@_iconBitmap.dispose if @_iconBitmap
|
||||
@_iconBitmap&.dispose
|
||||
@_iconBitmap = nil
|
||||
self.bitmap = nil if !self.disposed?
|
||||
super
|
||||
@@ -647,7 +647,7 @@ class Battle::Scene::BattlerShadowSprite < RPG::Sprite
|
||||
|
||||
def setPokemonBitmap(pkmn)
|
||||
@pkmn = pkmn
|
||||
@_iconBitmap.dispose if @_iconBitmap
|
||||
@_iconBitmap&.dispose
|
||||
@_iconBitmap = GameData::Species.shadow_bitmap_from_pokemon(@pkmn)
|
||||
self.bitmap = (@_iconBitmap) ? @_iconBitmap.bitmap : nil
|
||||
pbSetPosition
|
||||
|
||||
@@ -10,7 +10,7 @@ class Battle::Scene::Animation
|
||||
end
|
||||
|
||||
def dispose
|
||||
@tempSprites.each { |s| s.dispose if s }
|
||||
@tempSprites.each { |s| s&.dispose }
|
||||
end
|
||||
|
||||
def createProcesses; end
|
||||
@@ -47,7 +47,7 @@ class Battle::Scene::Animation
|
||||
|
||||
def update
|
||||
return if @animDone
|
||||
@tempSprites.each { |s| s.update if s }
|
||||
@tempSprites.each { |s| s&.update }
|
||||
finished = true
|
||||
@pictureEx.each_with_index do |p, i|
|
||||
next if !p.running?
|
||||
|
||||
@@ -140,9 +140,9 @@ class Battle::Scene::Animation::LineupAppear < Battle::Scene::Animation
|
||||
startsIndex = idxBall / ballsPerTrainer
|
||||
teamIndex = idxBall % ballsPerTrainer
|
||||
ret = @partyStarts[startsIndex] + teamIndex
|
||||
if startsIndex < @partyStarts.length - 1
|
||||
if startsIndex < @partyStarts.length - 1 && ret >= @partyStarts[startsIndex + 1]
|
||||
# There is a later trainer, don't spill over into its team
|
||||
return -1 if ret >= @partyStarts[startsIndex + 1]
|
||||
return -1
|
||||
end
|
||||
return ret
|
||||
end
|
||||
@@ -332,7 +332,7 @@ class Battle::Scene::Animation::PlayerFade < Battle::Scene::Animation
|
||||
end
|
||||
# Move and fade party bar/balls
|
||||
delay = 3
|
||||
if @sprites["partyBar_0"] && @sprites["partyBar_0"].visible
|
||||
if @sprites["partyBar_0"]&.visible
|
||||
partyBar = addSprite(@sprites["partyBar_0"])
|
||||
partyBar.moveDelta(delay, 16, -Graphics.width / 4, 0) if @fullAnim
|
||||
partyBar.moveOpacity(delay, 12, 0)
|
||||
@@ -377,7 +377,7 @@ class Battle::Scene::Animation::TrainerFade < Battle::Scene::Animation
|
||||
end
|
||||
# Move and fade party bar/balls
|
||||
delay = 3
|
||||
if @sprites["partyBar_1"] && @sprites["partyBar_1"].visible
|
||||
if @sprites["partyBar_1"]&.visible
|
||||
partyBar = addSprite(@sprites["partyBar_1"])
|
||||
partyBar.moveDelta(delay, 16, Graphics.width / 4, 0) if @fullAnim
|
||||
partyBar.moveOpacity(delay, 12, 0)
|
||||
@@ -722,12 +722,10 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation
|
||||
ball.setZ(0, batSprite.z + 1)
|
||||
@ballSpriteIndex = (@success) ? @tempSprites.length - 1 : -1
|
||||
# Set up trainer sprite (only visible in Safari Zone battles)
|
||||
if @showingTrainer && traSprite
|
||||
if traSprite.bitmap.width >= traSprite.bitmap.height * 2
|
||||
trainer = addSprite(traSprite, PictureOrigin::Bottom)
|
||||
# Trainer animation
|
||||
ballStartX, ballStartY = trainerThrowingFrames(ball, trainer, traSprite)
|
||||
end
|
||||
if @showingTrainer && traSprite && traSprite.bitmap.width >= traSprite.bitmap.height * 2
|
||||
trainer = addSprite(traSprite, PictureOrigin::Bottom)
|
||||
# Trainer animation
|
||||
ballStartX, ballStartY = trainerThrowingFrames(ball, trainer, traSprite)
|
||||
end
|
||||
delay = ball.totalDuration # 0 or 7
|
||||
# Poké Ball arc animation
|
||||
|
||||
Reference in New Issue
Block a user