mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-01-22 14:26:01 +00:00
Yet more Rubocopping
This commit is contained in:
@@ -142,7 +142,7 @@ end
|
||||
def pbToneChangeAll(tone, duration)
|
||||
$game_screen.start_tone_change(tone, duration * Graphics.frame_rate / 20)
|
||||
$game_screen.pictures.each do |picture|
|
||||
picture.start_tone_change(tone, duration * Graphics.frame_rate / 20) if picture
|
||||
picture&.start_tone_change(tone, duration * Graphics.frame_rate / 20)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -61,11 +61,10 @@ class Game_System
|
||||
|
||||
def bgm_play_internal(bgm, position) # :nodoc:
|
||||
@bgm_position = position if !@bgm_paused
|
||||
@playing_bgm = (bgm == nil) ? nil : bgm.clone
|
||||
@playing_bgm = bgm&.clone
|
||||
if bgm != nil && bgm.name != ""
|
||||
if FileTest.audio_exist?("Audio/BGM/" + bgm.name)
|
||||
bgm_play_internal2("Audio/BGM/" + bgm.name,
|
||||
bgm.volume, bgm.pitch, @bgm_position) if !@defaultBGM
|
||||
if !@defaultBGM && FileTest.audio_exist?("Audio/BGM/" + bgm.name)
|
||||
bgm_play_internal2("Audio/BGM/" + bgm.name, bgm.volume, bgm.pitch, @bgm_position)
|
||||
end
|
||||
else
|
||||
@bgm_position = position if !@bgm_paused
|
||||
@@ -161,7 +160,7 @@ class Game_System
|
||||
################################################################################
|
||||
|
||||
def bgs_play(bgs)
|
||||
@playing_bgs = (bgs == nil) ? nil : bgs.clone
|
||||
@playing_bgs = (bgs.nil?) ? nil : bgs.clone
|
||||
if bgs != nil && bgs.name != ""
|
||||
if FileTest.audio_exist?("Audio/BGS/" + bgs.name)
|
||||
vol = bgs.volume
|
||||
@@ -258,7 +257,7 @@ class Game_System
|
||||
################################################################################
|
||||
|
||||
def windowskin_name
|
||||
if @windowskin_name == nil
|
||||
if @windowskin_name.nil?
|
||||
return $data_system.windowskin_name
|
||||
else
|
||||
return @windowskin_name
|
||||
|
||||
@@ -66,7 +66,7 @@ class Game_Picture
|
||||
@zoom_x = zoom_x.to_f
|
||||
@zoom_y = zoom_y.to_f
|
||||
@opacity = opacity.to_f
|
||||
@blend_type = blend_type ? blend_type : 0
|
||||
@blend_type = blend_type || 0
|
||||
@duration = 0
|
||||
@target_x = @x
|
||||
@target_y = @y
|
||||
@@ -98,7 +98,7 @@ class Game_Picture
|
||||
@target_zoom_x = zoom_x.to_f
|
||||
@target_zoom_y = zoom_y.to_f
|
||||
@target_opacity = opacity.to_f
|
||||
@blend_type = blend_type ? blend_type : 0
|
||||
@blend_type = blend_type || 0
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Rotation Speed
|
||||
|
||||
@@ -193,7 +193,7 @@ class Game_Map
|
||||
if self_event != nil && terrain.can_surf_freely
|
||||
[2, 1, 0].each do |j|
|
||||
facing_tile_id = data[newx, newy, j]
|
||||
return false if facing_tile_id == nil
|
||||
return false if facing_tile_id.nil?
|
||||
facing_terrain = GameData::TerrainTag.try_get(@terrain_tags[facing_tile_id])
|
||||
if facing_terrain.id != :None && !facing_terrain.ignore_passability
|
||||
return facing_terrain.can_surf_freely
|
||||
@@ -207,7 +207,7 @@ class Game_Map
|
||||
# Can't walk onto ledges
|
||||
[2, 1, 0].each do |j|
|
||||
facing_tile_id = data[newx, newy, j]
|
||||
return false if facing_tile_id == nil
|
||||
return false if facing_tile_id.nil?
|
||||
facing_terrain = GameData::TerrainTag.try_get(@terrain_tags[facing_tile_id])
|
||||
return false if facing_terrain.ledge
|
||||
break if facing_terrain.id != :None && !facing_terrain.ignore_passability
|
||||
@@ -326,7 +326,7 @@ class Game_Map
|
||||
max_x = (self.width - (Graphics.width.to_f / TILE_WIDTH)) * REAL_RES_X
|
||||
@display_x = [0, [@display_x, max_x].min].max
|
||||
end
|
||||
$map_factory.setMapsInRange if $map_factory
|
||||
$map_factory&.setMapsInRange
|
||||
end
|
||||
|
||||
def display_y=(value)
|
||||
@@ -336,7 +336,7 @@ class Game_Map
|
||||
max_y = (self.height - (Graphics.height.to_f / TILE_HEIGHT)) * REAL_RES_Y
|
||||
@display_y = [0, [@display_y, max_y].min].max
|
||||
end
|
||||
$map_factory.setMapsInRange if $map_factory
|
||||
$map_factory&.setMapsInRange
|
||||
end
|
||||
|
||||
def scroll_up(distance)
|
||||
|
||||
@@ -93,7 +93,22 @@ class Interpreter
|
||||
max_y = ($game_map.height - (Graphics.height.to_f / Game_Map::TILE_HEIGHT)) * 4 * Game_Map::TILE_HEIGHT
|
||||
count_x = ($game_map.display_x - [0, [(x * Game_Map::REAL_RES_X) - center_x, max_x].min].max) / Game_Map::REAL_RES_X
|
||||
count_y = ($game_map.display_y - [0, [(y * Game_Map::REAL_RES_Y) - center_y, max_y].min].max) / Game_Map::REAL_RES_Y
|
||||
if !@diag
|
||||
if @diag
|
||||
@diag = false
|
||||
dir = nil
|
||||
if count_x != 0 && count_y != 0
|
||||
return false
|
||||
elsif count_x > 0
|
||||
dir = 4
|
||||
elsif count_x < 0
|
||||
dir = 6
|
||||
elsif count_y > 0
|
||||
dir = 8
|
||||
elsif count_y < 0
|
||||
dir = 2
|
||||
end
|
||||
count = count_x == 0 ? count_y.abs : count_x.abs
|
||||
else
|
||||
@diag = true
|
||||
dir = nil
|
||||
if count_x > 0
|
||||
@@ -110,21 +125,6 @@ class Interpreter
|
||||
end
|
||||
end
|
||||
count = [count_x.abs, count_y.abs].min
|
||||
else
|
||||
@diag = false
|
||||
dir = nil
|
||||
if count_x != 0 && count_y != 0
|
||||
return false
|
||||
elsif count_x > 0
|
||||
dir = 4
|
||||
elsif count_x < 0
|
||||
dir = 6
|
||||
elsif count_y > 0
|
||||
dir = 8
|
||||
elsif count_y < 0
|
||||
dir = 2
|
||||
end
|
||||
count = count_x != 0 ? count_x.abs : count_y.abs
|
||||
end
|
||||
$game_map.start_scroll(dir, count, speed) if dir != nil
|
||||
if @diag
|
||||
|
||||
@@ -185,10 +185,10 @@ class PokemonMapFactory
|
||||
return false if !event.through && event.character_name != ""
|
||||
end
|
||||
# Check passability of player
|
||||
if !thisEvent.is_a?(Game_Player)
|
||||
if $game_map.map_id == mapID && $game_player.x == x && $game_player.y == y
|
||||
return false if !$game_player.through && $game_player.character_name != ""
|
||||
end
|
||||
if !thisEvent.is_a?(Game_Player) &&
|
||||
$game_map.map_id == mapID && $game_player.x == x && $game_player.y == y &&
|
||||
!$game_player.through && $game_player.character_name != ""
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -201,8 +201,8 @@ class PokemonMapFactory
|
||||
return false if !map.valid?(x, y)
|
||||
return true if thisEvent.through
|
||||
if thisEvent == $game_player
|
||||
if !($DEBUG && Input.press?(Input::CTRL))
|
||||
return false if !map.passableStrict?(x, y, 0, thisEvent)
|
||||
if !($DEBUG && Input.press?(Input::CTRL)) && !map.passableStrict?(x, y, 0, thisEvent)
|
||||
return false
|
||||
end
|
||||
elsif !map.passableStrict?(x, y, 0, thisEvent)
|
||||
return false
|
||||
@@ -289,12 +289,12 @@ class PokemonMapFactory
|
||||
|
||||
# NOTE: Assumes the event is 1x1 tile in size. Only returns one tile.
|
||||
def getFacingTile(direction = nil, event = nil, steps = 1)
|
||||
event = $game_player if event == nil
|
||||
event = $game_player if event.nil?
|
||||
return [0, 0, 0] if !event
|
||||
x = event.x
|
||||
y = event.y
|
||||
id = event.map.map_id
|
||||
direction = event.direction if direction == nil
|
||||
direction = event.direction if direction.nil?
|
||||
return getFacingTileFromPos(id, x, y, direction, steps)
|
||||
end
|
||||
|
||||
@@ -511,6 +511,6 @@ end
|
||||
def updateTilesets
|
||||
maps = $map_factory.maps
|
||||
maps.each do |map|
|
||||
map.updateTileset if map
|
||||
map&.updateTileset
|
||||
end
|
||||
end
|
||||
|
||||
@@ -244,8 +244,9 @@ class Game_Character
|
||||
next if self == event || !event.at_coordinate?(new_x, new_y) || event.through
|
||||
return false if self != $game_player || event.character_name != ""
|
||||
end
|
||||
if $game_player.x == new_x && $game_player.y == new_y
|
||||
return false if !$game_player.through && @character_name != ""
|
||||
if $game_player.x == new_x && $game_player.y == new_y &&
|
||||
!$game_player.through && @character_name != ""
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -356,7 +357,7 @@ class Game_Character
|
||||
end
|
||||
|
||||
def force_move_route(move_route)
|
||||
if @original_move_route == nil
|
||||
if @original_move_route.nil?
|
||||
@original_move_route = @move_route
|
||||
@original_move_route_index = @move_route_index
|
||||
end
|
||||
|
||||
@@ -99,7 +99,7 @@ class Game_Event < Game_Character
|
||||
return $PokemonGlobal.eventvars[[@map_id, @event.id]].to_i
|
||||
end
|
||||
|
||||
def expired?(secs = 86400)
|
||||
def expired?(secs = 86_400)
|
||||
ontime = self.variable
|
||||
time = pbGetTimeNow
|
||||
return ontime && (time.to_i > ontime + secs)
|
||||
@@ -109,8 +109,8 @@ class Game_Event < Game_Character
|
||||
ontime = self.variable.to_i
|
||||
return false if !ontime
|
||||
now = pbGetTimeNow
|
||||
elapsed = (now.to_i - ontime) / 86400
|
||||
elapsed += 1 if (now.to_i - ontime) % 86400 > ((now.hour * 3600) + (now.min * 60) + now.sec)
|
||||
elapsed = (now.to_i - ontime) / 86_400
|
||||
elapsed += 1 if (now.to_i - ontime) % 86_400 > ((now.hour * 3600) + (now.min * 60) + now.sec)
|
||||
return elapsed >= days
|
||||
end
|
||||
|
||||
@@ -141,12 +141,12 @@ class Game_Event < Game_Character
|
||||
|
||||
def pbCheckEventTriggerAfterTurning
|
||||
return if $game_system.map_interpreter.running? || @starting
|
||||
if @event.name[/trainer\((\d+)\)/i]
|
||||
distance = $~[1].to_i
|
||||
if @trigger == 2 && pbEventCanReachPlayer?(self, $game_player, distance)
|
||||
start if !jumping? && !over_trigger?
|
||||
end
|
||||
end
|
||||
return if @trigger != 2 # Event touch
|
||||
return if !@event.name[/trainer\((\d+)\)/i]
|
||||
distance = $~[1].to_i
|
||||
return if !pbEventCanReachPlayer?(self, $game_player, distance)
|
||||
return if jumping? || over_trigger?
|
||||
start
|
||||
end
|
||||
|
||||
def check_event_trigger_touch(dir)
|
||||
@@ -170,8 +170,8 @@ class Game_Event < Game_Character
|
||||
def check_event_trigger_auto
|
||||
case @trigger
|
||||
when 2 # Event touch
|
||||
if at_coordinate?($game_player.x, $game_player.y)
|
||||
start if !jumping? && over_trigger?
|
||||
if at_coordinate?($game_player.x, $game_player.y) && !jumping? && over_trigger?
|
||||
start
|
||||
end
|
||||
when 3 # Autorun
|
||||
start
|
||||
@@ -197,7 +197,7 @@ class Game_Event < Game_Character
|
||||
return if new_page == @page
|
||||
@page = new_page
|
||||
clear_starting
|
||||
if @page == nil
|
||||
if @page.nil?
|
||||
@tile_id = 0
|
||||
@character_name = ""
|
||||
@character_hue = 0
|
||||
|
||||
@@ -185,13 +185,12 @@ class Game_Player < Game_Character
|
||||
return result if checkIfRunning && $game_system.map_interpreter.running?
|
||||
# All event loops
|
||||
$game_map.events.values.each do |event|
|
||||
next if !triggers.include?(event.trigger)
|
||||
next if !event.name[/trainer\((\d+)\)/i]
|
||||
distance = $~[1].to_i
|
||||
# If event coordinates and triggers are consistent
|
||||
if pbEventCanReachPlayer?(event, self, distance) && triggers.include?(event.trigger)
|
||||
# If starting determinant is front event (other than jumping)
|
||||
result.push(event) if !event.jumping? && !event.over_trigger?
|
||||
end
|
||||
next if !pbEventCanReachPlayer?(event, self, distance)
|
||||
next if event.jumping? || event.over_trigger?
|
||||
result.push(event)
|
||||
end
|
||||
return result
|
||||
end
|
||||
@@ -202,13 +201,12 @@ class Game_Player < Game_Character
|
||||
return result if checkIfRunning && $game_system.map_interpreter.running?
|
||||
# All event loops
|
||||
$game_map.events.values.each do |event|
|
||||
next if !triggers.include?(event.trigger)
|
||||
next if !event.name[/counter\((\d+)\)/i]
|
||||
distance = $~[1].to_i
|
||||
# If event coordinates and triggers are consistent
|
||||
if pbEventFacesPlayer?(event, self, distance) && triggers.include?(event.trigger)
|
||||
# If starting determinant is front event (other than jumping)
|
||||
result.push(event) if !event.jumping? && !event.over_trigger?
|
||||
end
|
||||
next if !pbEventFacesPlayer?(event, self, distance)
|
||||
next if event.jumping? || event.over_trigger?
|
||||
result.push(event)
|
||||
end
|
||||
return result
|
||||
end
|
||||
@@ -355,32 +353,29 @@ class Game_Player < Game_Character
|
||||
return false if !$game_map.valid?(new_x, new_y)
|
||||
# All event loops
|
||||
$game_map.events.values.each do |event|
|
||||
next if !triggers.include?(event.trigger)
|
||||
# If event coordinates and triggers are consistent
|
||||
next if !event.at_coordinate?(new_x, new_y)
|
||||
next if !triggers.include?(event.trigger)
|
||||
# If starting determinant is front event (other than jumping)
|
||||
next if event.jumping? || event.over_trigger?
|
||||
event.start
|
||||
result = true
|
||||
end
|
||||
# If fitting event is not found
|
||||
if result == false
|
||||
# If front tile is a counter
|
||||
if $game_map.counter?(new_x, new_y)
|
||||
# Calculate coordinates of 1 tile further away
|
||||
new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
|
||||
new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
|
||||
return false if !$game_map.valid?(new_x, new_y)
|
||||
# All event loops
|
||||
$game_map.events.values.each do |event|
|
||||
# If event coordinates and triggers are consistent
|
||||
next if !event.at_coordinate?(new_x, new_y)
|
||||
next if !triggers.include?(event.trigger)
|
||||
# If starting determinant is front event (other than jumping)
|
||||
next if event.jumping? || event.over_trigger?
|
||||
event.start
|
||||
result = true
|
||||
end
|
||||
if result == false && $game_map.counter?(new_x, new_y)
|
||||
# Calculate coordinates of 1 tile further away
|
||||
new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
|
||||
new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
|
||||
return false if !$game_map.valid?(new_x, new_y)
|
||||
# All event loops
|
||||
$game_map.events.values.each do |event|
|
||||
next if !triggers.include?(event.trigger)
|
||||
# If event coordinates and triggers are consistent
|
||||
next if !event.at_coordinate?(new_x, new_y)
|
||||
# If starting determinant is front event (other than jumping)
|
||||
next if event.jumping? || event.over_trigger?
|
||||
event.start
|
||||
result = true
|
||||
end
|
||||
end
|
||||
return result
|
||||
@@ -559,11 +554,10 @@ end
|
||||
def pbGetPlayerCharset(charset, trainer = nil, force = false)
|
||||
trainer = $player if !trainer
|
||||
outfit = (trainer) ? trainer.outfit : 0
|
||||
if $game_player && $game_player.charsetData && !force
|
||||
return nil if $game_player.charsetData[0] == trainer.character_ID &&
|
||||
$game_player.charsetData[1] == charset &&
|
||||
$game_player.charsetData[2] == outfit
|
||||
end
|
||||
return nil if !force && $game_player&.charsetData &&
|
||||
$game_player.charsetData[0] == trainer.character_ID &&
|
||||
$game_player.charsetData[1] == charset &&
|
||||
$game_player.charsetData[2] == outfit
|
||||
$game_player.charsetData = [trainer.character_ID, charset, outfit] if $game_player
|
||||
ret = charset
|
||||
if pbResolveBitmap("Graphics/Characters/" + ret + "_" + outfit.to_s)
|
||||
|
||||
@@ -56,7 +56,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
|
||||
if @interpreter.nil?
|
||||
@interpreter = Interpreter.new
|
||||
end
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user