Advertisement
Umbreonboy2

Zodiacos 1

Oct 9th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 167.86 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Pokémon Birthsigns - By Lucidious89
  4. # For -Pokémon Essentials-
  5. #
  6. #===============================================================================
  7. # This script intends to add a new mechanic known as "Birthsigns" to
  8. # Pokémon breeding. Each month of the year corresponds to a different sign,
  9. # and a Pokémon born under these signs will be infused with their bonuses.
  10. #
  11. # These scripts add 24 unique Birthsigns to choose from that come in two
  12. # sets of 12.
  13. #
  14. # You can swap between the two sets by setting "BIRTHSIGNS_SET_2" below to
  15. # true or false.
  16. #
  17. # You may also add a Birthsign to a Pokémon manually through scripts,
  18. # events, or through the debug menu on the party screen.
  19. #===============================================================================
  20. # ~Installation~
  21. #===============================================================================
  22. # To install, insert a new section above Main, and paste this there. Name
  23. # this new section "PokemonBirthsigns". This is a plug-n-play addition, and
  24. # doesn't require any other changes.
  25. #
  26. # However, several areas of the default scripts are overwritten here to
  27. # allow Pokémon Birthsigns to work. So it's recommended that this be
  28. # installed in a fresh copy of Essentials.
  29. #
  30. # These overwritten sections include:
  31. # -PField_Time
  32. # -PokeBattle_Pokemon
  33. # -PScreen_Party
  34. # -PScreen_Summary
  35. # -PField_DayCare
  36. # -PScreen_EggHatching
  37. # -PokeBattle_Battle
  38. # -PField_Field
  39. # -PScreen_Storage
  40. #
  41. # Add-Ons and optional scripts to further enhance Pokemon Birthsigns:
  42. #===========================================#
  43. # PBRibbons Update (for 'The Eternal' sign) #
  44. #===========================================#
  45. # http://pastebin.com/raw/fDZVLFnm #
  46. #===========================================#
  47. # Birthsigns Journal Script #
  48. #===========================================#
  49. # http://pastebin.com/raw/XqQTbPcF #
  50. #===========================================#
  51. # Birthsign Events Script #
  52. #===========================================#
  53. # http://pastebin.com/raw/2GKL2P6f #
  54. #===========================================#
  55. #
  56. # Links to required graphics:
  57. #===========================================#
  58. # Birthsigns graphics #
  59. #===========================================#
  60. # https://www.dropbox.com/sh/kyrxchab1hsu8m5/AAAFVCHiMtsBnkk-zLFiPhAba?dl=0
  61. #===========================================#
  62. # New Ribbons graphic #
  63. #===========================================#
  64. # https://www.dropbox.com/s/ln0opj4s5ck6cnq/ribbons.png?dl=0
  65. #
  66. #===============================================================================
  67. # ~Navigation~
  68. #===============================================================================
  69. # Since so many areas of the script must be overwritten, this script is
  70. # very long. To make navigating it easier, I've made added commented out
  71. # markers to quickly jump around the script using CTRL+F.
  72. #
  73. # They are as follows:
  74. # #TAG1 - Birthsign Set switch (true/false) && Set birthsign names
  75. # #TAG2 - Birthsign names (hatched)
  76. # #TAG3 - Birthsign names (manual)
  77. # #TAG4 - Birthsign descriptions (both hatched & manual)
  78. # #TAG5 - Birthsign values (manual)
  79. # #TAG6 - Various methods (for use in scripts or events)
  80. # #TAG7 - Birthsign Bonuses (passive buffs)
  81. # #TAG8 - Birthsign Bonuses (battle effects)
  82. # #TAG9 - Birthsign Bonuses (command options)
  83. # #TAG10- Birthsign definitions
  84. # #TAG11- Debug Menu (party screen)
  85. # #TAG12- Debug Menu (storage screen)
  86. # #TAG13- Summary Screen revamps
  87. # #TAG14- PC Storage Screen revamps
  88. # #TAG15- 'The Ancestor' Effect (alters egg steps)
  89. # #TAG16- 'The Assassin' Effect (alters odds of sleeping encounters)
  90. # #TAG17- 'The Scholar' Effect (alters bonus exp yield)
  91. # #TAG18- 'The Aristocrat' Effect (alters amount of bonus money)
  92. # #TAG19- 'The Hunter' Effect (alters capture rate)
  93. # #TAG20- 'The Specialist' Effect (change Hidden Power spreads)
  94. #
  95. #===============================================================================
  96. # Everything below is written for Pokémon Essentials v.16.1
  97. #===============================================================================
  98.  
  99.  
  100. #########[SECTION 1]##########
  101. #===============================================================================
  102. # Toggles between Birthsign set 1 (false) or 2 (true).
  103. # #TAG1
  104. #===============================================================================
  105. BIRTHSIGNS_SET_2 = false
  106.  
  107. #===============================================================================
  108. # Sets the names for each of the birthsigns. If you want to change the name
  109. # of a birthsign, you may do so here.
  110. # The rest of the script will recognize whatever name you enter here, along
  111. # with the Birthsigns Journal and Birthsign Events scripts.
  112. #===============================================================================
  113. if !BIRTHSIGNS_SET_2
  114. # Names for Set 1
  115. JAN_BIRTHSIGN = _INTL("'El Aprendiz'")
  116. FEB_BIRTHSIGN = _INTL("'El Acompañante'")
  117. MAR_BIRTHSIGN = _INTL("'El Iluminado'")
  118. APR_BIRTHSIGN = _INTL("'El Salvaje'")
  119. MAY_BIRTHSIGN = _INTL("'El Prodigio'")
  120. JUN_BIRTHSIGN = _INTL("'El Martir'")
  121. JUL_BIRTHSIGN = _INTL("'El Sirviente'")
  122. AUG_BIRTHSIGN = _INTL("'El Gladiador'")
  123. SEP_BIRTHSIGN = _INTL("'El Viajero'")
  124. OCT_BIRTHSIGN = _INTL("'El Ladrón'")
  125. NOV_BIRTHSIGN = _INTL("'El Gloton'")
  126. DEC_BIRTHSIGN = _INTL("'El Genio'")
  127. else
  128. # Names for Set 2
  129. JAN_BIRTHSIGN = _INTL("'The Phoenix'")
  130. FEB_BIRTHSIGN = _INTL("'The Scholar'")
  131. MAR_BIRTHSIGN = _INTL("'The Fugitive'")
  132. APR_BIRTHSIGN = _INTL("'The Aristocrat'")
  133. MAY_BIRTHSIGN = _INTL("'The Cleric'")
  134. JUN_BIRTHSIGN = _INTL("'The Monk'")
  135. JUL_BIRTHSIGN = _INTL("'The Ancestor'")
  136. AUG_BIRTHSIGN = _INTL("'The Specialist'")
  137. SEP_BIRTHSIGN = _INTL("'The Assassin'")
  138. OCT_BIRTHSIGN = _INTL("'The Parent'")
  139. NOV_BIRTHSIGN = _INTL("'The Hunter'")
  140. DEC_BIRTHSIGN = _INTL("'The Eternal'")
  141. end
  142.  
  143. #===============================================================================
  144. # New Zodiac
  145. #===============================================================================
  146. # Overwrites the default zodiac in PField_Time.
  147. #===============================================================================
  148. def zodiac(month,day)
  149. time=[
  150. 1,1,1,31, # The Apprentice || The Phoenix
  151. 2,1,2,28, # The Companion || The Scholar
  152. 3,1,3,31, # The Beacon || The Fugitive
  153. 4,1,4,30, # The Savage || The Aristocrat
  154. 5,1,5,31, # The Prodigy || The Cleric
  155. 6,1,6,30, # The Martyr || The Monk
  156. 7,1,7,31, # The Maiden || The Ancestor
  157. 8,1,8,31, # The Gladiator || The Specialist
  158. 9,1,9,30, # The Voyager || The Assassin
  159. 10,1,10,31, # The Thief || The Parent
  160. 11,1,11,30, # The Glutton || The Hunter
  161. 12,1,12,31 # The Wishmaker || The Eternal
  162. ]
  163. for i in 0...12
  164. return i if month==time[i*4] && day>=time[i*4+1]
  165. return i if month==time[i*4+2] && day<=time[i*4+2]
  166. end
  167. return 0
  168. end
  169.  
  170. def zodiacValue(sign)
  171. return (sign)%13
  172. end
  173.  
  174. #===============================================================================
  175. # Birthsigns Zodiac - Names
  176. #===============================================================================
  177. # Calls the birthsign names set for hatched Pokemon. These names may be
  178. # altered near the top of this script.
  179. # #TAG2
  180. #===============================================================================
  181. def pbGetZodiacName(sign)
  182. return [_INTL(""), # Null
  183. JAN_BIRTHSIGN, # The Apprentice || The Phoenix
  184. FEB_BIRTHSIGN, # The Companion || The Scholar
  185. MAR_BIRTHSIGN, # The Beacon || The Fugitive
  186. APR_BIRTHSIGN, # The Savage || The Aristocrat
  187. MAY_BIRTHSIGN, # The Prodigy || The Cleric
  188. JUN_BIRTHSIGN, # The Martyr || The Monk
  189. JUL_BIRTHSIGN, # The Maiden || The Ancestor
  190. AUG_BIRTHSIGN, # The Gladiator || The Specialist
  191. SEP_BIRTHSIGN, # The Voyager || The Assassin
  192. OCT_BIRTHSIGN, # The Thief || The Parent
  193. NOV_BIRTHSIGN, # The Glutton || The Hunter
  194. DEC_BIRTHSIGN][sign] # The Wishmaker || The Eternal
  195. end
  196.  
  197. #===============================================================================
  198. # Birthsigns Zodiac - Descriptions
  199. # #TAG5
  200. #===============================================================================
  201. def pbGetZodiacDesc(sign)
  202. if !BIRTHSIGNS_SET_2
  203. # Set 1
  204. return [_INTL(""),
  205. _INTL("The Pokémon starts off immunized to Pokérus."),
  206. _INTL("The Pokémon has the highest affection for its trainer."),
  207. _INTL("The Pokémon may use Flash without the move."),
  208. _INTL("The Pokémon has max IV's in offense & speed, but 0 HP."),
  209. _INTL("The Pokémon always has its Hidden Ability, if available."),
  210. _INTL("The Pokémon may use Soft-Boiled without the move."),
  211. _INTL("The Pokémon will always be female, if possible."),
  212. _INTL("The Pokémon starts off with 100 EV's in Atk & Sp.Atk."),
  213. _INTL("The Pokémon may use Teleport without the move."),
  214. _INTL("The Pokémon starts off with maximum EV's in speed."),
  215. _INTL("The Pokémon has max IV's in defenses & HP, but 0 speed."),
  216. _INTL("The Pokémon is always shiny.")][sign]
  217. else
  218. # Set 2
  219. return [_INTL(""),
  220. _INTL("The Pokémon may revive itself from the party menu."),
  221. _INTL("The Pokémon gains 20% more exp. points from battles."),
  222. _INTL("The Pokémon may escape dungeons from the menu."),
  223. _INTL("The Pokémon doubles prize money won when leading."),
  224. _INTL("The Pokémon may cure its status from the party menu."),
  225. _INTL("The Pokémon may relearn past moves when in a trance."),
  226. _INTL("The Pokémon yields eggs that hatch twice as fast."),
  227. _INTL("The Pokémon may re-roll for a new Hidden Power."),
  228. _INTL("The Pokémon may sneak up on sleeping wild Pokémon."),
  229. _INTL("The Pokémon may incubate eggs to hatch them sooner."),
  230. _INTL("The Pokémon raises capture rates by 20% when leading."),
  231. _INTL("The Pokémon may begin anew by reincarnating itself.")][sign]
  232. end
  233. end
  234. #===============================================================================
  235. # Manual Birthsigns - Values
  236. #===============================================================================
  237. # The list of birthsigns that may be applied through scripts/events.
  238. # #TAG4
  239. #===============================================================================
  240. module PBBirthsigns
  241. NONE = 0 # Null
  242. JAN = 1 # The Apprentice || The Phoenix
  243. FEB = 2 # The Companion || The Scholar
  244. MAR = 3 # The Beacon || The Fugitive
  245. APR = 4 # The Savage || The Aristocrat
  246. MAY = 5 # The Prodigy || The Cleric
  247. JUN = 6 # The Martyr || The Monk
  248. JUL = 7 # The Maiden || The Ancestor
  249. AUG = 8 # The Gladiator || The Specialist
  250. SEP = 9 # The Voyager || The Assassin
  251. OCT = 10 # The Thief || The Parent
  252. NOV = 11 # The Glutton || The Hunter
  253. DEC = 12 # The Wishmaker || The Eternal
  254. end
  255.  
  256. def PBBirthsigns.maxValue; 13; end
  257. def PBBirthsigns.getCount; 13; end
  258.  
  259. def PBBirthsigns.signValue(id)
  260. return (id)%13
  261. end
  262.  
  263. #===============================================================================
  264. # Manual Birthsigns - Names
  265. #===============================================================================
  266. # Calls the birthsign names for the debug menu and when applied manually on
  267. # a Pokemon. These names may be altered near the top of this script.
  268. # #TAG3
  269. #===============================================================================
  270. def PBBirthsigns.getName(id)
  271. names=[
  272. _INTL("No sign"), # Null
  273. JAN_BIRTHSIGN, # The Apprentice || The Phoenix
  274. FEB_BIRTHSIGN, # The Companion || The Scholar
  275. MAR_BIRTHSIGN, # The Beacon || The Fugitive
  276. APR_BIRTHSIGN, # The Savage || The Aristocrat
  277. MAY_BIRTHSIGN, # The Prodigy || The Cleric
  278. JUN_BIRTHSIGN, # The Martyr || The Monk
  279. JUL_BIRTHSIGN, # The Maiden || The Ancestor
  280. AUG_BIRTHSIGN, # The Gladiator || The Specialist
  281. SEP_BIRTHSIGN, # The Voyager || The Assassin
  282. OCT_BIRTHSIGN, # The Thief || The Parent
  283. NOV_BIRTHSIGN, # The Glutton || The Hunter
  284. DEC_BIRTHSIGN # The Wishmaker || The Eternal
  285. ]
  286. return names[id]
  287. end
  288.  
  289. #########[SECTION 2]##########
  290. #===============================================================================
  291. # Birthsign Checks
  292. #===============================================================================
  293. # Returns true if a certain birthsign is active on the user.
  294. # #TAG6
  295. #===============================================================================
  296. # January
  297. def hasJanBirthsign?
  298. if !isEgg? && !(self.isShadow? rescue false)
  299. if birthsign==1
  300. return true
  301. end
  302. end
  303. end
  304.  
  305. # February
  306. def hasFebBirthsign?
  307. if !isEgg? && !(self.isShadow? rescue false)
  308. if birthsign==2
  309. return true
  310. end
  311. end
  312. end
  313.  
  314. # March
  315. def hasMarBirthsign?
  316. if !isEgg? && !(self.isShadow? rescue false)
  317. if birthsign==3
  318. return true
  319. end
  320. end
  321. end
  322.  
  323. # April
  324. def hasAprBirthsign?
  325. if !isEgg? && !(self.isShadow? rescue false)
  326. if birthsign==4
  327. return true
  328. end
  329. end
  330. end
  331.  
  332. # May
  333. def hasMayBirthsign?
  334. if !isEgg? && !(self.isShadow? rescue false)
  335. if birthsign==5
  336. return true
  337. end
  338. end
  339. end
  340.  
  341. # June
  342. def hasJunBirthsign?
  343. if !isEgg? && !(self.isShadow? rescue false)
  344. if birthsign==6
  345. return true
  346. end
  347. end
  348. end
  349.  
  350. # July
  351. def hasJulBirthsign?
  352. if !isEgg? && !(self.isShadow? rescue false)
  353. if birthsign==7
  354. return true
  355. end
  356. end
  357. end
  358.  
  359. # August
  360. def hasAugBirthsign?
  361. if !isEgg? && !(self.isShadow? rescue false)
  362. if birthsign==8
  363. return true
  364. end
  365. end
  366. end
  367.  
  368. # September
  369. def hasSepBirthsign?
  370. if !isEgg? && !(self.isShadow? rescue false)
  371. if birthsign==9
  372. return true
  373. end
  374. end
  375. end
  376.  
  377. # October
  378. def hasOctBirthsign?
  379. if !isEgg? && !(self.isShadow? rescue false)
  380. if birthsign==10
  381. return true
  382. end
  383. end
  384. end
  385.  
  386. # November
  387. def hasNovBirthsign?
  388. if !isEgg? && !(self.isShadow? rescue false)
  389. if birthsign==11
  390. return true
  391. end
  392. end
  393. end
  394.  
  395. # December
  396. def hasDecBirthsign?
  397. if !isEgg? && !(self.isShadow? rescue false)
  398. if birthsign==12
  399. return true
  400. end
  401. end
  402. end
  403.  
  404. # Has ANY Birthsign
  405. def hasBirthsign?
  406. if !isEgg? && !(self.isShadow? rescue false)
  407. if birthsign>0
  408. return true
  409. end
  410. end
  411. end
  412.  
  413. # Null
  414. def hasNoSign?
  415. if isEgg? || (self.isShadow? rescue false)
  416. return true
  417. elsif obtainMode!=1 && (zodiacflag==0 || zodiacflag==nil)
  418. return true
  419. end
  420. end
  421.  
  422. #===============================================================================
  423. # Current Sign Check
  424. #===============================================================================
  425. # Returns true if the user has the current month's sign.
  426. #===============================================================================
  427. def hasCurrentSign?
  428. if Time.now.mon==1 && hasJanBirthsign?
  429. return true
  430. elsif Time.now.mon==2 && hasFebBirthsign?
  431. return true
  432. elsif Time.now.mon==3 && hasMarBirthsign?
  433. return true
  434. elsif Time.now.mon==4 && hasAprBirthsign?
  435. return true
  436. elsif Time.now.mon==5 && hasMayBirthsign?
  437. return true
  438. elsif Time.now.mon==6 && hasJunBirthsign?
  439. return true
  440. elsif Time.now.mon==7 && hasJulBirthsign?
  441. return true
  442. elsif Time.now.mon==8 && hasAugBirthsign?
  443. return true
  444. elsif Time.now.mon==9 && hasSepBirthsign?
  445. return true
  446. elsif Time.now.mon==10 && hasOctBirthsign?
  447. return true
  448. elsif Time.now.mon==11 && hasNovBirthsign?
  449. return true
  450. elsif Time.now.mon==12 && hasDecBirthsign?
  451. return true
  452. end
  453. end
  454.  
  455. #===============================================================================
  456. # Birthday Check
  457. #===============================================================================
  458. # Returns true if the current day is the user's birthday.
  459. # Only applies to hatched Pokemon.
  460. #===============================================================================
  461. def isBirthday?
  462. # Determines the current date
  463. thisyear=Time.now.year
  464. month=Time.now.mon
  465. date=Time.now.day
  466. today=(month && date)
  467. # Determines date of birth
  468. birthyear=timeEggHatched.year
  469. birthmonth=timeEggHatched.mon
  470. birthdate=timeEggHatched.day
  471. birthday=(birthmonth && birthdate)
  472. # Determines if there is a match
  473. if obtainMode==1
  474. if (birthday==today) && (birthyear<thisyear)
  475. return true
  476. end
  477. end
  478. end
  479.  
  480. #===============================================================================
  481. # Birthsigns - Name & Descriptions
  482. #===============================================================================
  483. # Returns the name or description of a user's birthsign, regardless of
  484. # whether they were hatched or manually given one.
  485. #===============================================================================
  486. def pbGetBirthsignName
  487. if self.obtainMode==1
  488. pbGetZodiacName(self.birthsign)
  489. else
  490. PBBirthsigns.getName(self.birthsign)
  491. end
  492. end
  493.  
  494. def pbGetBirthsignDesc
  495. pbGetZodiacDesc(self.birthsign)
  496. end
  497.  
  498. #===============================================================================
  499. # Birthsign Command Checks
  500. #===============================================================================
  501. # Returns true if the user has a particular command through a birthsign.
  502. # Used to eliminate redundant commands.
  503. #===============================================================================
  504. # The Beacon
  505. def hasFlashCmd?
  506. if !BIRTHSIGNS_SET_2
  507. if hasMarBirthsign?
  508. return true
  509. end
  510. end
  511. end
  512.  
  513. # The Martyr
  514. def hasSoftboiledCmd?
  515. if !BIRTHSIGNS_SET_2
  516. if hasJunBirthsign?
  517. return true
  518. end
  519. end
  520. end
  521.  
  522. # The Voyager
  523. def hasTeleportCmd?
  524. if !BIRTHSIGNS_SET_2
  525. if hasSepBirthsign?
  526. return true
  527. end
  528. end
  529. end
  530.  
  531. # The Fugitive
  532. def hasEscapeCmd?
  533. if BIRTHSIGNS_SET_2
  534. if hasMarBirthsign?
  535. return true
  536. end
  537. end
  538. end
  539.  
  540. #===============================================================================
  541. # Last Month Day
  542. #===============================================================================
  543. # Returns the final day of the month of the user's sign. (28th, 30th, 31st)
  544. # Used to display date ranges on the Birthsigns page.
  545. #===============================================================================
  546. def is30DayMon?
  547. if hasAprBirthsign? ||
  548. hasJunBirthsign? ||
  549. hasSepBirthsign? ||
  550. hasNovBirthsign?
  551. return true
  552. end
  553. end
  554.  
  555. def pbLastMonthDay
  556. if hasNoSign?
  557. return _INTL("???")
  558. elsif hasFebBirthsign?
  559. return _INTL("28th")
  560. elsif is30DayMon?
  561. return _INTL("30th")
  562. else
  563. return _INTL("31st")
  564. end
  565. end
  566.  
  567. #===============================================================================
  568. # Birthsign Bonuses - Passive Effects
  569. #===============================================================================
  570. # Applies passive birthsign bonuses.
  571. # #TAG7
  572. #===============================================================================
  573. def applyBirthsignBonuses
  574. if !isEgg?
  575. if !BIRTHSIGNS_SET_2
  576. #=========================================================================
  577. # Birthsign effects for Set 1
  578. #=========================================================================
  579. # The Apprentice
  580. if hasJanBirthsign?
  581. @pokerus=16
  582. end
  583. # The Companion
  584. if hasFebBirthsign?
  585. @happiness=255
  586. end
  587. # The Savage
  588. if hasAprBirthsign?
  589. @iv[0]=0
  590. @iv[1]=31
  591. @iv[3]=31
  592. @iv[4]=31
  593. end
  594. # The Prodigy
  595. if hasMayBirthsign?
  596. @abilityflag=2
  597. end
  598. # The Maiden
  599. if hasJulBirthsign?
  600. @genderflag=1
  601. end
  602. # The Gladiator
  603. if hasAugBirthsign?
  604. @ev=[0,100,0,0,100,0]
  605. end
  606. # The Thief
  607. if hasOctBirthsign?
  608. @ev=[0,0,0,252,0,0]
  609. end
  610. # The Glutton
  611. if hasNovBirthsign?
  612. @iv[0]=31
  613. @iv[2]=31
  614. @iv[3]=0
  615. @iv[5]=31
  616. end
  617. # The Wishmaker
  618. if hasDecBirthsign?
  619. @shinyflag=true
  620. end
  621. else
  622. #=========================================================================
  623. # Birthsign effects for Set 2.
  624. #=========================================================================
  625. # (add here if customizing)
  626. end
  627. # Resets flags if null sign is applied.
  628. if hasNoSign?
  629. @shinyflag=nil
  630. @abilityflag=nil
  631. @genderflag=nil
  632. @zodiacflag=0
  633. end
  634. end
  635. end
  636.  
  637. #########[SECTION 3]##########
  638. #===============================================================================
  639. # Defining Birthsigns
  640. #===============================================================================
  641. # The core codes that the rest of the Birthsigns script is built on.
  642. # Overwrite sections in PokeBattle_Pokemon.
  643. # #TAG10
  644. #===============================================================================
  645. class PokeBattle_Pokemon
  646. attr_accessor(:zodiacflag)
  647.  
  648. # Defines birthsigns
  649. def birthsign
  650. if obtainMode==1
  651. return zodiacValue(timeEggHatched.mon)
  652. else
  653. return @zodiacflag if @zodiacflag!=nil
  654. end
  655. return @personalID%13
  656. end
  657.  
  658. # Manually sets a Pokémon's birthsign through a script or event.
  659. def setBirthsign(value)
  660. if value.is_a?(String) || value.is_a?(Symbol)
  661. if isEgg?
  662. Kernel.pbMessage(_INTL("Eggs must be hatched first to inherit a birthsign!"))
  663. value=nil
  664. elsif (self.isShadow? rescue false)
  665. Kernel.pbMessage(_INTL("Shadow Pokémon can't have birthsigns!"))
  666. value=nil
  667. elsif obtainMode==1 || hasRibbon?(:SECONDSTEP)
  668. Kernel.pbMessage(_INTL("That Pokémon can't inherit a new birthsign!"))
  669. value=nil
  670. else
  671. value=getID(PBBirthsigns,value)
  672. end
  673. end
  674. @zodiacflag=value
  675. applyBirthsignBonuses
  676. self.calcStats
  677. end
  678.  
  679. #===============================================================================
  680. # Creates a new Pokémon object.
  681. # species - Pokémon species.
  682. # level - Pokémon level.
  683. # player - PokeBattle_Trainer object for the original trainer.
  684. # withMoves - If false, this Pokémon has no moves.
  685. #===============================================================================
  686. # zodiacflag- Sets birthsign to "no sign" by default.
  687. #===============================================================================
  688. def initialize(species,level,player=nil,withMoves=true)
  689. if species.is_a?(String) || species.is_a?(Symbol)
  690. species=getID(PBSpecies,species)
  691. end
  692. cname=getConstantName(PBSpecies,species) rescue nil
  693. if !species || species<1 || species>PBSpecies.maxValue || !cname
  694. raise ArgumentError.new(_INTL("The species number (no. {1} of {2}) is invalid.",
  695. species,PBSpecies.maxValue))
  696. return nil
  697. end
  698. time=pbGetTimeNow
  699. @timeReceived=time.getgm.to_i # Use GMT
  700. @species=species
  701. # Individual Values
  702. @personalID=rand(256)
  703. @personalID|=rand(256)<<8
  704. @personalID|=rand(256)<<16
  705. @personalID|=rand(256)<<24
  706. @hp=1
  707. @totalhp=1
  708. @ev=[0,0,0,0,0,0]
  709. @iv=[]
  710. @iv[0]=rand(32)
  711. @iv[1]=rand(32)
  712. @iv[2]=rand(32)
  713. @iv[3]=rand(32)
  714. @iv[4]=rand(32)
  715. @iv[5]=rand(32)
  716. if player
  717. @trainerID=player.id
  718. @ot=player.name
  719. @otgender=player.gender
  720. @language=player.language
  721. else
  722. @trainerID=0
  723. @ot=""
  724. @otgender=2
  725. end
  726. dexdata=pbOpenDexData
  727. pbDexDataOffset(dexdata,@species,19)
  728. @happiness=dexdata.fgetb
  729. dexdata.close
  730. @name=PBSpecies.getName(@species)
  731. @eggsteps=0
  732. @status=0
  733. @statusCount=0
  734. @item=0
  735. @mail=nil
  736. @fused=nil
  737. @ribbons=[]
  738. @moves=[]
  739. self.ballused=0
  740. self.level=level
  741. #===========================================================================
  742. # Sets flag to 0 on newly generated Pokemon, ensuring that random
  743. # birthsign effects are not applied when no birthsign is present.
  744. #===========================================================================
  745. self.zodiacflag=0
  746. #===========================================================================
  747. calcStats
  748. @hp=@totalhp
  749. if $game_map
  750. @obtainMap=$game_map.map_id
  751. @obtainText=nil
  752. @obtainLevel=level
  753. else
  754. @obtainMap=0
  755. @obtainText=nil
  756. @obtainLevel=level
  757. end
  758. @obtainMode=0 # Met
  759. @obtainMode=4 if $game_switches && $game_switches[FATEFUL_ENCOUNTER_SWITCH]
  760. @hatchedMap=0
  761. if withMoves
  762. atkdata=pbRgssOpen("Data/attacksRS.dat","rb")
  763. offset=atkdata.getOffset(species-1)
  764. length=atkdata.getLength(species-1)>>1
  765. atkdata.pos=offset
  766. # Generating move list
  767. movelist=[]
  768. for i in 0..length-1
  769. alevel=atkdata.fgetw
  770. move=atkdata.fgetw
  771. if alevel<=level
  772. movelist[movelist.length]=move
  773. end
  774. end
  775. atkdata.close
  776. movelist|=[] # Remove duplicates
  777. # Use the last 4 items in the move list
  778. listend=movelist.length-4
  779. listend=0 if listend<0
  780. j=0
  781. for i in listend...listend+4
  782. moveid=(i>=movelist.length) ? 0 : movelist[i]
  783. @moves[j]=PBMove.new(moveid)
  784. j+=1
  785. end
  786. end
  787. end
  788.  
  789. end
  790.  
  791. #########[SECTION 4]##########
  792. #===============================================================================
  793. # Party Screen - Debug Menu
  794. #===============================================================================
  795. # Updates the debug menu to allow Birthsigns to be applied manually.
  796. # This section overwrites the debug menu found in PScreen_Party.
  797. # #TAG11
  798. #===============================================================================
  799. class PokemonScreen
  800.  
  801. def pbPokemonDebug(pkmn,pkmnid)
  802. command=0
  803. loop do
  804. command=@scene.pbShowCommands(_INTL("Do what with {1}?",pkmn.name),[
  805. _INTL("HP/Status"),
  806. _INTL("Level"),
  807. _INTL("Species"),
  808. _INTL("Moves"),
  809. _INTL("Gender"),
  810. _INTL("Ability"),
  811. _INTL("Nature"),
  812. _INTL("Horoscopo"),
  813. _INTL("Shininess"),
  814. _INTL("Form"),
  815. _INTL("Happiness"),
  816. _INTL("EV/IV/pID"),
  817. _INTL("Pokérus"),
  818. _INTL("Ownership"),
  819. _INTL("Nickname"),
  820. _INTL("Poké Ball"),
  821. _INTL("Ribbons"),
  822. _INTL("Egg"),
  823. _INTL("Shadow Pokémon"),
  824. _INTL("Make Mystery Gift"),
  825. _INTL("Duplicate"),
  826. _INTL("Delete"),
  827. _INTL("Cancel")
  828. ],command)
  829. case command
  830. ### Cancel ###
  831. when -1, 22
  832. break
  833. ### HP/Status ###
  834. when 0
  835. cmd=0
  836. loop do
  837. cmd=@scene.pbShowCommands(_INTL("Do what with {1}?",pkmn.name),[
  838. _INTL("Set HP"),
  839. _INTL("Status: Sleep"),
  840. _INTL("Status: Poison"),
  841. _INTL("Status: Burn"),
  842. _INTL("Status: Paralysis"),
  843. _INTL("Status: Frozen"),
  844. _INTL("Fainted"),
  845. _INTL("Heal")
  846. ],cmd)
  847. # Break
  848. if cmd==-1
  849. break
  850. # Set HP
  851. elsif cmd==0
  852. params=ChooseNumberParams.new
  853. params.setRange(0,pkmn.totalhp)
  854. params.setDefaultValue(pkmn.hp)
  855. newhp=Kernel.pbMessageChooseNumber(
  856. _INTL("Set the Pokémon's HP (max. {1}).",pkmn.totalhp),params) { @scene.update }
  857. if newhp!=pkmn.hp
  858. pkmn.hp=newhp
  859. pbDisplay(_INTL("{1}'s HP was set to {2}.",pkmn.name,pkmn.hp))
  860. pbRefreshSingle(pkmnid)
  861. end
  862. # Set status
  863. elsif cmd>=1 && cmd<=5
  864. if pkmn.hp>0
  865. pkmn.status=cmd
  866. pkmn.statusCount=0
  867. if pkmn.status==PBStatuses::SLEEP
  868. params=ChooseNumberParams.new
  869. params.setRange(0,9)
  870. params.setDefaultValue(0)
  871. sleep=Kernel.pbMessageChooseNumber(
  872. _INTL("Set the Pokémon's sleep count."),params) { @scene.update }
  873. pkmn.statusCount=sleep
  874. end
  875. pbDisplay(_INTL("{1}'s status was changed.",pkmn.name))
  876. pbRefreshSingle(pkmnid)
  877. else
  878. pbDisplay(_INTL("{1}'s status could not be changed.",pkmn.name))
  879. end
  880. # Faint
  881. elsif cmd==6
  882. pkmn.hp=0
  883. pbDisplay(_INTL("{1}'s HP was set to 0.",pkmn.name))
  884. pbRefreshSingle(pkmnid)
  885. # Heal
  886. elsif cmd==7
  887. pkmn.heal
  888. pbDisplay(_INTL("{1} was fully healed.",pkmn.name))
  889. pbRefreshSingle(pkmnid)
  890. end
  891. end
  892. ### Level ###
  893. when 1
  894. params=ChooseNumberParams.new
  895. params.setRange(1,PBExperience::MAXLEVEL)
  896. params.setDefaultValue(pkmn.level)
  897. level=Kernel.pbMessageChooseNumber(
  898. _INTL("Set the Pokémon's level (max. {1}).",PBExperience::MAXLEVEL),params) { @scene.update }
  899. if level!=pkmn.level
  900. pkmn.level=level
  901. pkmn.calcStats
  902. pbDisplay(_INTL("{1}'s level was set to {2}.",pkmn.name,pkmn.level))
  903. pbRefreshSingle(pkmnid)
  904. end
  905. ### Species ###
  906. when 2
  907. species=pbChooseSpecies(pkmn.species)
  908. if species!=0
  909. oldspeciesname=PBSpecies.getName(pkmn.species)
  910. pkmn.species=species
  911. pkmn.calcStats
  912. oldname=pkmn.name
  913. pkmn.name=PBSpecies.getName(pkmn.species) if pkmn.name==oldspeciesname
  914. pbDisplay(_INTL("{1}'s species was changed to {2}.",oldname,PBSpecies.getName(pkmn.species)))
  915. pbSeenForm(pkmn)
  916. pbRefreshSingle(pkmnid)
  917. end
  918. ### Moves ###
  919. when 3
  920. cmd=0
  921. loop do
  922. cmd=@scene.pbShowCommands(_INTL("Do what with {1}?",pkmn.name),[
  923. _INTL("Teach move"),
  924. _INTL("Forget move"),
  925. _INTL("Reset movelist"),
  926. _INTL("Reset initial moves")],cmd)
  927. # Break
  928. if cmd==-1
  929. break
  930. # Teach move
  931. elsif cmd==0
  932. move=pbChooseMoveList
  933. if move!=0
  934. pbLearnMove(pkmn,move)
  935. pbRefreshSingle(pkmnid)
  936. end
  937. # Forget move
  938. elsif cmd==1
  939. move=pbChooseMove(pkmn,_INTL("Choose move to forget."))
  940. if move>=0
  941. movename=PBMoves.getName(pkmn.moves[move].id)
  942. pbDeleteMove(pkmn,move)
  943. pbDisplay(_INTL("{1} forgot {2}.",pkmn.name,movename))
  944. pbRefreshSingle(pkmnid)
  945. end
  946. # Reset movelist
  947. elsif cmd==2
  948. pkmn.resetMoves
  949. pbDisplay(_INTL("{1}'s moves were reset.",pkmn.name))
  950. pbRefreshSingle(pkmnid)
  951. # Reset initial moves
  952. elsif cmd==3
  953. pkmn.pbRecordFirstMoves
  954. pbDisplay(_INTL("{1}'s moves were set as its first-known moves.",pkmn.name))
  955. pbRefreshSingle(pkmnid)
  956. end
  957. end
  958. ### Gender ###
  959. when 4
  960. if pkmn.gender==2
  961. pbDisplay(_INTL("{1} is genderless.",pkmn.name))
  962. else
  963. cmd=0
  964. loop do
  965. oldgender=(pkmn.isMale?) ? _INTL("male") : _INTL("female")
  966. msg=[_INTL("Gender {1} is natural.",oldgender),
  967. _INTL("Gender {1} is being forced.",oldgender)][pkmn.genderflag ? 1 : 0]
  968. cmd=@scene.pbShowCommands(msg,[
  969. _INTL("Make male"),
  970. _INTL("Make female"),
  971. _INTL("Remove override")],cmd)
  972. # Break
  973. if cmd==-1
  974. break
  975. # Make male
  976. elsif cmd==0
  977. pkmn.setGender(0)
  978. if pkmn.isMale?
  979. pbDisplay(_INTL("{1} is now male.",pkmn.name))
  980. else
  981. pbDisplay(_INTL("{1}'s gender couldn't be changed.",pkmn.name))
  982. end
  983. # Make female
  984. elsif cmd==1
  985. pkmn.setGender(1)
  986. if pkmn.isFemale?
  987. pbDisplay(_INTL("{1} is now female.",pkmn.name))
  988. else
  989. pbDisplay(_INTL("{1}'s gender couldn't be changed.",pkmn.name))
  990. end
  991. # Remove override
  992. elsif cmd==2
  993. pkmn.genderflag=nil
  994. pbDisplay(_INTL("Gender override removed."))
  995. end
  996. pbSeenForm(pkmn)
  997. pbRefreshSingle(pkmnid)
  998. end
  999. end
  1000. ### Ability ###
  1001. when 5
  1002. cmd=0
  1003. loop do
  1004. abils=pkmn.getAbilityList
  1005. oldabil=PBAbilities.getName(pkmn.ability)
  1006. commands=[]
  1007. for i in abils
  1008. commands.push((i[1]<2 ? "" : "(H) ")+PBAbilities.getName(i[0]))
  1009. end
  1010. commands.push(_INTL("Remove override"))
  1011. msg=[_INTL("Ability {1} is natural.",oldabil),
  1012. _INTL("Ability {1} is being forced.",oldabil)][pkmn.abilityflag!=nil ? 1 : 0]
  1013. cmd=@scene.pbShowCommands(msg,commands,cmd)
  1014. # Break
  1015. if cmd==-1
  1016. break
  1017. # Set ability override
  1018. elsif cmd>=0 && cmd<abils.length
  1019. pkmn.setAbility(abils[cmd][1])
  1020. # Remove override
  1021. elsif cmd==abils.length
  1022. pkmn.abilityflag=nil
  1023. end
  1024. pbRefreshSingle(pkmnid)
  1025. end
  1026. ### Nature ###
  1027. when 6
  1028. cmd=0
  1029. loop do
  1030. oldnature=PBNatures.getName(pkmn.nature)
  1031. commands=[]
  1032. (PBNatures.getCount).times do |i|
  1033. commands.push(PBNatures.getName(i))
  1034. end
  1035. commands.push(_INTL("Remove override"))
  1036. msg=[_INTL("Nature {1} is natural.",oldnature),
  1037. _INTL("Nature {1} is being forced.",oldnature)][pkmn.natureflag ? 1 : 0]
  1038. cmd=@scene.pbShowCommands(msg,commands,cmd)
  1039. # Break
  1040. if cmd==-1
  1041. break
  1042. # Set nature override
  1043. elsif cmd>=0 && cmd<PBNatures.getCount
  1044. pkmn.setNature(cmd)
  1045. pkmn.calcStats
  1046. # Remove override
  1047. elsif cmd==PBNatures.getCount
  1048. pkmn.natureflag=nil
  1049. end
  1050. pbRefreshSingle(pkmnid)
  1051. end
  1052. ### Birthsign ###
  1053. when 7
  1054. cmd=0
  1055. if pkmn.isEgg?
  1056. pbDisplay(_INTL("Eggs must be hatched first to inherit a birthsign!"))
  1057. break
  1058. elsif (pkmn.isShadow? rescue false)
  1059. pbDisplay(_INTL("Shadow Pokémon can't have a birthsign!"))
  1060. break
  1061. elsif pkmn.obtainMode==1 || pkmn.hasRibbon?(:SECONDSTEP)
  1062. pbDisplay(_INTL("That Pokémon can't change its birthsign."))
  1063. break
  1064. end
  1065. loop do
  1066. oldsign=PBBirthsigns.getName(pkmn.birthsign)
  1067. commands=[]
  1068. (PBBirthsigns.getCount).times do |i|
  1069. commands.push(PBBirthsigns.getName(i))
  1070. end
  1071. msg=[_INTL("Change birthsigns."),
  1072. _INTL("{1} is active.",oldsign)][pkmn.zodiacflag ? 1 : 0]
  1073. cmd=@scene.pbShowCommands(msg,commands,cmd)
  1074. # Break
  1075. if cmd==-1
  1076. break
  1077. # Set birthsign override
  1078. elsif cmd>=0 && cmd<PBBirthsigns.getCount
  1079. pkmn.setBirthsign(cmd)
  1080. pkmn.calcStats
  1081. # Remove override
  1082. elsif cmd==PBBirthsigns.getCount
  1083. pkmn.zodiacflag=0
  1084. end
  1085. pbRefreshSingle(pkmnid)
  1086. end
  1087. ### Shininess ###
  1088. when 8
  1089. cmd=0
  1090. loop do
  1091. oldshiny=(pkmn.isShiny?) ? _INTL("shiny") : _INTL("normal")
  1092. msg=[_INTL("Shininess ({1}) is natural.",oldshiny),
  1093. _INTL("Shininess ({1}) is being forced.",oldshiny)][pkmn.shinyflag!=nil ? 1 : 0]
  1094. cmd=@scene.pbShowCommands(msg,[
  1095. _INTL("Make shiny"),
  1096. _INTL("Make normal"),
  1097. _INTL("Remove override")],cmd)
  1098. # Break
  1099. if cmd==-1
  1100. break
  1101. # Make shiny
  1102. elsif cmd==0
  1103. pkmn.makeShiny
  1104. # Make normal
  1105. elsif cmd==1
  1106. pkmn.makeNotShiny
  1107. # Remove override
  1108. elsif cmd==2
  1109. pkmn.shinyflag=nil
  1110. end
  1111. pbRefreshSingle(pkmnid)
  1112. end
  1113. ### Form ###
  1114. when 9
  1115. params=ChooseNumberParams.new
  1116. params.setRange(0,100)
  1117. params.setDefaultValue(pkmn.form)
  1118. f=Kernel.pbMessageChooseNumber(
  1119. _INTL("Set the Pokémon's form."),params) { @scene.update }
  1120. if f!=pkmn.form
  1121. pkmn.form=f
  1122. pbDisplay(_INTL("{1}'s form was set to {2}.",pkmn.name,pkmn.form))
  1123. pbSeenForm(pkmn)
  1124. pbRefreshSingle(pkmnid)
  1125. end
  1126. ### Happiness ###
  1127. when 10
  1128. params=ChooseNumberParams.new
  1129. params.setRange(0,255)
  1130. params.setDefaultValue(pkmn.happiness)
  1131. h=Kernel.pbMessageChooseNumber(
  1132. _INTL("Set the Pokémon's happiness (max. 255)."),params) { @scene.update }
  1133. if h!=pkmn.happiness
  1134. pkmn.happiness=h
  1135. pbDisplay(_INTL("{1}'s happiness was set to {2}.",pkmn.name,pkmn.happiness))
  1136. pbRefreshSingle(pkmnid)
  1137. end
  1138. ### EV/IV/pID ###
  1139. when 11
  1140. stats=[_INTL("HP"),_INTL("Attack"),_INTL("Defense"),
  1141. _INTL("Speed"),_INTL("Sp. Attack"),_INTL("Sp. Defense")]
  1142. cmd=0
  1143. loop do
  1144. persid=sprintf("0x%08X",pkmn.personalID)
  1145. cmd=@scene.pbShowCommands(_INTL("Personal ID is {1}.",persid),[
  1146. _INTL("Set EVs"),
  1147. _INTL("Set IVs"),
  1148. _INTL("Randomise pID")],cmd)
  1149. case cmd
  1150. # Break
  1151. when -1
  1152. break
  1153. # Set EVs
  1154. when 0
  1155. cmd2=0
  1156. loop do
  1157. evcommands=[]
  1158. for i in 0...stats.length
  1159. evcommands.push(stats[i]+" (#{pkmn.ev[i]})")
  1160. end
  1161. cmd2=@scene.pbShowCommands(_INTL("Change which EV?"),evcommands,cmd2)
  1162. if cmd2==-1
  1163. break
  1164. elsif cmd2>=0 && cmd2<stats.length
  1165. params=ChooseNumberParams.new
  1166. params.setRange(0,255)
  1167. params.setDefaultValue(pkmn.ev[cmd2])
  1168. params.setCancelValue(pkmn.ev[cmd2])
  1169. f=Kernel.pbMessageChooseNumber(
  1170. _INTL("Set the EV for {1} (max. 255).",stats[cmd2]),params) { @scene.update }
  1171. pkmn.ev[cmd2]=f
  1172. pkmn.totalhp
  1173. pkmn.calcStats
  1174. pbRefreshSingle(pkmnid)
  1175. end
  1176. end
  1177. # Set IVs
  1178. when 1
  1179. cmd2=0
  1180. loop do
  1181. hiddenpower=pbHiddenPower(pkmn.iv)
  1182. msg=_INTL("Hidden Power:\n{1}, power {2}.",PBTypes.getName(hiddenpower[0]),hiddenpower[1])
  1183. ivcommands=[]
  1184. for i in 0...stats.length
  1185. ivcommands.push(stats[i]+" (#{pkmn.iv[i]})")
  1186. end
  1187. ivcommands.push(_INTL("Randomise all"))
  1188. cmd2=@scene.pbShowCommands(msg,ivcommands,cmd2)
  1189. if cmd2==-1
  1190. break
  1191. elsif cmd2>=0 && cmd2<stats.length
  1192. params=ChooseNumberParams.new
  1193. params.setRange(0,31)
  1194. params.setDefaultValue(pkmn.iv[cmd2])
  1195. params.setCancelValue(pkmn.iv[cmd2])
  1196. f=Kernel.pbMessageChooseNumber(
  1197. _INTL("Set the IV for {1} (max. 31).",stats[cmd2]),params) { @scene.update }
  1198. pkmn.iv[cmd2]=f
  1199. pkmn.calcStats
  1200. pbRefreshSingle(pkmnid)
  1201. elsif cmd2==ivcommands.length-1
  1202. pkmn.iv[0]=rand(32)
  1203. pkmn.iv[1]=rand(32)
  1204. pkmn.iv[2]=rand(32)
  1205. pkmn.iv[3]=rand(32)
  1206. pkmn.iv[4]=rand(32)
  1207. pkmn.iv[5]=rand(32)
  1208. pkmn.calcStats
  1209. pbRefreshSingle(pkmnid)
  1210. end
  1211. end
  1212. # Randomise pID
  1213. when 2
  1214. pkmn.personalID=rand(256)
  1215. pkmn.personalID|=rand(256)<<8
  1216. pkmn.personalID|=rand(256)<<16
  1217. pkmn.personalID|=rand(256)<<24
  1218. pkmn.calcStats
  1219. pbRefreshSingle(pkmnid)
  1220. end
  1221. end
  1222. ### Pokérus ###
  1223. when 12
  1224. cmd=0
  1225. loop do
  1226. pokerus=(pkmn.pokerus) ? pkmn.pokerus : 0
  1227. msg=[_INTL("{1} doesn't have Pokérus.",pkmn.name),
  1228. _INTL("Has strain {1}, infectious for {2} more days.",pokerus/16,pokerus%16),
  1229. _INTL("Has strain {1}, not infectious.",pokerus/16)][pkmn.pokerusStage]
  1230. cmd=@scene.pbShowCommands(msg,[
  1231. _INTL("Give random strain"),
  1232. _INTL("Make not infectious"),
  1233. _INTL("Clear Pokérus")],cmd)
  1234. # Break
  1235. if cmd==-1
  1236. break
  1237. # Give random strain
  1238. elsif cmd==0
  1239. pkmn.givePokerus
  1240. # Make not infectious
  1241. elsif cmd==1
  1242. strain=pokerus/16
  1243. p=strain<<4
  1244. pkmn.pokerus=p
  1245. # Clear Pokérus
  1246. elsif cmd==2
  1247. pkmn.pokerus=0
  1248. end
  1249. end
  1250. ### Ownership ###
  1251. when 13
  1252. cmd=0
  1253. loop do
  1254. gender=[_INTL("Male"),_INTL("Female"),_INTL("Unknown")][pkmn.otgender]
  1255. msg=[_INTL("Player's Pokémon\n{1}\n{2}\n{3} ({4})",pkmn.ot,gender,pkmn.publicID,pkmn.trainerID),
  1256. _INTL("Foreign Pokémon\n{1}\n{2}\n{3} ({4})",pkmn.ot,gender,pkmn.publicID,pkmn.trainerID)
  1257. ][pkmn.isForeign?($Trainer) ? 1 : 0]
  1258. cmd=@scene.pbShowCommands(msg,[
  1259. _INTL("Make player's"),
  1260. _INTL("Set OT's name"),
  1261. _INTL("Set OT's gender"),
  1262. _INTL("Random foreign ID"),
  1263. _INTL("Set foreign ID")],cmd)
  1264. # Break
  1265. if cmd==-1
  1266. break
  1267. # Make player's
  1268. elsif cmd==0
  1269. pkmn.trainerID=$Trainer.id
  1270. pkmn.ot=$Trainer.name
  1271. pkmn.otgender=$Trainer.gender
  1272. # Set OT's name
  1273. elsif cmd==1
  1274. newot=pbEnterPlayerName(_INTL("{1}'s OT's name?",pkmn.name),1,7)
  1275. pkmn.ot=newot
  1276. # Set OT's gender
  1277. elsif cmd==2
  1278. cmd2=@scene.pbShowCommands(_INTL("Set OT's gender."),
  1279. [_INTL("Male"),_INTL("Female"),_INTL("Unknown")])
  1280. pkmn.otgender=cmd2 if cmd2>=0
  1281. # Random foreign ID
  1282. elsif cmd==3
  1283. pkmn.trainerID=$Trainer.getForeignID
  1284. # Set foreign ID
  1285. elsif cmd==4
  1286. params=ChooseNumberParams.new
  1287. params.setRange(0,65535)
  1288. params.setDefaultValue(pkmn.publicID)
  1289. val=Kernel.pbMessageChooseNumber(
  1290. _INTL("Set the new ID (max. 65535)."),params) { @scene.update }
  1291. pkmn.trainerID=val
  1292. pkmn.trainerID|=val<<16
  1293. end
  1294. end
  1295. ### Nickname ###
  1296. when 14
  1297. cmd=0
  1298. loop do
  1299. speciesname=PBSpecies.getName(pkmn.species)
  1300. msg=[_INTL("{1} has the nickname {2}.",speciesname,pkmn.name),
  1301. _INTL("{1} has no nickname.",speciesname)][pkmn.name==speciesname ? 1 : 0]
  1302. cmd=@scene.pbShowCommands(msg,[
  1303. _INTL("Rename"),
  1304. _INTL("Erase name")],cmd)
  1305. # Break
  1306. if cmd==-1
  1307. break
  1308. # Rename
  1309. elsif cmd==0
  1310. newname=pbEnterPokemonName(_INTL("{1}'s nickname?",speciesname),0,10,"",pkmn)
  1311. pkmn.name=(newname=="") ? speciesname : newname
  1312. pbRefreshSingle(pkmnid)
  1313. # Erase name
  1314. elsif cmd==1
  1315. pkmn.name=speciesname
  1316. end
  1317. end
  1318. ### Poké Ball ###
  1319. when 15
  1320. cmd=0
  1321. loop do
  1322. oldball=PBItems.getName(pbBallTypeToBall(pkmn.ballused))
  1323. commands=[]; balls=[]
  1324. for key in $BallTypes.keys
  1325. item=getID(PBItems,$BallTypes[key])
  1326. balls.push([key,PBItems.getName(item)]) if item && item>0
  1327. end
  1328. balls.sort! {|a,b| a[1]<=>b[1]}
  1329. for i in 0...commands.length
  1330. cmd=i if pkmn.ballused==balls[i][0]
  1331. end
  1332. for i in balls
  1333. commands.push(i[1])
  1334. end
  1335. cmd=@scene.pbShowCommands(_INTL("{1} used.",oldball),commands,cmd)
  1336. if cmd==-1
  1337. break
  1338. else
  1339. pkmn.ballused=balls[cmd][0]
  1340. end
  1341. end
  1342. ### Ribbons ###
  1343. when 16
  1344. cmd=0
  1345. loop do
  1346. commands=[]
  1347. for i in 1..PBRibbons.maxValue
  1348. commands.push(_INTL("{1} {2}",
  1349. pkmn.hasRibbon?(i) ? "[X]" : "[ ]",PBRibbons.getName(i)))
  1350. end
  1351. cmd=@scene.pbShowCommands(_INTL("{1} ribbons.",pkmn.ribbonCount),commands,cmd)
  1352. if cmd==-1
  1353. break
  1354. elsif cmd>=0 && cmd<commands.length
  1355. if pkmn.hasRibbon?(cmd+1)
  1356. pkmn.takeRibbon(cmd+1)
  1357. else
  1358. pkmn.giveRibbon(cmd+1)
  1359. end
  1360. end
  1361. end
  1362. ### Egg ###
  1363. when 17
  1364. cmd=0
  1365. loop do
  1366. msg=[_INTL("Not an egg"),
  1367. _INTL("Egg with eggsteps: {1}.",pkmn.eggsteps)][pkmn.isEgg? ? 1 : 0]
  1368. cmd=@scene.pbShowCommands(msg,[
  1369. _INTL("Make egg"),
  1370. _INTL("Make Pokémon"),
  1371. _INTL("Set eggsteps to 1")],cmd)
  1372. # Break
  1373. if cmd==-1
  1374. break
  1375. # Make egg
  1376. elsif cmd==0
  1377. if pbHasEgg?(pkmn.species) ||
  1378. pbConfirm(_INTL("{1} cannot be an egg. Make egg anyway?",PBSpecies.getName(pkmn.species)))
  1379. pkmn.level=EGGINITIALLEVEL
  1380. pkmn.zodiacflag==0
  1381. pkmn.calcStats
  1382. pkmn.name=_INTL("Egg")
  1383. dexdata=pbOpenDexData
  1384. pbDexDataOffset(dexdata,pkmn.species,21)
  1385. pkmn.eggsteps=dexdata.fgetw
  1386. dexdata.close
  1387. pkmn.hatchedMap=0
  1388. pkmn.obtainMode=1
  1389. pbRefreshSingle(pkmnid)
  1390. end
  1391. # Make Pokémon
  1392. elsif cmd==1
  1393. pkmn.name=PBSpecies.getName(pkmn.species)
  1394. pkmn.eggsteps=0
  1395. pkmn.hatchedMap=0
  1396. pkmn.obtainMode=0
  1397. pbRefreshSingle(pkmnid)
  1398. # Set eggsteps to 1
  1399. elsif cmd==2
  1400. pkmn.eggsteps=1 if pkmn.eggsteps>0
  1401. end
  1402. end
  1403. ### Shadow Pokémon ###
  1404. when 18
  1405. cmd=0
  1406. loop do
  1407. msg=[_INTL("Not a Shadow Pokémon."),
  1408. _INTL("Heart gauge is {1}.",pkmn.heartgauge)][(pkmn.isShadow? rescue false) ? 1 : 0]
  1409. cmd=@scene.pbShowCommands(msg,[
  1410. _INTL("Make Shadow"),
  1411. _INTL("Lower heart gauge")],cmd)
  1412. # Break
  1413. if cmd==-1
  1414. break
  1415. # Make Shadow
  1416. elsif cmd==0
  1417. if !(pkmn.isShadow? rescue false) && pkmn.respond_to?("makeShadow")
  1418. if pkmn.obtainMode==1
  1419. pbDisplay(_INTL("Pokémon born with a birthsign can't be made into Shadow Pokémon.",pkmn.name))
  1420. else
  1421. pkmn.setBirthsign(0)
  1422. pkmn.makeShadow
  1423. pbDisplay(_INTL("{1} is now a Shadow Pokémon.",pkmn.name))
  1424. end
  1425. pbRefreshSingle(pkmnid)
  1426. else
  1427. pbDisplay(_INTL("{1} is already a Shadow Pokémon.",pkmn.name))
  1428. end
  1429. # Lower heart gauge
  1430. elsif cmd==1
  1431. if (pkmn.isShadow? rescue false)
  1432. prev=pkmn.heartgauge
  1433. pkmn.adjustHeart(-700)
  1434. Kernel.pbMessage(_INTL("{1}'s heart gauge was lowered from {2} to {3} (now stage {4}).",
  1435. pkmn.name,prev,pkmn.heartgauge,pkmn.heartStage))
  1436. pbReadyToPurify(pkmn)
  1437. else
  1438. Kernel.pbMessage(_INTL("{1} is not a Shadow Pokémon.",pkmn.name))
  1439. end
  1440. end
  1441. end
  1442. ### Make Mystery Gift ###
  1443. when 19
  1444. pbCreateMysteryGift(0,pkmn)
  1445. ### Duplicate ###
  1446. when 20
  1447. if pbConfirm(_INTL("Are you sure you want to copy this Pokémon?"))
  1448. clonedpkmn=pkmn.clone
  1449. clonedpkmn.iv=pkmn.iv.clone
  1450. clonedpkmn.ev=pkmn.ev.clone
  1451. pbStorePokemon(clonedpkmn)
  1452. pbHardRefresh
  1453. pbDisplay(_INTL("The Pokémon was duplicated."))
  1454. break
  1455. end
  1456. ### Delete ###
  1457. when 21
  1458. if pbConfirm(_INTL("Are you sure you want to delete this Pokémon?"))
  1459. @party[pkmnid]=nil
  1460. @party.compact!
  1461. pbHardRefresh
  1462. pbDisplay(_INTL("The Pokémon was deleted."))
  1463. break
  1464. end
  1465. ###
  1466. end
  1467. end
  1468. end
  1469.  
  1470. #===============================================================================
  1471. # Birthsign Commands
  1472. #===============================================================================
  1473. # This section overwrites the section in PScreen_Party that creates command
  1474. # menu options.
  1475. # #TAG9
  1476. #===============================================================================
  1477. def pbPokemonScreen
  1478. @scene.pbStartScene(@party,@party.length>1 ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."),nil)
  1479. loop do
  1480. @scene.pbSetHelpText(@party.length>1 ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
  1481. pkmnid=@scene.pbChoosePokemon
  1482. break if pkmnid<0
  1483. pkmn=@party[pkmnid]
  1484. commands=[]
  1485. cmdSummary=-1
  1486. cmdDebug=-1
  1487. cmdMoves=[-1,-1,-1,-1]
  1488. cmdSwitch=-1
  1489. cmdMail=-1
  1490. cmdItem=-1
  1491. #=========================================================================
  1492. # Birthsigns Set 1
  1493. #=========================================================================
  1494. cmdFlash=-1
  1495. cmdSoftboiled=-1
  1496. cmdTeleport=-1
  1497. #=========================================================================
  1498. # Birthsigns Set 2
  1499. #=========================================================================
  1500. cmdRebirth=-1
  1501. cmdEscape=-1
  1502. cmdCure=-1
  1503. cmdTrance=-1
  1504. cmdIncubate=-1
  1505. cmdReroll=-1
  1506. cmdReincarnate=-1
  1507. #=========================================================================
  1508. # Build the commands
  1509. commands[cmdSummary=commands.length]=_INTL("Summary")
  1510. commands[cmdDebug=commands.length]=_INTL("Debug") if $DEBUG
  1511. for i in 0...pkmn.moves.length
  1512. move=pkmn.moves[i]
  1513. # Check for hidden moves and add any that were found
  1514. if !pkmn.isEgg? &&
  1515. #=====================================================================
  1516. # HM's - Creates commands for HM moves in the party menu.
  1517. #=====================================================================
  1518. (isConst?(move.id,PBMoves,:CUT) ||
  1519. isConst?(move.id,PBMoves,:FLY) ||
  1520. isConst?(move.id,PBMoves,:SURF) ||
  1521. isConst?(move.id,PBMoves,:STRENGTH) ||
  1522. isConst?(move.id,PBMoves,:ROCKSMASH) ||
  1523. isConst?(move.id,PBMoves,:WATERFALL) ||
  1524. isConst?(move.id,PBMoves,:DIVE) ||
  1525. #=====================================================================
  1526. # Other field commands - Creates commands for other field moves.
  1527. #=====================================================================
  1528. isConst?(move.id,PBMoves,:MILKDRINK) ||
  1529. isConst?(move.id,PBMoves,:HEADBUTT) ||
  1530. isConst?(move.id,PBMoves,:SWEETSCENT) ||
  1531. isConst?(move.id,PBMoves,:CHATTER) ||
  1532. #=====================================================================
  1533. # Unsupported commands as of Essentials v16.
  1534. # Remove comment tag from field moves you've added yourself.
  1535. # Any custom field moves must be added to this list.
  1536. #=====================================================================
  1537. #isConst?(move.id,PBMoves,:WHIRLPOOL) ||
  1538. #isConst?(move.id,PBMoves,:ROCKCLIMB) ||
  1539. #isConst?(move.id,PBMoves,:SECRETPOWER) ||
  1540. #isConst?(move.id,PBMoves,:DEFOG) ||
  1541. #=====================================================================
  1542. # Birthsign commands - Hides redundant birthsign commands.
  1543. # Adds field commands otherwise.
  1544. #=====================================================================
  1545. # The Beacon
  1546. (isConst?(move.id,PBMoves,:FLASH) && !pkmn.hasFlashCmd?) ||
  1547. # The Martyr
  1548. (isConst?(move.id,PBMoves,:SOFTBOILED) && !pkmn.hasSoftboiledCmd?) ||
  1549. # The Voyager
  1550. (isConst?(move.id,PBMoves,:TELEPORT) && !pkmn.hasTeleportCmd?) ||
  1551. # The Fugitive
  1552. (isConst?(move.id,PBMoves,:DIG) && !pkmn.hasEscapeCmd?))
  1553. #=====================================================================
  1554. commands[cmdMoves[i]=commands.length]=PBMoves.getName(move.id)
  1555. end
  1556. end
  1557. #=========================================================================
  1558. #Birthsigns Set 1
  1559. #=========================================================================
  1560. # The Beacon
  1561. if !BIRTHSIGNS_SET_2 && pkmn.hasMarBirthsign?
  1562. commands[cmdFlash=commands.length]=_INTL("Flash")
  1563. end
  1564. # The Martyr
  1565. if !BIRTHSIGNS_SET_2 && pkmn.hasJunBirthsign?
  1566. commands[cmdSoftboiled=commands.length]=_INTL("Soft-Boiled")
  1567. end
  1568. # The Voyager
  1569. if !BIRTHSIGNS_SET_2 && pkmn.hasSepBirthsign?
  1570. commands[cmdTeleport=commands.length]=_INTL("Teleport")
  1571. end
  1572. #=========================================================================
  1573. #Birthsigns Set 2
  1574. #=========================================================================
  1575. # The Phoenix
  1576. if BIRTHSIGNS_SET_2 && pkmn.hasJanBirthsign?
  1577. commands[cmdRebirth=commands.length]=_INTL("Rebirth")
  1578. end
  1579. # The Fugitive
  1580. if BIRTHSIGNS_SET_2 && pkmn.hasMarBirthsign?
  1581. commands[cmdEscape=commands.length]=_INTL("Escape")
  1582. end
  1583. # The Cleric
  1584. if BIRTHSIGNS_SET_2 && pkmn.hasMayBirthsign?
  1585. commands[cmdCure=commands.length]=_INTL("Cure")
  1586. end
  1587. # The Monk
  1588. if BIRTHSIGNS_SET_2 && pkmn.hasJunBirthsign?
  1589. commands[cmdTrance=commands.length]=_INTL("Trance")
  1590. end
  1591. # The Specialist
  1592. if BIRTHSIGNS_SET_2 && pkmn.hasAugBirthsign?
  1593. commands[cmdReroll=commands.length]=_INTL("Re-roll")
  1594. end
  1595. # The Parent
  1596. if BIRTHSIGNS_SET_2 && pkmn.hasOctBirthsign?
  1597. commands[cmdIncubate=commands.length]=_INTL("Incubate")
  1598. end
  1599. # The Eternal
  1600. if BIRTHSIGNS_SET_2 && pkmn.hasDecBirthsign?
  1601. # The Reincarnate skill is only displayed if it isn't December.
  1602. if Time.now.mon!=12
  1603. commands[cmdReincarnate=commands.length]=_INTL("Reincarnate")
  1604. end
  1605. end
  1606. #=========================================================================
  1607. commands[cmdSwitch=commands.length]=_INTL("Switch") if @party.length>1
  1608. if !pkmn.isEgg?
  1609. if pkmn.mail
  1610. commands[cmdMail=commands.length]=_INTL("Mail")
  1611. else
  1612. commands[cmdItem=commands.length]=_INTL("Item")
  1613. end
  1614. end
  1615. commands[commands.length]=_INTL("Cancel")
  1616. command=@scene.pbShowCommands(_INTL("Do what with {1}?",pkmn.name),commands)
  1617. havecommand=false
  1618. for i in 0...4
  1619. if cmdMoves[i]>=0 && command==cmdMoves[i]
  1620. havecommand=true
  1621. if isConst?(pkmn.moves[i].id,PBMoves,:SOFTBOILED) ||
  1622. isConst?(pkmn.moves[i].id,PBMoves,:MILKDRINK)
  1623. if pkmn.hp<=(pkmn.totalhp/5).floor
  1624. pbDisplay(_INTL("Not enough HP..."))
  1625. break
  1626. end
  1627. @scene.pbSetHelpText(_INTL("Use on which Pokémon?"))
  1628. oldpkmnid=pkmnid
  1629. loop do
  1630. @scene.pbPreSelect(oldpkmnid)
  1631. pkmnid=@scene.pbChoosePokemon(true,pkmnid)
  1632. break if pkmnid<0
  1633. newpkmn=@party[pkmnid]
  1634. if pkmnid==oldpkmnid
  1635. pbDisplay(_INTL("{1} can't use {2} on itself!",pkmn.name,PBMoves.getName(pkmn.moves[i].id)))
  1636. elsif newpkmn.isEgg?
  1637. pbDisplay(_INTL("{1} can't be used on an Egg!",PBMoves.getName(pkmn.moves[i].id)))
  1638. elsif newpkmn.hp==0 || newpkmn.hp==newpkmn.totalhp
  1639. pbDisplay(_INTL("{1} can't be used on that Pokémon.",PBMoves.getName(pkmn.moves[i].id)))
  1640. else
  1641. pkmn.hp-=(pkmn.totalhp/5).floor
  1642. hpgain=pbItemRestoreHP(newpkmn,(pkmn.totalhp/5).floor)
  1643. @scene.pbDisplay(_INTL("{1}'s HP was restored by {2} points.",newpkmn.name,hpgain))
  1644. pbRefresh
  1645. end
  1646. break if pkmn.hp<=(pkmn.totalhp/5).floor
  1647. end
  1648. break
  1649. elsif Kernel.pbCanUseHiddenMove?(pkmn,pkmn.moves[i].id)
  1650. @scene.pbEndScene
  1651. if isConst?(pkmn.moves[i].id,PBMoves,:FLY)
  1652. scene=PokemonRegionMapScene.new(-1,false)
  1653. screen=PokemonRegionMap.new(scene)
  1654. ret=screen.pbStartFlyScreen
  1655. if ret
  1656. $PokemonTemp.flydata=ret
  1657. return [pkmn,pkmn.moves[i].id]
  1658. end
  1659. @scene.pbStartScene(@party,
  1660. @party.length>1 ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
  1661. break
  1662. end
  1663. return [pkmn,pkmn.moves[i].id]
  1664. else
  1665. break
  1666. end
  1667. end
  1668. end
  1669. next if havecommand
  1670. if cmdSummary>=0 && command==cmdSummary
  1671. @scene.pbSummary(pkmnid)
  1672. #===============================================================================
  1673. # Birthsigns - The Beacon
  1674. # Flash Skill effect: Mimics the effect of 'Flash'.
  1675. #===============================================================================
  1676. elsif cmdFlash>=0 && command==cmdFlash
  1677. if Kernel.pbConfirmMessage(_INTL("Activate {1}'s birthsign?",pkmn.name))
  1678. if !pbGetMetadata($game_map.map_id,MetadataDarkMap)
  1679. Kernel.pbMessage(_INTL("That can't be used here."))
  1680. elsif $PokemonGlobal.flashUsed
  1681. Kernel.pbMessage(_INTL("This is in use already."))
  1682. else
  1683. darkness=$PokemonTemp.darknessSprite
  1684. return false if !darkness || darkness.disposed?
  1685. if !pbHiddenMoveAnimation(pkmn)
  1686. Kernel.pbMessage(_INTL("{1} used Flash!",pkmn.name))
  1687. end
  1688. $PokemonGlobal.flashUsed=true
  1689. Kernel.pbMessage(_INTL("{1} lit up the area by using the power of {2}!",
  1690. pkmn.name,pkmn.pbGetBirthsignName))
  1691. while darkness.radius<176
  1692. Graphics.update
  1693. Input.update
  1694. pbUpdateSceneMap
  1695. darkness.radius+=4
  1696. end
  1697. pbRefresh
  1698. break
  1699. end
  1700. end
  1701. #===============================================================================
  1702. # Birthsigns - The Martyr
  1703. # Soft-Boiled Skill effect: Mimics the effect of 'Soft-Boiled'.
  1704. #===============================================================================
  1705. elsif cmdSoftboiled>=0 && command==cmdSoftboiled
  1706. if Kernel.pbConfirmMessage(_INTL("Activate {1}'s birthsign?",pkmn.name))
  1707. if pkmn.hp<=(pkmn.totalhp/5).floor
  1708. Kernel.pbMessage(_INTL("Not enough HP..."))
  1709. break
  1710. end
  1711. @scene.pbSetHelpText(_INTL("Use on which Pokémon?"))
  1712. oldpkmnid=pkmnid
  1713. loop do
  1714. @scene.pbPreSelect(oldpkmnid)
  1715. pkmnid=@scene.pbChoosePokemon(true,pkmnid)
  1716. break if pkmnid<0
  1717. newpkmn=@party[pkmnid]
  1718. if pkmnid==oldpkmnid
  1719. Kernel.pbMessage(_INTL("{1} can't use that power on itself!",pkmn.name))
  1720. elsif newpkmn.isEgg?
  1721. Kernel.pbMessage(_INTL("That power can't be used on an Egg!"))
  1722. elsif newpkmn.hp==0 || newpkmn.hp==newpkmn.totalhp
  1723. Kernel.pbMessage(_INTL("That power can't be used on an uninjured Pokémon."))
  1724. else
  1725. pkmn.hp-=(pkmn.totalhp/5).floor
  1726. hpgain=pbItemRestoreHP(newpkmn,(pkmn.totalhp/5).floor)
  1727. @scene.pbDisplay(_INTL("{1}'s HP was restored by the power of {2}!",
  1728. newpkmn.name,pkmn.pbGetBirthsignName))
  1729. pbRefresh
  1730. end
  1731. break if pkmn.hp<=(pkmn.totalhp/5).floor
  1732. end
  1733. pbRefresh
  1734. end
  1735. #===============================================================================
  1736. # Birthsigns - The Voyager
  1737. # Teleport Skill effect: Mimics the effect of 'Teleport'.
  1738. #===============================================================================
  1739. elsif cmdTeleport>=0 && command==cmdTeleport
  1740. if Kernel.pbConfirmMessage(_INTL("Activate {1}'s birthsign?",pkmn.name))
  1741. if !pbGetMetadata($game_map.map_id,MetadataOutdoor)
  1742. Kernel.pbMessage(_INTL("That power can only be used outdoors."))
  1743. elsif $game_player.pbHasDependentEvents?
  1744. Kernel.pbMessage(_INTL("That power can't be used when you have someone with you."))
  1745. else
  1746. healing=$PokemonGlobal.healingSpot
  1747. if !healing
  1748. healing=pbGetMetadata(0,MetadataHome) # Home
  1749. elsif healing
  1750. mapname=pbGetMapNameFromId(healing[0])
  1751. if Kernel.pbConfirmMessage(_INTL("Do you want to return to {1}?",mapname))
  1752. if !pbHiddenMoveAnimation(pkmn)
  1753. Kernel.pbMessage(_INTL("{1} used Teleport!",pkmn.name))
  1754. end
  1755. pbFadeOutIn(99999){
  1756. Kernel.pbCancelVehicles
  1757. $game_temp.player_new_map_id=healing[0]
  1758. $game_temp.player_new_x=healing[1]
  1759. $game_temp.player_new_y=healing[2]
  1760. $game_temp.player_new_direction=2
  1761. $scene.transfer_player
  1762. $game_map.autoplay
  1763. $game_map.refresh
  1764. }
  1765. pbEraseEscapePoint
  1766. Kernel.pbMessage(_INTL("Returned to {1} using the power of {2}!",
  1767. mapname,pkmn.pbGetBirthsignName))
  1768. pbRefresh
  1769. break
  1770. end
  1771. end
  1772. end
  1773. end
  1774. #===============================================================================
  1775. # Birthsigns - The Phoenix
  1776. # Rebirth Skill effect: Revives the user with roughly 1/16th its max hp.
  1777. #===============================================================================
  1778. elsif cmdRebirth>=0 && command==cmdRebirth
  1779. if Kernel.pbConfirmMessage(_INTL("Activate {1}'s birthsign?",pkmn.name))
  1780. if pkmn.hp==0
  1781. hpgain=pbItemRestoreHP(pkmn,pkmn.totalhp/16.floor+1)
  1782. pbRefresh
  1783. pbSEPlay("ItemGet")
  1784. Kernel.pbMessage(_INTL("{1} was revived by the power of {2}!",
  1785. pkmn.name,pkmn.pbGetBirthsignName))
  1786. else
  1787. Kernel.pbMessage(_INTL("It won't have any effect."))
  1788. end
  1789. pbRefresh
  1790. end
  1791. #===============================================================================
  1792. # Birthsigns - The Fugitive
  1793. # Escape Skill effect: Mimics the effects of 'Dig' or 'Escape Rope'.
  1794. #===============================================================================
  1795. elsif cmdEscape>=0 && command==cmdEscape
  1796. if Kernel.pbConfirmMessage(_INTL("Activate {1}'s birthsign?",pkmn.name))
  1797. escape=($PokemonGlobal.escapePoint rescue nil)
  1798. outdoors=pbGetMetadata($game_map.map_id,MetadataOutdoor)
  1799. if !escape || escape==[] || outdoors
  1800. Kernel.pbMessage(_INTL("That power can't be used here."))
  1801. elsif $game_player.pbHasDependentEvents?
  1802. Kernel.pbMessage(_INTL("That power can't be used when you have someone with you."))
  1803. else
  1804. mapname=pbGetMapNameFromId(escape[0])
  1805. if Kernel.pbConfirmMessage(_INTL("Want to escape from here and return to {1}?",mapname))
  1806. if escape
  1807. if !pbHiddenMoveAnimation(pkmn)
  1808. Kernel.pbMessage(_INTL("{1} used Escape!",pkmn.name))
  1809. end
  1810. pbFadeOutIn(99999){
  1811. Kernel.pbCancelVehicles
  1812. $game_temp.player_new_map_id=escape[0]
  1813. $game_temp.player_new_x=escape[1]
  1814. $game_temp.player_new_y=escape[2]
  1815. $game_temp.player_new_direction=escape[3]
  1816. $scene.transfer_player
  1817. $game_map.autoplay
  1818. $game_map.refresh
  1819. }
  1820. pbEraseEscapePoint
  1821. Kernel.pbMessage(_INTL("Escaped to {1} by using the power of {2}!",
  1822. mapname,pkmn.pbGetBirthsignName))
  1823. pbRefresh
  1824. break
  1825. end
  1826. end
  1827. end
  1828. end
  1829. #===============================================================================
  1830. # Birthsigns - The Cleric
  1831. # Cure Skill effect: Heals the user's status conditions.
  1832. #===============================================================================
  1833. elsif cmdCure>=0 && command==cmdCure
  1834. if Kernel.pbConfirmMessage(_INTL("Activate {1}'s birthsign?",pkmn.name))
  1835. if pkmn.status>0 && pkmn.hp>0
  1836. pkmn.status=0
  1837. pkmn.statusCount=0
  1838. pbRefresh
  1839. pbSEPlay("ItemGet")
  1840. Kernel.pbMessage(_INTL("{1}'s condition was healed by the power of {2}!",
  1841. pkmn.name,pkmn.pbGetBirthsignName))
  1842. else
  1843. Kernel.pbMessage(_INTL("It won't have any effect."))
  1844. end
  1845. pbRefresh
  1846. end
  1847. #===============================================================================
  1848. # Birthsigns - The Monk
  1849. # Trance Skill effect: Relearns old moves.
  1850. #===============================================================================
  1851. elsif cmdTrance>=0 && command==cmdTrance
  1852. if Kernel.pbConfirmMessage(_INTL("Activate {1}'s birthsign?",pkmn.name))
  1853. Kernel.pbMessage(_INTL("{1} entered a deep trance...",pkmn.name))
  1854. if pbGetRelearnableMoves(pkmn).length>0
  1855. pbRelearnMoveScreen(pkmn)
  1856. else
  1857. Kernel.pbMessage(_INTL("...but it couldn't recall anything."))
  1858. end
  1859. pbRefresh
  1860. end
  1861. #===============================================================================
  1862. # Birthsigns - The Specialist
  1863. # Re-roll Skill effect: IV's are reset to yield a new Hidden Power.
  1864. #===============================================================================
  1865. elsif cmdReroll>=0 && command==cmdReroll
  1866. #=======================================================================
  1867. # IV Settings
  1868. # The IV numbers set to odd and even that determines hidden power.
  1869. # #TAG20
  1870. #=======================================================================
  1871. #Set to any odd-numbered IV you desire.
  1872. #Set to rand(32)/2.floor*2+1 if you want a random odd number.
  1873. odd = 25
  1874. #=======================================================================
  1875. #Set to any even-numbered IV you desire.
  1876. #Set to rand(32)/2.floor*2 if you want a random even number.
  1877. evn = 26
  1878. #=======================================================================
  1879. if Kernel.pbConfirmMessage(_INTL("Activate {1}'s birthsign?",pkmn.name))
  1880. pbRefresh
  1881. pbDisplay(_INTL("{1} can change its Hidden Power type!",pkmn.name))
  1882. command=0
  1883. loop do
  1884. command=@scene.pbShowCommands(_INTL("Choose a new Hidden Power."),[
  1885. _INTL("Grass"),
  1886. _INTL("Fire"),
  1887. _INTL("Water"),
  1888. _INTL("Electric"),
  1889. _INTL("Ice"),
  1890. _INTL("Fighting"),
  1891. _INTL("Flying"),
  1892. _INTL("Poison"),
  1893. _INTL("Ground"),
  1894. _INTL("Rock"),
  1895. _INTL("Bug"),
  1896. _INTL("Ghost"),
  1897. _INTL("Steel"),
  1898. _INTL("Psychic"),
  1899. _INTL("Dragon"),
  1900. _INTL("Dark"),
  1901. _INTL("Fairy"),
  1902. _INTL("*Random*"),
  1903. _INTL("Cancel")
  1904. ],command)
  1905. case command
  1906. when -1, 18
  1907. break
  1908. #Re-rolls the user's IV's for a new Hidden Power.
  1909. when 0 # Grass
  1910. pkmn.iv=[odd,odd,evn,odd,evn,odd]
  1911. when 1 # Fire
  1912. pkmn.iv=[odd,odd,evn,evn,evn,odd]
  1913. when 2 # Water
  1914. pkmn.iv=[odd,odd,odd,evn,evn,odd]
  1915. when 3 # Electric
  1916. pkmn.iv=[odd,odd,odd,odd,evn,odd]
  1917. when 4 # Ice
  1918. pkmn.iv=[odd,odd,odd,evn,odd,odd]
  1919. when 5 # Fighting
  1920. pkmn.iv=[odd,odd,evn,evn,evn,evn]
  1921. when 6 # Flying
  1922. pkmn.iv=[odd,odd,odd,evn,evn,evn]
  1923. when 7 # Poison
  1924. pkmn.iv=[odd,odd,evn,odd,evn,evn]
  1925. when 8 # Ground
  1926. pkmn.iv=[odd,odd,odd,odd,evn,evn]
  1927. when 9 # Rock
  1928. pkmn.iv=[odd,odd,evn,evn,odd,evn]
  1929. when 10# Bug
  1930. pkmn.iv=[odd,odd,odd,evn,odd,evn]
  1931. when 11# Ghost
  1932. pkmn.iv=[odd,odd,evn,odd,odd,evn]
  1933. when 12# Steel
  1934. pkmn.iv=[odd,odd,odd,odd,odd,evn]
  1935. when 13# Psychic
  1936. pkmn.iv=[odd,odd,evn,evn,odd,odd]
  1937. when 14# Dragon
  1938. pkmn.iv=[odd,odd,evn,odd,odd,odd]
  1939. #=====================================================================
  1940. # Types PBS file must include Fairy type for the below to work.
  1941. # Otherwise it will just return HP Dragon.
  1942. #=====================================================================
  1943. when 15# Dark
  1944. pkmn.iv=[odd,evn,odd,odd,odd,odd]
  1945. #=====================================================================
  1946. # Types PBS file must include Fairy type for the below to work.
  1947. # Otherwise it will just return HP Dark.
  1948. #=====================================================================
  1949. when 16# Fairy
  1950. pkmn.iv=[odd,odd,odd,odd,odd,odd]
  1951. #=====================================================================
  1952. # Randomizes the user's IV's and returns their new values.
  1953. #=====================================================================
  1954. when 17# Randomize
  1955. if pkmn.level>49
  1956. #Users level 50 and higher have better IV rolls.
  1957. pkmn.iv[0]=25+rand(7)
  1958. pkmn.iv[1]=25+rand(7)
  1959. pkmn.iv[2]=25+rand(7)
  1960. pkmn.iv[3]=25+rand(7)
  1961. pkmn.iv[4]=25+rand(7)
  1962. pkmn.iv[5]=25+rand(7)
  1963. else
  1964. #Users level 49 and lower have completely random IV rolls.
  1965. pkmn.iv[0]=rand(32)
  1966. pkmn.iv[1]=rand(32)
  1967. pkmn.iv[2]=rand(32)
  1968. pkmn.iv[3]=rand(32)
  1969. pkmn.iv[4]=rand(32)
  1970. pkmn.iv[5]=rand(32)
  1971. end
  1972. Kernel.pbMessage(_INTL("Re-roll:\n{1}/{2}/{3}/{4}/{5}/{6}",
  1973. pkmn.iv[0],pkmn.iv[1],pkmn.iv[2],pkmn.iv[4],pkmn.iv[5],pkmn.iv[3]))
  1974. end
  1975. #=====================================================================
  1976. pbRefresh
  1977. pkmn.calcStats
  1978. hiddenpower=pbHiddenPower(pkmn.iv)
  1979. pbSEPlay("ItemGet")
  1980. Kernel.pbMessage(_INTL("The power of {1} changed {2}'s Hidden Power to {3}!",
  1981. pkmn.pbGetBirthsignName,pkmn.name,PBTypes.getName(hiddenpower[0])))
  1982. break
  1983. end
  1984. end
  1985. #===============================================================================
  1986. # Birthsigns - The Parent
  1987. # Incubate Skill effect: Eggs with <1000 steps left will be reduced to 1.
  1988. #===============================================================================
  1989. elsif cmdIncubate>=0 && command==cmdIncubate
  1990. if Kernel.pbConfirmMessage(_INTL("Activate {1}'s birthsign?",pkmn.name))
  1991. @scene.pbSetHelpText(_INTL("Which egg to incubate?"))
  1992. oldpkmnid=pkmnid
  1993. loop do
  1994. @scene.pbPreSelect(oldpkmnid)
  1995. pkmnid=@scene.pbChoosePokemon(true,pkmnid)
  1996. break if pkmnid<0
  1997. newpkmn=@party[pkmnid]
  1998. if Input.trigger?(Input::B)
  1999. break
  2000. elsif !newpkmn.isEgg?
  2001. Kernel.pbMessage(_INTL("This power only works on eggs!"))
  2002. elsif newpkmn.isEgg? && newpkmn.eggsteps>1000
  2003. Kernel.pbMessage(_INTL("That egg still has {1} steps to go!",newpkmn.eggsteps))
  2004. elsif newpkmn.isEgg? && newpkmn.eggsteps<1000
  2005. newpkmn.eggsteps=1
  2006. Kernel.pbMessage(_INTL("{1} incubated the egg with the power of {2}!",
  2007. pkmn.name,pkmn.pbGetBirthsignName))
  2008. Kernel.pbMessage(_INTL("The egg is now ready to hatch!"))
  2009. end
  2010. end
  2011. pbRefresh
  2012. end
  2013. #===============================================================================
  2014. # Birthsigns - The Eternal
  2015. # Reincarnate Skill effect: Resets the user's birthsign and attributes.
  2016. #===============================================================================
  2017. elsif cmdReincarnate>=0 && command==cmdReincarnate
  2018. if Kernel.pbConfirmMessage(_INTL("Activate {1}'s birthsign?",pkmn.name))
  2019. if Time.now.mon==12 && pkmn.hasCurrentSign?
  2020. Kernel.pbMessage(_INTL("This power doesn't work unless its a different month!"))
  2021. break
  2022. end
  2023. Kernel.pbMessage(_INTL("Activating this birthsign will reset {1}'s birthsign, level,\nand many other attributes.",pkmn.name))
  2024. pbWait(10)
  2025. if Kernel.pbConfirmMessage(_INTL("Are you sure you want to activate this birthsign?"))
  2026. pkmn.level=EGGINITIALLEVEL
  2027. pkmn.ev=[0,0,0,0,0,0]
  2028. pkmn.happiness=120
  2029. pkmn.pokerus=0
  2030. pkmn.timeEggHatched=pbGetTimeNow
  2031. pkmn.obtainText=_INTL("From a previous life.")
  2032. if pkmn.obtainMode!=1
  2033. pkmn.setBirthsign(Time.now.mon)
  2034. end
  2035. Kernel.pbMessage(_INTL("{1} was reincarnated by the power of {2}!",pkmn.name,PBBirthsigns.getName(12)))
  2036. Kernel.pbMessage(_INTL("And..."))
  2037. pbSEPlay("ItemGet")
  2038. Kernel.pbMessage(_INTL("{1} gained the power of\n{2}!",pkmn.name,pkmn.pbGetBirthsignName))
  2039. pkmn.calcStats
  2040. pbRefresh
  2041. if Kernel.pbConfirmMessage(_INTL("Would you like to rename the reincarnated Pokémon?"))
  2042. species=PBSpecies.getName(pkmn.species)
  2043. nickname=pbEnterPokemonName(_INTL("{1}'s new name?",pkmn.name),0,10,"",pkmn)
  2044. pkmn.name=nickname if nickname!=""
  2045. pbRefresh
  2046. end
  2047. if !pkmn.hasRibbon?(:SECONDSTEP)
  2048. pkmn.giveRibbon(:SECONDSTEP)
  2049. Kernel.pbMessage(_INTL("You put the Second Step Ribbon on {1} to commemorate new life.",pkmn.name))
  2050. end
  2051. pbRefresh
  2052. end
  2053. end
  2054. #===============================================================================
  2055. elsif cmdSwitch>=0 && command==cmdSwitch
  2056. @scene.pbSetHelpText(_INTL("Move to where?"))
  2057. oldpkmnid=pkmnid
  2058. pkmnid=@scene.pbChoosePokemon(true)
  2059. if pkmnid>=0 && pkmnid!=oldpkmnid
  2060. pbSwitch(oldpkmnid,pkmnid)
  2061. end
  2062. elsif cmdDebug>=0 && command==cmdDebug
  2063. pbPokemonDebug(pkmn,pkmnid)
  2064. elsif cmdMail>=0 && command==cmdMail
  2065. command=@scene.pbShowCommands(_INTL("Do what with the mail?"),[_INTL("Read"),_INTL("Take"),_INTL("Cancel")])
  2066. case command
  2067. when 0 # Read
  2068. pbFadeOutIn(99999){
  2069. pbDisplayMail(pkmn.mail,pkmn)
  2070. }
  2071. when 1 # Take
  2072. pbTakeMail(pkmn)
  2073. pbRefreshSingle(pkmnid)
  2074. end
  2075. elsif cmdItem>=0 && command==cmdItem
  2076. command=@scene.pbShowCommands(_INTL("Do what with an item?"),[_INTL("Give"),_INTL("Take"),_INTL("Cancel")])
  2077. case command
  2078. when 0 # Give
  2079. item=@scene.pbChooseItem($PokemonBag)
  2080. if item>0
  2081. pbGiveMail(item,pkmn,pkmnid)
  2082. pbRefreshSingle(pkmnid)
  2083. end
  2084. when 1 # Take
  2085. pbTakeMail(pkmn)
  2086. pbRefreshSingle(pkmnid)
  2087. end
  2088. end
  2089. end
  2090. @scene.pbEndScene
  2091. return nil
  2092. end
  2093. end
  2094.  
  2095. #########[SECTION 5]##########
  2096. #===============================================================================
  2097. # Birthsigns Summary - Page rewrites
  2098. #===============================================================================
  2099. # Overwrites areas within the PScreen_Summary section.
  2100. # Adds zodiac tokens and other tweaks to the summary pages.
  2101. # #TAG13
  2102. #===============================================================================
  2103. class PokemonSummaryScene
  2104.  
  2105. #===============================================================================
  2106. # Birthsigns - Zodiac Token
  2107. # The token image displayed on each summary page.
  2108. #===============================================================================
  2109. def pbDisplaySummaryToken
  2110. tokenpath1="Graphics/Pictures/Birthsigns/token%02d"
  2111. tokenpath2="Graphics/Pictures/Birthsigns/Birthsigns2/token%02d"
  2112. if @pokemon.obtainMode==1
  2113. if !BIRTHSIGNS_SET_2
  2114. sprintf(tokenpath1,zodiacValue(@pokemon.birthsign))
  2115. else
  2116. sprintf(tokenpath2,zodiacValue(@pokemon.birthsign))
  2117. end
  2118. else
  2119. if !BIRTHSIGNS_SET_2
  2120. sprintf(tokenpath1,PBBirthsigns.signValue(@pokemon.birthsign))
  2121. else
  2122. sprintf(tokenpath2,PBBirthsigns.signValue(@pokemon.birthsign))
  2123. end
  2124. end
  2125. end
  2126.  
  2127. #===============================================================================
  2128. # Page 1: Info
  2129. #===============================================================================
  2130. def drawPageOne(pokemon)
  2131. if pokemon.isEgg?
  2132. drawPageOneEgg(pokemon)
  2133. return
  2134. end
  2135. overlay=@sprites["overlay"].bitmap
  2136. overlay.clear
  2137. @sprites["background"].setBitmap("Graphics/Pictures/summary1")
  2138. imagepos=[]
  2139. if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
  2140. status=6 if pbPokerus(pokemon)==1
  2141. status=@pokemon.status-1 if @pokemon.status>0
  2142. status=5 if pokemon.hp==0
  2143. imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
  2144. end
  2145. if pokemon.isShiny?
  2146. imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134,0,0,-1,-1])
  2147. end
  2148. if pbPokerus(pokemon)==2
  2149. imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),176,100,0,0,-1,-1])
  2150. end
  2151. ballused=@pokemon.ballused ? @pokemon.ballused : 0
  2152. ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
  2153. imagepos.push([ballimage,14,60,0,0,-1,-1])
  2154. #===========================================================================
  2155. # Birthsigns - Zodiac Token
  2156. #===========================================================================
  2157. if !(@pokemon.isShadow? rescue false)
  2158. zodiactoken=pbDisplaySummaryToken
  2159. imagepos.push([zodiactoken,150,260,0,0,-1,-1])
  2160. end
  2161. #===========================================================================
  2162. if (pokemon.isShadow? rescue false)
  2163. imagepos.push(["Graphics/Pictures/summaryShadow",224,240,0,0,-1,-1])
  2164. shadowfract=pokemon.heartgauge*1.0/PokeBattle_Pokemon::HEARTGAUGESIZE
  2165. imagepos.push(["Graphics/Pictures/summaryShadowBar",242,280,0,0,(shadowfract*248).floor,-1])
  2166. end
  2167. pbDrawImagePositions(overlay,imagepos)
  2168. base=Color.new(248,248,248)
  2169. shadow=Color.new(104,104,104)
  2170. pbSetSystemFont(overlay)
  2171. numberbase=(pokemon.isShiny?) ? Color.new(248,56,32) : Color.new(64,64,64)
  2172. numbershadow=(pokemon.isShiny?) ? Color.new(224,152,144) : Color.new(176,176,176)
  2173. publicID=pokemon.publicID
  2174. speciesname=PBSpecies.getName(pokemon.species)
  2175. growthrate=pokemon.growthrate
  2176. startexp=PBExperience.pbGetStartExperience(pokemon.level,growthrate)
  2177. endexp=PBExperience.pbGetStartExperience(pokemon.level+1,growthrate)
  2178. pokename=@pokemon.name
  2179. textpos=[
  2180. [_INTL("INFO"),26,16,0,base,shadow],
  2181. [pokename,46,62,0,base,shadow],
  2182. [pokemon.level.to_s,46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
  2183. [_INTL("Item"),16,320,0,base,shadow],
  2184. [_ISPRINTF("Dex No."),238,80,0,base,shadow],
  2185. [sprintf("%03d",pokemon.species),435,80,2,numberbase,numbershadow],
  2186. [_INTL("Species"),238,112,0,base,shadow],
  2187. [speciesname,435,112,2,Color.new(64,64,64),Color.new(176,176,176)],
  2188. [_INTL("Type"),238,144,0,base,shadow],
  2189. [_INTL("OT"),238,176,0,base,shadow],
  2190. [_INTL("ID No."),238,208,0,base,shadow],
  2191. ]
  2192. if pokemon.hasItem?
  2193. textpos.push([PBItems.getName(pokemon.item),16,352,0,Color.new(64,64,64),Color.new(176,176,176)])
  2194. else
  2195. textpos.push([_INTL("None"),16,352,0,Color.new(184,184,160),Color.new(208,208,200)])
  2196. end
  2197. if (pokemon.isShadow? rescue false)
  2198. textpos.push([_INTL("Heart Gauge"),238,240,0,base,shadow])
  2199. heartmessage=[_INTL("The door to its heart is open! Undo the final lock!"),
  2200. _INTL("The door to its heart is almost fully open."),
  2201. _INTL("The door to its heart is nearly open."),
  2202. _INTL("The door to its heart is opening wider."),
  2203. _INTL("The door to its heart is opening up."),
  2204. _INTL("The door to its heart is tightly shut.")
  2205. ][pokemon.heartStage]
  2206. memo=sprintf("<c3=404040,B0B0B0>%s\n",heartmessage)
  2207. drawFormattedTextEx(overlay,238,304,276,memo)
  2208. else
  2209. textpos.push([_INTL("Exp. Points"),238,240,0,base,shadow])
  2210. textpos.push([sprintf("%d",pokemon.exp),488,272,1,Color.new(64,64,64),Color.new(176,176,176)])
  2211. textpos.push([_INTL("To Next Lv."),238,304,0,base,shadow])
  2212. textpos.push([sprintf("%d",endexp-pokemon.exp),488,336,1,Color.new(64,64,64),Color.new(176,176,176)])
  2213. end
  2214. idno=(pokemon.ot=="") ? "?????" : sprintf("%05d",publicID)
  2215. textpos.push([idno,435,208,2,Color.new(64,64,64),Color.new(176,176,176)])
  2216. if pokemon.ot==""
  2217. textpos.push([_INTL("RENTAL"),435,176,2,Color.new(64,64,64),Color.new(176,176,176)])
  2218. else
  2219. ownerbase=Color.new(64,64,64)
  2220. ownershadow=Color.new(176,176,176)
  2221. if pokemon.otgender==0 # male OT
  2222. ownerbase=Color.new(24,112,216)
  2223. ownershadow=Color.new(136,168,208)
  2224. elsif pokemon.otgender==1 # female OT
  2225. ownerbase=Color.new(248,56,32)
  2226. ownershadow=Color.new(224,152,144)
  2227. end
  2228. textpos.push([pokemon.ot,435,176,2,ownerbase,ownershadow])
  2229. end
  2230. if pokemon.isMale?
  2231. textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
  2232. elsif pokemon.isFemale?
  2233. textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
  2234. end
  2235. pbDrawTextPositions(overlay,textpos)
  2236. drawMarkings(overlay,15,291,72,20,pokemon.markings)
  2237. type1rect=Rect.new(0,pokemon.type1*28,64,28)
  2238. type2rect=Rect.new(0,pokemon.type2*28,64,28)
  2239. if pokemon.type1==pokemon.type2
  2240. overlay.blt(402,146,@typebitmap.bitmap,type1rect)
  2241. else
  2242. overlay.blt(370,146,@typebitmap.bitmap,type1rect)
  2243. overlay.blt(436,146,@typebitmap.bitmap,type2rect)
  2244. end
  2245. if pokemon.level<PBExperience::MAXLEVEL
  2246. overlay.fill_rect(362,372,(pokemon.exp-startexp)*128/(endexp-startexp),2,Color.new(72,120,160))
  2247. overlay.fill_rect(362,374,(pokemon.exp-startexp)*128/(endexp-startexp),4,Color.new(24,144,248))
  2248. end
  2249. end
  2250.  
  2251. #===============================================================================
  2252. # Page 2: Memo
  2253. # The Birthsigns page is accessible here by pressing the confirm button.
  2254. #===============================================================================
  2255. def drawPageTwo(pokemon)
  2256. overlay=@sprites["overlay"].bitmap
  2257. overlay.clear
  2258. @sprites["background"].setBitmap("Graphics/Pictures/summary2")
  2259. imagepos=[]
  2260. if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
  2261. status=6 if pbPokerus(pokemon)==1
  2262. status=@pokemon.status-1 if @pokemon.status>0
  2263. status=5 if pokemon.hp==0
  2264. imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
  2265. end
  2266. if pokemon.isShiny?
  2267. imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134,0,0,-1,-1])
  2268. end
  2269. if pbPokerus(pokemon)==2
  2270. imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),176,100,0,0,-1,-1])
  2271. end
  2272. ballused=@pokemon.ballused ? @pokemon.ballused : 0
  2273. ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
  2274. imagepos.push([ballimage,14,60,0,0,-1,-1])
  2275. #===========================================================================
  2276. # Birthsigns - Zodiac Token
  2277. #===========================================================================
  2278. if !(@pokemon.isShadow? rescue false)
  2279. zodiactoken=pbDisplaySummaryToken
  2280. imagepos.push([zodiactoken,150,260,0,0,-1,-1])
  2281. end
  2282. #===========================================================================
  2283. pbDrawImagePositions(overlay,imagepos)
  2284. base=Color.new(248,248,248)
  2285. shadow=Color.new(104,104,104)
  2286. pbSetSystemFont(overlay)
  2287. naturename=PBNatures.getName(pokemon.nature)
  2288. pokename=@pokemon.name
  2289. textpos=[
  2290. [_INTL("TRAINER MEMO"),26,16,0,base,shadow],
  2291. [pokename,46,62,0,base,shadow],
  2292. [pokemon.level.to_s,46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
  2293. [_INTL("Item"),16,320,0,base,shadow],
  2294. ]
  2295. if pokemon.hasItem?
  2296. textpos.push([PBItems.getName(pokemon.item),16,352,0,Color.new(64,64,64),Color.new(176,176,176)])
  2297. else
  2298. textpos.push([_INTL("None"),16,352,0,Color.new(184,184,160),Color.new(208,208,200)])
  2299. end
  2300. if pokemon.isMale?
  2301. textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
  2302. elsif pokemon.isFemale?
  2303. textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
  2304. end
  2305. pbDrawTextPositions(overlay,textpos)
  2306. memo=""
  2307. shownature=(!(pokemon.isShadow? rescue false)) || pokemon.heartStage<=3
  2308. if shownature
  2309. memo+=_INTL("<c3=F83820,E09890>{1}<c3=404040,B0B0B0> nature.\n",naturename)
  2310. end
  2311. if pokemon.timeReceived
  2312. month=pbGetAbbrevMonthName(pokemon.timeReceived.mon)
  2313. date=pokemon.timeReceived.day
  2314. year=pokemon.timeReceived.year
  2315. memo+=_INTL("<c3=404040,B0B0B0>{1} {2}, {3}\n",month,date,year)
  2316. end
  2317. mapname=pbGetMapNameFromId(pokemon.obtainMap)
  2318. if (pokemon.obtainText rescue false) && pokemon.obtainText!=""
  2319. mapname=pokemon.obtainText
  2320. end
  2321. if mapname && mapname!=""
  2322. memo+=sprintf("<c3=F83820,E09890>%s\n",mapname)
  2323. else
  2324. memo+=_INTL("<c3=F83820,E09890>Faraway place\n")
  2325. end
  2326. if pokemon.obtainMode
  2327. mettext=[_INTL("Met at Lv. {1}.",pokemon.obtainLevel),
  2328. #=================================================================
  2329. # Birthsigns - The Eternal
  2330. # Changes met text for reincarnated Pokemon.
  2331. #=================================================================
  2332. if pokemon.hasRibbon?(:SECONDSTEP)
  2333. _INTL("Reincarnated.")
  2334. else
  2335. _INTL("Egg received.")
  2336. end,
  2337. #=================================================================
  2338. _INTL("Egg received."),
  2339. _INTL("Traded at Lv. {1}.",pokemon.obtainLevel),
  2340. "",
  2341. _INTL("Had a fateful encounter at Lv. {1}.",pokemon.obtainLevel)
  2342. ][pokemon.obtainMode]
  2343. memo+=sprintf("<c3=404040,B0B0B0>%s\n",mettext)
  2344. if pokemon.obtainMode==1 # hatched
  2345. if pokemon.timeEggHatched
  2346. month=pbGetAbbrevMonthName(pokemon.timeEggHatched.mon)
  2347. date=pokemon.timeEggHatched.day
  2348. year=pokemon.timeEggHatched.year
  2349. memo+=_INTL("<c3=404040,B0B0B0>{1} {2}, {3}\n",month,date,year)
  2350. end
  2351. mapname=pbGetMapNameFromId(pokemon.hatchedMap)
  2352. if mapname && mapname!=""
  2353. memo+=sprintf("<c3=F83820,E09890>%s\n",mapname)
  2354. else
  2355. memo+=_INTL("<c3=F83820,E09890>Faraway place\n")
  2356. end
  2357. memo+=_INTL("<c3=404040,B0B0B0>Egg hatched.\n")
  2358. else
  2359. memo+="<c3=404040,B0B0B0>\n"
  2360. end
  2361. end
  2362. if shownature
  2363. bestiv=0
  2364. tiebreaker=pokemon.personalID%6
  2365. for i in 0...6
  2366. if pokemon.iv[i]==pokemon.iv[bestiv]
  2367. bestiv=i if i>=tiebreaker && bestiv<tiebreaker
  2368. elsif pokemon.iv[i]>pokemon.iv[bestiv]
  2369. bestiv=i
  2370. end
  2371. end
  2372. characteristic=[_INTL("Loves to eat."),
  2373. _INTL("Often dozes off."),
  2374. _INTL("Often scatters things."),
  2375. _INTL("Scatters things often."),
  2376. _INTL("Likes to relax."),
  2377. _INTL("Proud of its power."),
  2378. _INTL("Likes to thrash about."),
  2379. _INTL("A little quick tempered."),
  2380. _INTL("Likes to fight."),
  2381. _INTL("Quick tempered."),
  2382. _INTL("Sturdy body."),
  2383. _INTL("Capable of taking hits."),
  2384. _INTL("Highly persistent."),
  2385. _INTL("Good endurance."),
  2386. _INTL("Good perseverance."),
  2387. _INTL("Likes to run."),
  2388. _INTL("Alert to sounds."),
  2389. _INTL("Impetuous and silly."),
  2390. _INTL("Somewhat of a clown."),
  2391. _INTL("Quick to flee."),
  2392. _INTL("Highly curious."),
  2393. _INTL("Mischievous."),
  2394. _INTL("Thoroughly cunning."),
  2395. _INTL("Often lost in thought."),
  2396. _INTL("Very finicky."),
  2397. _INTL("Strong willed."),
  2398. _INTL("Somewhat vain."),
  2399. _INTL("Strongly defiant."),
  2400. _INTL("Hates to lose."),
  2401. _INTL("Somewhat stubborn.")
  2402. ][bestiv*5+pokemon.iv[bestiv]%5]
  2403. memo+=sprintf("<c3=404040,B0B0B0>%s\n",characteristic)
  2404. end
  2405. drawFormattedTextEx(overlay,232,78,276,memo)
  2406. drawMarkings(overlay,15,291,72,20,pokemon.markings)
  2407. end
  2408.  
  2409. #===============================================================================
  2410. # Page 3: Stats
  2411. #===============================================================================
  2412. def drawPageThree(pokemon)
  2413. overlay=@sprites["overlay"].bitmap
  2414. overlay.clear
  2415. @sprites["background"].setBitmap("Graphics/Pictures/summary3")
  2416. imagepos=[]
  2417. if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
  2418. status=6 if pbPokerus(pokemon)==1
  2419. status=@pokemon.status-1 if @pokemon.status>0
  2420. status=5 if pokemon.hp==0
  2421. imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
  2422. end
  2423. if pokemon.isShiny?
  2424. imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134,0,0,-1,-1])
  2425. end
  2426. if pbPokerus(pokemon)==2
  2427. imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),176,100,0,0,-1,-1])
  2428. end
  2429. ballused=@pokemon.ballused ? @pokemon.ballused : 0
  2430. ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
  2431. imagepos.push([ballimage,14,60,0,0,-1,-1])
  2432. #===========================================================================
  2433. # Birthsigns - Zodiac Token
  2434. #===========================================================================
  2435. if !(@pokemon.isShadow? rescue false)
  2436. zodiactoken=pbDisplaySummaryToken
  2437. imagepos.push([zodiactoken,150,260,0,0,-1,-1])
  2438. end
  2439. #===========================================================================
  2440. pbDrawImagePositions(overlay,imagepos)
  2441. base=Color.new(248,248,248)
  2442. shadow=Color.new(104,104,104)
  2443. statshadows=[]
  2444. for i in 0...5; statshadows[i]=shadow; end
  2445. if !(pokemon.isShadow? rescue false) || pokemon.heartStage<=3
  2446. natup=(pokemon.nature/5).floor
  2447. natdn=(pokemon.nature%5).floor
  2448. statshadows[natup]=Color.new(136,96,72) if natup!=natdn
  2449. statshadows[natdn]=Color.new(64,120,152) if natup!=natdn
  2450. end
  2451. pbSetSystemFont(overlay)
  2452. abilityname=PBAbilities.getName(pokemon.ability)
  2453. abilitydesc=pbGetMessage(MessageTypes::AbilityDescs,pokemon.ability)
  2454. pokename=@pokemon.name
  2455. textpos=[
  2456. [_INTL("SKILLS"),26,16,0,base,shadow],
  2457. [pokename,46,62,0,base,shadow],
  2458. [pokemon.level.to_s,46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
  2459. [_INTL("Item"),16,320,0,base,shadow],
  2460. [_INTL("HP"),292,76,2,base,shadow],
  2461. [sprintf("%3d/%3d",pokemon.hp,pokemon.totalhp),462,76,1,Color.new(64,64,64),Color.new(176,176,176)],
  2462. [_INTL("Attack"),248,120,0,base,statshadows[0]],
  2463. [sprintf("%d",pokemon.attack),456,120,1,Color.new(64,64,64),Color.new(176,176,176)],
  2464. [_INTL("Defense"),248,152,0,base,statshadows[1]],
  2465. [sprintf("%d",pokemon.defense),456,152,1,Color.new(64,64,64),Color.new(176,176,176)],
  2466. [_INTL("Sp. Atk"),248,184,0,base,statshadows[3]],
  2467. [sprintf("%d",pokemon.spatk),456,184,1,Color.new(64,64,64),Color.new(176,176,176)],
  2468. [_INTL("Sp. Def"),248,216,0,base,statshadows[4]],
  2469. [sprintf("%d",pokemon.spdef),456,216,1,Color.new(64,64,64),Color.new(176,176,176)],
  2470. [_INTL("Speed"),248,248,0,base,statshadows[2]],
  2471. [sprintf("%d",pokemon.speed),456,248,1,Color.new(64,64,64),Color.new(176,176,176)],
  2472. [_INTL("Ability"),224,284,0,base,shadow],
  2473. [abilityname,362,284,0,Color.new(64,64,64),Color.new(176,176,176)],
  2474. ]
  2475. if pokemon.hasItem?
  2476. textpos.push([PBItems.getName(pokemon.item),16,352,0,Color.new(64,64,64),Color.new(176,176,176)])
  2477. else
  2478. textpos.push([_INTL("None"),16,352,0,Color.new(184,184,160),Color.new(208,208,200)])
  2479. end
  2480. if pokemon.isMale?
  2481. textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
  2482. elsif pokemon.isFemale?
  2483. textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
  2484. end
  2485. pbDrawTextPositions(overlay,textpos)
  2486. drawTextEx(overlay,224,316,282,2,abilitydesc,Color.new(64,64,64),Color.new(176,176,176))
  2487. drawMarkings(overlay,15,291,72,20,pokemon.markings)
  2488. if pokemon.hp>0
  2489. hpcolors=[
  2490. Color.new(24,192,32),Color.new(0,144,0), # Green
  2491. Color.new(248,184,0),Color.new(184,112,0), # Orange
  2492. Color.new(240,80,32),Color.new(168,48,56) # Red
  2493. ]
  2494. hpzone=0
  2495. hpzone=1 if pokemon.hp<=(@pokemon.totalhp/2).floor
  2496. hpzone=2 if pokemon.hp<=(@pokemon.totalhp/4).floor
  2497. overlay.fill_rect(360,110,pokemon.hp*96/pokemon.totalhp,2,hpcolors[hpzone*2+1])
  2498. overlay.fill_rect(360,112,pokemon.hp*96/pokemon.totalhp,4,hpcolors[hpzone*2])
  2499. end
  2500. end
  2501.  
  2502. #===============================================================================
  2503. # Page 4: Moves
  2504. #===============================================================================
  2505. def drawPageFour(pokemon)
  2506. overlay=@sprites["overlay"].bitmap
  2507. overlay.clear
  2508. @sprites["background"].setBitmap("Graphics/Pictures/summary4")
  2509. @sprites["pokemon"].visible=true
  2510. @sprites["pokeicon"].visible=false
  2511. imagepos=[]
  2512. if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
  2513. status=6 if pbPokerus(pokemon)==1
  2514. status=@pokemon.status-1 if @pokemon.status>0
  2515. status=5 if pokemon.hp==0
  2516. imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
  2517. end
  2518. if pokemon.isShiny?
  2519. imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134,0,0,-1,-1])
  2520. end
  2521. if pbPokerus(pokemon)==2
  2522. imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),176,100,0,0,-1,-1])
  2523. end
  2524. ballused=@pokemon.ballused ? @pokemon.ballused : 0
  2525. ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
  2526. imagepos.push([ballimage,14,60,0,0,-1,-1])
  2527. #===========================================================================
  2528. # Birthsigns - Zodiac Token
  2529. #===========================================================================
  2530. if !(@pokemon.isShadow? rescue false)
  2531. zodiactoken=pbDisplaySummaryToken
  2532. imagepos.push([zodiactoken,150,260,0,0,-1,-1])
  2533. end
  2534. #===========================================================================
  2535. pbDrawImagePositions(overlay,imagepos)
  2536. base=Color.new(248,248,248)
  2537. shadow=Color.new(104,104,104)
  2538. pbSetSystemFont(overlay)
  2539. pokename=@pokemon.name
  2540. textpos=[
  2541. [_INTL("MOVES"),26,16,0,base,shadow],
  2542. [pokename,46,62,0,base,shadow],
  2543. [pokemon.level.to_s,46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
  2544. [_INTL("Item"),16,320,0,base,shadow],
  2545. ]
  2546. if pokemon.hasItem?
  2547. textpos.push([PBItems.getName(pokemon.item),16,352,0,Color.new(64,64,64),Color.new(176,176,176)])
  2548. else
  2549. textpos.push([_INTL("None"),16,352,0,Color.new(184,184,160),Color.new(208,208,200)])
  2550. end
  2551. if pokemon.isMale?
  2552. textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
  2553. elsif pokemon.isFemale?
  2554. textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
  2555. end
  2556. pbDrawTextPositions(overlay,textpos)
  2557. imagepos=[]
  2558. yPos=98
  2559. for i in 0...pokemon.moves.length
  2560. if pokemon.moves[i].id>0
  2561. imagepos.push(["Graphics/Pictures/types",248,yPos+2,0,
  2562. pokemon.moves[i].type*28,64,28])
  2563. textpos.push([PBMoves.getName(pokemon.moves[i].id),316,yPos,0,
  2564. Color.new(64,64,64),Color.new(176,176,176)])
  2565. if pokemon.moves[i].totalpp>0
  2566. textpos.push([_ISPRINTF("PP"),342,yPos+32,0,
  2567. Color.new(64,64,64),Color.new(176,176,176)])
  2568. textpos.push([sprintf("%d/%d",pokemon.moves[i].pp,pokemon.moves[i].totalpp),
  2569. 460,yPos+32,1,Color.new(64,64,64),Color.new(176,176,176)])
  2570. end
  2571. else
  2572. textpos.push(["-",316,yPos,0,Color.new(64,64,64),Color.new(176,176,176)])
  2573. textpos.push(["--",442,yPos+32,1,Color.new(64,64,64),Color.new(176,176,176)])
  2574. end
  2575. yPos+=64
  2576. end
  2577. pbDrawTextPositions(overlay,textpos)
  2578. pbDrawImagePositions(overlay,imagepos)
  2579. drawMarkings(overlay,15,291,72,20,pokemon.markings)
  2580. end
  2581.  
  2582. #===============================================================================
  2583. # Page 5: Ribbons
  2584. #===============================================================================
  2585. def drawPageFive(pokemon)
  2586. overlay=@sprites["overlay"].bitmap
  2587. overlay.clear
  2588. @sprites["background"].setBitmap("Graphics/Pictures/summary5")
  2589. imagepos=[]
  2590. if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
  2591. status=6 if pbPokerus(pokemon)==1
  2592. status=@pokemon.status-1 if @pokemon.status>0
  2593. status=5 if pokemon.hp==0
  2594. imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
  2595. end
  2596. if pokemon.isShiny?
  2597. imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134,0,0,-1,-1])
  2598. end
  2599. if pbPokerus(pokemon)==2
  2600. imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),176,100,0,0,-1,-1])
  2601. end
  2602. ballused=@pokemon.ballused ? @pokemon.ballused : 0
  2603. ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
  2604. imagepos.push([ballimage,14,60,0,0,-1,-1])
  2605. #===========================================================================
  2606. # Birthsigns - Zodiac Token
  2607. #===========================================================================
  2608. if !(@pokemon.isShadow? rescue false)
  2609. zodiactoken=pbDisplaySummaryToken
  2610. imagepos.push([zodiactoken,150,260,0,0,-1,-1])
  2611. end
  2612. #===========================================================================
  2613. pbDrawImagePositions(overlay,imagepos)
  2614. base=Color.new(248,248,248)
  2615. shadow=Color.new(104,104,104)
  2616. pbSetSystemFont(overlay)
  2617. pokename=@pokemon.name
  2618. textpos=[
  2619. [_INTL("RIBBONS"),26,16,0,base,shadow],
  2620. [pokename,46,62,0,base,shadow],
  2621. [pokemon.level.to_s,46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
  2622. [_INTL("Item"),16,320,0,base,shadow],
  2623. [_INTL("No. of Ribbons:"),234,342,0,Color.new(64,64,64),Color.new(176,176,176)],
  2624. [pokemon.ribbonCount.to_s,450,342,1,Color.new(64,64,64),Color.new(176,176,176)],
  2625. ]
  2626. if pokemon.hasItem?
  2627. textpos.push([PBItems.getName(pokemon.item),16,352,0,Color.new(64,64,64),Color.new(176,176,176)])
  2628. else
  2629. textpos.push([_INTL("None"),16,352,0,Color.new(184,184,160),Color.new(208,208,200)])
  2630. end
  2631. if pokemon.isMale?
  2632. textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
  2633. elsif pokemon.isFemale?
  2634. textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
  2635. end
  2636. pbDrawTextPositions(overlay,textpos)
  2637. imagepos=[]
  2638. coord=0
  2639. if pokemon.ribbons
  2640. for i in pokemon.ribbons
  2641. ribn=i-1
  2642. imagepos.push(["Graphics/Pictures/ribbons",236+64*(coord%4),86+80*(coord/4).floor,
  2643. 64*(ribn%8),64*(ribn/8).floor,64,64])
  2644. coord+=1
  2645. break if coord>=12
  2646. end
  2647. end
  2648. pbDrawImagePositions(overlay,imagepos)
  2649. drawMarkings(overlay,15,291,72,20,pokemon.markings)
  2650. end
  2651.  
  2652. #===============================================================================
  2653. # Summary - Birthsign Page
  2654. #===============================================================================
  2655. # Draws the Birthsign Summary Page, accessible by pressing the confirm
  2656. # button on the Memo Page (Page 2).
  2657. #===============================================================================
  2658. def drawBirthsignPage(pokemon)
  2659. overlay=@sprites["overlay"].bitmap
  2660. overlay.clear
  2661. imagepos=[]
  2662. #=========================================================================
  2663. # Images
  2664. #=========================================================================
  2665. bgpath1="Graphics/Pictures/Birthsigns/birthsign%02d"
  2666. bgpath2="Graphics/Pictures/Birthsigns/Birthsigns2/birthsign%02d"
  2667. if @pokemon.obtainMode==1
  2668. if !BIRTHSIGNS_SET_2
  2669. zodiacimage=sprintf(bgpath1,zodiacValue(@pokemon.birthsign))
  2670. else
  2671. zodiacimage=sprintf(bgpath2,zodiacValue(@pokemon.birthsign))
  2672. end
  2673. else
  2674. if !BIRTHSIGNS_SET_2
  2675. zodiacimage=sprintf(bgpath1,PBBirthsigns.signValue(@pokemon.birthsign))
  2676. else
  2677. zodiacimage=sprintf(bgpath2,PBBirthsigns.signValue(@pokemon.birthsign))
  2678. end
  2679. end
  2680. zodiactoken=pbDisplaySummaryToken
  2681. imagepos.push([zodiacimage,0,0,0,0,-1,-1])
  2682. imagepos.push(["Graphics/Pictures/Birthsigns/Other/summaryzboarder",0,0,0,0,-1,-1])
  2683. imagepos.push([zodiactoken,4,122,0,0,-1,-1])
  2684. if @pokemon.isBirthday?
  2685. imagepos.push(["Graphics/Pictures/Birthsigns/Other/bdayicon",190,316,0,0,-1,-1])
  2686. end
  2687. pbDrawImagePositions(overlay,imagepos)
  2688. #=========================================================================
  2689. # Text
  2690. #=========================================================================
  2691. zodiac=@pokemon.pbGetBirthsignName
  2692. zodiacdesc=@pokemon.pbGetBirthsignDesc
  2693. month=pbGetAbbrevMonthName(pokemon.birthsign)
  2694. lastday=pokemon.pbLastMonthDay
  2695. pokename=@pokemon.name
  2696. # White Text
  2697. base=Color.new(248,248,248)
  2698. shadow=Color.new(104,104,104)
  2699. # Black Text
  2700. base2=Color.new(64,64,64)
  2701. shadow2=Color.new(176,176,176)
  2702. # Birthday Text
  2703. bdaycolor1=Color.new(255,215,0)
  2704. bdaycolor2=Color.new(0,0,125)
  2705. pbSetSystemFont(overlay)
  2706. textpos=[
  2707. [_INTL("BIRTHSIGN"),26,16,0,base,shadow],
  2708. [_INTL("{1}'s Birthsign",pokename),123,60,2,base,shadow],
  2709. [zodiac,121,90,2,base2,shadow2],
  2710. [_INTL("Sign: {1} 1st - {2}",month,lastday),4,352,0,base2,shadow2]
  2711. ]
  2712. if pokemon.obtainMode==1
  2713. if pokemon.timeEggHatched
  2714. date=pokemon.timeEggHatched.day
  2715. year=pokemon.timeEggHatched.year
  2716. if pokemon.isBirthday?
  2717. textpos.push([_INTL("Happy Birthday!"),22,320,0,bdaycolor1,bdaycolor2])
  2718. else
  2719. textpos.push([_INTL("Birthday: {1} {2}, {3}",month,date,year),4,320,0,base,shadow])
  2720. end
  2721. end
  2722. else
  2723. textpos.push([_INTL("Birthday: Unknown"),4,320,0,base,shadow])
  2724. end
  2725. pbDrawTextPositions(overlay,textpos)
  2726. pbSetSmallFont(overlay)
  2727. drawTextEx(overlay,260,320,258,0,zodiacdesc,base,shadow)
  2728. loop do
  2729. Input.update
  2730. Graphics.update
  2731. if Input.trigger?(Input::B)
  2732. Input.update
  2733. break
  2734. end
  2735. pbUpdate
  2736. end
  2737. end
  2738.  
  2739. #===============================================================================
  2740. # Summary - Page access
  2741. #===============================================================================
  2742. # Overwrites the section in PScreen_Summary that changes pages in the Summary.
  2743. #===============================================================================
  2744. def pbScene
  2745. pbPlayCry(@pokemon)
  2746. loop do
  2747. Graphics.update
  2748. Input.update
  2749. pbUpdate
  2750. if Input.trigger?(Input::B)
  2751. break
  2752. end
  2753. dorefresh=false
  2754. if Input.trigger?(Input::C)
  2755. if @page==0
  2756. break
  2757. elsif @page==3
  2758. pbMoveSelection
  2759. dorefresh=true
  2760. drawPageFour(@pokemon)
  2761. #=========================================================================
  2762. # Birthsigns page access
  2763. #=========================================================================
  2764. elsif @page==1 && @pokemon.hasBirthsign?
  2765. drawBirthsignPage(@pokemon)
  2766. drawPageTwo(@pokemon)
  2767. #=========================================================================
  2768. end
  2769. end
  2770. if Input.trigger?(Input::UP) && @partyindex>0
  2771. oldindex=@partyindex
  2772. pbGoToPrevious
  2773. if @partyindex!=oldindex
  2774. @pokemon=@party[@partyindex]
  2775. @sprites["pokemon"].setPokemonBitmap(@pokemon)
  2776. @sprites["pokemon"].color=Color.new(0,0,0,0)
  2777. pbPositionPokemonSprite(@sprites["pokemon"],40,144)
  2778. dorefresh=true
  2779. pbPlayCry(@pokemon)
  2780. end
  2781. end
  2782. if Input.trigger?(Input::DOWN) && @partyindex<@party.length-1
  2783. oldindex=@partyindex
  2784. pbGoToNext
  2785. if @partyindex!=oldindex
  2786. @pokemon=@party[@partyindex]
  2787. @sprites["pokemon"].setPokemonBitmap(@pokemon)
  2788. @sprites["pokemon"].color=Color.new(0,0,0,0)
  2789. pbPositionPokemonSprite(@sprites["pokemon"],40,144)
  2790. dorefresh=true
  2791. pbPlayCry(@pokemon)
  2792. end
  2793. end
  2794. if Input.trigger?(Input::LEFT) && !@pokemon.isEgg?
  2795. oldpage=@page
  2796. @page-=1
  2797. @page=0 if @page<0
  2798. @page=4 if @page>4
  2799. dorefresh=true
  2800. if @page!=oldpage # Move to next page
  2801. pbPlayCursorSE()
  2802. dorefresh=true
  2803. end
  2804. end
  2805. if Input.trigger?(Input::RIGHT) && !@pokemon.isEgg?
  2806. oldpage=@page
  2807. @page+=1
  2808. @page=0 if @page<0
  2809. @page=4 if @page>4
  2810. if @page!=oldpage # Move to next page
  2811. pbPlayCursorSE()
  2812. dorefresh=true
  2813. end
  2814. end
  2815. if dorefresh
  2816. case @page
  2817. when 0
  2818. drawPageOne(@pokemon)
  2819. when 1
  2820. drawPageTwo(@pokemon)
  2821. when 2
  2822. drawPageThree(@pokemon)
  2823. when 3
  2824. drawPageFour(@pokemon)
  2825. when 4
  2826. drawPageFive(@pokemon)
  2827. end
  2828. end
  2829. end
  2830. return @partyindex
  2831. end
  2832. end
  2833.  
  2834. #########[SECTION 6]##########
  2835. #===============================================================================
  2836. # Birthsign Bonuses - Hatch effects
  2837. #===============================================================================
  2838. # Applies Birthsign effects upon hatching or recieving and Egg that alter
  2839. # the Pokemon in some way.
  2840. # Overwrites sections in PField_DayCare & PScreen_EggHatching
  2841. #===============================================================================
  2842. def pbDayCareGenerateEgg
  2843. if pbDayCareDeposited!=2
  2844. return
  2845. elsif $Trainer.party.length>=6
  2846. raise _INTL("Can't store the egg")
  2847. end
  2848. pokemon0=$PokemonGlobal.daycare[0][0]
  2849. pokemon1=$PokemonGlobal.daycare[1][0]
  2850. mother=nil
  2851. father=nil
  2852. babyspecies=0
  2853. ditto0=pbIsDitto?(pokemon0)
  2854. ditto1=pbIsDitto?(pokemon1)
  2855. if (pokemon0.isFemale? || ditto0)
  2856. babyspecies=(ditto0) ? pokemon1.species : pokemon0.species
  2857. mother=pokemon0
  2858. father=pokemon1
  2859. else
  2860. babyspecies=(ditto1) ? pokemon0.species : pokemon1.species
  2861. mother=pokemon1
  2862. father=pokemon0
  2863. end
  2864. babyspecies=pbGetBabySpecies(babyspecies,mother.item,father.item)
  2865. if isConst?(babyspecies,PBSpecies,:MANAPHY) && hasConst?(PBSpecies,:PHIONE)
  2866. babyspecies=getConst(PBSpecies,:PHIONE)
  2867. elsif (isConst?(babyspecies,PBSpecies,:NIDORANfE) && hasConst?(PBSpecies,:NIDORANmA)) ||
  2868. (isConst?(babyspecies,PBSpecies,:NIDORANmA) && hasConst?(PBSpecies,:NIDORANfE))
  2869. babyspecies=[getConst(PBSpecies,:NIDORANmA),
  2870. getConst(PBSpecies,:NIDORANfE)][rand(2)]
  2871. elsif (isConst?(babyspecies,PBSpecies,:VOLBEAT) && hasConst?(PBSpecies,:ILLUMISE)) ||
  2872. (isConst?(babyspecies,PBSpecies,:ILLUMISE) && hasConst?(PBSpecies,:VOLBEAT))
  2873. babyspecies=[getConst(PBSpecies,:VOLBEAT),
  2874. getConst(PBSpecies,:ILLUMISE)][rand(2)]
  2875. end
  2876. # Generate egg
  2877. egg=PokeBattle_Pokemon.new(babyspecies,EGGINITIALLEVEL,$Trainer)
  2878. # Randomise personal ID
  2879. pid=rand(65536)
  2880. pid|=(rand(65536)<<16)
  2881. egg.personalID=pid
  2882. # Inheriting form
  2883. if isConst?(babyspecies,PBSpecies,:BURMY) ||
  2884. isConst?(babyspecies,PBSpecies,:SHELLOS) ||
  2885. isConst?(babyspecies,PBSpecies,:BASCULIN)
  2886. egg.form=mother.form
  2887. end
  2888. # Inheriting Moves
  2889. moves=[]
  2890. othermoves=[]
  2891. movefather=father; movemother=mother
  2892. if pbIsDitto?(movefather) && !mother.isFemale?
  2893. movefather=mother; movemother=father
  2894. end
  2895. # Initial Moves
  2896. initialmoves=egg.getMoveList
  2897. for k in initialmoves
  2898. if k[0]<=EGGINITIALLEVEL
  2899. moves.push(k[1])
  2900. else
  2901. othermoves.push(k[1]) if mother.knowsMove?(k[1]) && father.knowsMove?(k[1])
  2902. end
  2903. end
  2904. # Inheriting Natural Moves
  2905. for move in othermoves
  2906. moves.push(move)
  2907. end
  2908. # Inheriting Machine Moves
  2909. if !USENEWBATTLEMECHANICS
  2910. for i in 0...$ItemData.length
  2911. next if !$ItemData[i]
  2912. atk=$ItemData[i][ITEMMACHINE]
  2913. next if !atk || atk==0
  2914. if egg.isCompatibleWithMove?(atk)
  2915. moves.push(atk) if movefather.knowsMove?(atk)
  2916. end
  2917. end
  2918. end
  2919. # Inheriting Egg Moves
  2920. if movefather.isMale?
  2921. pbRgssOpen("Data/eggEmerald.dat","rb"){|f|
  2922. f.pos=(babyspecies-1)*8
  2923. offset=f.fgetdw
  2924. length=f.fgetdw
  2925. if length>0
  2926. f.pos=offset
  2927. i=0; loop do break unless i<length
  2928. atk=f.fgetw
  2929. moves.push(atk) if movefather.knowsMove?(atk)
  2930. i+=1
  2931. end
  2932. end
  2933. }
  2934. end
  2935. if USENEWBATTLEMECHANICS
  2936. pbRgssOpen("Data/eggEmerald.dat","rb"){|f|
  2937. f.pos=(babyspecies-1)*8
  2938. offset=f.fgetdw
  2939. length=f.fgetdw
  2940. if length>0
  2941. f.pos=offset
  2942. i=0; loop do break unless i<length
  2943. atk=f.fgetw
  2944. moves.push(atk) if movemother.knowsMove?(atk)
  2945. i+=1
  2946. end
  2947. end
  2948. }
  2949. end
  2950. # Volt Tackle
  2951. lightball=false
  2952. if (isConst?(father.species,PBSpecies,:PIKACHU) ||
  2953. isConst?(father.species,PBSpecies,:RAICHU)) &&
  2954. isConst?(father.item,PBItems,:LIGHTBALL)
  2955. lightball=true
  2956. end
  2957. if (isConst?(mother.species,PBSpecies,:PIKACHU) ||
  2958. isConst?(mother.species,PBSpecies,:RAICHU)) &&
  2959. isConst?(mother.item,PBItems,:LIGHTBALL)
  2960. lightball=true
  2961. end
  2962. if lightball && isConst?(babyspecies,PBSpecies,:PICHU) &&
  2963. hasConst?(PBMoves,:VOLTTACKLE)
  2964. moves.push(getConst(PBMoves,:VOLTTACKLE))
  2965. end
  2966. moves|=[] # remove duplicates
  2967. # Assembling move list
  2968. finalmoves=[]
  2969. listend=moves.length-4
  2970. listend=0 if listend<0
  2971. j=0
  2972. for i in listend..listend+3
  2973. moveid=(i>=moves.length) ? 0 : moves[i]
  2974. finalmoves[j]=PBMove.new(moveid)
  2975. j+=1
  2976. end
  2977. # Inheriting Individual Values
  2978. ivs=[]
  2979. for i in 0...6
  2980. ivs[i]=rand(32)
  2981. end
  2982. ivinherit=[]
  2983. for i in 0...2
  2984. parent=[mother,father][i]
  2985. ivinherit[i]=PBStats::HP if isConst?(parent.item,PBItems,:POWERWEIGHT)
  2986. ivinherit[i]=PBStats::ATTACK if isConst?(parent.item,PBItems,:POWERBRACER)
  2987. ivinherit[i]=PBStats::DEFENSE if isConst?(parent.item,PBItems,:POWERBELT)
  2988. ivinherit[i]=PBStats::SPEED if isConst?(parent.item,PBItems,:POWERANKLET)
  2989. ivinherit[i]=PBStats::SPATK if isConst?(parent.item,PBItems,:POWERLENS)
  2990. ivinherit[i]=PBStats::SPDEF if isConst?(parent.item,PBItems,:POWERBAND)
  2991. end
  2992. num=0; r=rand(2)
  2993. for i in 0...2
  2994. if ivinherit[r]!=nil
  2995. parent=[mother,father][r]
  2996. ivs[ivinherit[r]]=parent.iv[ivinherit[r]]
  2997. num+=1
  2998. break
  2999. end
  3000. r=(r+1)%2
  3001. end
  3002. stats=[PBStats::HP,PBStats::ATTACK,PBStats::DEFENSE,
  3003. PBStats::SPEED,PBStats::SPATK,PBStats::SPDEF]
  3004. limit=(USENEWBATTLEMECHANICS && (isConst?(mother.item,PBItems,:DESTINYKNOT) ||
  3005. isConst?(father.item,PBItems,:DESTINYKNOT))) ? 5 : 3
  3006. loop do
  3007. freestats=[]
  3008. for i in stats
  3009. freestats.push(i) if !ivinherit.include?(i)
  3010. end
  3011. break if freestats.length==0
  3012. r=freestats[rand(freestats.length)]
  3013. parent=[mother,father][rand(2)]
  3014. ivs[r]=parent.iv[r]
  3015. ivinherit.push(r)
  3016. num+=1
  3017. break if num>=limit
  3018. end
  3019. # Inheriting nature
  3020. newnatures=[]
  3021. newnatures.push(mother.nature) if isConst?(mother.item,PBItems,:EVERSTONE)
  3022. newnatures.push(father.nature) if isConst?(father.item,PBItems,:EVERSTONE)
  3023. if newnatures.length>0
  3024. egg.setNature(newnatures[rand(newnatures.length)])
  3025. end
  3026. # Masuda method and Shiny Charm
  3027. shinyretries=0
  3028. shinyretries+=5 if father.language!=mother.language
  3029. shinyretries+=2 if hasConst?(PBItems,:SHINYCHARM) &&
  3030. $PokemonBag.pbQuantity(:SHINYCHARM)>0
  3031. if shinyretries>0
  3032. for i in 0...shinyretries
  3033. break if egg.isShiny?
  3034. egg.personalID=rand(65536)|(rand(65536)<<16)
  3035. end
  3036. end
  3037. # Inheriting ability from the mother
  3038. if (!ditto0 && !ditto1)
  3039. if mother.hasHiddenAbility?
  3040. egg.setAbility(mother.abilityIndex) if rand(10)<6
  3041. else
  3042. if rand(10)<8
  3043. egg.setAbility(mother.abilityIndex)
  3044. else
  3045. egg.setAbility((mother.abilityIndex+1)%2)
  3046. end
  3047. end
  3048. elsif ((!ditto0 && ditto1) || (!ditto1 && ditto0)) && USENEWBATTLEMECHANICS
  3049. parent=(!ditto0) ? mother : father
  3050. if parent.hasHiddenAbility?
  3051. egg.setAbility(parent.abilityIndex) if rand(10)<6
  3052. end
  3053. end
  3054. # Inheriting Poké Ball from the mother
  3055. if mother.isFemale? &&
  3056. !isConst?(pbBallTypeToBall(mother.ballused),PBItems,:MASTERBALL) &&
  3057. !isConst?(pbBallTypeToBall(mother.ballused),PBItems,:CHERISHBALL)
  3058. egg.ballused=mother.ballused
  3059. end
  3060. egg.iv[0]=ivs[0]
  3061. egg.iv[1]=ivs[1]
  3062. egg.iv[2]=ivs[2]
  3063. egg.iv[3]=ivs[3]
  3064. egg.iv[4]=ivs[4]
  3065. egg.iv[5]=ivs[5]
  3066. egg.moves[0]=finalmoves[0]
  3067. egg.moves[1]=finalmoves[1]
  3068. egg.moves[2]=finalmoves[2]
  3069. egg.moves[3]=finalmoves[3]
  3070. egg.calcStats
  3071. egg.obtainText=_INTL("Day-Care Couple")
  3072. egg.name=_INTL("Egg")
  3073. dexdata=pbOpenDexData
  3074. pbDexDataOffset(dexdata,babyspecies,21)
  3075. eggsteps=dexdata.fgetw
  3076. dexdata.close
  3077. egg.eggsteps=eggsteps
  3078. #===============================================================================
  3079. # Birthsign - The Ancestor
  3080. # 1/2 eggsteps if one parent has sign. 1/4 the steps if both do.
  3081. # #TAG15
  3082. #===============================================================================
  3083. if BIRTHSIGNS_SET_2
  3084. mothersign=mother.hasJulBirthsign?
  3085. fathersign=father.hasJulBirthsign?
  3086. if mothersign || fathersign
  3087. egg.eggsteps=eggsteps/2
  3088. if mothersign && fathersign
  3089. egg.eggsteps=eggsteps/4
  3090. end
  3091. end
  3092. end
  3093. #===============================================================================
  3094. if rand(65536)<POKERUSCHANCE
  3095. egg.givePokerus
  3096. end
  3097. $Trainer.party[$Trainer.party.length]=egg
  3098. end
  3099.  
  3100. def pbHatch(pokemon)
  3101. speciesname=PBSpecies.getName(pokemon.species)
  3102. pokemon.name=speciesname
  3103. pokemon.trainerID=$Trainer.id
  3104. pokemon.ot=$Trainer.name
  3105. pokemon.happiness=120
  3106. pokemon.timeEggHatched=pbGetTimeNow
  3107. pokemon.obtainMode=1
  3108. pokemon.hatchedMap=$game_map.map_id
  3109. #===============================================================================
  3110. # Birthsigns Bonuses - Passive Effects
  3111. #===============================================================================
  3112. pokemon.applyBirthsignBonuses
  3113. pokemon.zodiacflag=nil
  3114. #===============================================================================
  3115. $Trainer.seen[pokemon.species]=true
  3116. $Trainer.owned[pokemon.species]=true
  3117. pbSeenForm(pokemon)
  3118. pokemon.pbRecordFirstMoves
  3119. if !pbHatchAnimation(pokemon)
  3120. Kernel.pbMessage(_INTL("Huh?\1"))
  3121. Kernel.pbMessage(_INTL("...\1"))
  3122. Kernel.pbMessage(_INTL("... .... .....\1"))
  3123. Kernel.pbMessage(_INTL("{1} hatched from the Egg!",speciesname))
  3124. if Kernel.pbConfirmMessage(_INTL("Would you like to nickname the newly hatched {1}?",speciesname))
  3125. species=PBSpecies.getName(pokemon.species)
  3126. nickname=pbEnterPokemonName(_INTL("{1}'s nickname?",speciesname),0,10,"",pokemon)
  3127. pokemon.name=nickname if nickname!=""
  3128. end
  3129. end
  3130. end
  3131.  
  3132. #===============================================================================
  3133. # Birthsigns Bonuses - Shadow Pokemon
  3134. #===============================================================================
  3135. # Applies passive birthsign effects to a purified Shadow Pokemon if it was
  3136. # obtained through an egg.
  3137. #===============================================================================
  3138. def pbPurify(pokemon,scene)
  3139. if pokemon.heartgauge==0 && pokemon.shadow
  3140. return if !pokemon.savedev && !pokemon.savedexp
  3141. pokemon.shadow=false
  3142. pokemon.giveRibbon(PBRibbons::NATIONAL)
  3143. scene.pbDisplay(_INTL("{1} opened the door to its heart!",pokemon.name))
  3144. oldmoves=[]
  3145. for i in 0...4; oldmoves.push(pokemon.moves[i].id); end
  3146. pokemon.pbUpdateShadowMoves()
  3147. for i in 0...4
  3148. if pokemon.moves[i].id!=0 && pokemon.moves[i].id!=oldmoves[i]
  3149. scene.pbDisplay(_INTL("{1} regained the move \n{2}!",
  3150. pokemon.name,PBMoves.getName(pokemon.moves[i].id)))
  3151. end
  3152. end
  3153. pokemon.pbRecordFirstMoves
  3154. if pokemon.savedev
  3155. for i in 0...6
  3156. pbApplyEVGain(pokemon,i,pokemon.savedev[i])
  3157. end
  3158. pokemon.savedev=nil
  3159. end
  3160. newexp=PBExperience.pbAddExperience(pokemon.exp,pokemon.savedexp||0,pokemon.growthrate)
  3161. pokemon.savedexp=nil
  3162. newlevel=PBExperience.pbGetLevelFromExperience(newexp,pokemon.growthrate)
  3163. curlevel=pokemon.level
  3164. if newexp!=pokemon.exp
  3165. scene.pbDisplay(_INTL("{1} regained {2} Exp. Points!",pokemon.name,newexp-pokemon.exp))
  3166. end
  3167. if newlevel==curlevel
  3168. pokemon.exp=newexp
  3169. pokemon.calcStats
  3170. else
  3171. pbChangeLevel(pokemon,newlevel,scene) # for convenience
  3172. pokemon.exp=newexp
  3173. end
  3174. #===========================================================================
  3175. # Birthsigns Bonuses - Passive Effects
  3176. #===========================================================================
  3177. if pokemon.hasBirthsign?
  3178. pokemon.applyBirthsignBonuses
  3179. pokemon.zodiacflag=nil
  3180. scene.pbDisplay(_INTL("{1} unlocked the power of its birthsign!",pokemon.name))
  3181. scene.pbDisplay(_INTL("{1} inherits the power of {2}!",pokemon.name,pokemon.pbGetBirthsignName))
  3182. end
  3183. #===========================================================================
  3184. speciesname=PBSpecies.getName(pokemon.species)
  3185. if scene.pbConfirm(_INTL("Would you like to give a nickname to {1}?",speciesname))
  3186. helptext=_INTL("{1}'s nickname?",speciesname)
  3187. newname=pbEnterPokemonName(helptext,0,10,"",pokemon)
  3188. pokemon.name=newname if newname!=""
  3189. end
  3190. end
  3191. end
  3192.  
  3193. #########[SECTION 7]##########
  3194. #===============================================================================
  3195. # Birthsign Bonuses - Battle Effects
  3196. #===============================================================================
  3197. # Applies Birthsign effects that alter conditions during or after battle.
  3198. # Overwrites sections in PokeBattle_Battle & PField_Field.
  3199. # #TAG8
  3200. #===============================================================================
  3201. def pbGenerateWildPokemon(species,level,isroamer=false)
  3202. genwildpoke=PokeBattle_Pokemon.new(species,level,$Trainer)
  3203. items=genwildpoke.wildHoldItems
  3204. firstpoke=$Trainer.firstParty
  3205. chances=[50,5,1]
  3206. chances=[60,20,5] if firstpoke && !firstpoke.isEgg? &&
  3207. isConst?(firstpoke.ability,PBAbilities,:COMPOUNDEYES)
  3208. itemrnd=rand(100)
  3209. if itemrnd<chances[0] || (items[0]==items[1] && items[1]==items[2])
  3210. genwildpoke.setItem(items[0])
  3211. elsif itemrnd<(chances[0]+chances[1])
  3212. genwildpoke.setItem(items[1])
  3213. elsif itemrnd<(chances[0]+chances[1]+chances[2])
  3214. genwildpoke.setItem(items[2])
  3215. end
  3216. if hasConst?(PBItems,:SHINYCHARM) && $PokemonBag.pbQuantity(:SHINYCHARM)>0
  3217. for i in 0...2 # 3 times as likely
  3218. break if genwildpoke.isShiny?
  3219. genwildpoke.personalID=rand(65536)|(rand(65536)<<16)
  3220. end
  3221. end
  3222. if rand(65536)<POKERUSCHANCE
  3223. genwildpoke.givePokerus
  3224. end
  3225. #===============================================================================
  3226. # Birthsign - The Assassin
  3227. # Wild Pokemon have a chance of being asleep for 1 turn when encountered.
  3228. # #TAG16
  3229. #===============================================================================
  3230. if $Trainer.party[0].hasSepBirthsign? && BIRTHSIGNS_SET_2
  3231. if genwildpoke.status=0
  3232. # The odds of encountering sleeping Pokemon at night (70%)
  3233. if PBDayNight.isNight?(pbGetTimeNow) && rand(100)<70
  3234. genwildpoke.status=1
  3235. genwildpoke.statusCount=2
  3236. # The odds of encountering sleeping Pokemon in day (30%)
  3237. elsif PBDayNight.isDay?(pbGetTimeNow) && rand(100)<30
  3238. genwildpoke.status=1
  3239. genwildpoke.statusCount=2
  3240. end
  3241. end
  3242. end
  3243. #===============================================================================
  3244. if firstpoke && !firstpoke.isEgg?
  3245. if isConst?(firstpoke.ability,PBAbilities,:CUTECHARM) &&
  3246. !genwildpoke.isSingleGendered?
  3247. if firstpoke.isMale?
  3248. (rand(3)<2) ? genwildpoke.makeFemale : genwildpoke.makeMale
  3249. elsif firstpoke.isFemale?
  3250. (rand(3)<2) ? genwildpoke.makeMale : genwildpoke.makeFemale
  3251. end
  3252. elsif isConst?(firstpoke.ability,PBAbilities,:SYNCHRONIZE)
  3253. genwildpoke.setNature(firstpoke.nature) if !isroamer && rand(10)<5
  3254. end
  3255. end
  3256. Events.onWildPokemonCreate.trigger(nil,genwildpoke)
  3257. return genwildpoke
  3258. end
  3259.  
  3260. class PokeBattle_Battle
  3261.  
  3262. def pbGainExpOne(index,defeated,partic,expshare,haveexpall,showmessages=true)
  3263. thispoke=@party1[index]
  3264. # Original species, not current species
  3265. level=defeated.level
  3266. baseexp=defeated.pokemon.baseExp
  3267. evyield=defeated.pokemon.evYield
  3268. ispartic=0
  3269. ispartic=1 if defeated.participants.include?(index)
  3270. haveexpshare=(isConst?(thispoke.item,PBItems,:EXPSHARE) ||
  3271. isConst?(thispoke.itemInitial,PBItems,:EXPSHARE)) ? 1 : 0
  3272. exp=0
  3273. if expshare>0
  3274. if partic==0 # No participants, all Exp goes to Exp Share holders
  3275. exp=(level*baseexp).floor
  3276. exp=(exp/(NOSPLITEXP ? 1 : expshare)).floor*haveexpshare
  3277. else
  3278. if NOSPLITEXP
  3279. exp=(level*baseexp).floor*ispartic
  3280. exp=(level*baseexp/2).floor*haveexpshare if ispartic==0
  3281. else
  3282. exp=(level*baseexp/2).floor
  3283. exp=(exp/partic).floor*ispartic + (exp/expshare).floor*haveexpshare
  3284. end
  3285. end
  3286. elsif ispartic==1
  3287. exp=(level*baseexp/(NOSPLITEXP ? 1 : partic)).floor
  3288. elsif haveexpall
  3289. exp=(level*baseexp/2).floor
  3290. end
  3291. return if exp<=0
  3292. #===============================================================================
  3293. # Birthsign - The Scholar
  3294. # The Pokemon gains 20% more exp. than normal.
  3295. # #TAG17
  3296. #===============================================================================
  3297. if thispoke.hasFebBirthsign? && BIRTHSIGNS_SET_2
  3298. exp=(exp*3/2.5).floor
  3299. end
  3300. #===============================================================================
  3301. exp=(exp*3/2).floor if @opponent
  3302. if USESCALEDEXPFORMULA
  3303. exp=(exp/5).floor
  3304. leveladjust=(2*level+10.0)/(level+thispoke.level+10.0)
  3305. leveladjust=leveladjust**5
  3306. leveladjust=Math.sqrt(leveladjust)
  3307. exp=(exp*leveladjust).floor
  3308. exp+=1 if ispartic>0 || haveexpshare>0
  3309. else
  3310. exp=(exp/7).floor
  3311. end
  3312. isOutsider=(thispoke.trainerID!=self.pbPlayer.id ||
  3313. (thispoke.language!=0 && thispoke.language!=self.pbPlayer.language))
  3314. if isOutsider
  3315. if thispoke.language!=0 && thispoke.language!=self.pbPlayer.language
  3316. exp=(exp*1.7).floor
  3317. else
  3318. exp=(exp*3/2).floor
  3319. end
  3320. end
  3321. exp=(exp*3/2).floor if isConst?(thispoke.item,PBItems,:LUCKYEGG) ||
  3322. isConst?(thispoke.itemInitial,PBItems,:LUCKYEGG)
  3323. growthrate=thispoke.growthrate
  3324. newexp=PBExperience.pbAddExperience(thispoke.exp,exp,growthrate)
  3325. exp=newexp-thispoke.exp
  3326. if exp>0
  3327. if showmessages
  3328. if isOutsider
  3329. pbDisplayPaused(_INTL("{1} gained a boosted {2} Exp. Points!",thispoke.name,exp))
  3330. else
  3331. pbDisplayPaused(_INTL("{1} gained {2} Exp. Points!",thispoke.name,exp))
  3332. end
  3333. end
  3334. # Gain effort value points, using RS effort values
  3335. totalev=0
  3336. for k in 0...6
  3337. totalev+=thispoke.ev[k]
  3338. end
  3339. for k in 0...6
  3340. evgain=evyield[k]
  3341. evgain*=2 if isConst?(thispoke.item,PBItems,:MACHOBRACE) ||
  3342. isConst?(thispoke.itemInitial,PBItems,:MACHOBRACE)
  3343. case k
  3344. when PBStats::HP
  3345. evgain+=4 if isConst?(thispoke.item,PBItems,:POWERWEIGHT) ||
  3346. isConst?(thispoke.itemInitial,PBItems,:POWERWEIGHT)
  3347. when PBStats::ATTACK
  3348. evgain+=4 if isConst?(thispoke.item,PBItems,:POWERBRACER) ||
  3349. isConst?(thispoke.itemInitial,PBItems,:POWERBRACER)
  3350. when PBStats::DEFENSE
  3351. evgain+=4 if isConst?(thispoke.item,PBItems,:POWERBELT) ||
  3352. isConst?(thispoke.itemInitial,PBItems,:POWERBELT)
  3353. when PBStats::SPATK
  3354. evgain+=4 if isConst?(thispoke.item,PBItems,:POWERLENS) ||
  3355. isConst?(thispoke.itemInitial,PBItems,:POWERLENS)
  3356. when PBStats::SPDEF
  3357. evgain+=4 if isConst?(thispoke.item,PBItems,:POWERBAND) ||
  3358. isConst?(thispoke.itemInitial,PBItems,:POWERBAND)
  3359. when PBStats::SPEED
  3360. evgain+=4 if isConst?(thispoke.item,PBItems,:POWERANKLET) ||
  3361. isConst?(thispoke.itemInitial,PBItems,:POWERANKLET)
  3362. end
  3363. evgain*=2 if thispoke.pokerusStage>=1 # Infected or cured
  3364. if evgain>0
  3365. # Can't exceed overall limit
  3366. evgain-=totalev+evgain-PokeBattle_Pokemon::EVLIMIT if totalev+evgain>PokeBattle_Pokemon::EVLIMIT
  3367. # Can't exceed stat limit
  3368. evgain-=thispoke.ev[k]+evgain-PokeBattle_Pokemon::EVSTATLIMIT if thispoke.ev[k]+evgain>PokeBattle_Pokemon::EVSTATLIMIT
  3369. # Add EV gain
  3370. thispoke.ev[k]+=evgain
  3371. if thispoke.ev[k]>PokeBattle_Pokemon::EVSTATLIMIT
  3372. print "Single-stat EV limit #{PokeBattle_Pokemon::EVSTATLIMIT} exceeded.\r\nStat: #{k} EV gain: #{evgain} EVs: #{thispoke.ev.inspect}"
  3373. thispoke.ev[k]=PokeBattle_Pokemon::EVSTATLIMIT
  3374. end
  3375. totalev+=evgain
  3376. if totalev>PokeBattle_Pokemon::EVLIMIT
  3377. print "EV limit #{PokeBattle_Pokemon::EVLIMIT} exceeded.\r\nTotal EVs: #{totalev} EV gain: #{evgain} EVs: #{thispoke.ev.inspect}"
  3378. end
  3379. end
  3380. end
  3381. newlevel=PBExperience.pbGetLevelFromExperience(newexp,growthrate)
  3382. tempexp=0
  3383. curlevel=thispoke.level
  3384. if newlevel<curlevel
  3385. debuginfo="#{thispoke.name}: #{thispoke.level}/#{newlevel} | #{thispoke.exp}/#{newexp} | gain: #{exp}"
  3386. raise RuntimeError.new(_INTL("The new level ({1}) is less than the Pokémon's\r\ncurrent level ({2}), which shouldn't happen.\r\n[Debug: {3}]",
  3387. newlevel,curlevel,debuginfo))
  3388. return
  3389. end
  3390. if thispoke.respond_to?("isShadow?") && thispoke.isShadow?
  3391. thispoke.exp+=exp
  3392. else
  3393. tempexp1=thispoke.exp
  3394. tempexp2=0
  3395. # Find battler
  3396. battler=pbFindPlayerBattler(index)
  3397. loop do
  3398. # EXP Bar animation
  3399. startexp=PBExperience.pbGetStartExperience(curlevel,growthrate)
  3400. endexp=PBExperience.pbGetStartExperience(curlevel+1,growthrate)
  3401. tempexp2=(endexp<newexp) ? endexp : newexp
  3402. thispoke.exp=tempexp2
  3403. @scene.pbEXPBar(thispoke,battler,startexp,endexp,tempexp1,tempexp2)
  3404. tempexp1=tempexp2
  3405. curlevel+=1
  3406. if curlevel>newlevel
  3407. thispoke.calcStats
  3408. battler.pbUpdate(false) if battler
  3409. @scene.pbRefresh
  3410. break
  3411. end
  3412. oldtotalhp=thispoke.totalhp
  3413. oldattack=thispoke.attack
  3414. olddefense=thispoke.defense
  3415. oldspeed=thispoke.speed
  3416. oldspatk=thispoke.spatk
  3417. oldspdef=thispoke.spdef
  3418. if battler && battler.pokemon && @internalbattle
  3419. battler.pokemon.changeHappiness("level up")
  3420. end
  3421. thispoke.calcStats
  3422. battler.pbUpdate(false) if battler
  3423. @scene.pbRefresh
  3424. pbDisplayPaused(_INTL("{1} grew to Level {2}!",thispoke.name,curlevel))
  3425. @scene.pbLevelUp(thispoke,battler,oldtotalhp,oldattack,
  3426. olddefense,oldspeed,oldspatk,oldspdef)
  3427. # Finding all moves learned at this level
  3428. movelist=thispoke.getMoveList
  3429. for k in movelist
  3430. if k[0]==thispoke.level # Learned a new move
  3431. pbLearnMove(index,k[1])
  3432. end
  3433. end
  3434. end
  3435. end
  3436. end
  3437. end
  3438.  
  3439. def pbEndOfBattle(canlose=false)
  3440. case @decision
  3441. ##### WIN #####
  3442. when 1
  3443. PBDebug.log("")
  3444. PBDebug.log("***Player won***")
  3445. if @opponent
  3446. @scene.pbTrainerBattleSuccess
  3447. if @opponent.is_a?(Array)
  3448. pbDisplayPaused(_INTL("{1} defeated {2} and {3}!",self.pbPlayer.name,@opponent[0].fullname,@opponent[1].fullname))
  3449. else
  3450. pbDisplayPaused(_INTL("{1} defeated\r\n{2}!",self.pbPlayer.name,@opponent.fullname))
  3451. end
  3452. @scene.pbShowOpponent(0)
  3453. pbDisplayPaused(@endspeech.gsub(/\\[Pp][Nn]/,self.pbPlayer.name))
  3454. if @opponent.is_a?(Array)
  3455. @scene.pbHideOpponent
  3456. @scene.pbShowOpponent(1)
  3457. pbDisplayPaused(@endspeech2.gsub(/\\[Pp][Nn]/,self.pbPlayer.name))
  3458. end
  3459. # Calculate money gained for winning
  3460. if @internalbattle
  3461. tmoney=0
  3462. if @opponent.is_a?(Array) # Double battles
  3463. maxlevel1=0; maxlevel2=0; limit=pbSecondPartyBegin(1)
  3464. for i in 0...limit
  3465. if @party2[i]
  3466. maxlevel1=@party2[i].level if maxlevel1<@party2[i].level
  3467. end
  3468. if @party2[i+limit]
  3469. maxlevel2=@party2[i+limit].level if maxlevel1<@party2[i+limit].level
  3470. end
  3471. end
  3472. tmoney+=maxlevel1*@opponent[0].moneyEarned
  3473. tmoney+=maxlevel2*@opponent[1].moneyEarned
  3474. else
  3475. maxlevel=0
  3476. for i in @party2
  3477. next if !i
  3478. maxlevel=i.level if maxlevel<i.level
  3479. end
  3480. tmoney+=maxlevel*@opponent.moneyEarned
  3481. end
  3482. # If Amulet Coin/Luck Incense's effect applies, double money earned
  3483. tmoney*=2 if @amuletcoin
  3484. # If Happy Hour's effect applies, double money earned
  3485. tmoney*=2 if @doublemoney
  3486. #===============================================================================
  3487. # Birthsign - The Aristocrat
  3488. # Doubles prize money when leading the party.
  3489. # #TAG18
  3490. #===============================================================================
  3491. if $Trainer.party[0].hasAprBirthsign? && BIRTHSIGNS_SET_2
  3492. tmoney=(tmoney*3/2.5).floor
  3493. end
  3494. #===============================================================================
  3495. oldmoney=self.pbPlayer.money
  3496. self.pbPlayer.money+=tmoney
  3497. moneygained=self.pbPlayer.money-oldmoney
  3498. if moneygained>0
  3499. pbDisplayPaused(_INTL("{1} got ${2}\r\nfor winning!",self.pbPlayer.name,tmoney))
  3500. end
  3501. end
  3502. end
  3503. if @internalbattle && @extramoney>0
  3504. @extramoney*=2 if @amuletcoin
  3505. @extramoney*=2 if @doublemoney
  3506. #===============================================================================
  3507. # Birthsign - The Aristocrat
  3508. # Doubles Pay Day money when leading the party.
  3509. #===============================================================================
  3510. if $Trainer.party[0].hasAprBirthsign? && BIRTHSIGNS_SET_2
  3511. @extramoney*=2
  3512. end
  3513. #===============================================================================
  3514. oldmoney=self.pbPlayer.money
  3515. self.pbPlayer.money+=@extramoney
  3516. moneygained=self.pbPlayer.money-oldmoney
  3517. if moneygained>0
  3518. pbDisplayPaused(_INTL("{1} picked up ${2}!",self.pbPlayer.name,@extramoney))
  3519. end
  3520. end
  3521. for pkmn in @snaggedpokemon
  3522. pbStorePokemon(pkmn)
  3523. self.pbPlayer.shadowcaught=[] if !self.pbPlayer.shadowcaught
  3524. self.pbPlayer.shadowcaught[pkmn.species]=true
  3525. end
  3526. @snaggedpokemon.clear
  3527. ##### LOSE, DRAW #####
  3528. when 2, 5
  3529. PBDebug.log("")
  3530. PBDebug.log("***Player lost***") if @decision==2
  3531. PBDebug.log("***Player drew with opponent***") if @decision==5
  3532. if @internalbattle
  3533. pbDisplayPaused(_INTL("{1} is out of usable Pokémon!",self.pbPlayer.name))
  3534. moneylost=pbMaxLevelFromIndex(0) # Player's Pokémon only, not partner's
  3535. multiplier=[8,16,24,36,48,60,80,100,120]
  3536. moneylost*=multiplier[[multiplier.length-1,self.pbPlayer.numbadges].min]
  3537. moneylost=self.pbPlayer.money if moneylost>self.pbPlayer.money
  3538. moneylost=0 if $game_switches[NO_MONEY_LOSS]
  3539. oldmoney=self.pbPlayer.money
  3540. self.pbPlayer.money-=moneylost
  3541. lostmoney=oldmoney-self.pbPlayer.money
  3542. if @opponent
  3543. if @opponent.is_a?(Array)
  3544. pbDisplayPaused(_INTL("{1} lost against {2} and {3}!",self.pbPlayer.name,@opponent[0].fullname,@opponent[1].fullname))
  3545. else
  3546. pbDisplayPaused(_INTL("{1} lost against\r\n{2}!",self.pbPlayer.name,@opponent.fullname))
  3547. end
  3548. if moneylost>0
  3549. pbDisplayPaused(_INTL("{1} paid ${2}\r\nas the prize money...",self.pbPlayer.name,lostmoney))
  3550. pbDisplayPaused(_INTL("...")) if !canlose
  3551. end
  3552. else
  3553. if moneylost>0
  3554. pbDisplayPaused(_INTL("{1} panicked and lost\r\n${2}...",self.pbPlayer.name,lostmoney))
  3555. pbDisplayPaused(_INTL("...")) if !canlose
  3556. end
  3557. end
  3558. pbDisplayPaused(_INTL("{1} blacked out!",self.pbPlayer.name)) if !canlose
  3559. elsif @decision==2
  3560. @scene.pbShowOpponent(0)
  3561. pbDisplayPaused(@endspeechwin.gsub(/\\[Pp][Nn]/,self.pbPlayer.name))
  3562. if @opponent.is_a?(Array)
  3563. @scene.pbHideOpponent
  3564. @scene.pbShowOpponent(1)
  3565. pbDisplayPaused(@endspeechwin2.gsub(/\\[Pp][Nn]/,self.pbPlayer.name))
  3566. end
  3567. end
  3568. end
  3569. # Pass on Pokérus within the party
  3570. infected=[]
  3571. for i in 0...$Trainer.party.length
  3572. if $Trainer.party[i].pokerusStage==1
  3573. infected.push(i)
  3574. end
  3575. end
  3576. if infected.length>=1
  3577. for i in infected
  3578. strain=$Trainer.party[i].pokerus/16
  3579. if i>0 && $Trainer.party[i-1].pokerusStage==0
  3580. $Trainer.party[i-1].givePokerus(strain) if rand(3)==0
  3581. end
  3582. if i<$Trainer.party.length-1 && $Trainer.party[i+1].pokerusStage==0
  3583. $Trainer.party[i+1].givePokerus(strain) if rand(3)==0
  3584. end
  3585. end
  3586. end
  3587. @scene.pbEndBattle(@decision)
  3588. for i in @battlers
  3589. i.pbResetForm
  3590. if i.hasWorkingAbility(:NATURALCURE)
  3591. i.status=0
  3592. end
  3593. end
  3594. for i in $Trainer.party
  3595. i.setItem(i.itemInitial)
  3596. i.itemInitial=i.itemRecycle=0
  3597. i.belch=false
  3598. end
  3599. return @decision
  3600. end
  3601. end
  3602.  
  3603. module PokeBattle_BattleCommon
  3604.  
  3605. def pbThrowPokeBall(idxPokemon,ball,rareness=nil,showplayer=false)
  3606. itemname=PBItems.getName(ball)
  3607. battler=nil
  3608. if pbIsOpposing?(idxPokemon)
  3609. battler=self.battlers[idxPokemon]
  3610. else
  3611. battler=self.battlers[idxPokemon].pbOppositeOpposing
  3612. end
  3613. if battler.isFainted?
  3614. battler=battler.pbPartner
  3615. end
  3616. pbDisplayBrief(_INTL("{1} threw one {2}!",self.pbPlayer.name,itemname))
  3617. if battler.isFainted?
  3618. pbDisplay(_INTL("But there was no target..."))
  3619. return
  3620. end
  3621. if @opponent && (!pbIsSnagBall?(ball) || !battler.isShadow?)
  3622. @scene.pbThrowAndDeflect(ball,1)
  3623. pbDisplay(_INTL("The Trainer blocked the Ball!\nDon't be a thief!"))
  3624. else
  3625. pokemon=battler.pokemon
  3626. species=pokemon.species
  3627. if $DEBUG && Input.press?(Input::CTRL)
  3628. shakes=4
  3629. else
  3630. if !rareness
  3631. dexdata=pbOpenDexData
  3632. pbDexDataOffset(dexdata,species,16)
  3633. rareness=dexdata.fgetb # Get rareness from dexdata file
  3634. dexdata.close
  3635. end
  3636. a=battler.totalhp
  3637. b=battler.hp
  3638. rareness=BallHandlers.modifyCatchRate(ball,rareness,self,battler)
  3639. x=(((a*3-b*2)*rareness)/(a*3)).floor
  3640. if battler.status==PBStatuses::SLEEP || battler.status==PBStatuses::FROZEN
  3641. x=(x*2.5).floor
  3642. elsif battler.status!=0
  3643. x=(x*1.5).floor
  3644. end
  3645. c=0
  3646. if $Trainer
  3647. if $Trainer.pokedexOwned>600
  3648. c=(x*2.5/6).floor
  3649. elsif $Trainer.pokedexOwned>450
  3650. c=(x*2/6).floor
  3651. elsif $Trainer.pokedexOwned>300
  3652. c=(x*1.5/6).floor
  3653. elsif $Trainer.pokedexOwned>150
  3654. c=(x*1/6).floor
  3655. elsif $Trainer.pokedexOwned>30
  3656. c=(x*0.5/6).floor
  3657. end
  3658. end
  3659. #===============================================================================
  3660. # Birthsign - The Hunter
  3661. # Increases the capture rate by 20% if leading the party.
  3662. # #TAG19
  3663. #===============================================================================
  3664. if $Trainer.party[0].hasNovBirthsign? && BIRTHSIGNS_SET_2
  3665. x=(x*3/2.5).floor
  3666. #x=(x*255).floor #Makes catch rate 100%. Used for testing.
  3667. end
  3668. #===============================================================================
  3669. shakes=0; critical=false
  3670. if x>255 || BallHandlers.isUnconditional?(ball,self,battler)
  3671. shakes=4
  3672. else
  3673. x=1 if x<1
  3674. y = ( 65536 / ((255.0/x)**0.1875) ).floor
  3675. if USECRITICALCAPTURE && pbRandom(256)<c
  3676. critical=true
  3677. shakes=4 if pbRandom(65536)<y
  3678. else
  3679. shakes+=1 if pbRandom(65536)<y
  3680. shakes+=1 if pbRandom(65536)<y && shakes==1
  3681. shakes+=1 if pbRandom(65536)<y && shakes==2
  3682. shakes+=1 if pbRandom(65536)<y && shakes==3
  3683. end
  3684. end
  3685. end
  3686. PBDebug.log("[Threw Poké Ball] #{itemname}, #{shakes} shakes (4=capture)")
  3687. @scene.pbThrow(ball,(critical) ? 1 : shakes,critical,battler.index,showplayer)
  3688. case shakes
  3689. when 0
  3690. pbDisplay(_INTL("Oh no! The Pokémon broke free!"))
  3691. BallHandlers.onFailCatch(ball,self,battler)
  3692. when 1
  3693. pbDisplay(_INTL("Aww... It appeared to be caught!"))
  3694. BallHandlers.onFailCatch(ball,self,battler)
  3695. when 2
  3696. pbDisplay(_INTL("Aargh! Almost had it!"))
  3697. BallHandlers.onFailCatch(ball,self,battler)
  3698. when 3
  3699. pbDisplay(_INTL("Gah! It was so close, too!"))
  3700. BallHandlers.onFailCatch(ball,self,battler)
  3701. when 4
  3702. pbDisplayBrief(_INTL("Gotcha! {1} was caught!",pokemon.name))
  3703. @scene.pbThrowSuccess
  3704. if pbIsSnagBall?(ball) && @opponent
  3705. pbRemoveFromParty(battler.index,battler.pokemonIndex)
  3706. battler.pbReset
  3707. battler.participants=[]
  3708. else
  3709. @decision=4
  3710. end
  3711. if pbIsSnagBall?(ball)
  3712. pokemon.ot=self.pbPlayer.name
  3713. pokemon.trainerID=self.pbPlayer.id
  3714. end
  3715. BallHandlers.onCatch(ball,self,pokemon)
  3716. pokemon.ballused=pbGetBallType(ball)
  3717. pokemon.makeUnmega rescue nil
  3718. pokemon.makeUnprimal rescue nil
  3719. pokemon.pbRecordFirstMoves
  3720. if GAINEXPFORCAPTURE
  3721. battler.captured=true
  3722. pbGainEXP
  3723. battler.captured=false
  3724. end
  3725. if !self.pbPlayer.hasOwned?(species)
  3726. self.pbPlayer.setOwned(species)
  3727. if $Trainer.pokedex
  3728. pbDisplayPaused(_INTL("{1}'s data was added to the Pokédex.",pokemon.name))
  3729. @scene.pbShowPokedex(species)
  3730. end
  3731. end
  3732. @scene.pbHideCaptureBall
  3733. if pbIsSnagBall?(ball) && @opponent
  3734. pokemon.pbUpdateShadowMoves rescue nil
  3735. @snaggedpokemon.push(pokemon)
  3736. else
  3737. pbStorePokemon(pokemon)
  3738. end
  3739. end
  3740. end
  3741. end
  3742. end
  3743.  
  3744. #########[SECTION 8]##########
  3745. #===============================================================================
  3746. # PC Modifications - Debug Menu
  3747. #===============================================================================
  3748. # Allows the debug tool to let you change birthsigns while in the PC.
  3749. # Overwrites sections in PScreen_Storage.
  3750. # #TAG12
  3751. #===============================================================================
  3752. class PokemonStorageScreen
  3753.  
  3754. def debugMenu(selected,pkmn,heldpoke)
  3755. command=0
  3756. loop do
  3757. command=@scene.pbShowCommands(_INTL("Do what with {1}?",pkmn.name),[
  3758. _INTL("Level"),
  3759. _INTL("Species"),
  3760. _INTL("Moves"),
  3761. _INTL("Gender"),
  3762. _INTL("Ability"),
  3763. _INTL("Nature"),
  3764. _INTL("Birthsign"),
  3765. _INTL("Shininess"),
  3766. _INTL("Form"),
  3767. _INTL("Happiness"),
  3768. _INTL("EV/IV/pID"),
  3769. _INTL("Pokérus"),
  3770. _INTL("Ownership"),
  3771. _INTL("Nickname"),
  3772. _INTL("Poké Ball"),
  3773. _INTL("Ribbons"),
  3774. _INTL("Egg"),
  3775. _INTL("Shadow Pokémon"),
  3776. _INTL("Make Mystery Gift"),
  3777. _INTL("Duplicate"),
  3778. _INTL("Delete"),
  3779. _INTL("Cancel")
  3780. ],command)
  3781. case command
  3782. ### Cancel ###
  3783. when -1, 21
  3784. break
  3785. ### Level ###
  3786. when 0
  3787. params=ChooseNumberParams.new
  3788. params.setRange(1,PBExperience::MAXLEVEL)
  3789. params.setDefaultValue(pkmn.level)
  3790. level=Kernel.pbMessageChooseNumber(
  3791. _INTL("Set the Pokémon's level (max. {1}).",PBExperience::MAXLEVEL),params)
  3792. if level!=pkmn.level
  3793. pkmn.level=level
  3794. pkmn.calcStats
  3795. pbDisplay(_INTL("{1}'s level was set to {2}.",pkmn.name,pkmn.level))
  3796. @scene.pbHardRefresh
  3797. end
  3798. ### Species ###
  3799. when 1
  3800. species=pbChooseSpecies(pkmn.species)
  3801. if species!=0
  3802. oldspeciesname=PBSpecies.getName(pkmn.species)
  3803. pkmn.species=species
  3804. pkmn.calcStats
  3805. oldname=pkmn.name
  3806. pkmn.name=PBSpecies.getName(pkmn.species) if pkmn.name==oldspeciesname
  3807. pbDisplay(_INTL("{1}'s species was changed to {2}.",oldname,PBSpecies.getName(pkmn.species)))
  3808. pbSeenForm(pkmn)
  3809. @scene.pbHardRefresh
  3810. end
  3811. ### Moves ###
  3812. when 2
  3813. cmd=0
  3814. loop do
  3815. cmd=@scene.pbShowCommands(_INTL("Do what with {1}?",pkmn.name),[
  3816. _INTL("Teach move"),
  3817. _INTL("Forget move"),
  3818. _INTL("Reset movelist"),
  3819. _INTL("Reset initial moves")],cmd)
  3820. # Break
  3821. if cmd==-1
  3822. break
  3823. # Teach move
  3824. elsif cmd==0
  3825. move=pbChooseMoveList
  3826. if move!=0
  3827. pbLearnMove(pkmn,move)
  3828. @scene.pbHardRefresh
  3829. end
  3830. # Forget Move
  3831. elsif cmd==1
  3832. pbChooseMove(pkmn,1,2)
  3833. if pbGet(1)>=0
  3834. pbDeleteMove(pkmn,pbGet(1))
  3835. pbDisplay(_INTL("{1} forgot {2}.",pkmn.name,pbGet(2)))
  3836. @scene.pbHardRefresh
  3837. end
  3838. # Reset Movelist
  3839. elsif cmd==2
  3840. pkmn.resetMoves
  3841. pbDisplay(_INTL("{1}'s moves were reset.",pkmn.name))
  3842. @scene.pbHardRefresh
  3843. # Reset initial moves
  3844. elsif cmd==3
  3845. pkmn.pbRecordFirstMoves
  3846. pbDisplay(_INTL("{1}'s moves were set as its first-known moves.",pkmn.name))
  3847. @scene.pbHardRefresh
  3848. end
  3849. end
  3850. ### Gender ###
  3851. when 3
  3852. if pkmn.gender==2
  3853. pbDisplay(_INTL("{1} is genderless.",pkmn.name))
  3854. else
  3855. cmd=0
  3856. loop do
  3857. oldgender=(pkmn.isMale?) ? _INTL("male") : _INTL("female")
  3858. msg=[_INTL("Gender {1} is natural.",oldgender),
  3859. _INTL("Gender {1} is being forced.",oldgender)][pkmn.genderflag ? 1 : 0]
  3860. cmd=@scene.pbShowCommands(msg,[
  3861. _INTL("Make male"),
  3862. _INTL("Make female"),
  3863. _INTL("Remove override")],cmd)
  3864. # Break
  3865. if cmd==-1
  3866. break
  3867. # Make male
  3868. elsif cmd==0
  3869. pkmn.setGender(0)
  3870. if pkmn.isMale?
  3871. pbDisplay(_INTL("{1} is now male.",pkmn.name))
  3872. else
  3873. pbDisplay(_INTL("{1}'s gender couldn't be changed.",pkmn.name))
  3874. end
  3875. # Make female
  3876. elsif cmd==1
  3877. pkmn.setGender(1)
  3878. if pkmn.isFemale?
  3879. pbDisplay(_INTL("{1} is now female.",pkmn.name))
  3880. else
  3881. pbDisplay(_INTL("{1}'s gender couldn't be changed.",pkmn.name))
  3882. end
  3883. # Remove override
  3884. elsif cmd==2
  3885. pkmn.genderflag=nil
  3886. pbDisplay(_INTL("Gender override removed."))
  3887. end
  3888. pbSeenForm(pkmn)
  3889. @scene.pbHardRefresh
  3890. end
  3891. end
  3892. ### Ability ###
  3893. when 4
  3894. cmd=0
  3895. loop do
  3896. abils=pkmn.getAbilityList
  3897. oldabil=PBAbilities.getName(pkmn.ability)
  3898. commands=[]
  3899. for i in abils
  3900. commands.push((i[1]<2 ? "" : "(H) ")+PBAbilities.getName(i[0]))
  3901. end
  3902. commands.push(_INTL("Remove override"))
  3903. msg=[_INTL("Ability {1} is natural.",oldabil),
  3904. _INTL("Ability {1} is being forced.",oldabil)][pkmn.abilityflag!=nil ? 1 : 0]
  3905. cmd=@scene.pbShowCommands(msg,commands,cmd)
  3906. # Break
  3907. if cmd==-1
  3908. break
  3909. # Set ability override
  3910. elsif cmd>=0 && cmd<abils.length
  3911. pkmn.setAbility(abils[cmd][1])
  3912. # Remove override
  3913. elsif cmd==abils.length
  3914. pkmn.abilityflag=nil
  3915. end
  3916. @scene.pbHardRefresh
  3917. end
  3918. ### Nature ###
  3919. when 5
  3920. cmd=0
  3921. loop do
  3922. oldnature=PBNatures.getName(pkmn.nature)
  3923. commands=[]
  3924. (PBNatures.getCount).times do |i|
  3925. commands.push(PBNatures.getName(i))
  3926. end
  3927. commands.push(_INTL("Remove override"))
  3928. msg=[_INTL("Nature {1} is natural.",oldnature),
  3929. _INTL("Nature {1} is being forced.",oldnature)][pkmn.natureflag ? 1 : 0]
  3930. cmd=@scene.pbShowCommands(msg,commands,cmd)
  3931. # Break
  3932. if cmd==-1
  3933. break
  3934. # Set nature override
  3935. elsif cmd>=0 && cmd<PBNatures.getCount
  3936. pkmn.setNature(cmd)
  3937. pkmn.calcStats
  3938. # Remove override
  3939. elsif cmd==PBNatures.getCount
  3940. pkmn.natureflag=nil
  3941. end
  3942. @scene.pbHardRefresh
  3943. end
  3944. ### Birthsign ###
  3945. when 6
  3946. cmd=0
  3947. if pkmn.isEgg?
  3948. pbDisplay(_INTL("Eggs must be hatched first to inherit a birthsign!"))
  3949. break
  3950. elsif (pkmn.isShadow? rescue false)
  3951. pbDisplay(_INTL("Shadow Pokémon can't have a birthsign!"))
  3952. break
  3953. elsif pkmn.obtainMode==1 || pkmn.hasRibbon?(:SECONDSTEP)
  3954. pbDisplay(_INTL("That Pokémon can't change its birthsign."))
  3955. break
  3956. end
  3957. loop do
  3958. oldsign=PBBirthsigns.getName(pkmn.birthsign)
  3959. commands=[]
  3960. (PBBirthsigns.getCount).times do |i|
  3961. commands.push(PBBirthsigns.getName(i))
  3962. end
  3963. msg=[_INTL("Change birthsigns."),
  3964. _INTL("{1} is active.",oldsign)][pkmn.zodiacflag ? 1 : 0]
  3965. cmd=@scene.pbShowCommands(msg,commands,cmd)
  3966. # Break
  3967. if cmd==-1
  3968. break
  3969. # Set birthsign override
  3970. elsif cmd>=0 && cmd<PBBirthsigns.getCount
  3971. pkmn.setBirthsign(cmd)
  3972. pkmn.calcStats
  3973. # Remove override
  3974. elsif cmd==PBBirthsigns.getCount
  3975. pkmn.zodiacflag=0
  3976. end
  3977. @scene.pbHardRefresh
  3978. end
  3979. ### Shininess ###
  3980. when 7
  3981. cmd=0
  3982. loop do
  3983. oldshiny=(pkmn.isShiny?) ? _INTL("shiny") : _INTL("normal")
  3984. msg=[_INTL("Shininess ({1}) is natural.",oldshiny),
  3985. _INTL("Shininess ({1}) is being forced.",oldshiny)][pkmn.shinyflag!=nil ? 1 : 0]
  3986. cmd=@scene.pbShowCommands(msg,[
  3987. _INTL("Make shiny"),
  3988. _INTL("Make normal"),
  3989. _INTL("Remove override")],cmd)
  3990. # Break
  3991. if cmd==-1
  3992. break
  3993. # Make shiny
  3994. elsif cmd==0
  3995. pkmn.makeShiny
  3996. # Make normal
  3997. elsif cmd==1
  3998. pkmn.makeNotShiny
  3999. # Remove override
  4000. elsif cmd==2
  4001. pkmn.shinyflag=nil
  4002. end
  4003. @scene.pbHardRefresh
  4004. end
  4005. ### Form ###
  4006. when 8
  4007. params=ChooseNumberParams.new
  4008. params.setRange(0,100)
  4009. params.setDefaultValue(pkmn.form)
  4010. f=Kernel.pbMessageChooseNumber(_INTL("Set the Pokémon's form."),params)
  4011. if f!=pkmn.form
  4012. pkmn.form=f
  4013. pbDisplay(_INTL("{1}'s form was set to {2}.",pkmn.name,pkmn.form))
  4014. pbSeenForm(pkmn)
  4015. @scene.pbHardRefresh
  4016. end
  4017. ### Happiness ###
  4018. when 9
  4019. params=ChooseNumberParams.new
  4020. params.setRange(0,255)
  4021. params.setDefaultValue(pkmn.happiness)
  4022. h=Kernel.pbMessageChooseNumber(
  4023. _INTL("Set the Pokémon's happiness (max. 255)."),params)
  4024. if h!=pkmn.happiness
  4025. pkmn.happiness=h
  4026. pbDisplay(_INTL("{1}'s happiness was set to {2}.",pkmn.name,pkmn.happiness))
  4027. @scene.pbHardRefresh
  4028. end
  4029. ### EV/IV/pID ###
  4030. when 10
  4031. stats=[_INTL("HP"),_INTL("Attack"),_INTL("Defense"),
  4032. _INTL("Speed"),_INTL("Sp. Attack"),_INTL("Sp. Defense")]
  4033. cmd=0
  4034. loop do
  4035. persid=sprintf("0x%08X",pkmn.personalID)
  4036. cmd=@scene.pbShowCommands(_INTL("Personal ID is {1}.",persid),[
  4037. _INTL("Set EVs"),
  4038. _INTL("Set IVs"),
  4039. _INTL("Randomise pID")],cmd)
  4040. case cmd
  4041. # Break
  4042. when -1
  4043. break
  4044. # Set EVs
  4045. when 0
  4046. cmd2=0
  4047. loop do
  4048. evcommands=[]
  4049. for i in 0...stats.length
  4050. evcommands.push(stats[i]+" (#{pkmn.ev[i]})")
  4051. end
  4052. cmd2=@scene.pbShowCommands(_INTL("Change which EV?"),evcommands,cmd2)
  4053. if cmd2==-1
  4054. break
  4055. elsif cmd2>=0 && cmd2<stats.length
  4056. params=ChooseNumberParams.new
  4057. params.setRange(0,255)
  4058. params.setDefaultValue(pkmn.ev[cmd2])
  4059. params.setCancelValue(pkmn.ev[cmd2])
  4060. f=Kernel.pbMessageChooseNumber(
  4061. _INTL("Set the EV for {1} (max. 255).",stats[cmd2]),params)
  4062. pkmn.ev[cmd2]=f
  4063. pkmn.calcStats
  4064. @scene.pbHardRefresh
  4065. end
  4066. end
  4067. # Set IVs
  4068. when 1
  4069. cmd2=0
  4070. loop do
  4071. hiddenpower=pbHiddenPower(pkmn.iv)
  4072. msg=_INTL("Hidden Power:\n{1}, power {2}.",PBTypes.getName(hiddenpower[0]),hiddenpower[1])
  4073. ivcommands=[]
  4074. for i in 0...stats.length
  4075. ivcommands.push(stats[i]+" (#{pkmn.iv[i]})")
  4076. end
  4077. ivcommands.push(_INTL("Randomise all"))
  4078. cmd2=@scene.pbShowCommands(msg,ivcommands,cmd2)
  4079. if cmd2==-1
  4080. break
  4081. elsif cmd2>=0 && cmd2<stats.length
  4082. params=ChooseNumberParams.new
  4083. params.setRange(0,31)
  4084. params.setDefaultValue(pkmn.iv[cmd2])
  4085. params.setCancelValue(pkmn.iv[cmd2])
  4086. f=Kernel.pbMessageChooseNumber(
  4087. _INTL("Set the IV for {1} (max. 31).",stats[cmd2]),params)
  4088. pkmn.iv[cmd2]=f
  4089. pkmn.calcStats
  4090. @scene.pbHardRefresh
  4091. elsif cmd2==ivcommands.length-1
  4092. pkmn.iv[0]=rand(32)
  4093. pkmn.iv[1]=rand(32)
  4094. pkmn.iv[2]=rand(32)
  4095. pkmn.iv[3]=rand(32)
  4096. pkmn.iv[4]=rand(32)
  4097. pkmn.iv[5]=rand(32)
  4098. pkmn.calcStats
  4099. @scene.pbHardRefresh
  4100. end
  4101. end
  4102. # Randomise pID
  4103. when 2
  4104. pkmn.personalID=rand(256)
  4105. pkmn.personalID|=rand(256)<<8
  4106. pkmn.personalID|=rand(256)<<16
  4107. pkmn.personalID|=rand(256)<<24
  4108. pkmn.calcStats
  4109. @scene.pbHardRefresh
  4110. end
  4111. end
  4112. ### Pokérus ###
  4113. when 11
  4114. cmd=0
  4115. loop do
  4116. pokerus=(pkmn.pokerus) ? pkmn.pokerus : 0
  4117. msg=[_INTL("{1} doesn't have Pokérus.",pkmn.name),
  4118. _INTL("Has strain {1}, infectious for {2} more days.",pokerus/16,pokerus%16),
  4119. _INTL("Has strain {1}, not infectious.",pokerus/16)][pkmn.pokerusStage]
  4120. cmd=@scene.pbShowCommands(msg,[
  4121. _INTL("Give random strain"),
  4122. _INTL("Make not infectious"),
  4123. _INTL("Clear Pokérus")],cmd)
  4124. # Break
  4125. if cmd==-1
  4126. break
  4127. # Give random strain
  4128. elsif cmd==0
  4129. pkmn.givePokerus
  4130. # Make not infectious
  4131. elsif cmd==1
  4132. strain=pokerus/16
  4133. p=strain<<4
  4134. pkmn.pokerus=p
  4135. # Clear Pokérus
  4136. elsif cmd==2
  4137. pkmn.pokerus=0
  4138. end
  4139. end
  4140. ### Ownership ###
  4141. when 12
  4142. cmd=0
  4143. loop do
  4144. gender=[_INTL("Male"),_INTL("Female"),_INTL("Unknown")][pkmn.otgender]
  4145. msg=[_INTL("Player's Pokémon\n{1}\n{2}\n{3} ({4})",pkmn.ot,gender,pkmn.publicID,pkmn.trainerID),
  4146. _INTL("Foreign Pokémon\n{1}\n{2}\n{3} ({4})",pkmn.ot,gender,pkmn.publicID,pkmn.trainerID)
  4147. ][pkmn.isForeign?($Trainer) ? 1 : 0]
  4148. cmd=@scene.pbShowCommands(msg,[
  4149. _INTL("Make player's"),
  4150. _INTL("Set OT's name"),
  4151. _INTL("Set OT's gender"),
  4152. _INTL("Random foreign ID"),
  4153. _INTL("Set foreign ID")],cmd)
  4154. # Break
  4155. if cmd==-1
  4156. break
  4157. # Make player's
  4158. elsif cmd==0
  4159. pkmn.trainerID=$Trainer.id
  4160. pkmn.ot=$Trainer.name
  4161. pkmn.otgender=$Trainer.gender
  4162. # Set OT's name
  4163. elsif cmd==1
  4164. newot=pbEnterPlayerName(_INTL("{1}'s OT's name?",pkmn.name),1,7)
  4165. pkmn.ot=newot
  4166. # Set OT's gender
  4167. elsif cmd==2
  4168. cmd2=@scene.pbShowCommands(_INTL("Set OT's gender."),
  4169. [_INTL("Male"),_INTL("Female"),_INTL("Unknown")])
  4170. pkmn.otgender=cmd2 if cmd2>=0
  4171. # Random foreign ID
  4172. elsif cmd==3
  4173. pkmn.trainerID=$Trainer.getForeignID
  4174. # Set foreign ID
  4175. elsif cmd==4
  4176. params=ChooseNumberParams.new
  4177. params.setRange(0,65535)
  4178. params.setDefaultValue(pkmn.publicID)
  4179. val=Kernel.pbMessageChooseNumber(
  4180. _INTL("Set the new ID (max. 65535)."),params)
  4181. pkmn.trainerID=val
  4182. pkmn.trainerID|=val<<16
  4183. end
  4184. end
  4185. ### Nickname ###
  4186. when 13
  4187. cmd=0
  4188. loop do
  4189. speciesname=PBSpecies.getName(pkmn.species)
  4190. msg=[_INTL("{1} has the nickname {2}.",speciesname,pkmn.name),
  4191. _INTL("{1} has no nickname.",speciesname)][pkmn.name==speciesname ? 1 : 0]
  4192. cmd=@scene.pbShowCommands(msg,[
  4193. _INTL("Rename"),
  4194. _INTL("Erase name")],cmd)
  4195. # Break
  4196. if cmd==-1
  4197. break
  4198. # Rename
  4199. elsif cmd==0
  4200. newname=pbEnterPokemonName(_INTL("{1}'s nickname?",speciesname),0,10,"",pkmn)
  4201. pkmn.name=(newname=="") ? speciesname : newname
  4202. @scene.pbHardRefresh
  4203. # Erase name
  4204. elsif cmd==1
  4205. pkmn.name=speciesname
  4206. end
  4207. end
  4208. ### Poké Ball ###
  4209. when 14
  4210. cmd=0
  4211. loop do
  4212. oldball=PBItems.getName(pbBallTypeToBall(pkmn.ballused))
  4213. commands=[]; balls=[]
  4214. for key in $BallTypes.keys
  4215. item=getID(PBItems,$BallTypes[key])
  4216. balls.push([key,PBItems.getName(item)]) if item && item>0
  4217. end
  4218. balls.sort! {|a,b| a[1]<=>b[1]}
  4219. for i in 0...commands.length
  4220. cmd=i if pkmn.ballused==balls[i][0]
  4221. end
  4222. for i in balls
  4223. commands.push(i[1])
  4224. end
  4225. cmd=@scene.pbShowCommands(_INTL("{1} used.",oldball),commands,cmd)
  4226. if cmd==-1
  4227. break
  4228. else
  4229. pkmn.ballused=balls[cmd][0]
  4230. end
  4231. end
  4232. ### Ribbons ###
  4233. when 15
  4234. cmd=0
  4235. loop do
  4236. commands=[]
  4237. for i in 1..PBRibbons.maxValue
  4238. commands.push(_INTL("{1} {2}",
  4239. pkmn.hasRibbon?(i) ? "[X]" : "[ ]",PBRibbons.getName(i)))
  4240. end
  4241. cmd=@scene.pbShowCommands(_INTL("{1} ribbons.",pkmn.ribbonCount),commands,cmd)
  4242. if cmd==-1
  4243. break
  4244. elsif cmd>=0 && cmd<commands.length
  4245. if pkmn.hasRibbon?(cmd+1)
  4246. pkmn.takeRibbon(cmd+1)
  4247. else
  4248. pkmn.giveRibbon(cmd+1)
  4249. end
  4250. end
  4251. end
  4252. ### Egg ###
  4253. when 16
  4254. cmd=0
  4255. loop do
  4256. msg=[_INTL("Not an egg"),
  4257. _INTL("Egg with eggsteps: {1}.",pkmn.eggsteps)][pkmn.isEgg? ? 1 : 0]
  4258. cmd=@scene.pbShowCommands(msg,[
  4259. _INTL("Make egg"),
  4260. _INTL("Make Pokémon"),
  4261. _INTL("Set eggsteps to 1")],cmd)
  4262. # Break
  4263. if cmd==-1
  4264. break
  4265. # Make egg
  4266. elsif cmd==0
  4267. if pbHasEgg?(pkmn.species) ||
  4268. pbConfirm(_INTL("{1} cannot be an egg. Make egg anyway?",PBSpecies.getName(pkmn.species)))
  4269. pkmn.level=EGGINITIALLEVEL
  4270. pkmn.zodiacflag==0
  4271. pkmn.calcStats
  4272. pkmn.name=_INTL("Egg")
  4273. dexdata=pbOpenDexData
  4274. pbDexDataOffset(dexdata,pkmn.species,21)
  4275. pkmn.eggsteps=dexdata.fgetw
  4276. dexdata.close
  4277. pkmn.hatchedMap=0
  4278. pkmn.obtainMode=1
  4279. @scene.pbHardRefresh
  4280. end
  4281. # Make Pokémon
  4282. elsif cmd==1
  4283. pkmn.name=PBSpecies.getName(pkmn.species)
  4284. pkmn.eggsteps=0
  4285. pkmn.hatchedMap=0
  4286. pkmn.obtainMode=0
  4287. @scene.pbHardRefresh
  4288. # Set eggsteps to 1
  4289. elsif cmd==2
  4290. pkmn.eggsteps=1 if pkmn.eggsteps>0
  4291. end
  4292. end
  4293. ### Shadow Pokémon ###
  4294. when 17
  4295. cmd=0
  4296. loop do
  4297. msg=[_INTL("Not a Shadow Pokémon."),
  4298. _INTL("Heart gauge is {1}.",pkmn.heartgauge)][(pkmn.isShadow? rescue false) ? 1 : 0]
  4299. cmd=@scene.pbShowCommands(msg,[
  4300. _INTL("Make Shadow"),
  4301. _INTL("Lower heart gauge")],cmd)
  4302. # Break
  4303. if cmd==-1
  4304. break
  4305. # Make Shadow
  4306. elsif cmd==0
  4307. if !(pkmn.isShadow? rescue false) && pkmn.respond_to?("makeShadow")
  4308. if pkmn.obtainMode==1
  4309. pbDisplay(_INTL("Pokémon born with a birthsign can't be made into Shadow Pokémon.",pkmn.name))
  4310. else
  4311. pkmn.setBirthsign(0)
  4312. pkmn.makeShadow
  4313. pbDisplay(_INTL("{1} is now a Shadow Pokémon.",pkmn.name))
  4314. end
  4315. @scene.pbHardRefresh
  4316. else
  4317. pbDisplay(_INTL("{1} is already a Shadow Pokémon.",pkmn.name))
  4318. end
  4319. # Lower heart gauge
  4320. elsif cmd==1
  4321. if (pkmn.isShadow? rescue false)
  4322. prev=pkmn.heartgauge
  4323. pkmn.adjustHeart(-700)
  4324. Kernel.pbMessage(_INTL("{1}'s heart gauge was lowered from {2} to {3} (now stage {4}).",
  4325. pkmn.name,prev,pkmn.heartgauge,pkmn.heartStage))
  4326. pbReadyToPurify(pkmn)
  4327. else
  4328. Kernel.pbMessage(_INTL("{1} is not a Shadow Pokémon.",pkmn.name))
  4329. end
  4330. end
  4331. end
  4332. ### Make Mystery Gift ###
  4333. when 18
  4334. pbCreateMysteryGift(0,pkmn)
  4335. ### Duplicate ###
  4336. when 19
  4337. if pbConfirm(_INTL("Are you sure you want to copy this Pokémon?"))
  4338. clonedpkmn=pkmn.clone
  4339. clonedpkmn.iv=pkmn.iv.clone
  4340. clonedpkmn.ev=pkmn.ev.clone
  4341. if @storage.pbMoveCaughtToParty(clonedpkmn)
  4342. if selected[0]!=-1
  4343. pbDisplay(_INTL("The duplicated Pokémon was moved to your party."))
  4344. end
  4345. else
  4346. oldbox=@storage.currentBox
  4347. newbox=@storage.pbStoreCaught(clonedpkmn)
  4348. if newbox<0
  4349. pbDisplay(_INTL("All boxes are full."))
  4350. elsif newbox!=oldbox
  4351. pbDisplay(_INTL("The duplicated Pokémon was moved to box \"{1}.\"",@storage[newbox].name))
  4352. @storage.currentBox=oldbox
  4353. end
  4354. end
  4355. @scene.pbHardRefresh
  4356. break
  4357. end
  4358. ### Delete ###
  4359. when 20
  4360. if pbConfirm(_INTL("Are you sure you want to delete this Pokémon?"))
  4361. @scene.pbRelease(selected,heldpoke)
  4362. if heldpoke
  4363. @heldpkmn=nil
  4364. else
  4365. @storage.pbDelete(selected[0],selected[1])
  4366. end
  4367. @scene.pbRefresh
  4368. pbDisplay(_INTL("The Pokémon was deleted."))
  4369. break
  4370. end
  4371. end
  4372. end
  4373. end
  4374. end
  4375.  
  4376. #===============================================================================
  4377. # PC Modifications - Storage Scene
  4378. #===============================================================================
  4379. # Allows birthsign tokens to be displayed in the PC storage window.
  4380. # Overwrites sections in PScreen_Storage.
  4381. # #TAG14
  4382. #===============================================================================
  4383. class PokemonStorageScene
  4384.  
  4385. def pbUpdateOverlay(selection,party=nil)
  4386. overlay=@sprites["overlay"].bitmap
  4387. overlay.clear
  4388. pokemon=nil
  4389. if @screen.pbHeldPokemon
  4390. pokemon=@screen.pbHeldPokemon
  4391. elsif selection>=0
  4392. pokemon=(party) ? party[selection] : @storage[@storage.currentBox,selection]
  4393. end
  4394. if !pokemon
  4395. @sprites["pokemon"].visible=false
  4396. return
  4397. end
  4398. @sprites["pokemon"].visible=true
  4399. #@sprites["pokemon"].mirror=true #Uncomment this line to mirror sprites.
  4400. speciesname=PBSpecies.getName(pokemon.species)
  4401. itemname="No item"
  4402. if pokemon.item>0
  4403. itemname=PBItems.getName(pokemon.item)
  4404. end
  4405. abilityname="No ability"
  4406. if pokemon.ability>0
  4407. abilityname=PBAbilities.getName(pokemon.ability)
  4408. end
  4409. base=Color.new(88,88,80)
  4410. shadow=Color.new(168,184,184)
  4411. pokename=pokemon.name
  4412. textstrings=[
  4413. [pokename,10,8,false,base,shadow]
  4414. ]
  4415. if !pokemon.isEgg?
  4416. if pokemon.isMale?
  4417. textstrings.push([_INTL("♂"),148,8,false,Color.new(24,112,216),Color.new(136,168,208)])
  4418. elsif pokemon.isFemale?
  4419. textstrings.push([_INTL("♀"),148,8,false,Color.new(248,56,32),Color.new(224,152,144)])
  4420. end
  4421. textstrings.push([_INTL("{1}",pokemon.level),36,234,false,base,shadow])
  4422. textstrings.push([_INTL("{1}",abilityname),85,306,2,base,shadow])
  4423. textstrings.push([_INTL("{1}",itemname),85,342,2,base,shadow])
  4424. end
  4425. pbSetSystemFont(overlay)
  4426. pbDrawTextPositions(overlay,textstrings)
  4427. textstrings.clear
  4428. if !pokemon.isEgg?
  4429. textstrings.push([_INTL("Lv."),10,238,false,base,shadow])
  4430. end
  4431. pbSetSmallFont(overlay)
  4432. pbDrawTextPositions(overlay,textstrings)
  4433. if pokemon.isShiny? && !pokemon.isEgg?
  4434. imagepos=[(["Graphics/Pictures/shiny",12,198,0,0,-1,-1])]
  4435. pbDrawImagePositions(overlay,imagepos)
  4436. end
  4437. #===============================================================================
  4438. # Birthsigns - Token Display Window
  4439. #===============================================================================
  4440. if pokemon.hasBirthsign?
  4441. imagepos=[(["Graphics/Pictures/Birthsigns/Other/storagesign",142,161,0,0,-1,-1])]
  4442. pbDrawImagePositions(overlay,imagepos)
  4443. #===============================================================================
  4444. # Birthsigns - Zodiac Token
  4445. #===============================================================================
  4446. tokenpath1="Graphics/Pictures/Birthsigns/token%02d"
  4447. tokenpath2="Graphics/Pictures/Birthsigns/Birthsigns2/token%02d"
  4448. if pokemon.obtainMode==1
  4449. if !BIRTHSIGNS_SET_2
  4450. zodiactoken=sprintf(tokenpath1,zodiacValue(pokemon.birthsign))
  4451. else
  4452. zodiactoken=sprintf(tokenpath2,zodiacValue(pokemon.birthsign))
  4453. end
  4454. else
  4455. if !BIRTHSIGNS_SET_2
  4456. zodiactoken=sprintf(tokenpath1,PBBirthsigns.signValue(pokemon.birthsign))
  4457. else
  4458. zodiactoken=sprintf(tokenpath2,PBBirthsigns.signValue(pokemon.birthsign))
  4459. end
  4460. end
  4461. imagepos=[([zodiactoken,148,166,0,0,-1,-1])]
  4462. pbDrawImagePositions(overlay,imagepos)
  4463. end
  4464. #===============================================================================
  4465. typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
  4466. type1rect=Rect.new(0,pokemon.type1*28,64,28)
  4467. type2rect=Rect.new(0,pokemon.type2*28,64,28)
  4468. if pokemon.type1==pokemon.type2
  4469. overlay.blt(52,272,typebitmap.bitmap,type1rect)
  4470. else
  4471. overlay.blt(18,272,typebitmap.bitmap,type1rect)
  4472. overlay.blt(88,272,typebitmap.bitmap,type2rect)
  4473. end
  4474. drawMarkings(overlay,66,240,128,20,pokemon.markings)
  4475. @sprites["pokemon"].setPokemonBitmap(pokemon)
  4476. pbPositionPokemonSprite(@sprites["pokemon"],26,70)
  4477. end
  4478. def pbDropDownPartyTab
  4479. begin
  4480. Graphics.update
  4481. Input.update
  4482. @sprites["boxparty"].y-=16
  4483. pbUpdateSpriteHash(@sprites)
  4484. end until @sprites["boxparty"].y<=Graphics.height-352
  4485. end
  4486. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement