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

@@ -134,13 +134,13 @@ class Trainer
# Returns true if there is a Pokémon of the given species in the trainer's
# party. You may also specify a particular form it should be.
def has_species?(species, form = -1)
return pokemon_party.any? { |p| p && p.isSpecies?(species) && (form < 0 || p.form == form) }
return pokemon_party.any? { |p| p&.isSpecies?(species) && (form < 0 || p.form == form) }
end
# Returns whether there is a fatefully met Pokémon of the given species in the
# trainer's party.
def has_fateful_species?(species)
return pokemon_party.any? { |p| p && p.isSpecies?(species) && p.obtain_method == 4 }
return pokemon_party.any? { |p| p&.isSpecies?(species) && p.obtain_method == 4 }
end
# Returns whether there is a Pokémon with the given type in the trainer's
@@ -148,7 +148,7 @@ class Trainer
def has_pokemon_of_type?(type)
return false if !GameData::Type.exists?(type)
type = GameData::Type.get(type).id
return pokemon_party.any? { |p| p && p.hasType?(type) }
return pokemon_party.any? { |p| p&.hasType?(type) }
end
# Checks whether any Pokémon in the party knows the given move, and returns

View File

@@ -73,7 +73,7 @@ def pbTrainerTypeCheck(trainer_type)
if pbConfirmMessage(_INTL("Add new trainer type {1}?", trainer_type.to_s))
pbTrainerTypeEditorNew(trainer_type.to_s)
end
pbMapInterpreter.command_end if pbMapInterpreter
pbMapInterpreter&.command_end
return false
end
@@ -113,10 +113,10 @@ def pbMissingTrainer(tr_type, tr_name, tr_version)
raise _INTL("Can't find trainer ({1}, {2}, ID {3})", tr_type.to_s, tr_name, tr_version)
end
message = ""
if tr_version != 0
message = _INTL("Add new trainer ({1}, {2}, ID {3})?", tr_type.to_s, tr_name, tr_version)
else
if tr_version == 0
message = _INTL("Add new trainer ({1}, {2})?", tr_type.to_s, tr_name)
else
message = _INTL("Add new trainer ({1}, {2}, ID {3})?", tr_type.to_s, tr_name, tr_version)
end
cmd = pbMessage(message, [_INTL("Yes"), _INTL("No")], 2)
pbNewTrainer(tr_type, tr_name, tr_version) if cmd == 0

View File

@@ -12,7 +12,7 @@ class TrainerWalkingCharSprite < SpriteWrapper
end
def charset=(value)
@animbitmap.dispose if @animbitmap
@animbitmap&.dispose
@animbitmap = nil
bitmapFileName = sprintf("Graphics/Characters/%s", value)
@charset = pbResolveBitmap(bitmapFileName)
@@ -26,7 +26,7 @@ class TrainerWalkingCharSprite < SpriteWrapper
end
def altcharset=(value) # Used for box icon in the naming screen
@animbitmap.dispose if @animbitmap
@animbitmap&.dispose
@animbitmap = nil
@charset = pbResolveBitmap(value)
if @charset
@@ -43,7 +43,7 @@ class TrainerWalkingCharSprite < SpriteWrapper
end
def dispose
@animbitmap.dispose if @animbitmap
@animbitmap&.dispose
super
end

View File

@@ -38,13 +38,13 @@ class Player < Trainer
def character_ID=(value)
return if @character_ID == value
@character_ID = value
$game_player.refresh_charset if $game_player
$game_player&.refresh_charset
end
def outfit=(value)
return if @outfit == value
@outfit = value
$game_player.refresh_charset if $game_player
$game_player&.refresh_charset
end
def trainer_type