Added decent spacing to all scripts thanks to Rubocop

This commit is contained in:
Maruno17
2021-12-18 15:25:40 +00:00
parent f7b76ae62e
commit d17fc40a47
207 changed files with 18577 additions and 18587 deletions

View File

@@ -4,10 +4,10 @@
class LocationWindow
def initialize(name)
@window = Window_AdvancedTextPokemon.new(name)
@window.resizeToFit(name,Graphics.width)
@window.resizeToFit(name, Graphics.width)
@window.x = 0
@window.y = -@window.height
@window.viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@window.viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@window.viewport.z = 99999
@currentmap = $game_map.map_id
@frames = 0
@@ -24,15 +24,15 @@ class LocationWindow
def update
return if @window.disposed?
@window.update
if $game_temp.message_window_showing || @currentmap!=$game_map.map_id
if $game_temp.message_window_showing || @currentmap != $game_map.map_id
@window.dispose
return
end
if @frames > Graphics.frame_rate * 2
@window.y -= 4
@window.dispose if @window.y+@window.height<0
@window.dispose if @window.y + @window.height < 0
else
@window.y += 4 if @window.y<0
@window.y += 4 if @window.y < 0
@frames += 1
end
end
@@ -48,7 +48,7 @@ class DarknessSprite < SpriteWrapper
def initialize(viewport = nil)
super(viewport)
@darkness = BitmapWrapper.new(Graphics.width,Graphics.height)
@darkness = BitmapWrapper.new(Graphics.width, Graphics.height)
@radius = radiusMin
self.bitmap = @darkness
self.z = 99998
@@ -69,18 +69,18 @@ class DarknessSprite < SpriteWrapper
end
def refresh
@darkness.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(0,0,0,255))
cx = Graphics.width/2
cy = Graphics.height/2
@darkness.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0, 255))
cx = Graphics.width / 2
cy = Graphics.height / 2
cradius = @radius
numfades = 5
for i in 1..numfades
for j in cx-cradius..cx+cradius
for j in cx - cradius..cx + cradius
diff2 = (cradius * cradius) - ((j - cx) * (j - cx))
diff = Math.sqrt(diff2)
@darkness.fill_rect(j,cy-diff,1,diff*2,Color.new(0,0,0,255.0*(numfades-i)/numfades))
@darkness.fill_rect(j, cy - diff, 1, diff * 2, Color.new(0, 0, 0, 255.0 * (numfades - i) / numfades))
end
cradius = (cradius*0.9).floor
cradius = (cradius * 0.9).floor
end
end
end
@@ -91,10 +91,10 @@ end
# Light effects
#===============================================================================
class LightEffect
def initialize(event,viewport = nil,map = nil,filename = nil)
@light = IconSprite.new(0,0,viewport)
if filename!=nil && filename!="" && pbResolveBitmap("Graphics/Pictures/"+filename)
@light.setBitmap("Graphics/Pictures/"+filename)
def initialize(event, viewport = nil, map = nil, filename = nil)
@light = IconSprite.new(0, 0, viewport)
if filename != nil && filename != "" && pbResolveBitmap("Graphics/Pictures/" + filename)
@light.setBitmap("Graphics/Pictures/" + filename)
else
@light.setBitmap("Graphics/Pictures/LE")
end
@@ -123,10 +123,10 @@ end
class LightEffect_Lamp < LightEffect
def initialize(event,viewport = nil,map = nil)
def initialize(event, viewport = nil, map = nil)
lamp = AnimatedBitmap.new("Graphics/Pictures/LE")
@light = Sprite.new(viewport)
@light.bitmap = Bitmap.new(128,64)
@light.bitmap = Bitmap.new(128, 64)
src_rect = Rect.new(0, 0, 64, 64)
@light.bitmap.blt(0, 0, lamp.bitmap, src_rect)
@light.bitmap.blt(20, 0, lamp.bitmap, src_rect)
@@ -177,15 +177,15 @@ class LightEffect_DayNight < LightEffect
return if !@light || !@event
super
shade = PBDayNight.getShade
if shade>=144 # If light enough, call it fully day
if shade >= 144 # If light enough, call it fully day
shade = 255
elsif shade<=64 # If dark enough, call it fully night
elsif shade <= 64 # If dark enough, call it fully night
shade = 0
else
shade = 255-(255*(144-shade)/(144-64))
shade = 255 - (255 * (144 - shade) / (144 - 64))
end
@light.opacity = 255-shade
if @light.opacity>0
@light.opacity = 255 - shade
if @light.opacity > 0
if (Object.const_defined?(:ScreenPosHelper) rescue false)
@light.x = ScreenPosHelper.pbScreenX(@event)
@light.y = ScreenPosHelper.pbScreenY(@event) - Game_Map::TILE_HEIGHT / 2
@@ -205,22 +205,22 @@ end
Events.onSpritesetCreate += proc { |_sender,e|
Events.onSpritesetCreate += proc { |_sender, e|
spriteset = e[0] # Spriteset being created
viewport = e[1] # Viewport used for tilemap and characters
map = spriteset.map # Map associated with the spriteset (not necessarily the current map)
for i in map.events.keys
if map.events[i].name[/^outdoorlight\((\w+)\)$/i]
filename = $~[1].to_s
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i],viewport,map,filename))
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i], viewport, map, filename))
elsif map.events[i].name[/^outdoorlight$/i]
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i],viewport,map))
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i], viewport, map))
elsif map.events[i].name[/^light\((\w+)\)$/i]
filename = $~[1].to_s
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i],viewport,map,filename))
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i], viewport, map, filename))
elsif map.events[i].name[/^light$/i]
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i],viewport,map))
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i], viewport, map))
end
end
spriteset.addUserSprite(Particle_Engine.new(viewport,map))
spriteset.addUserSprite(Particle_Engine.new(viewport, map))
}

View File

@@ -3,14 +3,14 @@
#===============================================================================
def pbCaveEntranceEx(exiting)
# Create bitmap
sprite = BitmapSprite.new(Graphics.width,Graphics.height)
sprite = BitmapSprite.new(Graphics.width, Graphics.height)
sprite.z = 100000
# Define values used for the animation
totalFrames = (Graphics.frame_rate*0.4).floor
increment = (255.0/totalFrames).ceil
totalFrames = (Graphics.frame_rate * 0.4).floor
increment = (255.0 / totalFrames).ceil
totalBands = 15
bandheight = ((Graphics.height/2.0)-10)/totalBands
bandwidth = ((Graphics.width/2.0)-12)/totalBands
bandheight = ((Graphics.height / 2.0) - 10) / totalBands
bandwidth = ((Graphics.width / 2.0) - 12) / totalBands
# Create initial array of band colors (black if exiting, white if entering)
grays = Array.new(totalBands) { |i| (exiting) ? 0 : 255 }
# Animate bands changing color
@@ -19,47 +19,47 @@ def pbCaveEntranceEx(exiting)
y = 0
# Calculate color of each band
for k in 0...totalBands
next if k>=totalBands*j/totalFrames
next if k >= totalBands * j / totalFrames
inc = increment
inc *= -1 if exiting
grays[k] -= inc
grays[k] = 0 if grays[k]<0
grays[k] = 0 if grays[k] < 0
end
# Draw gray rectangles
rectwidth = Graphics.width
rectheight = Graphics.height
for i in 0...totalBands
currentGray = grays[i]
sprite.bitmap.fill_rect(Rect.new(x,y,rectwidth,rectheight),
Color.new(currentGray,currentGray,currentGray))
sprite.bitmap.fill_rect(Rect.new(x, y, rectwidth, rectheight),
Color.new(currentGray, currentGray, currentGray))
x += bandwidth
y += bandheight
rectwidth -= bandwidth*2
rectheight -= bandheight*2
rectwidth -= bandwidth * 2
rectheight -= bandheight * 2
end
Graphics.update
Input.update
end
# Set the tone at end of band animation
if exiting
pbToneChangeAll(Tone.new(255,255,255),0)
pbToneChangeAll(Tone.new(255, 255, 255), 0)
else
pbToneChangeAll(Tone.new(-255,-255,-255),0)
pbToneChangeAll(Tone.new(-255, -255, -255), 0)
end
# Animate fade to white (if exiting) or black (if entering)
for j in 0...totalFrames
if exiting
sprite.color = Color.new(255,255,255,j*increment)
sprite.color = Color.new(255, 255, 255, j * increment)
else
sprite.color = Color.new(0,0,0,j*increment)
sprite.color = Color.new(0, 0, 0, j * increment)
end
Graphics.update
Input.update
end
# Set the tone at end of fading animation
pbToneChangeAll(Tone.new(0,0,0),8)
pbToneChangeAll(Tone.new(0, 0, 0), 8)
# Pause briefly
(Graphics.frame_rate/10).times do
(Graphics.frame_rate / 10).times do
Graphics.update
Input.update
end
@@ -88,7 +88,7 @@ def pbStartOver(gameover = false)
end
$stats.blacked_out_count += 1
$player.heal_party
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId >= 0
if gameover
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back to a Pokémon Center."))
else
@@ -106,9 +106,9 @@ def pbStartOver(gameover = false)
else
homedata = GameData::PlayerMetadata.get($player.character_ID)&.home
homedata = GameData::Metadata.get.home if !homedata
if homedata && !pbRgssExists?(sprintf("Data/Map%03d.rxdata",homedata[0]))
if homedata && !pbRgssExists?(sprintf("Data/Map%03d.rxdata", homedata[0]))
if $DEBUG
pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.",homedata[0]))
pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.", homedata[0]))
end
$player.heal_party
return