mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-10 22:54:59 +00:00
Added decent spacing to all scripts thanks to Rubocop
This commit is contained in:
@@ -32,7 +32,7 @@ class PokemonSprite < SpriteWrapper
|
||||
when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft
|
||||
self.ox = 0
|
||||
when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom
|
||||
self.ox = self.bitmap.width/2
|
||||
self.ox = self.bitmap.width / 2
|
||||
when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight
|
||||
self.ox = self.bitmap.width
|
||||
end
|
||||
@@ -40,21 +40,21 @@ class PokemonSprite < SpriteWrapper
|
||||
when PictureOrigin::TopLeft, PictureOrigin::Top, PictureOrigin::TopRight
|
||||
self.oy = 0
|
||||
when PictureOrigin::Left, PictureOrigin::Center, PictureOrigin::Right
|
||||
self.oy = self.bitmap.height/2
|
||||
self.oy = self.bitmap.height / 2
|
||||
when PictureOrigin::BottomLeft, PictureOrigin::Bottom, PictureOrigin::BottomRight
|
||||
self.oy = self.bitmap.height
|
||||
end
|
||||
end
|
||||
|
||||
def setPokemonBitmap(pokemon,back = false)
|
||||
def setPokemonBitmap(pokemon, back = false)
|
||||
@_iconbitmap.dispose if @_iconbitmap
|
||||
@_iconbitmap = (pokemon) ? GameData::Species.sprite_bitmap_from_pokemon(pokemon, back) : nil
|
||||
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
|
||||
self.color = Color.new(0,0,0,0)
|
||||
self.color = Color.new(0, 0, 0, 0)
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
def setPokemonBitmapSpecies(pokemon,species,back = false)
|
||||
def setPokemonBitmapSpecies(pokemon, species, back = false)
|
||||
@_iconbitmap.dispose if @_iconbitmap
|
||||
@_iconbitmap = (pokemon) ? GameData::Species.sprite_bitmap_from_pokemon(pokemon, back, species) : nil
|
||||
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
|
||||
@@ -87,7 +87,7 @@ class PokemonIconSprite < SpriteWrapper
|
||||
attr_accessor :active
|
||||
attr_reader :pokemon
|
||||
|
||||
def initialize(pokemon,viewport = nil)
|
||||
def initialize(pokemon, viewport = nil)
|
||||
super(viewport)
|
||||
@selected = false
|
||||
@active = false
|
||||
@@ -111,12 +111,12 @@ class PokemonIconSprite < SpriteWrapper
|
||||
|
||||
def x=(value)
|
||||
@logical_x = value
|
||||
super(@logical_x+@adjusted_x)
|
||||
super(@logical_x + @adjusted_x)
|
||||
end
|
||||
|
||||
def y=(value)
|
||||
@logical_y = value
|
||||
super(@logical_y+@adjusted_y)
|
||||
super(@logical_y + @adjusted_y)
|
||||
end
|
||||
|
||||
def pokemon=(value)
|
||||
@@ -133,8 +133,8 @@ class PokemonIconSprite < SpriteWrapper
|
||||
self.bitmap = @animBitmap.bitmap
|
||||
self.src_rect.width = @animBitmap.height
|
||||
self.src_rect.height = @animBitmap.height
|
||||
@numFrames = @animBitmap.width/@animBitmap.height
|
||||
@currentFrame = 0 if @currentFrame>=@numFrames
|
||||
@numFrames = @animBitmap.width / @animBitmap.height
|
||||
@currentFrame = 0 if @currentFrame >= @numFrames
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
@@ -150,7 +150,7 @@ class PokemonIconSprite < SpriteWrapper
|
||||
when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft
|
||||
self.ox = 0
|
||||
when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom
|
||||
self.ox = self.src_rect.width/2
|
||||
self.ox = self.src_rect.width / 2
|
||||
when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight
|
||||
self.ox = self.src_rect.width
|
||||
end
|
||||
@@ -160,7 +160,7 @@ class PokemonIconSprite < SpriteWrapper
|
||||
when PictureOrigin::Left, PictureOrigin::Center, PictureOrigin::Right
|
||||
# NOTE: This assumes the top quarter of the icon is blank, so oy is placed
|
||||
# in the middle of the lower three quarters of the image.
|
||||
self.oy = self.src_rect.height*5/8
|
||||
self.oy = self.src_rect.height * 5 / 8
|
||||
when PictureOrigin::BottomLeft, PictureOrigin::Bottom, PictureOrigin::BottomRight
|
||||
self.oy = self.src_rect.height
|
||||
end
|
||||
@@ -171,14 +171,14 @@ class PokemonIconSprite < SpriteWrapper
|
||||
return 0 if @pokemon.fainted? # Fainted - no animation
|
||||
# ret is initially the time a whole animation cycle lasts. It is divided by
|
||||
# the number of frames in that cycle at the end.
|
||||
ret = Graphics.frame_rate/4 # Green HP - 0.25 seconds
|
||||
if @pokemon.hp<=@pokemon.totalhp/4 # Red HP - 1 second
|
||||
ret = Graphics.frame_rate / 4 # Green HP - 0.25 seconds
|
||||
if @pokemon.hp <= @pokemon.totalhp / 4 # Red HP - 1 second
|
||||
ret *= 4
|
||||
elsif @pokemon.hp<=@pokemon.totalhp/2 # Yellow HP - 0.5 seconds
|
||||
elsif @pokemon.hp <= @pokemon.totalhp / 2 # Yellow HP - 0.5 seconds
|
||||
ret *= 2
|
||||
end
|
||||
ret /= @numFrames
|
||||
ret = 1 if ret<1
|
||||
ret = 1 if ret < 1
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -189,20 +189,20 @@ class PokemonIconSprite < SpriteWrapper
|
||||
self.bitmap = @animBitmap.bitmap
|
||||
# Update animation
|
||||
cl = self.counterLimit
|
||||
if cl==0
|
||||
if cl == 0
|
||||
@currentFrame = 0
|
||||
else
|
||||
@counter += 1
|
||||
if @counter>=cl
|
||||
@currentFrame = (@currentFrame+1)%@numFrames
|
||||
if @counter >= cl
|
||||
@currentFrame = (@currentFrame + 1) % @numFrames
|
||||
@counter = 0
|
||||
end
|
||||
end
|
||||
self.src_rect.x = self.src_rect.width*@currentFrame
|
||||
self.src_rect.x = self.src_rect.width * @currentFrame
|
||||
# Update "jumping" animation (used in party screen)
|
||||
if @selected
|
||||
@adjusted_x = 4
|
||||
@adjusted_y = (@currentFrame>=@numFrames/2) ? -2 : 6
|
||||
@adjusted_y = (@currentFrame >= @numFrames / 2) ? -2 : 6
|
||||
else
|
||||
@adjusted_x = 0
|
||||
@adjusted_y = 0
|
||||
@@ -223,7 +223,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
attr_reader :form
|
||||
attr_reader :shiny
|
||||
|
||||
def initialize(species,viewport = nil)
|
||||
def initialize(species, viewport = nil)
|
||||
super(viewport)
|
||||
@species = species
|
||||
@gender = 0
|
||||
@@ -260,7 +260,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
refresh
|
||||
end
|
||||
|
||||
def pbSetParams(species,gender,form,shiny = false)
|
||||
def pbSetParams(species, gender, form, shiny = false)
|
||||
@species = species
|
||||
@gender = gender
|
||||
@form = form
|
||||
@@ -280,7 +280,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft
|
||||
self.ox = 0
|
||||
when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom
|
||||
self.ox = self.src_rect.width/2
|
||||
self.ox = self.src_rect.width / 2
|
||||
when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight
|
||||
self.ox = self.src_rect.width
|
||||
end
|
||||
@@ -290,7 +290,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
when PictureOrigin::Left, PictureOrigin::Center, PictureOrigin::Right
|
||||
# NOTE: This assumes the top quarter of the icon is blank, so oy is placed
|
||||
# in the middle of the lower three quarters of the image.
|
||||
self.oy = self.src_rect.height*5/8
|
||||
self.oy = self.src_rect.height * 5 / 8
|
||||
when PictureOrigin::BottomLeft, PictureOrigin::Bottom, PictureOrigin::BottomRight
|
||||
self.oy = self.src_rect.height
|
||||
end
|
||||
@@ -300,9 +300,9 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
def counterLimit
|
||||
# ret is initially the time a whole animation cycle lasts. It is divided by
|
||||
# the number of frames in that cycle at the end.
|
||||
ret = Graphics.frame_rate/4 # 0.25 seconds
|
||||
ret = Graphics.frame_rate / 4 # 0.25 seconds
|
||||
ret /= @numFrames
|
||||
ret = 1 if ret<1
|
||||
ret = 1 if ret < 1
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -316,7 +316,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
self.src_rect.width = @animBitmap.height
|
||||
self.src_rect.height = @animBitmap.height
|
||||
@numFrames = @animBitmap.width / @animBitmap.height
|
||||
@currentFrame = 0 if @currentFrame>=@numFrames
|
||||
@currentFrame = 0 if @currentFrame >= @numFrames
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
@@ -327,10 +327,10 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
self.bitmap = @animBitmap.bitmap
|
||||
# Update animation
|
||||
@counter += 1
|
||||
if @counter>=self.counterLimit
|
||||
@currentFrame = (@currentFrame+1)%@numFrames
|
||||
if @counter >= self.counterLimit
|
||||
@currentFrame = (@currentFrame + 1) % @numFrames
|
||||
@counter = 0
|
||||
end
|
||||
self.src_rect.x = self.src_rect.width*@currentFrame
|
||||
self.src_rect.x = self.src_rect.width * @currentFrame
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user