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

@@ -129,18 +129,18 @@ DebugMenuCommands.register("togglewallpapers", {
paperscmds = []
paperscmds.push(_INTL("Unlock all"))
paperscmds.push(_INTL("Lock all"))
for i in PokemonStorage::BASICWALLPAPERQTY...w.length
(PokemonStorage::BASICWALLPAPERQTY...w.length).each do |i|
paperscmds.push(_INTL("{1} {2}", unlockarray[i] ? "[Y]" : "[ ]", w[i]))
end
paperscmd = pbShowCommands(nil, paperscmds, -1, paperscmd)
break if paperscmd < 0
case paperscmd
when 0 # Unlock all
for i in PokemonStorage::BASICWALLPAPERQTY...w.length
(PokemonStorage::BASICWALLPAPERQTY...w.length).each do |i|
unlockarray[i] = true
end
when 1 # Lock all
for i in PokemonStorage::BASICWALLPAPERQTY...w.length
(PokemonStorage::BASICWALLPAPERQTY...w.length).each do |i|
unlockarray[i] = false
end
else
@@ -406,7 +406,7 @@ DebugMenuCommands.register("resettrainers", {
"description" => _INTL("Turn off Self Switches A and B for all events with \"Trainer\" in their name."),
"effect" => proc {
if $game_map
for event in $game_map.events.values
$game_map.events.values.each do |event|
if event.name[/trainer/i]
$game_self_switches[[$game_map.map_id, event.id, "A"]] = false
$game_self_switches[[$game_map.map_id, event.id, "B"]] = false
@@ -428,7 +428,7 @@ DebugMenuCommands.register("readyrematches", {
if !$PokemonGlobal.phoneNumbers || $PokemonGlobal.phoneNumbers.length == 0
pbMessage(_INTL("There are no trainers in the Phone."))
else
for i in $PokemonGlobal.phoneNumbers
$PokemonGlobal.phoneNumbers.each do |i|
next if i.length != 8 # Isn't a trainer with an event
i[4] = 2
pbSetReadyToBattle(i)
@@ -566,7 +566,7 @@ DebugMenuCommands.register("demoparty", {
"effect" => proc {
party = []
species = [:PIKACHU, :PIDGEOTTO, :KADABRA, :GYARADOS, :DIGLETT, :CHANSEY]
for id in species
species.each do |id|
party.push(id) if GameData::Species.exists?(id)
end
$player.party.clear
@@ -674,8 +674,8 @@ DebugMenuCommands.register("clearboxes", {
"name" => _INTL("Clear Storage Boxes"),
"description" => _INTL("Remove all Pokémon in storage."),
"effect" => proc {
for i in 0...$PokemonStorage.maxBoxes
for j in 0...$PokemonStorage.maxPokemon(i)
$PokemonStorage.maxBoxes.times do |i|
$PokemonStorage.maxPokemon(i).times do |j|
$PokemonStorage[i, j] = nil
end
end
@@ -715,7 +715,7 @@ DebugMenuCommands.register("setbadges", {
badgecmds = []
badgecmds.push(_INTL("Give all"))
badgecmds.push(_INTL("Remove all"))
for i in 0...24
24.times do |i|
badgecmds.push(_INTL("{1} Badge {2}", $player.badges[i] ? "[Y]" : "[ ]", i + 1))
end
badgecmd = pbShowCommands(nil, badgecmds, -1, badgecmd)
@@ -803,7 +803,7 @@ DebugMenuCommands.register("dexlists", {
dexescmds = []
dexescmds.push(_INTL("Have Pokédex: {1}", $player.has_pokedex ? "[YES]" : "[NO]"))
dex_names = Settings.pokedex_names
for i in 0...dex_names.length
dex_names.length.times do |i|
name = (dex_names[i].is_a?(Array)) ? dex_names[i][0] : dex_names[i]
unlocked = $player.pokedex.unlocked?(i)
dexescmds.push(_INTL("{1} {2}", unlocked ? "[Y]" : "[ ]", name))

View File

@@ -20,7 +20,7 @@ def pbWarpToMap
y = rand(map.height)
next if !map.passableStrict?(x, y, 0, $game_player)
blocked = false
for event in map.events.values
map.events.values.each do |event|
if event.at_coordinate?(x, y) && !event.through
blocked = true if event.character_name != ""
end
@@ -509,7 +509,7 @@ def pbDebugRoamers
pbPlayBuzzerSE
else
pbPlayDecisionSE
for i in 0...Settings::ROAMING_SPECIES.length
Settings::ROAMING_SPECIES.length.times do |i|
$PokemonGlobal.roamPosition[i] = nil
end
$PokemonGlobal.roamedAlready = false
@@ -564,7 +564,7 @@ def pbExportAllAnimations
animations = pbLoadBattleAnimations
if animations
msgwindow = pbCreateMessageWindow
for anim in animations
animations.each do |anim|
next if !anim || anim.length == 0 || anim.name == ""
pbMessageDisplay(msgwindow, anim.name, false)
Graphics.update
@@ -577,7 +577,7 @@ def pbExportAllAnimations
graphicname = RTP.getImagePath("Graphics/Animations/" + anim.graphic)
pbSafeCopyFile(graphicname, "Animations/#{safename}/" + File.basename(graphicname))
end
for timing in anim.timing
anim.timing.each do |timing|
if !timing.timingType || timing.timingType == 0
if timing.name && timing.name != ""
audioName = RTP.getAudioPath("Audio/SE/Anim/" + timing.name)
@@ -618,7 +618,7 @@ def pbImportAllAnimations
msgwindow = pbCreateMessageWindow
animations = pbLoadBattleAnimations
animations = PBAnimations.new if !animations
for folder in animationFolders
animationFolders.each do |folder|
pbMessageDisplay(msgwindow, folder, false)
Graphics.update
audios = []
@@ -628,7 +628,7 @@ def pbImportAllAnimations
audios.concat(files.find_all { |f| f[f.length - 3, 3] == ext })
audios.concat(files.find_all { |f| f[f.length - 3, 3] == upext })
}
for audio in audios
audios.each do |audio|
pbSafeCopyFile(audio, RTP.getAudioPath("Audio/SE/Anim/" + File.basename(audio)), "Audio/SE/Anim/" + File.basename(audio))
end
images = []
@@ -637,7 +637,7 @@ def pbImportAllAnimations
images.concat(files.find_all { |f| f[f.length - 3, 3] == ext })
images.concat(files.find_all { |f| f[f.length - 3, 3] == upext })
}
for image in images
images.each do |image|
pbSafeCopyFile(image, RTP.getImagePath("Graphics/Animations/" + File.basename(image)), "Graphics/Animations/" + File.basename(image))
end
Dir.glob(folder + "/*.anm") { |f|
@@ -655,7 +655,7 @@ def pbImportAllAnimations
missingFiles.push(textdata.graphic)
end
end
for timing in textdata.timing
textdata.timing.each do |timing|
if timing.name && timing.name != ""
if !safeExists?(folder + "/" + timing.name) &&
!FileTest.audio_exist?("Audio/SE/Anim/" + timing.name)
@@ -687,7 +687,7 @@ def pbDebugFixInvalidTiles
Graphics.update
total_maps = mapData.mapinfos.keys.length
Console.echo_h1 _INTL("Checking {1} maps for invalid tiles", total_maps)
for id in mapData.mapinfos.keys.sort
mapData.mapinfos.keys.sort.each do |id|
if Time.now.to_i - t >= 5
Graphics.update
t = Time.now.to_i
@@ -697,9 +697,9 @@ def pbDebugFixInvalidTiles
next if !map || !mapData.mapinfos[id]
passages = mapData.getTilesetPassages(map, id)
# Check all tiles in map for non-existent tiles
for x in 0...map.data.xsize
for y in 0...map.data.ysize
for i in 0...map.data.zsize
map.data.xsize.times do |x|
map.data.ysize.times do |y|
map.data.zsize.times do |i|
tile_id = map.data[x, y, i]
next if pbCheckTileValidity(tile_id, map, tilesets, passages)
map.data[x, y, i] = 0
@@ -708,9 +708,9 @@ def pbDebugFixInvalidTiles
end
end
# Check all events in map for page graphics using a non-existent tile
for key in map.events.keys
map.events.keys.each do |key|
event = map.events[key]
for page in event.pages
event.pages.each do |page|
next if page.graphic.tile_id <= 0
next if pbCheckTileValidity(page.graphic.tile_id, map, tilesets, passages)
page.graphic.tile_id = 0
@@ -864,7 +864,7 @@ class PokemonDebugPartyScreen
def pbChooseMove(pkmn, text, index = 0)
moveNames = []
for i in pkmn.moves
pkmn.moves.each do |i|
if i.total_pp <= 0
moveNames.push(_INTL("{1} (PP: ---)", i.name))
else

View File

@@ -565,7 +565,7 @@ PokemonDebugMenuCommands.register("setmovepp", {
cmd = 0
loop do
commands = []
for i in pkmn.moves
pkmn.moves.each do |i|
break if !i.id
if i.total_pp <= 0
commands.push(_INTL("{1} (PP: ---)", i.name))
@@ -698,7 +698,7 @@ PokemonDebugMenuCommands.register("setability", {
abils = pkmn.getAbilityList
ability_commands = []
abil_cmd = 0
for i in abils
abils.each do |i|
ability_commands.push(((i[1] < 2) ? "" : "(H) ") + GameData::Ability.get(i[0]).name)
abil_cmd = ability_commands.length - 1 if pkmn.ability_id == i[0]
end
@@ -917,8 +917,8 @@ PokemonDebugMenuCommands.register("setpokeball", {
end
balls.sort! { |a, b| a[1] <=> b[1] }
cmd = 0
for i in 0...balls.length
next if balls[i][0] != pkmn.poke_ball
balls.each_with_index do |ball, i|
next if ball[0] != pkmn.poke_ball
cmd = i
break
end

View File

@@ -7,8 +7,8 @@ module FilenameUpdater
def readDirectoryFiles(directory, formats)
files = []
Dir.chdir(directory) {
for i in 0...formats.length
Dir.glob(formats[i]) { |f| files.push(f) }
formats.each do |format|
Dir.glob(format) { |f| files.push(f) }
end
}
return files
@@ -40,14 +40,14 @@ module FilenameUpdater
Graphics.update
Console.echo_li _INTL("Checking {1} maps for used berry tree charsets...", mapData.mapinfos.keys.length)
idx = 0
for id in mapData.mapinfos.keys.sort
mapData.mapinfos.keys.sort.each do |id|
echo "." if idx % 20 == 0
idx += 1
Graphics.update if idx % 250 == 0
map = mapData.getMap(id)
next if !map || !mapData.mapinfos[id]
changed = false
for key in map.events.keys
map.events.keys.each do |key|
if Time.now.to_i - t >= 5
Graphics.update
t = Time.now.to_i

View File

@@ -385,7 +385,7 @@ BattlerDebugMenuCommands.register("settypes", {
loop do
commands = []
types = []
(0...max_main_types).each do |i|
max_main_types.times do |i|
type = battler.types[i]
type_name = (type) ? GameData::Type.get(type).name : "-"
commands.push(_INTL("Type {1}: {2}", i + 1, type_name))