More Rubocop changes

This commit is contained in:
Maruno17
2022-02-13 00:57:54 +00:00
parent cca5989746
commit f68e699cc9
108 changed files with 708 additions and 808 deletions

View File

@@ -457,7 +457,7 @@ module RPG
end
# End fading
if @fade_time >= ((@target_type == :None) ? FADE_OLD_PARTICLES_END : FADE_NEW_TILES_END) - @time_shift &&
!@sprites.any? { |sprite| sprite.visible }
@sprites.none? { |sprite| sprite.visible }
@type = @target_type
@max = @target_max
@target_type = nil

View File

@@ -93,7 +93,7 @@ end
class LightEffect
def initialize(event, viewport = nil, map = nil, filename = nil)
@light = IconSprite.new(0, 0, viewport)
if filename != nil && filename != "" && pbResolveBitmap("Graphics/Pictures/" + filename)
if !nil_or_empty?(filename) && pbResolveBitmap("Graphics/Pictures/" + filename)
@light.setBitmap("Graphics/Pictures/" + filename)
else
@light.setBitmap("Graphics/Pictures/LE")
@@ -208,7 +208,7 @@ end
EventHandlers.add(:on_new_spriteset_map, :add_light_effects,
proc { |spriteset, viewport|
map = spriteset.map # Map associated with the spriteset (not necessarily the current map)
map.events.keys.each do |i|
map.events.each_key do |i|
if map.events[i].name[/^outdoorlight\((\w+)\)$/i]
filename = $~[1].to_s
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i], viewport, map, filename))

View File

@@ -632,13 +632,12 @@ def pbEvolutionCheck
new_species = pkmn.check_evolution_on_level_up
end
new_species = pkmn.check_evolution_after_battle(i) if new_species.nil?
next if new_species.nil?
# Evolve Pokémon if possible
if !new_species.nil?
evo = PokemonEvolutionScene.new
evo.pbStartScreen(pkmn, new_species)
evo.pbEvolution
evo.pbEndScreen
end
evo = PokemonEvolutionScene.new
evo.pbStartScreen(pkmn, new_species)
evo.pbEvolution
evo.pbEndScreen
end
end

View File

@@ -154,10 +154,7 @@ class PokemonMapMetadata
def updateMap
@erasedEvents.each do |i|
if i[0][0] == $game_map.map_id && i[1]
event = $game_map.events[i[0][1]]
event&.erase
end
$game_map.events[i[0][1]]&.erase if i[0][0] == $game_map.map_id && i[1]
end
@movedEvents.each do |i|
if i[0][0] == $game_map.map_id && i[1]
@@ -170,9 +167,7 @@ class PokemonMapMetadata
when 8 then $game_map.events[i[0][1]].turn_up
end
end
if i[1][3] != nil
$game_map.events[i[0][1]].through = i[1][3]
end
$game_map.events[i[0][1]].through = i[1][3] if i[1][3]
end
end
end

View File

@@ -11,7 +11,7 @@ module HiddenMoveHandlers
def self.addUseMove(item, proc); UseMove.add(item, proc); end
def self.hasHandler(item)
return CanUseMove[item] != nil && UseMove[item] != nil
return !CanUseMove[item].nil? && !UseMove[item].nil?
end
# Returns whether move can be used
@@ -370,7 +370,7 @@ end
# @deprecated This method is slated to be removed in v21.
def pbTransferUnderwater(mapid, x, y, direction = $game_player.direction)
Deprecation.warn_method('pbTransferUnderwater', 'v21', '"Transfer Player" event command')
Deprecation.warn_method("pbTransferUnderwater", "v21", '"Transfer Player" event command')
pbFadeOutIn {
$game_temp.player_new_map_id = mapid
$game_temp.player_new_x = x
@@ -787,7 +787,7 @@ end
# @deprecated This method is slated to be removed in v21.
def pbTransferSurfing(mapid, xcoord, ycoord, direction = $game_player.direction)
Deprecation.warn_method('pbTransferSurfing', 'v21', '"Transfer Player" event command')
Deprecation.warn_method("pbTransferSurfing", "v21", '"Transfer Player" event command')
pbFadeOutIn {
$game_temp.player_new_map_id = mapid
$game_temp.player_new_x = xcoord

View File

@@ -568,54 +568,54 @@ EventHandlers.add(:on_player_step_taken, :update_day_care,
#===============================================================================
# @deprecated This method is slated to be removed in v21.
def pbDayCareDeposited
Deprecation.warn_method('pbDayCareDeposited', 'v21', 'DayCare.count')
Deprecation.warn_method("pbDayCareDeposited", "v21", "DayCare.count")
return DayCare.count
end
# @deprecated This method is slated to be removed in v21.
def pbDayCareGetDeposited(index, name_var, cost_var)
Deprecation.warn_method('pbDayCareGetDeposited', 'v21', 'DayCare.get_details(index, name_var, cost_var)')
Deprecation.warn_method("pbDayCareGetDeposited", "v21", "DayCare.get_details(index, name_var, cost_var)")
DayCare.get_details(index, name_var, cost_var)
end
# @deprecated This method is slated to be removed in v21.
def pbDayCareGetLevelGain(index, name_var, level_var)
Deprecation.warn_method('pbDayCareGetLevelGain', 'v21', 'DayCare.get_level_gain(index, name_var, level_var)')
Deprecation.warn_method("pbDayCareGetLevelGain", "v21", "DayCare.get_level_gain(index, name_var, level_var)")
DayCare.get_level_gain(index, name_var, level_var)
end
# @deprecated This method is slated to be removed in v21.
def pbDayCareDeposit(party_index)
Deprecation.warn_method('pbDayCareDeposit', 'v21', 'DayCare.deposit(party_index)')
Deprecation.warn_method("pbDayCareDeposit", "v21", "DayCare.deposit(party_index)")
DayCare.deposit(party_index)
end
# @deprecated This method is slated to be removed in v21.
def pbDayCareWithdraw(index)
Deprecation.warn_method('pbDayCareWithdraw', 'v21', 'DayCare.withdraw(index)')
Deprecation.warn_method("pbDayCareWithdraw", "v21", "DayCare.withdraw(index)")
DayCare.withdraw(index)
end
# @deprecated This method is slated to be removed in v21.
def pbDayCareChoose(text, choice_var)
Deprecation.warn_method('pbDayCareChoose', 'v21', 'DayCare.choose(text, choice_var)')
Deprecation.warn_method("pbDayCareChoose", "v21", "DayCare.choose(text, choice_var)")
DayCare.choose(text, choice_var)
end
# @deprecated This method is slated to be removed in v21.
def pbDayCareGetCompatibility(compat_var)
Deprecation.warn_method('pbDayCareGetCompatibility', 'v21', 'DayCare.get_compatibility(compat_var)')
Deprecation.warn_method("pbDayCareGetCompatibility", "v21", "DayCare.get_compatibility(compat_var)")
DayCare.get_compatibility(compat_var)
end
# @deprecated This method is slated to be removed in v21.
def pbEggGenerated?
Deprecation.warn_method('pbEggGenerated?', 'v21', 'DayCare.egg_generated?')
Deprecation.warn_method("pbEggGenerated?", "v21", "DayCare.egg_generated?")
return DayCare.egg_generated?
end
# @deprecated This method is slated to be removed in v21.
def pbDayCareGenerateEgg
Deprecation.warn_method('pbDayCareGenerateEgg', 'v21', 'DayCare.collect_egg')
Deprecation.warn_method("pbDayCareGenerateEgg", "v21", "DayCare.collect_egg")
DayCare.collect_egg
end

View File

@@ -622,12 +622,11 @@ module RandomDungeonGenerator
((tiles.length + 1) * 1000).times do
x = ar1.get
y = ar2.get
if dungeon.isRoom?(x, y) &&
!tiles.any? { |item| (item[0] - x).abs < 2 && (item[1] - y).abs < 2 }
ret = [x, y]
tiles.push(ret)
return ret
end
next if !dungeon.isRoom?(x, y) ||
tiles.any? { |item| (item[0] - x).abs < 2 && (item[1] - y).abs < 2 }
ret = [x, y]
tiles.push(ret)
return ret
end
return nil
end
@@ -652,7 +651,7 @@ EventHandlers.add(:on_game_map_setup, :random_dungeon,
dungeon.generateMapInPlace(map)
roomtiles = []
# Reposition events
map.events.values.each do |event|
map.events.each_value do |event|
tile = RandomDungeonGenerator.pbRandomRoomTile(dungeon, roomtiles)
if tile
event.x = tile[0]