More Rubocopping

This commit is contained in:
Maruno17
2021-12-20 17:18:21 +00:00
parent db4acd3369
commit 33fcbf623b
154 changed files with 1388 additions and 1420 deletions

View File

@@ -37,9 +37,9 @@ end
def drawSpot(bitmap, spotpattern, x, y, red, green, blue)
height = spotpattern.length
width = spotpattern[0].length
for yy in 0...height
height.times do |yy|
spot = spotpattern[yy]
for xx in 0...width
width.times do |xx|
if spot[xx] == 1
xOrg = (x + xx) << 1
yOrg = (y + yy) << 1
@@ -297,7 +297,7 @@ MultipleForms.register(:ARCEUS, {
}
ret = 0
typeArray.each do |f, items|
for item in items
items.each do |item|
next if !pkmn.hasItem?(item)
ret = f
break
@@ -502,7 +502,7 @@ MultipleForms.register(:SILVALLY, {
}
ret = 0
typeArray.each do |f, items|
for item in items
items.each do |item|
next if !pkmn.hasItem?(item)
ret = f
break
@@ -539,8 +539,8 @@ MultipleForms.register(:NECROZMA, {
"onSetForm" => proc { |pkmn, form, oldForm|
next if form > 2 || oldForm > 2 # Ultra form changes don't affect moveset
form_moves = [
:SUNSTEELSTRIKE, # Dusk Mane (with Solgaleo) (form 1)
:MOONGEISTBEAM # Dawn Wings (with Lunala) (form 2)
:SUNSTEELSTRIKE, # Dusk Mane (with Solgaleo) (form 1)
:MOONGEISTBEAM # Dawn Wings (with Lunala) (form 2)
]
if form == 0
# Turned back into the base form; forget form-specific moves

View File

@@ -372,7 +372,7 @@ end
#===============================================================================
class Battle::Move::RemoveAllScreens < Battle::Move
def pbEffectGeneral(user)
for i in @battle.sides
@battle.sides.each do |i|
i.effects[PBEffects::AuroraVeil] = 0
i.effects[PBEffects::Reflect] = 0
i.effects[PBEffects::LightScreen] = 0

View File

@@ -8,12 +8,10 @@ class PokemonBox
BOX_SIZE = BOX_WIDTH * BOX_HEIGHT
def initialize(name, maxPokemon = BOX_SIZE)
@pokemon = []
@name = name
@background = 0
for i in 0...maxPokemon
@pokemon[i] = nil
end
@pokemon = []
maxPokemon.times { |i| @pokemon[i] = nil }
end
def length
@@ -62,14 +60,14 @@ class PokemonStorage
def initialize(maxBoxes = Settings::NUM_STORAGE_BOXES, maxPokemon = PokemonBox::BOX_SIZE)
@boxes = []
for i in 0...maxBoxes
maxBoxes.times do |i|
@boxes[i] = PokemonBox.new(_INTL("Box {1}", i + 1), maxPokemon)
@boxes[i].background = i % BASICWALLPAPERQTY
end
@currentBox = 0
@boxmode = -1
@unlockedWallpapers = []
for i in 0...allWallpapers.length
allWallpapers.length.times do |i|
@unlockedWallpapers[i] = false
end
end
@@ -107,7 +105,7 @@ class PokemonStorage
ret = [[], []] # Names, IDs
papers = allWallpapers
@unlockedWallpapers = [] if !@unlockedWallpapers
for i in 0...papers.length
papers.length.times do |i|
next if !isAvailableWallpaper?(i)
ret[0].push(papers[i])
ret[1].push(i)
@@ -137,7 +135,7 @@ class PokemonStorage
end
def full?
for i in 0...self.maxBoxes
self.maxBoxes.times do |i|
return false if !@boxes[i].full?
end
return true
@@ -148,7 +146,7 @@ class PokemonStorage
ret = self.party.length
return (ret >= Settings::MAX_PARTY_SIZE) ? -1 : ret
end
for i in 0...maxPokemon(box)
maxPokemon(box).times do |i|
return i if !self[box, i]
end
return -1
@@ -158,7 +156,7 @@ class PokemonStorage
if y == nil
return (x == -1) ? self.party : @boxes[x]
else
for i in @boxes
@boxes.each do |i|
raise "Box is a Pokémon, not a box" if i.is_a?(Pokemon)
end
return (x == -1) ? self.party[y] : @boxes[x][y]
@@ -176,7 +174,7 @@ class PokemonStorage
def pbCopy(boxDst, indexDst, boxSrc, indexSrc)
if indexDst < 0 && boxDst < self.maxBoxes
found = false
for i in 0...maxPokemon(boxDst)
maxPokemon(boxDst).times do |i|
next if self[boxDst, i]
found = true
indexDst = i
@@ -213,7 +211,7 @@ class PokemonStorage
end
def pbMoveCaughtToBox(pkmn, box)
for i in 0...maxPokemon(box)
maxPokemon(box).times do |i|
if self[box, i] == nil
if Settings::HEAL_STORED_POKEMON && box >= 0
old_ready_evo = pkmn.ready_to_evolve
@@ -233,14 +231,14 @@ class PokemonStorage
pkmn.heal
pkmn.ready_to_evolve = old_ready_evo
end
for i in 0...maxPokemon(@currentBox)
maxPokemon(@currentBox).times do |i|
if self[@currentBox, i] == nil
self[@currentBox, i] = pkmn
return @currentBox
end
end
for j in 0...self.maxBoxes
for i in 0...maxPokemon(j)
self.maxBoxes.times do |j|
maxPokemon(j).times do |i|
if self[j, i] == nil
self[j, i] = pkmn
@currentBox = j
@@ -259,9 +257,7 @@ class PokemonStorage
end
def clear
for i in 0...self.maxBoxes
@boxes[i].clear
end
self.maxBoxes.times { |i| @boxes[i].clear }
end
end
@@ -393,8 +389,8 @@ end
#===============================================================================
# Yields every Pokémon/egg in storage in turn.
def pbEachPokemon
for i in -1...$PokemonStorage.maxBoxes
for j in 0...$PokemonStorage.maxPokemon(i)
(-1...$PokemonStorage.maxBoxes).each do |i|
$PokemonStorage.maxPokemon(i).times do |j|
pkmn = $PokemonStorage[i][j]
yield(pkmn, i) if pkmn
end

View File

@@ -631,7 +631,7 @@ class Pokemon
@moves.clear
first_move_index = knowable_moves.length - MAX_MOVES
first_move_index = 0 if first_move_index < 0
for i in first_move_index...knowable_moves.length
(first_move_index...knowable_moves.length).each do |i|
@moves.push(Pokemon::Move.new(knowable_moves[i]))
end
end
@@ -744,7 +744,7 @@ class Pokemon
args.each_with_index do |ribbon, i|
this_ribbon_data = GameData::Ribbon.try_get(ribbon)
next if !this_ribbon_data
for j in 0...@ribbons.length
@ribbons.length.times do |j|
next if @ribbons[j] != this_ribbon_data.id
next_ribbon_data = GameData::Ribbon.try_get(args[i + 1])
next if !next_ribbon_data