Guest User

Untitled

a guest
Feb 9th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.94 KB | None | 0 0
  1. class MoveSelectionSprite < SpriteWrapper
  2. attr_reader :preselected
  3. attr_reader :index
  4.  
  5. def initialize(viewport=nil,fifthmove=false)
  6. super(viewport)
  7. @movesel=AnimatedBitmap.new("Graphics/Pictures/summarymovesel")
  8. @frame=0
  9. @index=0
  10. @fifthmove=fifthmove
  11. @preselected=false
  12. @updating=false
  13. @spriteVisible=true
  14. refresh
  15. end
  16.  
  17. def dispose
  18. @movesel.dispose
  19. super
  20. end
  21.  
  22. def index=(value)
  23. @index=value
  24. refresh
  25. end
  26.  
  27. def preselected=(value)
  28. @preselected=value
  29. refresh
  30. end
  31.  
  32. def visible=(value)
  33. super
  34. @spriteVisible=value if !@updating
  35. end
  36.  
  37. def refresh
  38. self.x=240
  39. self.y=92+(self.index*64)
  40. self.y-=76 if @fifthmove
  41. self.y+=20 if @fifthmove && self.index==4
  42. if self.preselected
  43. self.src_rect.set(0,h,w,h)
  44. else
  45. self.src_rect.set(0,0,w,h)
  46. end
  47. end
  48.  
  49. def update
  50. @updating=true
  51. super
  52. @movesel.update
  53. @updating=false
  54. refresh
  55. end
  56. end
  57.  
  58.  
  59.  
  60. class PokemonSummaryScene
  61. def pbPokerus(pkmn)
  62. return pkmn.pokerusStage
  63. end
  64.  
  65. def pbUpdate
  66. pbUpdateSpriteHash(@sprites)
  67. end
  68.  
  69. def pbStartScene(party,partyindex)
  70. @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
  71. @viewport.z=99999
  72. @party=party
  73. @partyindex=partyindex
  74. @pokemon=@party[@partyindex]
  75. @sprites={}
  76. @typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
  77. @sprites["background"]=IconSprite.new(0,0,@viewport)
  78. @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
  79. @sprites["pokemon"]=PokemonSprite.new(@viewport)
  80. @sprites["pokemon"].setPokemonBitmap(@pokemon)
  81. @sprites["pokemon"].mirror=true
  82. @sprites["pokemon"].color=Color.new(0,0,0,0)
  83. pbPositionPokemonSprite(@sprites["pokemon"],22,90)
  84. @sprites["pokeicon"]=PokemonBoxIcon.new(@pokemon,@viewport)
  85. @sprites["pokeicon"].x=14
  86. @sprites["pokeicon"].y=52
  87. @sprites["pokeicon"].mirror=false
  88. @sprites["pokeicon"].visible=false
  89. @sprites["movepresel"]=MoveSelectionSprite.new(@viewport)
  90. @sprites["movepresel"].visible=false
  91. @sprites["movepresel"].preselected=true
  92. @sprites["movesel"]=MoveSelectionSprite.new(@viewport)
  93. @sprites["movesel"].visible=false
  94. @page=0
  95. drawPageOne(@pokemon)
  96. pbFadeInAndShow(@sprites) { pbUpdate }
  97. end
  98.  
  99. def pbStartForgetScene(party,partyindex,moveToLearn)
  100. @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
  101. @viewport.z=99999
  102. @party=party
  103. @partyindex=partyindex
  104. @pokemon=@party[@partyindex]
  105. @sprites={}
  106. @page=3
  107. @typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
  108. @sprites["background"]=IconSprite.new(0,0,@viewport)
  109. @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
  110. @sprites["pokeicon"]=PokemonBoxIcon.new(@pokemon,@viewport)
  111. @sprites["pokeicon"].x=14
  112. @sprites["pokeicon"].y=52
  113. @sprites["pokeicon"].mirror=false
  114. @sprites["movesel"]=MoveSelectionSprite.new(@viewport,moveToLearn>0)
  115. @sprites["movesel"].visible=false
  116. @sprites["movesel"].visible=true
  117. @sprites["movesel"].index=0
  118. drawSelectedMove(@pokemon,moveToLearn,@pokemon.moves[0].id)
  119. pbFadeInAndShow(@sprites)
  120. end
  121.  
  122. def pbEndScene
  123. pbFadeOutAndHide(@sprites) { pbUpdate }
  124. pbDisposeSpriteHash(@sprites)
  125. @typebitmap.dispose
  126. @viewport.dispose
  127. end
  128.  
  129. def drawMarkings(bitmap,x,y,width,height,markings)
  130. totaltext=""
  131. oldfontname=bitmap.font.name
  132. oldfontsize=bitmap.font.size
  133. oldfontcolor=bitmap.font.color
  134. bitmap.font.size=24
  135. bitmap.font.name="Arial"
  136. PokemonStorage::MARKINGCHARS.each{|item| totaltext+=item }
  137. totalsize=bitmap.text_size(totaltext)
  138. realX=x+(width/2)-(totalsize.width/2)
  139. realY=y+(height/2)-(totalsize.height/2)
  140. i=0
  141. PokemonStorage::MARKINGCHARS.each{|item|
  142. marked=(markings&(1<<i))!=0
  143. bitmap.font.color=(marked) ? Color.new(72,64,56) : Color.new(184,184,160)
  144. itemwidth=bitmap.text_size(item).width
  145. bitmap.draw_text(realX,realY,itemwidth+2,totalsize.height,item)
  146. realX+=itemwidth
  147. i+=1
  148. }
  149. bitmap.font.name=oldfontname
  150. bitmap.font.size=oldfontsize
  151. bitmap.font.color=oldfontcolor
  152. end
  153.  
  154. def drawPageOne(pokemon)
  155. if pokemon.isEgg?
  156. drawPageOneEgg(pokemon)
  157. return
  158. end
  159. overlay=@sprites["overlay"].bitmap
  160. overlay.clear
  161. @sprites["background"].setBitmap("Graphics/Pictures/BrassSummary1")
  162. imagepos=[]
  163. if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
  164. status=6 if pbPokerus(pokemon)==1
  165. [email protected] if @pokemon.status>0
  166. status=5 if pokemon.hp==0
  167. imagepos.push(["Graphics/Pictures/statuses",120,230,0,16*status,44,16])
  168. end
  169. if pokemon.isShiny?
  170. imagepos.push([sprintf("Graphics/Pictures/shiny"),6,76,0,0,-1,-1])
  171. end
  172. if pbPokerus(pokemon)==2
  173. imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),414,6,0,0,-1,-1])
  174. end
  175. [email protected] ? @pokemon.ballused : 0
  176. ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
  177. imagepos.push([ballimage,36,286,0,0,-1,-1])
  178. pbDrawImagePositions(overlay,imagepos)
  179. base=Color.new(0,0,0)
  180. shadow=Color.new(104,104,104)
  181. white=Color.new(248,248,248)
  182. green=Color.new(136,248,104)
  183. pbSetSystemFont(overlay)
  184. # TO BE CHANGED IN THE FUTURE, currently affects nothing
  185. # (replaced with the colours above)
  186. numberbase=(pokemon.isShiny?) ? Color.new(248,56,32) : Color.new(64,64,64)
  187. numbershadow=(pokemon.isShiny?) ? Color.new(224,152,144) : Color.new(176,176,176)
  188. #
  189. publicID=pokemon.publicID
  190. speciesname=PBSpecies.getName(pokemon.species)
  191. growthrate=pokemon.growthrate
  192. startexp=PBExperience.pbGetStartExperience(pokemon.level,growthrate)
  193. endexp=PBExperience.pbGetStartExperience(pokemon.level+1,growthrate)
  194. # Left side of the Summary Screen
  195. # Colours are base, white
  196. # To center text on this side, make sure X is 84 and the third numb is 2
  197. textpos=[
  198. [_INTL("INFO"),84,2,2,base,white],
  199. [pokename,84,34,2,base,white],
  200. [_INTL("Lv {1}",pokemon.level.to_s),74,286,0,base,white]]
  201. if pokemon.hasItem?
  202. textpos.push([PBItems.getName(pokemon.item),84,254,2,base,white])
  203. else
  204. textpos.push([_INTL("NONE"),62,254,0,base,white])
  205. end
  206. if pokemon.isMale?
  207. textpos.push([_INTL("♂"),6,222,0,Color.new(120,96,240),Color.new(248,248,248)])
  208. elsif pokemon.isFemale?
  209. textpos.push([_INTL("♀"),6,222,0,Color.new(248,56,8),Color.new(248,248,248)])
  210. end
  211. pbDrawTextPositions(overlay,textpos)
  212. # Rest of page one
  213. # Colours are base, green
  214. textpos=[
  215. [_ISPRINTF("Dex No."),228,36,2,base,green],
  216. [sprintf("%03d",pokemon.species),400,36,2,base,green],
  217. [_INTL("Species"),228,70,2,base,green],
  218. [speciesname,400,70,2,base,green],
  219. [_INTL("Type"),228,104,2,base,green],
  220. [_INTL("OT"),228,138,2,base,green],
  221. [_INTL("ID No."),228,170,2,base,green],
  222. ]
  223. textpos.push([_INTL("EXP."),228,254,2,base,green])
  224. textpos.push([sprintf("%d",pokemon.exp),400,254,2,base,green])
  225. textpos.push([_INTL("TO NEXT"),228,288,2,base,green])
  226. textpos.push([sprintf("%d",endexp-pokemon.exp),400,288,2,base,green])
  227. idno=(pokemon.ot=="") ? "?????" : sprintf("%05d",publicID)
  228. textpos.push([idno,402,170,2,base,green])
  229. if pokemon.ot==""
  230. textpos.push([_INTL("RENTAL"),402,138,2,Color.new(64,64,64),Color.new(176,176,176)])
  231. else
  232. textpos.push([pokemon.ot,402,138,2,base,green])
  233. end
  234. pbDrawTextPositions(overlay,textpos)
  235. drawMarkings(overlay,440,4,72,20,pokemon.markings)
  236. type1rect=Rect.new(0,pokemon.type1*28,64,28)
  237. type2rect=Rect.new(0,pokemon.type2*28,64,28)
  238. if pokemon.type1==pokemon.type2
  239. overlay.blt(368,104,@typebitmap.bitmap,type1rect)
  240. else
  241. overlay.blt(336,104,@typebitmap.bitmap,type1rect)
  242. overlay.blt(400,104,@typebitmap.bitmap,type2rect)
  243. end
  244. if pokemon.level<PBExperience::MAXLEVEL
  245. overlay.fill_rect(312,230,(pokemon.exp-startexp)*174/(endexp-startexp),6,Color.new(32,136,248))
  246. end
  247. end
  248.  
  249. def drawPageOneEgg(pokemon)
  250. overlay=@sprites["overlay"].bitmap
  251. overlay.clear
  252. @sprites["background"].setBitmap("Graphics/Pictures/BrassSummary1")
  253. imagepos=[]
  254. if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
  255. status=6 if pbPokerus(pokemon)==1
  256. [email protected] if @pokemon.status>0
  257. status=5 if pokemon.hp==0
  258. imagepos.push(["Graphics/Pictures/statuses",120,230,0,16*status,44,16])
  259. end
  260. if pokemon.isShiny?
  261. imagepos.push([sprintf("Graphics/Pictures/shiny"),6,76,0,0,-1,-1])
  262. end
  263. if pbPokerus(pokemon)==2
  264. imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),414,6,0,0,-1,-1])
  265. end
  266. [email protected] ? @pokemon.ballused : 0
  267. ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
  268. imagepos.push([ballimage,36,286,0,0,-1,-1])
  269. pbDrawImagePositions(overlay,imagepos)
  270. base=Color.new(0,0,0)
  271. shadow=Color.new(104,104,104)
  272. white=Color.new(248,248,248)
  273. green=Color.new(136,248,104)
  274. pbSetSystemFont(overlay)
  275. textpos=[
  276. [_INTL("INFO"),84,2,2,base,white],
  277. [pokename,84,34,2,base,white],
  278. [_INTL("EGG"),74,286,0,base,white]]
  279. if pokemon.hasItem?
  280. textpos.push([PBItems.getName(pokemon.item),84,254,2,base,white])
  281. else
  282. textpos.push([_INTL(""),62,254,0,base,white])
  283. end
  284. pbDrawTextPositions(overlay,textpos)
  285. memo=""
  286. if pokemon.timeReceived
  287. month=pbGetAbbrevMonthName(pokemon.timeReceived.mon)
  288. date=pokemon.timeReceived.day
  289. year=pokemon.timeReceived.year
  290. memo+=_INTL("<c3=404040,efe4b0>{1} {2}, {3}\n",month,date,year)
  291. end
  292. mapname=pbGetMapNameFromId(pokemon.obtainMap)
  293. if (pokemon.obtainText rescue false) && pokemon.obtainText!=""
  294. mapname=pokemon.obtainText
  295. end
  296. if mapname && mapname!=""
  297. memo+=_INTL("<c3=404040,efe4b0>A mysterious Pokémon Egg received from <c3=F83820,E09890>{1}<c3=404040,B0B0B0>.\n",mapname)
  298. end
  299. memo+="<c3=404040,efe4b0>\n"
  300. memo+=_INTL("<c3=404040,efe4b0>\"The Egg Watch\"\n")
  301. eggstate=_INTL("It looks like this Egg will take a long time to hatch.")
  302. eggstate=_INTL("What will hatch from this? It doesn't seem close to hatching.") if pokemon.eggsteps<10200
  303. eggstate=_INTL("It appears to move occasionally. It may be close to hatching.") if pokemon.eggsteps<2550
  304. eggstate=_INTL("Sounds can be heard coming from inside! It will hatch soon!") if pokemon.eggsteps<1275
  305. memo+=sprintf("<c3=404040,efe4b0>%s\n",eggstate)
  306. drawFormattedTextEx(overlay,232,78,276,memo)
  307. drawMarkings(overlay,440,4,72,20,pokemon.markings)
  308. end
  309.  
  310. def drawPageTwo(pokemon)
  311. overlay=@sprites["overlay"].bitmap
  312. overlay.clear
  313. @sprites["background"].setBitmap("Graphics/Pictures/BrassSummary2")
  314. imagepos=[]
  315. if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
  316. status=6 if pbPokerus(pokemon)==1
  317. [email protected] if @pokemon.status>0
  318. status=5 if pokemon.hp==0
  319. imagepos.push(["Graphics/Pictures/statuses",120,230,0,16*status,44,16])
  320. end
  321. if pokemon.isShiny?
  322. imagepos.push([sprintf("Graphics/Pictures/shiny"),6,76,0,0,-1,-1])
  323. end
  324. if pbPokerus(pokemon)==2
  325. imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),414,6,0,0,-1,-1])
  326. end
  327. [email protected] ? @pokemon.ballused : 0
  328. ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
  329. imagepos.push([ballimage,36,286,0,0,-1,-1])
  330. pbDrawImagePositions(overlay,imagepos)
  331. base=Color.new(0,0,0)
  332. shadow=Color.new(104,104,104)
  333. white=Color.new(248,248,248)
  334. vanilla=Color.new(239,228,176)
  335. pbSetSystemFont(overlay)
  336. naturename=PBNatures.getName(pokemon.nature)
  337. # Left side of the Summary Screen
  338. # Colours are base, white
  339. # To center text on this side, make sure X is 84 and the third numb is 2
  340. textpos=[
  341. [_INTL("MEMO"),84,2,2,base,white],
  342. [pokename,84,34,2,base,white],
  343. [_INTL("Lv {1}",pokemon.level.to_s),74,286,0,base,white]]
  344. if pokemon.hasItem?
  345. textpos.push([PBItems.getName(pokemon.item),84,254,2,base,white])
  346. else
  347. textpos.push([_INTL("NONE"),62,254,0,base,white])
  348. end
  349. if pokemon.isMale?
  350. textpos.push([_INTL("♂"),6,222,0,Color.new(120,96,240),Color.new(248,248,248)])
  351. elsif pokemon.isFemale?
  352. textpos.push([_INTL("♀"),6,222,0,Color.new(248,56,8),Color.new(248,248,248)])
  353. end
  354. pbDrawTextPositions(overlay,textpos)
  355. memo=""
  356. shownature=(!(pokemon.isShadow? rescue false)) || pokemon.heartStage<=3
  357. if shownature
  358. memo+=_INTL("<c3=000000,efe4b0>{1}<c3=000000,efe4b0> nature.\n",naturename)
  359. end
  360. if pokemon.timeReceived
  361. month=pbGetAbbrevMonthName(pokemon.timeReceived.mon)
  362. date=pokemon.timeReceived.day
  363. year=pokemon.timeReceived.year
  364. memo+=_INTL("<c3=000000,efe4b0>{1} {2}, {3}\n",month,date,year)
  365. end
  366. mapname=pbGetMapNameFromId(pokemon.obtainMap)
  367. if (pokemon.obtainText rescue false) && pokemon.obtainText!=""
  368. mapname=pokemon.obtainText
  369. end
  370. if mapname && mapname!=""
  371. memo+=sprintf("<c3=000000,efe4b0>%s\n",mapname)
  372. else
  373. memo+=_INTL("<c3=000000,efe4b0>Faraway place\n")
  374. end
  375. if pokemon.obtainMode
  376. mettext=[_INTL("Met at Lv. {1}.",pokemon.obtainLevel),
  377. _INTL("Egg received."),
  378. _INTL("Traded at Lv. {1}.",pokemon.obtainLevel),
  379. "",
  380. _INTL("Had a fateful encounter at Lv. {1}.",pokemon.obtainLevel)
  381. ][pokemon.obtainMode]
  382. memo+=sprintf("<c3=000000,efe4b0>%s\n",mettext)
  383. if pokemon.obtainMode==1 # hatched
  384. if pokemon.timeEggHatched
  385. month=pbGetAbbrevMonthName(pokemon.timeEggHatched.mon)
  386. date=pokemon.timeEggHatched.day
  387. year=pokemon.timeEggHatched.year
  388. memo+=_INTL("<c3=000000,efe4b0>{1} {2}, {3}\n",month,date,year)
  389. end
  390. mapname=pbGetMapNameFromId(pokemon.hatchedMap)
  391. if mapname && mapname!=""
  392. memo+=sprintf("<c3=000000,efe4b0>%s\n",mapname)
  393. else
  394. memo+=_INTL("<c3=000000,efe4b0>Faraway place\n")
  395. end
  396. memo+=_INTL("<c3=000000,efe4b0>Egg hatched.\n")
  397. else
  398. memo+="<c3=000000,efe4b0>\n"
  399. end
  400. end
  401. if shownature
  402. bestiv=0
  403. tiebreaker=pokemon.personalID%6
  404. for i in 0...6
  405. if pokemon.iv[i]==pokemon.iv[bestiv]
  406. bestiv=i if i>=tiebreaker && bestiv<tiebreaker
  407. elsif pokemon.iv[i]>pokemon.iv[bestiv]
  408. bestiv=i
  409. end
  410. end
  411. characteristic=[_INTL("Loves to eat."),
  412. _INTL("Often dozes off."),
  413. _INTL("Often scatters things."),
  414. _INTL("Scatters things often."),
  415. _INTL("Likes to relax."),
  416. _INTL("Proud of its power."),
  417. _INTL("Likes to thrash about."),
  418. _INTL("A little quick tempered."),
  419. _INTL("Likes to fight."),
  420. _INTL("Quick tempered."),
  421. _INTL("Sturdy body."),
  422. _INTL("Capable of taking hits."),
  423. _INTL("Highly persistent."),
  424. _INTL("Good endurance."),
  425. _INTL("Good perseverance."),
  426. _INTL("Likes to run."),
  427. _INTL("Alert to sounds."),
  428. _INTL("Impetuous and silly."),
  429. _INTL("Somewhat of a clown."),
  430. _INTL("Quick to flee."),
  431. _INTL("Highly curious."),
  432. _INTL("Mischievous."),
  433. _INTL("Thoroughly cunning."),
  434. _INTL("Often lost in thought."),
  435. _INTL("Very finicky."),
  436. _INTL("Strong willed."),
  437. _INTL("Somewhat vain."),
  438. _INTL("Strongly defiant."),
  439. _INTL("Hates to lose."),
  440. _INTL("Somewhat stubborn.")
  441. ][bestiv*5+pokemon.iv[bestiv]%5]
  442. memo+=sprintf("<c3=000000,efe4b0>%s\n",characteristic)
  443. end
  444. drawFormattedTextEx(overlay,232,78,276,memo)
  445. drawMarkings(overlay,440,4,72,20,pokemon.markings)
  446. end
  447.  
  448. def drawPageThree(pokemon)
  449. overlay=@sprites["overlay"].bitmap
  450. overlay.clear
  451. @sprites["background"].setBitmap("Graphics/Pictures/BrassSummary3")
  452. imagepos=[]
  453. if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
  454. status=6 if pbPokerus(pokemon)==1
  455. [email protected] if @pokemon.status>0
  456. status=5 if pokemon.hp==0
  457. imagepos.push(["Graphics/Pictures/statuses",120,230,0,16*status,44,16])
  458. end
  459. if pokemon.isShiny?
  460. imagepos.push([sprintf("Graphics/Pictures/shiny"),6,76,0,0,-1,-1])
  461. end
  462. if pbPokerus(pokemon)==2
  463. imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),414,6,0,0,-1,-1])
  464. end
  465. [email protected] ? @pokemon.ballused : 0
  466. ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
  467. imagepos.push([ballimage,36,286,0,0,-1,-1])
  468. pbDrawImagePositions(overlay,imagepos)
  469. base=Color.new(0,0,0)
  470. shadow=Color.new(104,104,104)
  471. white=Color.new(248,248,248)
  472. green=Color.new(136,248,104)
  473. statshadows=[]
  474. for i in 0...5; statshadows[i]=shadow; end
  475. if !(pokemon.isShadow? rescue false) || pokemon.heartStage<=3
  476. natup=(pokemon.nature/5).floor
  477. natdn=(pokemon.nature%5).floor
  478. statshadows[natup]=Color.new(136,96,72) if natup!=natdn
  479. statshadows[natdn]=Color.new(64,120,152) if natup!=natdn
  480. end
  481. pbSetSystemFont(overlay)
  482. naturename=PBNatures.getName(pokemon.nature)
  483. # Left side of the Summary Screen
  484. # Colours are base, white
  485. # To center text on this side, make sure X is 84 and the third numb is 2
  486. textpos=[
  487. [_INTL("SKILLS"),84,2,2,base,white],
  488. [pokename,84,34,2,base,white],
  489. [_INTL("Lv {1}",pokemon.level.to_s),74,286,0,base,white]]
  490. if pokemon.hasItem?
  491. textpos.push([PBItems.getName(pokemon.item),84,254,2,base,white])
  492. else
  493. textpos.push([_INTL("NONE"),62,254,0,base,white])
  494. end
  495. if pokemon.isMale?
  496. textpos.push([_INTL("♂"),6,222,0,Color.new(120,96,240),Color.new(248,248,248)])
  497. elsif pokemon.isFemale?
  498. textpos.push([_INTL("♀"),6,222,0,Color.new(248,56,8),Color.new(248,248,248)])
  499. end
  500. pbDrawTextPositions(overlay,textpos)
  501. ######
  502. pbSetSystemFont(overlay)
  503. abilityname=PBAbilities.getName(pokemon.ability)
  504. abilitydesc=pbGetMessage(MessageTypes::AbilityDescs,pokemon.ability)
  505. textpos=[
  506. [_INTL("HP"),280,50,2,base,shadow],
  507. [sprintf("%3d/%3d",pokemon.hp,pokemon.totalhp),462,76,1,Color.new(64,64,64),Color.new(176,176,176)],
  508. [_INTL("Attack"),248,120,0,base,statshadows[0]],
  509. [sprintf("%d",pokemon.attack),280,80,1,Color.new(64,64,64),Color.new(176,176,176)],
  510. [_INTL("Defense"),248,152,0,base,statshadows[1]],
  511. [sprintf("%d",pokemon.defense),456,152,1,Color.new(64,64,64),Color.new(176,176,176)],
  512. [_INTL("Sp. Atk"),248,184,0,base,statshadows[3]],
  513. [sprintf("%d",pokemon.spatk),456,184,1,Color.new(64,64,64),Color.new(176,176,176)],
  514. [_INTL("Sp. Def"),248,216,0,base,statshadows[4]],
  515. [sprintf("%d",pokemon.spdef),456,216,1,Color.new(64,64,64),Color.new(176,176,176)],
  516. [_INTL("Speed"),248,248,0,base,statshadows[2]],
  517. [sprintf("%d",pokemon.speed),456,248,1,Color.new(64,64,64),Color.new(176,176,176)],
  518. [_INTL("Ability"),224,284,0,base,shadow],
  519. [abilityname,362,284,0,Color.new(64,64,64),Color.new(176,176,176)],
  520. ]
  521. pbDrawTextPositions(overlay,textpos)
  522. drawTextEx(overlay,224,316,282,2,abilitydesc,Color.new(64,64,64),Color.new(176,176,176))
  523. drawMarkings(overlay,440,4,72,20,pokemon.markings)
  524. if pokemon.hp>0
  525. hpcolors=[
  526. Color.new(24,192,32),Color.new(0,144,0), # Green
  527. Color.new(248,184,0),Color.new(184,112,0), # Orange
  528. Color.new(240,80,32),Color.new(168,48,56) # Red
  529. ]
  530. # hpzone=0
  531. # hpzone=1 if pokemon.hp<=(@pokemon.totalhp/2).floor
  532. # hpzone=2 if pokemon.hp<=(@pokemon.totalhp/4).floor
  533. # overlay.fill_rect(360,110,pokemon.hp*96/pokemon.totalhp,2,hpcolors[hpzone*2+1])
  534. # overlay.fill_rect(360,112,pokemon.hp*96/pokemon.totalhp,4,hpcolors[hpzone*2])
  535. end
  536. end
  537.  
  538. def drawPageFour(pokemon)
  539. overlay=@sprites["overlay"].bitmap
  540. overlay.clear
  541. @sprites["background"].setBitmap("Graphics/Pictures/BrassSummary4")
  542. imagepos=[]
  543. if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
  544. status=6 if pbPokerus(pokemon)==1
  545. [email protected] if @pokemon.status>0
  546. status=5 if pokemon.hp==0
  547. imagepos.push(["Graphics/Pictures/statuses",120,230,0,16*status,44,16])
  548. end
  549. if pokemon.isShiny?
  550. imagepos.push([sprintf("Graphics/Pictures/shiny"),6,76,0,0,-1,-1])
  551. end
  552. if pbPokerus(pokemon)==2
  553. imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),414,6,0,0,-1,-1])
  554. end
  555. [email protected] ? @pokemon.ballused : 0
  556. ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
  557. imagepos.push([ballimage,36,286,0,0,-1,-1])
  558. pbDrawImagePositions(overlay,imagepos)
  559. base=Color.new(0,0,0)
  560. shadow=Color.new(104,104,104)
  561. white=Color.new(248,248,248)
  562. green=Color.new(136,248,104)
  563. pbSetSystemFont(overlay)
  564. naturename=PBNatures.getName(pokemon.nature)
  565. # Left side of the Summary Screen
  566. # Colours are base, white
  567. # To center text on this side, make sure X is 84 and the third numb is 2
  568. textpos=[
  569. [_INTL("MOVES"),84,2,2,base,white],
  570. [pokename,84,34,2,base,white],
  571. [_INTL("Lv {1}",pokemon.level.to_s),74,286,0,base,white]]
  572. if pokemon.hasItem?
  573. textpos.push([PBItems.getName(pokemon.item),84,254,2,base,white])
  574. else
  575. textpos.push([_INTL("NONE"),62,254,0,base,white])
  576. end
  577. if pokemon.isMale?
  578. textpos.push([_INTL("♂"),6,222,0,Color.new(120,96,240),Color.new(248,248,248)])
  579. elsif pokemon.isFemale?
  580. textpos.push([_INTL("♀"),6,222,0,Color.new(248,56,8),Color.new(248,248,248)])
  581. end
  582. pbDrawTextPositions(overlay,textpos)
  583. imagepos=[]
  584. yPos=98
  585. for i in 0...pokemon.moves.length
  586. if pokemon.moves[i].id>0
  587. imagepos.push(["Graphics/Pictures/types",248,yPos+2,0,
  588. pokemon.moves[i].type*28,64,28])
  589. textpos.push([PBMoves.getName(pokemon.moves[i].id),316,yPos,0,
  590. Color.new(64,64,64),Color.new(176,176,176)])
  591. if pokemon.moves[i].totalpp>0
  592. textpos.push([_ISPRINTF("PP"),342,yPos+32,0,
  593. Color.new(64,64,64),Color.new(176,176,176)])
  594. textpos.push([sprintf("%d/%d",pokemon.moves[i].pp,pokemon.moves[i].totalpp),
  595. 460,yPos+32,1,Color.new(64,64,64),Color.new(176,176,176)])
  596. end
  597. else
  598. textpos.push(["-",316,yPos,0,Color.new(64,64,64),Color.new(176,176,176)])
  599. textpos.push(["--",442,yPos+32,1,Color.new(64,64,64),Color.new(176,176,176)])
  600. end
  601. yPos+=64
  602. end
  603. pbDrawTextPositions(overlay,textpos)
  604. pbDrawImagePositions(overlay,imagepos)
  605. drawMarkings(overlay,440,4,72,20,pokemon.markings)
  606. end
  607.  
  608. def drawSelectedMove(pokemon,moveToLearn,moveid)
  609. overlay=@sprites["overlay"].bitmap
  610. @sprites["pokemon"].visible=false if @sprites["pokemon"]
  611. @sprites["pokeicon"].setBitmap(pbPokemonIconFile(pokemon))
  612. @sprites["pokeicon"].src_rect=Rect.new(0,0,64,64)
  613. @sprites["pokeicon"].visible=true
  614. movedata=PBMoveData.new(moveid)
  615. basedamage=movedata.basedamage
  616. type=movedata.type
  617. category=movedata.category
  618. accuracy=movedata.accuracy
  619. drawMoveSelection(pokemon,moveToLearn)
  620. pbSetSystemFont(overlay)
  621. move=moveid
  622. textpos=[
  623. [basedamage<=1 ? basedamage==1 ? "???" : "---" : sprintf("%d",basedamage),
  624. 216,154,1,Color.new(64,64,64),Color.new(176,176,176)],
  625. [accuracy==0 ? "---" : sprintf("%d",accuracy),
  626. 216,186,1,Color.new(64,64,64),Color.new(176,176,176)]
  627. ]
  628. pbDrawTextPositions(overlay,textpos)
  629. imagepos=[["Graphics/Pictures/category",166,124,0,category*28,64,28]]
  630. pbDrawImagePositions(overlay,imagepos)
  631. drawTextEx(overlay,4,218,238,5,
  632. pbGetMessage(MessageTypes::MoveDescriptions,moveid),
  633. Color.new(64,64,64),Color.new(176,176,176))
  634. end
  635.  
  636. def drawMoveSelection(pokemon,moveToLearn)
  637. overlay=@sprites["overlay"].bitmap
  638. overlay.clear
  639. base=Color.new(248,248,248)
  640. shadow=Color.new(104,104,104)
  641. @sprites["background"].setBitmap("Graphics/Pictures/BrassSummary4Details")
  642. if moveToLearn!=0
  643. @sprites["background"].setBitmap("Graphics/Pictures/BrassSummary4Learning")
  644. end
  645. pbSetSystemFont(overlay)
  646. textpos=[
  647. [_INTL("MOVES"),26,16,0,base,shadow],
  648. [_INTL("CATEGORY"),20,122,0,base,shadow],
  649. [_INTL("POWER"),20,154,0,base,shadow],
  650. [_INTL("ACCURACY"),20,186,0,base,shadow]
  651. ]
  652. type1rect=Rect.new(0,pokemon.type1*28,64,28)
  653. type2rect=Rect.new(0,pokemon.type2*28,64,28)
  654. if pokemon.type1==pokemon.type2
  655. overlay.blt(130,78,@typebitmap.bitmap,type1rect)
  656. else
  657. overlay.blt(96,78,@typebitmap.bitmap,type1rect)
  658. overlay.blt(166,78,@typebitmap.bitmap,type2rect)
  659. end
  660. imagepos=[]
  661. yPos=98
  662. yPos-=76 if moveToLearn!=0
  663. for i in 0...5
  664. moveobject=nil
  665. if i==4
  666. moveobject=PBMove.new(moveToLearn) if moveToLearn!=0
  667. yPos+=20
  668. else
  669. moveobject=pokemon.moves[i]
  670. end
  671. if moveobject
  672. if moveobject.id!=0
  673. imagepos.push(["Graphics/Pictures/types",248,yPos+2,0,
  674. moveobject.type*28,64,28])
  675. textpos.push([PBMoves.getName(moveobject.id),316,yPos,0,
  676. Color.new(64,64,64),Color.new(176,176,176)])
  677. if moveobject.totalpp>0
  678. textpos.push([_ISPRINTF("PP"),342,yPos+32,0,
  679. Color.new(64,64,64),Color.new(176,176,176)])
  680. textpos.push([sprintf("%d/%d",moveobject.pp,moveobject.totalpp),
  681. 460,yPos+32,1,Color.new(64,64,64),Color.new(176,176,176)])
  682. end
  683. else
  684. textpos.push(["-",316,yPos,0,Color.new(64,64,64),Color.new(176,176,176)])
  685. textpos.push(["--",442,yPos+32,1,Color.new(64,64,64),Color.new(176,176,176)])
  686. end
  687. end
  688. yPos+=64
  689. end
  690. pbDrawTextPositions(overlay,textpos)
  691. pbDrawImagePositions(overlay,imagepos)
  692. end
  693.  
  694. def drawPageFive(pokemon)
  695. overlay=@sprites["overlay"].bitmap
  696. overlay.clear
  697. @sprites["background"].setBitmap("Graphics/Pictures/BrassSummary5")
  698. imagepos=[]
  699. if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
  700. status=6 if pbPokerus(pokemon)==1
  701. [email protected] if @pokemon.status>0
  702. status=5 if pokemon.hp==0
  703. imagepos.push(["Graphics/Pictures/statuses",120,230,0,16*status,44,16])
  704. end
  705. if pokemon.isShiny?
  706. imagepos.push([sprintf("Graphics/Pictures/shiny"),6,76,0,0,-1,-1])
  707. end
  708. if pbPokerus(pokemon)==2
  709. imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),414,6,0,0,-1,-1])
  710. end
  711. [email protected] ? @pokemon.ballused : 0
  712. ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
  713. imagepos.push([ballimage,36,286,0,0,-1,-1])
  714. pbDrawImagePositions(overlay,imagepos)
  715. base=Color.new(0,0,0)
  716. shadow=Color.new(104,104,104)
  717. white=Color.new(248,248,248)
  718. green=Color.new(136,248,104)
  719. pbSetSystemFont(overlay)
  720. naturename=PBNatures.getName(pokemon.nature)
  721. # Left side of the Summary Screen
  722. # Colours are base, white
  723. # To center text on this side, make sure X is 84 and the third numb is 2
  724. textpos=[
  725. [_INTL("RIBBONS"),84,2,2,base,white],
  726. [pokename,84,34,2,base,white],
  727. [_INTL("Lv {1}",pokemon.level.to_s),74,286,0,base,white]]
  728. if pokemon.hasItem?
  729. textpos.push([PBItems.getName(pokemon.item),84,254,2,base,white])
  730. else
  731. textpos.push([_INTL("NONE"),62,254,0,base,white])
  732. end
  733. if pokemon.isMale?
  734. textpos.push([_INTL("♂"),6,222,0,Color.new(120,96,240),Color.new(248,248,248)])
  735. elsif pokemon.isFemale?
  736. textpos.push([_INTL("♀"),6,222,0,Color.new(248,56,8),Color.new(248,248,248)])
  737. end
  738. pbDrawTextPositions(overlay,textpos)
  739. textpos=[
  740. [_INTL("No. of Ribbons:"),234,342,0,Color.new(64,64,64),Color.new(176,176,176)],
  741. [pokemon.ribbonCount.to_s,450,342,1,Color.new(64,64,64),Color.new(176,176,176)],
  742. ]
  743. pbDrawTextPositions(overlay,textpos)
  744. imagepos=[]
  745. coord=0
  746. if pokemon.ribbons
  747. for i in pokemon.ribbons
  748. ribn=i-1
  749. imagepos.push(["Graphics/Pictures/ribbons",236+64*(coord%4),86+80*(coord/4).floor,
  750. 64*(ribn%8),64*(ribn/8).floor,64,64])
  751. coord+=1
  752. break if coord>=12
  753. end
  754. end
  755. pbDrawImagePositions(overlay,imagepos)
  756. drawMarkings(overlay,440,4,72,20,pokemon.markings)
  757. end
  758.  
  759. def pbChooseMoveToForget(moveToLearn)
  760. selmove=0
  761. ret=0
  762. maxmove=(moveToLearn>0) ? 4 : 3
  763. loop do
  764. Graphics.update
  765. Input.update
  766. pbUpdate
  767. if Input.trigger?(Input::B)
  768. ret=4
  769. break
  770. end
  771. if Input.trigger?(Input::C)
  772. break
  773. end
  774. if Input.trigger?(Input::DOWN)
  775. selmove+=1
  776. if selmove<4 && selmove>[email protected]
  777. selmove=(moveToLearn>0) ? maxmove : 0
  778. end
  779. selmove=0 if selmove>maxmove
  780. @sprites["movesel"].index=selmove
  781. newmove=(selmove==4) ? moveToLearn : @pokemon.moves[selmove].id
  782. drawSelectedMove(@pokemon,moveToLearn,newmove)
  783. ret=selmove
  784. end
  785. if Input.trigger?(Input::UP)
  786. selmove-=1
  787. selmove=maxmove if selmove<0
  788. if selmove<4 && selmove>[email protected]
  789. end
  790. @sprites["movesel"].index=selmove
  791. newmove=(selmove==4) ? moveToLearn : @pokemon.moves[selmove].id
  792. drawSelectedMove(@pokemon,moveToLearn,newmove)
  793. ret=selmove
  794. end
  795. end
  796. return (ret==4) ? -1 : ret
  797. end
  798.  
  799. def pbMoveSelection
  800. @sprites["movesel"].visible=true
  801. @sprites["movesel"].index=0
  802. selmove=0
  803. oldselmove=0
  804. switching=false
  805. drawSelectedMove(@pokemon,0,@pokemon.moves[selmove].id)
  806. loop do
  807. Graphics.update
  808. Input.update
  809. pbUpdate
  810. if @sprites["movepresel"].index==@sprites["movesel"].index
  811. @sprites["movepresel"].z=@sprites["movesel"].z+1
  812. else
  813. @sprites["movepresel"].z=@sprites["movesel"].z
  814. end
  815. if Input.trigger?(Input::B)
  816. break if !switching
  817. @sprites["movepresel"].visible=false
  818. switching=false
  819. end
  820. if Input.trigger?(Input::C)
  821. if selmove==4
  822. break if !switching
  823. @sprites["movepresel"].visible=false
  824. switching=false
  825. else
  826. if !(@pokemon.isShadow? rescue false)
  827. if !switching
  828. @sprites["movepresel"].index=selmove
  829. oldselmove=selmove
  830. @sprites["movepresel"].visible=true
  831. switching=true
  832. else
  833. [email protected][oldselmove]
  834. @pokemon.moves[oldselmove][email protected][selmove]
  835. @pokemon.moves[selmove]=tmpmove
  836. @sprites["movepresel"].visible=false
  837. switching=false
  838. drawSelectedMove(@pokemon,0,@pokemon.moves[selmove].id)
  839. end
  840. end
  841. end
  842. end
  843. if Input.trigger?(Input::DOWN)
  844. selmove+=1
  845. selmove=0 if selmove<4 && selmove>[email protected]
  846. selmove=0 if selmove>=4
  847. selmove=4 if selmove<0
  848. @sprites["movesel"].index=selmove
  849. [email protected][selmove].id
  850. pbPlayCursorSE()
  851. drawSelectedMove(@pokemon,0,newmove)
  852. end
  853. if Input.trigger?(Input::UP)
  854. selmove-=1
  855. if selmove<4 && selmove>[email protected]
  856. end
  857. selmove=0 if selmove>=4
  858. [email protected] if selmove<0
  859. @sprites["movesel"].index=selmove
  860. [email protected][selmove].id
  861. pbPlayCursorSE()
  862. drawSelectedMove(@pokemon,0,newmove)
  863. end
  864. end
  865. @sprites["movesel"].visible=false
  866. end
  867.  
  868. def pbGoToPrevious
  869. if @page!=0
  870. newindex=@partyindex
  871. while newindex>0
  872. newindex-=1
  873. if @party[newindex] && !@party[newindex].isEgg?
  874. @partyindex=newindex
  875. break
  876. end
  877. end
  878. else
  879. newindex=@partyindex
  880. while newindex>0
  881. newindex-=1
  882. if @party[newindex]
  883. @partyindex=newindex
  884. break
  885. end
  886. end
  887. end
  888. end
  889.  
  890. def pbGoToNext
  891. if @page!=0
  892. newindex=@partyindex
  893. while newindex<@party.length-1
  894. newindex+=1
  895. if @party[newindex] && !@party[newindex].isEgg?
  896. @partyindex=newindex
  897. break
  898. end
  899. end
  900. else
  901. newindex=@partyindex
  902. while newindex<@party.length-1
  903. newindex+=1
  904. if @party[newindex]
  905. @partyindex=newindex
  906. break
  907. end
  908. end
  909. end
  910. end
  911.  
  912. def pbScene
  913. pbPlayCry(@pokemon)
  914. loop do
  915. Graphics.update
  916. Input.update
  917. pbUpdate
  918. if Input.trigger?(Input::B)
  919. break
  920. end
  921. dorefresh=false
  922. if Input.trigger?(Input::C)
  923. if @page==0
  924. break
  925. elsif @page==3
  926. pbMoveSelection
  927. dorefresh=true
  928. drawPageFour(@pokemon)
  929. end
  930. end
  931. if Input.trigger?(Input::UP) && @partyindex>0
  932. oldindex=@partyindex
  933. pbGoToPrevious
  934. if @partyindex!=oldindex
  935. @pokemon=@party[@partyindex]
  936. @sprites["pokemon"].setPokemonBitmap(@pokemon)
  937. @sprites["pokemon"].color=Color.new(0,0,0,0)
  938. pbPositionPokemonSprite(@sprites["pokemon"],40,144)
  939. dorefresh=true
  940. pbPlayCry(@pokemon)
  941. end
  942. end
  943. if Input.trigger?(Input::DOWN) && @partyindex<@party.length-1
  944. oldindex=@partyindex
  945. pbGoToNext
  946. if @partyindex!=oldindex
  947. @pokemon=@party[@partyindex]
  948. @sprites["pokemon"].setPokemonBitmap(@pokemon)
  949. @sprites["pokemon"].color=Color.new(0,0,0,0)
  950. pbPositionPokemonSprite(@sprites["pokemon"],40,144)
  951. dorefresh=true
  952. pbPlayCry(@pokemon)
  953. end
  954. end
  955. if Input.trigger?(Input::LEFT) && [email protected]?
  956. oldpage=@page
  957. @page-=1
  958. @page=0 if @page<0
  959. @page=4 if @page>4
  960. dorefresh=true
  961. if @page!=oldpage # Move to next page
  962. pbPlayCursorSE()
  963. dorefresh=true
  964. end
  965. end
  966. if Input.trigger?(Input::RIGHT) && [email protected]?
  967. oldpage=@page
  968. @page+=1
  969. @page=0 if @page<0
  970. @page=4 if @page>4
  971. if @page!=oldpage # Move to next page
  972. pbPlayCursorSE()
  973. dorefresh=true
  974. end
  975. end
  976. if dorefresh
  977. case @page
  978. when 0
  979. drawPageOne(@pokemon)
  980. when 1
  981. drawPageTwo(@pokemon)
  982. when 2
  983. drawPageThree(@pokemon)
  984. when 3
  985. drawPageFour(@pokemon)
  986. when 4
  987. drawPageFive(@pokemon)
  988. end
  989. end
  990. end
  991. return @partyindex
  992. end
  993. end
  994.  
  995.  
  996.  
  997. class PokemonSummary
  998. def initialize(scene)
  999. @scene=scene
  1000. end
  1001.  
  1002. def pbStartScreen(party,partyindex)
  1003. @scene.pbStartScene(party,partyindex)
  1004. @scene.pbEndScene
  1005. return ret
  1006. end
  1007.  
  1008. def pbStartForgetScreen(party,partyindex,moveToLearn)
  1009. ret=-1
  1010. @scene.pbStartForgetScene(party,partyindex,moveToLearn)
  1011. loop do
  1012. [email protected](moveToLearn)
  1013. if ret>=0 && moveToLearn!=0 && pbIsHiddenMove?(party[partyindex].moves[ret].id) && !$DEBUG
  1014. Kernel.pbMessage(_INTL("HM moves can't be forgotten now.")){ @scene.pbUpdate }
  1015. else
  1016. break
  1017. end
  1018. end
  1019. @scene.pbEndScene
  1020. return ret
  1021. end
  1022.  
  1023. def pbStartChooseMoveScreen(party,partyindex,message)
  1024. ret=-1
  1025. @scene.pbStartForgetScene(party,partyindex,0)
  1026. Kernel.pbMessage(message){ @scene.pbUpdate }
  1027. loop do
  1028. if ret<0
  1029. Kernel.pbMessage(_INTL("You must choose a move!")){ @scene.pbUpdate }
  1030. else
  1031. break
  1032. end
  1033. end
  1034. @scene.pbEndScene
  1035. return ret
  1036. end
  1037. end
Advertisement
Add Comment
Please, Sign In to add comment