Code tidying with Rubocop

This commit is contained in:
Maruno17
2023-07-18 22:42:10 +01:00
parent 6053363715
commit a5734eaf46
68 changed files with 276 additions and 232 deletions

View File

@@ -21,7 +21,7 @@ def pbCaveEntranceEx(exiting)
y = 0
# Calculate color of each band
totalBands.times do |k|
grays[k] = lerp(start_gray, end_gray, duration, timer_start + k * duration / totalBands, System.uptime)
grays[k] = lerp(start_gray, end_gray, duration, timer_start + (k * duration / totalBands), System.uptime)
end
# Draw gray rectangles
rectwidth = Graphics.width

View File

@@ -4,7 +4,7 @@
# Pokérus check
EventHandlers.add(:on_frame_update, :pokerus_counter,
proc {
next if !$player&.party.any? { |pkmn| pkmn.pokerusStage == 1 }
next if !$player || $player.party.none? { |pkmn| pkmn.pokerusStage == 1 }
last = $PokemonGlobal.pokerusTime
next if !last
now = pbGetTimeNow

View File

@@ -392,7 +392,7 @@ SpecialBattleIntroAnimations.register("alternate_vs_trainer_animation", 50, #
if delta_t <= shudder_time
# +2, -2, -2, +2, repeat
period = (delta_t / 0.025).to_i % 4
shudder_delta = [2, 0 , -2, 0][period]
shudder_delta = [2, 0, -2, 0][period]
vs.x = vs_x + shudder_delta
vs.y = vs_y - shudder_delta
elsif delta_t <= zoom_time

View File

@@ -234,7 +234,7 @@ end
#===============================================================================
# Moon phases and Zodiac
#===============================================================================
# Calculates the phase of the moon.
# Calculates the phase of the moon. time is in UTC.
# 0 - New Moon
# 1 - Waxing Crescent
# 2 - First Quarter
@@ -243,7 +243,7 @@ end
# 5 - Waning Gibbous
# 6 - Last Quarter
# 7 - Waning Crescent
def moonphase(time = nil) # in UTC
def moonphase(time = nil)
time = pbGetTimeNow if !time
transitions = [
1.8456618033125,

View File

@@ -103,7 +103,7 @@ def pbHiddenMoveAnimation(pokemon)
when 1 # Expand viewport height from zero to full
viewport.rect.y = lerp(Graphics.height / 2, (Graphics.height - bg.bitmap.height) / 2,
0.25, timer_start, System.uptime)
viewport.rect.height = Graphics.height - viewport.rect.y * 2
viewport.rect.height = Graphics.height - (viewport.rect.y * 2)
bg.oy = (bg.bitmap.height - viewport.rect.height) / 2
if viewport.rect.y == (Graphics.height - bg.bitmap.height) / 2
phase = 2
@@ -134,7 +134,7 @@ def pbHiddenMoveAnimation(pokemon)
when 5 # Shrink viewport height from full to zero
viewport.rect.y = lerp((Graphics.height - bg.bitmap.height) / 2, Graphics.height / 2,
0.25, timer_start, System.uptime)
viewport.rect.height = Graphics.height - viewport.rect.y * 2
viewport.rect.height = Graphics.height - (viewport.rect.y * 2)
bg.oy = (bg.bitmap.height - viewport.rect.height) / 2
phase = 6 if viewport.rect.y == Graphics.height / 2
end