Advertisement
Nyaruko69

Untitled

May 1st, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 121.50 KB | None | 0 0
  1. #-------------------------------------------------------------------------------
  2. # Config for battle system visuals
  3. # set this to false to remove battle bases
  4. USEBATTLEBASES = false
  5. # applies a blur to the background
  6. # toggle between true and false, or set as numeric value
  7. # higher values will increase battle loading times (recommended = 3)
  8. BLURBATTLEBACKGROUND = 0
  9. # resize factor of the background (default = 3.5)
  10. BACKGROUNDSCALAR = 3.5
  11. #-------------------------------------------------------------------------------
  12.  
  13. # List of Pokemon that are going to trigger the "Minor Legendary" battle entry
  14. # animation
  15.  
  16. MINOR_LEGENDARIES = [
  17. :MOLTRES,
  18. :ARTICUNO,
  19. :ZAPDOS,
  20. :GIRATINA,
  21. :DEOXYS
  22. ]
  23.  
  24. # Array handling the automatic queuing of battle BGM
  25.  
  26. BATTLE_BGM_SPECIES = [
  27. [:DEOXYS,"BT-Deoxys Theme.ogg"],
  28. [:GIRATINA,"giratinabattle.ogg"],
  29. [[:MOLTRES,:ZAPDOS,:ARTICUNO],"dpplegendary.ogg"],
  30. [[:REGISTEEL,:REGIROCK,:REGICE,:REGIGIGAS],"regibattle.ogg"],
  31. ]
  32.  
  33. # List of trainertypes triggering the "evil" team animation
  34. EVIL_TEAM_LIST = [
  35. :SOLDADO_M,
  36. :SOLDADO_F,
  37. ]
  38.  
  39. #===============================================================================
  40. # Don't touch these
  41. # Used to configure the system for potential DS styles (leftovers)
  42. #-----------------------------------------------------
  43. VIEWPORT_HEIGHT = DEFAULTSCREENHEIGHT
  44. VIEWPORT_OFFSET = 0
  45. #-------------------------------------------------------------------------------
  46. # Extensions for classes
  47. #-------------------------------------------------------------------------------
  48. # additional String functionality
  49. class ::String
  50. def starts_with?(char)
  51. proc = self.scan(/./)
  52. return (proc[0] == char) ? true : false
  53. end
  54. end
  55. # additional Sprite functionality
  56. class Sprite
  57. attr_reader :storedBitmap
  58. attr_accessor :speed
  59. attr_accessor :toggle
  60. attr_accessor :end_x
  61. attr_accessor :end_y
  62. attr_accessor :param
  63. attr_accessor :ex
  64. attr_accessor :ey
  65.  
  66. def drawRect(width,height,color)
  67. self.bitmap = Bitmap.new(width,height)
  68. self.bitmap.fill_rect(0,0,width,height,color)
  69. end
  70.  
  71. def center
  72. self.ox = self.src_rect.width/2
  73. self.oy = self.src_rect.height/2
  74. end
  75.  
  76. def snapScreen
  77. bmp = Graphics.snap_to_bitmap
  78. width = self.viewport ? viewport.rect.width : Graphics.width
  79. height = self.viewport ? viewport.rect.height : Graphics.height
  80. x = self.viewport ? viewport.rect.x : 0
  81. y = self.viewport ? viewport.rect.y : 0
  82. self.bitmap = Bitmap.new(width,height)
  83. self.bitmap.blt(0,0,bmp,Rect.new(x,y,width,height))
  84. end
  85.  
  86. def skew(angle=90)
  87. return false if !self.bitmap
  88. angle=angle*(Math::PI/180)
  89. bitmap=self.bitmap
  90. rect=Rect.new(0,0,bitmap.width,bitmap.height)
  91. width=rect.width+((rect.height-1)/Math.tan(angle))
  92. self.bitmap=Bitmap.new(width,rect.height)
  93. for i in 0...rect.height
  94. y=rect.height-i
  95. x=i/Math.tan(angle)
  96. self.bitmap.blt(x+rect.x,y+rect.y,bitmap,Rect.new(0,y,rect.width,1))
  97. end
  98. end
  99.  
  100. def blur_sprite(blur_val=2,opacity=35)
  101. bitmap = self.bitmap
  102. self.bitmap = Bitmap.new(bitmap.width,bitmap.height)
  103. self.bitmap.blt(0,0,bitmap,Rect.new(0,0,bitmap.width,bitmap.height))
  104. x=0
  105. y=0
  106. for i in 1...(8 * blur_val)
  107. dir = i % 8
  108. x += (1 + (i / 8))*([0,6,7].include?(dir) ? -1 : 1)*([1,5].include?(dir) ? 0 : 1)
  109. y += (1 + (i / 8))*([1,4,5,6].include?(dir) ? -1 : 1)*([3,7].include?(dir) ? 0 : 1)
  110. self.bitmap.blt(x-blur_val,y+(blur_val*2),bitmap,Rect.new(0,0,bitmap.width,bitmap.height),opacity)
  111. end
  112. end
  113.  
  114. def getAvgColor(freq=2)
  115. return Color.new(0,0,0,0) if !self.bitmap
  116. bmp = self.bitmap
  117. width = self.bitmap.width/freq
  118. height = self.bitmap.height/freq
  119. red = 0
  120. green = 0
  121. blue = 0
  122. n = width*height
  123. for x in 0...width
  124. for y in 0...height
  125. color = bmp.get_pixel(x*freq,y*freq)
  126. if color.alpha > 0
  127. red += color.red
  128. green += color.green
  129. blue += color.blue
  130. end
  131. end
  132. end
  133. avg = Color.new(red/n,green/n,blue/n)
  134. return avg
  135. end
  136.  
  137. def create_outline(color,thickness=2,hard=false)
  138. return false if !self.bitmap
  139. bmp = self.bitmap.clone
  140. self.bitmap = Bitmap.new(bmp.width,bmp.height)
  141. for x in 0...bmp.width-thickness
  142. for y in 0...bmp.height
  143. pixel = bmp.get_pixel(x,y)
  144. if pixel.alpha > 0
  145. for i in 1..thickness
  146. c1 = bmp.get_pixel(x,y-i)
  147. c2 = bmp.get_pixel(x,y+i)
  148. c3 = bmp.get_pixel(x-i,y)
  149. c4 = bmp.get_pixel(x+i,y)
  150. self.bitmap.set_pixel(x,y-i,color) if c1.alpha <= 0
  151. self.bitmap.set_pixel(x,y+i,color) if c2.alpha <= 0
  152. self.bitmap.set_pixel(x-i,y,color) if c3.alpha <= 0
  153. self.bitmap.set_pixel(x+i,y,color) if c4.alpha <= 0
  154. end
  155. end
  156. end
  157. end
  158. self.bitmap.blt(0,0,bmp,Rect.new(0,0,bmp.width,bmp.height))
  159. end
  160.  
  161. def colorize(color)
  162. return false if !self.bitmap
  163. bmp = self.bitmap.clone
  164. self.bitmap = Bitmap.new(bmp.width,bmp.height)
  165. for x in 0...bmp.width
  166. for y in 0...bmp.height
  167. pixel = bmp.get_pixel(x,y)
  168. self.bitmap.set_pixel(x,y,color) if pixel.alpha > 0
  169. end
  170. end
  171. end
  172.  
  173. def glow(color,opacity=35,keep=true)
  174. return false if !self.bitmap
  175. temp_bmp = self.bitmap.clone
  176. self.colorize(color)
  177. self.blur_sprite(3,opacity)
  178. src = self.bitmap.clone
  179. self.bitmap.clear
  180. 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))
  181. self.bitmap.blt(0,0,temp_bmp,Rect.new(0,0,temp_bmp.width,temp_bmp.height)) if keep
  182. end
  183.  
  184. def fuzz(color,opacity=35)
  185. return false if !self.bitmap
  186. self.colorize(color)
  187. self.blur_sprite(3,opacity)
  188. src = self.bitmap.clone
  189. self.bitmap.clear
  190. 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))
  191. end
  192.  
  193. def memorize_bitmap(bitmap = nil)
  194. @storedBitmap = bitmap if !bitmap.nil?
  195. @storedBitmap = self.bitmap.clone if bitmap.nil?
  196. end
  197. def restore_bitmap
  198. self.bitmap = @storedBitmap.clone
  199. end
  200.  
  201. def toneAll(val)
  202. self.tone.red += val
  203. self.tone.green += val
  204. self.tone.blue += val
  205. end
  206.  
  207. def onlineBitmap(url)
  208. pbDownloadToFile(url,"_temp.png")
  209. return if !FileTest.exist?("_temp.png")
  210. self.bitmap = pbBitmap("_temp")
  211. File.delete("_temp.png")
  212. end
  213. end
  214. # additional Bitmap functionality
  215. class Bitmap
  216. def drawCircle(color=Color.new(255,255,255),r=(self.width/2),tx=(self.width/2),ty=(self.height/2),hollow=false)
  217. # basic circle formula
  218. # (x - tx)**2 + (y - ty)**2 = r**2
  219. for x in 0...self.width
  220. f = (r**2 - (x - tx)**2)
  221. next if f < 0
  222. y1 = -Math.sqrt(f).to_i + ty
  223. y2 = Math.sqrt(f).to_i + ty
  224. if hollow
  225. self.set_pixel(x,y1,color)
  226. self.set_pixel(x,y2,color)
  227. else
  228. for y in y1..y2
  229. self.set_pixel(x,y,color)
  230. end
  231. end
  232. end
  233. end
  234. end
  235. #-------------------------------------------------------------------------------
  236. # Class used for generating scrolling backgrounds (move animations)
  237. #-------------------------------------------------------------------------------
  238. class ScrollingSprite < Sprite
  239. attr_accessor :speed
  240. attr_accessor :direction
  241. attr_accessor :vertical
  242.  
  243. def setBitmap(val,vertical=false,pulse=false)
  244. @vertical = vertical
  245. @pulse = pulse
  246. @direction = 1 if @direction.nil?
  247. @gopac = 1
  248. @speed = 32 if @speed.nil?
  249. val = pbBitmap(val) if val.is_a?(String)
  250. if @vertical
  251. bmp = Bitmap.new(val.width,val.height*2)
  252. for i in 0...2
  253. bmp.blt(0,val.height*i,val,Rect.new(0,0,val.width,val.height))
  254. end
  255. self.bitmap = bmp.clone
  256. y = @direction > 0 ? 0 : val.height
  257. self.src_rect.set(0,y,val.width,val.height)
  258. else
  259. bmp = Bitmap.new(val.width*2,val.height)
  260. for i in 0...2
  261. bmp.blt(val.width*i,0,val,Rect.new(0,0,val.width,val.height))
  262. end
  263. self.bitmap = bmp.clone
  264. x = @direction > 0 ? 0 : val.width
  265. self.src_rect.set(x,0,val.width,val.height)
  266. end
  267. end
  268.  
  269. def update
  270. if @vertical
  271. self.src_rect.y += @speed*@direction
  272. self.src_rect.y = 0 if @direction > 0 && self.src_rect.y >= self.src_rect.height
  273. self.src_rect.y = self.src_rect.height if @direction < 0 && self.src_rect.y <= 0
  274. else
  275. self.src_rect.x += @speed*@direction
  276. self.src_rect.x = 0 if @direction > 0 && self.src_rect.x >= self.src_rect.width
  277. self.src_rect.x = self.src_rect.width if @direction < 0 && self.src_rect.x <= 0
  278. end
  279. if @pulse
  280. self.opacity -= @gopac*@speed
  281. @gopac *= -1 if self.opacity == 255 || self.opacity == 0
  282. end
  283. end
  284.  
  285. end
  286. #-------------------------------------------------------------------------------
  287. # Class used for generating sprites with a trail
  288. #-------------------------------------------------------------------------------
  289. class TrailingSprite
  290. attr_accessor :x
  291. attr_accessor :y
  292. attr_accessor :z
  293. attr_accessor :color
  294. attr_accessor :keyFrame
  295. attr_accessor :zoom_x
  296. attr_accessor :zoom_y
  297. attr_accessor :opacity
  298.  
  299. def initialize(viewport,bmp)
  300. @viewport = viewport
  301. @bmp = bmp
  302. @sprites = {}
  303. @x = 0
  304. @y = 0
  305. @z = 0
  306. @i = 0
  307. @frame = 128
  308. @keyFrame = 0
  309. @color = Color.new(0,0,0,0)
  310. @zoom_x = 1
  311. @zoom_y = 1
  312. @opacity = 255
  313. end
  314.  
  315. def update
  316. @frame += 1
  317. if @frame > @keyFrame
  318. @sprites["#{@i}"] = Sprite.new(@viewport)
  319. @sprites["#{@i}"].bitmap = @bmp
  320. @sprites["#{@i}"].center
  321. @sprites["#{@i}"].x = x
  322. @sprites["#{@i}"].y = y
  323. @sprites["#{@i}"].z = z
  324. @sprites["#{@i}"].zoom_x = @zoom_x
  325. @sprites["#{@i}"].zoom_y = @zoom_y
  326. @sprites["#{@i}"].opacity = @opacity
  327. @i += 1
  328. @frame = 0
  329. end
  330. for key in @sprites.keys
  331. if @sprites[key].opacity > @keyFrame
  332. @sprites[key].opacity -= 24
  333. @sprites[key].zoom_x -= 0.035
  334. @sprites[key].zoom_y -= 0.035
  335. @sprites[key].color = @color
  336. end
  337. end
  338. end
  339.  
  340. def visible=(val)
  341. for key in @sprites.keys
  342. @sprites[key].visible = val
  343. end
  344. end
  345.  
  346. def dispose
  347. for key in @sprites.keys
  348. @sprites[key].dispose
  349. end
  350. @sprites.clear
  351. end
  352.  
  353. def disposed?
  354. @sprites.keys.length < 1
  355. end
  356. end
  357. #-------------------------------------------------------------------------------
  358. # Class used to render the background for the special S&M trainer battle
  359. # animation
  360. #-------------------------------------------------------------------------------
  361. class RainbowSprite < Sprite
  362. attr_accessor :speed
  363. def setBitmap(val,speed = 1)
  364. @val = val
  365. @val = pbBitmap(val) if val.is_a?(String)
  366. @speed = speed
  367. self.bitmap = Bitmap.new(@val.width,@val.height)
  368. self.bitmap.blt(0,0,@val,Rect.new(0,0,@val.width,@val.height))
  369. @current_hue = 0
  370. end
  371.  
  372. def update
  373. self.bitmap.clear
  374. self.bitmap.blt(0,0,@val,Rect.new(0,0,@val.width,@val.height))
  375. self.bitmap.hue_change(@current_hue)
  376. @current_hue += @speed
  377. @current_hue = 0 if @current_hue >= 360
  378. end
  379. end
  380. #-------------------------------------------------------------------------------
  381. # Common UI handlers
  382. #-------------------------------------------------------------------------------
  383. class CommonButton < Sprite
  384. attr_accessor :selected
  385. def setButton(size="M",var=1,text="")
  386. bmp = pbBitmap("Graphics/Pictures/Common/btn#{size}_#{var}")
  387. pbSetSmallFont(bmp)
  388. case size
  389. when "M"
  390. x, y, w, h = 46, 22, 92, 38
  391. when "N"
  392. x, y, w, h = 54, 16, 108, 30
  393. when "L"
  394. x, y, w, h = 61, 22, 122, 38
  395. end
  396. color = self.darkenColor(bmp.get_pixel(x, y))
  397. self.bitmap = Bitmap.new(bmp.width - 22, bmp.height)
  398. pbSetSmallFont(self.bitmap)
  399. self.bitmap.blt(0, 0, bmp, Rect.new(0, 0, bmp.width - 22, bmp.height))
  400. pbDrawOutlineText(self.bitmap,2,2,w,h,text,Color.new(255,255,255),color,1)
  401. end
  402.  
  403. def darkenColor(color=nil,amt=0.6)
  404. return getDarkerColor(color,amt)
  405. end
  406. end
  407.  
  408. def getDarkerColor(color=nil,amt=0.6)
  409. return nil if color.nil?
  410. red = color.red - color.red*amt
  411. green = color.green - color.green*amt
  412. blue = color.blue - color.blue*amt
  413. return Color.new(red,green,blue)
  414. end
  415. #-------------------------------------------------------------------------------
  416. # Misc scripting utilities
  417. #-------------------------------------------------------------------------------
  418. class Bitmap
  419. attr_accessor :storedPath
  420. end
  421.  
  422. def pbBitmap(name)
  423. if !pbResolveBitmap(name).nil?
  424. bmp = BitmapCache.load_bitmap(name)
  425. bmp.storedPath = name
  426. else
  427. p "Image located at '#{name}' was not found!" if $DEBUG
  428. bmp = Bitmap.new(1,1)
  429. end
  430. return bmp
  431. end
  432. #-------------------------------------------------------------------------------
  433. # F12 Soft-resetting fix
  434. #-------------------------------------------------------------------------------
  435. if defined?(SOFTRESETFIX) && SOFTRESETFIX
  436. unless $f12_fix.nil?
  437. game_name = "Game"
  438. if $DEBUG
  439. Thread.new{system(game_name+" debug")}
  440. else
  441. Thread.new{system(game_name)}
  442. end
  443. exit
  444. end
  445. $f12_fix = true
  446. end
  447. #===============================================================================
  448. # New methods used to inject new code into Scripts.rxdata
  449. #-------------------------------------------------------------------------------
  450. # Backs up your current scripts to prevent any permanent damage
  451. #-------------------------------------------------------------------------------
  452. def backupScriptData(file_name = nil)
  453. if file_name.nil?
  454. ini = Win32API.new('kernel32', 'GetPrivateProfileString','PPPPLP', 'L')
  455. scripts_filename = "\0" * 256
  456. ini.call('Game', 'Scripts', '', scripts_filename, 256, '.\\Game.ini')
  457. scripts_filename.delete!("\0")
  458. else
  459. scripts_filename = file_name
  460. end
  461. File.copy(scripts_filename, scripts_filename+".bak",false)
  462. end
  463. #-------------------------------------------------------------------------------
  464. # Returns all possible data read from the game's scripts
  465. #-------------------------------------------------------------------------------
  466. def getScriptData(file_name = nil)
  467. # Backs up the Scripts
  468. backupScriptData(file_name)
  469. # Gets Scripts filename from the .ini file
  470. if file_name.nil?
  471. ini = Win32API.new('kernel32', 'GetPrivateProfileString','PPPPLP', 'L')
  472. scripts_filename = "\0" * 256
  473. ini.call('Game', 'Scripts', '', scripts_filename, 256, '.\\Game.ini')
  474. scripts_filename.delete!("\0")
  475. else
  476. scripts_filename = file_name
  477. end
  478.  
  479. scripts = load_data(scripts_filename)
  480. names = []
  481. codes = []
  482. # Reads all the currently existing scripts, and stores them for later manipulation
  483. for script in scripts
  484. id, name, code = script
  485. next if id.nil?
  486. code = Zlib::Inflate.inflate(code)
  487. code.gsub!(/\t/) {' '}
  488. names.push(name)
  489. codes.push(code)
  490. end
  491. return names, codes, scripts_filename
  492. end
  493. #-------------------------------------------------------------------------------
  494. # Returns one specific script from the game's scripts
  495. #-------------------------------------------------------------------------------
  496. def getSpecificScript(name = "Main")
  497. # Fetches all the necessary Scripts data
  498. names, codes, scripts_filename = getScriptData
  499. # Gets the location index of script from name
  500. if name.is_a?(String)
  501. index = names.index(name)
  502. elsif name.is_a?(Numeric)
  503. index = name
  504. else
  505. return # failsafe
  506. end
  507. # Returns selected script
  508. return codes[index]
  509. end
  510. #-------------------------------------------------------------------------------
  511. #===============================================================================
  512. # Elite Battle system
  513. # by Luka S.J.
  514. # ----------------
  515. # Sprites Script
  516. # ----------------
  517. # system is based off the original Essentials battle system, made by
  518. # Poccil & Maruno
  519. # No additional features added to AI, mechanics
  520. # or functionality of the battle system.
  521. # This update is purely cosmetic, and includes a B/W like dynamic scene with a
  522. # custom interface.
  523. #
  524. # Enjoy the script, and make sure to give credit!
  525. # (DO NOT ALTER THE NAMES OF THE INDIVIDUAL SCRIPT SECTIONS OR YOU WILL BREAK
  526. # YOUR SYSTEM!)
  527. #-------------------------------------------------------------------------------
  528. # New methods for creating in-battle Pokemon sprites.
  529. # * creates fixed shadows in the sprite itself
  530. # * calculates correct positions according to metric data in here
  531. # * sprites have a different focal point for more precise base placement
  532. #===============================================================================
  533. class DynamicPokemonSprite
  534. attr_accessor :shadow
  535. attr_accessor :sprite
  536. attr_accessor :showshadow
  537. attr_accessor :status
  538. attr_accessor :hidden
  539. attr_accessor :fainted
  540. attr_accessor :anim
  541. attr_accessor :charged
  542. attr_accessor :isShadow
  543. attr_reader :loaded
  544. attr_reader :selected
  545. attr_reader :isSub
  546. attr_reader :viewport
  547. attr_reader :pulse
  548.  
  549. def initialize(doublebattle,index,viewport=nil)
  550. @viewport=viewport
  551. @metrics=load_data("Data/metrics.dat")
  552. @selected=0
  553. @frame=0
  554. @frame2=0
  555. @frame3=0
  556.  
  557. @status=0
  558. @loaded=false
  559. @charged=false
  560. @index=index
  561. @doublebattle=doublebattle
  562. @showshadow=true
  563. @altitude=0
  564. @yposition=0
  565. @shadow=Sprite.new(@viewport)
  566. @sprite=Sprite.new(@viewport)
  567. back=(@index%2==0)
  568. @substitute=AnimatedBitmapWrapper.new("Graphics/Battlers/"+(back ? "substitute_back" : "substitute"),POKEMONSPRITESCALE)
  569. @overlay=Sprite.new(@viewport)
  570. @isSub=false
  571. @lock=false
  572. @pokemon=nil
  573. @still=false
  574. @hidden=false
  575. @fainted=false
  576. @anim=false
  577. @isShadow=false
  578.  
  579. @fp = {}
  580. for i in 0...16
  581. @fp["#{i}"] = Sprite.new(@viewport)
  582. @fp["#{i}"].bitmap = pbBitmap("Graphics/Animations/ebShadow")
  583. @fp["#{i}"].ox = @fp["#{i}"].bitmap.width/4
  584. @fp["#{i}"].oy = @fp["#{i}"].bitmap.height/2
  585. @fp["#{i}"].src_rect.set(0,0,@fp["#{i}"].bitmap.width/2,@fp["#{i}"].bitmap.height)
  586. @fp["#{i}"].opacity = 0
  587. end
  588.  
  589. for i in 0...16
  590. @fp["c#{i}"] = Sprite.new(@viewport)
  591. @fp["c#{i}"].bitmap = pbBitmap("Graphics/Animations/ebCharged")
  592. @fp["c#{i}"].ox = @fp["c#{i}"].bitmap.width/8
  593. @fp["c#{i}"].oy = @fp["c#{i}"].bitmap.height
  594. @fp["c#{i}"].src_rect.set(0,0,@fp["c#{i}"].bitmap.width/4,@fp["c#{i}"].bitmap.height)
  595. @fp["c#{i}"].opacity = 0
  596. end
  597.  
  598. for j in 0...4
  599. @fp["r#{j}"] = Sprite.new(viewport)
  600. @fp["r#{j}"].bitmap = pbBitmap("Graphics/Animations/ebRipple")
  601. @fp["r#{j}"].ox = @fp["r#{j}"].bitmap.width/2
  602. @fp["r#{j}"].oy = @fp["r#{j}"].bitmap.height/2
  603. @fp["r#{j}"].zoom_x = 0
  604. @fp["r#{j}"].zoom_y = 0
  605. @fp["r#{j}"].param = 0
  606. end
  607.  
  608. @pulse = 8
  609. @k = 1
  610. end
  611.  
  612. def battleIndex; return @index; end
  613. def x; @sprite.x; end
  614. def y; @sprite.y; end
  615. def z; @sprite.z; end
  616. def ox; @sprite.ox; end
  617. def oy; @sprite.oy; end
  618. def zoom_x; @sprite.zoom_x; end
  619. def zoom_y; @sprite.zoom_y; end
  620. def visible; @sprite.visible; end
  621. def opacity; @sprite.opacity; end
  622. def width; @bitmap.width; end
  623. def height; @bitmap.height; end
  624. def tone; @sprite.tone; end
  625. def bitmap; @bitmap.bitmap; end
  626. def actualBitmap; @bitmap; end
  627. def disposed?; @sprite.disposed?; end
  628. def color; @sprite.color; end
  629. def src_rect; @sprite.src_rect; end
  630. def blend_type; @sprite.blend_type; end
  631. def angle; @sprite.angle; end
  632. def mirror; @sprite.mirror; end
  633. def src_rect; return @sprite.src_rect; end
  634. def src_rect=(val)
  635. @sprite.src_rect=val
  636. end
  637. def lock
  638. @lock=true
  639. end
  640. def bitmap=(val)
  641. @bitmap.bitmap=val
  642. end
  643. def x=(val)
  644. @sprite.x=val
  645. @shadow.x=val
  646. end
  647. def ox=(val)
  648. @sprite.ox=val
  649. self.formatShadow
  650. end
  651. def addOx(val)
  652. @sprite.ox+=val
  653. self.formatShadow
  654. end
  655. def oy=(val)
  656. @sprite.oy=val
  657. self.formatShadow
  658. end
  659. def addOy(val)
  660. @sprite.oy+=val
  661. self.formatShadow
  662. end
  663. def y=(val)
  664. @sprite.y=val
  665. @shadow.y=val
  666. end
  667. def z=(val)
  668. @shadow.z=(val==32) ? 31 : 10
  669. @sprite.z=val
  670. end
  671. def zoom_x=(val)
  672. @sprite.zoom_x=val
  673. self.formatShadow
  674. end
  675. def zoom_y=(val)
  676. @sprite.zoom_y=val
  677. self.formatShadow
  678. end
  679. def visible=(val)
  680. return if @hidden
  681. @sprite.visible=val
  682. if @fp
  683. for key in @fp.keys
  684. @fp[key].visible=val
  685. end
  686. end
  687. self.formatShadow
  688. end
  689. def opacity=(val)
  690. @sprite.opacity=val
  691. self.formatShadow
  692. end
  693. def tone=(val)
  694. @sprite.tone=val
  695. end
  696. def color=(val)
  697. @sprite.color=val
  698. if @fp
  699. for key in @fp.keys
  700. @fp[key].color=val
  701. end
  702. end
  703. end
  704. def blend_type=(val)
  705. @sprite.blend_type=val
  706. self.formatShadow
  707. end
  708. def angle=(val)
  709. @sprite.angle=(val)
  710. self.formatShadow
  711. end
  712. def mirror=(val)
  713. @sprite.mirror=(val)
  714. self.formatShadow
  715. end
  716. def dispose
  717. @sprite.dispose
  718. @shadow.dispose
  719. pbDisposeSpriteHash(@fp)
  720. end
  721. def selected=(val)
  722. @selected=val
  723. @sprite.visible=true if !@hidden
  724. end
  725. def toneAll(val)
  726. @sprite.tone.red+=val
  727. @sprite.tone.green+=val
  728. @sprite.tone.blue+=val
  729. end
  730.  
  731. def setBitmap(file,shadow=false)
  732. self.resetParticles
  733. @showshadow = shadow
  734. @bitmap = AnimatedBitmapWrapper.new(file)
  735. @sprite.bitmap = @bitmap.bitmap.clone
  736. @shadow.bitmap = @bitmap.bitmap.clone
  737. @loaded = true
  738. self.formatShadow
  739. end
  740.  
  741. def setPokemonBitmap(pokemon,back=false,species=nil)
  742. self.resetParticles
  743. return if !pokemon || pokemon.nil?
  744. @pokemon = pokemon
  745. @isShadow = true if @pokemon.isShadow?
  746. @altitude = @metrics[2][pokemon.species]
  747. if back
  748. @yposition = @metrics[0][pokemon.species]
  749. @altitude *= 0.5
  750. else
  751. @yposition = @metrics[1][pokemon.species]
  752. end
  753. scale = back ? BACKSPRITESCALE : POKEMONSPRITESCALE
  754. if !species.nil?
  755. @bitmap = pbLoadPokemonBitmapSpecies(pokemon,species,back,scale)
  756. else
  757. @bitmap = pbLoadPokemonBitmap(pokemon,back,scale)
  758. end
  759. @sprite.bitmap = @bitmap.bitmap.clone
  760. @shadow.bitmap = @bitmap.bitmap.clone
  761. @sprite.ox = @bitmap.width/2
  762. @sprite.oy = @bitmap.height
  763. @sprite.oy += @altitude
  764. @sprite.oy -= @yposition
  765. @sprite.oy -= pokemon.formOffsetY if pokemon.respond_to?(:formOffsetY)
  766.  
  767. @fainted = false
  768. @loaded = true
  769. @hidden = false
  770. self.visible = true
  771. @pulse = 8
  772. @k = 1
  773. self.formatShadow
  774. end
  775.  
  776. def resetParticles
  777. if @fp
  778. for key in @fp.keys
  779. @fp[key].visible = false
  780. end
  781. end
  782. @isShadow = false
  783. @charged = false
  784. end
  785.  
  786. def refreshMetrics(metrics)
  787. @metrics = metrics
  788. @altitude = @metrics[2][@pokemon.species]
  789. if (@index%2==0)
  790. @yposition = @metrics[0][@pokemon.species]
  791. @altitude *= 0.5
  792. else
  793. @yposition = @metrics[1][@pokemon.species]
  794. end
  795.  
  796. @sprite.ox = @bitmap.width/2
  797. @sprite.oy = @bitmap.height
  798. @sprite.oy += @altitude
  799. @sprite.oy -= @yposition
  800. @sprite.oy -= @pokemon.formOffsetY if @pokemon.respond_to?(:formOffsetY)
  801. end
  802.  
  803. def setSubstitute
  804. @isSub = true
  805. @sprite.bitmap = @substitute.bitmap.clone
  806. @shadow.bitmap = @substitute.bitmap.clone
  807. @sprite.ox = @substitute.width/2
  808. @sprite.oy = @substitute.height
  809. self.formatShadow
  810. end
  811.  
  812. def removeSubstitute
  813. @isSub = false
  814. @sprite.bitmap = @bitmap.bitmap.clone
  815. @shadow.bitmap = @bitmap.bitmap.clone
  816. @sprite.ox = @bitmap.width/2
  817. @sprite.oy = @bitmap.height
  818. @sprite.oy += @altitude
  819. @sprite.oy -= @yposition
  820. @sprite.oy -= @pokemon.formOffsetY if @pokemon && @pokemon.respond_to?(:formOffsetY)
  821. self.formatShadow
  822. end
  823.  
  824. def still
  825. @still = true
  826. end
  827.  
  828. def clear
  829. @sprite.bitmap.clear
  830. @bitmap.dispose
  831. end
  832.  
  833. def formatShadow
  834. @shadow.zoom_x = @sprite.zoom_x*0.90
  835. @shadow.zoom_y = @sprite.zoom_y*0.30
  836. @shadow.ox = @sprite.ox - 6
  837. @shadow.oy = @sprite.oy - 6
  838. @shadow.opacity = @sprite.opacity*0.3
  839. @shadow.tone = Tone.new(-255,-255,-255,255)
  840. @shadow.visible = @sprite.visible
  841. @shadow.mirror = @sprite.mirror
  842. @shadow.angle = @sprite.angle
  843.  
  844. @shadow.visible = false if !@showshadow
  845. end
  846.  
  847. def update(angle=74)
  848. if @still
  849. @still = false
  850. return
  851. end
  852. return if @lock
  853. return if !@bitmap || @bitmap.disposed?
  854. if @isSub
  855. @substitute.update
  856. @sprite.bitmap=@substitute.bitmap.clone
  857. @shadow.bitmap=@substitute.bitmap.clone
  858. else
  859. @bitmap.update
  860. @sprite.bitmap=@bitmap.bitmap.clone
  861. @shadow.bitmap=@bitmap.bitmap.clone
  862. end
  863. @shadow.skew(angle)
  864. if !@anim && !@pulse.nil?
  865. @pulse += @k
  866. @k *= -1 if @pulse == 128 || @pulse == 8
  867. case @status
  868. when 0
  869. @sprite.color = Color.new(0,0,0,0)
  870. when 1 #PSN
  871. @sprite.color = Color.new(109,55,130,@pulse)
  872. when 2 #PAR
  873. @sprite.color = Color.new(204,152,44,@pulse)
  874. when 3 #FRZ
  875. @sprite.color = Color.new(56,160,193,@pulse)
  876. when 4 #BRN
  877. @sprite.color = Color.new(206,73,43,@pulse)
  878. end
  879. end
  880. @anim = false
  881. # Pokémon sprite blinking when targeted or damaged
  882. @frame += 1
  883. @frame = 0 if @frame > 256
  884. if @selected==2 # When targeted or damaged
  885. @sprite.visible = (@frame%10<7) && !@hidden
  886. end
  887. self.formatShadow
  888. end
  889.  
  890. def shadowUpdate
  891. return if !@loaded
  892. return if self.disposed? || @bitmap.disposed?
  893. for i in 0...16
  894. next if i > @frame2/4
  895. @fp["#{i}"].visible = @showshadow
  896. @fp["#{i}"].visible = false if @hidden
  897. @fp["#{i}"].visible = false if !@isShadow
  898. next if !@isShadow
  899. if @fp["#{i}"].opacity <= 0
  900. @fp["#{i}"].toggle = 2
  901. z = [0.5,0.6,0.7,0.8,0.9,1.0][rand(6)]
  902. @fp["#{i}"].param = z
  903. @fp["#{i}"].x = self.x - self.bitmap.width*self.zoom_x/2 + rand(self.bitmap.width)*self.zoom_x
  904. @fp["#{i}"].y = self.y - 64*self.zoom_y + rand(64)*self.zoom_y
  905. @fp["#{i}"].z = (rand(2)==0) ? self.z - 1 : self.z + 1
  906. @fp["#{i}"].speed = (rand(2)==0) ? +1 : -1
  907. @fp["#{i}"].src_rect.x = rand(2)*@fp["#{i}"].bitmap.width/2
  908. end
  909. @fp["#{i}"].zoom_x = @fp["#{i}"].param*self.zoom_x
  910. @fp["#{i}"].zoom_y = @fp["#{i}"].param*self.zoom_y
  911. @fp["#{i}"].param -= 0.01
  912. @fp["#{i}"].y -= 1
  913. @fp["#{i}"].opacity += 8*@fp["#{i}"].toggle
  914. @fp["#{i}"].toggle = -1 if @fp["#{i}"].opacity >= 255
  915. end
  916. @frame2 += 1 if @frame2 < 128
  917. end
  918.  
  919. def chargedUpdate
  920. return if !@loaded
  921. return if self.disposed? || @bitmap.disposed?
  922. for i in 0...16
  923. next if i > @frame3/16
  924. @fp["c#{i}"].visible = @showshadow
  925. @fp["c#{i}"].visible = false if @hidden
  926. @fp["c#{i}"].visible = false if !@charged
  927. next if !@charged
  928. if @fp["c#{i}"].opacity <= 0
  929. x = @sprite.x - @sprite.ox + rand(@sprite.bitmap.width)
  930. y = @sprite.y - @sprite.oy*0.7 + rand(@sprite.bitmap.height*0.8)
  931. @fp["c#{i}"].x = x
  932. @fp["c#{i}"].y = y
  933. @fp["c#{i}"].z = (rand(2)==0) ? self.z - 1 : self.z + 1
  934. @fp["c#{i}"].src_rect.x = rand(4)*@fp["c#{i}"].bitmap.width/4
  935. @fp["c#{i}"].zoom_y = 0.6
  936. @fp["c#{i}"].opacity = 166 + rand(90)
  937. @fp["c#{i}"].mirror = (x < @sprite.x) ? false : true
  938. end
  939. @fp["c#{i}"].zoom_y += 0.1
  940. @fp["c#{i}"].opacity -= 16
  941. end
  942. for j in 0...4
  943. next if j > @frame3/32
  944. @fp["r#{j}"].visible = @showshadow
  945. @fp["r#{j}"].visible = false if @hidden
  946. @fp["r#{j}"].visible = false if !@charged
  947. if @fp["r#{j}"].opacity <= 0
  948. @fp["r#{j}"].opacity = 255
  949. @fp["r#{j}"].zoom_x = 0
  950. @fp["r#{j}"].zoom_y = 0
  951. @fp["r#{j}"].param = 0
  952. end
  953. @fp["r#{j}"].param += 0.01
  954. @fp["r#{j}"].zoom_x = @fp["r#{j}"].param*self.zoom_x
  955. @fp["r#{j}"].zoom_y = @fp["r#{j}"].param*self.zoom_x
  956. @fp["r#{j}"].x = self.x
  957. @fp["r#{j}"].y = self.y
  958. @fp["r#{j}"].opacity -= 2
  959. end
  960. @frame3 += 1 if @frame3 < 256
  961. end
  962. end
  963. #-------------------------------------------------------------------------------
  964. # Animated trainer sprites
  965. #-------------------------------------------------------------------------------
  966. class DynamicTrainerSprite < DynamicPokemonSprite
  967.  
  968. def initialize(doublebattle,index,viewport=nil,trarray=false)
  969. @viewport=viewport
  970. @trarray=trarray
  971. @selected=0
  972. @frame=0
  973. @frame2=0
  974.  
  975. @status=0
  976. @loaded=false
  977. @index=index
  978. @doublebattle=doublebattle
  979. @showshadow=true
  980. @altitude=0
  981. @yposition=0
  982. @shadow=Sprite.new(@viewport)
  983. @sprite=Sprite.new(@viewport)
  984. @overlay=Sprite.new(@viewport)
  985. @lock=false
  986. end
  987.  
  988. def totalFrames; @bitmap.animationFrames; end
  989. def toLastFrame
  990. @bitmap.toFrame(@bitmap.totalFrames-1)
  991. self.update
  992. end
  993. def selected; end
  994.  
  995. def setTrainerBitmap(file)
  996. @bitmap=AnimatedBitmapWrapper.new(file,TRAINERSPRITESCALE)
  997. @sprite.bitmap=@bitmap.bitmap.clone
  998. @shadow.bitmap=@bitmap.bitmap.clone
  999. @sprite.ox=@bitmap.width/2
  1000. if @doublebattle && @trarray
  1001. if @index==-2
  1002. @sprite.ox-=50
  1003. elsif @index==-1
  1004. @sprite.ox+=50
  1005. end
  1006. end
  1007. @sprite.oy=@bitmap.height-16
  1008.  
  1009. self.formatShadow
  1010. @shadow.skew(74)
  1011. end
  1012.  
  1013. end
  1014. #-------------------------------------------------------------------------------
  1015. # New class used to configure and animate battle backgrounds
  1016. #-------------------------------------------------------------------------------
  1017. class AnimatedBattleBackground < Sprite
  1018.  
  1019. def setBitmap(backdrop,scene)
  1020. blur = 4; blur = BLURBATTLEBACKGROUND if BLURBATTLEBACKGROUND.is_a?(Numeric)
  1021. @eff = {}
  1022. @scene = scene
  1023. if $INEDITOR
  1024. @defaultvector = VECTOR1
  1025. else
  1026. @defaultvector = (@scene.battle.doublebattle ? VECTOR2 : VECTOR1)
  1027. end
  1028. @canAnimate = !pbResolveBitmap("Graphics/BattleBacks/Animation/eff1"+backdrop).nil?
  1029. bg = pbBitmap("Graphics/BattleBacks/battlebg/"+backdrop)
  1030. @bmp = Bitmap.new(bg.width*BACKGROUNDSCALAR,bg.width*BACKGROUNDSCALAR)
  1031. @bmp.stretch_blt(Rect.new(0,0,@bmp.width,@bmp.height),bg,Rect.new(0,0,bg.width,bg.height))
  1032. self.bitmap = @bmp.clone
  1033. self.blur_sprite(blur) if BLURBATTLEBACKGROUND
  1034. sx, sy = @scene.vector.spoof(@defaultvector)
  1035. self.ox = 256 + sx
  1036. self.oy = 192 + sy
  1037. for i in 1..3
  1038. next if !@canAnimate
  1039. @eff["#{i}"] = Sprite.new(self.viewport)
  1040. bmp = pbBitmap("Graphics/BattleBacks/Animation/eff#{i}"+backdrop)
  1041. @eff["#{i}"].bitmap = Bitmap.new(@bmp.width*2,@bmp.height)
  1042. @eff["#{i}"].bitmap.stretch_blt(Rect.new(0,0,@bmp.width*2,@bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))
  1043. @eff["#{i}"].src_rect.set([0,128,0,-128][i]*BACKGROUNDSCALAR,0,bmp.width*BACKGROUNDSCALAR/2,bmp.height*BACKGROUNDSCALAR)
  1044. @eff["#{i}"].ox = self.ox
  1045. @eff["#{i}"].oy = self.oy
  1046. @eff["#{i}"].blur_sprite(blur) if BLURBATTLEBACKGROUND
  1047. end
  1048. self.update
  1049. end
  1050.  
  1051. def update
  1052. if @canAnimate
  1053. @eff["1"].src_rect.x -= 1
  1054. @eff["1"].src_rect.x = 512*BACKGROUNDSCALAR if @eff["1"].src_rect.x <= -256*BACKGROUNDSCALAR
  1055. @eff["2"].src_rect.x += 1
  1056. @eff["2"].src_rect.x = -256*BACKGROUNDSCALAR if @eff["2"].src_rect.x >= 512*BACKGROUNDSCALAR
  1057. @eff["3"].src_rect.x -= 2
  1058. @eff["3"].src_rect.x = 512*BACKGROUNDSCALAR if @eff["3"].src_rect.x <= -256*BACKGROUNDSCALAR
  1059. end
  1060. # coordinates
  1061. self.x = @scene.vector.x2
  1062. self.y = @scene.vector.y2
  1063. self.angle = ((@scene.vector.angle - @defaultvector[2])*0.5).to_i if $PokemonSystem.screensize < 2 && @scene.sendingOut
  1064. sx, sy = @scene.vector.spoof(@defaultvector)
  1065. self.zoom_x = ((@scene.vector.x2 - @scene.vector.x)*1.0/(sx - @defaultvector[0])*1.0)**0.6
  1066. self.zoom_y = ((@scene.vector.y2 - @scene.vector.y)*1.0/(sy - @defaultvector[1])*1.0)**0.6
  1067. for i in 1..3
  1068. next if !@canAnimate
  1069. @eff["#{i}"].x = self.x
  1070. @eff["#{i}"].y = self.y
  1071. @eff["#{i}"].zoom_x = self.zoom_x
  1072. @eff["#{i}"].zoom_y = self.zoom_y
  1073. @eff["#{i}"].visible = true
  1074. @eff["#{i}"].tone = self.tone
  1075. if self.angle!=0
  1076. @eff["#{i}"].opacity -= 51
  1077. else
  1078. @eff["#{i}"].opacity += 51
  1079. end
  1080. end
  1081. end
  1082.  
  1083. alias dispose_bg_ebs dispose unless self.method_defined?(:dispose_bg_ebs)
  1084. def dispose
  1085. pbDisposeSpriteHash(@eff)
  1086. dispose_bg_ebs
  1087. end
  1088.  
  1089. alias :color_bg= :color= unless self.method_defined?(:color_bg=)
  1090. def color=(val)
  1091. for i in 1..3
  1092. next if !@canAnimate
  1093. @eff["#{i}"].color = val
  1094. end
  1095. self.color_bg = val
  1096. end
  1097. end
  1098. #-------------------------------------------------------------------------------
  1099. # New class used to render the Mother Beast Lusamine styled VS background
  1100. #-------------------------------------------------------------------------------
  1101. class CrazyRainbowBackground
  1102.  
  1103. def initialize(viewport)
  1104. @viewport = viewport
  1105. @sprites = {}
  1106.  
  1107. @sprites["bg"] = Sprite.new(@viewport)
  1108. @sprites["bg"].drawRect(@viewport.rect.width,@viewport.rect.height,Color.new(0,0,0))
  1109. @sprites["bg"].z = 200
  1110. for j in 0...3
  1111. @sprites["b#{j}"] = RainbowSprite.new(@viewport)
  1112. @sprites["b#{j}"].setBitmap("Graphics/Transitions/smC#{j}",8)
  1113. @sprites["b#{j}"].ox = @sprites["b#{j}"].bitmap.width/2
  1114. @sprites["b#{j}"].oy = @sprites["b#{j}"].bitmap.height/2
  1115. @sprites["b#{j}"].x = @viewport.rect.width/2
  1116. @sprites["b#{j}"].y = @viewport.rect.height/2
  1117. @sprites["b#{j}"].zoom_x = 0.6 + 0.6*j
  1118. @sprites["b#{j}"].zoom_y = 0.6 + 0.6*j
  1119. @sprites["b#{j}"].opacity = 64 + 64*(1+j)
  1120. @sprites["b#{j}"].z = 250
  1121. end
  1122. for j in 0...64
  1123. @sprites["p#{j}"] = Sprite.new(@viewport)
  1124. @sprites["p#{j}"].z = 300
  1125. width = 16 + rand(48)
  1126. height = 16 + rand(16)
  1127. @sprites["p#{j}"].bitmap = Bitmap.new(width,height)
  1128. bmp = pbBitmap("Graphics/Transitions/smCParticle")
  1129. @sprites["p#{j}"].bitmap.stretch_blt(Rect.new(0,0,width,height),bmp,Rect.new(0,0,bmp.width,bmp.height))
  1130. @sprites["p#{j}"].bitmap.hue_change(rand(360))
  1131. @sprites["p#{j}"].ox = width/2
  1132. @sprites["p#{j}"].oy = height + 192 + rand(32)
  1133. @sprites["p#{j}"].angle = rand(360)
  1134. @sprites["p#{j}"].speed = 1 + rand(4)
  1135. @sprites["p#{j}"].x = @viewport.rect.width/2
  1136. @sprites["p#{j}"].y = @viewport.rect.height/2
  1137. @sprites["p#{j}"].zoom_x = (@sprites["p#{j}"].oy/192.0)*1.5
  1138. @sprites["p#{j}"].zoom_y = (@sprites["p#{j}"].oy/192.0)*1.5
  1139. end
  1140. @frame = 0
  1141. end
  1142.  
  1143. def update
  1144. for j in 0...3
  1145. @sprites["b#{j}"].zoom_x -= 0.025
  1146. @sprites["b#{j}"].zoom_y -= 0.025
  1147. @sprites["b#{j}"].opacity -= 4
  1148. if @sprites["b#{j}"].zoom_x <= 0 || @sprites["b#{j}"].opacity <= 0
  1149. @sprites["b#{j}"].zoom_x = 2.25
  1150. @sprites["b#{j}"].zoom_y = 2.25
  1151. @sprites["b#{j}"].opacity = 255
  1152. end
  1153. @sprites["b#{j}"].update if @frame%8==0
  1154. end
  1155. for j in 0...64
  1156. @sprites["p#{j}"].angle -= @sprites["p#{j}"].speed
  1157. @sprites["p#{j}"].opacity -= @sprites["p#{j}"].speed
  1158. @sprites["p#{j}"].oy -= @sprites["p#{j}"].speed/2 if @sprites["p#{j}"].oy > @sprites["p#{j}"].bitmap.height
  1159. @sprites["p#{j}"].zoom_x = (@sprites["p#{j}"].oy/192.0)*1.5
  1160. @sprites["p#{j}"].zoom_y = (@sprites["p#{j}"].oy/192.0)*1.5
  1161. if @sprites["p#{j}"].zoom_x <= 0 || @sprites["p#{j}"].oy <= 0 || @sprites["p#{j}"].opacity <= 0
  1162. @sprites["p#{j}"].angle = rand(360)
  1163. @sprites["p#{j}"].oy = @sprites["p#{j}"].bitmap.height + 192 + rand(32)
  1164. @sprites["p#{j}"].zoom_x = (@sprites["p#{j}"].oy/192.0)*1.5
  1165. @sprites["p#{j}"].zoom_y = (@sprites["p#{j}"].oy/192.0)*1.5
  1166. @sprites["p#{j}"].opacity = 255
  1167. @sprites["p#{j}"].speed = 1 + rand(4)
  1168. end
  1169. end
  1170. @frame += 1
  1171. @frame = 0 if @frame > 128
  1172. end
  1173.  
  1174. def dispose
  1175. pbDisposeSpriteHash(@sprites)
  1176. end
  1177.  
  1178. end
  1179. #===============================================================================
  1180. # New functions for the Sprite class
  1181. # adds new bitmap transformations
  1182. #===============================================================================
  1183. def setPictureSpriteEB(sprite,picture)
  1184. sprite.visible = picture.visible
  1185. # Set sprite coordinates
  1186. sprite.y = picture.y
  1187. sprite.z = picture.number
  1188. # Set zoom rate, opacity level, and blend method
  1189. sprite.zoom_x = picture.zoom_x / 100.0
  1190. sprite.zoom_y = picture.zoom_y / 100.0
  1191. sprite.opacity = picture.opacity
  1192. sprite.blend_type = picture.blend_type
  1193. # Set rotation angle and color tone
  1194. angle = picture.angle
  1195. sprite.tone = picture.tone
  1196. sprite.color = picture.color
  1197. while angle < 0
  1198. angle += 360
  1199. end
  1200. angle %= 360
  1201. sprite.angle=angle
  1202. end
  1203. #-------------------------------------------------------------------------------
  1204. # Utilities used for move animations
  1205. #-------------------------------------------------------------------------------
  1206. class PokeBattle_Scene
  1207. def getCenter(sprite,zoom=false)
  1208. zoom = zoom ? sprite.zoom_y : 1
  1209. x = sprite.x
  1210. y = sprite.y + (sprite.bitmap.height-sprite.oy)*zoom - sprite.bitmap.height*zoom/2
  1211. return x, y
  1212. end
  1213.  
  1214. def alignSprites(sprite,target)
  1215. sprite.ox = sprite.src_rect.width/2
  1216. sprite.oy = sprite.src_rect.height/2
  1217. sprite.x, sprite.y = getCenter(target)
  1218. sprite.zoom_x, sprite.zoom_y = target.zoom_x/2, target.zoom_y/2
  1219. end
  1220.  
  1221. def getRealVector(targetindex,player)
  1222. vector = (player ? PLAYERVECTOR : ENEMYVECTOR).clone
  1223. if @battle.doublebattle && !USEBATTLEBASES
  1224. case targetindex
  1225. when 0
  1226. vector[0] = vector[0] + 80
  1227. when 1
  1228. vector[0] = vector[0] + 192
  1229. when 2
  1230. vector[0] = vector[0] - 64
  1231. when 3
  1232. vector[0] = vector[0] - 36
  1233. end
  1234. end
  1235. return vector
  1236. end
  1237.  
  1238. def applySpriteProperties(sprite1,sprite2)
  1239. sprite2.x = sprite1.x
  1240. sprite2.y = sprite1.y
  1241. sprite2.z = sprite1.z
  1242. sprite2.zoom_x = sprite1.zoom_x
  1243. sprite2.zoom_y = sprite1.zoom_y
  1244. sprite2.opacity = sprite1.opacity
  1245. sprite2.angle = sprite1.angle
  1246. sprite2.tone = sprite1.tone
  1247. sprite2.color = sprite1.color
  1248. sprite2.visible = sprite1.visible
  1249. end
  1250. end
  1251. #===============================================================================
  1252. # Misc. scripting tools
  1253. #===============================================================================
  1254. def checkEBFolderPath
  1255. if !pbResolveBitmap("Graphics/Pictures/EBS/pokeballs").nil?
  1256. return "Graphics/Pictures/EBS"
  1257. else
  1258. return "Graphics/Pictures"
  1259. end
  1260. end
  1261.  
  1262. def checkEBFolderPathDS
  1263. if !pbResolveBitmap("Graphics/Pictures/EBS/DS/background").nil?
  1264. return "Graphics/Pictures/EBS/DS"
  1265. else
  1266. return "Graphics/Pictures"
  1267. end
  1268. end
  1269.  
  1270. #===============================================================================
  1271. # Elite Battle system
  1272. # by Luka S.J.
  1273. # ----------------
  1274. # EntryAnimations Script
  1275. # ----------------
  1276. # system is based off the original Essentials battle system, made by
  1277. # Poccil & Maruno
  1278. # No additional features added to AI, mechanics
  1279. # or functionality of the battle system.
  1280. # This update is purely cosmetic, and includes a B/W like dynamic scene with a
  1281. # custom interface.
  1282. #
  1283. # Enjoy the script, and make sure to give credit!
  1284. # (DO NOT ALTER THE NAMES OF THE INDIVIDUAL SCRIPT SECTIONS OR YOU WILL BREAK
  1285. # YOUR SYSTEM!)
  1286. #-------------------------------------------------------------------------------
  1287. # Replaces the stock battle start animations for trainer (non-VS) and wild
  1288. # battles.
  1289. #
  1290. # If you'd like to use just the new transitions from EBS for your project,
  1291. # you'll also need to copy over the EliteBattle_Sprites section of the scripts
  1292. # to your project, as well as the configurations for the following constants:
  1293. # - VIEWPORT_HEIGHT
  1294. # - VIEWPORT_OFFSET
  1295. #
  1296. # In order to use the New VS sequence you need the following images in your
  1297. # Graphics/Transitions/ folder:
  1298. # - vsTrainer#{trainer_id}
  1299. # - vsBarNew#{trainer_id}
  1300. #
  1301. # In order to use the Elite Four VS sequence you need the following images in your
  1302. # Graphics/Transitions/ folder:
  1303. # - vsTrainer#{trainer_id}
  1304. # - vsBarElite#{trainer_id}
  1305. #
  1306. # In order to use the Special VS sequence you need the following images in your
  1307. # Graphics/Transitions/ folder:
  1308. # - vsTrainerSpecial#{trainer_id}
  1309. # - vsBarSpecial#{trainer_id}
  1310. #
  1311. # In order to use the new Sun/Moon styled trainer battles you need the following
  1312. # in your Graphics/Transitions/ folder:
  1313. # - smTrainer#{trainer_id}
  1314. # Other styles for S&M transitions:
  1315. # - smSpecial#{trainer_id} <-- Plays a special version
  1316. # - smElite#{trainer_id} <-- Plays an Elite4 version
  1317. # - smCrazy#{trainer_id} <-- Plays a crazy bg version
  1318. #
  1319. # Having just the trainersprite will play the animation with the default background
  1320. # found in the Graphics/Transitions/ folder. You can use unique backgrounds for
  1321. # your trainertypes by having the following in your folder:
  1322. # - smBg#{trainer_id}
  1323. # - smBgNext#{trainer_id}
  1324. # - smBgLast#{trainer_id}
  1325. # - smEffBg#{trainer_id} (for Elite4 variant)
  1326. #
  1327. # If you have the smSpecial#{trainer_id} image file in your Graphics/Transitions
  1328. # folder, the game will play a special variant of the SM VS animation.
  1329. #
  1330. # New graphics for default VS backgrounds of any trainertypes registered in the
  1331. # EVIL_TEAM_LIST array are in Graphics/Transitions/ folder:
  1332. # - smBgEvil
  1333. # - smBgNextEvil
  1334. # - smBgLastEvil
  1335. #
  1336. # You can add special transitions for your species by having the following
  1337. # Graphics in your Graphics/Transitions/ folder:
  1338. # - species#{species_id}
  1339. # - speciesBg#{species_id} (optional)
  1340. # - speciesEffA#{species_id} (optional)
  1341. # - speciesEffB#{species_id} (optional)
  1342. # - speciesEffC#{species_id} (optional)
  1343. #
  1344. # This style is only compatible with the Next Gen UI
  1345. #===============================================================================
  1346. alias pbBattleAnimation_ebs pbBattleAnimation unless defined?(pbBattleAnimation_ebs)
  1347. def pbBattleAnimation(bgm=nil,trainerid=-1,trainername="")
  1348. handled = false
  1349. playingBGS = nil
  1350. playingBGM = nil
  1351. if $game_system && $game_system.is_a?(Game_System)
  1352. playingBGS = $game_system.getPlayingBGS
  1353. playingBGM = $game_system.getPlayingBGM
  1354. $game_system.bgm_pause
  1355. $game_system.bgs_pause
  1356. end
  1357. $smAnim = false
  1358. $specialSpecies = false
  1359. pbMEFade(0.25)
  1360. pbWait(10)
  1361. pbMEStop
  1362. for value in BATTLE_BGM_SPECIES
  1363. if value[0].is_a?(Array)
  1364. for species in value[0]
  1365. num = species if species.is_a?(Numeric)
  1366. num = getConst(PBSpecies,species) if species.is_a?(Symbol)
  1367. bgm = value[1] if !num.nil? && trainerid < 0 && num == $wildSpecies
  1368. end
  1369. else
  1370. num = value[0] if value[0].is_a?(Numeric)
  1371. num = getConst(PBSpecies,value[0]) if value[0].is_a?(Symbol)
  1372. bgm = value[1] if !num.nil? && trainerid < 0 && num == $wildSpecies
  1373. end
  1374. end
  1375. if bgm
  1376. pbBGMPlay(bgm,80)
  1377. else
  1378. pbBGMPlay(pbGetWildBattleBGM(0),80)
  1379. end
  1380. viewport = Viewport.new(0,0,Graphics.width,VIEWPORT_HEIGHT)
  1381. viewport.z = 99999
  1382. # Fade to gray a few times.
  1383. viewport.color = Color.new(17*8,17*8,17*8)
  1384. 3.times do
  1385. viewport.color.alpha = 0
  1386. 6.times do
  1387. viewport.color.alpha += 30
  1388. Graphics.update
  1389. Input.update
  1390. pbUpdateSceneMap
  1391. end
  1392. 6.times do
  1393. viewport.color.alpha -= 30
  1394. Graphics.update
  1395. Input.update
  1396. pbUpdateSceneMap
  1397. end
  1398. end
  1399.  
  1400. if trainerid >= 0 && !handled
  1401. tgraphic = sprintf("Graphics/Transitions/smTrainer%d",trainerid)
  1402. tgraphic2 = sprintf("Graphics/Transitions/smSpecial%d",trainerid)
  1403. tgraphic3 = sprintf("Graphics/Transitions/smElite%d",trainerid)
  1404. tgraphic4 = sprintf("Graphics/Transitions/smCrazy%d",trainerid)
  1405. e_team = false
  1406. for val in EVIL_TEAM_LIST
  1407. if val.is_a?(Numeric)
  1408. id = val
  1409. elsif val.is_a?(Symbol)
  1410. id = getConst(PBTrainers,val)
  1411. end
  1412. e_team = true if !id.nil? && trainerid == id
  1413. end
  1414. handled = vsEvilTeam(viewport) if e_team
  1415. if (pbResolveBitmap(tgraphic) || pbResolveBitmap(tgraphic2) || pbResolveBitmap(tgraphic3) || pbResolveBitmap(tgraphic4)) && defined?(EBUISTYLE)
  1416. viewport.color = Color.new(255,255,255,0)
  1417. smPreBattle(viewport) if !handled
  1418. handled = true
  1419. $smAnim = true
  1420. end
  1421. tbargraphic = sprintf("Graphics/Transitions/vsBarSpecial%s",getConstantName(PBTrainers,trainerid)) rescue nil
  1422. tbargraphic = sprintf("Graphics/Transitions/vsBarSpecial%d",trainerid) if !pbResolveBitmap(tbargraphic)
  1423. tgraphic = sprintf("Graphics/Transitions/vsTrainerSpecial%s",getConstantName(PBTrainers,trainerid)) rescue nil
  1424. tgraphic = sprintf("Graphics/Transitions/vsTrainerSpecial%d",trainerid) if !pbResolveBitmap(tgraphic)
  1425. if pbResolveBitmap(tgraphic) && !handled
  1426. handled = vsSequenceSpecial(viewport,trainername,trainerid,tbargraphic,tgraphic)
  1427. end
  1428. tbargraphic = sprintf("Graphics/Transitions/vsBarElite%s",getConstantName(PBTrainers,trainerid)) rescue nil
  1429. tbargraphic = sprintf("Graphics/Transitions/vsBarElite%d",trainerid) if !pbResolveBitmap(tbargraphic)
  1430. tgraphic = sprintf("Graphics/Transitions/vsTrainer%s",getConstantName(PBTrainers,trainerid)) rescue nil
  1431. tgraphic = sprintf("Graphics/Transitions/vsTrainer%d",trainerid) if !pbResolveBitmap(tgraphic)
  1432. if pbResolveBitmap(tbargraphic) && pbResolveBitmap(tgraphic) && !handled
  1433. handled = vsSequenceElite(viewport,trainername,trainerid,tbargraphic,tgraphic)
  1434. end
  1435. tbargraphic = sprintf("Graphics/Transitions/vsBarNew%s",getConstantName(PBTrainers,trainerid)) rescue nil
  1436. tbargraphic = sprintf("Graphics/Transitions/vsBarNew%d",trainerid) if !pbResolveBitmap(tbargraphic)
  1437. if pbResolveBitmap(tbargraphic) && pbResolveBitmap(tgraphic) && !handled
  1438. handled = vsSequenceNew(viewport,trainername,trainerid,tbargraphic,tgraphic)
  1439. end
  1440. tbargraphic = sprintf("Graphics/Transitions/vsBar%s",getConstantName(PBTrainers,trainerid)) rescue nil
  1441. tbargraphic = sprintf("Graphics/Transitions/vsBar%d",trainerid) if !pbResolveBitmap(tbargraphic)
  1442. if pbResolveBitmap(tbargraphic) && pbResolveBitmap(tgraphic) && !handled
  1443. handled = vsSequenceEssentials(viewport,trainername,trainerid,tbargraphic,tgraphic)
  1444. end
  1445. end
  1446. if !handled && trainerid >= 0
  1447. case rand(3)
  1448. when 0
  1449. ebTrainerAnimation1(viewport)
  1450. when 1
  1451. ebTrainerAnimation2(viewport)
  1452. when 2
  1453. ebTrainerAnimation3(viewport)
  1454. end
  1455. handled = true
  1456. end
  1457. if !handled
  1458. minor = false
  1459. if !$wildSpecies.nil?
  1460. for species in MINOR_LEGENDARIES
  1461. num = species if species.is_a?(Numeric)
  1462. num = getConst(PBSpecies,species) if species.is_a?(Symbol)
  1463. minor = true if $wildSpecies == num
  1464. end
  1465. special = pbResolveBitmap("Graphics/Transitions/species#{$wildSpecies}")
  1466. end
  1467. if !$wildSpecies.nil? && queuedIsRegi?
  1468. ebWildAnimationRegi(viewport)
  1469. elsif !$wildSpecies.nil? && special
  1470. ebWildAnimationMinor(viewport,true)
  1471. $specialSpecies = true
  1472. elsif !$wildSpecies.nil? && minor
  1473. ebWildAnimationMinor(viewport)
  1474. elsif !$wildLevel.nil? && $wildLevel > $Trainer.party[0].level
  1475. ebWildAnimationOverlevel(viewport)
  1476. elsif $PokemonGlobal && ($PokemonGlobal.surfing || $PokemonGlobal.diving || $PokemonGlobal.fishing)
  1477. ebWildAnimationWater(viewport)
  1478. elsif $PokemonEncounters && $PokemonEncounters.isCave?
  1479. ebWildAnimationCave(viewport)
  1480. elsif pbGetMetadata($game_map.map_id,MetadataOutdoor)
  1481. ebWildAnimationOutdoor(viewport)
  1482. else
  1483. ebWildAnimationIndoor(viewport)
  1484. end
  1485. handled = true
  1486. end
  1487. pbPushFade
  1488. yield if block_given?
  1489. pbPopFade
  1490. if $game_system && $game_system.is_a?(Game_System)
  1491. $game_system.bgm_resume(playingBGM)
  1492. $game_system.bgs_resume(playingBGS)
  1493. end
  1494. $PokemonGlobal.nextBattleBGM = nil
  1495. $PokemonGlobal.nextBattleME = nil
  1496. $PokemonGlobal.nextBattleBack = nil
  1497. $PokemonEncounters.clearStepCount
  1498. for j in 0..17
  1499. viewport.color = Color.new(0,0,0,(17-j)*15)
  1500. Graphics.update
  1501. Input.update
  1502. pbUpdateSceneMap
  1503. end
  1504. viewport.dispose
  1505. $smAnim = false
  1506. end
  1507.  
  1508. alias pbWildBattle_ebs pbWildBattle unless defined?(pbWildBattle_ebs)
  1509. def pbWildBattle(*args)
  1510. species = args[0]
  1511. if species.is_a?(String) || species.is_a?(Symbol)
  1512. $wildSpecies = getConst(PBSpecies,species)
  1513. else
  1514. $wildSpecies = species
  1515. end
  1516. $wildLevel = args[1]
  1517. return pbWildBattle_ebs(*args)
  1518. $wildSpecies = nil
  1519. $wildLevel = nil
  1520. end
  1521. #-------------------------------------------------------------------------------
  1522. # Custom animations for trainer battles
  1523. #-------------------------------------------------------------------------------
  1524. def ebTrainerAnimation1(viewport)
  1525. ball=Sprite.new(viewport)
  1526. ball.bitmap=pbBitmap("Graphics/Transitions/vsBall")
  1527. ball.ox=ball.bitmap.width/2
  1528. ball.oy=ball.bitmap.height/2
  1529. ball.x=viewport.rect.width/2
  1530. ball.y=viewport.rect.height/2
  1531. ball.zoom_x=0
  1532. ball.zoom_y=0
  1533. 16.times do
  1534. ball.angle+=22.5
  1535. ball.zoom_x+=0.0625
  1536. ball.zoom_y+=0.0625
  1537. pbWait(1)
  1538. end
  1539. bmp=Graphics.snap_to_bitmap
  1540. pbWait(8)
  1541. ball.dispose
  1542. black=Sprite.new(viewport)
  1543. black.bitmap=Bitmap.new(viewport.rect.width,viewport.rect.height)
  1544. black.bitmap.fill_rect(0,0,viewport.rect.width,viewport.rect.height,Color.new(0,0,0))
  1545. field1=Sprite.new(viewport)
  1546. field1.bitmap=bmp
  1547. field1.src_rect.height=VIEWPORT_HEIGHT/2
  1548. field2=Sprite.new(viewport)
  1549. field2.bitmap=bmp
  1550. field2.y=VIEWPORT_HEIGHT/2
  1551. field2.src_rect.height=VIEWPORT_HEIGHT/2
  1552. field2.src_rect.y=(VIEWPORT_HEIGHT+VIEWPORT_OFFSET)/2
  1553. 16.times do
  1554. field1.x-=viewport.rect.width/16
  1555. field2.x+=viewport.rect.width/16
  1556. pbWait(1)
  1557. end
  1558. viewport.color=Color.new(0,0,0,255)
  1559. black.dispose
  1560. field1.dispose
  1561. field2.dispose
  1562. end
  1563.  
  1564. def ebTrainerAnimation2(viewport)
  1565. bmp=Graphics.snap_to_bitmap
  1566. black=Sprite.new(viewport)
  1567. black.bitmap=Bitmap.new(viewport.rect.width,viewport.rect.height)
  1568. black.bitmap.fill_rect(0,0,viewport.rect.width,viewport.rect.height,Color.new(0,0,0))
  1569. field1=Sprite.new(viewport)
  1570. field1.bitmap=bmp
  1571. field1.src_rect.height=VIEWPORT_HEIGHT/2
  1572. field2=Sprite.new(viewport)
  1573. field2.bitmap=bmp
  1574. field2.y=VIEWPORT_HEIGHT/2
  1575. field2.src_rect.height=VIEWPORT_HEIGHT/2
  1576. field2.src_rect.y=(VIEWPORT_HEIGHT+VIEWPORT_OFFSET)/2
  1577. ball1=Sprite.new(viewport)
  1578. ball1.bitmap=pbBitmap("Graphics/Transitions/vsBall")
  1579. ball1.ox=ball1.bitmap.width/2
  1580. ball1.oy=ball1.bitmap.height/2
  1581. ball1.x=viewport.rect.width+ball1.ox
  1582. ball1.y=viewport.rect.height/4
  1583. ball1.zoom_x=0.5
  1584. ball1.zoom_y=0.5
  1585. ball2=Sprite.new(viewport)
  1586. ball2.bitmap=pbBitmap("Graphics/Transitions/vsBall")
  1587. ball2.ox=ball2.bitmap.width/2
  1588. ball2.oy=ball2.bitmap.height/2
  1589. ball2.y=(viewport.rect.height/4)*3
  1590. ball2.x=-ball2.ox
  1591. ball2.zoom_x=0.5
  1592. ball2.zoom_y=0.5
  1593. 16.times do
  1594. ball1.x-=(viewport.rect.width/8)
  1595. ball2.x+=(viewport.rect.width/8)
  1596. pbWait(1)
  1597. end
  1598. 32.times do
  1599. field1.x-=(viewport.rect.width/16)
  1600. field1.y-=(viewport.rect.height/32)
  1601. field2.x+=(viewport.rect.width/16)
  1602. field2.y+=(viewport.rect.height/32)
  1603. pbWait(1)
  1604. end
  1605. viewport.color=Color.new(0,0,0,255)
  1606. black.dispose
  1607. ball1.dispose
  1608. ball2.dispose
  1609. field1.dispose
  1610. field2.dispose
  1611. end
  1612.  
  1613. def ebTrainerAnimation3(viewport)
  1614. balls = {}
  1615. rects = {}
  1616. ball = Bitmap.new(viewport.rect.height/6,viewport.rect.height/6)
  1617. bmp = pbBitmap("Graphics/Transitions/vsBall")
  1618. ball.stretch_blt(Rect.new(0,0,ball.width,ball.height),bmp,Rect.new(0,0,bmp.width,bmp.height))
  1619. for i in 0...6
  1620. rects["#{i}"] = Sprite.new(viewport)
  1621. rects["#{i}"].bitmap = Bitmap.new(1,viewport.rect.height/6)
  1622. rects["#{i}"].bitmap.fill_rect(0,0,1,viewport.rect.height/6,Color.new(0,0,0))
  1623. rects["#{i}"].x = (i%2==0) ? -32 : viewport.rect.width+32
  1624. rects["#{i}"].ox = (i%2==0) ? 0 : 1
  1625. rects["#{i}"].y = (viewport.rect.height/6)*i
  1626.  
  1627. balls["#{i}"] = Sprite.new(viewport)
  1628. balls["#{i}"].bitmap = ball
  1629. balls["#{i}"].ox = ball.width/2
  1630. balls["#{i}"].oy = ball.height/2
  1631. balls["#{i}"].x = rects["#{i}"].x
  1632. balls["#{i}"].y = rects["#{i}"].y + rects["#{i}"].bitmap.height/2
  1633. end
  1634. for j in 0...28
  1635. for i in 0...6
  1636. balls["#{i}"].x+=(i%2==0) ? 24 : -24
  1637. balls["#{i}"].angle-=(i%2==0) ? 42 : -42
  1638. rects["#{i}"].zoom_x+=24
  1639. end
  1640. pbWait(1)
  1641. end
  1642. viewport.color = Color.new(0,0,0,255)
  1643. pbDisposeSpriteHash(balls)
  1644. pbDisposeSpriteHash(rects)
  1645. end
  1646.  
  1647. def vsEvilTeam(viewport)
  1648. fp = {}
  1649. viewport.color = Color.new(0,0,0,0)
  1650. 8.times do
  1651. viewport.color.alpha += 32
  1652. pbWait(1)
  1653. end
  1654.  
  1655. fp["bg"] = Sprite.new(viewport)
  1656. fp["bg"].bitmap = pbBitmap("Graphics/Transitions/evilTeamBg")
  1657. fp["bg"].color = Color.new(0,0,0)
  1658.  
  1659. fp["bg2"] = Sprite.new(viewport)
  1660. fp["bg2"].bitmap = pbBitmap("Graphics/Transitions/evilTeamEff5")
  1661. fp["bg2"].ox = fp["bg2"].bitmap.width/2
  1662. fp["bg2"].oy = fp["bg2"].bitmap.height/2
  1663. fp["bg2"].x = viewport.rect.width/2
  1664. fp["bg2"].y = viewport.rect.height/2
  1665. fp["bg2"].visible = false
  1666.  
  1667. speed = []
  1668. for j in 0...16
  1669. fp["e1_#{j}"] = Sprite.new(viewport)
  1670. bmp = pbBitmap("Graphics/Transitions/evilTeamEff1")
  1671. fp["e1_#{j}"].bitmap = Bitmap.new(bmp.width,bmp.height)
  1672. w = bmp.width/(1 + rand(3))
  1673. fp["e1_#{j}"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))
  1674. fp["e1_#{j}"].oy = fp["e1_#{j}"].bitmap.height/2
  1675. fp["e1_#{j}"].angle = rand(360)
  1676. fp["e1_#{j}"].opacity = 0
  1677. fp["e1_#{j}"].x = viewport.rect.width/2
  1678. fp["e1_#{j}"].y = viewport.rect.height/2
  1679. speed.push(4 + rand(5))
  1680. end
  1681.  
  1682. fp["logo"] = Sprite.new(viewport)
  1683. fp["logo"].bitmap = pbBitmap("Graphics/Transitions/evilTeamLogo")
  1684. fp["logo"].ox = fp["logo"].bitmap.width/2
  1685. fp["logo"].oy = fp["logo"].bitmap.height/2
  1686. fp["logo"].x = viewport.rect.width/2
  1687. fp["logo"].y = viewport.rect.height/2
  1688. fp["logo"].memorize_bitmap
  1689. fp["logo"].bitmap = pbBitmap("Graphics/Transitions/evilTeamLogo2")
  1690. fp["logo"].zoom_x = 2
  1691. fp["logo"].zoom_y = 2
  1692. fp["logo"].z = 50
  1693.  
  1694. fp["ring"] = Sprite.new(viewport)
  1695. fp["ring"].bitmap = pbBitmap("Graphics/Transitions/evilTeamEff2")
  1696. fp["ring"].ox = fp["ring"].bitmap.width/2
  1697. fp["ring"].oy = fp["ring"].bitmap.height/2
  1698. fp["ring"].x = viewport.rect.width/2
  1699. fp["ring"].y = viewport.rect.height/2
  1700. fp["ring"].zoom_x = 0
  1701. fp["ring"].zoom_y = 0
  1702. fp["ring"].z = 100
  1703.  
  1704. for j in 0...32
  1705. fp["e2_#{j}"] = Sprite.new(viewport)
  1706. bmp = pbBitmap("Graphics/Transitions/evilTeamEff4")
  1707. fp["e2_#{j}"].bitmap = pbBitmap("Graphics/Transitions/evilTeamEff4")
  1708. fp["e2_#{j}"].oy = fp["e2_#{j}"].bitmap.height/2
  1709. fp["e2_#{j}"].angle = rand(360)
  1710. fp["e2_#{j}"].opacity = 0
  1711. fp["e2_#{j}"].x = viewport.rect.width/2
  1712. fp["e2_#{j}"].y = viewport.rect.height/2
  1713. fp["e2_#{j}"].z = 100
  1714. end
  1715.  
  1716. fp["ring2"] = Sprite.new(viewport)
  1717. fp["ring2"].bitmap = pbBitmap("Graphics/Transitions/evilTeamEff3")
  1718. fp["ring2"].ox = fp["ring2"].bitmap.width/2
  1719. fp["ring2"].oy = fp["ring2"].bitmap.height/2
  1720. fp["ring2"].x = viewport.rect.width/2
  1721. fp["ring2"].y = viewport.rect.height/2
  1722. fp["ring2"].visible = false
  1723. fp["ring2"].zoom_x = 0
  1724. fp["ring2"].zoom_y = 0
  1725. fp["ring2"].z = 100
  1726.  
  1727. for i in 0...32
  1728. viewport.color.alpha -= 8 if viewport.color.alpha > 0
  1729. fp["logo"].zoom_x -= 1/32.0
  1730. fp["logo"].zoom_y -= 1/32.0
  1731. for j in 0...16
  1732. next if j > i/4
  1733. if fp["e1_#{j}"].ox < -(viewport.rect.width/2)
  1734. speed[j] = 4 + rand(5)
  1735. fp["e1_#{j}"].opacity = 0
  1736. fp["e1_#{j}"].ox = 0
  1737. fp["e1_#{j}"].angle = rand(360)
  1738. bmp = pbBitmap("Graphics/Transitions/evilTeamEff1")
  1739. fp["e1_#{j}"].bitmap.clear
  1740. w = bmp.width/(1 + rand(3))
  1741. fp["e1_#{j}"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))
  1742. end
  1743. fp["e1_#{j}"].opacity += speed[j]
  1744. fp["e1_#{j}"].ox -= speed[j]
  1745. end
  1746. pbWait(1)
  1747. end
  1748. fp["logo"].color = Color.new(255,255,255)
  1749. fp["logo"].restore_bitmap
  1750. fp["ring2"].visible = true
  1751. fp["bg2"].visible = true
  1752. viewport.color = Color.new(255,255,255)
  1753. for i in 0...144
  1754. if i >= 128
  1755. viewport.color.alpha += 16
  1756. else
  1757. viewport.color.alpha -= 16 if viewport.color.alpha > 0
  1758. end
  1759. fp["logo"].color.alpha -= 16 if fp["logo"].color.alpha > 0
  1760. fp["bg"].color.alpha -= 8 if fp["bg"].color.alpha > 0
  1761. for j in 0...16
  1762. if fp["e1_#{j}"].ox < -(viewport.rect.width/2)
  1763. speed[j] = 4 + rand(5)
  1764. fp["e1_#{j}"].opacity = 0
  1765. fp["e1_#{j}"].ox = 0
  1766. fp["e1_#{j}"].angle = rand(360)
  1767. bmp = pbBitmap("Graphics/Transitions/evilTeamEff1")
  1768. fp["e1_#{j}"].bitmap.clear
  1769. w = bmp.width/(1 + rand(3))
  1770. fp["e1_#{j}"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))
  1771. end
  1772. fp["e1_#{j}"].opacity += speed[j]
  1773. fp["e1_#{j}"].ox -= speed[j]
  1774. end
  1775. for j in 0...32
  1776. next if j > i*2
  1777. fp["e2_#{j}"].ox -= 16
  1778. fp["e2_#{j}"].opacity += 16
  1779. end
  1780. fp["ring"].zoom_x += 0.1
  1781. fp["ring"].zoom_y += 0.1
  1782. fp["ring"].opacity -= 8
  1783. fp["ring2"].zoom_x += 0.2 if fp["ring2"].zoom_x < 3
  1784. fp["ring2"].zoom_y += 0.2 if fp["ring2"].zoom_y < 3
  1785. fp["ring2"].opacity -= 16
  1786. fp["bg2"].angle += 2 if $PokemonSystem.screensize < 2
  1787. pbWait(1)
  1788. end
  1789. pbDisposeSpriteHash(fp)
  1790. 8.times do
  1791. viewport.color.red -= 255/8.0
  1792. viewport.color.green -= 255/8.0
  1793. viewport.color.blue -= 255/8.0
  1794. pbWait(1)
  1795. end
  1796. end
  1797. #-------------------------------------------------------------------------------
  1798. # Custom animations for wild battles
  1799. #-------------------------------------------------------------------------------
  1800. def queuedIsRegi?
  1801. ret = false
  1802. for poke in [:REGIROCK,:REGISTEEL,:REGICE,:REGIGIGAS]
  1803. num = getConst(PBSpecies,poke)
  1804. next if num.nil? || ret
  1805. if $wildSpecies == num
  1806. ret = true
  1807. end
  1808. end
  1809. return ret
  1810. end
  1811.  
  1812. def ebWildAnimationRegi(viewport)
  1813. fp = {}
  1814. index = [PBSpecies::REGIROCK,PBSpecies::REGISTEEL,PBSpecies::REGICE,PBSpecies::REGIGIGAS].index($wildSpecies)
  1815. width = viewport.rect.width
  1816. height = viewport.rect.height
  1817. viewport.color = Color.new(0,0,0,0)
  1818. fp["back"] = Sprite.new(viewport)
  1819. fp["back"].bitmap = Graphics.snap_to_bitmap
  1820. fp["back"].blur_sprite
  1821. c = index < 3 ? 0 : 255
  1822. fp["back"].color = Color.new(c,c,c,128*(index < 3 ? 1 : 2))
  1823. fp["back"].z = 99999
  1824. fp["back"].opacity = 0
  1825. x = [
  1826. [width*0.5,width*0.25,width*0.75,width*0.25,width*0.75,width*0.25,width*0.75],
  1827. [width*0.5,width*0.3,width*0.7,width*0.15,width*0.85,width*0.3,width*0.7],
  1828. [width*0.5,width*0.325,width*0.675,width*0.5,width*0.5,width*0.15,width*0.85],
  1829. [width*0.5,width*0.5,width*0.5,width*0.5,width*0.35,width*0.65,width*0.5]
  1830. ]
  1831. y = [
  1832. [height*0.5,height*0.5,height*0.5,height*0.25,height*0.75,height*0.75,height*0.25],
  1833. [height*0.5,height*0.25,height*0.75,height*0.5,height*0.5,height*0.75,height*0.25],
  1834. [height*0.5,height*0.5,height*0.5,height*0.25,height*0.75,height*0.5,height*0.5],
  1835. [height*0.9,height*0.74,height*0.58,height*0.4,height*0.25,height*0.25,height*0.1]
  1836. ]
  1837. for j in 0...14
  1838. fp["#{j}"] = Sprite.new(viewport)
  1839. fp["#{j}"].bitmap = pbBitmap("Graphics/Transitions/regi")
  1840. fp["#{j}"].src_rect.set(96*(j/7),100*index,96,100)
  1841. fp["#{j}"].ox = fp["#{j}"].src_rect.width/2
  1842. fp["#{j}"].oy = fp["#{j}"].src_rect.height/2
  1843. fp["#{j}"].x = x[index][j%7]
  1844. fp["#{j}"].y = y[index][j%7]
  1845. fp["#{j}"].opacity = 0
  1846. fp["#{j}"].z = 99999
  1847. end
  1848. 8.times do
  1849. fp["back"].opacity += 32
  1850. pbWait(1)
  1851. end
  1852. k = -2
  1853. for i in 0...72
  1854. if index < 3
  1855. k += 2 if i%8==0
  1856. else
  1857. k += (k==3 ? 2 : 1) if i%4==0
  1858. end
  1859. k = 6 if k > 6
  1860. for j in 0..k
  1861. fp["#{j}"].opacity += 32
  1862. fp["#{j+7}"].opacity += 26 if fp["#{j}"].opacity >= 255
  1863. fp["#{j}"].visible = fp["#{j+7}"].opacity < 255
  1864. end
  1865. fp["back"].color.alpha += 2 if fp["back"].color.alpha < 255
  1866. pbWait(1)
  1867. end
  1868. 8.times do
  1869. viewport.color.alpha += 32
  1870. pbWait(1)
  1871. end
  1872. pbDisposeSpriteHash(fp)
  1873. end
  1874.  
  1875. def ebWildAnimationOutdoor(viewport)
  1876. screen=Sprite.new(viewport)
  1877. screen.bitmap=Bitmap.new(viewport.rect.width,viewport.rect.height)
  1878. black=Color.new(0,0,0)
  1879. width=viewport.rect.width/16
  1880. height=viewport.rect.height/4
  1881. for i in 0...16
  1882. if i < 8
  1883. x1=width+(i%8)*(width*2)
  1884. x2=viewport.rect.width-width-(i%8)*(width*2)
  1885. else
  1886. x2=width+(i%8)*(width*2)
  1887. x1=viewport.rect.width-width-(i%8)*(width*2)
  1888. end
  1889. y1=(i/8)*height
  1890. y2=viewport.rect.height-height-y1
  1891. for j in 1...3
  1892. ext=j*(width/2)
  1893. screen.bitmap.fill_rect(x1,y1,ext,height,black)
  1894. screen.bitmap.fill_rect(x1-ext,y1,ext,height,black)
  1895. screen.bitmap.fill_rect(x2,y2,ext,height,black)
  1896. screen.bitmap.fill_rect(x2-ext,y2,ext,height,black)
  1897. pbWait(1)
  1898. end
  1899. end
  1900. viewport.color=Color.new(0,0,0,255)
  1901. screen.dispose
  1902. end
  1903.  
  1904. def ebWildAnimationIndoor(viewport)
  1905. screen=Sprite.new(viewport)
  1906. screen.bitmap=Bitmap.new(viewport.rect.width,viewport.rect.height)
  1907. black=Color.new(0,0,0)
  1908. width=viewport.rect.width
  1909. height=viewport.rect.height/16
  1910. for i in 1...17
  1911. for j in 0...16
  1912. x=(j%2==0) ? 0 : viewport.rect.width-i*(width/16)
  1913. screen.bitmap.fill_rect(x,j*height,i*(width/16),height,black)
  1914. end
  1915. pbWait(1)
  1916. end
  1917. viewport.color=Color.new(0,0,0,255)
  1918. pbWait(10)
  1919. screen.dispose
  1920. end
  1921.  
  1922. def ebWildAnimationCave(viewport)
  1923. screen=Sprite.new(viewport)
  1924. screen.bitmap=Bitmap.new(viewport.rect.width,viewport.rect.height)
  1925. black=Color.new(0,0,0)
  1926. width=viewport.rect.width/4
  1927. height=viewport.rect.height/4
  1928. sprites={}
  1929. for i in 0...16
  1930. sprites["#{i}"]=Sprite.new(viewport)
  1931. sprites["#{i}"].bitmap=Bitmap.new(width,height)
  1932. sprites["#{i}"].bitmap.fill_rect(0,0,width,height,black)
  1933. sprites["#{i}"].ox=width/2
  1934. sprites["#{i}"].oy=height/2
  1935. sprites["#{i}"].x=width/2+width*(i%4)
  1936. sprites["#{i}"].y=viewport.rect.height-height/2-height*(i/4)
  1937. sprites["#{i}"].zoom_x=0
  1938. sprites["#{i}"].zoom_y=0
  1939. end
  1940. seq=[[0],[4,1],[8,5,2],[12,9,6,3],[13,10,7],[14,11],[15]]
  1941. for i in 0...seq.length
  1942. 5.times do
  1943. for j in 0...seq[i].length
  1944. n=seq[i][j]
  1945. sprites["#{n}"].zoom_x+=0.2
  1946. sprites["#{n}"].zoom_y+=0.2
  1947. end
  1948. pbWait(1)
  1949. end
  1950. end
  1951. viewport.color=Color.new(0,0,0,255)
  1952. pbWait(1)
  1953. pbDisposeSpriteHash(sprites)
  1954. screen.dispose
  1955. end
  1956.  
  1957. def ebWildAnimationMinor(viewport,special=false)
  1958. bmp = Graphics.snap_to_bitmap
  1959. max = 50
  1960. amax = 4
  1961. frames = {}
  1962. zoom = 1
  1963. viewport.color = special ? Color.new(64,64,64,0) : Color.new(255,255,155,0)
  1964. 20.times do
  1965. viewport.color.alpha+=2
  1966. pbWait(1)
  1967. end
  1968. for i in 0...(max+20)
  1969. if !(i%2==0)
  1970. if i > max*0.75
  1971. zoom+=0.3
  1972. else
  1973. zoom-=0.01
  1974. end
  1975. angle = 0 if angle.nil?
  1976. angle = (i%3==0) ? rand(amax*2) - amax : angle
  1977. frames["#{i}"] = Sprite.new(viewport)
  1978. frames["#{i}"].bitmap = bmp
  1979. frames["#{i}"].src_rect.set(0,0,viewport.rect.width,viewport.rect.height)
  1980. frames["#{i}"].ox = viewport.rect.width/2
  1981. frames["#{i}"].oy = viewport.rect.height/2
  1982. frames["#{i}"].x = viewport.rect.width/2
  1983. frames["#{i}"].y = viewport.rect.height/2
  1984. frames["#{i}"].angle = angle
  1985. frames["#{i}"].zoom_x = zoom
  1986. frames["#{i}"].zoom_y = zoom
  1987. frames["#{i}"].tone = Tone.new(i/4,i/4,i/4)
  1988. frames["#{i}"].opacity = 30
  1989. end
  1990. if i >= max
  1991. viewport.color.alpha += 12
  1992. if special
  1993. viewport.color.red -= 64/20.0
  1994. viewport.color.green -= 64/20.0
  1995. viewport.color.blue -= 64/20.0
  1996. else
  1997. viewport.color.blue += 5
  1998. end
  1999. end
  2000. pbWait(1)
  2001. end
  2002. frames["#{max+19}"].tone = Tone.new(255,255,255)
  2003. pbWait(10)
  2004. 10.times do
  2005. next if special
  2006. viewport.color.red-=25.5
  2007. viewport.color.green-=25.5
  2008. viewport.color.blue-=25.5
  2009. pbWait(1)
  2010. end
  2011. pbDisposeSpriteHash(frames)
  2012. end
  2013.  
  2014. def ebWildAnimationOverlevel(viewport)
  2015. height = viewport.rect.height/4
  2016. width = viewport.rect.width/10
  2017. backdrop = Sprite.new(viewport)
  2018. backdrop.bitmap = Graphics.snap_to_bitmap
  2019. sprite = Sprite.new(viewport)
  2020. sprite.bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
  2021. for j in 0...4
  2022. y = [0,2,1,3]
  2023. for i in 1..10
  2024. sprite.bitmap.fill_rect(0,height*y[j],width*i,height,Color.new(255,255,255))
  2025. backdrop.tone.red += 3
  2026. backdrop.tone.green += 3
  2027. backdrop.tone.blue += 3
  2028. pbWait(1)
  2029. end
  2030. end
  2031. viewport.color = Color.new(0,0,0,0)
  2032. 10.times do
  2033. viewport.color.alpha += 25.5
  2034. pbWait(1)
  2035. end
  2036. backdrop.dispose
  2037. sprite.dispose
  2038. end
  2039.  
  2040. def ebWildAnimationWater(viewport)
  2041. bmp = Graphics.snap_to_bitmap
  2042. split = 12
  2043. n = viewport.rect.height/split
  2044. sprites = {}
  2045. black = Sprite.new(viewport)
  2046. black.bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
  2047. black.bitmap.fill_rect(0,0,black.bitmap.width,black.bitmap.height,Color.new(0,0,0))
  2048. for i in 0...n
  2049. sprites["#{i}"] = Sprite.new(viewport)
  2050. sprites["#{i}"].bitmap = bmp
  2051. sprites["#{i}"].ox = bmp.width/2
  2052. sprites["#{i}"].x = viewport.rect.width/2
  2053. sprites["#{i}"].y = i*split
  2054. sprites["#{i}"].src_rect.set(0,i*split,bmp.width,split)
  2055. sprites["#{i}"].color = Color.new(0,0,0,0)
  2056. end
  2057. for f in 0...64
  2058. for i in 0...n
  2059. o = Math.sin(f - i*0.5)
  2060. sprites["#{i}"].x = viewport.rect.width/2 + 16*o if f >= i
  2061. sprites["#{i}"].color.alpha += 25.5 if sprites["#{i}"].color.alpha < 255 && f >= (64 - (48-i))
  2062. end
  2063. pbWait(1)
  2064. end
  2065. viewport.color = Color.new(0,0,0,255)
  2066. pbDisposeSpriteHash(sprites)
  2067. end
  2068. #-------------------------------------------------------------------------------
  2069. # VS. animation, by Luka S.J.
  2070. # Tweaked by Maruno.
  2071. # (official Essentials one)
  2072. #-------------------------------------------------------------------------------
  2073. SE_EXTRA_PATH = " "
  2074. def vsSequenceEssentials(viewport,trainername,trainerid,tbargraphic,tgraphic)
  2075. outfit=$Trainer ? $Trainer.outfit : 0
  2076. # Set up
  2077. viewplayer=Viewport.new(0,viewport.rect.height/3,viewport.rect.width/2,128)
  2078. viewplayer.z=viewport.z
  2079. viewopp=Viewport.new(viewport.rect.width/2,viewport.rect.height/3,viewport.rect.width/2,128)
  2080. viewopp.z=viewport.z
  2081. viewvs=Viewport.new(0,0,viewport.rect.width,viewport.rect.height)
  2082. viewvs.z=viewport.z
  2083. xoffset=(viewport.rect.width/2)/10
  2084. xoffset=xoffset.round
  2085. xoffset=xoffset*10
  2086. fade=Sprite.new(viewport)
  2087. fade.bitmap=BitmapCache.load_bitmap("Graphics/Transitions/vsFlash")
  2088. fade.tone=Tone.new(-255,-255,-255)
  2089. fade.opacity=100
  2090. overlay=Sprite.new(viewport)
  2091. overlay.bitmap=Bitmap.new(viewport.rect.width,viewport.rect.height)
  2092. pbSetSystemFont(overlay.bitmap)
  2093. bar1=Sprite.new(viewplayer)
  2094. pbargraphic=sprintf("Graphics/Transitions/vsBar%s_%d",getConstantName(PBTrainers,$Trainer.trainertype),outfit) rescue nil
  2095. pbargraphic=sprintf("Graphics/Transitions/vsBar%d_%d",$Trainer.trainertype,outfit) if !pbResolveBitmap(pbargraphic)
  2096. if !pbResolveBitmap(pbargraphic)
  2097. pbargraphic=sprintf("Graphics/Transitions/vsBar%s",getConstantName(PBTrainers,$Trainer.trainertype)) rescue nil
  2098. end
  2099. pbargraphic=sprintf("Graphics/Transitions/vsBar%d",$Trainer.trainertype) if !pbResolveBitmap(pbargraphic)
  2100. bar1.bitmap=BitmapCache.load_bitmap(pbargraphic)
  2101. bar1.x=-xoffset
  2102. bar2=Sprite.new(viewopp)
  2103. bar2.bitmap=BitmapCache.load_bitmap(tbargraphic)
  2104. bar2.x=xoffset
  2105. vs=Sprite.new(viewvs)
  2106. vs.bitmap=BitmapCache.load_bitmap("Graphics/Transitions/vs")
  2107. vs.ox=vs.bitmap.width/2
  2108. vs.oy=vs.bitmap.height/2
  2109. vs.x=viewport.rect.width/2
  2110. vs.y=viewport.rect.height/1.5
  2111. vs.visible=false
  2112. flash=Sprite.new(viewvs)
  2113. flash.bitmap=BitmapCache.load_bitmap("Graphics/Transitions/vsFlash")
  2114. flash.opacity=0
  2115. # Animation
  2116. 10.times do
  2117. bar1.x+=xoffset/10
  2118. bar2.x-=xoffset/10
  2119. pbWait(1)
  2120. end
  2121. pbSEPlay("#{SE_EXTRA_PATH}Flash2")
  2122. pbSEPlay("#{SE_EXTRA_PATH}Sword2")
  2123. flash.opacity=255
  2124. bar1.dispose
  2125. bar2.dispose
  2126. bar1=AnimatedPlane.new(viewplayer)
  2127. bar1.bitmap=BitmapCache.load_bitmap(pbargraphic)
  2128. player=Sprite.new(viewplayer)
  2129. pgraphic=sprintf("Graphics/Transitions/vsTrainer%s_%d",getConstantName(PBTrainers,$Trainer.trainertype),outfit) rescue nil
  2130. pgraphic=sprintf("Graphics/Transitions/vsTrainer%d_%d",$Trainer.trainertype,outfit) if !pbResolveBitmap(pgraphic)
  2131. if !pbResolveBitmap(pgraphic)
  2132. pgraphic=sprintf("Graphics/Transitions/vsTrainer%s",getConstantName(PBTrainers,$Trainer.trainertype)) rescue nil
  2133. end
  2134. pgraphic=sprintf("Graphics/Transitions/vsTrainer%d",$Trainer.trainertype) if !pbResolveBitmap(pgraphic)
  2135. player.bitmap=BitmapCache.load_bitmap(pgraphic)
  2136. player.x=-xoffset
  2137. bar2=AnimatedPlane.new(viewopp)
  2138. bar2.bitmap=BitmapCache.load_bitmap(tbargraphic)
  2139. trainer=Sprite.new(viewopp)
  2140. trainer.bitmap=BitmapCache.load_bitmap(tgraphic)
  2141. trainer.x=xoffset
  2142. trainer.tone=Tone.new(-255,-255,-255)
  2143. 25.times do
  2144. flash.opacity-=51 if flash.opacity>0
  2145. bar1.ox-=16
  2146. bar2.ox+=16
  2147. pbWait(1)
  2148. end
  2149. 11.times do
  2150. bar1.ox-=16
  2151. bar2.ox+=16
  2152. player.x+=xoffset/10
  2153. trainer.x-=xoffset/10
  2154. pbWait(1)
  2155. end
  2156. 2.times do
  2157. bar1.ox-=16
  2158. bar2.ox+=16
  2159. player.x-=xoffset/20
  2160. trainer.x+=xoffset/20
  2161. pbWait(1)
  2162. end
  2163. 10.times do
  2164. bar1.ox-=16
  2165. bar2.ox+=16
  2166. pbWait(1)
  2167. end
  2168. val=2
  2169. flash.opacity=255
  2170. vs.visible=true
  2171. trainer.tone=Tone.new(0,0,0)
  2172. textpos=[
  2173. [_INTL("{1}",$Trainer.name),viewport.rect.width/4,(viewport.rect.height/1.5)+10,2,
  2174. Color.new(248,248,248),Color.new(12*6,12*6,12*6)],
  2175. [_INTL("{1}",trainername),(viewport.rect.width/4)+(viewport.rect.width/2),(viewport.rect.height/1.5)+10,2,
  2176. Color.new(248,248,248),Color.new(12*6,12*6,12*6)]
  2177. ]
  2178. pbDrawTextPositions(overlay.bitmap,textpos)
  2179. pbSEPlay("#{SE_EXTRA_PATH}Sword2")
  2180. 70.times do
  2181. bar1.ox-=16
  2182. bar2.ox+=16
  2183. flash.opacity-=25.5 if flash.opacity>0
  2184. vs.x+=val
  2185. vs.y-=val
  2186. val=2 if vs.x<=(viewport.rect.width/2)-2
  2187. val=-2 if vs.x>=(viewport.rect.width/2)+2
  2188. pbWait(1)
  2189. end
  2190. 30.times do
  2191. bar1.ox-=16
  2192. bar2.ox+=16
  2193. vs.zoom_x+=0.2
  2194. vs.zoom_y+=0.2
  2195. pbWait(1)
  2196. end
  2197. flash.tone=Tone.new(-255,-255,-255)
  2198. 10.times do
  2199. bar1.ox-=16
  2200. bar2.ox+=16
  2201. flash.opacity+=25.5
  2202. pbWait(1)
  2203. end
  2204. # End
  2205. player.dispose
  2206. trainer.dispose
  2207. flash.dispose
  2208. vs.dispose
  2209. bar1.dispose
  2210. bar2.dispose
  2211. overlay.dispose
  2212. fade.dispose
  2213. viewvs.dispose
  2214. viewopp.dispose
  2215. viewplayer.dispose
  2216. viewport.color=Color.new(0,0,0,255)
  2217. return true
  2218. end
  2219. #-------------------------------------------------------------------------------
  2220. # New EBS VS. animation
  2221. #-------------------------------------------------------------------------------
  2222. def vsSequenceNew(viewport,trainername,trainerid,tbargraphic,tgraphic)
  2223. #------------------
  2224. # sets the face2 graphic to be the shadow instead of larger mug
  2225. showShadow = false
  2226. # decides whether or not to colour the vsLight(s) according to the vsBar
  2227. colorLight = false
  2228. # decides whether or not to return to default white colour
  2229. colorReset = false
  2230. #------------------
  2231. ow = Sprite.new(viewport)
  2232. ow.bitmap = Graphics.snap_to_bitmap
  2233. ow.blur_sprite
  2234. ow.opacity = 0
  2235. ow.tone = Tone.new(-92,-92,-92)
  2236.  
  2237. bmp = pbBitmap("Graphics/Transitions/vsLight3")
  2238. globaly = viewport.rect.height*0.4
  2239.  
  2240. bar = Sprite.new(viewport)
  2241. bar.bitmap = pbBitmap(tbargraphic)
  2242. bar.ox = bar.bitmap.width
  2243. bar.oy = bar.bitmap.height/2
  2244. bar.x = viewport.rect.width*2 + 64
  2245. bar.y = globaly
  2246.  
  2247. color = bar.bitmap.get_pixel(bar.bitmap.width/2,1)
  2248.  
  2249. bbar1 = Sprite.new(viewport)
  2250. bbar1.bitmap = Bitmap.new(viewport.rect.width,2)
  2251. bbar1.bitmap.fill_rect(0,0,viewport.rect.width,2,Color.new(0,0,0))
  2252. bbar1.y = bar.y - bar.oy
  2253. bbar1.zoom_y = 0
  2254. bbar1.z = 99
  2255.  
  2256. bbar2 = Sprite.new(viewport)
  2257. bbar2.bitmap = Bitmap.new(viewport.rect.width,2)
  2258. bbar2.bitmap.fill_rect(0,0,viewport.rect.width,2,Color.new(0,0,0))
  2259. bbar2.oy = 2
  2260. bbar2.y = bar.y + bar.oy + 8
  2261. bbar2.zoom_y = 0
  2262. bbar2.z = 99
  2263.  
  2264. face2 = Sprite.new(viewport)
  2265. face2.bitmap = pbBitmap(tgraphic)
  2266. face2.src_rect.set(0,face2.bitmap.height/4,face2.bitmap.width,face2.bitmap.height/2) if !showShadow
  2267. face2.oy = face2.src_rect.height/2
  2268. face2.y = globaly
  2269. face2.zoom_x = 2 if !showShadow
  2270. face2.zoom_y = 2 if !showShadow
  2271. face2.opacity = showShadow ? 255 : 92
  2272. face2.visible = false
  2273. face2.x = showShadow ? (viewport.rect.width - face2.bitmap.width + 16) : (viewport.rect.width - face2.bitmap.width*2 + 64)
  2274. face2.color = Color.new(0,0,0,255) if showShadow
  2275.  
  2276. light3 = Sprite.new(viewport)
  2277. light3.bitmap = Bitmap.new(bmp.width*2,bmp.height)
  2278. for i in 0...2
  2279. light3.bitmap.blt(bmp.width*i,0,bmp,Rect.new(0,0,bmp.width,bmp.height))
  2280. end
  2281. light3.x = viewport.rect.width
  2282. light3.oy = bmp.height/2
  2283. light3.y = globaly
  2284. light3.color = color if colorLight
  2285.  
  2286. light1 = Sprite.new(viewport)
  2287. light1.bitmap = pbBitmap("Graphics/Transitions/vsLight1")
  2288. light1.ox = light1.bitmap.width/2
  2289. light1.oy = light1.bitmap.height/2
  2290. light1.x = viewport.rect.width*0.25
  2291. light1.y = globaly
  2292. light1.zoom_x = 0
  2293. light1.zoom_y = 0
  2294. light1.color = color if colorLight
  2295.  
  2296. light2 = Sprite.new(viewport)
  2297. light2.bitmap = pbBitmap("Graphics/Transitions/vsLight2")
  2298. light2.ox = light2.bitmap.width/2
  2299. light2.oy = light2.bitmap.height/2
  2300. light2.x = viewport.rect.width*0.25
  2301. light2.y = globaly
  2302. light2.zoom_x = 0
  2303. light2.zoom_y = 0
  2304. light2.color = color if colorLight
  2305.  
  2306. vs = Sprite.new(viewport)
  2307. vs.bitmap = pbBitmap("Graphics/Transitions/vs")
  2308. vs.ox = vs.bitmap.width/2
  2309. vs.oy = vs.bitmap.height/2
  2310. vs.x = viewport.rect.width*0.25
  2311. vs.y = globaly
  2312. vs.opacity = 0
  2313. vs.zoom_x = 4
  2314. vs.zoom_y = 4
  2315.  
  2316. face1 = Sprite.new(viewport)
  2317. face1.bitmap = pbBitmap(tgraphic)
  2318. face1.oy = face1.bitmap.height/2
  2319. face1.y = globaly
  2320. face1.x = viewport.rect.width
  2321. face1.color = Color.new(0,0,0,255)
  2322.  
  2323. name = Sprite.new(viewport)
  2324. name.bitmap = Bitmap.new(viewport.rect.width/2,96)
  2325. pbSetSystemFont(name.bitmap)
  2326. name.ox = name.bitmap.width/2
  2327. name.x = viewport.rect.width*0.75
  2328. name.y = bar.y + bar.oy
  2329. pbDrawTextPositions(name.bitmap,[[trainername,name.bitmap.width/2,4,2,Color.new(255,255,255),nil]])
  2330. name.visible = false
  2331.  
  2332. ripples = Sprite.new(viewport)
  2333. ripples.bitmap = pbBitmap("Graphics/Transitions/ripples")
  2334. ripples.ox = ripples.bitmap.width/2
  2335. ripples.oy = ripples.bitmap.height/2
  2336. ripples.x = vs.x
  2337. ripples.y = globaly
  2338. ripples.opacity = 0
  2339. ripples.z = 99
  2340. ripples.zoom_x = 0.0
  2341. ripples.zoom_y = 0.0
  2342.  
  2343. 8.times do
  2344. light1.zoom_x+=1.0/16
  2345. light1.zoom_y+=1.0/16
  2346. light2.zoom_x+=1.0/8
  2347. light2.zoom_y+=1.0/8
  2348. light1.angle-=32
  2349. light2.angle+=64
  2350. light3.x-=64
  2351. ow.opacity+=12.8
  2352. pbWait(1)
  2353. end
  2354. n = false
  2355. k = false
  2356. max = 224
  2357. for i in 0...max
  2358. n = !n if i%8==0
  2359. k = !k if i%4==0
  2360. ow.opacity+=12.8 if ow.opacity < 255
  2361. light1.zoom_x+=(n ? 1.0/16 : -1.0/16)
  2362. light1.zoom_y+=(n ? 1.0/16 : -1.0/16)
  2363. light1.angle-=16
  2364. light2.angle+=32
  2365. light3.x-=32
  2366. light3.x = 0 if light3.x <= -light3.bitmap.width/2
  2367. if i >= 32 && i < 41
  2368. bar.x-=64
  2369. pbSEPlay("#{SE_EXTRA_PATH}Ice8",80) if i==32
  2370. end
  2371. if i >= 32
  2372. face1.x-=(face1.x-viewport.rect.width/2)*0.1
  2373. end
  2374. viewport.color.alpha-=255/20.0 if viewport.color.alpha > 0
  2375. face2.x -= (showShadow ? -1 : 1) if i%(showShadow ? 4 : 2)==0 && face2.visible
  2376. vs.x+=(k ? 2 : -2)/2 if i >= 72
  2377. vs.y-=(k ? 2 : -2)/2 if i >= 72
  2378. ripples.opacity-=12.8 if ripples.opacity > 0
  2379. ripples.zoom_x+=0.2 if ripples.opacity > 0
  2380. ripples.zoom_y+=0.2 if ripples.opacity > 0
  2381. if i > 62
  2382. vs.opacity+=25.5 if vs.opacity < 255
  2383. vs.zoom_x-=0.2 if vs.zoom_x > 1
  2384. vs.zoom_y-=0.2 if vs.zoom_y > 1
  2385. end
  2386. if i==72
  2387. viewport.color = Color.new(255,255,255,255)
  2388. ow.color = Color.new(0,0,0,255)
  2389. face2.visible = true
  2390. face1.color = Color.new(0,0,0,0)
  2391. name.visible = true
  2392. ripples.opacity = 255
  2393. pbSEPlay("#{SE_EXTRA_PATH}Saint9",50)
  2394. pbSEPlay("#{SE_EXTRA_PATH}Flash2",50)
  2395. if colorReset
  2396. light1.color = Color.new(0,0,0,0)
  2397. light2.color = Color.new(0,0,0,0)
  2398. light3.color = Color.new(0,0,0,0)
  2399. end
  2400. end
  2401. if i >= max-8
  2402. bbar1.zoom_y+=8
  2403. bbar2.zoom_y+=8
  2404. name.opacity-=255/4.0
  2405. end
  2406. pbWait(1)
  2407. end
  2408. viewport.color = Color.new(0,0,0,255)
  2409. ow.dispose
  2410. bar.dispose
  2411. bbar1.dispose
  2412. bbar2.dispose
  2413. face1.dispose
  2414. face2.dispose
  2415. light1.dispose
  2416. light2.dispose
  2417. light3.dispose
  2418. ripples.dispose
  2419. vs.dispose
  2420. return true
  2421. end
  2422. #-------------------------------------------------------------------------------
  2423. # Elite Four EBS VS. animation
  2424. #-------------------------------------------------------------------------------
  2425. def vsSequenceElite(viewport,trainername,trainerid,tbargraphic,tgraphic)
  2426. ow = Sprite.new(viewport)
  2427. ow.bitmap = Graphics.snap_to_bitmap
  2428. ow.blur_sprite
  2429. ow.opacity = 0
  2430. ow.tone = Tone.new(-92,-92,-92)
  2431.  
  2432. effect1 = Sprite.new(viewport)
  2433. effect1.bitmap = pbBitmap("Graphics/Transitions/vsBg")
  2434. effect1.ox = effect1.bitmap.width/2
  2435. effect1.x = viewport.rect.width/2
  2436. effect1.oy = effect1.bitmap.height/2
  2437. effect1.y = viewport.rect.height/2
  2438. effect1.visible = false
  2439.  
  2440. names = Sprite.new(viewport)
  2441. names.bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
  2442. names.z = 999
  2443. pbSetSystemFont(names.bitmap)
  2444. txt = [
  2445. [trainername,viewport.rect.width*0.25,viewport.rect.height*0.25+32,2,Color.new(255,255,255),Color.new(32,32,32)],
  2446. [$Trainer.name,viewport.rect.width*0.75,viewport.rect.height*0.75+32,2,Color.new(255,255,255),Color.new(32,32,32)]
  2447. ]
  2448. pbDrawTextPositions(names.bitmap,txt)
  2449. names.visible = false
  2450.  
  2451. bmp = pbBitmap("Graphics/Transitions/vsLight3")
  2452.  
  2453. bar1 = Sprite.new(viewport)
  2454. bar1.bitmap = pbBitmap(tbargraphic)
  2455. bar1.oy = bar1.bitmap.height/2
  2456. bar1.y = viewport.rect.height*0.25
  2457. bar1.x = viewport.rect.width
  2458.  
  2459. light1 = Sprite.new(viewport)
  2460. light1.bitmap = Bitmap.new(bmp.width*2,bmp.height)
  2461. for i in 0...2
  2462. light1.bitmap.blt(bmp.width*i,0,bmp,Rect.new(0,0,bmp.width,bmp.height))
  2463. end
  2464. light1.x = viewport.rect.width
  2465. light1.oy = bmp.height/2
  2466. light1.y = viewport.rect.height*0.25
  2467.  
  2468. shadow1 = Sprite.new(viewport)
  2469. shadow1.bitmap = pbBitmap(tgraphic)
  2470. shadow1.oy = shadow1.bitmap.height/2
  2471. shadow1.y = viewport.rect.height*0.25
  2472. shadow1.x = viewport.rect.width/2 - 16
  2473. shadow1.color = Color.new(0,0,0,255)
  2474. shadow1.opacity = 96
  2475. shadow1.visible = false
  2476.  
  2477. face1 = Sprite.new(viewport)
  2478. face1.bitmap = pbBitmap(tgraphic)
  2479. face1.oy = face1.bitmap.height/2
  2480. face1.y = viewport.rect.height*0.25
  2481. face1.x = viewport.rect.width
  2482. face1.color = Color.new(0,0,0,255)
  2483.  
  2484. #-------------------
  2485. outfit=$Trainer ? $Trainer.outfit : 0
  2486. pbargraphic=sprintf("Graphics/Transitions/vsBarElite%s_%d",getConstantName(PBTrainers,$Trainer.trainertype),outfit) rescue nil
  2487. pbargraphic=sprintf("Graphics/Transitions/vsBarElite%d_%d",$Trainer.trainertype,outfit) if !pbResolveBitmap(pbargraphic)
  2488. if !pbResolveBitmap(pbargraphic)
  2489. pbargraphic=sprintf("Graphics/Transitions/vsBarElite%s",getConstantName(PBTrainers,$Trainer.trainertype)) rescue nil
  2490. end
  2491. pbargraphic=sprintf("Graphics/Transitions/vsBarElite%d",$Trainer.trainertype) if !pbResolveBitmap(pbargraphic)
  2492. pgraphic=sprintf("Graphics/Transitions/vsTrainer%s_%d",getConstantName(PBTrainers,$Trainer.trainertype),outfit) rescue nil
  2493. pgraphic=sprintf("Graphics/Transitions/vsTrainer%d_%d",$Trainer.trainertype,outfit) if !pbResolveBitmap(pgraphic)
  2494. if !pbResolveBitmap(pgraphic)
  2495. pgraphic=sprintf("Graphics/Transitions/vsTrainer%s",getConstantName(PBTrainers,$Trainer.trainertype)) rescue nil
  2496. end
  2497. pgraphic=sprintf("Graphics/Transitions/vsTrainer%d",$Trainer.trainertype) if !pbResolveBitmap(pgraphic)
  2498. #-------------------
  2499.  
  2500. bar2 = Sprite.new(viewport)
  2501. bar2.bitmap = pbBitmap(pbargraphic)
  2502. bar2.oy = bar2.bitmap.height/2
  2503. bar2.y = viewport.rect.height*0.75
  2504. bar2.x = -bar2.bitmap.width
  2505.  
  2506. light2 = Sprite.new(viewport)
  2507. light2.bitmap = light1.bitmap.clone
  2508. light2.mirror = true
  2509. light2.x = -light2.bitmap.width
  2510. light2.oy = bmp.height/2
  2511. light2.y = viewport.rect.height*0.75
  2512.  
  2513. shadow2 = Sprite.new(viewport)
  2514. shadow2.bitmap = pbBitmap(pgraphic)
  2515. shadow2.oy = shadow2.bitmap.height/2
  2516. shadow2.y = viewport.rect.height*0.75
  2517. shadow2.x = 16
  2518. shadow2.color = Color.new(0,0,0,255)
  2519. shadow2.opacity = 96
  2520. shadow2.visible = false
  2521.  
  2522. face2 = Sprite.new(viewport)
  2523. face2.bitmap = pbBitmap(pgraphic)
  2524. face2.oy = face2.bitmap.height/2
  2525. face2.y = viewport.rect.height*0.75
  2526. face2.x = -face2.bitmap.width
  2527. face2.color = Color.new(0,0,0,255)
  2528.  
  2529. ripples = Sprite.new(viewport)
  2530. ripples.bitmap = pbBitmap("Graphics/Transitions/ripples")
  2531. ripples.ox = ripples.bitmap.width/2
  2532. ripples.oy = ripples.bitmap.height/2
  2533. ripples.x = viewport.rect.width/2
  2534. ripples.y = viewport.rect.height/2
  2535. ripples.opacity = 0
  2536. ripples.zoom_x = 0.0
  2537. ripples.zoom_y = 0.0
  2538. ripples.z = 999
  2539.  
  2540. vs = Sprite.new(viewport)
  2541. vs.bitmap = pbBitmap("Graphics/Transitions/vs")
  2542. vs.ox = vs.bitmap.width/2
  2543. vs.oy = vs.bitmap.height/2
  2544. vs.x = viewport.rect.width/2
  2545. vs.y = viewport.rect.height/2
  2546. vs.opacity = 0
  2547. vs.zoom_x = 4
  2548. vs.zoom_y = 4
  2549. vs.z = 999
  2550.  
  2551. max = 224
  2552. k = false
  2553. for i in 0...max
  2554. k = !k if i%4==0
  2555. viewport.color.alpha-=255/16.0 if viewport.color.alpha > 0
  2556. ow.opacity+=12.8 if ow.opacity < 255
  2557. light1.x-=(light1.x > 0) ? 64 : 32
  2558. light1.x = 0 if light1.x <= -light1.bitmap.width/2
  2559. bar1.x-=(bar1.x)*0.2 if i >= 32
  2560.  
  2561. face1.x-=(face1.x-viewport.rect.width/2)*0.1 if i >= 16
  2562. face2.x+=(0-face2.x)*0.1 if i >= 16
  2563.  
  2564. light2.x+=(light2.x < -light2.bitmap.width/2) ? 64 : 32
  2565. light2.x = -light2.bitmap.width/2 if light2.x >= 0
  2566. bar2.x+=(0-bar2.x)*0.2 if i >= 32
  2567.  
  2568. effect1.angle+=2 if $PokemonSystem.screensize < 2
  2569. vs.x+=(k ? 2 : -2)/2 if i >= 72
  2570. vs.y-=(k ? 2 : -2)/2 if i >= 72
  2571. ripples.opacity-=12.8 if ripples.opacity > 0
  2572. ripples.zoom_x+=0.2 if ripples.opacity > 0
  2573. ripples.zoom_y+=0.2 if ripples.opacity > 0
  2574. if i%4 == 0
  2575. shadow1.x-=1
  2576. shadow2.x+=1
  2577. end
  2578. if i > 62 && i < max-16
  2579. vs.opacity+=25.5 if vs.opacity < 255
  2580. vs.zoom_x-=0.2 if vs.zoom_x > 1
  2581. vs.zoom_y-=0.2 if vs.zoom_y > 1
  2582. end
  2583. if i == 72
  2584. face1.color = Color.new(0,0,0,0)
  2585. face2.color = Color.new(0,0,0,0)
  2586. viewport.color = Color.new(255,255,255,255)
  2587. ow.color = Color.new(0,0,0,255)
  2588. effect1.visible = true
  2589. ripples.opacity = 255
  2590. names.visible = true
  2591. shadow1.visible = true
  2592. shadow2.visible = true
  2593. pbSEPlay("#{SE_EXTRA_PATH}Saint9",50)
  2594. pbSEPlay("#{SE_EXTRA_PATH}Flash2",50)
  2595. end
  2596. viewport.color = Color.new(0,0,0,0) if i == max-17
  2597. if i >= max-16
  2598. vs.zoom_x+=0.2
  2599. vs.zoom_y+=0.2
  2600. viewport.color.alpha+=255/8.0
  2601. end
  2602.  
  2603. pbWait(1)
  2604. end
  2605. viewport.color = Color.new(0,0,0,255)
  2606. ow.dispose
  2607. effect1.dispose
  2608. bar1.dispose
  2609. bar2.dispose
  2610. light1.dispose
  2611. light2.dispose
  2612. face1.dispose
  2613. face2.dispose
  2614. shadow1.dispose
  2615. shadow2.dispose
  2616. names.dispose
  2617. vs.dispose
  2618. ripples.dispose
  2619. return true
  2620. end
  2621. #-------------------------------------------------------------------------------
  2622. # Special EBS VS. animation
  2623. #-------------------------------------------------------------------------------
  2624. def vsSequenceSpecial(viewport,trainername,trainerid,tbargraphic,tgraphic)
  2625. ow = Sprite.new(viewport)
  2626. ow.bitmap = Graphics.snap_to_bitmap
  2627. ow.blur_sprite
  2628. ow.opacity = 0
  2629.  
  2630. bg = Sprite.new(viewport)
  2631. bg.visible = false
  2632.  
  2633. light = AnimatedPlane.new(viewport)
  2634. light.bitmap = pbBitmap("Graphics/Transitions/vsSpecialLight")
  2635. light.opacity = 0
  2636.  
  2637. vss = Sprite.new(viewport)
  2638. vss.bitmap = pbBitmap("Graphics/Transitions/vs")
  2639. vss.color = Color.new(0,0,0,255)
  2640. vss.ox = vss.bitmap.width/2
  2641. vss.oy = vss.bitmap.height/2
  2642. vss.x = 110 + 16
  2643. vss.y = 132 + 16
  2644. vss.opacity = 128
  2645. vss.visible = false
  2646.  
  2647. vs = Sprite.new(viewport)
  2648. vs.bitmap = pbBitmap("Graphics/Transitions/vs")
  2649. vs.ox = vs.bitmap.width/2
  2650. vs.oy = vs.bitmap.height/2
  2651. vs.x = 110
  2652. vs.y = 132
  2653. vs.visible = false
  2654.  
  2655. names = Sprite.new(viewport)
  2656. names.x = 6
  2657. names.y = 4
  2658. names.opacity = 128
  2659. names.color = Color.new(0,0,0,255)
  2660. names.visible = false
  2661.  
  2662. name = Sprite.new(viewport)
  2663. name.bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
  2664. name.bitmap.font.name = "Arial"
  2665. name.bitmap.font.size = 48
  2666. name.visible = false
  2667. pbDrawOutlineText(name.bitmap,64,viewport.rect.height-160,-1,-1,"#{trainername}",Color.new(255,255,255),Color.new(0,0,0),2)
  2668. names.bitmap = name.bitmap.clone
  2669.  
  2670. border1 = Sprite.new(viewport)
  2671. border1.bitmap = pbBitmap("Graphics/Transitions/vsBorder")
  2672. border1.zoom_x = 1.2
  2673. border1.y = -border1.bitmap.height
  2674. border1.z = 99
  2675.  
  2676. border2 = Sprite.new(viewport)
  2677. border2.bitmap = pbBitmap("Graphics/Transitions/vsBorder")
  2678. border2.zoom_x = 1.2
  2679. border2.x = viewport.rect.width
  2680. border2.angle = 180
  2681. border2.y = viewport.rect.height+border2.bitmap.height
  2682. border2.z = 99
  2683.  
  2684. trainer = Sprite.new(viewport)
  2685. trainer.bitmap = pbBitmap(tgraphic)
  2686. trainer.x = 0
  2687. trainer.ox = trainer.bitmap.width
  2688. trainer.z = 100
  2689. trainer.color = Color.new(0,0,0,255)
  2690.  
  2691. shadow = Sprite.new(viewport)
  2692. shadow.bitmap = pbBitmap(tgraphic)
  2693. shadow.x = viewport.rect.width + 22
  2694. shadow.ox = shadow.bitmap.width
  2695. shadow.y = 22
  2696. shadow.color = Color.new(0,0,0,255)
  2697. shadow.opacity = 128
  2698. shadow.visible = false
  2699.  
  2700. if pbResolveBitmap(tbargraphic)
  2701. bg.bitmap = pbBitmap(tbargraphic)
  2702. else
  2703. bg.bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
  2704. color = trainer.getAvgColor
  2705. avg = ((color.red+color.green+color.blue)/3)-120
  2706. color = Color.new(color.red-avg,color.green-avg,color.blue-avg)
  2707. bg.bitmap.fill_rect(0,0,viewport.rect.width,viewport.rect.height,color)
  2708. end
  2709.  
  2710. y1 = border1.y.to_f
  2711. y2 = border2.y.to_f
  2712. 30.times do
  2713. ow.opacity += 12.8
  2714. y1 += ((70-border1.bitmap.height)-y1)*0.2
  2715. border1.y = y1
  2716. y2 -= (y2-(viewport.rect.height+border2.bitmap.height-70))*0.2
  2717. border2.y = y2
  2718. light.opacity+=12.8
  2719. light.ox += 24
  2720. pbWait(1)
  2721. end
  2722. 40.times do
  2723. trainer.x += ((viewport.rect.width)-trainer.x)*0.2
  2724. light.ox += 24
  2725. pbWait(1)
  2726. end
  2727.  
  2728. viewport.tone = Tone.new(255,255,255)
  2729. bg.visible = true
  2730. shadow.visible = true
  2731. vs.visible = true
  2732. vss.visible = true
  2733. name.visible = true
  2734. names.visible = true
  2735. trainer.color = Color.new(0,0,0,0)
  2736.  
  2737. p = 1
  2738. 20.times do
  2739. viewport.tone.red -= 255/20.0
  2740. viewport.tone.green -= 255/20.0
  2741. viewport.tone.blue -= 255/20.0
  2742. light.ox += 24
  2743. vs.x += p; vs.y -= p
  2744. p = -1 if vs.x >= 112
  2745. p = +1 if vs.x <= 108
  2746. vss.x = vs.x + 16; vss.y = vs.y + 16
  2747. pbWait(1)
  2748. end
  2749. 120.times do
  2750. light.ox += 24
  2751. vs.x += p; vs.y -= p
  2752. p = -1 if vs.x >= 112
  2753. p = +1 if vs.x <= 108
  2754. vss.x = vs.x + 16; vss.y = vs.y + 16
  2755. pbWait(1)
  2756. end
  2757. y1 = border1.y.to_f
  2758. y2 = border2.y.to_f
  2759. 6.times do
  2760. trainer.x -= 1
  2761. shadow.x = trainer.x + 22
  2762. light.ox += 24
  2763. vs.x += p; vs.y -= p
  2764. p = -1 if vs.x >= 112
  2765. p = +1 if vs.x <= 108
  2766. vss.x = vs.x + 16; vss.y = vs.y + 16
  2767. pbWait(1)
  2768. end
  2769. 30.times do
  2770. trainer.x += ((viewport.rect.width*2)-trainer.x)*0.2
  2771. shadow.x = trainer.x + 22
  2772. y1 += ((0)-y1)*0.2
  2773. border1.y = y1
  2774. y2 -= (y2-(viewport.rect.height))*0.2
  2775. border2.y = y2
  2776. light.ox += 24
  2777. vs.x += p; vs.y -= p
  2778. p = -1 if vs.x >= 112
  2779. p = +1 if vs.x <= 108
  2780. vss.x = vs.x + 16; vss.y = vs.y + 16
  2781. pbWait(1)
  2782. end
  2783. ow.dispose
  2784. bg.dispose
  2785. vs.dispose
  2786. vss.dispose
  2787. name.dispose
  2788. names.dispose
  2789. trainer.dispose
  2790. shadow.dispose
  2791. light.dispose
  2792. viewport.color=Color.new(0,0,0,255)
  2793. return true
  2794. end
  2795. #-------------------------------------------------------------------------------
  2796. # Sun & Moon VS animation logic
  2797. #-------------------------------------------------------------------------------
  2798. # used to play that little "rainbow" zoom before the battle starts
  2799. def smPreBattle(viewport)
  2800. bmp = Graphics.snap_to_bitmap
  2801. fp = {}
  2802. fp["bg1"] = Sprite.new(viewport)
  2803. fp["bg1"].bitmap = bmp
  2804. fp["bg1"].ox = bmp.width/2
  2805. fp["bg1"].oy = bmp.height/2
  2806. fp["bg1"].x = viewport.rect.width/2
  2807. fp["bg1"].y = viewport.rect.height/2
  2808. fp["bg2"] = Sprite.new(viewport)
  2809. fp["bg2"].bitmap = bmp
  2810. fp["bg2"].blur_sprite(3)
  2811. fp["bg2"].ox = bmp.width/2
  2812. fp["bg2"].oy = bmp.height/2
  2813. fp["bg2"].x = viewport.rect.width/2
  2814. fp["bg2"].y = viewport.rect.height/2
  2815. fp["bg2"].opacity = 0
  2816.  
  2817. fp["glow1"] = Sprite.new(viewport)
  2818. fp["glow1"].bitmap = pbBitmap("Graphics/Transitions/smGlow1")
  2819. fp["glow1"].ox = fp["glow1"].bitmap.width/2
  2820. fp["glow1"].oy = fp["glow1"].bitmap.height/2
  2821. fp["glow1"].x = viewport.rect.width/2
  2822. fp["glow1"].y = viewport.rect.height/2
  2823. fp["glow1"].zoom_x = 0.35
  2824. fp["glow1"].zoom_y = 0.35
  2825. fp["glow1"].opacity = 0
  2826. fp["glow2"] = Sprite.new(viewport)
  2827. fp["glow2"].bitmap = pbBitmap("Graphics/Transitions/smGlow1")
  2828. fp["glow2"].ox = fp["glow1"].bitmap.width/2
  2829. fp["glow2"].oy = fp["glow1"].bitmap.height/2
  2830. fp["glow2"].x = viewport.rect.width/2
  2831. fp["glow2"].y = viewport.rect.height/2
  2832. fp["glow2"].zoom_x = 0.1
  2833. fp["glow2"].zoom_y = 0.1
  2834. fp["glow2"].opacity = 0
  2835. for i in 0...32
  2836. fp["bg1"].zoom_x += 0.02
  2837. fp["bg1"].zoom_y += 0.02
  2838. fp["bg2"].zoom_x += 0.02
  2839. fp["bg2"].zoom_y += 0.02
  2840. fp["bg2"].opacity += 12
  2841. if i >= 16
  2842. fp["bg2"].tone.red += 16
  2843. fp["bg2"].tone.green += 16
  2844. fp["bg2"].tone.blue += 16
  2845. end
  2846. if i >= 28
  2847. fp["glow1"].opacity += 64
  2848. fp["glow1"].zoom_x += 0.02
  2849. fp["glow1"].zoom_y += 0.02
  2850. end
  2851. Graphics.update
  2852. end
  2853. for i in 0...52
  2854. fp["glow1"].zoom_x += 0.02
  2855. fp["glow1"].zoom_y += 0.02
  2856. if i >= 8
  2857. fp["glow2"].opacity += 64
  2858. fp["glow2"].zoom_x += 0.02
  2859. fp["glow2"].zoom_y += 0.02
  2860. end
  2861. if i >= 36
  2862. viewport.color.alpha += 16
  2863. end
  2864. Graphics.update
  2865. end
  2866. pbDisposeSpriteHash(fp)
  2867. end
  2868. # handler for the different Sun/Moon transitions
  2869. class PokeBattle_Scene
  2870. attr_accessor :sequenceType
  2871. def startSMSequence(viewport,trainerid)
  2872. @vs = {}
  2873. return crazySequence_start(viewport,trainerid) if pbResolveBitmap(sprintf("Graphics/Transitions/smCrazy%d",trainerid))
  2874. return vsSequenceSM_start(viewport,trainerid)
  2875. end
  2876.  
  2877. def updateSMSequence
  2878. return crazySequence_update if sequenceType == 1
  2879. return vsSequenceSM_update
  2880. end
  2881.  
  2882. def endSMSequence
  2883. return crazySequence_end if sequenceType == 1
  2884. return vsSequenceSM_end
  2885. end
  2886.  
  2887. def sendoutSMSequence
  2888. $smAnim = false
  2889. return crazySequence_sendout if sequenceType == 1
  2890. return vsSequenceSM_sendout
  2891. end
  2892. end
  2893. #-------------------------------------------------------------------------------
  2894. # Classic Sun Moon VS sequences
  2895. #-------------------------------------------------------------------------------
  2896. class PokeBattle_Scene
  2897. # actual Sun/Moon intro sequence gets handled here
  2898. def vsSequenceSM_start(viewport,trainerid)
  2899. # checks for variants of the sequel
  2900. @smSpecial = pbResolveBitmap(sprintf("Graphics/Transitions/smSpecial%d",trainerid))
  2901. @smElite = pbResolveBitmap(sprintf("Graphics/Transitions/smElite%d",trainerid))
  2902. @smSpecial = false if @smElite
  2903. # checks if trainer belongs to the evil team
  2904. evil = false
  2905. for val in EVIL_TEAM_LIST
  2906. if val.is_a?(Numeric)
  2907. id = val
  2908. elsif val.is_a?(Symbol)
  2909. id = getConst(PBTrainers,val)
  2910. end
  2911. evil = true if !id.nil? && trainerid == id
  2912. end
  2913. # sets the color to white
  2914. viewport.color = Color.new(255,255,255) if !evil
  2915.  
  2916. bgstring = "Graphics/Transitions/smBg#{trainerid}"
  2917. bgstring2 = "Graphics/Transitions/smBgNext#{trainerid}"
  2918. bgstring3 = "Graphics/Transitions/smBgLast#{trainerid}"
  2919.  
  2920. if @smElite
  2921. # Elite4 variant
  2922. @vs["bg"] = Sprite.new(viewport)
  2923. str = sprintf("Graphics/Transitions/smEffBg%d",trainerid)
  2924. str = "Graphics/Transitions/smEffBg" if !pbResolveBitmap(str)
  2925. @vs["bg"].bitmap = pbBitmap(str)
  2926. else
  2927. # Regular and special animations
  2928. @vs["bg"] = @smSpecial ? RainbowSprite.new(viewport) : ScrollingSprite.new(viewport)
  2929. @vs["bg"].setBitmap("Graphics/Transitions/smBgDefault")
  2930. @vs["bg"].setBitmap("Graphics/Transitions/smBgEvil") if evil
  2931. @vs["bg"].setBitmap(bgstring) if pbResolveBitmap(bgstring)
  2932. @vs["bg"].setBitmap("Graphics/Transitions/smBgSpecial") if @smSpecial
  2933. end
  2934. @vs["bg"].color = Color.new(0,0,0,255)
  2935. @vs["bg"].speed = @smSpecial ? 4 : 32 if !@smElite
  2936. @vs["bg"].ox = @vs["bg"].src_rect.width/2
  2937. @vs["bg"].oy = @vs["bg"].src_rect.height/2
  2938. @vs["bg"].x = viewport.rect.width/2
  2939. @vs["bg"].y = viewport.rect.height/2
  2940. @vs["bg"].angle = - 8 if !@smSpecial && !@smElite && $PokemonSystem.screensize < 2
  2941. @vs["bg"].z = 200
  2942. if !@smSpecial && !@smElite
  2943. # loads the rest of the scrolling panorama
  2944. @vs["bg2"] = ScrollingSprite.new(viewport)
  2945. @vs["bg2"].setBitmap("Graphics/Transitions/smBgLastDefault",false,true)
  2946. @vs["bg2"].setBitmap("Graphics/Transitions/smBgLastEvil",false,true) if evil
  2947. @vs["bg2"].setBitmap(bgstring3,false,true) if pbResolveBitmap(bgstring3)
  2948. @vs["bg2"].color = Color.new(0,0,0,255)
  2949. @vs["bg2"].speed = 64
  2950. @vs["bg2"].ox = @vs["bg2"].src_rect.width/2
  2951. @vs["bg2"].oy = @vs["bg2"].src_rect.height/2
  2952. @vs["bg2"].x = viewport.rect.width/2
  2953. @vs["bg2"].y = viewport.rect.height/2
  2954. @vs["bg2"].angle = - 8 if $PokemonSystem.screensize < 2
  2955. @vs["bg2"].z = 200
  2956. @vs["bg3"] = ScrollingSprite.new(viewport)
  2957. @vs["bg3"].setBitmap("Graphics/Transitions/smBgNextDefault",false,true)
  2958. @vs["bg3"].setBitmap("Graphics/Transitions/smBgNextEvil",false,true) if evil
  2959. @vs["bg3"].setBitmap(bgstring2,false,true) if pbResolveBitmap(bgstring2)
  2960. @vs["bg3"].color = Color.new(0,0,0,255)
  2961. @vs["bg3"].speed = 80
  2962. @vs["bg3"].ox = @vs["bg3"].src_rect.width/2
  2963. @vs["bg3"].oy = @vs["bg3"].src_rect.height/2
  2964. @vs["bg3"].x = viewport.rect.width/2
  2965. @vs["bg3"].y = viewport.rect.height/2
  2966. @vs["bg3"].angle = - 8 if $PokemonSystem.screensize < 2
  2967. @vs["bg3"].z = 200
  2968. end
  2969.  
  2970. @vsFp = {}
  2971. @fpDx = []
  2972. @fpDy = []
  2973. @fpIndex = 0
  2974. if @smSpecial
  2975. # loads particles for special variant
  2976. @vsFp["ring"] = Sprite.new(viewport)
  2977. @vsFp["ring"].bitmap = pbBitmap("Graphics/Transitions/smRing")
  2978. @vsFp["ring"].ox = @vsFp["ring"].bitmap.width/2
  2979. @vsFp["ring"].oy = @vsFp["ring"].bitmap.height/2
  2980. @vsFp["ring"].x = viewport.rect.width/2
  2981. @vsFp["ring"].y = viewport.rect.height
  2982. @vsFp["ring"].zoom_x = 0
  2983. @vsFp["ring"].zoom_y = 0
  2984. @vsFp["ring"].z = 500
  2985.  
  2986. for j in 0...32
  2987. @vsFp["s#{j}"] = Sprite.new(viewport)
  2988. @vsFp["s#{j}"].bitmap = pbBitmap("Graphics/Transitions/smSpec")
  2989. @vsFp["s#{j}"].ox = @vsFp["s#{j}"].bitmap.width/2
  2990. @vsFp["s#{j}"].oy = @vsFp["s#{j}"].bitmap.height/2
  2991. @vsFp["s#{j}"].opacity = 0
  2992. @vsFp["s#{j}"].z = 220
  2993. @fpDx.push(0)
  2994. @fpDy.push(0)
  2995. end
  2996.  
  2997. @fpSpeed = []
  2998. @fpOpac = []
  2999. for j in 0...3
  3000. k = j+1
  3001. speed = 2 + rand(5)
  3002. @vsFp["p#{j}"] = ScrollingSprite.new(viewport)
  3003. @vsFp["p#{j}"].setBitmap("Graphics/Transitions/smSpecEff#{k}")
  3004. @vsFp["p#{j}"].speed = speed*4
  3005. @vsFp["p#{j}"].direction = -1
  3006. @vsFp["p#{j}"].opacity = 0
  3007. @vsFp["p#{j}"].z = 400
  3008. @vsFp["p#{j}"].zoom_y = 1 + rand(10)*0.005
  3009. @fpSpeed.push(speed)
  3010. @fpOpac.push(4) if j > 0
  3011. end
  3012. end
  3013.  
  3014. if @smElite
  3015. # loads particles for Elite4 variant
  3016. for j in 0...16
  3017. @vsFp["e#{j}"] = Sprite.new(viewport)
  3018. bmp = pbBitmap("Graphics/Transitions/smEff1")
  3019. @vsFp["e#{j}"].bitmap = Bitmap.new(bmp.width,bmp.height)
  3020. w = bmp.width/(1 + rand(3))
  3021. @vsFp["e#{j}"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))
  3022. @vsFp["e#{j}"].oy = @vsFp["e#{j}"].bitmap.height/2
  3023. @vsFp["e#{j}"].angle = rand(360)
  3024. @vsFp["e#{j}"].opacity = 0
  3025. @vsFp["e#{j}"].x = viewport.rect.width/2
  3026. @vsFp["e#{j}"].y = viewport.rect.height/2
  3027. @vsFp["e#{j}"].speed = (4 + rand(5))
  3028. @vsFp["e#{j}"].z = 220
  3029. end
  3030. for j in 0...3
  3031. @vsFp["ec#{j}"] = Sprite.new(viewport)
  3032. @vsFp["ec#{j}"].bitmap = pbBitmap("Graphics/Transitions/smEff2")
  3033. @vsFp["ec#{j}"].ox = @vsFp["ec#{j}"].bitmap.width/2
  3034. @vsFp["ec#{j}"].oy = @vsFp["ec#{j}"].bitmap.height/2
  3035. @vsFp["ec#{j}"].x = viewport.rect.width/2
  3036. @vsFp["ec#{j}"].y = viewport.rect.height/2
  3037. @vsFp["ec#{j}"].zoom_x = 1.5
  3038. @vsFp["ec#{j}"].zoom_y = 1.5
  3039. @vsFp["ec#{j}"].opacity = 0
  3040. @vsFp["ec#{j}"].z = 220
  3041. end
  3042. @vs["bg2"] = Sprite.new(viewport)
  3043. @vs["bg2"].bitmap = pbBitmap("Graphics/Transitions/smEff3")
  3044. @vs["bg2"].ox = @vs["bg2"].src_rect.width/2
  3045. @vs["bg2"].oy = @vs["bg2"].src_rect.height/2
  3046. @vs["bg2"].x = viewport.rect.width/2
  3047. @vs["bg2"].y = viewport.rect.height/2
  3048. @vs["bg2"].opacity = 0
  3049. @vs["bg2"].z = 200
  3050. end
  3051.  
  3052. # trainer and trainer effect graphics
  3053. @vs["shade"] = Sprite.new(viewport)
  3054. @vs["shade"].z = 250
  3055. @vs["glow"] = Sprite.new(viewport)
  3056. @vs["glow"].y = viewport.rect.height
  3057. @vs["glow"].z = 250
  3058. @vs["glow2"] = Sprite.new(viewport)
  3059. @vs["glow2"].x = viewport.rect.width/2
  3060. @vs["glow2"].z = 250
  3061.  
  3062. @vs["trainer"] = Sprite.new(viewport)
  3063. @vs["trainer"].z = 350
  3064. @vs["trainer"].bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
  3065. @vs["trainer"].ox = @vs["trainer"].bitmap.width/2
  3066. @vs["trainer"].oy = @vs["trainer"].bitmap.height/2
  3067. @vs["trainer"].x = @vs["trainer"].ox
  3068. @vs["trainer"].y = @vs["trainer"].oy
  3069. @vs["trainer"].tone = Tone.new(255,255,255)
  3070. @vs["trainer"].zoom_x = 1.32
  3071. @vs["trainer"].zoom_y = 1.32
  3072. @vs["trainer"].opacity = 0
  3073.  
  3074. t_ext = @smSpecial ? "Special" : "Trainer"
  3075. t_ext = "Elite" if @smElite
  3076. bmp = pbBitmap("Graphics/Transitions/sm#{t_ext}#{trainerid}")
  3077. ox = (@vs["trainer"].bitmap.width - bmp.width)/2
  3078. oy = (@vs["trainer"].bitmap.height - bmp.height)/2
  3079. @vs["trainer"].bitmap.blt(ox,oy,bmp,Rect.new(0,0,bmp.width,bmp.height))
  3080. bmp = @vs["trainer"].bitmap.clone
  3081.  
  3082. @vs["shade"].bitmap = bmp.clone
  3083. @vs["shade"].color = @smElite ? Color.new(150,115,255,204) : Color.new(10,169,245,204)
  3084. @vs["shade"].opacity = 0
  3085.  
  3086. @vs["glow"].bitmap = bmp.clone
  3087. @vs["glow"].glow(Color.new(0,0,0),35,false)
  3088. @vs["glow"].src_rect.set(0,viewport.rect.height,viewport.rect.width/2,0)
  3089. @vs["glow2"].bitmap = @vs["glow"].bitmap.clone
  3090. @vs["glow2"].src_rect.set(viewport.rect.width/2,0,viewport.rect.width/2,0)
  3091.  
  3092. @vs["overlay"] = Sprite.new(viewport)
  3093. @vs["overlay"].z = 999
  3094. obmp = pbBitmap("Graphics/Transitions/ballTransition")
  3095. @vs["overlay"].bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
  3096. @vs["overlay"].opacity = 0
  3097. # starts playing the intro of the animation
  3098. 16.times do
  3099. viewport.color.alpha -= 16 if viewport.color.alpha > 0
  3100. @vs["trainer"].zoom_x -= 0.02
  3101. @vs["trainer"].zoom_y -= 0.02
  3102. @vs["trainer"].opacity += 32
  3103. Graphics.update
  3104. end
  3105. @vs["trainer"].zoom_x = 1; @vs["trainer"].zoom_y = 1
  3106. @commandWindow.drawLineup
  3107. @commandWindow.lineupY(-32)
  3108. for i in 0...16
  3109. @commandWindow.showArrows if i < 10
  3110. @vs["trainer"].tone.red -= 16
  3111. @vs["trainer"].tone.green -= 16
  3112. @vs["trainer"].tone.blue -= 16
  3113. @vs["bg"].color.alpha -= 16
  3114. if !@smSpecial && !@smElite
  3115. @vs["bg2"].color.alpha -= 16
  3116. @vs["bg3"].color.alpha -= 16
  3117. end
  3118. if @smSpecial
  3119. @vsFp["ring"].zoom_x += 0.2
  3120. @vsFp["ring"].zoom_y += 0.2
  3121. @vsFp["ring"].opacity -= 16
  3122. end
  3123. self.vsSequenceSM_update
  3124. Graphics.update
  3125. end
  3126. 16.times do
  3127. self.vsSequenceSM_update
  3128. Graphics.update
  3129. end
  3130. for i in 0...16
  3131. @vs["trainer"].tone.red -= 32*(i < 8 ? -1 : 1)
  3132. @vs["trainer"].tone.green -= 32*(i < 8 ? -1 : 1)
  3133. @vs["trainer"].tone.blue -= 32*(i < 8 ? -1 : 1)
  3134. @vs["bg"].speed = (@smSpecial ? 2 : 16) if i == 8 && !@smElite
  3135. if !@smSpecial && !@smElite
  3136. @vs["bg2"].speed = 2 if i == 8
  3137. @vs["bg3"].speed = 6 if i == 8
  3138. end
  3139. for j in 0...3
  3140. next if !@smSpecial
  3141. next if i != 8
  3142. @vsFp["p#{j}"].speed /= 4
  3143. end
  3144. self.vsSequenceSM_update
  3145. Graphics.update
  3146. end
  3147. 16.times do
  3148. @vs["glow"].src_rect.height += 24
  3149. @vs["glow"].src_rect.y -= 24
  3150. @vs["glow"].y -= 24
  3151. @vs["glow2"].src_rect.height += 24
  3152. self.vsSequenceSM_update
  3153. Graphics.update
  3154. end
  3155. viewport.color = Color.new(255,255,255,0) if @smElite
  3156. 8.times do
  3157. viewport.color.alpha += 32 if @smElite
  3158. @vs["glow"].tone.red += 32
  3159. @vs["glow"].tone.green += 32
  3160. @vs["glow"].tone.blue += 32
  3161. @vs["glow2"].tone.red += 32
  3162. @vs["glow2"].tone.green += 32
  3163. @vs["glow2"].tone.blue += 32
  3164. self.vsSequenceSM_update
  3165. Graphics.update
  3166. end
  3167. @vs["bg2"].opacity = 255 if @smElite
  3168. for i in 0...4
  3169. @vs["trainer"].tone.red += 64
  3170. @vs["trainer"].tone.green += 64
  3171. @vs["trainer"].tone.blue += 64
  3172. if !@smSpecial && !@smElite
  3173. @vs["bg"].x += 2
  3174. @vs["bg2"].x += 2
  3175. @vs["bg3"].x += 2
  3176. end
  3177. viewport.color.alpha -= 16 if @smElite
  3178. self.vsSequenceSM_update
  3179. Graphics.update
  3180. end
  3181. for j in 0...3
  3182. viewport.color.alpha -= 16 if @smElite
  3183. next if !@smSpecial
  3184. @vsFp["p#{j}"].z = 300
  3185. end
  3186. for i in 0...8
  3187. viewport.color.alpha -= 16 if @smElite
  3188. @vs["trainer"].tone.red -= 32
  3189. @vs["trainer"].tone.green -= 32
  3190. @vs["trainer"].tone.blue -= 32
  3191. @vs["shade"].opacity += 32
  3192. @vs["shade"].x -= 4
  3193. if i < 4 && !@smSpecial && !@smElite
  3194. @vs["bg"].x -= 2
  3195. @vs["bg2"].x -= 2
  3196. @vs["bg3"].x -= 2
  3197. end
  3198. self.vsSequenceSM_update
  3199. Graphics.update
  3200. end
  3201. # end of intro animation
  3202. end
  3203.  
  3204. def vsSequenceSM_update
  3205. # updates the background effects
  3206. @vs["bg"].update if @vs["bg"] && !@vs["bg"].disposed?
  3207. @vs["bg2"].update if @vs["bg2"] && !@vs["bg2"].disposed?
  3208. @vs["bg3"].update if @vs["bg3"] && !@vs["bg3"].disposed?
  3209. for j in 0...32
  3210. # updates the particles for the special variant
  3211. next if !@smSpecial
  3212. next if !@vsFp["s#{j}"] || @vsFp["s#{j}"].disposed?
  3213. next if j > @fpIndex/4
  3214. if @vsFp["s#{j}"].opacity <= 1
  3215. width = @vs["bg"].viewport.rect.width
  3216. height = @vs["bg"].viewport.rect.height
  3217. x = rand(width*0.75) + width*0.125
  3218. y = rand(height*0.50) + height*0.25
  3219. @fpDx[j] = x + rand(width*0.125)*(x < width/2 ? -1 : 1)
  3220. @fpDy[j] = y - rand(height*0.25)
  3221. z = [1,0.75,0.5,0.25][rand(4)]
  3222. @vsFp["s#{j}"].zoom_x = z
  3223. @vsFp["s#{j}"].zoom_y = z
  3224. @vsFp["s#{j}"].x = x
  3225. @vsFp["s#{j}"].y = y
  3226. @vsFp["s#{j}"].opacity = 255
  3227. @vsFp["s#{j}"].angle = rand(360)
  3228. end
  3229. @vsFp["s#{j}"].x -= (@vsFp["s#{j}"].x - @fpDx[j])*0.05
  3230. @vsFp["s#{j}"].y -= (@vsFp["s#{j}"].y - @fpDy[j])*0.05
  3231. @vsFp["s#{j}"].opacity -= @vsFp["s#{j}"].opacity*0.05
  3232. @vsFp["s#{j}"].zoom_x -= @vsFp["s#{j}"].zoom_x*0.05
  3233. @vsFp["s#{j}"].zoom_y -= @vsFp["s#{j}"].zoom_y*0.05
  3234. end
  3235. for j in 0...3
  3236. # updates the particles for the special variant
  3237. next if !@smSpecial
  3238. next if !@vsFp["p#{j}"] || @vsFp["p#{j}"].disposed?
  3239. @vsFp["p#{j}"].update
  3240. if j == 0
  3241. @vsFp["p#{j}"].opacity += 5 if @vsFp["p#{j}"].opacity < 155
  3242. else
  3243. @vsFp["p#{j}"].opacity += @fpOpac[j-1]*(@fpSpeed[j]/2)
  3244. end
  3245. next if @fpIndex < 24
  3246. @fpOpac[j-1] *= -1 if (@vsFp["p#{j}"].opacity >= 255 || @vsFp["p#{j}"].opacity < 65)
  3247. end
  3248. if @smElite && @vs["bg"] && !@vs["bg"].disposed?
  3249. # updates the particles for the Elite4 variant
  3250. @vs["bg"].angle += 1 if $PokemonSystem.screensize < 2
  3251. @vs["bg2"].angle -= 1 if $PokemonSystem.screensize < 2
  3252. for j in 0...16
  3253. next if @vs["bg2"].opacity < 255
  3254. if @vsFp["e#{j}"].ox < -(@vsFp["e#{j}"].viewport.rect.width/2)
  3255. @vsFp["e#{j}"].speed = 4 + rand(5)
  3256. @vsFp["e#{j}"].opacity = 0
  3257. @vsFp["e#{j}"].ox = 0
  3258. @vsFp["e#{j}"].angle = rand(360)
  3259. bmp = pbBitmap("Graphics/Transitions/smEff1")
  3260. @vsFp["e#{j}"].bitmap.clear
  3261. w = bmp.width/(1 + rand(3))
  3262. @vsFp["e#{j}"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))
  3263. end
  3264. @vsFp["e#{j}"].opacity += @vsFp["e#{j}"].speed
  3265. @vsFp["e#{j}"].ox -= @vsFp["e#{j}"].speed
  3266. end
  3267. for j in 0...3
  3268. next if j > @fpIndex/50
  3269. if @vsFp["ec#{j}"].zoom_x <= 0
  3270. @vsFp["ec#{j}"].zoom_x = 1.5
  3271. @vsFp["ec#{j}"].zoom_y = 1.5
  3272. @vsFp["ec#{j}"].opacity = 0
  3273. end
  3274. @vsFp["ec#{j}"].opacity += 8
  3275. @vsFp["ec#{j}"].zoom_x -= 0.01
  3276. @vsFp["ec#{j}"].zoom_y -= 0.01
  3277. end
  3278.  
  3279. end
  3280. @fpIndex += 1 if @fpIndex < 150
  3281. end
  3282.  
  3283. def vsSequenceSM_end
  3284. # final transition
  3285. viewport = @viewport
  3286. zoom = 4.0
  3287. obmp = pbBitmap("Graphics/Transitions/ballTransition")
  3288. @vs["bg"].speed = @smSpecial ? 4 : 32 if !@smElite
  3289. if !@smSpecial && !@smElite
  3290. @vs["bg2"].speed = 64
  3291. @vs["bg3"].speed = 8
  3292. end
  3293. for j in 0...3
  3294. next if !@smSpecial
  3295. @vsFp["p#{j}"].speed *= 4
  3296. end
  3297. for i in 0..20
  3298. @vs["trainer"].x += 6*(i/5 + 1)
  3299. @vs["glow"].x += 6*(i/5 + 1)
  3300. @vs["glow2"].x += 6*(i/5 + 1)
  3301. @commandWindow.hideArrows if i < 10
  3302. @vs["overlay"].bitmap.clear
  3303. ox = (1 - zoom)*viewport.rect.width*0.5
  3304. oy = (1 - zoom)*viewport.rect.height*0.5
  3305. width = (ox < 0 ? 0 : ox).ceil
  3306. height = (oy < 0 ? 0 : oy).ceil
  3307. @vs["overlay"].bitmap.fill_rect(0,0,width,viewport.rect.height,Color.new(0,0,0))
  3308. @vs["overlay"].bitmap.fill_rect(viewport.rect.width-width,0,width,viewport.rect.height,Color.new(0,0,0))
  3309. @vs["overlay"].bitmap.fill_rect(0,0,viewport.rect.width,height,Color.new(0,0,0))
  3310. @vs["overlay"].bitmap.fill_rect(0,viewport.rect.height-height,viewport.rect.width,height,Color.new(0,0,0))
  3311. @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))
  3312. @vs["overlay"].opacity += 64
  3313. zoom -= 4.0/20
  3314. self.vsSequenceSM_update
  3315. @vs["shade"].opacity -= 16
  3316. Graphics.update
  3317. end
  3318. @commandWindow.lineupY(+32)
  3319. # disposes of current sprites
  3320. pbDisposeSpriteHash(@vs)
  3321. pbDisposeSpriteHash(@vsFp)
  3322. @vs["overlay"] = Sprite.new(@msgview)
  3323. @vs["overlay"].z = 9999999
  3324. @vs["overlay"].bitmap = Bitmap.new(@msgview.rect.width,@msgview.rect.height)
  3325. @vs["overlay"].bitmap.fill_rect(0,0,@msgview.rect.width,@msgview.rect.height,Color.new(0,0,0))
  3326. end
  3327.  
  3328. def vsSequenceSM_sendout
  3329. # transitions from VS sequence to the battle scene
  3330. viewport = @msgview
  3331. zoom = 0
  3332. obmp = pbBitmap("Graphics/Transitions/ballTransition")
  3333. 21.times do
  3334. @vs["overlay"].bitmap.clear
  3335. ox = (1 - zoom)*viewport.rect.width*0.5
  3336. oy = (1 - zoom)*viewport.rect.height*0.5
  3337. width = (ox < 0 ? 0 : ox).ceil
  3338. height = (oy < 0 ? 0 : oy).ceil
  3339. @vs["overlay"].bitmap.fill_rect(0,0,width,viewport.rect.height,Color.new(0,0,0))
  3340. @vs["overlay"].bitmap.fill_rect(viewport.rect.width-width,0,width,viewport.rect.height,Color.new(0,0,0))
  3341. @vs["overlay"].bitmap.fill_rect(0,0,viewport.rect.width,height,Color.new(0,0,0))
  3342. @vs["overlay"].bitmap.fill_rect(0,viewport.rect.height-height,viewport.rect.width,height,Color.new(0,0,0))
  3343. @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))
  3344. @vs["overlay"].opacity -= 12.8
  3345. zoom += 4.0/20
  3346. wait(1,true)
  3347. end
  3348. @vs["overlay"].dispose
  3349. end
  3350. end
  3351. #-------------------------------------------------------------------------------
  3352. # New S&M "Mother Beast Lusamine" styled sequence
  3353. #-------------------------------------------------------------------------------
  3354. class PokeBattle_Scene
  3355. def crazySequence_start(viewport,trainerid)
  3356. @sequenceType = 1
  3357. @vs["bg"] = CrazyRainbowBackground.new(viewport)
  3358. @vs["rect"] = Sprite.new(@viewport)
  3359. @vs["rect"].z = 400
  3360. @vs["rect"].drawRect(viewport.rect.width,viewport.rect.height,Color.new(0,0,0))
  3361. @vs["rect"].color = Color.new(255,255,255)
  3362.  
  3363. @vs["trainer"] = Sprite.new(viewport)
  3364. @vs["trainer"].bitmap = pbBitmap(sprintf("Graphics/Transitions/smCrazy%d",trainerid))
  3365. @vs["trainer"].ox = @vs["trainer"].bitmap.width/2
  3366. @vs["trainer"].oy = @vs["trainer"].bitmap.height/2
  3367. @vs["trainer"].x = 3*viewport.rect.width/2
  3368. @vs["trainer"].y = viewport.rect.height/2
  3369. @vs["trainer"].color = Color.new(255,255,255)
  3370. @vs["trainer"].z = 450
  3371.  
  3372. @vs["trainer3"] = Sprite.new(viewport)
  3373. @vs["trainer3"].bitmap = Bitmap.new(viewport.rect.width,viewport.rect.height)
  3374. bmp = @vs["trainer"].bitmap.clone
  3375. @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))
  3376. @vs["trainer3"].y = viewport.rect.height
  3377. @vs["trainer3"].color = Color.new(255,255,255)
  3378. @vs["trainer3"].z = 400
  3379. @vs["trainer3"].glow(Color.new(255,255,255))
  3380. @vs["trainer3"].src_rect.set(0,viewport.rect.height,viewport.rect.width,0)
  3381.  
  3382. @commandWindow.drawLineup
  3383. @commandWindow.lineupY(-32)
  3384. 64.times do
  3385. @vs["bg"].update
  3386. end
  3387. 16.times do
  3388. @vs["rect"].color.alpha -= 16
  3389. Graphics.update
  3390. end
  3391. for i in 0...24
  3392. @commandWindow.showArrows if i < 10
  3393. @vs["trainer"].x += ((-16 + viewport.rect.width/2) - @vs["trainer"].x)*0.2
  3394. Graphics.update
  3395. end
  3396. 4.times do
  3397. @vs["trainer"].x += 4
  3398. Graphics.update
  3399. end
  3400. 8.times do
  3401. @vs["trainer"].color.alpha -= 32
  3402. Graphics.update
  3403. end
  3404. 16.times do
  3405. @vs["trainer3"].src_rect.y -= 24
  3406. @vs["trainer3"].src_rect.height += 24
  3407. @vs["trainer3"].y -= 24
  3408. Graphics.update
  3409. end
  3410. @vs["rect"].color = Color.new(255,255,255,0)
  3411. for i in 0...2
  3412. 8.times do
  3413. @vs["trainer"].color.alpha += 32*(i==0 ? 1 : -1)
  3414. @vs["rect"].color.alpha += 16
  3415. @vs["rect"].opacity -= 16 if i == 1
  3416. @vs["bg"].update if i == 1
  3417. Graphics.update
  3418. end
  3419. end
  3420. 16.times do
  3421. @vs["bg"].update
  3422. @vs["rect"].opacity -= 16
  3423. Graphics.update
  3424. end
  3425. end
  3426.  
  3427. def crazySequence_end
  3428. view = @vs["trainer"].viewport
  3429. @vs["bg"].dispose
  3430. @vs["rect"].dispose
  3431. @vs["trainer"].dispose
  3432. @vs["trainer3"].dispose
  3433.  
  3434. bmp = Graphics.snap_to_bitmap
  3435. @vs["ov1"] = Sprite.new(view)
  3436. @vs["ov1"].bitmap = bmp
  3437. @vs["ov1"].ox = bmp.width/2
  3438. @vs["ov1"].oy = bmp.height/2
  3439. @vs["ov1"].x = viewport.rect.width/2
  3440. @vs["ov1"].y = viewport.rect.height/2
  3441. @vs["ov1"].z = 500
  3442. @vs["ov2"] = Sprite.new(view)
  3443. @vs["ov2"].bitmap = bmp
  3444. @vs["ov2"].blur_sprite(3)
  3445. @vs["ov2"].ox = bmp.width/2
  3446. @vs["ov2"].oy = bmp.height/2
  3447. @vs["ov2"].x = viewport.rect.width/2
  3448. @vs["ov2"].y = viewport.rect.height/2
  3449. @vs["ov2"].opacity = 0
  3450. @vs["ov2"].z = 500
  3451. # final zooming transition
  3452. for i in 0...32
  3453. @commandWindow.hideArrows if i < 10
  3454. @vs["ov1"].zoom_x += 0.02
  3455. @vs["ov1"].zoom_y += 0.02
  3456. @vs["ov2"].zoom_x += 0.02
  3457. @vs["ov2"].zoom_y += 0.02
  3458. @vs["ov2"].opacity += 12
  3459. if i >= 16
  3460. @vs["ov2"].tone.red += 16
  3461. @vs["ov2"].tone.green += 16
  3462. @vs["ov2"].tone.blue += 16
  3463. end
  3464. Graphics.update
  3465. end
  3466. 8.times do; Graphics.update; end
  3467. $smAnim = false
  3468. @vs["ov1"].opacity = 0
  3469. for i in 0...16
  3470. @vs["ov2"].opacity -= 16
  3471. wait(1,true)
  3472. end
  3473. @commandWindow.lineupY(+32)
  3474. @vs["ov1"].dispose
  3475. @vs["ov2"].dispose
  3476. end
  3477.  
  3478. def crazySequence_sendout
  3479. end
  3480.  
  3481. def crazySequence_update
  3482. return if @vs["trainer"].disposed?
  3483. @vs["bg"].update
  3484. end
  3485. end#-------------------------------------------------------------------------------
  3486. # Special Pokemon VS animation
  3487. #-------------------------------------------------------------------------------
  3488. class PokeBattle_Scene
  3489. # called within the scene to update animation
  3490. def ebSpecialSpecies_update
  3491. for j in 0...3
  3492. if @vsFp["ec#{j}"].zoom_x <= 0
  3493. @vsFp["ec#{j}"].zoom_x = 2
  3494. @vsFp["ec#{j}"].zoom_y = 2
  3495. @vsFp["ec#{j}"].opacity = 255
  3496. end
  3497. @vsFp["ec#{j}"].opacity -= 3
  3498. @vsFp["ec#{j}"].zoom_x -= 0.02
  3499. @vsFp["ec#{j}"].zoom_y -= 0.02
  3500. end
  3501. @vsFp["poke1"].src_rect.height += 40 if @vsFp["poke1"].src_rect.height < 640
  3502. @vsFp["poke1"].opacity -= 2*@vsFp["poke1"].toggle
  3503. @vsFp["poke1"].toggle *= -1 if @vsFp["poke1"].opacity <= 0 || @vsFp["poke1"].opacity >= 255
  3504. @vsFp["bg"].angle += 1 if $PokemonSystem.screensize < 2
  3505. end
  3506. # called within the scene to initialize and start the animation
  3507. def ebSpecialSpecies_start(viewport)
  3508. species = $wildSpecies
  3509. viewport.color = Color.new(255,255,255,0)
  3510.  
  3511. @vsFp = {}
  3512. # graphics for bars covering the viewport
  3513. @vsFp["bar1"] = Sprite.new(viewport)
  3514. @vsFp["bar1"].drawRect(viewport.rect.width,viewport.rect.height/2,Color.new(0,0,0))
  3515. @vsFp["bar1"].z = 999
  3516. @vsFp["bar2"] = Sprite.new(viewport)
  3517. @vsFp["bar2"].drawRect(viewport.rect.width,viewport.rect.height/2 + 2,Color.new(0,0,0))
  3518. @vsFp["bar2"].oy = @vsFp["bar2"].bitmap.height
  3519. @vsFp["bar2"].y = viewport.rect.height + 2
  3520. @vsFp["bar2"].z = 999
  3521. # background graphic
  3522. @vsFp["bg"] = Sprite.new(viewport)
  3523. str = "Graphics/Transitions/speciesBg#{species}"
  3524. str = "Graphics/Transitions/speciesBg" if !pbResolveBitmap(str)
  3525. @vsFp["bg"].bitmap = pbBitmap(str)
  3526. @vsFp["bg"].ox = @vsFp["bg"].src_rect.width/2
  3527. @vsFp["bg"].oy = @vsFp["bg"].src_rect.height/2
  3528. @vsFp["bg"].x = viewport.rect.width/2
  3529. @vsFp["bg"].y = viewport.rect.height/2
  3530. # "electricity" effect that scrolls horizontally behind the Pokemon
  3531. @vsFp["streak"] = ScrollingSprite.new(viewport)
  3532. @vsFp["streak"].setBitmap("Graphics/Transitions/vsLight3")
  3533. @vsFp["streak"].x = viewport.rect.width
  3534. @vsFp["streak"].y = viewport.rect.height/2
  3535. @vsFp["streak"].speed = 64
  3536. @vsFp["streak"].oy = @vsFp["streak"].bitmap.height/2
  3537. # initial particles
  3538. for j in 0...24
  3539. n = ["B","C"][rand(2)]
  3540. @vsFp["p#{j}"] = Sprite.new(viewport)
  3541. str = "Graphics/Transitions/speciesEff#{n}#{species}"
  3542. str = "Graphics/Transitions/speciesEff#{n}" if !pbResolveBitmap(str)
  3543. @vsFp["p#{j}"].bitmap = pbBitmap(str)
  3544. @vsFp["p#{j}"].ox = @vsFp["p#{j}"].bitmap.width/2
  3545. @vsFp["p#{j}"].oy = @vsFp["p#{j}"].bitmap.height/2
  3546. @vsFp["p#{j}"].x = viewport.rect.width + 48
  3547. y = viewport.rect.height*0.5*0.72 + rand(0.28*viewport.rect.height)
  3548. @vsFp["p#{j}"].y = y
  3549. @vsFp["p#{j}"].speed = rand(4) + 1
  3550. @vsFp["p#{j}"].z = 1 if rand(2)==0
  3551. end
  3552. # main Pokemon graphic
  3553. @vsFp["poke1"] = Sprite.new(viewport)
  3554. @vsFp["poke1"].bitmap = pbBitmap("Graphics/Transitions/species#{species}")
  3555. @vsFp["poke1"].ox = @vsFp["poke1"].bitmap.width/2
  3556. @vsFp["poke1"].oy = @vsFp["poke1"].bitmap.height*0.25
  3557. @vsFp["poke1"].x = viewport.rect.width/2
  3558. @vsFp["poke1"].y = viewport.rect.height/2
  3559. @vsFp["poke1"].glow(Color.new(101,136,194),35,false)
  3560. @vsFp["poke1"].src_rect.height = 0
  3561. @vsFp["poke1"].toggle = -1
  3562. @vsFp["poke2"] = Sprite.new(viewport)
  3563. @vsFp["poke2"].bitmap = pbBitmap("Graphics/Transitions/species#{species}")
  3564. @vsFp["poke2"].ox = @vsFp["poke2"].bitmap.width/2
  3565. @vsFp["poke2"].oy = @vsFp["poke2"].bitmap.height*0.25
  3566. @vsFp["poke2"].x = viewport.rect.width
  3567. @vsFp["poke2"].y = viewport.rect.height/2
  3568. @vsFp["poke2"].opacity = 0
  3569. # ring particles which zoom towards the center of viewport
  3570. for j in 0...3
  3571. @vsFp["ec#{j}"] = Sprite.new(viewport)
  3572. str = "Graphics/Transitions/speciesEffA#{species}"
  3573. str = "Graphics/Transitions/speciesEffA" if !pbResolveBitmap(str)
  3574. @vsFp["ec#{j}"].bitmap = pbBitmap(str)
  3575. @vsFp["ec#{j}"].ox = @vsFp["ec#{j}"].bitmap.width/2
  3576. @vsFp["ec#{j}"].oy = @vsFp["ec#{j}"].bitmap.height/2
  3577. @vsFp["ec#{j}"].x = viewport.rect.width/2
  3578. @vsFp["ec#{j}"].y = viewport.rect.height/2
  3579. @vsFp["ec#{j}"].zoom_x = 2
  3580. @vsFp["ec#{j}"].zoom_y = 2
  3581. @vsFp["ec#{j}"].opacity = 255
  3582. end
  3583. # starts the animation
  3584. for i in 0...64
  3585. @vsFp["streak"].x -= 64 if @vsFp["streak"].x > 0
  3586. @vsFp["streak"].update if @vsFp["streak"].x <= 0
  3587. @vsFp["streak"].opacity -= 16 if i >= 48
  3588. @vsFp["bar1"].zoom_y -= 0.02 if @vsFp["bar1"].zoom_y > 0.72
  3589. @vsFp["bar2"].zoom_y -= 0.02 if @vsFp["bar2"].zoom_y > 0.72
  3590. @vsFp["poke2"].opacity += 16
  3591. @vsFp["poke2"].x -= (@vsFp["poke2"].x - viewport.rect.width/2)*0.1
  3592. for j in 0...3
  3593. next if j > i/50
  3594. if @vsFp["ec#{j}"].zoom_x <= 0
  3595. @vsFp["ec#{j}"].zoom_x = 2
  3596. @vsFp["ec#{j}"].zoom_y = 2
  3597. @vsFp["ec#{j}"].opacity = 255
  3598. end
  3599. @vsFp["ec#{j}"].opacity -= 3
  3600. @vsFp["ec#{j}"].zoom_x -= 0.02
  3601. @vsFp["ec#{j}"].zoom_y -= 0.02
  3602. end
  3603. for j in 0...24
  3604. next if j > i/2
  3605. @vsFp["p#{j}"].x -= 32*@vsFp["p#{j}"].speed
  3606. end
  3607. @vsFp["bg"].angle += 1 if $PokemonSystem.screensize < 2
  3608. Graphics.update
  3609. end
  3610. # changes focus to Pokemon graphic
  3611. for i in 0...8
  3612. @vsFp["bar1"].zoom_y -= 0.72/8
  3613. @vsFp["bar2"].zoom_y -= 0.72/8
  3614. @vsFp["poke1"].y -= 8
  3615. @vsFp["poke2"].y -= 8
  3616. if i >= 4
  3617. viewport.color.alpha += 64
  3618. end
  3619. ebSpecialSpecies_update
  3620. Graphics.update
  3621. end
  3622. # flash and impact of screen
  3623. @vsFp["poke1"].oy = @vsFp["poke1"].bitmap.height/2
  3624. @vsFp["poke1"].y = viewport.rect.height/2
  3625. @vsFp["poke2"].oy = @vsFp["poke2"].bitmap.height/2
  3626. @vsFp["poke2"].y = viewport.rect.height/2
  3627. @vsFp["impact"] = Sprite.new(viewport)
  3628. @vsFp["impact"].bitmap = pbBitmap("Graphics/Pictures/impact")
  3629. @vsFp["impact"].ox = @vsFp["impact"].bitmap.width/2
  3630. @vsFp["impact"].oy = @vsFp["impact"].bitmap.height/2
  3631. @vsFp["impact"].x = viewport.rect.width/2
  3632. @vsFp["impact"].y = viewport.rect.height/2
  3633. @vsFp["impact"].z = 999
  3634. @vsFp["impact"].opacity = 0
  3635. pbPlayCry(species)
  3636. k = -1
  3637. # fades flash
  3638. for i in 0...32
  3639. viewport.color.alpha -= 16 if viewport.color.alpha > 0
  3640. @vsFp["bg"].y += k*4 if i < 16
  3641. @vsFp["poke2"].y += k*4 if i < 16
  3642. k *= -1 if i%2==0
  3643. @vsFp["impact"].opacity += (i < 24) ? 64 : -32
  3644. @vsFp["impact"].angle += 180 if i%4 == 0
  3645. @vsFp["impact"].mirror = !@vsFp["impact"].mirror if i%4 == 2
  3646. ebSpecialSpecies_update
  3647. Graphics.update
  3648. end
  3649. end
  3650. # called to end the sequence and dispose of sprites
  3651. def ebSpecialSpecies_end
  3652. bmp = Graphics.snap_to_bitmap
  3653. view = @vsFp["poke1"].viewport
  3654. pbDisposeSpriteHash(@vsFp)
  3655. @vsFp["ov1"] = Sprite.new(view)
  3656. @vsFp["ov1"].bitmap = bmp
  3657. @vsFp["ov1"].ox = bmp.width/2
  3658. @vsFp["ov1"].oy = bmp.height/2
  3659. @vsFp["ov1"].x = viewport.rect.width/2
  3660. @vsFp["ov1"].y = viewport.rect.height/2
  3661. @vsFp["ov2"] = Sprite.new(view)
  3662. @vsFp["ov2"].bitmap = bmp
  3663. @vsFp["ov2"].blur_sprite(3)
  3664. @vsFp["ov2"].ox = bmp.width/2
  3665. @vsFp["ov2"].oy = bmp.height/2
  3666. @vsFp["ov2"].x = viewport.rect.width/2
  3667. @vsFp["ov2"].y = viewport.rect.height/2
  3668. @vsFp["ov2"].opacity = 0
  3669. # final zooming transition
  3670. for i in 0...32
  3671. @vsFp["ov1"].zoom_x += 0.02
  3672. @vsFp["ov1"].zoom_y += 0.02
  3673. @vsFp["ov2"].zoom_x += 0.02
  3674. @vsFp["ov2"].zoom_y += 0.02
  3675. @vsFp["ov2"].opacity += 12
  3676. if i >= 16
  3677. @vsFp["ov2"].tone.red += 16
  3678. @vsFp["ov2"].tone.green += 16
  3679. @vsFp["ov2"].tone.blue += 16
  3680. end
  3681. Graphics.update
  3682. end
  3683. 8.times do; Graphics.update; end
  3684. @vsFp["ov1"].opacity = 0
  3685. $specialSpecies = false
  3686. @sprites["battlebox1"].appear
  3687. for i in 0...16
  3688. @vsFp["ov2"].opacity -= 16
  3689. if i < 10
  3690. if EBUISTYLE==2
  3691. @sprites["battlebox1"].show
  3692. elsif EBUISTYLE==0
  3693. @sprites["battlebox1"].update
  3694. else
  3695. @sprites["battlebox1"].x+=26
  3696. end
  3697. end
  3698. animateBattleSprites
  3699. Graphics.update
  3700. end
  3701. pbDisposeSpriteHash(@vsFp)
  3702. end
  3703.  
  3704. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement