mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 13:44:59 +00:00
Many more Rubocop-inspired code improvements
This commit is contained in:
@@ -200,7 +200,7 @@ class Battle::Scene
|
||||
# Start Bag screen
|
||||
itemScene = PokemonBag_Scene.new
|
||||
itemScene.pbStartScene($bag, true,
|
||||
Proc.new { |item|
|
||||
proc { |item|
|
||||
useType = GameData::Item.get(item).battle_use
|
||||
next useType && useType > 0
|
||||
}, false)
|
||||
@@ -368,7 +368,7 @@ class Battle::Scene
|
||||
when :Foe, :Other
|
||||
indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)
|
||||
indices.each { |i| return i if !@battle.battlers[i].fainted? }
|
||||
indices.each { |i| return i }
|
||||
return indices.first if !indices.empty?
|
||||
end
|
||||
return idxBattler # Target the user initially
|
||||
end
|
||||
@@ -391,7 +391,7 @@ class Battle::Scene
|
||||
# Update selected command
|
||||
if mode == 0 # Choosing just one target, can change index
|
||||
if Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT)
|
||||
inc = ((cw.index % 2) == 0) ? -2 : 2
|
||||
inc = (cw.index.even?) ? -2 : 2
|
||||
inc *= -1 if Input.trigger?(Input::RIGHT)
|
||||
indexLength = @battle.sideSizes[cw.index % 2] * 2
|
||||
newIndex = cw.index
|
||||
@@ -402,8 +402,8 @@ class Battle::Scene
|
||||
cw.index = newIndex
|
||||
break
|
||||
end
|
||||
elsif (Input.trigger?(Input::UP) && (cw.index % 2) == 0) ||
|
||||
(Input.trigger?(Input::DOWN) && (cw.index % 2) == 1)
|
||||
elsif (Input.trigger?(Input::UP) && cw.index.even?) ||
|
||||
(Input.trigger?(Input::DOWN) && cw.index.odd?)
|
||||
tryIndex = @battle.pbGetOpposingIndicesInOrder(cw.index)
|
||||
tryIndex.each do |idxBattlerTry|
|
||||
next if texts[idxBattlerTry].nil?
|
||||
|
||||
@@ -479,7 +479,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase
|
||||
# NOTE: Battler indexes go from left to right from the perspective of
|
||||
# that side's trainer, so inc is different for each side for the
|
||||
# same value of i/2.
|
||||
inc = ((i % 2) == 0) ? i / 2 : numButtons - 1 - i / 2
|
||||
inc = (i.even?) ? i / 2 : numButtons - 1 - i / 2
|
||||
button = SpriteWrapper.new(viewport)
|
||||
button.bitmap = @buttonBitmap.bitmap
|
||||
button.src_rect.width = (@smallButtons) ? CMD_BUTTON_WIDTH_SMALL : @buttonBitmap.width / 2
|
||||
@@ -530,7 +530,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase
|
||||
if @texts[i]
|
||||
sel ||= (@mode == 0 && i == @index)
|
||||
sel ||= (@mode == 1)
|
||||
buttonType = ((i % 2) == 0) ? 1 : 2
|
||||
buttonType = (i.even?) ? 1 : 2
|
||||
end
|
||||
buttonType = 2 * buttonType + ((@smallButtons) ? 1 : 0)
|
||||
button.src_rect.x = (sel) ? @buttonBitmap.width / 2 : 0
|
||||
|
||||
@@ -39,7 +39,7 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
|
||||
end
|
||||
|
||||
def initializeDataBoxGraphic(sideSize)
|
||||
onPlayerSide = ((@battler.index % 2) == 0)
|
||||
onPlayerSide = @battler.index.even?
|
||||
# Get the data box graphic and set whether the HP numbers/Exp bar are shown
|
||||
if sideSize == 1 # One Pokémon on side, use the regular dara box BG
|
||||
bgFilename = ["Graphics/Pictures/Battle/databox_normal",
|
||||
@@ -537,7 +537,7 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
|
||||
def pbSetPosition
|
||||
return if !@_iconBitmap
|
||||
pbSetOrigin
|
||||
if (@index % 2) == 0
|
||||
if @index.even?
|
||||
self.z = 50 + 5 * @index / 2
|
||||
else
|
||||
self.z = 50 - 5 * (@index + 1) / 2
|
||||
|
||||
@@ -34,7 +34,7 @@ class Battle::Scene::Animation::Intro < Battle::Scene::Animation
|
||||
end
|
||||
# Shadows
|
||||
for i in 0...@battle.battlers.length
|
||||
makeSlideSprite("shadow_#{i}", ((i % 2) == 0) ? 1 : -1, appearTime, PictureOrigin::Center)
|
||||
makeSlideSprite("shadow_#{i}", (i.even?) ? 1 : -1, appearTime, PictureOrigin::Center)
|
||||
end
|
||||
# Fading blackness over whole screen
|
||||
blackScreen = addNewSprite(0, 0, "Graphics/Battle animations/black_screen")
|
||||
@@ -196,7 +196,7 @@ class Battle::Scene::Animation::DataBoxAppear < Battle::Scene::Animation
|
||||
return if !@sprites["dataBox_#{@idxBox}"]
|
||||
box = addSprite(@sprites["dataBox_#{@idxBox}"])
|
||||
box.setVisible(0, true)
|
||||
dir = ((@idxBox % 2) == 0) ? 1 : -1
|
||||
dir = (@idxBox.even?) ? 1 : -1
|
||||
box.setDelta(0, dir * Graphics.width / 2, 0)
|
||||
box.moveDelta(0, 8, -dir * Graphics.width / 2, 0)
|
||||
end
|
||||
@@ -216,7 +216,7 @@ class Battle::Scene::Animation::DataBoxDisappear < Battle::Scene::Animation
|
||||
def createProcesses
|
||||
return if !@sprites["dataBox_#{@idxBox}"] || !@sprites["dataBox_#{@idxBox}"].visible
|
||||
box = addSprite(@sprites["dataBox_#{@idxBox}"])
|
||||
dir = ((@idxBox % 2) == 0) ? 1 : -1
|
||||
dir = (@idxBox.even?) ? 1 : -1
|
||||
box.moveDelta(0, 8, dir * Graphics.width / 2, 0)
|
||||
box.setVisible(8, false)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user