Yet more Rubocopping

This commit is contained in:
Maruno17
2021-12-23 00:27:17 +00:00
parent 514fe13ca2
commit 132a16950d
171 changed files with 1455 additions and 1647 deletions

View File

@@ -334,11 +334,11 @@ MultipleForms.register(:KYUREM, {
case form
when 0 # Normal
pkmn.moves.each do |move|
if [:ICEBURN, :FREEZESHOCK].include?(move.id)
move.id = :GLACIATE if GameData::Move.exists?(:GLACIATE)
if [:ICEBURN, :FREEZESHOCK].include?(move.id) && GameData::Move.exists?(:GLACIATE)
move.id = :GLACIATE
end
if [:FUSIONFLARE, :FUSIONBOLT].include?(move.id)
move.id = :SCARYFACE if GameData::Move.exists?(:SCARYFACE)
if [:FUSIONFLARE, :FUSIONBOLT].include?(move.id) && GameData::Move.exists?(:SCARYFACE)
move.id = :SCARYFACE
end
end
when 1 # White

View File

@@ -50,12 +50,11 @@ def pbPurify(pkmn, scene)
pkmn.exp = newexp
end
end
if $PokemonSystem.givenicknames == 0
if scene.pbConfirm(_INTL("Would you like to give a nickname to {1}?", pkmn.speciesName))
newname = pbEnterPokemonName(_INTL("{1}'s nickname?", pkmn.speciesName),
0, Pokemon::MAX_NAME_SIZE, "", pkmn)
pkmn.name = newname
end
if $PokemonSystem.givenicknames == 0 &&
scene.pbConfirm(_INTL("Would you like to give a nickname to {1}?", pkmn.speciesName))
newname = pbEnterPokemonName(_INTL("{1}'s nickname?", pkmn.speciesName),
0, Pokemon::MAX_NAME_SIZE, "", pkmn)
pkmn.name = newname
end
end
@@ -201,13 +200,13 @@ class Battle::Battler
def shadowPokemon?
p = self.pokemon
return p && p.shadowPokemon?
return p&.shadowPokemon?
end
def inHyperMode?
return false if fainted?
p = self.pokemon
return p && p.hyper_mode
return p&.hyper_mode
end
def pbHyperMode

View File

@@ -8,14 +8,14 @@ class PokemonSprite < SpriteWrapper
end
def dispose
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap&.dispose
@_iconbitmap = nil
self.bitmap = nil if !self.disposed?
super
end
def clearBitmap
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap&.dispose
@_iconbitmap = nil
self.bitmap = nil
end
@@ -47,7 +47,7 @@ class PokemonSprite < SpriteWrapper
end
def setPokemonBitmap(pokemon, back = false)
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap&.dispose
@_iconbitmap = (pokemon) ? GameData::Species.sprite_bitmap_from_pokemon(pokemon, back) : nil
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
self.color = Color.new(0, 0, 0, 0)
@@ -55,14 +55,14 @@ class PokemonSprite < SpriteWrapper
end
def setPokemonBitmapSpecies(pokemon, species, back = false)
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap&.dispose
@_iconbitmap = (pokemon) ? GameData::Species.sprite_bitmap_from_pokemon(pokemon, back, species) : nil
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
changeOrigin
end
def setSpeciesBitmap(species, gender = 0, form = 0, shiny = false, shadow = false, back = false, egg = false)
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap&.dispose
@_iconbitmap = GameData::Species.sprite_bitmap(species, form, gender, shiny, shadow, back, egg)
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
changeOrigin
@@ -102,7 +102,7 @@ class PokemonIconSprite < SpriteWrapper
end
def dispose
@animBitmap.dispose if @animBitmap
@animBitmap&.dispose
super
end
@@ -121,7 +121,7 @@ class PokemonIconSprite < SpriteWrapper
def pokemon=(value)
@pokemon = value
@animBitmap.dispose if @animBitmap
@animBitmap&.dispose
@animBitmap = nil
if !@pokemon
self.bitmap = nil
@@ -236,7 +236,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
end
def dispose
@animBitmap.dispose if @animBitmap
@animBitmap&.dispose
super
end
@@ -307,7 +307,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
end
def refresh
@animBitmap.dispose if @animBitmap
@animBitmap&.dispose
@animBitmap = nil
bitmapFileName = GameData::Species.icon_filename(@species, @form, @gender, @shiny)
return if !bitmapFileName

View File

@@ -153,7 +153,7 @@ class PokemonStorage
end
def [](x, y = nil)
if y == nil
if y.nil?
return (x == -1) ? self.party : @boxes[x]
else
@boxes.each do |i|
@@ -212,7 +212,7 @@ class PokemonStorage
def pbMoveCaughtToBox(pkmn, box)
maxPokemon(box).times do |i|
if self[box, i] == nil
if self[box, i].nil?
if Settings::HEAL_STORED_POKEMON && box >= 0
old_ready_evo = pkmn.ready_to_evolve
pkmn.heal
@@ -232,14 +232,14 @@ class PokemonStorage
pkmn.ready_to_evolve = old_ready_evo
end
maxPokemon(@currentBox).times do |i|
if self[@currentBox, i] == nil
if self[@currentBox, i].nil?
self[@currentBox, i] = pkmn
return @currentBox
end
end
self.maxBoxes.times do |j|
maxPokemon(j).times do |i|
if self[j, i] == nil
if self[j, i].nil?
self[j, i] = pkmn
@currentBox = j
return @currentBox

View File

@@ -157,7 +157,7 @@ class Pokemon
@ability = nil
MultipleForms.call("onSetForm", self, value, oldForm)
calc_stats
$player.pokedex.register(self) if $player
$player&.pokedex&.register(self)
end
# The same as def form=, but yields to a given block in the middle so that a
@@ -170,7 +170,7 @@ class Pokemon
yield if block_given?
MultipleForms.call("onSetForm", self, value, oldForm)
calc_stats
$player.pokedex.register(self) if $player
$player&.pokedex&.register(self)
end
def form_simple=(value)