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

@@ -40,9 +40,7 @@ class Game_Screen
def start_tone_change(tone, duration)
@tone_target = tone.clone
@tone_duration = duration
if @tone_duration == 0
@tone = @tone_target.clone
end
@tone = @tone_target.clone if @tone_duration == 0
end
def start_flash(color, duration)

View File

@@ -103,9 +103,7 @@ class Game_Picture
def start_tone_change(tone, duration)
@tone_target = tone.clone
@tone_duration = duration
if @tone_duration == 0
@tone = @tone_target.clone
end
@tone = @tone_target.clone if @tone_duration == 0
end
# Erase Picture

View File

@@ -371,17 +371,13 @@ class Game_Map
def start_fog_tone_change(tone, duration)
@fog_tone_target = tone.clone
@fog_tone_duration = duration
if @fog_tone_duration == 0
@fog_tone = @fog_tone_target.clone
end
@fog_tone = @fog_tone_target.clone if @fog_tone_duration == 0
end
def start_fog_opacity_change(opacity, duration)
@fog_opacity_target = opacity.to_f
@fog_opacity_duration = duration
if @fog_opacity_duration == 0
@fog_opacity = @fog_opacity_target
end
@fog_opacity = @fog_opacity_target if @fog_opacity_duration == 0
end
def set_tile(x, y, layer, id = 0)

View File

@@ -5,69 +5,68 @@
# Version 1.02
# 2005-12-18
#===============================================================================
=begin
This script supplements the built-in "Scroll Map" event command with the
aim of simplifying cutscenes (and map scrolling in general). Whereas the
normal event command requires a direction and number of tiles to scroll,
Map Autoscroll scrolls the map to center on the tile whose x and y
coordinates are given.
FEATURES
- automatic map scrolling to given x,y coordinate (or player)
- destination is fixed, so it's possible to scroll to same place even if
origin is variable (e.g. moving NPC)
- variable speed (just like "Scroll Map" event command)
- diagonal scrolling supported
SETUP
Instead of a "Scroll Map" event command, use the "Call Script" command
and enter on the following on the first line:
autoscroll(x,y)
(replacing "x" and "y" with the x and y coordinates of the tile to scroll to)
To specify a scroll speed other than the default (4), use:
autoscroll(x,y,speed)
(now also replacing "speed" with the scroll speed from 1-6)
Diagonal scrolling happens automatically when the destination is diagonal
relative to the starting point (i.e., not directly up, down, left or right).
To scroll to the player, instead use the following:
autoscroll_player(speed)
Note: because of how the interpreter and the "Call Script" event command
are setup, the call to autoscroll(...) can only be on the first line of
the "Call Script" event command (and not flowing down to subsequent lines).
For example, the following call may not work as expected:
autoscroll($game_variables[1],
$game_variables[2])
(since the long argument names require dropping down to a second line)
A work-around is to setup new variables with shorter names in a preceding
(separate) "Call Script" event command:
@x = $game_variables[1]
@y = $game_variables[2]
and then use those as arguments:
autoscroll(@x,@y)
The renaming must be in a separate "Call Script" because otherwise
the call to autoscroll(...) isn't on the first line.
Originally requested by militantmilo80:
http://www.rmxp.net/forums/index.php?showtopic=29519
=end
#
# This script supplements the built-in "Scroll Map" event command with the
# aim of simplifying cutscenes (and map scrolling in general). Whereas the
# normal event command requires a direction and number of tiles to scroll,
# Map Autoscroll scrolls the map to center on the tile whose x and y
# coordinates are given.
#
# FEATURES
# - automatic map scrolling to given x,y coordinate (or player)
# - destination is fixed, so it's possible to scroll to same place even if
# origin is variable (e.g. moving NPC)
# - variable speed (just like "Scroll Map" event command)
# - diagonal scrolling supported
#
# SETUP
# Instead of a "Scroll Map" event command, use the "Call Script" command
# and enter on the following on the first line:
#
# autoscroll(x,y)
#
# (replacing "x" and "y" with the x and y coordinates of the tile to scroll to)
#
# To specify a scroll speed other than the default (4), use:
#
# autoscroll(x,y,speed)
#
# (now also replacing "speed" with the scroll speed from 1-6)
#
# Diagonal scrolling happens automatically when the destination is diagonal
# relative to the starting point (i.e., not directly up, down, left or right).
#
# To scroll to the player, instead use the following:
#
# autoscroll_player(speed)
#
# Note: because of how the interpreter and the "Call Script" event command
# are setup, the call to autoscroll(...) can only be on the first line of
# the "Call Script" event command (and not flowing down to subsequent lines).
#
# For example, the following call may not work as expected:
#
# autoscroll($game_variables[1],
# $game_variables[2])
#
# (since the long argument names require dropping down to a second line)
# A work-around is to setup new variables with shorter names in a preceding
# (separate) "Call Script" event command:
#
# @x = $game_variables[1]
# @y = $game_variables[2]
#
# and then use those as arguments:
#
# autoscroll(@x,@y)
#
# The renaming must be in a separate "Call Script" because otherwise
# the call to autoscroll(...) isn't on the first line.
#
# Originally requested by militantmilo80:
# http://www.rmxp.net/forums/index.php?showtopic=29519
#
#===============================================================================
#===============================================================================
#

View File

@@ -433,9 +433,9 @@ module MapFactoryHelper
end
def self.mapsConnected?(id1, id2)
MapFactoryHelper.eachConnectionForMap(id1) { |conn|
MapFactoryHelper.eachConnectionForMap(id1) do |conn|
return true if conn[0] == id2 || conn[3] == id2
}
end
return false
end

View File

@@ -237,9 +237,7 @@ class Game_Event < Game_Character
@trigger = @page.trigger
@list = @page.list
@interpreter = nil
if @trigger == 4 # Parallel Process
@interpreter = Interpreter.new
end
@interpreter = Interpreter.new if @trigger == 4 # Parallel Process
check_event_trigger_auto
end
@@ -262,18 +260,14 @@ class Game_Event < Game_Character
@moveto_happened = false
last_moving = moving?
super
if !moving? && last_moving
$game_player.pbCheckEventTriggerFromDistance([2])
end
$game_player.pbCheckEventTriggerFromDistance([2]) if !moving? && last_moving
if @need_refresh
@need_refresh = false
refresh
end
check_event_trigger_auto
if @interpreter
unless @interpreter.running?
@interpreter.setup(@list, @event.id, @map_id)
end
@interpreter.setup(@list, @event.id, @map_id) if !@interpreter.running?
@interpreter.update
end
end

View File

@@ -40,9 +40,7 @@ class Game_CommonEvent
def refresh
# Create an interpreter for parallel process if necessary
if self.trigger == 2 && switchIsOn?(self.switch_id)
if @interpreter.nil?
@interpreter = Interpreter.new
end
@interpreter = Interpreter.new if @interpreter.nil?
else
@interpreter = nil
end

View File

@@ -27,7 +27,7 @@ class Game_Follower < Game_Event
end
end
#=============================================================================
#-----------------------------------------------------------------------------
def move_through(direction)
old_through = @through
@@ -105,7 +105,7 @@ class Game_Follower < Game_Event
end
end
#=============================================================================
#-----------------------------------------------------------------------------
def turn_towards_leader(leader)
pbTurnTowardEvent(self, leader)
@@ -146,7 +146,7 @@ class Game_Follower < Game_Event
end
end
#=============================================================================
#-----------------------------------------------------------------------------
def update_move
was_jumping = jumping?
@@ -157,7 +157,7 @@ class Game_Follower < Game_Event
end
end
#=============================================================================
#-----------------------------------------------------------------------------
private

View File

@@ -84,7 +84,7 @@ class Game_FollowerFactory
@last_update = -1
end
#=============================================================================
#-----------------------------------------------------------------------------
def add_follower(event, name = nil, common_event_id = nil)
return if !event
@@ -150,7 +150,7 @@ class Game_FollowerFactory
$PokemonGlobal.followers.each_with_index { |follower, i| yield @events[i], follower }
end
#=============================================================================
#-----------------------------------------------------------------------------
def turn_followers
leader = $game_player
@@ -208,11 +208,11 @@ class Game_FollowerFactory
vector = $map_factory.getRelativePos(event.map.map_id, event.x, event.y,
leader[0], leader[1], leader[2])
if vector[0] != 0
move_route.prepend((vector[0] > 0) ? PBMoveRoute::Right : PBMoveRoute::Left)
move_route.prepend((vector[0] > 0) ? PBMoveRoute::RIGHT : PBMoveRoute::LEFT)
elsif vector[1] != 0
move_route.prepend((vector[1] > 0) ? PBMoveRoute::Down : PBMoveRoute::Up)
move_route.prepend((vector[1] > 0) ? PBMoveRoute::DOWN : PBMoveRoute::UP)
end
pbMoveRoute(event, move_route + [PBMoveRoute::Opacity, 0])
pbMoveRoute(event, move_route + [PBMoveRoute::OPACITY, 0])
end
end
@@ -237,7 +237,7 @@ class Game_FollowerFactory
end
end
#=============================================================================
#-----------------------------------------------------------------------------
def update
followers = $PokemonGlobal.followers
@@ -286,7 +286,7 @@ class Game_FollowerFactory
end
end
#=============================================================================
#-----------------------------------------------------------------------------
private