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

@@ -66,7 +66,7 @@ end
def setBattleRule(*args)
r = nil
for arg in args
args.each do |arg|
if r
$game_temp.add_battle_rule(r, arg)
r = nil
@@ -234,7 +234,7 @@ def pbWildBattleCore(*args)
# Generate wild Pokémon based on the species and level
foeParty = []
sp = nil
for arg in args
args.each do |arg|
if arg.is_a?(Pokemon)
foeParty.push(arg)
elsif arg.is_a?(Array)
@@ -382,7 +382,7 @@ def pbTrainerBattleCore(*args)
foeEndSpeeches = []
foeParty = []
foePartyStarts = []
for arg in args
args.each do |arg|
case arg
when NPCTrainer
foeTrainers.push(arg)
@@ -483,7 +483,7 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech = nil,
# Find all other triggered trainer events
triggeredEvents = $game_player.pbTriggeredTrainerEvents([2], false)
otherEvent = []
for i in triggeredEvents
triggeredEvents.each do |i|
next if i.id == thisEvent.id
next if $game_self_switches[[$game_map.map_id, i.id, "A"]]
otherEvent.push(i)
@@ -632,9 +632,7 @@ end
def pbDynamicItemList(*args)
ret = []
for i in 0...args.length
ret.push(args[i]) if GameData::Item.exists?(args[i])
end
args.each { |arg| ret.push(arg) if GameData::Item.exists?(arg) }
return ret
end
@@ -685,10 +683,10 @@ def pbPickup(pkmn)
pkmnLevel = [100, pkmn.level].min
itemStartIndex = (pkmnLevel - 1) / 10
itemStartIndex = 0 if itemStartIndex < 0
for i in 0...9
9.times do |i|
items.push(pickupList[itemStartIndex + i])
end
for i in 0...2
2.times do |i|
items.push(pickupListRare[itemStartIndex + i])
end
# Probabilities of choosing each item in turn from the pool

View File

@@ -109,7 +109,7 @@ def pbBattleAnimation(bgm = nil, battletype = 0, foe = nil)
alphaDiff = (255.0 / halfFlashTime).ceil
2.times do
viewport.color.alpha = 0
for i in 0...halfFlashTime * 2
(halfFlashTime * 2).times do |i|
if i < halfFlashTime
viewport.color.alpha += alphaDiff
else
@@ -238,7 +238,7 @@ SpecialBattleIntroAnimations.register("vs_animation", 50, # Priority 50
flash.opacity = 0
# Animate bars sliding in from either side
slideInTime = (Graphics.frame_rate * 0.25).floor
for i in 0...slideInTime
slideInTime.times do |i|
bar1.x = xoffset * (i + 1 - slideInTime) / slideInTime
bar2.x = xoffset * (slideInTime - i - 1) / slideInTime
pbWait(1)
@@ -263,7 +263,7 @@ SpecialBattleIntroAnimations.register("vs_animation", 50, # Priority 50
trainer.tone = Tone.new(-255, -255, -255)
# Dim the flash and make the trainer sprites appear, while animating bars
animTime = (Graphics.frame_rate * 1.2).floor
for i in 0...animTime
animTime.times do |i|
flash.opacity -= 52 * 20 / Graphics.frame_rate if flash.opacity > 0
bar1.ox -= 32 * 20 / Graphics.frame_rate
bar2.ox += 32 * 20 / Graphics.frame_rate
@@ -294,7 +294,7 @@ SpecialBattleIntroAnimations.register("vs_animation", 50, # Priority 50
shudderTime = (Graphics.frame_rate * 1.75).floor
zoomTime = (Graphics.frame_rate * 2.5).floor
shudderDelta = [4 * 20 / Graphics.frame_rate, 1].max
for i in 0...animTime
animTime.times do |i|
if i < shudderTime # Fade out the white flash
flash.opacity -= 52 * 20 / Graphics.frame_rate if flash.opacity > 0
elsif i == shudderTime # Make the flash black

View File

@@ -18,7 +18,7 @@ end
# Resets all roaming Pokemon that were defeated without having been caught.
def pbResetAllRoamers
return if !$PokemonGlobal.roamPokemon
for i in 0...$PokemonGlobal.roamPokemon.length
$PokemonGlobal.roamPokemon.length.times do |i|
next if $PokemonGlobal.roamPokemon[i] != true || !$PokemonGlobal.roamPokemonCaught[i]
$PokemonGlobal.roamPokemon[i] = nil
end
@@ -45,14 +45,14 @@ def pbRoamPokemon
# Start all roamers off in random maps
if !$PokemonGlobal.roamPosition
$PokemonGlobal.roamPosition = {}
for i in 0...Settings::ROAMING_SPECIES.length
Settings::ROAMING_SPECIES.length.times do |i|
next if !GameData::Species.exists?(Settings::ROAMING_SPECIES[i][0])
keys = pbRoamingAreas(i).keys
$PokemonGlobal.roamPosition[i] = keys[rand(keys.length)]
end
end
# Roam each Pokémon in turn
for i in 0...Settings::ROAMING_SPECIES.length
Settings::ROAMING_SPECIES.length.times do |i|
pbRoamPokemonOne(i)
end
end
@@ -77,7 +77,7 @@ def pbRoamPokemonOne(idxRoamer)
newMapChoices = []
nextMaps = pbRoamingAreas(idxRoamer)[currentMap]
return if !nextMaps
for map in nextMaps
nextMaps.each do |map|
# Only add map as a choice if the player hasn't been there recently
newMapChoices.push(map)
end