Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-------------------------------------------------------------------------------
- # Config for battle system visuals
- # set this to false to remove battle bases
- USEBATTLEBASES = false
- # applies a blur to the background
- # toggle between true and false, or set as numeric value
- # higher values will increase battle loading times (recommended = 3)
- BLURBATTLEBACKGROUND = 0
- # resize factor of the background (default = 3.5)
- BACKGROUNDSCALAR = 3.5
- #-------------------------------------------------------------------------------
- # List of Pokemon that are going to trigger the "Minor Legendary" battle entry
- # animation
- MINOR_LEGENDARIES = [
- :MOLTRES,
- :ARTICUNO,
- :ZAPDOS,
- :GIRATINA,
- :DEOXYS
- ]
- # Array handling the automatic queuing of battle BGM
- BATTLE_BGM_SPECIES = [
- [:DEOXYS,"BT-Deoxys Theme.ogg"],
- [:GIRATINA,"giratinabattle.ogg"],
- [[:MOLTRES,:ZAPDOS,:ARTICUNO],"dpplegendary.ogg"],
- [[:REGISTEEL,:REGIROCK,:REGICE,:REGIGIGAS],"regibattle.ogg"],
- ]
- # List of trainertypes triggering the "evil" team animation
- EVIL_TEAM_LIST = [
- :SOLDADO_M,
- :SOLDADO_F,
- ]
- #===============================================================================
- # Don't touch these
- # Used to configure the system for potential DS styles (leftovers)
- #-----------------------------------------------------
- VIEWPORT_HEIGHT = DEFAULTSCREENHEIGHT
- VIEWPORT_OFFSET = 0
- #-------------------------------------------------------------------------------
- # Extensions for classes
- #-------------------------------------------------------------------------------
- # additional String functionality
- class ::String
- def starts_with?(char)
- proc = self.scan(/./)
- return (proc[0] == char) ? true : false
- end
- end
- # additional Sprite functionality
- class Sprite
- attr_reader :storedBitmap
- attr_accessor :speed
- attr_accessor :toggle
- attr_accessor :end_x
- attr_accessor :end_y
- attr_accessor :param
- attr_accessor :ex
- attr_accessor :ey
- def drawRect(width,height,color)
- self.bitmap = Bitmap.new(width,height)
- self.bitmap.fill_rect(0,0,width,height,color)
- end
- def center
- self.ox = self.src_rect.width/2
- self.oy = self.src_rect.height/2
- end
- def snapScreen
- bmp = Graphics.snap_to_bitmap
- width = self.viewport ? viewport.rect.width : Graphics.width
- height = self.viewport ? viewport.rect.height : Graphics.height
- x = self.viewport ? viewport.rect.x : 0
- y = self.viewport ? viewport.rect.y : 0
- self.bitmap = Bitmap.new(width,height)
- self.bitmap.blt(0,0,bmp,Rect.new(x,y,width,height))
- end
- def skew(angle=90)
- return false if !self.bitmap
- angle=angle*(Math::PI/180)
- bitmap=self.bitmap
- rect=Rect.new(0,0,bitmap.width,bitmap.height)
- width=rect.width+((rect.height-1)/Math.tan(angle))
- self.bitmap=Bitmap.new(width,rect.height)
- for i in 0...rect.height
- y=rect.height-i
- x=i/Math.tan(angle)
- self.bitmap.blt(x+rect.x,y+rect.y,bitmap,Rect.new(0,y,rect.width,1))
- end
- end
- def blur_sprite(blur_val=2,opacity=35)
- bitmap = self.bitmap
- self.bitmap = Bitmap.new(bitmap.width,bitmap.height)
- self.bitmap.blt(0,0,bitmap,Rect.new(0,0,bitmap.width,bitmap.height))
- x=0
- y=0
- for i in 1...(8 * blur_val)
- dir = i % 8
- x += (1 + (i / 8))*([0,6,7].include?(dir) ? -1 : 1)*([1,5].include?(dir) ? 0 : 1)
- y += (1 + (i / 8))*([1,4,5,6].include?(dir) ? -1 : 1)*([3,7].include?(dir) ? 0 : 1)
- self.bitmap.blt(x-blur_val,y+(blur_val*2),bitmap,Rect.new(0,0,bitmap.width,bitmap.height),opacity)
- end
- end
- def getAvgColor(freq=2)
- return Color.new(0,0,0,0) if !self.bitmap
- bmp = self.bitmap
- width = self.bitmap.width/freq
- height = self.bitmap.height/freq
- red = 0
- green = 0
- blue = 0
- n = width*height
- for x in 0...width
- for y in 0...height
- color = bmp.get_pixel(x*freq,y*freq)
- if color.alpha > 0
- red += color.red
- green += color.green
- blue += color.blue
- end
- end
- end
- avg = Color.new(red/n,green/n,blue/n)
- return avg
- end
- def create_outline(color,thickness=2,hard=false)
- return false if !self.bitmap
- bmp = self.bitmap.clone
- self.bitmap = Bitmap.new(bmp.width,bmp.height)
- for x in 0...bmp.width-thickness
- for y in 0...bmp.height
- pixel = bmp.get_pixel(x,y)
- if pixel.alpha > 0
- for i in 1..thickness
- c1 = bmp.get_pixel(x,y-i)
- c2 = bmp.get_pixel(x,y+i)
- c3 = bmp.get_pixel(x-i,y)
- c4 = bmp.get_pixel(x+i,y)
- self.bitmap.set_pixel(x,y-i,color) if c1.alpha <= 0
- self.bitmap.set_pixel(x,y+i,color) if c2.alpha <= 0
- self.bitmap.set_pixel(x-i,y,color) if c3.alpha <= 0
- self.bitmap.set_pixel(x+i,y,color) if c4.alpha <= 0
- end
- end
- end
- end
- self.bitmap.blt(0,0,bmp,Rect.new(0,0,bmp.width,bmp.height))
- end
- def colorize(color)
- return false if !self.bitmap
- bmp = self.bitmap.clone
- self.bitmap = Bitmap.new(bmp.width,bmp.height)
- for x in 0...bmp.width
- for y in 0...bmp.height
- pixel = bmp.get_pixel(x,y)
- self.bitmap.set_pixel(x,y,color) if pixel.alpha > 0
- end
- end
- end
- def glow(color,opacity=35,keep=true)
- return false if !self.bitmap
- temp_bmp = self.bitmap.clone
- self.colorize(color)
- self.blur_sprite(3,opacity)
- src = self.bitmap.clone
- self.bitmap.clear
- self.bitmap.stretch_blt(Rect.new(-0.005*src.width,-0.015*src.height,src.width*1.01,1.02*src.height),src,Rect.new(0,0,src.width,src.height))
- self.bitmap.blt(0,0,temp_bmp,Rect.new(0,0,temp_bmp.width,temp_bmp.height)) if keep
- end
- def fuzz(color,opacity=35)
- return false if !self.bitmap
- self.colorize(color)
- self.blur_sprite(3,opacity)
- src = self.bitmap.clone
- self.bitmap.clear
- self.bitmap.stretch_blt(Rect.new(-0.005*src.width,-0.015*src.height,src.width*1.01,1.02*src.height),src,Rect.new(0,0,src.width,src.height))
- end
- def memorize_bitmap(bitmap = nil)
- @storedBitmap = bitmap if !bitmap.nil?
- @storedBitmap = self.bitmap.clone if bitmap.nil?
- end
- def restore_bitmap
- self.bitmap = @storedBitmap.clone
- end
- def toneAll(val)
- self.tone.red += val
- self.tone.green += val
- self.tone.blue += val
- end
- def onlineBitmap(url)
- pbDownloadToFile(url,"_temp.png")
- return if !FileTest.exist?("_temp.png")
- self.bitmap = pbBitmap("_temp")
- File.delete("_temp.png")
- end
- end
- # additional Bitmap functionality
- class Bitmap
- def drawCircle(color=Color.new(255,255,255),r=(self.width/2),tx=(self.width/2),ty=(self.height/2),hollow=false)
- # basic circle formula
- # (x - tx)**2 + (y - ty)**2 = r**2
- for x in 0...self.width
- f = (r**2 - (x - tx)**2)
- next if f < 0
- y1 = -Math.sqrt(f).to_i + ty
- y2 = Math.sqrt(f).to_i + ty
- if hollow
- self.set_pixel(x,y1,color)
- self.set_pixel(x,y2,color)
- else
- for y in y1..y2
- self.set_pixel(x,y,color)
- end
- end
- end
- end
- end
- #-------------------------------------------------------------------------------
- # Class used for generating scrolling backgrounds (move animations)
- #-------------------------------------------------------------------------------
- class ScrollingSprite < Sprite
- attr_accessor :speed
- attr_accessor :direction
- attr_accessor :vertical
- def setBitmap(val,vertical=false,pulse=false)
- @vertical = vertical
- @pulse = pulse
- @direction = 1 if @direction.nil?
- @gopac = 1
- @speed = 32 if @speed.nil?
- val = pbBitmap(val) if val.is_a?(String)
- if @vertical
- bmp = Bitmap.new(val.width,val.height*2)
- for i in 0...2
- bmp.blt(0,val.height*i,val,Rect.new(0,0,val.width,val.height))
- end
- self.bitmap = bmp.clone
- y = @direction > 0 ? 0 : val.height
- self.src_rect.set(0,y,val.width,val.height)
- else
- bmp = Bitmap.new(val.width*2,val.height)
- for i in 0...2
- bmp.blt(val.width*i,0,val,Rect.new(0,0,val.width,val.height))
- end
- self.bitmap = bmp.clone
- x = @direction > 0 ? 0 : val.width
- self.src_rect.set(x,0,val.width,val.height)
- end
- end
- def update
- if @vertical
- self.src_rect.y += @speed*@direction
- self.src_rect.y = 0 if @direction > 0 && self.src_rect.y >= self.src_rect.height
- self.src_rect.y = self.src_rect.height if @direction < 0 && self.src_rect.y <= 0
- else
- self.src_rect.x += @speed*@direction
- self.src_rect.x = 0 if @direction > 0 && self.src_rect.x >= self.src_rect.width
- self.src_rect.x = self.src_rect.width if @direction < 0 && self.src_rect.x <= 0
- end
- if @pulse
- self.opacity -= @gopac*@speed
- @gopac *= -1 if self.opacity == 255 || self.opacity == 0
- end
- end
- end
- #-------------------------------------------------------------------------------
- # Class used for generating sprites with a trail
- #-------------------------------------------------------------------------------
- class TrailingSprite
- attr_accessor :x
- attr_accessor :y
- attr_accessor :z
- attr_accessor :color
- attr_accessor :keyFrame
- attr_accessor :zoom_x
- attr_accessor :zoom_y
- attr_accessor :opacity
- def initialize(viewport,bmp)
- @viewport = viewport
- @bmp = bmp
- @sprites = {}
- @x = 0
- @y = 0
- @z = 0
- @i = 0
- @frame = 128
- @keyFrame = 0
- @color = Color.new(0,0,0,0)
- @zoom_x = 1
- @zoom_y = 1
- @opacity = 255
- end
- def update
- @frame += 1
- if @frame > @keyFrame
- @sprites["#{@i}"] = Sprite.new(@viewport)
- @sprites["#{@i}"].bitmap = @bmp
- @sprites["#{@i}"].center
- @sprites["#{@i}"].x = x
- @sprites["#{@i}"].y = y
- @sprites["#{@i}"].z = z
- @sprites["#{@i}"].zoom_x = @zoom_x
- @sprites["#{@i}"].zoom_y = @zoom_y
- @sprites["#{@i}"].opacity = @opacity
- @i += 1
- @frame = 0
- end
- for key in @sprites.keys
- if @sprites[key].opacity > @keyFrame
- @sprites[key].opacity -= 24
- @sprites[key].zoom_x -= 0.035
- @sprites[key].zoom_y -= 0.035
- @sprites[key].color = @color
- end
- end
- end
- def visible=(val)
- for key in @sprites.keys
- @sprites[key].visible = val
- end
- end
- def dispose
- for key in @sprites.keys
- @sprites[key].dispose
- end
- @sprites.clear
- end
- def disposed?
- @sprites.keys.length < 1
- end
- end
- #-------------------------------------------------------------------------------
- # Class used to render the background for the special S&M trainer battle
- # animation
- #-------------------------------------------------------------------------------
- class RainbowSprite < Sprite
- attr_accessor :speed
- def setBitmap(val,speed = 1)
- @val = val
- @val = pbBitmap(val) if val.is_a?(String)
- @speed = speed
- self.bitmap = Bitmap.new(@val.width,@val.height)
- self.bitmap.blt(0,0,@val,Rect.new(0,0,@val.width,@val.height))
- @current_hue = 0
- end
- def update
- self.bitmap.clear
- self.bitmap.blt(0,0,@val,Rect.new(0,0,@val.width,@val.height))
- self.bitmap.hue_change(@current_hue)
- @current_hue += @speed
- @current_hue = 0 if @current_hue >= 360
- end
- end
- #-------------------------------------------------------------------------------
- # Common UI handlers
- #-------------------------------------------------------------------------------
- class CommonButton < Sprite
- attr_accessor :selected
- def setButton(size="M",var=1,text="")
- bmp = pbBitmap("Graphics/Pictures/Common/btn#{size}_#{var}")
- pbSetSmallFont(bmp)
- case size
- when "M"
- x, y, w, h = 46, 22, 92, 38
- when "N"
- x, y, w, h = 54, 16, 108, 30
- when "L"
- x, y, w, h = 61, 22, 122, 38
- end
- color = self.darkenColor(bmp.get_pixel(x, y))
- self.bitmap = Bitmap.new(bmp.width - 22, bmp.height)
- pbSetSmallFont(self.bitmap)
- self.bitmap.blt(0, 0, bmp, Rect.new(0, 0, bmp.width - 22, bmp.height))
- pbDrawOutlineText(self.bitmap,2,2,w,h,text,Color.new(255,255,255),color,1)
- end
- def darkenColor(color=nil,amt=0.6)
- return getDarkerColor(color,amt)
- end
- end
- def getDarkerColor(color=nil,amt=0.6)
- return nil if color.nil?
- red = color.red - color.red*amt
- green = color.green - color.green*amt
- blue = color.blue - color.blue*amt
- return Color.new(red,green,blue)
- end
- #-------------------------------------------------------------------------------
- # Misc scripting utilities
- #-------------------------------------------------------------------------------
- class Bitmap
- attr_accessor :storedPath
- end
- def pbBitmap(name)
- if !pbResolveBitmap(name).nil?
- bmp = BitmapCache.load_bitmap(name)
- bmp.storedPath = name
- else
- p "Image located at '#{name}' was not found!" if $DEBUG
- bmp = Bitmap.new(1,1)
- end
- return bmp
- end
- #-------------------------------------------------------------------------------
- # F12 Soft-resetting fix
- #-------------------------------------------------------------------------------
- if defined?(SOFTRESETFIX) && SOFTRESETFIX
- unless $f12_fix.nil?
- game_name = "Game"
- if $DEBUG
- Thread.new{system(game_name+" debug")}
- else
- Thread.new{system(game_name)}
- end
- exit
- end
- $f12_fix = true
- end
- #===============================================================================
- # New methods used to inject new code into Scripts.rxdata
- #-------------------------------------------------------------------------------
- # Backs up your current scripts to prevent any permanent damage
- #-------------------------------------------------------------------------------
- def backupScriptData(file_name = nil)
- if file_name.nil?
- ini = Win32API.new('kernel32', 'GetPrivateProfileString','PPPPLP', 'L')
- scripts_filename = "\0" * 256
- ini.call('Game', 'Scripts', '', scripts_filename, 256, '.\\Game.ini')
- scripts_filename.delete!("\0")
- else
- scripts_filename = file_name
- end
- File.copy(scripts_filename, scripts_filename+".bak",false)
- end
- #-------------------------------------------------------------------------------
- # Returns all possible data read from the game's scripts
- #-------------------------------------------------------------------------------
- def getScriptData(file_name = nil)
- # Backs up the Scripts
- backupScriptData(file_name)
- # Gets Scripts filename from the .ini file
- if file_name.nil?
- ini = Win32API.new('kernel32', 'GetPrivateProfileString','PPPPLP', 'L')
- scripts_filename = "\0" * 256
- ini.call('Game', 'Scripts', '', scripts_filename, 256, '.\\Game.ini')
- scripts_filename.delete!("\0")
- else
- scripts_filename = file_name
- end
- scripts = load_data(scripts_filename)
- names = []
- codes = []
- # Reads all the currently existing scripts, and stores them for later manipulation
- for script in scripts
- id, name, code = script
- next if id.nil?
- code = Zlib::Inflate.inflate(code)
- code.gsub!(/\t/) {' '}
- names.push(name)
- codes.push(code)
- end
- return names, codes, scripts_filename
- end
- #-------------------------------------------------------------------------------
- # Returns one specific script from the game's scripts
- #-------------------------------------------------------------------------------
- def getSpecificScript(name = "Main")
- # Fetches all the necessary Scripts data
- names, codes, scripts_filename = getScriptData
- # Gets the location index of script from name
- if name.is_a?(String)
- index = names.index(name)
- elsif name.is_a?(Numeric)
- index = name
- else
- return # failsafe
- end
- # Returns selected script
- return codes[index]
- end
- #-------------------------------------------------------------------------------
- #===============================================================================
- # Elite Battle system
- # by Luka S.J.
- # ----------------
- # Sprites Script
- # ----------------
- # system is based off the original Essentials battle system, made by
- # Poccil & Maruno
- # No additional features added to AI, mechanics
- # or functionality of the battle system.
- # This update is purely cosmetic, and includes a B/W like dynamic scene with a
- # custom interface.
- #
- # Enjoy the script, and make sure to give credit!
- # (DO NOT ALTER THE NAMES OF THE INDIVIDUAL SCRIPT SECTIONS OR YOU WILL BREAK
- # YOUR SYSTEM!)
- #-------------------------------------------------------------------------------
- # New methods for creating in-battle Pokemon sprites.
- # * creates fixed shadows in the sprite itself
- # * calculates correct positions according to metric data in here
- # * sprites have a different focal point for more precise base placement
- #===============================================================================
- class DynamicPokemonSprite
- attr_accessor :shadow
- attr_accessor :sprite
- attr_accessor :showshadow
- attr_accessor :status
- attr_accessor :hidden
- attr_accessor :fainted
- attr_accessor :anim
- attr_accessor :charged
- attr_accessor :isShadow
- attr_reader :loaded
- attr_reader :selected
- attr_reader :isSub
- attr_reader :viewport
- attr_reader :pulse
- def initialize(doublebattle,index,viewport=nil)
- @viewport=viewport
- @metrics=load_data("Data/metrics.dat")
- @selected=0
- @frame=0
- @frame2=0
- @frame3=0
- @status=0
- @loaded=false
- @charged=false
- @index=index
- @doublebattle=doublebattle
- @showshadow=true
- @altitude=0
- @yposition=0
- @shadow=Sprite.new(@viewport)
- @sprite=Sprite.new(@viewport)
- back=(@index%2==0)
- @substitute=AnimatedBitmapWrapper.new("Graphics/Battlers/"+(back ? "substitute_back" : "substitute"),POKEMONSPRITESCALE)
- @overlay=Sprite.new(@viewport)
- @isSub=false
- @lock=false
- @pokemon=nil
- @still=false
- @hidden=false
- @fainted=false
- @anim=false
- @isShadow=false
- @fp = {}
- for i in 0...16
- @fp["#{i}"] = Sprite.new(@viewport)
- @fp["#{i}"].bitmap = pbBitmap("Graphics/Animations/ebShadow")
- @fp["#{i}"].ox = @fp["#{i}"].bitmap.width/4
- @fp["#{i}"].oy = @fp["#{i}"].bitmap.height/2
- @fp["#{i}"].src_rect.set(0,0,@fp["#{i}"].bitmap.width/2,@fp["#{i}"].bitmap.height)
- @fp["#{i}"].opacity = 0
- end
- for i in 0...16
- @fp["c#{i}"] = Sprite.new(@viewport)
- @fp["c#{i}"].bitmap = pbBitmap("Graphics/Animations/ebCharged")
- @fp["c#{i}"].ox = @fp["c#{i}"].bitmap.width/8
- @fp["c#{i}"].oy = @fp["c#{i}"].bitmap.height
- @fp["c#{i}"].src_rect.set(0,0,@fp["c#{i}"].bitmap.width/4,@fp["c#{i}"].bitmap.height)
- @fp["c#{i}"].opacity = 0
- end
- for j in 0...4
- @fp["r#{j}"] = Sprite.new(viewport)
- @fp["r#{j}"].bitmap = pbBitmap("Graphics/Animations/ebRipple")
- @fp["r#{j}"].ox = @fp["r#{j}"].bitmap.width/2
- @fp["r#{j}"].oy = @fp["r#{j}"].bitmap.height/2
- @fp["r#{j}"].zoom_x = 0
- @fp["r#{j}"].zoom_y = 0
- @fp["r#{j}"].param = 0
- end
- @pulse = 8
- @k = 1
- end
- def battleIndex; return @index; end
- def x; @sprite.x; end
- def y; @sprite.y; end
- def z; @sprite.z; end
- def ox; @sprite.ox; end
- def oy; @sprite.oy; end
- def zoom_x; @sprite.zoom_x; end
- def zoom_y; @sprite.zoom_y; end
- def visible; @sprite.visible; end
- def opacity; @sprite.opacity; end
- def width; @bitmap.width; end
- def height; @bitmap.height; end
- def tone; @sprite.tone; end
- def bitmap; @bitmap.bitmap; end
- def actualBitmap; @bitmap; end
- def disposed?; @sprite.disposed?; end
- def color; @sprite.color; end
- def src_rect; @sprite.src_rect; end
- def blend_type; @sprite.blend_type; end
- def angle; @sprite.angle; end
- def mirror; @sprite.mirror; end
- def src_rect; return @sprite.src_rect; end
- def src_rect=(val)
- @sprite.src_rect=val
- end
- def lock
- @lock=true
- end
- def bitmap=(val)
- @bitmap.bitmap=val
- end
- def x=(val)
- @sprite.x=val
- @shadow.x=val
- end
- def ox=(val)
- @sprite.ox=val
- self.formatShadow
- end
- def addOx(val)
- @sprite.ox+=val
- self.formatShadow
- end
- def oy=(val)
- @sprite.oy=val
- self.formatShadow
- end
- def addOy(val)
- @sprite.oy+=val
- self.formatShadow
- end
- def y=(val)
- @sprite.y=val
- @shadow.y=val
- end
- def z=(val)
- @shadow.z=(val==32) ? 31 : 10
- @sprite.z=val
- end
- def zoom_x=(val)
- @sprite.zoom_x=val
- self.formatShadow
- end
- def zoom_y=(val)
- @sprite.zoom_y=val
- self.formatShadow
- end
- def visible=(val)
- return if @hidden
- @sprite.visible=val
- if @fp
- for key in @fp.keys
- @fp[key].visible=val
- end
- end
- self.formatShadow
- end
- def opacity=(val)
- @sprite.opacity=val
- self.formatShadow
- end
- def tone=(val)
- @sprite.tone=val
- end
- def color=(val)
- @sprite.color=val
- if @fp
- for key in @fp.keys
- @fp[key].color=val
- end
- end
- end
- def blend_type=(val)
- @sprite.blend_type=val
- self.formatShadow
- end
- def angle=(val)
- @sprite.angle=(val)
- self.formatShadow
- end
- def mirror=(val)
- @sprite.mirror=(val)
- self.formatShadow
- end
- def dispose
- @sprite.dispose
- @shadow.dispose
- pbDisposeSpriteHash(@fp)
- end
- def selected=(val)
- @selected=val
- @sprite.visible=true if !@hidden
- end
- def toneAll(val)
- @sprite.tone.red+=val
- @sprite.tone.green+=val
- @sprite.tone.blue+=val
- end
- def setBitmap(file,shadow=false)
- self.resetParticles
- @showshadow = shadow
- @bitmap = AnimatedBitmapWrapper.new(file)
- @sprite.bitmap = @bitmap.bitmap.clone
- @shadow.bitmap = @bitmap.bitmap.clone
- @loaded = true
- self.formatShadow
- end
- def setPokemonBitmap(pokemon,back=false,species=nil)
- self.resetParticles
- return if !pokemon || pokemon.nil?
- @pokemon = pokemon
- @isShadow = true if @pokemon.isShadow?
- @altitude = @metrics[2][pokemon.species]
- if back
- @yposition = @metrics[0][pokemon.species]
- @altitude *= 0.5
- else
- @yposition = @metrics[1][pokemon.species]
- end
- scale = back ? BACKSPRITESCALE : POKEMONSPRITESCALE
- if !species.nil?
- @bitmap = pbLoadPokemonBitmapSpecies(pokemon,species,back,scale)
- else
- @bitmap = pbLoadPokemonBitmap(pokemon,back,scale)
- end
- @sprite.bitmap = @bitmap.bitmap.clone
- @shadow.bitmap = @bitmap.bitmap.clone
- @sprite.ox = @bitmap.width/2
- @sprite.oy = @bitmap.height
- @sprite.oy += @altitude
- @sprite.oy -= @yposition
- @sprite.oy -= pokemon.formOffsetY if pokemon.respond_to?(:formOffsetY)
- @fainted = false
- @loaded = true
- @hidden = false
- self.visible = true
- @pulse = 8
- @k = 1
- self.formatShadow
- end
- def resetParticles
- if @fp
- for key in @fp.keys
- @fp[key].visible = false
- end
- end
- @isShadow = false
- @charged = false
- end
- def refreshMetrics(metrics)
- @metrics = metrics
- @altitude = @metrics[2][@pokemon.species]
- if (@index%2==0)
- @yposition = @metrics[0][@pokemon.species]
- @altitude *= 0.5
- else
- @yposition = @metrics[1][@pokemon.species]
- end
- @sprite.ox = @bitmap.width/2
- @sprite.oy = @bitmap.height
- @sprite.oy += @altitude
- @sprite.oy -= @yposition
- @sprite.oy -= @pokemon.formOffsetY if @pokemon.respond_to?(:formOffsetY)
- end
- def setSubstitute
- @isSub = true
- @sprite.bitmap = @substitute.bitmap.clone
- @shadow.bitmap = @substitute.bitmap.clone
- @sprite.ox = @substitute.width/2
- @sprite.oy = @substitute.height
- self.formatShadow
- end
- def removeSubstitute
- @isSub = false
- @sprite.bitmap = @bitmap.bitmap.clone
- @shadow.bitmap = @bitmap.bitmap.clone
- @sprite.ox = @bitmap.width/2
- @sprite.oy = @bitmap.height
- @sprite.oy += @altitude
- @sprite.oy -= @yposition
- @sprite.oy -= @pokemon.formOffsetY if @pokemon && @pokemon.respond_to?(:formOffsetY)
- self.formatShadow
- end
- def still
- @still = true
- end
- def clear
- @sprite.bitmap.clear
- @bitmap.dispose
- end
- def formatShadow
- @shadow.zoom_x = @sprite.zoom_x*0.90
- @shadow.zoom_y = @sprite.zoom_y*0.30
- @shadow.ox = @sprite.ox - 6
- @shadow.oy = @sprite.oy - 6
- @shadow.opacity = @sprite.opacity*0.3
- @shadow.tone = Tone.new(-255,-255,-255,255)
- @shadow.visible = @sprite.visible
- @shadow.mirror = @sprite.mirror
- @shadow.angle = @sprite.angle
- @shadow.visible = false if !@showshadow
- end
- def update(angle=74)
- if @still
- @still = false
- return
- end
- return if @lock
- return if !@bitmap || @bitmap.disposed?
- if @isSub
- @substitute.update
- @sprite.bitmap=@substitute.bitmap.clone
- @shadow.bitmap=@substitute.bitmap.clone
- else
- @bitmap.update
- @sprite.bitmap=@bitmap.bitmap.clone
- @shadow.bitmap=@bitmap.bitmap.clone
- end
- @shadow.skew(angle)
- if !@anim && !@pulse.nil?
- @pulse += @k
- @k *= -1 if @pulse == 128 || @pulse == 8
- case @status
- when 0
- @sprite.color = Color.new(0,0,0,0)
- when 1 #PSN
- @sprite.color = Color.new(109,55,130,@pulse)
- when 2 #PAR
- @sprite.color = Color.new(204,152,44,@pulse)
- when 3 #FRZ
- @sprite.color = Color.new(56,160,193,@pulse)
- when 4 #BRN
- @sprite.color = Color.new(206,73,43,@pulse)
- end
- end
- @anim = false
- # Pokémon sprite blinking when targeted or damaged
- @frame += 1
- @frame = 0 if @frame > 256
- if @selected==2 # When targeted or damaged
- @sprite.visible = (@frame%10<7) && !@hidden
- end
- self.formatShadow
- end
- def shadowUpdate
- return if !@loaded
- return if self.disposed? || @bitmap.disposed?
- for i in 0...16
- next if i > @frame2/4
- @fp["#{i}"].visible = @showshadow
- @fp["#{i}"].visible = false if @hidden
- @fp["#{i}"].visible = false if !@isShadow
- next if !@isShadow
- if @fp["#{i}"].opacity <= 0
- @fp["#{i}"].toggle = 2
- z = [0.5,0.6,0.7,0.8,0.9,1.0][rand(6)]
- @fp["#{i}"].param = z
- @fp["#{i}"].x = self.x - self.bitmap.width*self.zoom_x/2 + rand(self.bitmap.width)*self.zoom_x
- @fp["#{i}"].y = self.y - 64*self.zoom_y + rand(64)*self.zoom_y
- @fp["#{i}"].z = (rand(2)==0) ? self.z - 1 : self.z + 1
- @fp["#{i}"].speed = (rand(2)==0) ? +1 : -1
- @fp["#{i}"].src_rect.x = rand(2)*@fp["#{i}"].bitmap.width/2
- end
- @fp["#{i}"].zoom_x = @fp["#{i}"].param*self.zoom_x
- @fp["#{i}"].zoom_y = @fp["#{i}"].param*self.zoom_y
- @fp["#{i}"].param -= 0.01
- @fp["#{i}"].y -= 1
- @fp["#{i}"].opacity += 8*@fp["#{i}"].toggle
- @fp["#{i}"].toggle = -1 if @fp["#{i}"].opacity >= 255
- end
- @frame2 += 1 if @frame2 < 128
- end
- def chargedUpdate
- return if !@loaded
- return if self.disposed? || @bitmap.disposed?
- for i in 0...16
- next if i > @frame3/16
- @fp["c#{i}"].visible = @showshadow
- @fp["c#{i}"].visible = false if @hidden
- @fp["c#{i}"].visible = false if !@charged
- next if !@charged
- if @fp["c#{i}"].opacity <= 0
- x = @sprite.x - @sprite.ox + rand(@sprite.bitmap.width)
- y = @sprite.y - @sprite.oy*0.7 + rand(@sprite.bitmap.height*0.8)
- @fp["c#{i}"].x = x
- @fp["c#{i}"].y = y
- @fp["c#{i}"].z = (rand(2)==0) ? self.z - 1 : self.z + 1
- @fp["c#{i}"].src_rect.x = rand(4)*@fp["c#{i}"].bitmap.width/4
- @fp["c#{i}"].zoom_y = 0.6
- @fp["c#{i}"].opacity = 166 + rand(90)
- @fp["c#{i}"].mirror = (x < @sprite.x) ? false : true
- end
- @fp["c#{i}"].zoom_y += 0.1
- @fp["c#{i}"].opacity -= 16
- end
- for j in 0...4
- next if j > @frame3/32
- @fp["r#{j}"].visible = @showshadow
- @fp["r#{j}"].visible = false if @hidden
- @fp["r#{j}"].visible = false if !@charged
- if @fp["r#{j}"].opacity <= 0
- @fp["r#{j}"].opacity = 255
- @fp["r#{j}"].zoom_x = 0
- @fp["r#{j}"].zoom_y = 0
- @fp["r#{j}"].param = 0
- end
- @fp["r#{j}"].param += 0.01
- @fp["r#{j}"].zoom_x = @fp["r#{j}"].param*self.zoom_x
- @fp["r#{j}"].zoom_y = @fp["r#{j}"].param*self.zoom_x
- @fp["r#{j}"].x = self.x
- @fp["r#{j}"].y = self.y
- @fp["r#{j}"].opacity -= 2
- end
- @frame3 += 1 if @frame3 < 256
- end
- end
- #-------------------------------------------------------------------------------
- # Animated trainer sprites
- #-------------------------------------------------------------------------------
- class DynamicTrainerSprite < DynamicPokemonSprite
- def initialize(doublebattle,index,viewport=nil,trarray=false)
- @viewport=viewport
- @trarray=trarray
- @selected=0
- @frame=0
- @frame2=0
- @status=0
- @loaded=false
- @index=index
- @doublebattle=doublebattle
- @showshadow=true
- @altitude=0
- @yposition=0
- @shadow=Sprite.new(@viewport)
- @sprite=Sprite.new(@viewport)
- @overlay=Sprite.new(@viewport)
- @lock=false
- end
- def totalFrames; @bitmap.animationFrames; end
- def toLastFrame
- @bitmap.toFrame(@bitmap.totalFrames-1)
- self.update
- end
- def selected; end
- def setTrainerBitmap(file)
- @bitmap=AnimatedBitmapWrapper.new(file,TRAINERSPRITESCALE)
- @sprite.bitmap=@bitmap.bitmap.clone
- @shadow.bitmap=@bitmap.bitmap.clone
- @sprite.ox=@bitmap.width/2
- if @doublebattle && @trarray
- if @index==-2
- @sprite.ox-=50
- elsif @index==-1
- @sprite.ox+=50
- end
- end
- @sprite.oy=@bitmap.height-16
- self.formatShadow
- @shadow.skew(74)
- end
- end
- #-------------------------------------------------------------------------------
- # New class used to configure and animate battle backgrounds
- #-------------------------------------------------------------------------------
- class AnimatedBattleBackground < Sprite
- def setBitmap(backdrop,scene)
- blur = 4; blur = BLURBATTLEBACKGROUND if BLURBATTLEBACKGROUND.is_a?(Numeric)
- @eff = {}
- @scene = scene
- if $INEDITOR
- @defaultvector = VECTOR1
- else
- @defaultvector = (@scene.battle.doublebattle ? VECTOR2 : VECTOR1)
- end
- @canAnimate = !pbResolveBitmap("Graphics/BattleBacks/Animation/eff1"+backdrop).nil?
- bg = pbBitmap("Graphics/BattleBacks/battlebg/"+backdrop)
- @bmp = Bitmap.new(bg.width*BACKGROUNDSCALAR,bg.width*BACKGROUNDSCALAR)
- @bmp.stretch_blt(Rect.new(0,0,@bmp.width,@bmp.height),bg,Rect.new(0,0,bg.width,bg.height))
- self.bitmap = @bmp.clone
- self.blur_sprite(blur) if BLURBATTLEBACKGROUND
- sx, sy = @scene.vector.spoof(@defaultvector)
- self.ox = 256 + sx
- self.oy = 192 + sy
- for i in 1..3
- next if !@canAnimate
- @eff["#{i}"] = Sprite.new(self.viewport)
- bmp = pbBitmap("Graphics/BattleBacks/Animation/eff#{i}"+backdrop)
- @eff["#{i}"].bitmap = Bitmap.new(@bmp.width*2,@bmp.height)
- @eff["#{i}"].bitmap.stretch_blt(Rect.new(0,0,@bmp.width*2,@bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))
- @eff["#{i}"].src_rect.set([0,128,0,-128][i]*BACKGROUNDSCALAR,0,bmp.width*BACKGROUNDSCALAR/2,bmp.height*BACKGROUNDSCALAR)
- @eff["#{i}"].ox = self.ox
- @eff["#{i}"].oy = self.oy
- @eff["#{i}"].blur_sprite(blur) if BLURBATTLEBACKGROUND
- end
- self.update
- end
- def update
- if @canAnimate
- @eff["1"].src_rect.x -= 1
- @eff["1"].src_rect.x = 512*BACKGROUNDSCALAR if @eff["1"].src_rect.x <= -256*BACKGROUNDSCALAR
- @eff["2"].src_rect.x += 1
- @eff["2"].src_rect.x = -256*BACKGROUNDSCALAR if @eff["2"].src_rect.x >= 512*BACKGROUNDSCALAR
- @eff["3"].src_rect.x -= 2
- @eff["3"].src_rect.x = 512*BACKGROUNDSCALAR if @eff["3"].src_rect.x <= -256*BACKGROUNDSCALAR
- end
- # coordinates
- self.x = @scene.vector.x2
- self.y = @scene.vector.y2
- self.angle = ((@scene.vector.angle - @defaultvector[2])*0.5).to_i if $PokemonSystem.screensize < 2 && @scene.sendingOut
- sx, sy = @scene.vector.spoof(@defaultvector)
- self.zoom_x = ((@scene.vector.x2 - @scene.vector.x)*1.0/(sx - @defaultvector[0])*1.0)**0.6
- self.zoom_y = ((@scene.vector.y2 - @scene.vector.y)*1.0/(sy - @defaultvector[1])*1.0)**0.6
- for i in 1..3
- next if !@canAnimate
- @eff["#{i}"].x = self.x
- @eff["#{i}"].y = self.y
- @eff["#{i}"].zoom_x = self.zoom_x
- @eff["#{i}"].zoom_y = self.zoom_y
- @eff["#{i}"].visible = true
- @eff["#{i}"].tone = self.tone
- if self.angle!=0
- @eff["#{i}"].opacity -= 51
- else
- @eff["#{i}"].opacity += 51
- end
- end
- end
- alias dispose_bg_ebs dispose unless self.method_defined?(:dispose_bg_ebs)
- def dispose
- pbDisposeSpriteHash(@eff)
- dispose_bg_ebs
- end
- alias :color_bg= :color= unless self.method_defined?(:color_bg=)
- def color=(val)
- for i in 1..3
- next if !@canAnimate
- @eff["#{i}"].color = val
- end
- self.color_bg = val
- end
- end
- #-------------------------------------------------------------------------------
- # New class used to render the Mother Beast Lusamine styled VS background
- #-------------------------------------------------------------------------------
- class CrazyRainbowBackground
- def initialize(viewport)
- @viewport = viewport
- @sprites = {}
- @sprites["bg"] = Sprite.new(@viewport)
- @sprites["bg"].drawRect(@viewport.rect.width,@viewport.rect.height,Color.new(0,0,0))
- @sprites["bg"].z = 200
- for j in 0...3
- @sprites["b#{j}"] = RainbowSprite.new(@viewport)
- @sprites["b#{j}"].setBitmap("Graphics/Transitions/smC#{j}",8)
- @sprites["b#{j}"].ox = @sprites["b#{j}"].bitmap.width/2
- @sprites["b#{j}"].oy = @sprites["b#{j}"].bitmap.height/2
- @sprites["b#{j}"].x = @viewport.rect.width/2
- @sprites["b#{j}"].y = @viewport.rect.height/2
- @sprites["b#{j}"].zoom_x = 0.6 + 0.6*j
- @sprites["b#{j}"].zoom_y = 0.6 + 0.6*j
- @sprites["b#{j}"].opacity = 64 + 64*(1+j)
- @sprites["b#{j}"].z = 250
- end
- for j in 0...64
- @sprites["p#{j}"] = Sprite.new(@viewport)
- @sprites["p#{j}"].z = 300
- width = 16 + rand(48)
- height = 16 + rand(16)
- @sprites["p#{j}"].bitmap = Bitmap.new(width,height)
- bmp = pbBitmap("Graphics/Transitions/smCParticle")
- @sprites["p#{j}"].bitmap.stretch_blt(Rect.new(0,0,width,height),bmp,Rect.new(0,0,bmp.width,bmp.height))
- @sprites["p#{j}"].bitmap.hue_change(rand(360))
- @sprites["p#{j}"].ox = width/2
- @sprites["p#{j}"].oy = height + 192 + rand(32)
- @sprites["p#{j}"].angle = rand(360)
- @sprites["p#{j}"].speed = 1 + rand(4)
- @sprites["p#{j}"].x = @viewport.rect.width/2
- @sprites["p#{j}"].y = @viewport.rect.height/2
- @sprites["p#{j}"].zoom_x = (@sprites["p#{j}"].oy/192.0)*1.5
- @sprites["p#{j}"].zoom_y = (@sprites["p#{j}"].oy/192.0)*1.5
- end
- @frame = 0
- end
- def update
- for j in 0...3
- @sprites["b#{j}"].zoom_x -= 0.025
- @sprites["b#{j}"].zoom_y -= 0.025
- @sprites["b#{j}"].opacity -= 4
- if @sprites["b#{j}"].zoom_x <= 0 || @sprites["b#{j}"].opacity <= 0
- @sprites["b#{j}"].zoom_x = 2.25
- @sprites["b#{j}"].zoom_y = 2.25
- @sprites["b#{j}"].opacity = 255
- end
- @sprites["b#{j}"].update if @frame%8==0
- end
- for j in 0...64
- @sprites["p#{j}"].angle -= @sprites["p#{j}"].speed
- @sprites["p#{j}"].opacity -= @sprites["p#{j}"].speed
- @sprites["p#{j}"].oy -= @sprites["p#{j}"].speed/2 if @sprites["p#{j}"].oy > @sprites["p#{j}"].bitmap.height
- @sprites["p#{j}"].zoom_x = (@sprites["p#{j}"].oy/192.0)*1.5
- @sprites["p#{j}"].zoom_y = (@sprites["p#{j}"].oy/192.0)*1.5
- if @sprites["p#{j}"].zoom_x <= 0 || @sprites["p#{j}"].oy <= 0 || @sprites["p#{j}"].opacity <= 0
- @sprites["p#{j}"].angle = rand(360)
- @sprites["p#{j}"].oy = @sprites["p#{j}"].bitmap.height + 192 + rand(32)
- @sprites["p#{j}"].zoom_x = (@sprites["p#{j}"].oy/192.0)*1.5
- @sprites["p#{j}"].zoom_y = (@sprites["p#{j}"].oy/192.0)*1.5
- @sprites["p#{j}"].opacity = 255
- @sprites["p#{j}"].speed = 1 + rand(4)
- end
- end
- @frame += 1
- @frame = 0 if @frame > 128
- end
- def dispose
- pbDisposeSpriteHash(@sprites)
- end
- end
- #===============================================================================
- # New functions for the Sprite class
- # adds new bitmap transformations
- #===============================================================================
- def setPictureSpriteEB(sprite,picture)
- sprite.visible = picture.visible
- # Set sprite coordinates
- sprite.y = picture.y
- sprite.z = picture.number
- # Set zoom rate, opacity level, and blend method
- sprite.zoom_x = picture.zoom_x / 100.0
- sprite.zoom_y = picture.zoom_y / 100.0
- sprite.opacity = picture.opacity
- sprite.blend_type = picture.blend_type
- # Set rotation angle and color tone
- angle = picture.angle
- sprite.tone = picture.tone
- sprite.color = picture.color
- while angle < 0
- angle += 360
- end
- angle %= 360
- sprite.angle=angle
- end
- #-------------------------------------------------------------------------------
- # Utilities used for move animations
- #-------------------------------------------------------------------------------
- class PokeBattle_Scene
- def getCenter(sprite,zoom=false)
- zoom = zoom ? sprite.zoom_y : 1
- x = sprite.x
- y = sprite.y + (sprite.bitmap.height-sprite.oy)*zoom - sprite.bitmap.height*zoom/2
- return x, y
- end
- def alignSprites(sprite,target)
- sprite.ox = sprite.src_rect.width/2
- sprite.oy = sprite.src_rect.height/2
- sprite.x, sprite.y = getCenter(target)
- sprite.zoom_x, sprite.zoom_y = target.zoom_x/2, target.zoom_y/2
- end
- def getRealVector(targetindex,player)
- vector = (player ? PLAYERVECTOR : ENEMYVECTOR).clone
- if @battle.doublebattle && !USEBATTLEBASES
- case targetindex
- when 0
- vector[0] = vector[0] + 80
- when 1
- vector[0] = vector[0] + 192
- when 2
- vector[0] = vector[0] - 64
- when 3
- vector[0] = vector[0] - 36
- end
- end
- return vector
- end
- def applySpriteProperties(sprite1,sprite2)
- sprite2.x = sprite1.x
- sprite2.y = sprite1.y
- sprite2.z = sprite1.z
- sprite2.zoom_x = sprite1.zoom_x
- sprite2.zoom_y = sprite1.zoom_y
- sprite2.opacity = sprite1.opacity
- sprite2.angle = sprite1.angle
- sprite2.tone = sprite1.tone
- sprite2.color = sprite1.color
- sprite2.visible = sprite1.visible
- end
- end
- #===============================================================================
- # Misc. scripting tools
- #===============================================================================
- def checkEBFolderPath
- if !pbResolveBitmap("Graphics/Pictures/EBS/pokeballs").nil?
- return "Graphics/Pictures/EBS"
- else
- return "Graphics/Pictures"
- end
- end
- def checkEBFolderPathDS
- if !pbResolveBitmap("Graphics/Pictures/EBS/DS/background").nil?
- return "Graphics/Pictures/EBS/DS"
- else
- return "Graphics/Pictures"
- end
- end
- #===============================================================================
- # Elite Battle system
- # by Luka S.J.
- # ----------------
- # EntryAnimations Script
- # ----------------
- # system is based off the original Essentials battle system, made by
- # Poccil & Maruno
- # No additional features added to AI, mechanics
- # or functionality of the battle system.
- # This update is purely cosmetic, and includes a B/W like dynamic scene with a
- # custom interface.
- #
- # Enjoy the script, and make sure to give credit!
- # (DO NOT ALTER THE NAMES OF THE INDIVIDUAL SCRIPT SECTIONS OR YOU WILL BREAK
- # YOUR SYSTEM!)
- #-------------------------------------------------------------------------------
- # Replaces the stock battle start animations for trainer (non-VS) and wild
- # battles.
- #
- # If you'd like to use just the new transitions from EBS for your project,
- # you'll also need to copy over the EliteBattle_Sprites section of the scripts
- # to your project, as well as the configurations for the following constants:
- # - VIEWPORT_HEIGHT
- # - VIEWPORT_OFFSET
- #
- # In order to use the New VS sequence you need the following images in your
- # Graphics/Transitions/ folder:
- # - vsTrainer#{trainer_id}
- # - vsBarNew#{trainer_id}
- #
- # In order to use the Elite Four VS sequence you need the following images in your
- # Graphics/Transitions/ folder:
- # - vsTrainer#{trainer_id}
- # - vsBarElite#{trainer_id}
- #
- # In order to use the Special VS sequence you need the following images in your
- # Graphics/Transitions/ folder:
- # - vsTrainerSpecial#{trainer_id}
- # - vsBarSpecial#{trainer_id}
- #
- # In order to use the new Sun/Moon styled trainer battles you need the following
- # in your Graphics/Transitions/ folder:
- # - smTrainer#{trainer_id}
- # Other styles for S&M transitions:
- # - smSpecial#{trainer_id} <-- Plays a special version
- # - smElite#{trainer_id} <-- Plays an Elite4 version
- # - smCrazy#{trainer_id} <-- Plays a crazy bg version
- #
- # Having just the trainersprite will play the animation with the default background
- # found in the Graphics/Transitions/ folder. You can use unique backgrounds for
- # your trainertypes by having the following in your folder:
- # - smBg#{trainer_id}
- # - smBgNext#{trainer_id}
- # - smBgLast#{trainer_id}
- # - smEffBg#{trainer_id} (for Elite4 variant)
- #
- # If you have the smSpecial#{trainer_id} image file in your Graphics/Transitions
- # folder, the game will play a special variant of the SM VS animation.
- #
- # New graphics for default VS backgrounds of any trainertypes registered in the
- # EVIL_TEAM_LIST array are in Graphics/Transitions/ folder:
- # - smBgEvil
- # - smBgNextEvil
- # - smBgLastEvil
- #
- # You can add special transitions for your species by having the following
- # Graphics in your Graphics/Transitions/ folder:
- # - species#{species_id}
- # - speciesBg#{species_id} (optional)
- # - speciesEffA#{species_id} (optional)
- # - speciesEffB#{species_id} (optional)
- # - speciesEffC#{species_id} (optional)
- #
- # This style is only compatible with the Next Gen UI
- #===============================================================================
- alias pbBattleAnimation_ebs pbBattleAnimation unless defined?(pbBattleAnimation_ebs)
- def pbBattleAnimation(bgm=nil,trainerid=-1,trainername="")
- handled = false
- playingBGS = nil
- playingBGM = nil
- if $game_system && $game_system.is_a?(Game_System)
- playingBGS = $game_system.getPlayingBGS
- playingBGM = $game_system.getPlayingBGM
- $game_system.bgm_pause
- $game_system.bgs_pause
- end
- $smAnim = false
- $specialSpecies = false
- pbMEFade(0.25)
- pbWait(10)
- pbMEStop
- for value in BATTLE_BGM_SPECIES
- if value[0].is_a?(Array)
- for species in value[0]
- num = species if species.is_a?(Numeric)
- num = getConst(PBSpecies,species) if species.is_a?(Symbol)
- bgm = value[1] if !num.nil? && trainerid < 0 && num == $wildSpecies
- end
- else
- num = value[0] if value[0].is_a?(Numeric)
- num = getConst(PBSpecies,value[0]) if value[0].is_a?(Symbol)
- bgm = value[1] if !num.nil? && trainerid < 0 && num == $wildSpecies
- end
- end
- if bgm
- pbBGMPlay(bgm,80)
- else
- pbBGMPlay(pbGetWildBattleBGM(0),80)
- end
- viewport = Viewport.new(0,0,Graphics.width,VIEWPORT_HEIGHT)
- viewport.z = 99999
- # Fade to gray a few times.
- viewport.color = Color.new(17*8,17*8,17*8)
- 3.times do
- viewport.color.alpha = 0
- 6.times do
- viewport.color.alpha += 30
- Graphics.update
- Input.update
- pbUpdateSceneMap
- end
- 6.times do
- viewport.color.alpha -= 30
- Graphics.update
- Input.update
- pbUpdateSceneMap
- end
- end
- if trainerid >= 0 && !handled
- tgraphic = sprintf("Graphics/Transitions/smTrainer%d",trainerid)
- tgraphic2 = sprintf("Graphics/Transitions/smSpecial%d",trainerid)
- tgraphic3 = sprintf("Graphics/Transitions/smElite%d",trainerid)
- tgraphic4 = sprintf("Graphics/Transitions/smCrazy%d",trainerid)
- e_team = false
- for val in EVIL_TEAM_LIST
- if val.is_a?(Numeric)
- id = val
- elsif val.is_a?(Symbol)
- id = getConst(PBTrainers,val)
- end
- e_team = true if !id.nil? && trainerid == id
- end
- handled = vsEvilTeam(viewport) if e_team
- if (pbResolveBitmap(tgraphic) || pbResolveBitmap(tgraphic2) || pbResolveBitmap(tgraphic3) || pbResolveBitmap(tgraphic4)) && defined?(EBUISTYLE)
- viewport.color = Color.new(255,255,255,0)
- smPreBattle(viewport) if !handled
- handled = true
- $smAnim = true
- end
- tbargraphic = sprintf("Graphics/Transitions/vsBarSpecial%s",getConstantName(PBTrainers,trainerid)) rescue nil
- tbargraphic = sprintf("Graphics/Transitions/vsBarSpecial%d",trainerid) if !pbResolveBitmap(tbargraphic)
- tgraphic = sprintf("Graphics/Transitions/vsTrainerSpecial%s",getConstantName(PBTrainers,trainerid)) rescue nil
- tgraphic = sprintf("Graphics/Transitions/vsTrainerSpecial%d",trainerid) if !pbResolveBitmap(tgraphic)
- if pbResolveBitmap(tgraphic) && !handled
- handled = vsSequenceSpecial(viewport,trainername,trainerid,tbargraphic,tgraphic)
- end
- tbargraphic = sprintf("Graphics/Transitions/vsBarElite%s",getConstantName(PBTrainers,trainerid)) rescue nil
- tbargraphic = sprintf("Graphics/Transitions/vsBarElite%d",trainerid) if !pbResolveBitmap(tbargraphic)
- tgraphic = sprintf("Graphics/Transitions/vsTrainer%s",getConstantName(PBTrainers,trainerid)) rescue nil
- tgraphic = sprintf("Graphics/Transitions/vsTrainer%d",trainerid) if !pbResolveBitmap(tgraphic)
- if pbResolveBitmap(tbargraphic) && pbResolveBitmap(tgraphic) && !handled
- handled = vsSequenceElite(viewport,trainername,trainerid,tbargraphic,tgraphic)
- end
- tbargraphic = sprintf("Graphics/Transitions/vsBarNew%s",getConstantName(PBTrainers,trainerid)) rescue nil
- tbargraphic = sprintf("Graphics/Transitions/vsBarNew%d",trainerid) if !pbResolveBitmap(tbargraphic)
- if pbResolveBitmap(tbargraphic) && pbResolveBitmap(tgraphic) && !handled
- handled = vsSequenceNew(viewport,trainername,trainerid,tbargraphic,tgraphic)
- end
- tbargraphic = sprintf("Graphics/Transitions/vsBar%s",getConstantName(PBTrainers,trainerid)) rescue nil
- tbargraphic = sprintf("Graphics/Transitions/vsBar%d",trainerid) if !pbResolveBitmap(tbargraphic)
- if pbResolveBitmap(tbargraphic) && pbResolveBitmap(tgraphic) && !handled
- handled = vsSequenceEssentials(viewport,trainername,trainerid,tbargraphic,tgraphic)
- end
- end
- if !handled && trainerid >= 0
- case rand(3)
- when 0
- ebTrainerAnimation1(viewport)
- when 1
- ebTrainerAnimation2(viewport)
- when 2
- ebTrainerAnimation3(viewport)
- end
- handled = true
- end
- if !handled
- minor = false
- if !$wildSpecies.nil?
- for species in MINOR_LEGENDARIES
- num = species if species.is_a?(Numeric)
- num = getConst(PBSpecies,species) if species.is_a?(Symbol)
- minor = true if $wildSpecies == num
- end
- special = pbResolveBitmap("Graphics/Transitions/species#{$wildSpecies}")
- end
- if !$wildSpecies.nil? && queuedIsRegi?
- ebWildAnimationRegi(viewport)
- elsif !$wildSpecies.nil? && special
- ebWildAnimationMinor(viewport,true)
- $specialSpecies = true
- elsif !$wildSpecies.nil? && minor
- ebWildAnimationMinor(viewport)
- elsif !$wildLevel.nil? && $wildLevel > $Trainer.party[0].level
- ebWildAnimationOverlevel(viewport)
- elsif $PokemonGlobal && ($PokemonGlobal.surfing || $PokemonGlobal.diving || $PokemonGlobal.fishing)
- ebWildAnimationWater(viewport)
- elsif $PokemonEncounters && $PokemonEncounters.isCave?
- ebWildAnimationCave(viewport)
- elsif pbGetMetadata($game_map.map_id,MetadataOutdoor)
- ebWildAnimationOutdoor(viewport)
- else
- ebWildAnimationIndoor(viewport)
- end
- handled = true
- end
- pbPushFade
- yield if block_given?
- pbPopFade
- if $game_system && $game_system.is_a?(Game_System)
- $game_system.bgm_resume(playingBGM)
- $game_system.bgs_resume(playingBGS)
- end
- $PokemonGlobal.nextBattleBGM = nil
- $PokemonGlobal.nextBattleME = nil
- $PokemonGlobal.nextBattleBack = nil
- $PokemonEncounters.clearStepCount
- for j in 0..17
- viewport.color = Color.new(0,0,0,(17-j)*15)
- Graphics.update
- Input.update
- pbUpdateSceneMap
- end
- viewport.dispose
- $smAnim = false
- end
- alias pbWildBattle_ebs pbWildBattle unless defined?(pbWildBattle_ebs)
- def pbWildBattle(*args)
- species = args[0]
- if species.is_a?(String) || species.is_a?(Symbol)
- $wildSpecies = getConst(PBSpecies,species)
- else
- $wildSpecies = species
- end
- $wildLevel = args[1]
- return pbWildBattle_ebs(*args)
- $wildSpecies = nil
- $wildLevel = nil
- end
- #-------------------------------------------------------------------------------
- # Custom animations for trainer battles
- #-------------------------------------------------------------------------------
- def ebTrainerAnimation1(viewport)
- ball=Sprite.new(viewport)
- ball.bitmap=pbBitmap("Graphics/Transitions/vsBall")
- ball.ox=ball.bitmap.width/2
- ball.oy=ball.bitmap.height/2
- ball.x=viewport.rect.width/2
- ball.y=viewport.rect.height/2
- ball.zoom_x=0
- ball.zoom_y=0
- 16.times do
- ball.angle+=22.5
- ball.zoom_x+=0.0625
- ball.zoom_y+=0.0625
- pbWait(1)
- end
- bmp=Graphics.snap_to_bitmap
- pbWait(8)
- ball.dispose
- black=Sprite.new(viewport)
- black.bitmap=Bitmap.new(viewport.rect.width,viewport.rect.height)
- black.bitmap.fill_rect(0,0,viewport.rect.width,viewport.rect.height,Color.new(0,0,0))
- field1=Sprite.new(viewport)
- field1.bitmap=bmp
- field1.src_rect.height=VIEWPORT_HEIGHT/2
- field2=Sprite.new(viewport)
- field2.bitmap=bmp
- field2.y=VIEWPORT_HEIGHT/2
- field2.src_rect.height=VIEWPORT_HEIGHT/2
- field2.src_rect.y=(VIEWPORT_HEIGHT+VIEWPORT_OFFSET)/2
- 16.times do
- field1.x-=viewport.rect.width/16
- field2.x+=viewport.rect.width/16
- pbWait(1)
- end
- viewport.color=Color.new(0,0,0,255)
- black.dispose
- field1.dispose
- field2.dispose
- end
- def ebTrainerAnimation2(viewport)
- bmp=Graphics.snap_to_bitmap
- black=Sprite.new(viewport)
- black.bitmap=Bitmap.new(viewport.rect.width,viewport.rect.height)
- black.bitmap.fill_rect(0,0,viewport.rect.width,viewport.rect.height,Color.new(0,0,0))
- field1=Sprite.new(viewport)
- field1.bitmap=bmp
- field1.src_rect.height=VIEWPORT_HEIGHT/2
- field2=Sprite.new(viewport)
- field2.bitmap=bmp
- field2.y=VIEWPORT_HEIGHT/2
- field2.src_rect.height=VIEWPORT_HEIGHT/2
- field2.src_rect.y=(VIEWPORT_HEIGHT+VIEWPORT_OFFSET)/2
- ball1=Sprite.new(viewport)
- ball1.bitmap=pbBitmap("Graphics/Transitions/vsBall")
- ball1.ox=ball1.bitmap.width/2
- ball1.oy=ball1.bitmap.height/2
- ball1.x=viewport.rect.width+ball1.ox
- ball1.y=viewport.rect.height/4
- ball1.zoom_x=0.5
- ball1.zoom_y=0.5
- ball2=Sprite.new(viewport)
- ball2.bitmap=pbBitmap("Graphics/Transitions/vsBall")
- ball2.ox=ball2.bitmap.width/2
- ball2.oy=ball2.bitmap.height/2
- ball2.y=(viewport.rect.height/4)*3
- ball2.x=-ball2.ox
- ball2.zoom_x=0.5
- ball2.zoom_y=0.5
- 16.times do
- ball1.x-=(viewport.rect.width/8)
- ball2.x+=(viewport.rect.width/8)
- pbWait(1)
- end
- 32.times do
- field1.x-=(viewport.rect.width/16)
- field1.y-=(viewport.rect.height/32)
- field2.x+=(viewport.rect.width/16)
- field2.y+=(viewport.rect.height/32)
- pbWait(1)
- end
- viewport.color=Color.new(0,0,0,255)
- black.dispose
- ball1.dispose
- ball2.dispose
- field1.dispose
- field2.dispose
- end
- def ebTrainerAnimation3(viewport)
- balls = {}
- rects = {}
- ball = Bitmap.new(viewport.rect.height/6,viewport.rect.height/6)
- bmp = pbBitmap("Graphics/Transitions/vsBall")
- ball.stretch_blt(Rect.new(0,0,ball.width,ball.height),bmp,Rect.new(0,0,bmp.width,bmp.height))
- for i in 0...6
- rects["#{i}"] = Sprite.new(viewport)
- rects["#{i}"].bitmap = Bitmap.new(1,viewport.rect.height/6)
- rects["#{i}"].bitmap.fill_rect(0,0,1,viewport.rect.height/6,Color.new(0,0,0))
- rects["#{i}"].x = (i%2==0) ? -32 : viewport.rect.width+32
- rects["#{i}"].ox = (i%2==0) ? 0 : 1
- rects["#{i}"].y = (viewport.rect.height/6)*i
- balls["#{i}"] = Sprite.new(viewport)
- balls["#{i}"].bitmap = ball
- balls["#{i}"].ox = ball.width/2
- balls["#{i}"].oy = ball.height/2
- balls["#{i}"].x = rects["#{i}"].x
- balls["#{i}"].y = rects["#{i}"].y + rects["#{i}"].bitmap.height/2
- end
- for j in 0...28
- for i in 0...6
- balls["#{i}"].x+=(i%2==0) ? 24 : -24
- balls["#{i}"].angle-=(i%2==0) ? 42 : -42
- rects["#{i}"].zoom_x+=24
- end
- pbWait(1)
- end
- viewport.color = Color.new(0,0,0,255)
- pbDisposeSpriteHash(balls)
- pbDisposeSpriteHash(rects)
- end
- def vsEvilTeam(viewport)
- fp = {}
- viewport.color = Color.new(0,0,0,0)
- 8.times do
- viewport.color.alpha += 32
- pbWait(1)
- end
- fp["bg"] = Sprite.new(viewport)
- fp["bg"].bitmap = pbBitmap("Graphics/Transitions/evilTeamBg")
- fp["bg"].color = Color.new(0,0,0)
- fp["bg2"] = Sprite.new(viewport)
- fp["bg2"].bitmap = pbBitmap("Graphics/Transitions/evilTeamEff5")
- fp["bg2"].ox = fp["bg2"].bitmap.width/2
- fp["bg2"].oy = fp["bg2"].bitmap.height/2
- fp["bg2"].x = viewport.rect.width/2
- fp["bg2"].y = viewport.rect.height/2
- fp["bg2"].visible = false
- speed = []
- for j in 0...16
- fp["e1_#{j}"] = Sprite.new(viewport)
- bmp = pbBitmap("Graphics/Transitions/evilTeamEff1")
- fp["e1_#{j}"].bitmap = Bitmap.new(bmp.width,bmp.height)
- w = bmp.width/(1 + rand(3))
- fp["e1_#{j}"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))
- fp["e1_#{j}"].oy = fp["e1_#{j}"].bitmap.height/2
- fp["e1_#{j}"].angle = rand(360)
- fp["e1_#{j}"].opacity = 0
- fp["e1_#{j}"].x = viewport.rect.width/2
- fp["e1_#{j}"].y = viewport.rect.height/2
- speed.push(4 + rand(5))
- end
- fp["logo"] = Sprite.new(viewport)
- fp["logo"].bitmap = pbBitmap("Graphics/Transitions/evilTeamLogo")
- fp["logo"].ox = fp["logo"].bitmap.width/2
- fp["logo"].oy = fp["logo"].bitmap.height/2
- fp["logo"].x = viewport.rect.width/2
- fp["logo"].y = viewport.rect.height/2
- fp["logo"].memorize_bitmap
- fp["logo"].bitmap = pbBitmap("Graphics/Transitions/evilTeamLogo2")
- fp["logo"].zoom_x = 2
- fp["logo"].zoom_y = 2
- fp["logo"].z = 50
- fp["ring"] = Sprite.new(viewport)
- fp["ring"].bitmap = pbBitmap("Graphics/Transitions/evilTeamEff2")
- fp["ring"].ox = fp["ring"].bitmap.width/2
- fp["ring"].oy = fp["ring"].bitmap.height/2
- fp["ring"].x = viewport.rect.width/2
- fp["ring"].y = viewport.rect.height/2
- fp["ring"].zoom_x = 0
- fp["ring"].zoom_y = 0
- fp["ring"].z = 100
- for j in 0...32
- fp["e2_#{j}"] = Sprite.new(viewport)
- bmp = pbBitmap("Graphics/Transitions/evilTeamEff4")
- fp["e2_#{j}"].bitmap = pbBitmap("Graphics/Transitions/evilTeamEff4")
- fp["e2_#{j}"].oy = fp["e2_#{j}"].bitmap.height/2
- fp["e2_#{j}"].angle = rand(360)
- fp["e2_#{j}"].opacity = 0
- fp["e2_#{j}"].x = viewport.rect.width/2
- fp["e2_#{j}"].y = viewport.rect.height/2
- fp["e2_#{j}"].z = 100
- end
- fp["ring2"] = Sprite.new(viewport)
- fp["ring2"].bitmap = pbBitmap("Graphics/Transitions/evilTeamEff3")
- fp["ring2"].ox = fp["ring2"].bitmap.width/2
- fp["ring2"].oy = fp["ring2"].bitmap.height/2
- fp["ring2"].x = viewport.rect.width/2
- fp["ring2"].y = viewport.rect.height/2
- fp["ring2"].visible = false
- fp["ring2"].zoom_x = 0
- fp["ring2"].zoom_y = 0
- fp["ring2"].z = 100
- for i in 0...32
- viewport.color.alpha -= 8 if viewport.color.alpha > 0
- fp["logo"].zoom_x -= 1/32.0
- fp["logo"].zoom_y -= 1/32.0
- for j in 0...16
- next if j > i/4
- if fp["e1_#{j}"].ox < -(viewport.rect.width/2)
- speed[j] = 4 + rand(5)
- fp["e1_#{j}"].opacity = 0
- fp["e1_#{j}"].ox = 0
- fp["e1_#{j}"].angle = rand(360)
- bmp = pbBitmap("Graphics/Transitions/evilTeamEff1")
- fp["e1_#{j}"].bitmap.clear
- w = bmp.width/(1 + rand(3))
- fp["e1_#{j}"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))
- end
- fp["e1_#{j}"].opacity += speed[j]
- fp["e1_#{j}"].ox -= speed[j]
- end
- pbWait(1)
- end
- fp["logo"].color = Color.new(255,255,255)
- fp["logo"].restore_bitmap
- fp["ring2"].visible = true
- fp["bg2"].visible = true
- viewport.color = Color.new(255,255,255)
- for i in 0...144
- if i >= 128
- viewport.color.alpha += 16
- else
- viewport.color.alpha -= 16 if viewport.color.alpha > 0
- end
- fp["logo"].color.alpha -= 16 if fp["logo"].color.alpha > 0
- fp["bg"].color.alpha -= 8 if fp["bg"].color.alpha > 0
- for j in 0...16
- if fp["e1_#{j}"].ox < -(viewport.rect.width/2)
- speed[j] = 4 + rand(5)
- fp["e1_#{j}"].opacity = 0
- fp["e1_#{j}"].ox = 0
- fp["e1_#{j}"].angle = rand(360)
- bmp = pbBitmap("Graphics/Transitions/evilTeamEff1")
- fp["e1_#{j}"].bitmap.clear
- w = bmp.width/(1 + rand(3))
- fp["e1_#{j}"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))
- end
- fp["e1_#{j}"].opacity += speed[j]
- fp["e1_#{j}"].ox -= speed[j]
- end
- for j in 0...32
- next if j > i*2
- fp["e2_#{j}"].ox -= 16
- fp["e2_#{j}"].opacity += 16
- end
- fp["ring"].zoom_x += 0.1
- fp["ring"].zoom_y += 0.1
- fp["ring"].opacity -= 8
- fp["ring2"].zoom_x += 0.2 if fp["ring2"].zoom_x < 3
- fp["ring2"].zoom_y += 0.2 if fp["ring2"].zoom_y < 3
- fp["ring2"].opacity -= 16
- fp["bg2"].angle += 2 if $PokemonSystem.screensize < 2
- pbWait(1)
- end
- pbDisposeSpriteHash(fp)
- 8.times do
- viewport.color.red -= 255/8.0
- viewport.color.green -= 255/8.0
- viewport.color.blue -= 255/8.0
- pbWait(1)
- end
- end
- #-------------------------------------------------------------------------------
- # Custom animations for wild battles
- #-------------------------------------------------------------------------------
- def queuedIsRegi?
- ret = false
- for poke in [:REGIROCK,:REGISTEEL,:REGICE,:REGIGIGAS]
- num = getConst(PBSpecies,poke)
- next if num.nil? || ret
- if $wildSpecies == num
- ret = true
- end
- end
- return ret
- end
- def ebWildAnimationRegi(viewport)
- fp = {}
- index = [PBSpecies::REGIROCK,PBSpecies::REGISTEEL,PBSpecies::REGICE,PBSpecies::REGIGIGAS].index($wildSpecies)
- width = viewport.rect.width
- height = viewport.rect.height
- viewport.color = Color.new(0,0,0,0)
- fp["back"] = Sprite.new(viewport)
- fp["back"].bitmap = Graphics.snap_to_bitmap
- fp["back"].blur_sprite
- c = index < 3 ? 0 : 255
- fp["back"].color = Color.new(c,c,c,128*(index < 3 ? 1 : 2))
- fp["back"].z = 99999
- fp["back"].opacity = 0
- x = [
- [width*0.5,width*0.25,width*0.75,width*0.25,width*0.75,width*0.25,width*0.75],
- [width*0.5,width*0.3,width*0.7,width*0.15,width*0.85,width*0.3,width*0.7],
- [width*0.5,width*0.325,width*0.675,width*0.5,width*0.5,width*0.15,width*0.85],
- [width*0.5,width*0.5,width*0.5,width*0.5,width*0.35,width*0.65,width*0.5]
- ]
- y = [
- [height*0.5,height*0.5,height*0.5,height*0.25,height*0.75,height*0.75,height*0.25],
- [height*0.5,height*0.25,height*0.75,height*0.5,height*0.5,height*0.75,height*0.25],
- [height*0.5,height*0.5,height*0.5,height*0.25,height*0.75,height*0.5,height*0.5],
- [height*0.9,height*0.74,height*0.58,height*0.4,height*0.25,height*0.25,height*0.1]
- ]
- for j in 0...14
- fp["#{j}"] = Sprite.new(viewport)
- fp["#{j}"].bitmap = pbBitmap("Graphics/Transitions/regi")
- fp["#{j}"].src_rect.set(96*(j/7),100*index,96,100)
- fp["#{j}"].ox = fp["#{j}"].src_rect.width/2
- fp["#{j}"].oy = fp["#{j}"].src_rect.height/2
- fp["#{j}"].x = x[index][j%7]
- fp["#{j}"].y = y[index][j%7]
- fp["#{j}"].opacity = 0
- fp["#{j}"].z = 99999
- end
- 8.times do
- fp["back"].opacity += 32
- pbWait(1)
- end
- k = -2
- for i in 0...72
- if index < 3
- k += 2 if i%8==0
- else
- k += (k==3 ? 2 : 1) if i%4==0
- end
- k = 6 if k > 6
- for j in 0..k
- fp["#{j}"].opacity += 32
- fp["#{j+7}"].opacity += 26 if fp["#{j}"].opacity >= 255
- fp["#{j}"].visible = fp["#{j+7}"].opacity < 255
- end
- fp["back"].color.alpha += 2 if fp["back"].color.alpha < 255
- pbWait(1)
- end
- 8.times do
- viewport.color.alpha += 32
- pbWait(1)
- end
- pbDisposeSpriteHash(fp)
- end
- def ebWildAnimationOutdoor(viewport)
- screen=Sprite.new(viewport)
- screen.bitmap=Bitmap.new(viewport.rect.width,viewport.rect.height)
- black=Color.new(0,0,0)
- width=viewport.rect.width/16
- height=viewport.rect.height/4
- for i in 0...16
- if i < 8
- x1=width+(i%8)*(width*2)
- x2=viewport.rect.width-width-(i%8)*(width*2)
- else
- x2=width+(i%8)*(width*2)
- x1=viewport.rect.width-width-(i%8)*(width*2)
- end
- y1=(i/8)*height
- y2=viewport.rect.height-height-y1
- for j in 1...3
- ext=j*(width/2)
- screen.bitmap.fill_rect(x1,y1,ext,height,black)
- screen.bitmap.fill_rect(x1-ext,y1,ext,height,black)
- screen.bitmap.fill_rect(x2,y2,ext,height,black)
- screen.bitmap.fill_rect(x2-ext,y2,ext,height,black)
- pbWait(1)
- end
- end
- viewport.color=Color.new(0,0,0,255)
- screen.dispose
- end
- def ebWildAnimationIndoor(viewport)
- screen=Sprite.new(viewport)
- screen.bitmap=Bitmap.new(viewport.rect.width,viewport.rect.height)
- black=Color.new(0,0,0)
- width=viewport.rect.width
- height=viewport.rect.height/16
- for i in 1...17
- for j in 0...16
- x=(j%2==0) ? 0 : viewport.rect.width-i*(width/16)
- screen.bitmap.fill_rect(x,j*height,i*(width/16),height,black)
- end
- pbWait(1)
- end
- viewport.color=Color.new(0,0,0,255)
- pbWait(10)
- screen.dispose
- end
- def ebWildAnimationCave(viewport)
- screen=Sprite.new(viewport)
- screen.bitmap=Bitmap.new(viewport.rect.width,viewport.rect.height)
- black=Color.new(0,0,0)
- width=viewport.rect.width/4
- height=viewport.rect.height/4
- sprites={}
- for i in 0...16
- sprites["#{i}"]=Sprite.new(viewport)
- sprites["#{i}"].bitmap=Bitmap.new(width,height)
- sprites["#{i}"].bitmap.fill_rect(0,0,width,height,black)
- sprites["#{i}"].ox=width/2
- sprites["#{i}"].oy=height/2
- sprites["#{i}"].x=width/2+width*(i%4)
- sprites["#{i}"].y=viewport.rect.height-height/2-height*(i/4)
- sprites["#{i}"].zoom_x=0
- sprites["#{i}"].zoom_y=0
- end
- seq=[[0],[4,1],[8,5,2],[12,9,6,3],[13,10,7],[14,11],[15]]
- for i in 0...seq.length
- 5.times do
- for j in 0...seq[i].length
- n=seq[i][j]
- sprites["#{n}"].zoom_x+=0.2
- sprites["#{n}"].zoom_y+=0.2
- end
- pbWait(1)
- end
- end
- viewport.color=Color.new(0,0,0,255)
- pbWait(1)
- pbDisposeSpriteHash(sprites)
- screen.dispose
- end
- def ebWildAnimationMinor(viewport,special=false)
- bmp = Graphics.snap_to_bitmap
- max = 50
- amax = 4
- frames = {}
- zoom = 1
- viewport.color = special ? Color.new(64,64,64,0) : Color.new(255,255,155,0)
- 20.times do
- viewport.color.alpha+=2
- pbWait(1)
- end
- for i in 0...(max+20)
- if !(i%2==0)
- if i > max*0.75
- zoom+=0.3
- else
- zoom-=0.01
- end
- angle = 0 if angle.nil?
- angle = (i%3==0) ? rand(amax*2) - amax : angle
- frames["#{i}"] = Sprite.new(viewport)
- frames["#{i}"].bitmap = bmp
- frames["#{i}"].src_rect.set(0,0,viewport.rect.width,viewport.rect.height)
- frames["#{i}"].ox = viewport.rect.width/2
- frames["#{i}"].oy = viewport.rect.height/2
- frames["#{i}"].x = viewport.rect.width/2
- frames["#{i}"].y = viewport.rect.height/2
- frames["#{i}"].angle = angle
- frames["#{i}"].zoom_x = zoom
- frames["#{i}"].zoom_y = zoom
- frames["#{i}"].tone = Tone.new(i/4,i/4,i/4)
- frames["#{i}"].opacity = 30
- end
- if i >= max
- viewport.color.alpha += 12
- if special
- viewport.color.red -= 64/20.0
- viewport.color.green -= 64/20.0
- viewport.color.blue -= 64/20.0
- else
- viewport.color.blue += 5
- end
- end
- pbWait(1)
- end
- frames["#{max+19}"].tone = Tone.new(255,255,255)
- pbWait(10)
- 10.times do
- next if special
- viewport.color.red-=25.5
- viewport.color.green-=25.5
- viewport.color.blue-=25.5
- pbWait(1)
- end
- pbDisposeSpriteHash(frames)
- end
- def ebWildAnimationOverlevel(viewport)
- height = viewport.rect.height/4
- width = viewport.rect.width/10
- backdrop = Sprite.new(viewport)
- backdrop.bitmap = Graphics.snap_to_bitmap
- sprite = Sprite.new(viewport)
- sprite.bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
- for j in 0...4
- y = [0,2,1,3]
- for i in 1..10
- sprite.bitmap.fill_rect(0,height*y[j],width*i,height,Color.new(255,255,255))
- backdrop.tone.red += 3
- backdrop.tone.green += 3
- backdrop.tone.blue += 3
- pbWait(1)
- end
- end
- viewport.color = Color.new(0,0,0,0)
- 10.times do
- viewport.color.alpha += 25.5
- pbWait(1)
- end
- backdrop.dispose
- sprite.dispose
- end
- def ebWildAnimationWater(viewport)
- bmp = Graphics.snap_to_bitmap
- split = 12
- n = viewport.rect.height/split
- sprites = {}
- black = Sprite.new(viewport)
- black.bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
- black.bitmap.fill_rect(0,0,black.bitmap.width,black.bitmap.height,Color.new(0,0,0))
- for i in 0...n
- sprites["#{i}"] = Sprite.new(viewport)
- sprites["#{i}"].bitmap = bmp
- sprites["#{i}"].ox = bmp.width/2
- sprites["#{i}"].x = viewport.rect.width/2
- sprites["#{i}"].y = i*split
- sprites["#{i}"].src_rect.set(0,i*split,bmp.width,split)
- sprites["#{i}"].color = Color.new(0,0,0,0)
- end
- for f in 0...64
- for i in 0...n
- o = Math.sin(f - i*0.5)
- sprites["#{i}"].x = viewport.rect.width/2 + 16*o if f >= i
- sprites["#{i}"].color.alpha += 25.5 if sprites["#{i}"].color.alpha < 255 && f >= (64 - (48-i))
- end
- pbWait(1)
- end
- viewport.color = Color.new(0,0,0,255)
- pbDisposeSpriteHash(sprites)
- end
- #-------------------------------------------------------------------------------
- # VS. animation, by Luka S.J.
- # Tweaked by Maruno.
- # (official Essentials one)
- #-------------------------------------------------------------------------------
- SE_EXTRA_PATH = " "
- def vsSequenceEssentials(viewport,trainername,trainerid,tbargraphic,tgraphic)
- outfit=$Trainer ? $Trainer.outfit : 0
- # Set up
- viewplayer=Viewport.new(0,viewport.rect.height/3,viewport.rect.width/2,128)
- viewplayer.z=viewport.z
- viewopp=Viewport.new(viewport.rect.width/2,viewport.rect.height/3,viewport.rect.width/2,128)
- viewopp.z=viewport.z
- viewvs=Viewport.new(0,0,viewport.rect.width,viewport.rect.height)
- viewvs.z=viewport.z
- xoffset=(viewport.rect.width/2)/10
- xoffset=xoffset.round
- xoffset=xoffset*10
- fade=Sprite.new(viewport)
- fade.bitmap=BitmapCache.load_bitmap("Graphics/Transitions/vsFlash")
- fade.tone=Tone.new(-255,-255,-255)
- fade.opacity=100
- overlay=Sprite.new(viewport)
- overlay.bitmap=Bitmap.new(viewport.rect.width,viewport.rect.height)
- pbSetSystemFont(overlay.bitmap)
- bar1=Sprite.new(viewplayer)
- pbargraphic=sprintf("Graphics/Transitions/vsBar%s_%d",getConstantName(PBTrainers,$Trainer.trainertype),outfit) rescue nil
- pbargraphic=sprintf("Graphics/Transitions/vsBar%d_%d",$Trainer.trainertype,outfit) if !pbResolveBitmap(pbargraphic)
- if !pbResolveBitmap(pbargraphic)
- pbargraphic=sprintf("Graphics/Transitions/vsBar%s",getConstantName(PBTrainers,$Trainer.trainertype)) rescue nil
- end
- pbargraphic=sprintf("Graphics/Transitions/vsBar%d",$Trainer.trainertype) if !pbResolveBitmap(pbargraphic)
- bar1.bitmap=BitmapCache.load_bitmap(pbargraphic)
- bar1.x=-xoffset
- bar2=Sprite.new(viewopp)
- bar2.bitmap=BitmapCache.load_bitmap(tbargraphic)
- bar2.x=xoffset
- vs=Sprite.new(viewvs)
- vs.bitmap=BitmapCache.load_bitmap("Graphics/Transitions/vs")
- vs.ox=vs.bitmap.width/2
- vs.oy=vs.bitmap.height/2
- vs.x=viewport.rect.width/2
- vs.y=viewport.rect.height/1.5
- vs.visible=false
- flash=Sprite.new(viewvs)
- flash.bitmap=BitmapCache.load_bitmap("Graphics/Transitions/vsFlash")
- flash.opacity=0
- # Animation
- 10.times do
- bar1.x+=xoffset/10
- bar2.x-=xoffset/10
- pbWait(1)
- end
- pbSEPlay("#{SE_EXTRA_PATH}Flash2")
- pbSEPlay("#{SE_EXTRA_PATH}Sword2")
- flash.opacity=255
- bar1.dispose
- bar2.dispose
- bar1=AnimatedPlane.new(viewplayer)
- bar1.bitmap=BitmapCache.load_bitmap(pbargraphic)
- player=Sprite.new(viewplayer)
- pgraphic=sprintf("Graphics/Transitions/vsTrainer%s_%d",getConstantName(PBTrainers,$Trainer.trainertype),outfit) rescue nil
- pgraphic=sprintf("Graphics/Transitions/vsTrainer%d_%d",$Trainer.trainertype,outfit) if !pbResolveBitmap(pgraphic)
- if !pbResolveBitmap(pgraphic)
- pgraphic=sprintf("Graphics/Transitions/vsTrainer%s",getConstantName(PBTrainers,$Trainer.trainertype)) rescue nil
- end
- pgraphic=sprintf("Graphics/Transitions/vsTrainer%d",$Trainer.trainertype) if !pbResolveBitmap(pgraphic)
- player.bitmap=BitmapCache.load_bitmap(pgraphic)
- player.x=-xoffset
- bar2=AnimatedPlane.new(viewopp)
- bar2.bitmap=BitmapCache.load_bitmap(tbargraphic)
- trainer=Sprite.new(viewopp)
- trainer.bitmap=BitmapCache.load_bitmap(tgraphic)
- trainer.x=xoffset
- trainer.tone=Tone.new(-255,-255,-255)
- 25.times do
- flash.opacity-=51 if flash.opacity>0
- bar1.ox-=16
- bar2.ox+=16
- pbWait(1)
- end
- 11.times do
- bar1.ox-=16
- bar2.ox+=16
- player.x+=xoffset/10
- trainer.x-=xoffset/10
- pbWait(1)
- end
- 2.times do
- bar1.ox-=16
- bar2.ox+=16
- player.x-=xoffset/20
- trainer.x+=xoffset/20
- pbWait(1)
- end
- 10.times do
- bar1.ox-=16
- bar2.ox+=16
- pbWait(1)
- end
- val=2
- flash.opacity=255
- vs.visible=true
- trainer.tone=Tone.new(0,0,0)
- textpos=[
- [_INTL("{1}",$Trainer.name),viewport.rect.width/4,(viewport.rect.height/1.5)+10,2,
- Color.new(248,248,248),Color.new(12*6,12*6,12*6)],
- [_INTL("{1}",trainername),(viewport.rect.width/4)+(viewport.rect.width/2),(viewport.rect.height/1.5)+10,2,
- Color.new(248,248,248),Color.new(12*6,12*6,12*6)]
- ]
- pbDrawTextPositions(overlay.bitmap,textpos)
- pbSEPlay("#{SE_EXTRA_PATH}Sword2")
- 70.times do
- bar1.ox-=16
- bar2.ox+=16
- flash.opacity-=25.5 if flash.opacity>0
- vs.x+=val
- vs.y-=val
- val=2 if vs.x<=(viewport.rect.width/2)-2
- val=-2 if vs.x>=(viewport.rect.width/2)+2
- pbWait(1)
- end
- 30.times do
- bar1.ox-=16
- bar2.ox+=16
- vs.zoom_x+=0.2
- vs.zoom_y+=0.2
- pbWait(1)
- end
- flash.tone=Tone.new(-255,-255,-255)
- 10.times do
- bar1.ox-=16
- bar2.ox+=16
- flash.opacity+=25.5
- pbWait(1)
- end
- # End
- player.dispose
- trainer.dispose
- flash.dispose
- vs.dispose
- bar1.dispose
- bar2.dispose
- overlay.dispose
- fade.dispose
- viewvs.dispose
- viewopp.dispose
- viewplayer.dispose
- viewport.color=Color.new(0,0,0,255)
- return true
- end
- #-------------------------------------------------------------------------------
- # New EBS VS. animation
- #-------------------------------------------------------------------------------
- def vsSequenceNew(viewport,trainername,trainerid,tbargraphic,tgraphic)
- #------------------
- # sets the face2 graphic to be the shadow instead of larger mug
- showShadow = false
- # decides whether or not to colour the vsLight(s) according to the vsBar
- colorLight = false
- # decides whether or not to return to default white colour
- colorReset = false
- #------------------
- ow = Sprite.new(viewport)
- ow.bitmap = Graphics.snap_to_bitmap
- ow.blur_sprite
- ow.opacity = 0
- ow.tone = Tone.new(-92,-92,-92)
- bmp = pbBitmap("Graphics/Transitions/vsLight3")
- globaly = viewport.rect.height*0.4
- bar = Sprite.new(viewport)
- bar.bitmap = pbBitmap(tbargraphic)
- bar.ox = bar.bitmap.width
- bar.oy = bar.bitmap.height/2
- bar.x = viewport.rect.width*2 + 64
- bar.y = globaly
- color = bar.bitmap.get_pixel(bar.bitmap.width/2,1)
- bbar1 = Sprite.new(viewport)
- bbar1.bitmap = Bitmap.new(viewport.rect.width,2)
- bbar1.bitmap.fill_rect(0,0,viewport.rect.width,2,Color.new(0,0,0))
- bbar1.y = bar.y - bar.oy
- bbar1.zoom_y = 0
- bbar1.z = 99
- bbar2 = Sprite.new(viewport)
- bbar2.bitmap = Bitmap.new(viewport.rect.width,2)
- bbar2.bitmap.fill_rect(0,0,viewport.rect.width,2,Color.new(0,0,0))
- bbar2.oy = 2
- bbar2.y = bar.y + bar.oy + 8
- bbar2.zoom_y = 0
- bbar2.z = 99
- face2 = Sprite.new(viewport)
- face2.bitmap = pbBitmap(tgraphic)
- face2.src_rect.set(0,face2.bitmap.height/4,face2.bitmap.width,face2.bitmap.height/2) if !showShadow
- face2.oy = face2.src_rect.height/2
- face2.y = globaly
- face2.zoom_x = 2 if !showShadow
- face2.zoom_y = 2 if !showShadow
- face2.opacity = showShadow ? 255 : 92
- face2.visible = false
- face2.x = showShadow ? (viewport.rect.width - face2.bitmap.width + 16) : (viewport.rect.width - face2.bitmap.width*2 + 64)
- face2.color = Color.new(0,0,0,255) if showShadow
- light3 = Sprite.new(viewport)
- light3.bitmap = Bitmap.new(bmp.width*2,bmp.height)
- for i in 0...2
- light3.bitmap.blt(bmp.width*i,0,bmp,Rect.new(0,0,bmp.width,bmp.height))
- end
- light3.x = viewport.rect.width
- light3.oy = bmp.height/2
- light3.y = globaly
- light3.color = color if colorLight
- light1 = Sprite.new(viewport)
- light1.bitmap = pbBitmap("Graphics/Transitions/vsLight1")
- light1.ox = light1.bitmap.width/2
- light1.oy = light1.bitmap.height/2
- light1.x = viewport.rect.width*0.25
- light1.y = globaly
- light1.zoom_x = 0
- light1.zoom_y = 0
- light1.color = color if colorLight
- light2 = Sprite.new(viewport)
- light2.bitmap = pbBitmap("Graphics/Transitions/vsLight2")
- light2.ox = light2.bitmap.width/2
- light2.oy = light2.bitmap.height/2
- light2.x = viewport.rect.width*0.25
- light2.y = globaly
- light2.zoom_x = 0
- light2.zoom_y = 0
- light2.color = color if colorLight
- vs = Sprite.new(viewport)
- vs.bitmap = pbBitmap("Graphics/Transitions/vs")
- vs.ox = vs.bitmap.width/2
- vs.oy = vs.bitmap.height/2
- vs.x = viewport.rect.width*0.25
- vs.y = globaly
- vs.opacity = 0
- vs.zoom_x = 4
- vs.zoom_y = 4
- face1 = Sprite.new(viewport)
- face1.bitmap = pbBitmap(tgraphic)
- face1.oy = face1.bitmap.height/2
- face1.y = globaly
- face1.x = viewport.rect.width
- face1.color = Color.new(0,0,0,255)
- name = Sprite.new(viewport)
- name.bitmap = Bitmap.new(viewport.rect.width/2,96)
- pbSetSystemFont(name.bitmap)
- name.ox = name.bitmap.width/2
- name.x = viewport.rect.width*0.75
- name.y = bar.y + bar.oy
- pbDrawTextPositions(name.bitmap,[[trainername,name.bitmap.width/2,4,2,Color.new(255,255,255),nil]])
- name.visible = false
- ripples = Sprite.new(viewport)
- ripples.bitmap = pbBitmap("Graphics/Transitions/ripples")
- ripples.ox = ripples.bitmap.width/2
- ripples.oy = ripples.bitmap.height/2
- ripples.x = vs.x
- ripples.y = globaly
- ripples.opacity = 0
- ripples.z = 99
- ripples.zoom_x = 0.0
- ripples.zoom_y = 0.0
- 8.times do
- light1.zoom_x+=1.0/16
- light1.zoom_y+=1.0/16
- light2.zoom_x+=1.0/8
- light2.zoom_y+=1.0/8
- light1.angle-=32
- light2.angle+=64
- light3.x-=64
- ow.opacity+=12.8
- pbWait(1)
- end
- n = false
- k = false
- max = 224
- for i in 0...max
- n = !n if i%8==0
- k = !k if i%4==0
- ow.opacity+=12.8 if ow.opacity < 255
- light1.zoom_x+=(n ? 1.0/16 : -1.0/16)
- light1.zoom_y+=(n ? 1.0/16 : -1.0/16)
- light1.angle-=16
- light2.angle+=32
- light3.x-=32
- light3.x = 0 if light3.x <= -light3.bitmap.width/2
- if i >= 32 && i < 41
- bar.x-=64
- pbSEPlay("#{SE_EXTRA_PATH}Ice8",80) if i==32
- end
- if i >= 32
- face1.x-=(face1.x-viewport.rect.width/2)*0.1
- end
- viewport.color.alpha-=255/20.0 if viewport.color.alpha > 0
- face2.x -= (showShadow ? -1 : 1) if i%(showShadow ? 4 : 2)==0 && face2.visible
- vs.x+=(k ? 2 : -2)/2 if i >= 72
- vs.y-=(k ? 2 : -2)/2 if i >= 72
- ripples.opacity-=12.8 if ripples.opacity > 0
- ripples.zoom_x+=0.2 if ripples.opacity > 0
- ripples.zoom_y+=0.2 if ripples.opacity > 0
- if i > 62
- vs.opacity+=25.5 if vs.opacity < 255
- vs.zoom_x-=0.2 if vs.zoom_x > 1
- vs.zoom_y-=0.2 if vs.zoom_y > 1
- end
- if i==72
- viewport.color = Color.new(255,255,255,255)
- ow.color = Color.new(0,0,0,255)
- face2.visible = true
- face1.color = Color.new(0,0,0,0)
- name.visible = true
- ripples.opacity = 255
- pbSEPlay("#{SE_EXTRA_PATH}Saint9",50)
- pbSEPlay("#{SE_EXTRA_PATH}Flash2",50)
- if colorReset
- light1.color = Color.new(0,0,0,0)
- light2.color = Color.new(0,0,0,0)
- light3.color = Color.new(0,0,0,0)
- end
- end
- if i >= max-8
- bbar1.zoom_y+=8
- bbar2.zoom_y+=8
- name.opacity-=255/4.0
- end
- pbWait(1)
- end
- viewport.color = Color.new(0,0,0,255)
- ow.dispose
- bar.dispose
- bbar1.dispose
- bbar2.dispose
- face1.dispose
- face2.dispose
- light1.dispose
- light2.dispose
- light3.dispose
- ripples.dispose
- vs.dispose
- return true
- end
- #-------------------------------------------------------------------------------
- # Elite Four EBS VS. animation
- #-------------------------------------------------------------------------------
- def vsSequenceElite(viewport,trainername,trainerid,tbargraphic,tgraphic)
- ow = Sprite.new(viewport)
- ow.bitmap = Graphics.snap_to_bitmap
- ow.blur_sprite
- ow.opacity = 0
- ow.tone = Tone.new(-92,-92,-92)
- effect1 = Sprite.new(viewport)
- effect1.bitmap = pbBitmap("Graphics/Transitions/vsBg")
- effect1.ox = effect1.bitmap.width/2
- effect1.x = viewport.rect.width/2
- effect1.oy = effect1.bitmap.height/2
- effect1.y = viewport.rect.height/2
- effect1.visible = false
- names = Sprite.new(viewport)
- names.bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
- names.z = 999
- pbSetSystemFont(names.bitmap)
- txt = [
- [trainername,viewport.rect.width*0.25,viewport.rect.height*0.25+32,2,Color.new(255,255,255),Color.new(32,32,32)],
- [$Trainer.name,viewport.rect.width*0.75,viewport.rect.height*0.75+32,2,Color.new(255,255,255),Color.new(32,32,32)]
- ]
- pbDrawTextPositions(names.bitmap,txt)
- names.visible = false
- bmp = pbBitmap("Graphics/Transitions/vsLight3")
- bar1 = Sprite.new(viewport)
- bar1.bitmap = pbBitmap(tbargraphic)
- bar1.oy = bar1.bitmap.height/2
- bar1.y = viewport.rect.height*0.25
- bar1.x = viewport.rect.width
- light1 = Sprite.new(viewport)
- light1.bitmap = Bitmap.new(bmp.width*2,bmp.height)
- for i in 0...2
- light1.bitmap.blt(bmp.width*i,0,bmp,Rect.new(0,0,bmp.width,bmp.height))
- end
- light1.x = viewport.rect.width
- light1.oy = bmp.height/2
- light1.y = viewport.rect.height*0.25
- shadow1 = Sprite.new(viewport)
- shadow1.bitmap = pbBitmap(tgraphic)
- shadow1.oy = shadow1.bitmap.height/2
- shadow1.y = viewport.rect.height*0.25
- shadow1.x = viewport.rect.width/2 - 16
- shadow1.color = Color.new(0,0,0,255)
- shadow1.opacity = 96
- shadow1.visible = false
- face1 = Sprite.new(viewport)
- face1.bitmap = pbBitmap(tgraphic)
- face1.oy = face1.bitmap.height/2
- face1.y = viewport.rect.height*0.25
- face1.x = viewport.rect.width
- face1.color = Color.new(0,0,0,255)
- #-------------------
- outfit=$Trainer ? $Trainer.outfit : 0
- pbargraphic=sprintf("Graphics/Transitions/vsBarElite%s_%d",getConstantName(PBTrainers,$Trainer.trainertype),outfit) rescue nil
- pbargraphic=sprintf("Graphics/Transitions/vsBarElite%d_%d",$Trainer.trainertype,outfit) if !pbResolveBitmap(pbargraphic)
- if !pbResolveBitmap(pbargraphic)
- pbargraphic=sprintf("Graphics/Transitions/vsBarElite%s",getConstantName(PBTrainers,$Trainer.trainertype)) rescue nil
- end
- pbargraphic=sprintf("Graphics/Transitions/vsBarElite%d",$Trainer.trainertype) if !pbResolveBitmap(pbargraphic)
- pgraphic=sprintf("Graphics/Transitions/vsTrainer%s_%d",getConstantName(PBTrainers,$Trainer.trainertype),outfit) rescue nil
- pgraphic=sprintf("Graphics/Transitions/vsTrainer%d_%d",$Trainer.trainertype,outfit) if !pbResolveBitmap(pgraphic)
- if !pbResolveBitmap(pgraphic)
- pgraphic=sprintf("Graphics/Transitions/vsTrainer%s",getConstantName(PBTrainers,$Trainer.trainertype)) rescue nil
- end
- pgraphic=sprintf("Graphics/Transitions/vsTrainer%d",$Trainer.trainertype) if !pbResolveBitmap(pgraphic)
- #-------------------
- bar2 = Sprite.new(viewport)
- bar2.bitmap = pbBitmap(pbargraphic)
- bar2.oy = bar2.bitmap.height/2
- bar2.y = viewport.rect.height*0.75
- bar2.x = -bar2.bitmap.width
- light2 = Sprite.new(viewport)
- light2.bitmap = light1.bitmap.clone
- light2.mirror = true
- light2.x = -light2.bitmap.width
- light2.oy = bmp.height/2
- light2.y = viewport.rect.height*0.75
- shadow2 = Sprite.new(viewport)
- shadow2.bitmap = pbBitmap(pgraphic)
- shadow2.oy = shadow2.bitmap.height/2
- shadow2.y = viewport.rect.height*0.75
- shadow2.x = 16
- shadow2.color = Color.new(0,0,0,255)
- shadow2.opacity = 96
- shadow2.visible = false
- face2 = Sprite.new(viewport)
- face2.bitmap = pbBitmap(pgraphic)
- face2.oy = face2.bitmap.height/2
- face2.y = viewport.rect.height*0.75
- face2.x = -face2.bitmap.width
- face2.color = Color.new(0,0,0,255)
- ripples = Sprite.new(viewport)
- ripples.bitmap = pbBitmap("Graphics/Transitions/ripples")
- ripples.ox = ripples.bitmap.width/2
- ripples.oy = ripples.bitmap.height/2
- ripples.x = viewport.rect.width/2
- ripples.y = viewport.rect.height/2
- ripples.opacity = 0
- ripples.zoom_x = 0.0
- ripples.zoom_y = 0.0
- ripples.z = 999
- vs = Sprite.new(viewport)
- vs.bitmap = pbBitmap("Graphics/Transitions/vs")
- vs.ox = vs.bitmap.width/2
- vs.oy = vs.bitmap.height/2
- vs.x = viewport.rect.width/2
- vs.y = viewport.rect.height/2
- vs.opacity = 0
- vs.zoom_x = 4
- vs.zoom_y = 4
- vs.z = 999
- max = 224
- k = false
- for i in 0...max
- k = !k if i%4==0
- viewport.color.alpha-=255/16.0 if viewport.color.alpha > 0
- ow.opacity+=12.8 if ow.opacity < 255
- light1.x-=(light1.x > 0) ? 64 : 32
- light1.x = 0 if light1.x <= -light1.bitmap.width/2
- bar1.x-=(bar1.x)*0.2 if i >= 32
- face1.x-=(face1.x-viewport.rect.width/2)*0.1 if i >= 16
- face2.x+=(0-face2.x)*0.1 if i >= 16
- light2.x+=(light2.x < -light2.bitmap.width/2) ? 64 : 32
- light2.x = -light2.bitmap.width/2 if light2.x >= 0
- bar2.x+=(0-bar2.x)*0.2 if i >= 32
- effect1.angle+=2 if $PokemonSystem.screensize < 2
- vs.x+=(k ? 2 : -2)/2 if i >= 72
- vs.y-=(k ? 2 : -2)/2 if i >= 72
- ripples.opacity-=12.8 if ripples.opacity > 0
- ripples.zoom_x+=0.2 if ripples.opacity > 0
- ripples.zoom_y+=0.2 if ripples.opacity > 0
- if i%4 == 0
- shadow1.x-=1
- shadow2.x+=1
- end
- if i > 62 && i < max-16
- vs.opacity+=25.5 if vs.opacity < 255
- vs.zoom_x-=0.2 if vs.zoom_x > 1
- vs.zoom_y-=0.2 if vs.zoom_y > 1
- end
- if i == 72
- face1.color = Color.new(0,0,0,0)
- face2.color = Color.new(0,0,0,0)
- viewport.color = Color.new(255,255,255,255)
- ow.color = Color.new(0,0,0,255)
- effect1.visible = true
- ripples.opacity = 255
- names.visible = true
- shadow1.visible = true
- shadow2.visible = true
- pbSEPlay("#{SE_EXTRA_PATH}Saint9",50)
- pbSEPlay("#{SE_EXTRA_PATH}Flash2",50)
- end
- viewport.color = Color.new(0,0,0,0) if i == max-17
- if i >= max-16
- vs.zoom_x+=0.2
- vs.zoom_y+=0.2
- viewport.color.alpha+=255/8.0
- end
- pbWait(1)
- end
- viewport.color = Color.new(0,0,0,255)
- ow.dispose
- effect1.dispose
- bar1.dispose
- bar2.dispose
- light1.dispose
- light2.dispose
- face1.dispose
- face2.dispose
- shadow1.dispose
- shadow2.dispose
- names.dispose
- vs.dispose
- ripples.dispose
- return true
- end
- #-------------------------------------------------------------------------------
- # Special EBS VS. animation
- #-------------------------------------------------------------------------------
- def vsSequenceSpecial(viewport,trainername,trainerid,tbargraphic,tgraphic)
- ow = Sprite.new(viewport)
- ow.bitmap = Graphics.snap_to_bitmap
- ow.blur_sprite
- ow.opacity = 0
- bg = Sprite.new(viewport)
- bg.visible = false
- light = AnimatedPlane.new(viewport)
- light.bitmap = pbBitmap("Graphics/Transitions/vsSpecialLight")
- light.opacity = 0
- vss = Sprite.new(viewport)
- vss.bitmap = pbBitmap("Graphics/Transitions/vs")
- vss.color = Color.new(0,0,0,255)
- vss.ox = vss.bitmap.width/2
- vss.oy = vss.bitmap.height/2
- vss.x = 110 + 16
- vss.y = 132 + 16
- vss.opacity = 128
- vss.visible = false
- vs = Sprite.new(viewport)
- vs.bitmap = pbBitmap("Graphics/Transitions/vs")
- vs.ox = vs.bitmap.width/2
- vs.oy = vs.bitmap.height/2
- vs.x = 110
- vs.y = 132
- vs.visible = false
- names = Sprite.new(viewport)
- names.x = 6
- names.y = 4
- names.opacity = 128
- names.color = Color.new(0,0,0,255)
- names.visible = false
- name = Sprite.new(viewport)
- name.bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
- name.bitmap.font.name = "Arial"
- name.bitmap.font.size = 48
- name.visible = false
- pbDrawOutlineText(name.bitmap,64,viewport.rect.height-160,-1,-1,"#{trainername}",Color.new(255,255,255),Color.new(0,0,0),2)
- names.bitmap = name.bitmap.clone
- border1 = Sprite.new(viewport)
- border1.bitmap = pbBitmap("Graphics/Transitions/vsBorder")
- border1.zoom_x = 1.2
- border1.y = -border1.bitmap.height
- border1.z = 99
- border2 = Sprite.new(viewport)
- border2.bitmap = pbBitmap("Graphics/Transitions/vsBorder")
- border2.zoom_x = 1.2
- border2.x = viewport.rect.width
- border2.angle = 180
- border2.y = viewport.rect.height+border2.bitmap.height
- border2.z = 99
- trainer = Sprite.new(viewport)
- trainer.bitmap = pbBitmap(tgraphic)
- trainer.x = 0
- trainer.ox = trainer.bitmap.width
- trainer.z = 100
- trainer.color = Color.new(0,0,0,255)
- shadow = Sprite.new(viewport)
- shadow.bitmap = pbBitmap(tgraphic)
- shadow.x = viewport.rect.width + 22
- shadow.ox = shadow.bitmap.width
- shadow.y = 22
- shadow.color = Color.new(0,0,0,255)
- shadow.opacity = 128
- shadow.visible = false
- if pbResolveBitmap(tbargraphic)
- bg.bitmap = pbBitmap(tbargraphic)
- else
- bg.bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
- color = trainer.getAvgColor
- avg = ((color.red+color.green+color.blue)/3)-120
- color = Color.new(color.red-avg,color.green-avg,color.blue-avg)
- bg.bitmap.fill_rect(0,0,viewport.rect.width,viewport.rect.height,color)
- end
- y1 = border1.y.to_f
- y2 = border2.y.to_f
- 30.times do
- ow.opacity += 12.8
- y1 += ((70-border1.bitmap.height)-y1)*0.2
- border1.y = y1
- y2 -= (y2-(viewport.rect.height+border2.bitmap.height-70))*0.2
- border2.y = y2
- light.opacity+=12.8
- light.ox += 24
- pbWait(1)
- end
- 40.times do
- trainer.x += ((viewport.rect.width)-trainer.x)*0.2
- light.ox += 24
- pbWait(1)
- end
- viewport.tone = Tone.new(255,255,255)
- bg.visible = true
- shadow.visible = true
- vs.visible = true
- vss.visible = true
- name.visible = true
- names.visible = true
- trainer.color = Color.new(0,0,0,0)
- p = 1
- 20.times do
- viewport.tone.red -= 255/20.0
- viewport.tone.green -= 255/20.0
- viewport.tone.blue -= 255/20.0
- light.ox += 24
- vs.x += p; vs.y -= p
- p = -1 if vs.x >= 112
- p = +1 if vs.x <= 108
- vss.x = vs.x + 16; vss.y = vs.y + 16
- pbWait(1)
- end
- 120.times do
- light.ox += 24
- vs.x += p; vs.y -= p
- p = -1 if vs.x >= 112
- p = +1 if vs.x <= 108
- vss.x = vs.x + 16; vss.y = vs.y + 16
- pbWait(1)
- end
- y1 = border1.y.to_f
- y2 = border2.y.to_f
- 6.times do
- trainer.x -= 1
- shadow.x = trainer.x + 22
- light.ox += 24
- vs.x += p; vs.y -= p
- p = -1 if vs.x >= 112
- p = +1 if vs.x <= 108
- vss.x = vs.x + 16; vss.y = vs.y + 16
- pbWait(1)
- end
- 30.times do
- trainer.x += ((viewport.rect.width*2)-trainer.x)*0.2
- shadow.x = trainer.x + 22
- y1 += ((0)-y1)*0.2
- border1.y = y1
- y2 -= (y2-(viewport.rect.height))*0.2
- border2.y = y2
- light.ox += 24
- vs.x += p; vs.y -= p
- p = -1 if vs.x >= 112
- p = +1 if vs.x <= 108
- vss.x = vs.x + 16; vss.y = vs.y + 16
- pbWait(1)
- end
- ow.dispose
- bg.dispose
- vs.dispose
- vss.dispose
- name.dispose
- names.dispose
- trainer.dispose
- shadow.dispose
- light.dispose
- viewport.color=Color.new(0,0,0,255)
- return true
- end
- #-------------------------------------------------------------------------------
- # Sun & Moon VS animation logic
- #-------------------------------------------------------------------------------
- # used to play that little "rainbow" zoom before the battle starts
- def smPreBattle(viewport)
- bmp = Graphics.snap_to_bitmap
- fp = {}
- fp["bg1"] = Sprite.new(viewport)
- fp["bg1"].bitmap = bmp
- fp["bg1"].ox = bmp.width/2
- fp["bg1"].oy = bmp.height/2
- fp["bg1"].x = viewport.rect.width/2
- fp["bg1"].y = viewport.rect.height/2
- fp["bg2"] = Sprite.new(viewport)
- fp["bg2"].bitmap = bmp
- fp["bg2"].blur_sprite(3)
- fp["bg2"].ox = bmp.width/2
- fp["bg2"].oy = bmp.height/2
- fp["bg2"].x = viewport.rect.width/2
- fp["bg2"].y = viewport.rect.height/2
- fp["bg2"].opacity = 0
- fp["glow1"] = Sprite.new(viewport)
- fp["glow1"].bitmap = pbBitmap("Graphics/Transitions/smGlow1")
- fp["glow1"].ox = fp["glow1"].bitmap.width/2
- fp["glow1"].oy = fp["glow1"].bitmap.height/2
- fp["glow1"].x = viewport.rect.width/2
- fp["glow1"].y = viewport.rect.height/2
- fp["glow1"].zoom_x = 0.35
- fp["glow1"].zoom_y = 0.35
- fp["glow1"].opacity = 0
- fp["glow2"] = Sprite.new(viewport)
- fp["glow2"].bitmap = pbBitmap("Graphics/Transitions/smGlow1")
- fp["glow2"].ox = fp["glow1"].bitmap.width/2
- fp["glow2"].oy = fp["glow1"].bitmap.height/2
- fp["glow2"].x = viewport.rect.width/2
- fp["glow2"].y = viewport.rect.height/2
- fp["glow2"].zoom_x = 0.1
- fp["glow2"].zoom_y = 0.1
- fp["glow2"].opacity = 0
- for i in 0...32
- fp["bg1"].zoom_x += 0.02
- fp["bg1"].zoom_y += 0.02
- fp["bg2"].zoom_x += 0.02
- fp["bg2"].zoom_y += 0.02
- fp["bg2"].opacity += 12
- if i >= 16
- fp["bg2"].tone.red += 16
- fp["bg2"].tone.green += 16
- fp["bg2"].tone.blue += 16
- end
- if i >= 28
- fp["glow1"].opacity += 64
- fp["glow1"].zoom_x += 0.02
- fp["glow1"].zoom_y += 0.02
- end
- Graphics.update
- end
- for i in 0...52
- fp["glow1"].zoom_x += 0.02
- fp["glow1"].zoom_y += 0.02
- if i >= 8
- fp["glow2"].opacity += 64
- fp["glow2"].zoom_x += 0.02
- fp["glow2"].zoom_y += 0.02
- end
- if i >= 36
- viewport.color.alpha += 16
- end
- Graphics.update
- end
- pbDisposeSpriteHash(fp)
- end
- # handler for the different Sun/Moon transitions
- class PokeBattle_Scene
- attr_accessor :sequenceType
- def startSMSequence(viewport,trainerid)
- @vs = {}
- return crazySequence_start(viewport,trainerid) if pbResolveBitmap(sprintf("Graphics/Transitions/smCrazy%d",trainerid))
- return vsSequenceSM_start(viewport,trainerid)
- end
- def updateSMSequence
- return crazySequence_update if sequenceType == 1
- return vsSequenceSM_update
- end
- def endSMSequence
- return crazySequence_end if sequenceType == 1
- return vsSequenceSM_end
- end
- def sendoutSMSequence
- $smAnim = false
- return crazySequence_sendout if sequenceType == 1
- return vsSequenceSM_sendout
- end
- end
- #-------------------------------------------------------------------------------
- # Classic Sun Moon VS sequences
- #-------------------------------------------------------------------------------
- class PokeBattle_Scene
- # actual Sun/Moon intro sequence gets handled here
- def vsSequenceSM_start(viewport,trainerid)
- # checks for variants of the sequel
- @smSpecial = pbResolveBitmap(sprintf("Graphics/Transitions/smSpecial%d",trainerid))
- @smElite = pbResolveBitmap(sprintf("Graphics/Transitions/smElite%d",trainerid))
- @smSpecial = false if @smElite
- # checks if trainer belongs to the evil team
- evil = false
- for val in EVIL_TEAM_LIST
- if val.is_a?(Numeric)
- id = val
- elsif val.is_a?(Symbol)
- id = getConst(PBTrainers,val)
- end
- evil = true if !id.nil? && trainerid == id
- end
- # sets the color to white
- viewport.color = Color.new(255,255,255) if !evil
- bgstring = "Graphics/Transitions/smBg#{trainerid}"
- bgstring2 = "Graphics/Transitions/smBgNext#{trainerid}"
- bgstring3 = "Graphics/Transitions/smBgLast#{trainerid}"
- if @smElite
- # Elite4 variant
- @vs["bg"] = Sprite.new(viewport)
- str = sprintf("Graphics/Transitions/smEffBg%d",trainerid)
- str = "Graphics/Transitions/smEffBg" if !pbResolveBitmap(str)
- @vs["bg"].bitmap = pbBitmap(str)
- else
- # Regular and special animations
- @vs["bg"] = @smSpecial ? RainbowSprite.new(viewport) : ScrollingSprite.new(viewport)
- @vs["bg"].setBitmap("Graphics/Transitions/smBgDefault")
- @vs["bg"].setBitmap("Graphics/Transitions/smBgEvil") if evil
- @vs["bg"].setBitmap(bgstring) if pbResolveBitmap(bgstring)
- @vs["bg"].setBitmap("Graphics/Transitions/smBgSpecial") if @smSpecial
- end
- @vs["bg"].color = Color.new(0,0,0,255)
- @vs["bg"].speed = @smSpecial ? 4 : 32 if !@smElite
- @vs["bg"].ox = @vs["bg"].src_rect.width/2
- @vs["bg"].oy = @vs["bg"].src_rect.height/2
- @vs["bg"].x = viewport.rect.width/2
- @vs["bg"].y = viewport.rect.height/2
- @vs["bg"].angle = - 8 if !@smSpecial && !@smElite && $PokemonSystem.screensize < 2
- @vs["bg"].z = 200
- if !@smSpecial && !@smElite
- # loads the rest of the scrolling panorama
- @vs["bg2"] = ScrollingSprite.new(viewport)
- @vs["bg2"].setBitmap("Graphics/Transitions/smBgLastDefault",false,true)
- @vs["bg2"].setBitmap("Graphics/Transitions/smBgLastEvil",false,true) if evil
- @vs["bg2"].setBitmap(bgstring3,false,true) if pbResolveBitmap(bgstring3)
- @vs["bg2"].color = Color.new(0,0,0,255)
- @vs["bg2"].speed = 64
- @vs["bg2"].ox = @vs["bg2"].src_rect.width/2
- @vs["bg2"].oy = @vs["bg2"].src_rect.height/2
- @vs["bg2"].x = viewport.rect.width/2
- @vs["bg2"].y = viewport.rect.height/2
- @vs["bg2"].angle = - 8 if $PokemonSystem.screensize < 2
- @vs["bg2"].z = 200
- @vs["bg3"] = ScrollingSprite.new(viewport)
- @vs["bg3"].setBitmap("Graphics/Transitions/smBgNextDefault",false,true)
- @vs["bg3"].setBitmap("Graphics/Transitions/smBgNextEvil",false,true) if evil
- @vs["bg3"].setBitmap(bgstring2,false,true) if pbResolveBitmap(bgstring2)
- @vs["bg3"].color = Color.new(0,0,0,255)
- @vs["bg3"].speed = 80
- @vs["bg3"].ox = @vs["bg3"].src_rect.width/2
- @vs["bg3"].oy = @vs["bg3"].src_rect.height/2
- @vs["bg3"].x = viewport.rect.width/2
- @vs["bg3"].y = viewport.rect.height/2
- @vs["bg3"].angle = - 8 if $PokemonSystem.screensize < 2
- @vs["bg3"].z = 200
- end
- @vsFp = {}
- @fpDx = []
- @fpDy = []
- @fpIndex = 0
- if @smSpecial
- # loads particles for special variant
- @vsFp["ring"] = Sprite.new(viewport)
- @vsFp["ring"].bitmap = pbBitmap("Graphics/Transitions/smRing")
- @vsFp["ring"].ox = @vsFp["ring"].bitmap.width/2
- @vsFp["ring"].oy = @vsFp["ring"].bitmap.height/2
- @vsFp["ring"].x = viewport.rect.width/2
- @vsFp["ring"].y = viewport.rect.height
- @vsFp["ring"].zoom_x = 0
- @vsFp["ring"].zoom_y = 0
- @vsFp["ring"].z = 500
- for j in 0...32
- @vsFp["s#{j}"] = Sprite.new(viewport)
- @vsFp["s#{j}"].bitmap = pbBitmap("Graphics/Transitions/smSpec")
- @vsFp["s#{j}"].ox = @vsFp["s#{j}"].bitmap.width/2
- @vsFp["s#{j}"].oy = @vsFp["s#{j}"].bitmap.height/2
- @vsFp["s#{j}"].opacity = 0
- @vsFp["s#{j}"].z = 220
- @fpDx.push(0)
- @fpDy.push(0)
- end
- @fpSpeed = []
- @fpOpac = []
- for j in 0...3
- k = j+1
- speed = 2 + rand(5)
- @vsFp["p#{j}"] = ScrollingSprite.new(viewport)
- @vsFp["p#{j}"].setBitmap("Graphics/Transitions/smSpecEff#{k}")
- @vsFp["p#{j}"].speed = speed*4
- @vsFp["p#{j}"].direction = -1
- @vsFp["p#{j}"].opacity = 0
- @vsFp["p#{j}"].z = 400
- @vsFp["p#{j}"].zoom_y = 1 + rand(10)*0.005
- @fpSpeed.push(speed)
- @fpOpac.push(4) if j > 0
- end
- end
- if @smElite
- # loads particles for Elite4 variant
- for j in 0...16
- @vsFp["e#{j}"] = Sprite.new(viewport)
- bmp = pbBitmap("Graphics/Transitions/smEff1")
- @vsFp["e#{j}"].bitmap = Bitmap.new(bmp.width,bmp.height)
- w = bmp.width/(1 + rand(3))
- @vsFp["e#{j}"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))
- @vsFp["e#{j}"].oy = @vsFp["e#{j}"].bitmap.height/2
- @vsFp["e#{j}"].angle = rand(360)
- @vsFp["e#{j}"].opacity = 0
- @vsFp["e#{j}"].x = viewport.rect.width/2
- @vsFp["e#{j}"].y = viewport.rect.height/2
- @vsFp["e#{j}"].speed = (4 + rand(5))
- @vsFp["e#{j}"].z = 220
- end
- for j in 0...3
- @vsFp["ec#{j}"] = Sprite.new(viewport)
- @vsFp["ec#{j}"].bitmap = pbBitmap("Graphics/Transitions/smEff2")
- @vsFp["ec#{j}"].ox = @vsFp["ec#{j}"].bitmap.width/2
- @vsFp["ec#{j}"].oy = @vsFp["ec#{j}"].bitmap.height/2
- @vsFp["ec#{j}"].x = viewport.rect.width/2
- @vsFp["ec#{j}"].y = viewport.rect.height/2
- @vsFp["ec#{j}"].zoom_x = 1.5
- @vsFp["ec#{j}"].zoom_y = 1.5
- @vsFp["ec#{j}"].opacity = 0
- @vsFp["ec#{j}"].z = 220
- end
- @vs["bg2"] = Sprite.new(viewport)
- @vs["bg2"].bitmap = pbBitmap("Graphics/Transitions/smEff3")
- @vs["bg2"].ox = @vs["bg2"].src_rect.width/2
- @vs["bg2"].oy = @vs["bg2"].src_rect.height/2
- @vs["bg2"].x = viewport.rect.width/2
- @vs["bg2"].y = viewport.rect.height/2
- @vs["bg2"].opacity = 0
- @vs["bg2"].z = 200
- end
- # trainer and trainer effect graphics
- @vs["shade"] = Sprite.new(viewport)
- @vs["shade"].z = 250
- @vs["glow"] = Sprite.new(viewport)
- @vs["glow"].y = viewport.rect.height
- @vs["glow"].z = 250
- @vs["glow2"] = Sprite.new(viewport)
- @vs["glow2"].x = viewport.rect.width/2
- @vs["glow2"].z = 250
- @vs["trainer"] = Sprite.new(viewport)
- @vs["trainer"].z = 350
- @vs["trainer"].bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
- @vs["trainer"].ox = @vs["trainer"].bitmap.width/2
- @vs["trainer"].oy = @vs["trainer"].bitmap.height/2
- @vs["trainer"].x = @vs["trainer"].ox
- @vs["trainer"].y = @vs["trainer"].oy
- @vs["trainer"].tone = Tone.new(255,255,255)
- @vs["trainer"].zoom_x = 1.32
- @vs["trainer"].zoom_y = 1.32
- @vs["trainer"].opacity = 0
- t_ext = @smSpecial ? "Special" : "Trainer"
- t_ext = "Elite" if @smElite
- bmp = pbBitmap("Graphics/Transitions/sm#{t_ext}#{trainerid}")
- ox = (@vs["trainer"].bitmap.width - bmp.width)/2
- oy = (@vs["trainer"].bitmap.height - bmp.height)/2
- @vs["trainer"].bitmap.blt(ox,oy,bmp,Rect.new(0,0,bmp.width,bmp.height))
- bmp = @vs["trainer"].bitmap.clone
- @vs["shade"].bitmap = bmp.clone
- @vs["shade"].color = @smElite ? Color.new(150,115,255,204) : Color.new(10,169,245,204)
- @vs["shade"].opacity = 0
- @vs["glow"].bitmap = bmp.clone
- @vs["glow"].glow(Color.new(0,0,0),35,false)
- @vs["glow"].src_rect.set(0,viewport.rect.height,viewport.rect.width/2,0)
- @vs["glow2"].bitmap = @vs["glow"].bitmap.clone
- @vs["glow2"].src_rect.set(viewport.rect.width/2,0,viewport.rect.width/2,0)
- @vs["overlay"] = Sprite.new(viewport)
- @vs["overlay"].z = 999
- obmp = pbBitmap("Graphics/Transitions/ballTransition")
- @vs["overlay"].bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
- @vs["overlay"].opacity = 0
- # starts playing the intro of the animation
- 16.times do
- viewport.color.alpha -= 16 if viewport.color.alpha > 0
- @vs["trainer"].zoom_x -= 0.02
- @vs["trainer"].zoom_y -= 0.02
- @vs["trainer"].opacity += 32
- Graphics.update
- end
- @vs["trainer"].zoom_x = 1; @vs["trainer"].zoom_y = 1
- @commandWindow.drawLineup
- @commandWindow.lineupY(-32)
- for i in 0...16
- @commandWindow.showArrows if i < 10
- @vs["trainer"].tone.red -= 16
- @vs["trainer"].tone.green -= 16
- @vs["trainer"].tone.blue -= 16
- @vs["bg"].color.alpha -= 16
- if !@smSpecial && !@smElite
- @vs["bg2"].color.alpha -= 16
- @vs["bg3"].color.alpha -= 16
- end
- if @smSpecial
- @vsFp["ring"].zoom_x += 0.2
- @vsFp["ring"].zoom_y += 0.2
- @vsFp["ring"].opacity -= 16
- end
- self.vsSequenceSM_update
- Graphics.update
- end
- 16.times do
- self.vsSequenceSM_update
- Graphics.update
- end
- for i in 0...16
- @vs["trainer"].tone.red -= 32*(i < 8 ? -1 : 1)
- @vs["trainer"].tone.green -= 32*(i < 8 ? -1 : 1)
- @vs["trainer"].tone.blue -= 32*(i < 8 ? -1 : 1)
- @vs["bg"].speed = (@smSpecial ? 2 : 16) if i == 8 && !@smElite
- if !@smSpecial && !@smElite
- @vs["bg2"].speed = 2 if i == 8
- @vs["bg3"].speed = 6 if i == 8
- end
- for j in 0...3
- next if !@smSpecial
- next if i != 8
- @vsFp["p#{j}"].speed /= 4
- end
- self.vsSequenceSM_update
- Graphics.update
- end
- 16.times do
- @vs["glow"].src_rect.height += 24
- @vs["glow"].src_rect.y -= 24
- @vs["glow"].y -= 24
- @vs["glow2"].src_rect.height += 24
- self.vsSequenceSM_update
- Graphics.update
- end
- viewport.color = Color.new(255,255,255,0) if @smElite
- 8.times do
- viewport.color.alpha += 32 if @smElite
- @vs["glow"].tone.red += 32
- @vs["glow"].tone.green += 32
- @vs["glow"].tone.blue += 32
- @vs["glow2"].tone.red += 32
- @vs["glow2"].tone.green += 32
- @vs["glow2"].tone.blue += 32
- self.vsSequenceSM_update
- Graphics.update
- end
- @vs["bg2"].opacity = 255 if @smElite
- for i in 0...4
- @vs["trainer"].tone.red += 64
- @vs["trainer"].tone.green += 64
- @vs["trainer"].tone.blue += 64
- if !@smSpecial && !@smElite
- @vs["bg"].x += 2
- @vs["bg2"].x += 2
- @vs["bg3"].x += 2
- end
- viewport.color.alpha -= 16 if @smElite
- self.vsSequenceSM_update
- Graphics.update
- end
- for j in 0...3
- viewport.color.alpha -= 16 if @smElite
- next if !@smSpecial
- @vsFp["p#{j}"].z = 300
- end
- for i in 0...8
- viewport.color.alpha -= 16 if @smElite
- @vs["trainer"].tone.red -= 32
- @vs["trainer"].tone.green -= 32
- @vs["trainer"].tone.blue -= 32
- @vs["shade"].opacity += 32
- @vs["shade"].x -= 4
- if i < 4 && !@smSpecial && !@smElite
- @vs["bg"].x -= 2
- @vs["bg2"].x -= 2
- @vs["bg3"].x -= 2
- end
- self.vsSequenceSM_update
- Graphics.update
- end
- # end of intro animation
- end
- def vsSequenceSM_update
- # updates the background effects
- @vs["bg"].update if @vs["bg"] && !@vs["bg"].disposed?
- @vs["bg2"].update if @vs["bg2"] && !@vs["bg2"].disposed?
- @vs["bg3"].update if @vs["bg3"] && !@vs["bg3"].disposed?
- for j in 0...32
- # updates the particles for the special variant
- next if !@smSpecial
- next if !@vsFp["s#{j}"] || @vsFp["s#{j}"].disposed?
- next if j > @fpIndex/4
- if @vsFp["s#{j}"].opacity <= 1
- width = @vs["bg"].viewport.rect.width
- height = @vs["bg"].viewport.rect.height
- x = rand(width*0.75) + width*0.125
- y = rand(height*0.50) + height*0.25
- @fpDx[j] = x + rand(width*0.125)*(x < width/2 ? -1 : 1)
- @fpDy[j] = y - rand(height*0.25)
- z = [1,0.75,0.5,0.25][rand(4)]
- @vsFp["s#{j}"].zoom_x = z
- @vsFp["s#{j}"].zoom_y = z
- @vsFp["s#{j}"].x = x
- @vsFp["s#{j}"].y = y
- @vsFp["s#{j}"].opacity = 255
- @vsFp["s#{j}"].angle = rand(360)
- end
- @vsFp["s#{j}"].x -= (@vsFp["s#{j}"].x - @fpDx[j])*0.05
- @vsFp["s#{j}"].y -= (@vsFp["s#{j}"].y - @fpDy[j])*0.05
- @vsFp["s#{j}"].opacity -= @vsFp["s#{j}"].opacity*0.05
- @vsFp["s#{j}"].zoom_x -= @vsFp["s#{j}"].zoom_x*0.05
- @vsFp["s#{j}"].zoom_y -= @vsFp["s#{j}"].zoom_y*0.05
- end
- for j in 0...3
- # updates the particles for the special variant
- next if !@smSpecial
- next if !@vsFp["p#{j}"] || @vsFp["p#{j}"].disposed?
- @vsFp["p#{j}"].update
- if j == 0
- @vsFp["p#{j}"].opacity += 5 if @vsFp["p#{j}"].opacity < 155
- else
- @vsFp["p#{j}"].opacity += @fpOpac[j-1]*(@fpSpeed[j]/2)
- end
- next if @fpIndex < 24
- @fpOpac[j-1] *= -1 if (@vsFp["p#{j}"].opacity >= 255 || @vsFp["p#{j}"].opacity < 65)
- end
- if @smElite && @vs["bg"] && !@vs["bg"].disposed?
- # updates the particles for the Elite4 variant
- @vs["bg"].angle += 1 if $PokemonSystem.screensize < 2
- @vs["bg2"].angle -= 1 if $PokemonSystem.screensize < 2
- for j in 0...16
- next if @vs["bg2"].opacity < 255
- if @vsFp["e#{j}"].ox < -(@vsFp["e#{j}"].viewport.rect.width/2)
- @vsFp["e#{j}"].speed = 4 + rand(5)
- @vsFp["e#{j}"].opacity = 0
- @vsFp["e#{j}"].ox = 0
- @vsFp["e#{j}"].angle = rand(360)
- bmp = pbBitmap("Graphics/Transitions/smEff1")
- @vsFp["e#{j}"].bitmap.clear
- w = bmp.width/(1 + rand(3))
- @vsFp["e#{j}"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))
- end
- @vsFp["e#{j}"].opacity += @vsFp["e#{j}"].speed
- @vsFp["e#{j}"].ox -= @vsFp["e#{j}"].speed
- end
- for j in 0...3
- next if j > @fpIndex/50
- if @vsFp["ec#{j}"].zoom_x <= 0
- @vsFp["ec#{j}"].zoom_x = 1.5
- @vsFp["ec#{j}"].zoom_y = 1.5
- @vsFp["ec#{j}"].opacity = 0
- end
- @vsFp["ec#{j}"].opacity += 8
- @vsFp["ec#{j}"].zoom_x -= 0.01
- @vsFp["ec#{j}"].zoom_y -= 0.01
- end
- end
- @fpIndex += 1 if @fpIndex < 150
- end
- def vsSequenceSM_end
- # final transition
- viewport = @viewport
- zoom = 4.0
- obmp = pbBitmap("Graphics/Transitions/ballTransition")
- @vs["bg"].speed = @smSpecial ? 4 : 32 if !@smElite
- if !@smSpecial && !@smElite
- @vs["bg2"].speed = 64
- @vs["bg3"].speed = 8
- end
- for j in 0...3
- next if !@smSpecial
- @vsFp["p#{j}"].speed *= 4
- end
- for i in 0..20
- @vs["trainer"].x += 6*(i/5 + 1)
- @vs["glow"].x += 6*(i/5 + 1)
- @vs["glow2"].x += 6*(i/5 + 1)
- @commandWindow.hideArrows if i < 10
- @vs["overlay"].bitmap.clear
- ox = (1 - zoom)*viewport.rect.width*0.5
- oy = (1 - zoom)*viewport.rect.height*0.5
- width = (ox < 0 ? 0 : ox).ceil
- height = (oy < 0 ? 0 : oy).ceil
- @vs["overlay"].bitmap.fill_rect(0,0,width,viewport.rect.height,Color.new(0,0,0))
- @vs["overlay"].bitmap.fill_rect(viewport.rect.width-width,0,width,viewport.rect.height,Color.new(0,0,0))
- @vs["overlay"].bitmap.fill_rect(0,0,viewport.rect.width,height,Color.new(0,0,0))
- @vs["overlay"].bitmap.fill_rect(0,viewport.rect.height-height,viewport.rect.width,height,Color.new(0,0,0))
- @vs["overlay"].bitmap.stretch_blt(Rect.new(ox,oy,(obmp.width*zoom).ceil,(obmp.height*zoom).ceil),obmp,Rect.new(0,0,obmp.width,obmp.height))
- @vs["overlay"].opacity += 64
- zoom -= 4.0/20
- self.vsSequenceSM_update
- @vs["shade"].opacity -= 16
- Graphics.update
- end
- @commandWindow.lineupY(+32)
- # disposes of current sprites
- pbDisposeSpriteHash(@vs)
- pbDisposeSpriteHash(@vsFp)
- @vs["overlay"] = Sprite.new(@msgview)
- @vs["overlay"].z = 9999999
- @vs["overlay"].bitmap = Bitmap.new(@msgview.rect.width,@msgview.rect.height)
- @vs["overlay"].bitmap.fill_rect(0,0,@msgview.rect.width,@msgview.rect.height,Color.new(0,0,0))
- end
- def vsSequenceSM_sendout
- # transitions from VS sequence to the battle scene
- viewport = @msgview
- zoom = 0
- obmp = pbBitmap("Graphics/Transitions/ballTransition")
- 21.times do
- @vs["overlay"].bitmap.clear
- ox = (1 - zoom)*viewport.rect.width*0.5
- oy = (1 - zoom)*viewport.rect.height*0.5
- width = (ox < 0 ? 0 : ox).ceil
- height = (oy < 0 ? 0 : oy).ceil
- @vs["overlay"].bitmap.fill_rect(0,0,width,viewport.rect.height,Color.new(0,0,0))
- @vs["overlay"].bitmap.fill_rect(viewport.rect.width-width,0,width,viewport.rect.height,Color.new(0,0,0))
- @vs["overlay"].bitmap.fill_rect(0,0,viewport.rect.width,height,Color.new(0,0,0))
- @vs["overlay"].bitmap.fill_rect(0,viewport.rect.height-height,viewport.rect.width,height,Color.new(0,0,0))
- @vs["overlay"].bitmap.stretch_blt(Rect.new(ox,oy,(obmp.width*zoom).ceil,(obmp.height*zoom).ceil),obmp,Rect.new(0,0,obmp.width,obmp.height))
- @vs["overlay"].opacity -= 12.8
- zoom += 4.0/20
- wait(1,true)
- end
- @vs["overlay"].dispose
- end
- end
- #-------------------------------------------------------------------------------
- # New S&M "Mother Beast Lusamine" styled sequence
- #-------------------------------------------------------------------------------
- class PokeBattle_Scene
- def crazySequence_start(viewport,trainerid)
- @sequenceType = 1
- @vs["bg"] = CrazyRainbowBackground.new(viewport)
- @vs["rect"] = Sprite.new(@viewport)
- @vs["rect"].z = 400
- @vs["rect"].drawRect(viewport.rect.width,viewport.rect.height,Color.new(0,0,0))
- @vs["rect"].color = Color.new(255,255,255)
- @vs["trainer"] = Sprite.new(viewport)
- @vs["trainer"].bitmap = pbBitmap(sprintf("Graphics/Transitions/smCrazy%d",trainerid))
- @vs["trainer"].ox = @vs["trainer"].bitmap.width/2
- @vs["trainer"].oy = @vs["trainer"].bitmap.height/2
- @vs["trainer"].x = 3*viewport.rect.width/2
- @vs["trainer"].y = viewport.rect.height/2
- @vs["trainer"].color = Color.new(255,255,255)
- @vs["trainer"].z = 450
- @vs["trainer3"] = Sprite.new(viewport)
- @vs["trainer3"].bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
- bmp = @vs["trainer"].bitmap.clone
- @vs["trainer3"].bitmap.blt((viewport.rect.width-bmp.width)/2,(viewport.rect.height-bmp.height)/2,bmp,Rect.new(0,0,bmp.width,bmp.height))
- @vs["trainer3"].y = viewport.rect.height
- @vs["trainer3"].color = Color.new(255,255,255)
- @vs["trainer3"].z = 400
- @vs["trainer3"].glow(Color.new(255,255,255))
- @vs["trainer3"].src_rect.set(0,viewport.rect.height,viewport.rect.width,0)
- @commandWindow.drawLineup
- @commandWindow.lineupY(-32)
- 64.times do
- @vs["bg"].update
- end
- 16.times do
- @vs["rect"].color.alpha -= 16
- Graphics.update
- end
- for i in 0...24
- @commandWindow.showArrows if i < 10
- @vs["trainer"].x += ((-16 + viewport.rect.width/2) - @vs["trainer"].x)*0.2
- Graphics.update
- end
- 4.times do
- @vs["trainer"].x += 4
- Graphics.update
- end
- 8.times do
- @vs["trainer"].color.alpha -= 32
- Graphics.update
- end
- 16.times do
- @vs["trainer3"].src_rect.y -= 24
- @vs["trainer3"].src_rect.height += 24
- @vs["trainer3"].y -= 24
- Graphics.update
- end
- @vs["rect"].color = Color.new(255,255,255,0)
- for i in 0...2
- 8.times do
- @vs["trainer"].color.alpha += 32*(i==0 ? 1 : -1)
- @vs["rect"].color.alpha += 16
- @vs["rect"].opacity -= 16 if i == 1
- @vs["bg"].update if i == 1
- Graphics.update
- end
- end
- 16.times do
- @vs["bg"].update
- @vs["rect"].opacity -= 16
- Graphics.update
- end
- end
- def crazySequence_end
- view = @vs["trainer"].viewport
- @vs["bg"].dispose
- @vs["rect"].dispose
- @vs["trainer"].dispose
- @vs["trainer3"].dispose
- bmp = Graphics.snap_to_bitmap
- @vs["ov1"] = Sprite.new(view)
- @vs["ov1"].bitmap = bmp
- @vs["ov1"].ox = bmp.width/2
- @vs["ov1"].oy = bmp.height/2
- @vs["ov1"].x = viewport.rect.width/2
- @vs["ov1"].y = viewport.rect.height/2
- @vs["ov1"].z = 500
- @vs["ov2"] = Sprite.new(view)
- @vs["ov2"].bitmap = bmp
- @vs["ov2"].blur_sprite(3)
- @vs["ov2"].ox = bmp.width/2
- @vs["ov2"].oy = bmp.height/2
- @vs["ov2"].x = viewport.rect.width/2
- @vs["ov2"].y = viewport.rect.height/2
- @vs["ov2"].opacity = 0
- @vs["ov2"].z = 500
- # final zooming transition
- for i in 0...32
- @commandWindow.hideArrows if i < 10
- @vs["ov1"].zoom_x += 0.02
- @vs["ov1"].zoom_y += 0.02
- @vs["ov2"].zoom_x += 0.02
- @vs["ov2"].zoom_y += 0.02
- @vs["ov2"].opacity += 12
- if i >= 16
- @vs["ov2"].tone.red += 16
- @vs["ov2"].tone.green += 16
- @vs["ov2"].tone.blue += 16
- end
- Graphics.update
- end
- 8.times do; Graphics.update; end
- $smAnim = false
- @vs["ov1"].opacity = 0
- for i in 0...16
- @vs["ov2"].opacity -= 16
- wait(1,true)
- end
- @commandWindow.lineupY(+32)
- @vs["ov1"].dispose
- @vs["ov2"].dispose
- end
- def crazySequence_sendout
- end
- def crazySequence_update
- return if @vs["trainer"].disposed?
- @vs["bg"].update
- end
- end#-------------------------------------------------------------------------------
- # Special Pokemon VS animation
- #-------------------------------------------------------------------------------
- class PokeBattle_Scene
- # called within the scene to update animation
- def ebSpecialSpecies_update
- for j in 0...3
- if @vsFp["ec#{j}"].zoom_x <= 0
- @vsFp["ec#{j}"].zoom_x = 2
- @vsFp["ec#{j}"].zoom_y = 2
- @vsFp["ec#{j}"].opacity = 255
- end
- @vsFp["ec#{j}"].opacity -= 3
- @vsFp["ec#{j}"].zoom_x -= 0.02
- @vsFp["ec#{j}"].zoom_y -= 0.02
- end
- @vsFp["poke1"].src_rect.height += 40 if @vsFp["poke1"].src_rect.height < 640
- @vsFp["poke1"].opacity -= 2*@vsFp["poke1"].toggle
- @vsFp["poke1"].toggle *= -1 if @vsFp["poke1"].opacity <= 0 || @vsFp["poke1"].opacity >= 255
- @vsFp["bg"].angle += 1 if $PokemonSystem.screensize < 2
- end
- # called within the scene to initialize and start the animation
- def ebSpecialSpecies_start(viewport)
- species = $wildSpecies
- viewport.color = Color.new(255,255,255,0)
- @vsFp = {}
- # graphics for bars covering the viewport
- @vsFp["bar1"] = Sprite.new(viewport)
- @vsFp["bar1"].drawRect(viewport.rect.width,viewport.rect.height/2,Color.new(0,0,0))
- @vsFp["bar1"].z = 999
- @vsFp["bar2"] = Sprite.new(viewport)
- @vsFp["bar2"].drawRect(viewport.rect.width,viewport.rect.height/2 + 2,Color.new(0,0,0))
- @vsFp["bar2"].oy = @vsFp["bar2"].bitmap.height
- @vsFp["bar2"].y = viewport.rect.height + 2
- @vsFp["bar2"].z = 999
- # background graphic
- @vsFp["bg"] = Sprite.new(viewport)
- str = "Graphics/Transitions/speciesBg#{species}"
- str = "Graphics/Transitions/speciesBg" if !pbResolveBitmap(str)
- @vsFp["bg"].bitmap = pbBitmap(str)
- @vsFp["bg"].ox = @vsFp["bg"].src_rect.width/2
- @vsFp["bg"].oy = @vsFp["bg"].src_rect.height/2
- @vsFp["bg"].x = viewport.rect.width/2
- @vsFp["bg"].y = viewport.rect.height/2
- # "electricity" effect that scrolls horizontally behind the Pokemon
- @vsFp["streak"] = ScrollingSprite.new(viewport)
- @vsFp["streak"].setBitmap("Graphics/Transitions/vsLight3")
- @vsFp["streak"].x = viewport.rect.width
- @vsFp["streak"].y = viewport.rect.height/2
- @vsFp["streak"].speed = 64
- @vsFp["streak"].oy = @vsFp["streak"].bitmap.height/2
- # initial particles
- for j in 0...24
- n = ["B","C"][rand(2)]
- @vsFp["p#{j}"] = Sprite.new(viewport)
- str = "Graphics/Transitions/speciesEff#{n}#{species}"
- str = "Graphics/Transitions/speciesEff#{n}" if !pbResolveBitmap(str)
- @vsFp["p#{j}"].bitmap = pbBitmap(str)
- @vsFp["p#{j}"].ox = @vsFp["p#{j}"].bitmap.width/2
- @vsFp["p#{j}"].oy = @vsFp["p#{j}"].bitmap.height/2
- @vsFp["p#{j}"].x = viewport.rect.width + 48
- y = viewport.rect.height*0.5*0.72 + rand(0.28*viewport.rect.height)
- @vsFp["p#{j}"].y = y
- @vsFp["p#{j}"].speed = rand(4) + 1
- @vsFp["p#{j}"].z = 1 if rand(2)==0
- end
- # main Pokemon graphic
- @vsFp["poke1"] = Sprite.new(viewport)
- @vsFp["poke1"].bitmap = pbBitmap("Graphics/Transitions/species#{species}")
- @vsFp["poke1"].ox = @vsFp["poke1"].bitmap.width/2
- @vsFp["poke1"].oy = @vsFp["poke1"].bitmap.height*0.25
- @vsFp["poke1"].x = viewport.rect.width/2
- @vsFp["poke1"].y = viewport.rect.height/2
- @vsFp["poke1"].glow(Color.new(101,136,194),35,false)
- @vsFp["poke1"].src_rect.height = 0
- @vsFp["poke1"].toggle = -1
- @vsFp["poke2"] = Sprite.new(viewport)
- @vsFp["poke2"].bitmap = pbBitmap("Graphics/Transitions/species#{species}")
- @vsFp["poke2"].ox = @vsFp["poke2"].bitmap.width/2
- @vsFp["poke2"].oy = @vsFp["poke2"].bitmap.height*0.25
- @vsFp["poke2"].x = viewport.rect.width
- @vsFp["poke2"].y = viewport.rect.height/2
- @vsFp["poke2"].opacity = 0
- # ring particles which zoom towards the center of viewport
- for j in 0...3
- @vsFp["ec#{j}"] = Sprite.new(viewport)
- str = "Graphics/Transitions/speciesEffA#{species}"
- str = "Graphics/Transitions/speciesEffA" if !pbResolveBitmap(str)
- @vsFp["ec#{j}"].bitmap = pbBitmap(str)
- @vsFp["ec#{j}"].ox = @vsFp["ec#{j}"].bitmap.width/2
- @vsFp["ec#{j}"].oy = @vsFp["ec#{j}"].bitmap.height/2
- @vsFp["ec#{j}"].x = viewport.rect.width/2
- @vsFp["ec#{j}"].y = viewport.rect.height/2
- @vsFp["ec#{j}"].zoom_x = 2
- @vsFp["ec#{j}"].zoom_y = 2
- @vsFp["ec#{j}"].opacity = 255
- end
- # starts the animation
- for i in 0...64
- @vsFp["streak"].x -= 64 if @vsFp["streak"].x > 0
- @vsFp["streak"].update if @vsFp["streak"].x <= 0
- @vsFp["streak"].opacity -= 16 if i >= 48
- @vsFp["bar1"].zoom_y -= 0.02 if @vsFp["bar1"].zoom_y > 0.72
- @vsFp["bar2"].zoom_y -= 0.02 if @vsFp["bar2"].zoom_y > 0.72
- @vsFp["poke2"].opacity += 16
- @vsFp["poke2"].x -= (@vsFp["poke2"].x - viewport.rect.width/2)*0.1
- for j in 0...3
- next if j > i/50
- if @vsFp["ec#{j}"].zoom_x <= 0
- @vsFp["ec#{j}"].zoom_x = 2
- @vsFp["ec#{j}"].zoom_y = 2
- @vsFp["ec#{j}"].opacity = 255
- end
- @vsFp["ec#{j}"].opacity -= 3
- @vsFp["ec#{j}"].zoom_x -= 0.02
- @vsFp["ec#{j}"].zoom_y -= 0.02
- end
- for j in 0...24
- next if j > i/2
- @vsFp["p#{j}"].x -= 32*@vsFp["p#{j}"].speed
- end
- @vsFp["bg"].angle += 1 if $PokemonSystem.screensize < 2
- Graphics.update
- end
- # changes focus to Pokemon graphic
- for i in 0...8
- @vsFp["bar1"].zoom_y -= 0.72/8
- @vsFp["bar2"].zoom_y -= 0.72/8
- @vsFp["poke1"].y -= 8
- @vsFp["poke2"].y -= 8
- if i >= 4
- viewport.color.alpha += 64
- end
- ebSpecialSpecies_update
- Graphics.update
- end
- # flash and impact of screen
- @vsFp["poke1"].oy = @vsFp["poke1"].bitmap.height/2
- @vsFp["poke1"].y = viewport.rect.height/2
- @vsFp["poke2"].oy = @vsFp["poke2"].bitmap.height/2
- @vsFp["poke2"].y = viewport.rect.height/2
- @vsFp["impact"] = Sprite.new(viewport)
- @vsFp["impact"].bitmap = pbBitmap("Graphics/Pictures/impact")
- @vsFp["impact"].ox = @vsFp["impact"].bitmap.width/2
- @vsFp["impact"].oy = @vsFp["impact"].bitmap.height/2
- @vsFp["impact"].x = viewport.rect.width/2
- @vsFp["impact"].y = viewport.rect.height/2
- @vsFp["impact"].z = 999
- @vsFp["impact"].opacity = 0
- pbPlayCry(species)
- k = -1
- # fades flash
- for i in 0...32
- viewport.color.alpha -= 16 if viewport.color.alpha > 0
- @vsFp["bg"].y += k*4 if i < 16
- @vsFp["poke2"].y += k*4 if i < 16
- k *= -1 if i%2==0
- @vsFp["impact"].opacity += (i < 24) ? 64 : -32
- @vsFp["impact"].angle += 180 if i%4 == 0
- @vsFp["impact"].mirror = !@vsFp["impact"].mirror if i%4 == 2
- ebSpecialSpecies_update
- Graphics.update
- end
- end
- # called to end the sequence and dispose of sprites
- def ebSpecialSpecies_end
- bmp = Graphics.snap_to_bitmap
- view = @vsFp["poke1"].viewport
- pbDisposeSpriteHash(@vsFp)
- @vsFp["ov1"] = Sprite.new(view)
- @vsFp["ov1"].bitmap = bmp
- @vsFp["ov1"].ox = bmp.width/2
- @vsFp["ov1"].oy = bmp.height/2
- @vsFp["ov1"].x = viewport.rect.width/2
- @vsFp["ov1"].y = viewport.rect.height/2
- @vsFp["ov2"] = Sprite.new(view)
- @vsFp["ov2"].bitmap = bmp
- @vsFp["ov2"].blur_sprite(3)
- @vsFp["ov2"].ox = bmp.width/2
- @vsFp["ov2"].oy = bmp.height/2
- @vsFp["ov2"].x = viewport.rect.width/2
- @vsFp["ov2"].y = viewport.rect.height/2
- @vsFp["ov2"].opacity = 0
- # final zooming transition
- for i in 0...32
- @vsFp["ov1"].zoom_x += 0.02
- @vsFp["ov1"].zoom_y += 0.02
- @vsFp["ov2"].zoom_x += 0.02
- @vsFp["ov2"].zoom_y += 0.02
- @vsFp["ov2"].opacity += 12
- if i >= 16
- @vsFp["ov2"].tone.red += 16
- @vsFp["ov2"].tone.green += 16
- @vsFp["ov2"].tone.blue += 16
- end
- Graphics.update
- end
- 8.times do; Graphics.update; end
- @vsFp["ov1"].opacity = 0
- $specialSpecies = false
- @sprites["battlebox1"].appear
- for i in 0...16
- @vsFp["ov2"].opacity -= 16
- if i < 10
- if EBUISTYLE==2
- @sprites["battlebox1"].show
- elsif EBUISTYLE==0
- @sprites["battlebox1"].update
- else
- @sprites["battlebox1"].x+=26
- end
- end
- animateBattleSprites
- Graphics.update
- end
- pbDisposeSpriteHash(@vsFp)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement