Lots of rubocop

This commit is contained in:
Maruno17
2023-01-28 15:21:12 +00:00
parent 2d056052ce
commit 13aab8d911
159 changed files with 1679 additions and 1931 deletions

View File

@@ -448,52 +448,52 @@ end
# Event movement
#===============================================================================
module PBMoveRoute
Down = 1
Left = 2
Right = 3
Up = 4
LowerLeft = 5
LowerRight = 6
UpperLeft = 7
UpperRight = 8
Random = 9
TowardPlayer = 10
AwayFromPlayer = 11
Forward = 12
Backward = 13
Jump = 14 # xoffset, yoffset
Wait = 15 # frames
TurnDown = 16
TurnLeft = 17
TurnRight = 18
TurnUp = 19
TurnRight90 = 20
TurnLeft90 = 21
Turn180 = 22
TurnRightOrLeft90 = 23
TurnRandom = 24
TurnTowardPlayer = 25
TurnAwayFromPlayer = 26
SwitchOn = 27 # 1 param
SwitchOff = 28 # 1 param
ChangeSpeed = 29 # 1 param
ChangeFreq = 30 # 1 param
WalkAnimeOn = 31
WalkAnimeOff = 32
StepAnimeOn = 33
StepAnimeOff = 34
DirectionFixOn = 35
DirectionFixOff = 36
ThroughOn = 37
ThroughOff = 38
AlwaysOnTopOn = 39
AlwaysOnTopOff = 40
Graphic = 41 # Name, hue, direction, pattern
Opacity = 42 # 1 param
Blending = 43 # 1 param
PlaySE = 44 # 1 param
Script = 45 # 1 param
ScriptAsync = 101 # 1 param
DOWN = 1
LEFT = 2
RRIGHT = 3
UP = 4
LOWER_LEFT = 5
LOWER_RIGHT = 6
UPPER_LEFT = 7
UPPER_RIGHT = 8
RANDOM = 9
TOWARD_PLAYER = 10
AWAY_FROM_PLAYER = 11
FORWARD = 12
BACKWARD = 13
JUMP = 14 # xoffset, yoffset
WAIT = 15 # frames
TURN_DOWN = 16
TURN_LEFT = 17
TURN_RIGHT = 18
TURN_UP = 19
TURN_RIGHT90 = 20
TURN_LEFT90 = 21
TURN180 = 22
TURN_RIGHT_OR_LEFT90 = 23
TURN_RANDOM = 24
TURN_TOWARD_PLAYER = 25
TURN_AWAY_FROM_PLAYER = 26
SWITCH_ON = 27 # 1 param
SWITCH_OFF = 28 # 1 param
CHANGE_SPEED = 29 # 1 param
CHANGE_FREQUENCY = 30 # 1 param
WALK_ANIME_ON = 31
WALK_ANIME_OFF = 32
STEP_ANIME_ON = 33
STEP_ANIME_OFF = 34
DIRECTION_FIX_ON = 35
DIRECTION_FIX_OFF = 36
THROUGH_ON = 37
THROUGH_OFF = 38
ALWAYS_ON_TOP_ON = 39
ALWAYS_ON_TOP_OFF = 40
GRAPHIC = 41 # Name, hue, direction, pattern
OPACITY = 42 # 1 param
BLENDING = 43 # 1 param
PLAY_SE = 44 # 1 param
SCRIPT = 45 # 1 param
SCRIPT_ASYNC = 101 # 1 param
end
def pbMoveRoute(event, commands, waitComplete = false)
@@ -501,23 +501,23 @@ def pbMoveRoute(event, commands, waitComplete = false)
route.repeat = false
route.skippable = true
route.list.clear
route.list.push(RPG::MoveCommand.new(PBMoveRoute::ThroughOn))
route.list.push(RPG::MoveCommand.new(PBMoveRoute::THROUGH_ON))
i = 0
while i < commands.length
case commands[i]
when PBMoveRoute::Wait, PBMoveRoute::SwitchOn, PBMoveRoute::SwitchOff,
PBMoveRoute::ChangeSpeed, PBMoveRoute::ChangeFreq, PBMoveRoute::Opacity,
PBMoveRoute::Blending, PBMoveRoute::PlaySE, PBMoveRoute::Script
when PBMoveRoute::WAIT, PBMoveRoute::SWITCH_ON, PBMoveRoute::SWITCH_OFF,
PBMoveRoute::CHANGE_SPEED, PBMoveRoute::CHANGE_FREQUENCY, PBMoveRoute::OPACITY,
PBMoveRoute::BLENDING, PBMoveRoute::PLAY_SE, PBMoveRoute::SCRIPT
route.list.push(RPG::MoveCommand.new(commands[i], [commands[i + 1]]))
i += 1
when PBMoveRoute::ScriptAsync
route.list.push(RPG::MoveCommand.new(PBMoveRoute::Script, [commands[i + 1]]))
route.list.push(RPG::MoveCommand.new(PBMoveRoute::Wait, [0]))
when PBMoveRoute::SCRIPT_ASYNC
route.list.push(RPG::MoveCommand.new(PBMoveRoute::SCRIPT, [commands[i + 1]]))
route.list.push(RPG::MoveCommand.new(PBMoveRoute::WAIT, [0]))
i += 1
when PBMoveRoute::Jump
when PBMoveRoute::JUMP
route.list.push(RPG::MoveCommand.new(commands[i], [commands[i + 1], commands[i + 2]]))
i += 2
when PBMoveRoute::Graphic
when PBMoveRoute::GRAPHIC
route.list.push(RPG::MoveCommand.new(commands[i],
[commands[i + 1], commands[i + 2],
commands[i + 3], commands[i + 4]]))
@@ -527,7 +527,7 @@ def pbMoveRoute(event, commands, waitComplete = false)
end
i += 1
end
route.list.push(RPG::MoveCommand.new(PBMoveRoute::ThroughOff))
route.list.push(RPG::MoveCommand.new(PBMoveRoute::THROUGH_OFF))
route.list.push(RPG::MoveCommand.new(0))
event&.force_move_route(route)
return route

View File

@@ -390,12 +390,10 @@ class WildBattle
$game_temp.clear_battle_rules
# Perform the battle itself
outcome = 0
pbBattleAnimation(pbGetWildBattleBGM(foe_party), (foe_party.length == 1) ? 0 : 2, foe_party) {
pbSceneStandby {
outcome = battle.pbStartBattle
}
pbBattleAnimation(pbGetWildBattleBGM(foe_party), (foe_party.length == 1) ? 0 : 2, foe_party) do
pbSceneStandby { outcome = battle.pbStartBattle }
BattleCreationHelperMethods.after_battle(outcome, can_lose)
}
end
Input.update
# Save the result of the battle in a Game Variable (1 by default)
BattleCreationHelperMethods.set_outcome(outcome, outcome_variable)
@@ -512,12 +510,10 @@ class TrainerBattle
$game_temp.clear_battle_rules
# Perform the battle itself
outcome = 0
pbBattleAnimation(pbGetTrainerBattleBGM(foe_trainers), (battle.singleBattle?) ? 1 : 3, foe_trainers) {
pbSceneStandby {
outcome = battle.pbStartBattle
}
pbBattleAnimation(pbGetTrainerBattleBGM(foe_trainers), (battle.singleBattle?) ? 1 : 3, foe_trainers) do
pbSceneStandby { outcome = battle.pbStartBattle }
BattleCreationHelperMethods.after_battle(outcome, can_lose)
}
end
Input.update
# Save the result of the battle in a Game Variable (1 by default)
BattleCreationHelperMethods.set_outcome(outcome, outcome_variable, true)

View File

@@ -219,9 +219,7 @@ HiddenMoveHandlers::UseMove.add(:CUT, proc { |move, pokemon|
end
$stats.cut_count += 1
facingEvent = $game_player.pbFacingEvent
if facingEvent
pbSmashEvent(facingEvent)
end
pbSmashEvent(facingEvent) if facingEvent
next true
})
@@ -232,13 +230,10 @@ def pbSmashEvent(event)
elsif event.name[/smashrock/i]
pbSEPlay("Rock Smash", 80)
end
pbMoveRoute(event, [PBMoveRoute::Wait, 2,
PBMoveRoute::TurnLeft,
PBMoveRoute::Wait, 2,
PBMoveRoute::TurnRight,
PBMoveRoute::Wait, 2,
PBMoveRoute::TurnUp,
PBMoveRoute::Wait, 2])
pbMoveRoute(event, [PBMoveRoute::WAIT, 2,
PBMoveRoute::TURN_LEFT, PBMoveRoute::WAIT, 2,
PBMoveRoute::TURN_RIGHT, PBMoveRoute::WAIT, 2,
PBMoveRoute::TURN_UP, PBMoveRoute::WAIT, 2])
pbWait(Graphics.frame_rate * 4 / 10)
event.erase
$PokemonMap&.addErasedEvent(event.id)
@@ -273,7 +268,7 @@ HiddenMoveHandlers::UseMove.add(:DIG, proc { |move, pokemon|
if !pbHiddenMoveAnimation(pokemon)
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
end
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = escape[0]
$game_temp.player_new_x = escape[1]
$game_temp.player_new_y = escape[2]
@@ -282,7 +277,7 @@ HiddenMoveHandlers::UseMove.add(:DIG, proc { |move, pokemon|
$scene.transfer_player
$game_map.autoplay
$game_map.refresh
}
end
pbEraseEscapePoint
next true
end
@@ -306,7 +301,7 @@ def pbDive
speciesname = (movefinder) ? movefinder.name : $player.name
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
pbHiddenMoveAnimation(movefinder)
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = map_metadata.dive_map_id
$game_temp.player_new_x = $game_player.x
$game_temp.player_new_y = $game_player.y
@@ -318,7 +313,7 @@ def pbDive
$scene.transfer_player(false)
$game_map.autoplay
$game_map.refresh
}
end
return true
end
return false
@@ -344,7 +339,7 @@ def pbSurfacing
speciesname = (movefinder) ? movefinder.name : $player.name
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
pbHiddenMoveAnimation(movefinder)
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = surface_map_id
$game_temp.player_new_x = $game_player.x
$game_temp.player_new_y = $game_player.y
@@ -356,7 +351,7 @@ def pbSurfacing
surfbgm = GameData::Metadata.get.surf_BGM
(surfbgm) ? pbBGMPlay(surfbgm) : $game_map.autoplayAsCue
$game_map.refresh
}
end
return true
end
return false
@@ -365,7 +360,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')
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = mapid
$game_temp.player_new_x = x
$game_temp.player_new_y = y
@@ -373,7 +368,7 @@ def pbTransferUnderwater(mapid, x, y, direction = $game_player.direction)
$scene.transfer_player(false)
$game_map.autoplay
$game_map.refresh
}
end
end
EventHandlers.add(:on_player_interact, :diving,
@@ -438,7 +433,7 @@ HiddenMoveHandlers::UseMove.add(:DIVE, proc { |move, pokemon|
if !pbHiddenMoveAnimation(pokemon)
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
end
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = dive_map_id
$game_temp.player_new_x = $game_player.x
$game_temp.player_new_y = $game_player.y
@@ -449,7 +444,7 @@ HiddenMoveHandlers::UseMove.add(:DIVE, proc { |move, pokemon|
$scene.transfer_player(false)
$game_map.autoplay
$game_map.refresh
}
end
next true
})
@@ -518,7 +513,7 @@ def pbFlyToNewLocation(pkmn = nil, move = :FLY)
pbMessage(_INTL("{1} used {2}!", name, GameData::Move.get(move).name))
end
$stats.fly_count += 1
pbFadeOutIn {
pbFadeOutIn do
pbSEPlay("Fly")
$game_temp.player_new_map_id = $game_temp.fly_destination[0]
$game_temp.player_new_x = $game_temp.fly_destination[1]
@@ -531,7 +526,7 @@ def pbFlyToNewLocation(pkmn = nil, move = :FLY)
$game_map.refresh
yield if block_given?
pbWait(Graphics.frame_rate / 4)
}
end
pbEraseEscapePoint
return true
end
@@ -763,7 +758,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')
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = mapid
$game_temp.player_new_x = xcoord
$game_temp.player_new_y = ycoord
@@ -771,7 +766,7 @@ def pbTransferSurfing(mapid, xcoord, ycoord, direction = $game_player.direction)
$scene.transfer_player(false)
$game_map.autoplay
$game_map.refresh
}
end
end
EventHandlers.add(:on_player_interact, :start_surfing,
@@ -923,7 +918,7 @@ HiddenMoveHandlers::UseMove.add(:TELEPORT, proc { |move, pokemon|
if !pbHiddenMoveAnimation(pokemon)
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
end
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = healing[0]
$game_temp.player_new_x = healing[1]
$game_temp.player_new_y = healing[2]
@@ -932,7 +927,7 @@ HiddenMoveHandlers::UseMove.add(:TELEPORT, proc { |move, pokemon|
$scene.transfer_player
$game_map.autoplay
$game_map.refresh
}
end
pbEraseEscapePoint
next true
})

View File

@@ -50,33 +50,27 @@ def pbFishing(hasEncounter, rodType = 1)
message = ""
time.times { message += ". " }
if pbWaitMessage(msgWindow, time)
pbFishingEnd {
pbMessageDisplay(msgWindow, _INTL("Not even a nibble..."))
}
pbFishingEnd { pbMessageDisplay(msgWindow, _INTL("Not even a nibble...")) }
break
end
if hasEncounter && rand(100) < biteChance
$scene.spriteset.addUserAnimation(Settings::EXCLAMATION_ANIMATION_ID, $game_player.x, $game_player.y, true, 3)
frames = Graphics.frame_rate - rand(Graphics.frame_rate / 2) # 0.5-1 second
if !pbWaitForInput(msgWindow, message + _INTL("\r\nOh! A bite!"), frames)
pbFishingEnd {
pbMessageDisplay(msgWindow, _INTL("The Pokémon got away..."))
}
pbFishingEnd { pbMessageDisplay(msgWindow, _INTL("The Pokémon got away...")) }
break
end
if Settings::FISHING_AUTO_HOOK || rand(100) < hookChance
pbFishingEnd {
pbFishingEnd do
pbMessageDisplay(msgWindow, _INTL("Landed a Pokémon!")) if !Settings::FISHING_AUTO_HOOK
}
end
ret = true
break
end
# biteChance += 15
# hookChance += 15
else
pbFishingEnd {
pbMessageDisplay(msgWindow, _INTL("Not even a nibble..."))
}
pbFishingEnd { pbMessageDisplay(msgWindow, _INTL("Not even a nibble...")) }
break
end
end

View File

@@ -381,11 +381,11 @@ def pbBerryPlant
[_INTL("Fertilize"), _INTL("Plant Berry"), _INTL("Exit")], -1)
when 0 # Fertilize
mulch = nil
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
mulch = screen.pbChooseItemScreen(proc { |item| GameData::Item.get(item).is_mulch? })
}
end
return if !mulch
mulch_data = GameData::Item.get(mulch)
if mulch_data.is_mulch?
@@ -408,11 +408,11 @@ def pbBerryPlant
ask_to_plant = false
end
if !ask_to_plant || pbConfirmMessage(_INTL("Want to plant a Berry?"))
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
berry = screen.pbChooseItemScreen(proc { |item| GameData::Item.get(item).is_berry? })
}
end
if berry
$stats.berries_planted += 1
berry_plant.plant(berry)

View File

@@ -404,7 +404,7 @@ class DayCare
end
end
#=============================================================================
#-----------------------------------------------------------------------------
def self.count
return $PokemonGlobal.day_care.count
@@ -494,7 +494,7 @@ class DayCare
day_care.reset_egg_counters
end
#=============================================================================
#-----------------------------------------------------------------------------
private

View File

@@ -512,8 +512,8 @@ module RandomDungeon
start = nil
maxWidth = @usable_width - (@buffer_x * 2)
maxHeight = @usable_height - (@buffer_y * 2)
for y in 0...maxHeight
for x in 0...maxWidth
maxHeight.times do |y|
maxWidth.times do |x|
next if !tile_is_ground?(@map_data[x + @buffer_x, y + @buffer_y, 0])
start = [x, y]
break
@@ -535,10 +535,10 @@ module RandomDungeon
checking = to_check.shift
x1, x2, y, dy = checking
x = x1
if !visited[y * maxWidth + x] && tile_is_ground?(@map_data[x + @buffer_x, y + @buffer_y, 0])
if !visited[(y * maxWidth) + x] && tile_is_ground?(@map_data[x + @buffer_x, y + @buffer_y, 0])
loop do
break if visited[y * maxWidth + x - 1] || !tile_is_ground?(@map_data[x - 1 + @buffer_x, y + @buffer_y, 0])
visited[y * maxWidth + x - 1] = true
break if visited[(y * maxWidth) + x - 1] || !tile_is_ground?(@map_data[x - 1 + @buffer_x, y + @buffer_y, 0])
visited[(y * maxWidth) + x - 1] = true
x -= 1
end
end
@@ -546,8 +546,8 @@ module RandomDungeon
loop do
break if x1 > x2
loop do
break if visited[y * maxWidth + x1] || !tile_is_ground?(@map_data[x1 + @buffer_x, y + @buffer_y, 0])
visited[y * maxWidth + x1] = true
break if visited[(y * maxWidth) + x1] || !tile_is_ground?(@map_data[x1 + @buffer_x, y + @buffer_y, 0])
visited[(y * maxWidth) + x1] = true
to_check.push([x, x1, y + dy, dy])
to_check.push([x2 + 1, x1, y - dy, -dy]) if x1 > x2
x1 += 1
@@ -555,16 +555,16 @@ module RandomDungeon
x1 += 1
loop do
break if x1 >= x2
break if !visited[y * maxWidth + x1] && tile_is_ground?(@map_data[x1 + @buffer_x, y + @buffer_y, 0])
break if !visited[(y * maxWidth) + x1] && tile_is_ground?(@map_data[x1 + @buffer_x, y + @buffer_y, 0])
x1 += 1
end
x = x1
end
end
# Check for unflooded floor tiles
for y in 0...maxHeight
for x in 0...maxWidth
next if visited[y * maxWidth + x] || !tile_is_ground?(@map_data[x + @buffer_x, y + @buffer_y, 0])
maxHeight.times do |y|
maxWidth.times do |x|
next if visited[(y * maxWidth) + x] || !tile_is_ground?(@map_data[x + @buffer_x, y + @buffer_y, 0])
@need_redraw = true
break
end
@@ -824,9 +824,9 @@ module RandomDungeon
def get_wall_tile_for_coord(x, y, layer = 0)
if layer == 0
is_neighbour = lambda { |x, y| return tile_is_ground?(@map_data.value(x, y)) }
is_neighbour = lambda { |x2, y2| return tile_is_ground?(@map_data.value(x2, y2)) }
else
is_neighbour = lambda { |x, y| return tile_is_wall?(@map_data[x, y, 1]) }
is_neighbour = lambda { |x2, y2| return tile_is_wall?(@map_data[x2, y2, 1]) }
end
neighbours = 0
neighbours |= 0x01 if is_neighbour.call(x, y - 1) # N
@@ -863,8 +863,8 @@ module RandomDungeon
(maxWidth / @parameters.cell_width).times do |i|
next if rand(100) >= @parameters.floor_patch_chance
# Random placing of floor patch tiles
mid_x = i * @parameters.cell_width + rand(@parameters.cell_width)
mid_y = j * @parameters.cell_height + rand(@parameters.cell_height)
mid_x = (i * @parameters.cell_width) + rand(@parameters.cell_width)
mid_y = (j * @parameters.cell_height) + rand(@parameters.cell_height)
((mid_y - @parameters.floor_patch_radius)..(mid_y + @parameters.floor_patch_radius)).each do |y|
((mid_x - @parameters.floor_patch_radius)..(mid_x + @parameters.floor_patch_radius)).each do |x|
if @tileset.floor_patch_under_walls
@@ -989,7 +989,7 @@ module RandomDungeon
when :void_decoration_large, :floor_decoration_large
4.times do |c|
tile = @tileset.get_random_tile_of_type(tile_type, self, i, j, layer)
tile += (c % 2) + 8 * (c / 2) if tile >= 384 # Regular tile
tile += (c % 2) + (8 * (c / 2)) if tile >= 384 # Regular tile
map.data[i + (c % 2), j + (c / 2), layer] = tile
end
else