Resolved many Rubocop warnings

This commit is contained in:
Maruno17
2020-09-06 17:31:12 +01:00
parent 6c4670eaa3
commit 681a8331ab
137 changed files with 921 additions and 1200 deletions

View File

@@ -307,7 +307,7 @@ class PokeBattle_Battle
# screen.
def pbPlayerDisplayParty(idxBattler=0)
partyOrders = pbPartyOrder(idxBattler)
idxStart, idxEnd = pbTeamIndexRangeFromBattlerIndex(idxBattler)
idxStart, _idxEnd = pbTeamIndexRangeFromBattlerIndex(idxBattler)
ret = []
eachInTeamFromBattlerIndex(idxBattler) { |pkmn,i| ret[partyOrders[i]-idxStart] = pkmn }
return ret
@@ -408,7 +408,7 @@ class PokeBattle_Battle
# Used to calculate money gained/lost after winning/losing a battle.
def pbMaxLevelInTeam(side,idxTrainer)
ret = 1
eachInTeam(side,idxTrainer) do |pkmn,i|
eachInTeam(side,idxTrainer) do |pkmn,_i|
ret = pkmn.level if pkmn.level>ret
end
return ret
@@ -433,13 +433,13 @@ class PokeBattle_Battle
def pbSideBattlerCount(idxBattler=0)
ret = 0
eachSameSideBattler(idxBattler) { |b| ret += 1 }
eachSameSideBattler(idxBattler) { |_b| ret += 1 }
return ret
end
def pbOpposingBattlerCount(idxBattler=0)
ret = 0
eachOtherSideBattler(idxBattler) { |b| ret += 1 }
eachOtherSideBattler(idxBattler) { |_b| ret += 1 }
return ret
end
@@ -558,7 +558,7 @@ class PokeBattle_Battle
idxPartyEnd = (idxTrainer<partyStarts.length-1) ? partyStarts[idxTrainer+1] : party.length
origPartyPos = partyOrders[idxParty] # Position of erased Pokémon initially
partyOrders[idxParty] = idxPartyEnd # Put erased Pokémon last in the team
party.each_with_index do |pkmn,i|
party.each_with_index do |_pkmn,i|
next if i<idxPartyStart || i>=idxPartyEnd # Only check the team
next if partyOrders[i]<origPartyPos # Appeared before erased Pokémon
partyOrders[i] -= 1 # Appeared after erased Pokémon; bump it up by 1
@@ -756,8 +756,8 @@ class PokeBattle_Battle
@scene.pbAnimation(move,user,targets,hitNum) if @showAnims
end
def pbCommonAnimation(name,user=nil,targets=nil,hitNum=0)
@scene.pbCommonAnimation(name,user,targets,hitNum) if @showAnims
def pbCommonAnimation(name,user=nil,targets=nil)
@scene.pbCommonAnimation(name,user,targets) if @showAnims
end
def pbShowAbilitySplash(battler,delay=false,logTrigger=true)

View File

@@ -58,7 +58,7 @@ class PokeBattle_Battle
raise _INTL("Error: def pbGetOwnerIndexFromBattlerIndex gives invalid owner index ({1} for battle type {2}v{3}, trainers {4}v{5})",
requireds.length-1,@sideSizes[0],@sideSizes[1],side1counts.length,side2counts.length)
end
sideCounts.each_with_index do |count,i|
sideCounts.each_with_index do |_count,i|
if !requireds[i] || requireds[i]==0
raise _INTL("Player-side trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)",
i+1,@sideSizes[0],@sideSizes[1]) if side==0
@@ -139,7 +139,7 @@ class PokeBattle_Battle
# For each trainer in turn, find the needed number of Pokémon for them to
# send out, and initialize them
battlerNumber = 0
trainer.each_with_index do |t,idxTrainer|
trainer.each_with_index do |_t,idxTrainer|
ret[side][idxTrainer] = []
eachInTeam(side,idxTrainer) do |pkmn,idxPkmn|
next if !pkmn.able?
@@ -403,7 +403,7 @@ class PokeBattle_Battle
pbDisplayPaused(_INTL("You defeated {1}, {2} and {3}!",@opponent[0].fullname,
@opponent[1].fullname,@opponent[2].fullname))
end
@opponent.each_with_index do |t,i|
@opponent.each_with_index do |_t,i|
@scene.pbShowOpponent(i)
msg = (@endSpeeches[i] && @endSpeeches[i]!="") ? @endSpeeches[i] : "..."
pbDisplayPaused(msg.gsub(/\\[Pp][Nn]/,pbPlayer.name))
@@ -437,7 +437,7 @@ class PokeBattle_Battle
pbDisplayPaused(_INTL("You blacked out!")) if !@canLose
elsif @decision==2
if @opponent
@opponent.each_with_index do |t,i|
@opponent.each_with_index do |_t,i|
@scene.pbShowOpponent(i)
msg = (@endSpeechesWin[i] && @endSpeechesWin[i]!="") ? @endSpeechesWin[i] : "..."
pbDisplayPaused(msg.gsub(/\\[Pp][Nn]/,pbPlayer.name))

View File

@@ -168,7 +168,6 @@ class PokeBattle_Battle
raise RuntimeError.new(
_INTL("{1}'s new level is less than its\r\ncurrent level, which shouldn't happen.\r\n[Debug: {2}]",
pkmn.name,debugInfo))
return
end
# Give Exp
if pkmn.shadowPokemon?

View File

@@ -94,7 +94,7 @@ class PokeBattle_Battle
end
def pbCanChooseNonActive?(idxBattler)
pbParty(idxBattler).each_with_index do |pkmn,i|
pbParty(idxBattler).each_with_index do |_pkmn,i|
return true if pbCanSwitchLax?(idxBattler,i)
end
return false
@@ -212,7 +212,7 @@ class PokeBattle_Battle
if random
return -1 if !pbCanSwitch?(idxBattler) # Can battler switch out?
choices = [] # Find all Pokémon that can switch in
eachInTeamFromBattlerIndex(idxBattler) do |pkmn,i|
eachInTeamFromBattlerIndex(idxBattler) do |_pkmn,i|
choices.push(i) if pbCanSwitchLax?(idxBattler,i)
end
return -1 if choices.length==0

View File

@@ -45,7 +45,7 @@ class PokeBattle_Battle
return false if battler.effects[PBEffects::Encore]>0
# No moves that can be chosen (will Struggle instead)
usable = false
battler.eachMoveWithIndex do |m,i|
battler.eachMoveWithIndex do |_m,i|
next if !pbCanChooseMove?(idxBattler,i,false)
usable = true
break

View File

@@ -297,7 +297,7 @@ class PokeBattle_Battle
next if !b.canHeal?
hpGain = b.totalhp/16
hpGain = (hpGain*1.3).floor if b.hasActiveItem?(:BIGROOT)
hpGain = b.pbRecoverHP(hpGain)
b.pbRecoverHP(hpGain)
pbDisplay(_INTL("Aqua Ring restored {1}'s HP!",b.pbThis(true)))
end
# Ingrain
@@ -306,7 +306,7 @@ class PokeBattle_Battle
next if !b.canHeal?
hpGain = b.totalhp/16
hpGain = (hpGain*1.3).floor if b.hasActiveItem?(:BIGROOT)
hpGain = b.pbRecoverHP(hpGain)
b.pbRecoverHP(hpGain)
pbDisplay(_INTL("{1} absorbed nutrients with its roots!",b.pbThis))
end
# Leech Seed