mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-11 15:15:00 +00:00
More Rubocopping
This commit is contained in:
@@ -381,7 +381,7 @@ class Battle::Scene
|
||||
#=============================================================================
|
||||
def pbSelectBattler(idxBattler, selectMode = 1)
|
||||
numWindows = @battle.sideSizes.max * 2
|
||||
for i in 0...numWindows
|
||||
numWindows.times do |i|
|
||||
sel = (idxBattler.is_a?(Array)) ? !idxBattler[i].nil? : i == idxBattler
|
||||
selVal = (sel) ? selectMode : 0
|
||||
@sprites["dataBox_#{i}"].selected = selVal if @sprites["dataBox_#{i}"]
|
||||
|
||||
@@ -48,13 +48,13 @@ class Battle::Scene
|
||||
@sprites["targetWindow"] = TargetMenu.new(@viewport, 200, @battle.sideSizes)
|
||||
pbShowWindow(MESSAGE_BOX)
|
||||
# The party lineup graphics (bar and balls) for both sides
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
partyBar = pbAddSprite("partyBar_#{side}", 0, 0,
|
||||
"Graphics/Pictures/Battle/overlay_lineup", @viewport)
|
||||
partyBar.z = 120
|
||||
partyBar.mirror = true if side == 0 # Player's lineup bar only
|
||||
partyBar.visible = false
|
||||
for i in 0...NUM_BALLS
|
||||
NUM_BALLS.times do |i|
|
||||
ball = pbAddSprite("partyBall_#{side}_#{i}", 0, 0, nil, @viewport)
|
||||
ball.z = 121
|
||||
ball.visible = false
|
||||
@@ -137,7 +137,7 @@ class Battle::Scene
|
||||
bg = pbAddSprite("battle_bg2", -Graphics.width, 0, battleBG, @viewport)
|
||||
bg.z = 0
|
||||
bg.mirror = true
|
||||
for side in 0...2
|
||||
2.times do |side|
|
||||
baseX, baseY = Battle::Scene.pbBattlerPosition(side)
|
||||
base = pbAddSprite("base_#{side}", baseX, baseY,
|
||||
(side == 0) ? playerBase : enemyBase, @viewport)
|
||||
|
||||
@@ -27,7 +27,7 @@ class Battle::Scene
|
||||
# data box(es), return the wild Pokémon's sprite(s) to normal colour, show
|
||||
# shiny animation(s)
|
||||
# Set up data box animation
|
||||
for i in 0...@battle.sideSizes[1]
|
||||
@battle.sideSizes[1].times do |i|
|
||||
idxBattler = (2 * i) + 1
|
||||
next if !@battle.battlers[idxBattler]
|
||||
dataBoxAnim = Animation::DataBoxAppear.new(@sprites, @viewport, idxBattler)
|
||||
@@ -42,7 +42,7 @@ class Battle::Scene
|
||||
end
|
||||
# Show shiny animation for wild Pokémon
|
||||
if @battle.showAnims
|
||||
for i in 0...@battle.sideSizes[1]
|
||||
@battle.sideSizes[1].times do |i|
|
||||
idxBattler = (2 * i) + 1
|
||||
next if !@battle.battlers[idxBattler] || !@battle.battlers[idxBattler].shiny?
|
||||
if Settings::SUPER_SHINY && @battle.battlers[idxBattler].super_shiny?
|
||||
@@ -400,7 +400,7 @@ class Battle::Scene
|
||||
# Yield to other code, i.e. playing an animation
|
||||
yield
|
||||
# Restore shadow visibility
|
||||
for i in 0...@battle.battlers.length
|
||||
@battle.battlers.length.times do |i|
|
||||
shadow = @sprites["shadow_#{i}"]
|
||||
shadow.visible = shadows[i] if shadow
|
||||
end
|
||||
|
||||
@@ -38,21 +38,21 @@ class Battle::Scene::MenuBase
|
||||
|
||||
def z=(value)
|
||||
@z = value
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].z = value if !i[1].disposed?
|
||||
end
|
||||
end
|
||||
|
||||
def visible=(value)
|
||||
@visible = value
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].visible = (value && @visibility[i[0]]) if !i[1].disposed?
|
||||
end
|
||||
end
|
||||
|
||||
def color=(value)
|
||||
@color = value
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].color = value if !i[1].disposed?
|
||||
end
|
||||
end
|
||||
@@ -174,7 +174,7 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase
|
||||
@msgBox.text = value[0]
|
||||
return if USE_GRAPHICS
|
||||
commands = []
|
||||
for i in 1..4
|
||||
(1..4).each do |i|
|
||||
commands.push(value[i]) if value[i] && value[i] != nil
|
||||
end
|
||||
@cmdWindow.commands = commands
|
||||
@@ -182,8 +182,7 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase
|
||||
|
||||
def refreshButtons
|
||||
return if !USE_GRAPHICS
|
||||
for i in 0...@buttons.length
|
||||
button = @buttons[i]
|
||||
@buttons.each_with_index do |button, i|
|
||||
button.src_rect.x = (i == @index) ? @buttonBitmap.width / 2 : 0
|
||||
button.src_rect.y = MODES[@mode][i] * BUTTON_HEIGHT
|
||||
button.z = self.z + ((i == @index) ? 3 : 2)
|
||||
@@ -343,7 +342,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
|
||||
if !USE_GRAPHICS
|
||||
# Fill in command window
|
||||
commands = []
|
||||
for i in 0...[4, moves.length].max
|
||||
[4, moves.length].max.times do |i|
|
||||
commands.push((moves[i]) ? moves[i].name : "-")
|
||||
end
|
||||
@cmdWindow.commands = commands
|
||||
|
||||
@@ -133,14 +133,14 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
|
||||
def opacity=(value)
|
||||
super
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].opacity = value if !i[1].disposed?
|
||||
end
|
||||
end
|
||||
|
||||
def visible=(value)
|
||||
super
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].visible = value if !i[1].disposed?
|
||||
end
|
||||
@expBar.visible = (value && @showExp)
|
||||
@@ -148,7 +148,7 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
|
||||
def color=(value)
|
||||
super
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].color = value if !i[1].disposed?
|
||||
end
|
||||
end
|
||||
@@ -335,7 +335,7 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
@expFlash = Graphics.frame_rate / 5
|
||||
pbSEPlay("Pkmn exp full")
|
||||
self.flash(Color.new(64, 200, 248, 192), @expFlash)
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].flash(Color.new(64, 200, 248, 192), @expFlash) if !i[1].disposed?
|
||||
end
|
||||
else
|
||||
|
||||
@@ -169,7 +169,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
a = (2 * startY) - (4 * midY) + (2 * endY)
|
||||
b = (4 * midY) - (3 * startY) - endY
|
||||
c = startY
|
||||
for i in 1..duration
|
||||
(1..duration).each do |i|
|
||||
t = i.to_f / duration # t ranges from 0 to 1
|
||||
x = startX + ((endX - startX) * t) # Linear in t
|
||||
y = (a * (t**2)) + (b * t) + c # Quadratic in t
|
||||
@@ -188,7 +188,7 @@ module Battle::Scene::Animation::BallAnimationMixin
|
||||
end
|
||||
if numFrames > 1
|
||||
curFrame = 0
|
||||
for i in 1..duration
|
||||
(1..duration).each do |i|
|
||||
thisFrame = numFrames * numTumbles * i / duration
|
||||
if thisFrame > curFrame
|
||||
curFrame = thisFrame
|
||||
|
||||
@@ -33,7 +33,7 @@ class Battle::Scene::Animation::Intro < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
# Shadows
|
||||
for i in 0...@battle.battlers.length
|
||||
@battle.battlers.length.times do |i|
|
||||
makeSlideSprite("shadow_#{i}", (i.even?) ? 1 : -1, appearTime, PictureOrigin::Center)
|
||||
end
|
||||
# Fading blackness over whole screen
|
||||
@@ -70,7 +70,7 @@ class Battle::Scene::Animation::Intro2 < Battle::Scene::Animation
|
||||
end
|
||||
|
||||
def createProcesses
|
||||
for i in 0...@sideSize
|
||||
@sideSize.times do |i|
|
||||
idxBattler = (2 * i) + 1
|
||||
next if !@sprites["pokemon_#{idxBattler}"]
|
||||
battler = addSprite(@sprites["pokemon_#{idxBattler}"], PictureOrigin::Bottom)
|
||||
@@ -117,7 +117,7 @@ class Battle::Scene::Animation::LineupAppear < Battle::Scene::Animation
|
||||
bar.y = barY
|
||||
bar.opacity = 255
|
||||
bar.visible = false
|
||||
for i in 0...Battle::Scene::NUM_BALLS
|
||||
Battle::Scene::NUM_BALLS.times do |i|
|
||||
ball = sprites["partyBall_#{@side}_#{i}"]
|
||||
ball.x = ballX
|
||||
ball.y = ballY
|
||||
@@ -154,7 +154,7 @@ class Battle::Scene::Animation::LineupAppear < Battle::Scene::Animation
|
||||
bar.setDelta(0, dir * Graphics.width / 2, 0)
|
||||
bar.moveDelta(0, 8, -dir * Graphics.width / 2, 0)
|
||||
delay = bar.totalDuration
|
||||
for i in 0...Battle::Scene::NUM_BALLS
|
||||
Battle::Scene::NUM_BALLS.times do |i|
|
||||
createBall(i, (@fullAnim) ? delay + (i * 2) : 0, dir)
|
||||
end
|
||||
end
|
||||
@@ -339,7 +339,7 @@ class Battle::Scene::Animation::PlayerFade < Battle::Scene::Animation
|
||||
partyBar.setVisible(delay + 12, false)
|
||||
partyBar.setOpacity(delay + 12, 255)
|
||||
end
|
||||
for i in 0...Battle::Scene::NUM_BALLS
|
||||
Battle::Scene::NUM_BALLS.times do |i|
|
||||
next if !@sprites["partyBall_0_#{i}"] || !@sprites["partyBall_0_#{i}"].visible
|
||||
partyBall = addSprite(@sprites["partyBall_0_#{i}"])
|
||||
partyBall.moveDelta(delay + (2 * i), 16, -Graphics.width, 0) if @fullAnim
|
||||
@@ -384,7 +384,7 @@ class Battle::Scene::Animation::TrainerFade < Battle::Scene::Animation
|
||||
partyBar.setVisible(delay + 12, false)
|
||||
partyBar.setOpacity(delay + 12, 255)
|
||||
end
|
||||
for i in 0...Battle::Scene::NUM_BALLS
|
||||
Battle::Scene::NUM_BALLS.times do |i|
|
||||
next if !@sprites["partyBall_1_#{i}"] || !@sprites["partyBall_1_#{i}"].visible
|
||||
partyBall = addSprite(@sprites["partyBall_1_#{i}"])
|
||||
partyBall.moveDelta(delay + (2 * i), 16, Graphics.width, 0) if @fullAnim
|
||||
@@ -777,7 +777,7 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation
|
||||
delay = ball.totalDuration + 3
|
||||
end
|
||||
# Poké Ball drops to the ground
|
||||
for i in 0...4
|
||||
4.times do |i|
|
||||
t = [4, 4, 3, 2][i] # Time taken to rise or fall for each bounce
|
||||
d = [1, 2, 4, 8][i] # Fraction of the starting height each bounce rises to
|
||||
delay -= t if i == 0
|
||||
@@ -793,7 +793,7 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation
|
||||
battler.setXY(ball.totalDuration, ballEndX, ballGroundY)
|
||||
# Poké Ball shakes
|
||||
delay = ball.totalDuration + 12
|
||||
for i in 0...[@numShakes, 3].min
|
||||
[@numShakes, 3].min.times do |i|
|
||||
ball.setSE(delay, "Battle ball shake")
|
||||
ball.moveXY(delay, 2, ballEndX - (2 * (4 - i)), ballGroundY)
|
||||
ball.moveAngle(delay, 2, 5 * (4 - i)) # positive means counterclockwise
|
||||
|
||||
Reference in New Issue
Block a user