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

@@ -40,21 +40,20 @@ def drawSpot(bitmap, spotpattern, x, y, red, green, blue)
height.times do |yy|
spot = spotpattern[yy]
width.times do |xx|
if spot[xx] == 1
xOrg = (x + xx) << 1
yOrg = (y + yy) << 1
color = bitmap.get_pixel(xOrg, yOrg)
r = color.red + red
g = color.green + green
b = color.blue + blue
color.red = [[r, 0].max, 255].min
color.green = [[g, 0].max, 255].min
color.blue = [[b, 0].max, 255].min
bitmap.set_pixel(xOrg, yOrg, color)
bitmap.set_pixel(xOrg + 1, yOrg, color)
bitmap.set_pixel(xOrg, yOrg + 1, color)
bitmap.set_pixel(xOrg + 1, yOrg + 1, color)
end
next if spot[xx] != 1
xOrg = (x + xx) << 1
yOrg = (y + yy) << 1
color = bitmap.get_pixel(xOrg, yOrg)
r = color.red + red
g = color.green + green
b = color.blue + blue
color.red = [[r, 0].max, 255].min
color.green = [[g, 0].max, 255].min
color.blue = [[b, 0].max, 255].min
bitmap.set_pixel(xOrg, yOrg, color)
bitmap.set_pixel(xOrg + 1, yOrg, color)
bitmap.set_pixel(xOrg, yOrg + 1, color)
bitmap.set_pixel(xOrg + 1, yOrg + 1, color)
end
end
end

View File

@@ -149,7 +149,7 @@ end
#
#===============================================================================
def pbRelicStone
if !$player.party.any? { |pkmn| pkmn.purifiable? }
if $player.party.none? { |pkmn| pkmn.purifiable? }
pbMessage(_INTL("You have no Pokémon that can be purified."))
return
end
@@ -421,17 +421,16 @@ EventHandlers.add(:on_player_step_taken, :lower_heart_gauges,
next if pkmn.heart_gauge == 0
pkmn.heart_gauge_step_counter = 0 if !pkmn.heart_gauge_step_counter
pkmn.heart_gauge_step_counter += 1
if pkmn.heart_gauge_step_counter >= 256
old_stage = pkmn.heartStage
pkmn.change_heart_gauge("walking")
new_stage = pkmn.heartStage
if new_stage == 0
pkmn.check_ready_to_purify
elsif new_stage != old_stage
pkmn.update_shadow_moves
end
pkmn.heart_gauge_step_counter = 0
next if pkmn.heart_gauge_step_counter < 256
old_stage = pkmn.heartStage
pkmn.change_heart_gauge("walking")
new_stage = pkmn.heartStage
if new_stage == 0
pkmn.check_ready_to_purify
elsif new_stage != old_stage
pkmn.update_shadow_moves
end
pkmn.heart_gauge_step_counter = 0
end
$PokemonGlobal.purifyChamber&.update
}

View File

@@ -212,15 +212,14 @@ class PokemonStorage
def pbMoveCaughtToBox(pkmn, box)
maxPokemon(box).times do |i|
if self[box, i].nil?
if Settings::HEAL_STORED_POKEMON && box >= 0
old_ready_evo = pkmn.ready_to_evolve
pkmn.heal
pkmn.ready_to_evolve = old_ready_evo
end
self[box, i] = pkmn
return true
next unless self[box, i].nil?
if Settings::HEAL_STORED_POKEMON && box >= 0
old_ready_evo = pkmn.ready_to_evolve
pkmn.heal
pkmn.ready_to_evolve = old_ready_evo
end
self[box, i] = pkmn
return true
end
return false
end
@@ -239,11 +238,10 @@ class PokemonStorage
end
self.maxBoxes.times do |j|
maxPokemon(j).times do |i|
if self[j, i].nil?
self[j, i] = pkmn
@currentBox = j
return @currentBox
end
next unless self[j, i].nil?
self[j, i] = pkmn
@currentBox = j
return @currentBox
end
end
return -1

View File

@@ -106,7 +106,7 @@ class Pokemon
def inspect
str = super.chop
str << sprintf(' %s Lv.%s>', @species, @level.to_s || '???')
str << sprintf(" %s Lv.%s>", @species, @level.to_s || "???")
return str
end
@@ -143,7 +143,7 @@ class Pokemon
return @forced_form if !@forced_form.nil?
return @form if $game_temp.in_battle || $game_temp.in_storage
calc_form = MultipleForms.call("getForm", self)
self.form = calc_form if calc_form != nil && calc_form != @form
self.form = calc_form if calc_form && calc_form != @form
return @form
end
@@ -250,7 +250,7 @@ class Pokemon
return if !able?
new_status = GameData::Status.try_get(value)
if !new_status
raise ArgumentError, _INTL('Attempted to set {1} as Pokémon status', value.class.name)
raise ArgumentError, _INTL("Attempted to set {1} as Pokémon status", value.class.name)
end
@status = new_status.id
end
@@ -311,13 +311,13 @@ class Pokemon
# @deprecated This method is slated to be removed in v21.
def type1
Deprecation.warn_method('type1', 'v21', 'pkmn.types')
Deprecation.warn_method("type1", "v21", "pkmn.types")
return types[0]
end
# @deprecated This method is slated to be removed in v21.
def type2
Deprecation.warn_method('type2', 'v21', 'pkmn.types')
Deprecation.warn_method("type2", "v21", "pkmn.types")
return types[1] || types[0]
end
@@ -588,7 +588,7 @@ class Pokemon
# @param mail [Mail, nil] mail to be held by this Pokémon
def mail=(mail)
if !mail.nil? && !mail.is_a?(Mail)
raise ArgumentError, _INTL('Invalid value {1} given', mail.inspect)
raise ArgumentError, _INTL("Invalid value {1} given", mail.inspect)
end
@mail = mail
end
@@ -1185,7 +1185,7 @@ class Pokemon
when Player, NPCTrainer
@owner = Owner.new_from_trainer(owner)
else
@owner = Owner.new(0, '', 2, 2)
@owner = Owner.new(0, "", 2, 2)
end
@obtain_method = 0 # Met
@obtain_method = 4 if $game_switches && $game_switches[Settings::FATEFUL_ENCOUNTER_SWITCH]

View File

@@ -37,7 +37,7 @@ class Pokemon
# @param gender [Integer] owner gender
# @param language [Integer] owner language
# @return [Owner] foreign Owner object
def self.new_foreign(name = '', gender = 2, language = 2)
def self.new_foreign(name = "", gender = 2, language = 2)
return new($player.make_foreign_ID, name, gender, language)
end