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

@@ -21,16 +21,16 @@ class PokeBattle_Pokemon
attr_accessor :moves # Moves (PBMove)
attr_accessor :firstmoves # The moves known when this Pokémon was obtained
attr_accessor :item # Held item
attr_accessor :mail # Mail
attr_writer :mail # Mail
attr_accessor :fused # The Pokémon fused into this one
attr_accessor :iv # Array of 6 Individual Values for HP, Atk, Def,
# Speed, Sp Atk, and Sp Def
attr_accessor :ivMaxed # Array of booleans that max each IV value
attr_writer :ivMaxed # Array of booleans that max each IV value
attr_accessor :ev # Effort Values
attr_accessor :happiness # Current happiness
attr_accessor :ballused # Ball used
attr_accessor :eggsteps # Steps to hatch egg, 0 if Pokémon is not an egg
attr_accessor :markings # Markings
attr_writer :markings # Markings
attr_accessor :ribbons # Array of ribbons
attr_accessor :pokerus # Pokérus strain and infection time
attr_accessor :personalID # Personal ID
@@ -41,15 +41,15 @@ class PokeBattle_Pokemon
# 4 - fateful encounter
attr_accessor :obtainMap # Map where obtained
attr_accessor :obtainText # Replaces the obtain map's name if not nil
attr_accessor :obtainLevel # Level obtained
attr_writer :obtainLevel # Level obtained
attr_accessor :hatchedMap # Map where an egg was hatched
attr_accessor :language # Language
attr_writer :language # Language
attr_accessor :ot # Original Trainer's name
attr_accessor :otgender # Original Trainer's gender:
attr_writer :otgender # Original Trainer's gender:
# 0 - male, 1 - female, 2 - mixed, 3 - unknown
# For information only, not used to verify
# ownership of the Pokémon
attr_accessor :cool,:beauty,:cute,:smart,:tough,:sheen # Contest stats
attr_writer :cool,:beauty,:cute,:smart,:tough,:sheen # Contest stats
IV_STAT_LIMIT = 31 # Max total IVs
EV_LIMIT = 510 # Max total EVs
@@ -348,7 +348,7 @@ class PokeBattle_Pokemon
strain = 1+rand(15) if strain<=0 || strain>=16
time = 1+(strain%4)
@pokerus = time
@pokerus |= strain<<4
@pokerus |= strain << 4
end
# Resets the infection time for this Pokémon's Pokérus (even if cured).
@@ -357,7 +357,7 @@ class PokeBattle_Pokemon
strain = @pokerus%16
time = 1+(strain%4)
@pokerus = time
@pokerus |= strain<<4
@pokerus |= strain << 4
end
# Reduces the time remaining for this Pokémon's Pokérus (if infected).
@@ -447,7 +447,8 @@ class PokeBattle_Pokemon
return if move<=0
for i in 0...4 # Already knows move, relocate it to the end of the list
next if @moves[i].id!=move
j = i+1; while j<4
j = i+1
while j<4
break if @moves[j].id==0
tmp = @moves[j]
@moves[j] = @moves[j-1]
@@ -524,12 +525,12 @@ class PokeBattle_Pokemon
#=============================================================================
# Contest attributes, ribbons
#=============================================================================
def cool; return @cool ? @cool : 0; end
def beauty; return @beauty ? @beauty : 0; end
def cute; return @cute ? @cute : 0; end
def smart; return @smart ? @smart : 0; end
def tough; return @tough ? @tough : 0; end
def sheen; return @sheen ? @sheen : 0; end
def cool; return @cool || 0; end
def beauty; return @beauty || 0; end
def cute; return @cute || 0; end
def smart; return @smart || 0; end
def tough; return @tough || 0; end
def sheen; return @sheen || 0; end
# Returns the number of ribbons this Pokémon has.
def ribbonCount
@@ -672,8 +673,7 @@ class PokeBattle_Pokemon
# Returns an array of booleans indicating whether a stat is made to have
# maximum IVs (for Hyper Training). Set like @ivMaxed[PBStats::ATTACK] = true
def ivMaxed
@ivMaxed = [] if !@ivMaxed
return @ivMaxed
return @ivMaxed || []
end
# Returns this Pokémon's effective IVs, taking into account Hyper Training.
@@ -870,7 +870,6 @@ class PokeBattle_Pokemon
realSpecies = pbGetSpeciesFromFSpecies(species)[0] if species && species>0
if !species || species<=0 || realSpecies>PBSpecies.maxValue || !cname
raise ArgumentError.new(_INTL("The species given ({1}) is invalid.",ospecies))
return nil
end
@species = realSpecies
@name = PBSpecies.getName(@species)

View File

@@ -63,7 +63,7 @@ end
class PokeBattle_RealBattlePeer
def pbOnEnteringBattle(battle,pkmn,wild=false)
def pbOnEnteringBattle(_battle,pkmn,wild=false)
f = MultipleForms.call("getFormOnEnteringBattle",pkmn,wild)
pkmn.form = f if f
end
@@ -248,7 +248,6 @@ MultipleForms.register(:BURMY,{
},
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
next if !endBattle || !usedInBattle
env = battle.environment
case battle.environment
when PBEnvironment::Rock, PBEnvironment::Sand, PBEnvironment::Cave
next 1 # Sandy Cloak

View File

@@ -231,9 +231,9 @@ end
# Pokémon class.
#===============================================================================
class PokeBattle_Pokemon
attr_accessor :heartgauge
attr_writer :heartgauge
attr_accessor :shadow
attr_accessor :hypermode
attr_writer :hypermode
attr_accessor :savedev
attr_accessor :savedexp
attr_accessor :shadowmoves
@@ -260,8 +260,7 @@ class PokeBattle_Pokemon
end
def heartgauge
@heartgauge = 0 if !@heartgauge
return @heartgauge
return @heartgauge || 0
end
def heartStage
@@ -668,7 +667,7 @@ end
Events.onStartBattle += proc { |sender|
Events.onStartBattle += proc { |_sender|
# Record current heart gauges of Pokémon in party, to see if they drop to zero
# during battle and need to say they're ready to be purified afterwards
$PokemonTemp.heartgauges = []
@@ -677,9 +676,7 @@ Events.onStartBattle += proc { |sender|
end
}
Events.onEndBattle += proc { |sender,e|
decision = e[0]
canLose = e[1]
Events.onEndBattle += proc { |_sender,_e|
for i in 0...$PokemonTemp.heartgauges.length
pokemon = $Trainer.party[i]
if pokemon && $PokemonTemp.heartgauges[i] &&

View File

@@ -39,7 +39,7 @@ HiddenMoveHandlers::UseMove.add(:CHATTER,proc { |move,pokemon|
class PokeBattle_Scene
def pbChatter(user,target)
def pbChatter(user,_target)
pbPlayCry(user.pokemon,90,100) if user.pokemon
Graphics.frame_rate.times do
Graphics.update

View File

@@ -111,7 +111,7 @@ class PokemonStorage
$Trainer.party
end
def party=(value)
def party=(_value)
raise ArgumentError.new("Not supported")
end