The PokéCommunity Forums Fan Games Game Development Scripts & Tutorials
Essentials Script Pokemon Birthsigns

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.


Reply
 
Thread Tools
  #1    
Old May 7th, 2015 (10:58 AM). Edited 3 Weeks Ago by Lucidious89.
Lucidious89 Lucidious89 is offline
     
    Join Date: Apr 2014
    Gender: Male
    Posts: 173
    Overview
    These scripts add a Birthsign system to Essentials; giving your Pokemon certain bonuses right from the start that vary depending on the particular sign they have. Similar to other RPG's such as The Elder Scrolls games; where different Birthsigns grant your character a variety of perks and bonuses to start off with. The difference with this is that these Birthsigns are automatically applied at the moment of the Pokemon's birth - when it hatches from an Egg. So depending on the time of year that you hatch your Pokemon, they will gain different starting bonuses than others! In addition to this, there are other cool additions that builds upon the concept of the Birthsign mechanic such as birthdays, lore, and features that will let you hide secrets throughout the world tied to specific constellations.

    This project comes with 30 unique Birthsigns, each with their own effects. You may create your own 12-month zodiac by picking 12 signs that you like best, or feel free to use the default set of 12.

    UPDATE As of 12/8/17:
    Each month now has a corresponding Rival month, along with two Partner months. When breeding, you'll receive extra bonuses for your eggs if the parents' birthsigns are compatible. However, Rival matches will result in poorer offspring. These bonuses include less random IV inheritance, shortened egg steps to hatching, and random bonus items that offspring may be holding upon hatching.

    UPDATE As of 1/7/18:
    Three smaller scripts of mine - IV Star Ratings, Egg Group Types, and HGSS Shiny Leaf have been rolled into this project. These are inactive by default, but you may turn them on by setting their appropriate toggles to "true" at the top of the core script, if you'd like to use one or all of them. In addition, this project is now also compatible with the Z-Move Add On script in the form of a toggle as well.

    -Pokemon Birthsigns is built to support Pokemon Essentials v17 (all scripts are now compatible).
    -Support for Kleinstudio's Essentials Black & White has now been added. Install the designated scripts for compatibility. To preview what this version of the script would look like, check my initial post about it here. Keep in mind Kleinstudio is based off of Essentials 15, so many of the newest features added to this project will not be available in that version.

    *Note: It is recommended that you start a new game after installing. Pokemon that existed prior to installing may be randomly assigned a birthsign unintentionally.


    The Birthsigns
    Spoiler:
    1. 'The Apprentice'

      Constellation: Pikachu
      Type: Passive
      Effect: When born under this sign, the Pokemon gains twice as many EV's from battle. This may stack with similar effects.

    2. 'The Companion'

      Constellation: Luvdisc
      Type: Battle Lead
      Effect: When born under this sign, the Pokemon is twice as happy than usual. This joy is contagious, and even wild Pokemon encountered will have increased happiness when this Pokemon is leading.

    3. 'The Beacon'

      Constellation: Ampharos
      Type: Field Skill
      Effect: When born under this sign, the Pokemon hatches with the ability to use the 'Starlight' skill on the field; allowing it to lighten up dark areas.

    4. 'The Savage'

      Constellation: Luxray
      Type: Passive
      Effect: When born under this sign, the Pokemon has maximum IV's in Attack, Sp.Atk, and Speed; however the HP IV is 0.

    5. 'The Prodigy'

      Constellation: Eevee
      Type: Self Skill
      Effect: When born under this sign, the Pokemon has access to the 'Ability Swap' skill from the menu; allowing it to swap out its current ability for one of its other abilities.

    6. 'The Martyr'

      Constellation: Chansey
      Type: Party Skill
      Effect: When born under this sign, the Pokemon hatches with the ability to use the 'Rescue' skill while on the field; allowing it to sacrifice its own HP to heal an ally.

    7. 'The Maiden'

      Constellation: Gardevoir
      Type: Passive
      Effect: When born under this sign, the Pokemon has very high odds of being female. The Pokemon also starts off with 150 EV's in Sp.Atk.

    8. 'The Gladiator'

      Constellation: Gallade
      Type: Passive
      Effect: When born under this sign, the Pokemon has very high odds of being male. The Pokemon also starts off with 150 EV's in Attack.

    9. 'The Voyager'

      Constellation: Beheeyem
      Type: Field Skill
      Effect: When born under this sign, the Pokemon hatches with the ability to use the 'Navigate' skill while on the field; allowing it to lead its trainer to the previously used Pokemon Center.

    10. 'The Thief'

      Constellation: Sneasel
      Type: Battle Lead
      Effect: When born under this sign, the Pokemon will sometimes encounter wild Pokemon holding valuable treasures ripe for the stealing. This includes things such as Pearls, Nuggets, or even ancient Relics.

    11. 'The Glutton'

      Constellation: Munchlax
      Type: Passive
      Effect: When born under this sign, the Pokemon hatches with maximum IV's in HP, Defense, and Sp.Def; however the Speed IV is 0.

    12. 'The Wishmaker'

      Constellation: Jirachi
      Type: Passive
      Effect: When born under this sign, the Pokemon has much higher odds of being shiny.

    13. 'The Phoenix'

      Constellation: Ho-oh
      Type: Self Skill
      Effect: When born under this sign, the Pokemon has access to the 'Rebirth' skill from the menu; allowing the Pokemon to revive themselves from the KO status while on the field.

    14. 'The Scholar'

      Constellation: Slowking
      Type: Passive
      Effect: When born under this sign, the Pokemon gains an additional 20% bonus to experience gained from battles. This stacks with similar effects.

    15. 'The Fugitive'

      Constellation: Klefki
      Type: Field Skill
      Effect: When born under this sign, the Pokemon has access to the 'Escape' skill from the menu; allowing the Pokemon to flee to the exit of any dungeon with its trainer.

    16. 'The Aristocrat'

      Constellation: Meowth
      Type: Battle Lead
      Effect: When born under this sign, the Pokemon demands 20% more prize money from trainer battles when leading the party. The Pokemon also has a good chance at finding spare change after wild battles, too. Also doubles money earned with Pay Day.

    17. 'The Cleric'

      Constellation: Audino
      Type: Party Skill
      Effect: When born under this sign, the Pokemon has access to the 'Cure' skill from the menu; allowing the Pokemon to heal the party of any harmful status conditions while on the field, at the cost of its HP.

    18. 'The Monk'

      Constellation: Medicham
      Type: Self Skill
      Effect: When born under this sign, the Pokemon has access to the 'Trance' skill from the menu; allowing the Pokemon to enter a meditative state and recall any past moves that have long since been forgotten. No Heart Scales are required.

    19. 'The Ancestor'

      Month: July
      Constellation: Sigilyph
      Type: Passive
      Effect: When born under this sign, any Eggs yielded by the Pokemon will inherit the user's EV spread.

    20. 'The Specialist'

      Constellation: Smeargle
      Type: Self Skill
      Effect: When born under this sign, the Pokemon has access to the 'Re-roll' skill from the menu; allowing the Pokemon to reshuffle its IV's to align with a particular Hidden Power type. The new IV's will be randomized, but will always yield combinations that correspond with a chosen type.

      Note that Hidden Power spreads all assume that there are only 17 types to choose from (Including Fairy, but not including Normal or sub-types like ??? and Shadow), so they may not be accurate if you have extra custom types in your game.

    21. 'The Assassin'

      Constellation: Darkrai
      Type: Battle Lead
      Effect: When born under this sign, the Pokemon has a high chance of seeking out vulnerable wild Pokemon who are asleep when encountered. The user needs to be leading the party for this effect to work. The odds of finding sleeping Pokemon are lower during the day, but higher during nighttime.

    22. 'The Parent'

      Constellation: Kangaskahn
      Type: Party Skill
      Effect: When born under this sign, the Pokemon has access to the 'Incubate' skill from the menu; allowing the Pokemon to nurture any Eggs in the party that are close to hatching, and bring down their remaining step count to 1. The Egg must have less than 1,000 steps left for this to work.

    23. 'The Hunter'

      Constellation: Houndoom
      Type: Battle Lead
      Effect: When born under this sign, the Pokemon increases the capture rate of wild Pokemon by 20% when leading the party. This stacks with other effects.

    24. 'The Eternal'

      Constellation: Mew
      Type: Self Skill
      Effect: When born under this sign, the Pokemon has access to the 'Reincarnate' skill from the menu; allowing the Pokemon to be reborn with a new birthsign. Reincarnated Pokemon begin their life anew, as if they have just been born. Level, EV's, Happiness, Pokerus, OT, Birthdate and Birthsign are all reset; and any effects of the new birthsign will be applied. IV's, Nature, Ability, Gender, Moves, Shinyness and Evolutionary Stages are NOT reset, unless a newly inherited birthsign alters them.

      Once Reincarnated, you are given an opportunity to rename the reborn Pokemon. Also, the obtain method text in the Pokemon's Memo Page in the Summary will now read "From a previous life".The Pokemon is also given a "Second Step Ribbon" to commemorate its new life.

    25. 'The Bard'

      Constellation: Kricketune
      Type: Field Skill
      Effect: When born under this sign, the Pokemon has access to the 'Harmonize' skill from the menu; allowing it to lure wild Pokemon with song.

    26. 'The Empath'

      Constellation: Mesprit
      Type: Party Skill
      Effect: When born under this sign, the Pokemon has access to the 'Bond' skill from the menu; allowing it to select another party member to copy their nature.

    27. 'The Mirror'

      Constellation: Bronzor
      Type: Battle Lead
      Effect: When born under this sign, the Pokemon may get into wild encounters with Pokemon that share similar IV's.

    28. 'The Tactician'

      Constellation: Bisharp
      Type: Self Skill
      Effect: When born under this sign, the Pokemon has access to the 'Gambit' skill from the menu; allowing it to reallocate its EV points in a different arrangement. The Pokemon must already have 510 EV's to activate this skill.

    29. 'The Fool'

      Constellation: Spinda
      Type: Party Skill
      Effect: When born under this sign, the Pokemon has access to the 'Lunacy' skill from the menu; allowing it to reduce its own level by 3 in order to randomly raise the level of a selected party member by 1-5 levels. The user must be at least level 5 to activate this effect. Doesn't work on targets that are higher level than the user.

    30. 'The Alchemist'

      Constellation: Shuckle
      Type: Self Skill
      Effect: When born under this sign, the Pokemon has access to the 'Transmute' skill from the menu; allowing it to morph its held item into a different one. Stardust is used as a catalyst in the transmutation process, and 1 will be consumed from your inventory with each use. This skill cannot be used if you don't have any Stardust in your inventory. The type of item you get through transmutation depends on the initial item being held.


    Installation
    Spoiler:
    Pokemon Birthsigns
    The core birthsigns script that will add the base mechanic to your game. This is the only installation that is required, but there are several add-ons and optional additions that can further enhance this script found below.
    Spoiler:


    **Pokemon Birthsigns is a plug-n-play project, but keep in mind that to do this it means several areas such as the Summary, Storage screen, and other areas of the Essentials script will be overwritten by the changes in the Birthsign script. So if you have any personalized changes to those areas in your own project, you must apply those changes to my Birthsign script as well if you don't want them to be overwritten.**

    1) First, paste the following folder within the Pictures folder under Graphics. This Birthsigns folder contains by default all the graphics required for everything I add to this project, regardless of what version or which scripts you're using. You may also install the pokegear icon separately in your Pictures folder if you want an icon for the Birthsigns Journal to be displayed in your Pokegear.

    2) Then to install the script, create a new section above "Main", and paste all of the code in one of the below links in this new section. Install the first link for default Essentials (v17), or the second for Kleinstudio's Essentials BW (v3).


    **Please note that the Kleinstudio version of this script will not be updated regularly, and thus will not match up with many of the current effects, mechanics, and features present in the latest version of this project.


    Add-on Scripts
    Each of these implement additional features and mechanics to the core birthsign script that all play off of the birthsign mechanics. Highly recommended.
    Spoiler:
    Birthsigns Journal
    Spoiler:


    This script adds a Journal feature to your game which displays relevant information of each birthsign. This includes lore, effects of sign bonuses, each sign's Partner/Rival signs (highlighted in blue/red, respectively), and much more. This can be accessed through a script, event, or through the Pokegear by default. Use scene=BirthsignJournalScene.new to access this otherwise.

    Here is a link to my initial post about this add-on for some more detail:
    Birthsign Journal Post

    1) To install the script, Insert a new section above Main, but below the Pokemon Birthsigns script you just installed previously. Paste the following code in the new section. Choose the first link for default Essentials (v17), or choose the second link for Essentials BW (v3).


    **Please note that the Kleinstudio version of this script will not be updated regularly, and thus will not match up with many of the current effects, mechanics, and features present in the latest version of this project.


    Birthsign Events
    Spoiler:



    This provides new scripts that'll allow you to easily set up three useful Events utilizing Pokemon Birthsigns. This'll give you a way to utilize the Birthsign mechanic as not just a way to enhance your Pokemon, but as a tool that can be utilized to set up events throughout the actual adventure.

    Refer to this linked post for more information about what this script is capable of, and how to set up these events.:
    Birthsign Events Post

    1) To install, use Insert to create a new section below your Pokemon Birthsigns script, and paste the following code in this new section:


    Zodiac Powers (and EBS Compatibility)
    Spoiler:



    This is an entirely new battle mechanic built to support Pokemon Birthsigns. This adds new items known as "Zodiac Gems" to your game that correspond to each of the birthsigns. When your Pokemon with a matching birthsign holds one of these during battle, you can activate its Zodiac Power to unleash a variety of effects. Refer to the post here for an in-depth walkthrough of the mechanic:
    Zodiac Powers Post

    1) To install, use Insert to create a new section below your Pokemon Birthsigns script, and paste the following code in this new section:

    2) Next, you'll need to add the Zodiac Gem graphics into your Pictures/Icons folder. I already numbered them so that you may simply drop them into the folder of a fresh copy of Essentials. If your project already has items with these numbers, please re-number the Zodiac Gems to match your project.

    3) Now you'll need to add the Zodiac Gems to your Items PBS file. Once again, I already numbered them so you can simply copy/paste them into a fresh installation of Essentials. Please re-number them to match your project if you're already using these numbers.

    Items PBS additions:
    Spoiler:
    Code:
    526,JANZODICA,Janzodica,,1,200,"A gem bathed in January's starlight. A Pokémon with a matching birthsign may use its Zodiac Power.",0,0,15,
    527,FEBZODICA,Febzodica,,1,200,"A gem bathed in February's starlight. A Pokémon with a matching birthsign may use its Zodiac Power.",0,0,15,
    528,MARZODICA,Marzodica,,1,200,"A gem bathed in March's starlight. A Pokémon with a matching birthsign may use its Zodiac Power.",0,0,15,
    529,APRIZODICA,Aprizodica,,1,200,"A gem bathed April's starlight. A Pokémon with a matching birthsign may use its Zodiac Power.",0,0,15,
    530,MAYZODICA,Mayzodica,,1,200,"A gem bathed in May's starlight. A Pokémon with a matching birthsign may use its Zodiac Power.",0,0,15,
    531,JUNZODICA,Junzodica,,1,200,"A gem bathed in June's starlight. A Pokémon with a matching birthsign may use its Zodiac Power.",0,0,15,
    532,JULZODICA,Julzodica,,1,200,"A gem bathed in July's starlight. A Pokémon with a matching birthsign may use its Zodiac Power.",0,0,15,
    533,AUGZODICA,Augzodica,,1,200,"A gem bathed in August's starlight. A Pokémon with a matching birthsign may use its Zodiac Power.",0,0,15,
    534,SEPZODICA,Sepzodica,,1,200,"A gem bathed in September's starlight. A Pokémon with a matching birthsign may use its Zodiac Power.",0,0,15,
    535,OCTZODICA,Octzodica,,1,200,"A gem bathed in October's starlight. A Pokémon with a matching birthsign may use its Zodiac Power.",0,0,15,
    536,NOVIZODICA,Novizodica,,1,200,"A gem bathed in November's starlight. A Pokémon with a matching birthsign may use its Zodiac Power.",0,0,15,
    537,DECIZODICA,Decizodica,,1,200,"A gem bathed in December's starlight. A Pokémon with a matching birthsign may use its Zodiac Power.",0,0,15,


    If you're using Luka S.J.'s Elite Battle System, you must also install this compatibility script to allow this add-on to work. Insert a new section below EliteBattle_3, and paste the code from this link in that new section. Name it EliteBattle_ZodiacCompatibility, or whatever you want. ONLY install this if you're using Luka's EliteBattle System!


    Optional Additions
    These are minor additions that aren't essential to anything, but help supplement the birthsign mechanics in useful ways. None of these are required for the base scripts or add-on scripts to function.
    Spoiler:
    PBRibbons Update
    Spoiler:



    This replaces the entire PBRibbons script. This is necessary only to add the "Second Step Ribbon" to your game, which is tied into the effect of 'The Eternal' Birthsign. The Second Step Ribbon is placed onto a Pokemon that has reincarnated itself with that birthsign's effect. It isn't required for anything but that, and the sign will still function perfectly without the ribbon if you don't choose to include it.

    1) First, you need to replace the ribbons graphic in your Graphics/Pictures folder with this:

    2) Then, replace your PBRibbons script with the updated code found here:


    Debug_Pokemon Update
    Spoiler:

    This is necessary only if you'd like access to Debug features that allow you to manually change a Pokemon's birthsign. This is useful for testing purposes, but has no actual use for potential players. Replace your Debug_Pokemon script with this, if you choose to include it:



    PBEggGroups Update
    Spoiler:
    This is necessary only if you want to fully implement my Legendary Breeding mechanic with Pokemon Birthsigns. This adds 8 new Egg Groups to the game that are required for Legendary Breeding. However, nothing will actually change in your game until you make the appropriate changes to the pokemon PBS file. Consult the thread for more details on this.

    Replace your PBEggGroups script with this:



    Features for Other Scripts
    Spoiler:
    Adds some functionality for FL's Unreal Time script, and the Following Pokemon script updated by mej71. You may find my original post detailing this functionality here.

    Unreal Time System
    Spoiler:
    FL's script changes the time mechanic in Essentials so that it behaves more like the time system found in Ocarina of Time, or Harvest Moon. However, with some changes you can make it so that time still flows normally, except you have the ability to jump ahead or backwards to whatever month you desire.

    My addition to his script adds a feature that will allow you to alter the time so that you can change the current month. This is very useful as it allows you to ensure your eggs will hatch with a particular birthsign. You may call this script in an event with "pbSetMonth", which will open up a command list with all 12 months to choose from. Picking a month will set the date so that it is now the first day of that selected month (the time of day will remain the same). There is also a 13th option, "Reset", which will revert the time back to the appropriate real-world time.

    You may also use "pbResetDay" in an Event to reset the current day to the first day of the current month. Also, "pbTimeCheck" will return the current date and time, allowing you to easily check the time to ensure that you've properly set the desired time.


    Installation
    Spoiler:
    1) First off, you'll obviously need to have this script installed first. You may find it here:
    Unreal Time System
    Make sure to credit to FL if using this script.


    2) Once installed, you'll have to make several adjustments to his script. First, use CTRL+F to locate every instance of
    Code:
    NTN_ENABLED
    and change it to
    Code:
    $ntnEnabled
    This will allow the "Reset" function to work, allowing you to revert the time back to normal whenever you desire.


    3) Now find the line:
    Code:
    NTS_TIMEPROPORTION=60
    And change it to:
    Code:
    NTS_TIMEPROPORTION=1
    This will make it so that time moves forward at the normal rate. This isnt required if you prefer time to advance at a quicker rate (at which case set this to whatever number you want. Read FL's notes for more details).


    4) Next, find this line:
    Code:
    NTN_EXTRADAYS=-1
    And change the "-1" into whatever variable number you have available to use. I used 97.


    5) Next, find this section:
    Code:
    # Initial values
    NTN_INITIALYEAR=2000 # Can ONLY holds around range 1970-2038
    NTN_INITIALMONTH=1
    NTN_INITIALDAY=1
    NTN_INITIALHOUR=12
    NTN_INITIALMINUTE=0
    And replace it with this:
    Code:
    # Initial values
    NTN_INITIALYEAR=pbGetTimeNow.year # Can ONLY holds around range 1970-2038
    NTN_INITIALMONTH=pbGetTimeNow.mon
    NTN_INITIALDAY=pbGetTimeNow.day
    NTN_INITIALHOUR=pbGetTimeNow.hour
    NTN_INITIALMINUTE=pbGetTimeNow.min
    This will make it so that the base time that the Unreal Time system uses is whatever the current date and time is, instead of the default FL uses (January 1st, 2000).


    6) Finally, paste all of the following somewhere in your project. Right below the Unreal Time script is a good spot.
    Code:
    #===============================================================================
    # Month Reset
    # Allows you to reset the current month to a different one.
    # Requires FL's Unreal Time System script, found here:
    #===============================================================================
    # http://www.pokecommunity.com/showthread.php?p=7283916#7283916
    #===============================================================================
    # Use pbTimeCheck in an event to check the current date and time.
    # Use pbResetDay in an event to change the day to the first of the month.
    # Use pbSetMonth in an event to select a new month to set the time to.
    
    # Use so you may check the current date and time.
    # Useful way to check if the time has been properly set.
    def pbTimeCheck
      curmon=pbGetAbbrevMonthName(pbGetTimeNow.mon)
      curday=pbGetTimeNow.day
      curyear=pbGetTimeNow.year
      curhour=pbGetTimeNow.hour
      curmin=pbGetTimeNow.min
      Kernel.pbMessage(_INTL("Date: {1} {2}, {3}\nTime: {4}:{5}",
      curmon,curday,curyear,curhour,curmin))
    end
    
    # Used to reset the current day to the first of the month.
    # Months may be off by a few days otherwise.
    def pbResetDay
      curDay = pbGetTimeNow.day
      timeDifference = (1-curDay)
      setToFirst = timeDifference
      $game_variables[NTN_EXTRADAYS]+=setToFirst
      Kernel.pbMessage(_INTL("The current day has been reset to the first of the month."))
    end
    
    # Allows you to choose the desired month to switch to. The day is reset to
    # the first day of the newly selected month.
    # Use the "Reset" option at the bottom of the list to revert the month and
    # day to its natural time.
    def pbSetMonth
      curMonth = pbGetTimeNow.mon*30
      curDay = pbGetTimeNow.day
      timeNow = curMonth+curDay
      command=0
      loop do
        command=Kernel.pbShowCommands(nil,[
        _INTL("January"),
        _INTL("February"),
        _INTL("March"),
        _INTL("April"),
        _INTL("May"),
        _INTL("June"),
        _INTL("July"),
        _INTL("August"),
        _INTL("September"),
        _INTL("October"),
        _INTL("November"),
        _INTL("December"),
        _INTL("Reset"),
        _INTL("Cancel")
        ],-1)
        case command
        ### Cancel ###
        when -1, 13
          Kernel.pbMessage(_INTL("The current date was not changed."))
          break
        ### Jan ###
        when 0
          month = 1
          timeWished = month*30
          timeDifference = timeWished-timeNow
          monthSet = timeDifference
          $game_variables[NTN_EXTRADAYS]+=monthSet
          Kernel.pbMessage(_INTL("The month has been set to January."))
          pbResetDay
          break
        ### Feb ###
        when 1
          month = 2
          timeWished = month*31
          timeDifference = timeWished-timeNow
          monthSet = timeDifference
          $game_variables[NTN_EXTRADAYS]+=monthSet
          Kernel.pbMessage(_INTL("The month has been set to February."))
          pbResetDay
          break
        ### Mar ###
        when 2
          month = 3
          timeWished = month*31
          timeDifference = timeWished-timeNow
          monthSet = timeDifference
          $game_variables[NTN_EXTRADAYS]+=monthSet
          Kernel.pbMessage(_INTL("The month has been set to March."))
          pbResetDay
          break
        ### Apr ###
        when 3
          month = 4
          timeWished = month*31
          timeDifference = timeWished-timeNow
          monthSet = timeDifference
          $game_variables[NTN_EXTRADAYS]+=monthSet
          Kernel.pbMessage(_INTL("The month has been set to April."))
          pbResetDay
          break
        ### May ###
        when 4
          month = 5
          timeWished = month*31
          timeDifference = timeWished-timeNow
          monthSet = timeDifference
          $game_variables[NTN_EXTRADAYS]+=monthSet
          Kernel.pbMessage(_INTL("The month has been set to May."))
          pbResetDay
          break
        ### Jun ###
        when 5
          month = 6
          timeWished = month*31
          timeDifference = timeWished-timeNow
          monthSet = timeDifference
          $game_variables[NTN_EXTRADAYS]+=monthSet
          Kernel.pbMessage(_INTL("The month has been set to June."))
          pbResetDay
          break
        ### Jul ###
        when 6
          month = 7
          timeWished = month*31
          timeDifference = timeWished-timeNow
          monthSet = timeDifference
          $game_variables[NTN_EXTRADAYS]+=monthSet
          Kernel.pbMessage(_INTL("The month has been set to July."))
          pbResetDay
          break
        ### Aug ###
        when 7
          month = 8
          timeWished = month*31
          timeDifference = timeWished-timeNow
          monthSet = timeDifference
          $game_variables[NTN_EXTRADAYS]+=monthSet
          Kernel.pbMessage(_INTL("The month has been set to August."))
          pbResetDay
          break
        ### Sep ###
        when 8
          month = 9
          timeWished = month*31
          timeDifference = timeWished-timeNow
          monthSet = timeDifference
          $game_variables[NTN_EXTRADAYS]+=monthSet
          Kernel.pbMessage(_INTL("The month has been set to September."))
          pbResetDay
          break
        ### Oct ###
        when 9
          month = 10
          timeWished = month*31
          timeDifference = timeWished-timeNow
          monthSet = timeDifference
          $game_variables[NTN_EXTRADAYS]+=monthSet
          Kernel.pbMessage(_INTL("The month has been set to October."))
          pbResetDay
          break
        ### Nov ###
        when 10
          month = 11
          timeWished = month*31
          timeDifference = timeWished-timeNow
          monthSet = timeDifference
          $game_variables[NTN_EXTRADAYS]+=monthSet
          Kernel.pbMessage(_INTL("The month has been set to November."))
          pbResetDay
          break
        ### Dec ###
        when 11
          month = 12
          timeWished = month*31
          timeDifference = timeWished-timeNow
          monthSet = timeDifference
          $game_variables[NTN_EXTRADAYS]+=monthSet
          Kernel.pbMessage(_INTL("The month has been set to December."))
          pbResetDay
          break
        ### Reset ###
        when 12
          $game_variables[NTN_EXTRADAYS] = 0
          $PokemonGlobal.newFrameCount=0
          Kernel.pbMessage(_INTL("The time has been reset to the current date."))
          break
        end
      end
    end
    ~

    *Note: You shouldn't bother FL with questions or help with this addition. I made this add-on to his script on my own and he isn't responsible for it if it's causing issues for you. I've tested it and it seems to work perfectly, so there shouldn't be an issue if you follow the instructions. And please remember to give credit to him for his script.



    Following Pokemon
    Spoiler:
    This script, updated by mej71, adds the follower mechanic originally seen in HGSS. Talking to a follower will display various messages that change based on certain factors.

    My addition to this project adds a birthday emote and various birthday messages to the Following Pokemon script, which will be displayed on your hatched followers every year during their birthday.


    Installation
    Spoiler:
    1) First off, you'll obviously need to have this script installed first. You may find it here:
    Following Pokemon
    Make sure to credit the appropriate people if using this script.


    2) Now at the top of the script, add my bolded line to this section:
    Code:
    Following_Activated_Switch = 126      # Switch should be reserved
    Toggle_Following_Switch = 103         # Switch should be reserved
    Current_Following_Variable = 36       # Variable should be reserved
    CommonEvent = 4                       # Common Event space needed
    ItemWalk=26                           # Variable should be reserved
    Walking_Time_Variable = 27            # Variable should be reserved
    Walking_Item_Variable = 28            # Variable should be reserved
    Animation_Come_Out = 93              
    Animation_Come_In = 94
    Emo_Happy = 95
    Emo_Normal = 96
    Emo_Hate = 97
    Emo_Poison= 98
    Emo_sing= 99
    Emo_love= 100
    Emo_Cake= 92

    3) Next, search the Following Pokemon script for this heading:
    Code:
    #===============================================================================
    # * Random Messages if none of the above apply
    #===============================================================================
    And paste the following new code above this heading:
    (Note that mej71 has already updated his script to include this, so you many not need to add this)
    Code:
    #===============================================================================
    # * Pokemon Messages when birthday
    #===============================================================================          
              elsif e.isBirthday?
                $scene.spriteset.addUserAnimation(Emo_Cake, pos_x, pos_y-2)
                pbWait(50)
                messages=rand(10)
                if messages==0
                  Kernel.pbMessage(_INTL("{1} seems to be reminiscing on all it has learned in the last year.",e.name,$Trainer.name))
                elsif messages==1
                  Kernel.pbMessage(_INTL("{1} seems glad to be spending its birthday with {2}.",e.name,$Trainer.name))
                elsif messages==2
                  Kernel.pbMessage(_INTL("{1} is having the best birthday ever!",e.name,$Trainer.name))
                elsif messages==3
                  Kernel.pbMessage(_INTL("{1} can't believe its been a whole year already!",e.name,$Trainer.name))
                elsif messages==4
                  Kernel.pbMessage(_INTL("{1} seems to be sniffing around for presents...",e.name,$Trainer.name))
                elsif messages==5
                  Kernel.pbMessage(_INTL("{1} seems a bit out of breath...\nYou're getting old!",e.name,$Trainer.name))
                elsif messages==6
                  Kernel.pbMessage(_INTL("{1} looks ready to party!",e.name,$Trainer.name))
                elsif messages==7
                  Kernel.pbMessage(_INTL("You wish {1} a happy birthday.\nHappy birthday, {1}!",e.name,$Trainer.name))
                elsif messages==8
                  Kernel.pbMessage(_INTL("{1} seems to be looking forward to another year with {2}.",e.name,$Trainer.name))
                elsif messages==9
                  Kernel.pbMessage(_INTL("{1} wants to eat some cake!",e.name,$Trainer.name))
                end

    4) Now go into your Graphics/Animations folder, and add this graphic. It'll ask you to replace the existing graphic in that folder, and click yes.
    New emo2 graphic


    5) Now make sure to save your work and exit RPGMaker before moving onto the next step.


    6) Finally, go into your Data folder and add this file. It'll ask you to replace the existing file in that folder, and click yes.
    New Animations file

    *Note: You shouldn't bother mej71 with questions or help with this addition. I made this add-on to his script on my own and he isn't responsible for it if it's causing issues for you. I've tested it and it seems to work perfectly, so there shouldn't be an issue if you follow the instructions. And please remember to give credit to him and the rest of the contributors to the script.





    Useful Things to Know
    Spoiler:

    Toggles
    • ZODIACSET
      This controls which 12-month zodiac will be active in your game. Set this to a number that will give you the desired zodiac set.
      0 = No zodiac.
      1 = Birthsigns Set 1 (signs 1-12)
      2 = Birthsigns Set 2 (signs 13-24)
      3 = Random Zodiac
      4 = Custom Zodiac

    • WILDBIRTHSIGNS
      This controls whether wild Pokemon will spawn with birthsigns. The number you set this toggle will give different results.
      0 = Wild Pokemon spawn with no birthsigns.
      1 = Wild Pokemon spawn with whatever the current month's sign is, based on your zodiac.
      2 = Wild Pokemon spawn with a random sign out of your 12 month zodiac.
      3 = Wild Pokemon spawn with a random sign out of all 30 birthsign options.

    • SHOW_IV_STARS
      This toggles whether or not you want my IV Star Ratings script to be displayed in your game. Set this to true or false.

    • SHOW_EGG_GROUPS
      This toggles whether or not you want my Summary Egg Groups script to be displayed in your game. Set this to true or false.

    • SHOW_SHINY_LEAF
      This toggles whether or not you want my HGSS Shiny Leaf Functionality script to be displayed in your game. Set this to true or false.

    • INCLUDE_ZMOVES
      This toggles compatibility with the Z-Move Add On scripts. Please set this toggle to "true" if using their scripts. Otherwise, this must be set to "false".


    Coding
    • PBBirthsigns.getName(X)
      Returns the name of a particular birthsign, where "X" is the number associated with a particular sign (where 'The Apprentice' is #1, and 'The Alchemist' is #30).

    • PBZodiacsigns.getName(X)
      Returns the name of a particular birthsign within your 12-month zodiac, where "X" is the number of the month associated with that sign (ex. 9 would get the name of September's sign).

    • pokemon.pbGetBirthsignName
      Returns the name of the Pokemon's active birthsign.

    • pokemon.setZodiacsign(X)
      Manually sets a particular sign on a Pokemon, where "X" is the month number associated with a particular sign in your zodiac.

    • pokemon.setRandomZodiac
      Sets a completely random birthsign on a Pokemon out of your 12-month zodiac.

    • pokemon.setBirthsign(X)
      Manually sets a particular sign on a Pokemon, where "X" is the number associated with a particular sign (where 'The Apprentice' is #1, and 'The Alchemist' is #30).

    • pokemon.setRandomSign
      Sets a completely random birthsign on a Pokemon out of the 30 possible options.

    • pokemon.canHaveSign?
      Returns true if the Pokemon in question is capable of having a birthsign.

    • pokemon.hasXxxBirthsign?
      Returns true if the Pokemon in question has a particular zodiac sign, where "Xxx" is the abbreviated month, such as Jan or Dec.

    • pokemon.hasPartnerSign?
      pokemon.hasRivalSign?
      Returns true if the Pokemon in question has a corresponding Partner or Rival sign to the current month.

    • pokemon.hasCurrentSign?
      Returns true if the Pokemon in question has the current month's birthsign.

    • pokemon.hasBirthsign?
      Returns true if the Pokemon in question has any birthsign.

    • pokemon.isBirthday?
      Returns true if it's the Pokemon's birthday. Only applies to hatched Pokemon.

    • pokemon.setShinyLeaf(X)
      Sets a number of shiny leaves on a Pokemon, where "X" is the number of desired leaves (0-6). This wont be displayed unless the SHOW_SHINY_LEAF toggle is set to "true".

    • pokemon.addShinyLeaf
      Adds 1 shiny leaf to a Pokemon's total. This wont be displayed unless the SHOW_SHINY_LEAF toggle is set to "true".

    • pokemon.removeShinyLeaf
      Removes 1 shiny leaf from a Pokemon's total. This wont be displayed unless the SHOW_SHINY_LEAF toggle is set to "true".

    • pokemon.hasLeafCrown?
      Returns true if the Pokemon has a leaf crown (6 leaves).

    • pbArceusEggSpawn
      Running this script in an event allows you to trigger a unique event that allows Arceus to spawn an egg of specific legendary species based on its held item. This is a feature introduced in my Legendary Breeding script, so consult that thread for more details on its mechanics.


    Reference
    • All Partner/Rival sign month match-ups:
      Spoiler:
      1. Month: January
        Partners: May, September
        Rival: July

      2. Month: February
        Partners: June, October
        Rival: August

      3. Month: March
        Partners: July, November
        Rival: September

      4. Month: April
        Partners: August, December
        Rival: October

      5. Month: May
        Partners: September, January
        Rival: November

      6. Month: June
        Partners: October, February
        Rival: December

      7. Month: July
        Partners: November, March
        Rival: January

      8. Month: August
        Partners: December, April
        Rival: February

      9. Month: September
        Partners: January, May
        Rival: March

      10. Month: October
        Partners: February, June
        Rival: April

      11. Month: November
        Partners: March, July
        Rival: May

      12. Month: December
        Partners: April, August
        Rival: June



    For Add-on Scripts
    • scene = BirthsignsJournalScene.new
      Accesses the Birthsigns Journal (if the Birthsigns Journal Add-On is installed)

    • Setting up a birthsign event:
      Using the Birthsign Events script, you can easily set up three different types of events -
      Spoiler:
      Event Types
      • Birthstone Event:
        Grants a selected Pokemon the corresponding birthsign if they don't already have one.

      • Birthpath Event:
        Unlocks a blocked path if a selected Pokemon has the corresponding birthsign.

      • Sign Conversion Event:
        Converts a selected Pokemon's existing birthsign to the new corresponding birthsign.


      Control Switches
      The Birthsign Events script utilizes 15 different control switches (numbers 111-125). 12 for months, and 3 for the actual event types. If your project already uses these switch numbers for something else, you must re-number the Birthsign Event switches in the script itself. To avoid confusion, it's best if you name all of the switches as so:



      To set up an Event, all you need to do is turn ON the desired month switch, and the desired event type switch. Then insert the script pbBirthsignEvent. Page 2 of the event should be blank (for Birthstone and Sign Conversion events), but have the Self Switch A turned on. Birthpath events are different only in that Page 2 should have an "unlocked" event in place, for when the player meets the requirements of Page 1.

      Here's an example of a Sign Conversion event for December's birthsign:



    • Giving NPC Trainers the ability to use Zodiac Powers in battle:
      If the Zodiac Powers Add-On is installed, make the following changes -
      Spoiler:
      In the PTrainer_NPCTrainers section:
      • 1) Find this line in the script:
        Code:
        TPDEFAULTS = [0,10,0,0,0,0,0,nil,nil,0,false,nil,10,70,nil,false,0]
        And replace it with this:
        Code:
        #===============================================================================
        TPBIRTHSIGN = 17
        TPDEFAULTS = [0,10,0,0,0,0,0,nil,nil,0,false,nil,10,70,nil,false,0,0]
        #===============================================================================

      • 2) Next, find this line:
        Code:
        pokemon.ballused=poke[TPBALL]
        And paste this directly under it:
        Code:
        #=========================================================================
              pokemon.setBirthsign(poke[TPBIRTHSIGN])
              #=========================================================================

        That's it! Now, if you want to give a trainer's Pokemon a Zodiac Power, you may do so in the Trainer PBS file. Simply give the Pokemon the desired Zodiac Gem to hold, and then add the month of the birthsign as the final variable by writing the 3 letter abbreviation in caps (ex: JAN). Doing so will give the trainer's Pokemon the required birthsign to activate its item.

        Trainer PBS example:
        Code:
        #-------------------
        PICNICKER
        Susie
        1
        MEOWTH,10,OCTZODICA,,,,,,,0,,,,,,,,OCT
        #-------------------
        PICNICKER
        Susie,1
        1
        PERSIAN,32,OCTZODICA,FAKEOUT,NIGHTSLASH,HYPNOSIS,SLASH,1,,0,,ADAMANT,31,,,,,OCT
        #-------------------

      Keep in mind that NPC Trainers will always activate their Zodiac Powers on turn 1.


    • Imposing a once-per-battle rule for Zodiac Powers:
      By default, you can use Zodiac Powers an unlimited number of times in battle. This is balanced by the Zodiac Gems (which trigger the powers) being consumables. However, you can still implement a once per battle rule by simply doing this -
      Spoiler:
      Find this line in the Zodiac Power script, and remove the comment tag in front of it
      Code:
      #@zodiacPower[side][owner]=-2




    Version History
    Current: v2.6.1
    Spoiler:
    (v2.6.1) Minor Update 1/18/18: Legendary Breeding Compatibility
    (v2.6) Major Update 1/7/18: New Signs & Custom Zodiac
    (v2.5.1) Minor Update 12/13/17: Final Revisions for v17
    (v2.5) Major Update 12/8/17: Essentials 17 Compatibility & Overhauls
    (v2.1.3) Major Update 4/28/17: Zodiac Powers
    (v2.0.3) Minor Update 4/19/17: Player Signs and Birthsign updates
    (v2.0.2) Update 3/30/17: Birthsigns for Essentials BW
    (v2.0.1) Minor Update 5/4/16: Add-on Features for Other Scripts
    (v2.0) Update 5/2/16: Happy Birthday, Pokemon Birthsigns!
    (v1.5.3) Minor Update 4/18/16 : Code changes for 'The Ancestor' and 'The Specialist'
    (v1.5.2) Minor Update 1/7/16 : Compatibility fixes for Essentials v16
    (v1.5.1) Minor Update 9/28/15 : PC Modifications
    (v1.5) Update 9/24/15 : Birthsign Events
    (v1.4.1) Minor Update 9/17/15 : 'The Eternal' Update
    (v1.4) Update 9/16/15 : Plug-n-Play Birthsigns
    (v1.3) Update 9/9/15 : Manual Birthsigns, Debug Options, and Script Overhauls
    (V1.2) Update 5/21/15 : Birthsigns Journal
    (v1.1) Update 5/14/15: Birthsign Set 2
    (v1.0) Posted 5/7/15: Pokemon Birthsigns


    Known Issues
    As of version v2.6.1
    Spoiler:
    • (Zodiac Powers) Not every move/ability/zodiac power combination has been tested. There are bound to be certain things that break when stacked together. One example is using 'The Voyager' Zodiac Power (U-Turn effect) and Baton Pass on the same turn, which causes Baton Pass to break and create an awkward situation in battle. I'll fix some of these issues as I find them, if possible.


    Complementary Scripts
    Other scripts that work well in conjunction with Pokemon Birthsigns are:
    Spoiler:
    Reply With Quote

    Relevant Advertising!

      #2    
    Old May 7th, 2015 (1:02 PM). Edited May 7th, 2015 by Super Dedenne.
    Super Dedenne's Avatar
    Super Dedenne Super Dedenne is offline
       
      Join Date: Apr 2014
      Gender: Other
      Posts: 32
      Wow... I've never really seen anyone tackle how hatching works in such a way. Quite the imagination! The is fantastic and the tutorial enables the birth (haha) of an entire host of fantastic ideas. I didn't really expect you'd set out-of-battle HM moves to be naturally known by the Pokemon with a specific sign--brilliant!

      I didn't have enough time to play with the summary screens or the Birthsign TM/HM effect hiccup, but if you wish I could help you out via PM with those quirks on my free time.

      Spoiler:

      (And thanks for linking those seriously overlooked scripts. FL and Obito would've really appreciated it.)
      __________________
      Public Additions/Snippets:
      Trainer Outfit: Acro/MachBike Fix
      (Needs 15.1 update) Pokemon Summary Add-On: Improved Ribbons + Scroll!
      I might release some of my private plug-n'-play scripts in the future.
      Reply With Quote
        #3    
      Old May 7th, 2015 (1:59 PM).
      Lucidious89 Lucidious89 is offline
         
        Join Date: Apr 2014
        Gender: Male
        Posts: 173
        Quote:
        Originally Posted by Super Dedenne View Post
        Wow... I've never really seen anyone tackle how hatching works in such a way. Quite the imagination! The is fantastic and the tutorial enables the birth (haha) of an entire host of fantastic ideas. I didn't really expect you'd set out-of-battle HM moves to be naturally known by the Pokemon with a specific sign--brilliant!

        I didn't have enough time to play with the summary screens or the Birthsign TM/HM effect hiccup, but if you wish I could help you out via PM with those quirks on my free time.

        Spoiler:

        (And thanks for linking those seriously overlooked scripts. FL and Obito would've really appreciated it.)
        Thanks, I'm glad you like it. Ever since i discovered the 'zodiac' def in the scripts, it's been bugging me how such a cool element has gone (as far as I can tell) completely unused by anyone working with Essentials. That's basically where the idea began. The out-of-battle moves was born out of how im trying to design my own Pokemon game; I'm trying to make it really challenging where items and quick travel are scarce, so it seemed like a cool idea to me to give them as optional bonuses to Pokemon if you went out of your way to customize them from birth. This way the player is forced into making a choice; do I go for the better battling potential right out of the gate? Or maybe for effects that'll make things easier for me outside of battle?

        I also tried to capitalize on the lesser-used moves that are usually abandoned by players. Most players ditch Teleport for Fly, Flash is generally not even mandatory, and Soft-Boiled has an extremely small userbase. This way, those effects can still be useful without having to lug around an otherwise useless move, or a Pokemon you don't want to train. This is why I didn't choose things like Surf, which is something everyone is likely to have in their party anyway; even if it wasn't an HM.

        As far as any help goes, I would really appreciate it! I'm sure if I played around with things long enough, I'd eventually figure out how to fix those small quirks. I just got sort of burnt out trying to fix them when they're ultimately pretty minor.

        (And I agree those scripts are overlooked! I use a few of them myself and I think they're great!)

        Also I just edited the post to fix a couple of naming issues I noticed. Nothing major, it was just bugging me that I wrote the wrong names in one of the commented-out sections.
        Reply With Quote
          #4    
        Old May 7th, 2015 (2:15 PM).
        akane159 akane159 is offline
           
          Join Date: Oct 2012
          Gender: Female
          Posts: 72
          i did what you say, but it nothing happen :S , i have to swicht "ON" son variable ?
          Reply With Quote
            #5    
          Old May 7th, 2015 (2:19 PM).
          Lucidious89 Lucidious89 is offline
             
            Join Date: Apr 2014
            Gender: Male
            Posts: 173
            Quote:
            Originally Posted by akane159 View Post
            i did what you say, but it nothing happen :S , i have to swicht "ON" son variable ?
            There shouldn't be anything you have to switch on. Just hatch an egg, and whatever month it currently is will have its effects applied. If your Pokemon has a round purple icon graphic on its summary pages, then it already has the corresponding effect applied.
            Reply With Quote
              #6    
            Old May 7th, 2015 (2:24 PM).
            akane159 akane159 is offline
               
              Join Date: Oct 2012
              Gender: Female
              Posts: 72
              but nothing happen, look :S

              Spoiler:
              Reply With Quote
                #7    
              Old May 7th, 2015 (2:34 PM).
              Lucidious89 Lucidious89 is offline
                 
                Join Date: Apr 2014
                Gender: Male
                Posts: 173
                Quote:
                Originally Posted by akane159 View Post
                but nothing happen, look :S

                Spoiler:
                Did you download and install the graphics from the link in Step 11? If your computer is following the standard time, it should be applying May's effect - 'The Prodigy'. This means any Pokemon you hatch will ALWAYS hatch with its Hidden Ability.

                Check the Pokemon you're hatching, and see if they all have their HA's. If they do, then the scripts are working, you just didn't implement the graphics correctly.
                Reply With Quote
                  #8    
                Old May 7th, 2015 (2:37 PM).
                akane159 akane159 is offline
                   
                  Join Date: Oct 2012
                  Gender: Female
                  Posts: 72
                  this is me script
                  PField_Time
                  Spoiler:
                  Quote:
                  ################################################################################
                  # * Day and night system
                  ################################################################################
                  def pbGetTimeNow
                  return Time.now
                  end



                  module PBDayNight
                  HourlyTones=[
                  Tone.new(-142.5,-142.5,-22.5,68), # Midnight
                  Tone.new(-135.5,-135.5,-24, 68),
                  Tone.new(-127.5,-127.5,-25.5,68),
                  Tone.new(-127.5,-127.5,-25.5,68),
                  Tone.new(-119, -96.3, -45.3,45.3),
                  Tone.new(-51, -73.7, -73.7,22.7),
                  Tone.new(17, -51, -102, 0), # 6AM
                  Tone.new(14.2, -42.5, -85, 0),
                  Tone.new(11.3, -34, -68, 0),
                  Tone.new(8.5, -25.5, -51, 0),
                  Tone.new(5.7, -17, -34, 0),
                  Tone.new(2.8, -8.5, -17, 0),
                  Tone.new(0, 0, 0, 0), # Noon
                  Tone.new(0, 0, 0, 0),
                  Tone.new(0, 0, 0, 0),
                  Tone.new(0, 0, 0, 0),
                  Tone.new(-3, -7, -2, 0),
                  Tone.new(-10, -18, -5, 0),
                  Tone.new(-36, -75, -13, 0), # 6PM
                  Tone.new(-72, -136, -34, 3),
                  Tone.new(-88.5, -133, -31, 34),
                  Tone.new(-108.5,-129, -28, 68),
                  Tone.new(-127.5,-127.5,-25.5,68),
                  Tone.new(-142.5,-142.5,-22.5,68)
                  ]
                  @cachedTone=nil
                  @dayNightToneLastUpdate=nil

                  # Returns true if it's day.
                  def self.isDay?(time)
                  return (time.hour>=6 && time.hour<20)
                  end

                  # Returns true if it's night.
                  def self.isNight?(time)
                  return (time.hour>=20 || time.hour<6)
                  end

                  # Returns true if it's morning.
                  def self.isMorning?(time)
                  return (time.hour>=6 && time.hour<12)
                  end

                  # Returns true if it's the afternoon.
                  def self.isAfternoon?(time)
                  return (time.hour>=12 && time.hour<20)
                  end

                  # Returns true if it's the evening.
                  def self.isEvening?(time)
                  return (time.hour>=17 && time.hour<20)
                  end

                  # Gets a number representing the amount of daylight (0=full night, 255=full day).
                  def self.getShade
                  time=pbGetDayNightMinutes
                  time=(24*60)-time if time>(12*60)
                  shade=255*time/(12*60)
                  end

                  # Gets a Tone object representing a suggested shading
                  # tone for the current time of day.
                  def self.getTone()
                  return Tone.new(0,0,0) if !ENABLESHADING
                  if [email protected]
                  @cachedTone=Tone.new(0,0,0)
                  end
                  if [email protected] || @dayNightToneLastUpdate!=Graphics.frame_count
                  @cachedTone=getToneInternal()
                  @dayNightToneLastUpdate=Graphics.frame_count
                  end
                  return @cachedTone
                  end

                  def self.pbGetDayNightMinutes
                  now=pbGetTimeNow # Get the current in-game time
                  return (now.hour*60)+now.min
                  end

                  private

                  # Internal function

                  def self.getToneInternal()
                  # Calculates the tone for the current frame, used for day/night effects
                  realMinutes=pbGetDayNightMinutes
                  hour=realMinutes/60
                  minute=realMinutes%60
                  tone=PBDayNight::HourlyTones[hour]
                  nexthourtone=PBDayNight::HourlyTones[(hour+1)%24]
                  # Calculate current tint according to current and next hour's tint and
                  # depending on current minute
                  return Tone.new(
                  ((nexthourtone.red-tone.red)*minute/60.0)+tone.red,
                  ((nexthourtone.green-tone.green)*minute/60.0)+tone.green,
                  ((nexthourtone.blue-tone.blue)*minute/60.0)+tone.blue,
                  ((nexthourtone.gray-tone.gray)*minute/60.0)+tone.gray
                  )
                  end
                  end



                  def pbDayNightTint(object)
                  if !$scene.is_a?(Scene_Map)
                  return
                  else
                  if ENABLESHADING && $game_map && pbGetMetadata($game_map.map_id,MetadataOutdoor)
                  tone=PBDayNight.getTone()
                  object.tone.set(tone.red,tone.green,tone.blue,tone.gray)
                  else
                  object.tone.set(0,0,0,0)
                  end
                  end
                  end



                  ################################################################################
                  # * Zodiac and day/month checks
                  ################################################################################
                  # Calculates the phase of the moon.
                  # 0 - New Moon
                  # 1 - Waxing Crescent
                  # 2 - First Quarter
                  # 3 - Waxing Gibbous
                  # 4 - Full Moon
                  # 5 - Waning Gibbous
                  # 6 - Last Quarter
                  # 7 - Waning Crescent
                  def moonphase(time) # in UTC
                  transitions=[
                  1.8456618033125,
                  5.5369854099375,
                  9.2283090165625,
                  12.9196326231875,
                  16.6109562298125,
                  20.3022798364375,
                  23.9936034430625,
                  27.6849270496875]
                  yy=time.year-((12-time.mon)/10.0).floor
                  j=(365.25*(4712+yy)).floor + (((time.mon+9)%12)*30.6+0.5).floor + time.day+59
                  j-=(((yy/100.0)+49).floor*0.75).floor-38 if j>2299160
                  j+=(((time.hour*60)+time.min*60)+time.sec)/86400.0
                  v=(j-2451550.1)/29.530588853
                  v=((v-v.floor)+(v<0 ? 1 : 0))
                  ag=v*29.53
                  for i in 0...transitions.length
                  return i if ag<=transitions[i]
                  end
                  return 0
                  end

                  #=======================================================================================
                  # New Birthsigns
                  #
                  # If you want to modify the date ranges for each Birthsign:
                  #-The first number on each line corresponds to the month that Birthsign begins.
                  #-The second number on each line corresponds to the day of the given month that the Birthsign begins.
                  #-The third number on each line corresponds to the month that the Birthsign ends.
                  #-The fourth number on each line corresponds to the day of the given month that the Birthsign ends.
                  #
                  #If you change the date ranges for any of the Birthsigns, make sure to reflect these changes in the
                  #Birthsign Page text in PScreen_Summary
                  #=======================================================================================
                  def zodiac(month,day)
                  time=[
                  1,1,1,31, # The Companion
                  2,1,2,28, # The Lover
                  3,1,3,31, # The Beacon
                  4,1,4,30, # The Savage
                  5,1,5,31, # The Prodigy
                  6,1,6,30, # The Martyr
                  7,1,7,31, # The Widow
                  8,1,8,31, # The Gladiator
                  9,1,9,30, # The Voyager
                  10,1,10,31, # The Thief
                  11,1,11,30, # The Glutton
                  12,1,12,31 # The Wishmaker
                  ]
                  for i in 0...12
                  return i if month==time[i*4] && day>=time[i*4+1]
                  return i if month==time[i*4+2] && day<=time[i*4+2]
                  end
                  return 0
                  end
                  #=======================================

                  # Calculates the zodiac sign based on the given month and day:
                  # 0 is Aries, 11 is Pisces. Month is 1 if January, and so on.
                  def zodiac(month,day)
                  time=[
                  3,21,4,19, # Aries
                  4,20,5,20, # Taurus
                  5,21,6,20, # Gemini
                  6,21,7,20, # Cancer
                  7,23,8,22, # Leo
                  8,23,9,22, # Virgo
                  9,23,10,22, # Libra
                  10,23,11,21, # Scorpio
                  11,22,12,21, # Sagittarius
                  12,22,1,19, # Capricorn
                  1,20,2,18, # Aquarius
                  2,19,3,20 # Pisces
                  ]
                  for i in 0...12
                  return i if month==time[i*4] && day>=time[i*4+1]
                  return i if month==time[i*4+2] && day<=time[i*4+2]
                  end
                  return 0
                  end

                  # Returns the opposite of the given zodiac sign.
                  # 0 is Aries, 11 is Pisces.
                  def zodiacOpposite(sign)
                  return (sign+6)%12
                  end

                  # 0 is Aries, 11 is Pisces.
                  def zodiacPartners(sign)
                  return [(sign+4)%12,(sign+8)%12]
                  end

                  # 0 is Aries, 11 is Pisces.
                  def zodiacComplements(sign)
                  return [(sign+1)%12,(sign+11)%12]
                  end
                  #===============================================================================
                  # Birthsigns - Names & Descriptions
                  #
                  #If you choose to change the names of 'The Beacon', 'The Martyr', or 'The Voyager', you will also
                  #need to change the text in PScreen_Party & PScreen_Summary to match your new names.
                  #
                  #If you choose to change the names of any of the other Birthsigns, you will need to change the
                  #text in PScreen_EggHatching & PScreen_Summary to match your new names.
                  #
                  #If you choose to change the description text for any of the Birthsigns, your next text may no
                  #longer fit on the page and may require new positioning in PScreen_Summary, and may
                  #also need changes to the 'summaryzboarder' graphic.
                  #===============================================================================
                  def zodiacValue(sign)
                  return (sign)%12
                  end

                  def pbGetZodiacName(sign)
                  return [_INTL(""),
                  _INTL("'The Apprentice'"),
                  _INTL("'The Companion'"),
                  _INTL("'The Beacon'"),
                  _INTL("'The Savage'"),
                  _INTL("'The Prodigy'"),
                  _INTL("'The Martyr'"),
                  _INTL("'The Maiden'"),
                  _INTL("'The Gladiator'"),
                  _INTL("'The Voyager'"),
                  _INTL("'The Thief'"),
                  _INTL("'The Glutton'"),
                  _INTL("'The Wishmaker'")][sign]
                  end

                  def pbGetZodiacDesc(sign)
                  return [_INTL(""),
                  _INTL("The Pokémon is born cured of Pokérus."),
                  _INTL("The Pokémon is born with max happiness."),
                  _INTL("The Pokémon can use Flash without the move."),
                  _INTL("The Pokémon has max IV's in offense & Speed, but 0 HP."),
                  _INTL("The Pokémon is born with its Hidden Ability."),
                  _INTL("The Pokémon can use Soft-Boiled without the move."),
                  _INTL("The Pokémon is always born female, if able."),
                  _INTL("The Pokémon is born with 100 EV's in Atk & Sp.Atk."),
                  _INTL("The Pokémon can use Teleport without the move."),
                  _INTL("The Pokémon is born with max EV's in Speed."),
                  _INTL("The Pokémon has max IV's in defenses & HP, but 0 Speed."),
                  _INTL("The Pokémon is always born shiny.")][sign]
                  end
                  #===========================================================================

                  def pbIsWeekday(wdayVariable,*arg)
                  timenow=pbGetTimeNow
                  wday=timenow.wday
                  ret=false
                  for wd in arg
                  ret=true if wd==wday
                  end
                  if wdayVariable>0
                  $game_variables[wdayVariable]=[
                  _INTL("Sunday"),
                  _INTL("Monday"),
                  _INTL("Tuesday"),
                  _INTL("Wednesday"),
                  _INTL("Thursday"),
                  _INTL("Friday"),
                  _INTL("Saturday")
                  ][wday]
                  $game_map.need_refresh = true if $game_map
                  end
                  return ret
                  end

                  def pbIsMonth(wdayVariable,*arg)
                  timenow=pbGetTimeNow
                  wday=timenow.mon
                  ret=false
                  for wd in arg
                  ret=true if wd==wday
                  end
                  if wdayVariable>0
                  $game_variables[wdayVariable]=[
                  _INTL("January"),
                  _INTL("February"),
                  _INTL("March"),
                  _INTL("April"),
                  _INTL("May"),
                  _INTL("June"),
                  _INTL("July"),
                  _INTL("August"),
                  _INTL("September"),
                  _INTL("October"),
                  _INTL("November"),
                  _INTL("December")
                  ][wday-1]
                  $game_map.need_refresh = true if $game_map
                  end
                  return ret
                  end

                  def pbGetAbbrevMonthName(month)
                  return [_INTL(""),
                  _INTL("Jan."),
                  _INTL("Feb."),
                  _INTL("Mar."),
                  _INTL("Apr."),
                  _INTL("May"),
                  _INTL("Jun."),
                  _INTL("Jul."),
                  _INTL("Aug."),
                  _INTL("Sep."),
                  _INTL("Oct."),
                  _INTL("Nov."),
                  _INTL("Dec.")][month]
                  end



                  PokeBattle_Pokemon

                  Spoiler:
                  Quote:
                  # This class stores data on each Pokemon. Refer to $Trainer.party for an array
                  # of each Pokemon in the Trainer's current party.
                  class PokeBattle_Pokemon
                  attr_reader(:totalhp) # Current Total HP
                  attr_reader(:attack) # Current Attack stat
                  attr_reader(:defense) # Current Defense stat
                  attr_reader(:speed) # Current Speed stat
                  attr_reader(:spatk) # Current Special Attack stat
                  attr_reader(:spdef) # Current Special Defense stat
                  attr_accessor(:iv) # Array of 6 Individual Values for HP, Atk, Def,
                  # Speed, Sp Atk, and Sp Def
                  attr_accessor(:ev) # Effort Values
                  attr_accessor(:species) # Species (National Pokedex number)
                  attr_accessor(:personalID) # Personal ID
                  attr_accessor(:trainerID) # 32-bit Trainer ID (the secret ID is in the upper
                  # 16 bits)
                  attr_accessor(:hp) # Current HP
                  attr_accessor(:pokerus) # Pokérus strain and infection time
                  attr_accessor(:item) # Held item
                  attr_accessor(:itemRecycle) # Consumed held item (used in battle only)
                  attr_accessor(:itemInitial) # Resulting held item (used in battle only)
                  attr_accessor(:mail) # Mail
                  attr_accessor(:fused) # The Pokémon fused into this one
                  attr_accessor(:name) # Nickname
                  attr_accessor(:exp) # Current experience points
                  attr_accessor(:happiness) # Current happiness
                  attr_accessor(:status) # Status problem (PBStatuses)
                  attr_accessor(:statusCount) # Sleep count/Toxic flag
                  attr_accessor(:eggsteps) # Steps to hatch egg, 0 if Pokémon is not an egg
                  attr_accessor(:moves) # Moves (PBMove)
                  attr_accessor(:firstmoves) # The moves known when this Pokémon was obtained
                  attr_accessor(:ballused) # Ball used
                  attr_accessor(:markings) # Markings
                  attr_accessor(:obtainMode) # Manner obtained:
                  # 0 - met, 1 - as egg, 2 - traded,
                  # 4 - fateful encounter
                  attr_accessor(:obtainMap) # Map where obtained
                  attr_accessor(:obtainText) # Replaces the obtain map's name if not nil
                  attr_accessor(:obtainLevel) # Level obtained
                  attr_accessor(:hatchedMap) # Map where an egg was hatched
                  attr_accessor(:language) # Language
                  attr_accessor(:ot) # Original Trainer's name
                  attr_accessor(:otgender) # Original Trainer's gender:
                  # 0 - male, 1 - female, 2 - mixed, 3 - unknown
                  # For information only, not used to verify
                  # ownership of the Pokemon
                  attr_accessor(:abilityflag) # Forces the first/second/hidden (0/1/2) ability
                  attr_accessor(:genderflag) # Forces male (0) or female (1)
                  attr_accessor(:natureflag) # Forces a particular nature
                  attr_accessor(:shinyflag) # Forces the shininess (true/false)
                  attr_accessor(:ribbons) # Array of ribbons
                  attr_accessor :cool,:beauty,:cute,:smart,:tough,:sheen # Contest stats

                  ################################################################################
                  # Ownership, obtained information
                  ################################################################################
                  # Returns the gender of this Pokémon's original trainer (2=unknown).
                  def otgender
                  @otgender=2 if [email protected]
                  return @otgender
                  end

                  # Returns whether the specified Trainer is NOT this Pokemon's original trainer.
                  def isForeign?(trainer)
                  return @trainerID!=trainer.id || @ot!=trainer.name
                  end

                  # Returns the public portion of the original trainer's ID.
                  def publicID
                  return @trainerID&0xFFFF
                  end

                  # Returns this Pokémon's level when this Pokémon was obtained.
                  def obtainLevel
                  @obtainLevel=0 if [email protected]
                  return @obtainLevel
                  end

                  # Returns the time when this Pokémon was obtained.
                  def timeReceived
                  return @timeReceived ? Time.at(@timeReceived) : Time.gm(2000)
                  end

                  # Sets the time when this Pokémon was obtained.
                  def timeReceived=(value)
                  # Seconds since Unix epoch
                  if value.is_a?(Time)
                  @timeReceived=value.to_i
                  else
                  @timeReceived=value
                  end
                  end

                  # Returns the time when this Pokémon hatched.
                  def timeEggHatched
                  if obtainMode==1
                  return @timeEggHatched ? Time.at(@timeEggHatched) : Time.gm(2000)
                  else
                  return Time.gm(2000)
                  end
                  end

                  # Sets the time when this Pokémon hatched.
                  def timeEggHatched=(value)
                  # Seconds since Unix epoch
                  if value.is_a?(Time)
                  @timeEggHatched=value.to_i
                  else
                  @timeEggHatched=value
                  end
                  end

                  def birthsign
                  if obtainMode==1
                  return pbGetZodiacName(self.timeEggHatched.mon)
                  end
                  end

                  ################################################################################
                  # Form Change Time
                  ################################################################################

                  def form_change_time
                  if [email protected]_change_time
                  @form_change_time=Time.now
                  end
                  return @form_change_time
                  end

                  ################################################################################
                  # Party Index
                  # Returns the index of the pokemon in the trainers party, if applicable
                  ################################################################################

                  def partyIndex
                  ret=-1
                  return ret if !$Trainer || !($Trainer.party)
                  for i in 0...$Trainer.party.length
                  return i if $Trainer.party[i]==self
                  end
                  return ret
                  end

                  ################################################################################
                  # Level
                  ################################################################################
                  # Returns this Pokemon's level.
                  def level
                  return PBExperience.pbGetLevelFromExperience(@exp,self.growthrate)
                  end

                  # Sets this Pokemon's level by changing its Exp. Points.
                  def level=(value)
                  if value<1 || value>PBExperience::MAXLEVEL
                  raise ArgumentError.new(_INTL("The level number ({1}) is invalid.",value))
                  end
                  self.exp=PBExperience.pbGetStartExperience(value,self.growthrate)
                  end

                  # Returns whether this Pokemon is an egg.
                  def isEgg?
                  return @eggsteps>0
                  end

                  def egg?; return isEgg?; end # DEPRECATED

                  # Returns this Pokemon's growth rate.
                  def growthrate
                  dexdata=pbOpenDexData
                  pbDexDataOffset(dexdata,@species,20)
                  ret=dexdata.fgetb
                  dexdata.close
                  return ret
                  end

                  # Returns this Pokemon's base Experience value.
                  def baseExp
                  dexdata=pbOpenDexData
                  pbDexDataOffset(dexdata,@species,38)
                  ret=dexdata.fgetw
                  dexdata.close
                  return ret
                  end

                  ################################################################################
                  # Gender
                  ################################################################################
                  # Returns this Pokemon's gender. 0=male, 1=female, 2=genderless
                  def gender
                  return @genderflag if @genderflag!=nil
                  dexdata=pbOpenDexData
                  pbDexDataOffset(dexdata,@species,18)
                  genderbyte=dexdata.fgetb
                  dexdata.close
                  case genderbyte
                  when 255
                  return 2 # genderless
                  when 254
                  return 1 # always female
                  else
                  [email protected]&0xFF
                  return PokeBattle_Pokemon.isFemale(lowbyte,genderbyte) ? 1 : 0
                  end
                  end

                  # Helper function that determines whether the input values would make a female.
                  def self.isFemale(b,genderRate)
                  return true if genderRate==254 # AlwaysFemale
                  return false if genderRate==255 # Genderless
                  return b<=genderRate
                  end

                  # Returns whether this Pokémon is male.
                  def isMale?
                  return self.gender==0
                  end

                  # Returns whether this Pokémon is female.
                  def isFemale?
                  return self.gender==1
                  end

                  # Sets this Pokémon's gender to a particular gender (if possible).
                  def setGender(value)
                  dexdata=pbOpenDexData
                  pbDexDataOffset(dexdata,@species,18)
                  genderbyte=dexdata.fgetb
                  dexdata.close
                  if genderbyte!=255 && genderbyte!=0 && genderbyte!=254
                  @genderflag=value
                  end
                  end

                  def makeMale; setGender(0); end
                  def makeFemale; setGender(1); end

                  ################################################################################
                  # Ability
                  ################################################################################
                  # Returns the index of this Pokémon's ability.
                  def abilityIndex
                  [email protected]!=nil ? @abilityflag : (@personalID&1)
                  return abil
                  end

                  # Returns the ID of this Pokemon's ability.
                  def ability
                  abil=abilityIndex
                  dexdata=pbOpenDexData
                  pbDexDataOffset(dexdata,@species,29)
                  ret1=dexdata.fgetb
                  ret2=dexdata.fgetb
                  pbDexDataOffset(dexdata,@species,40)
                  h1=dexdata.fgetb
                  h2=dexdata.fgetb
                  h3=dexdata.fgetb
                  h4=dexdata.fgetb
                  dexdata.close
                  ret=ret1
                  if abil==2
                  return h1 if h1>0
                  abil=(@personalID&1)
                  elsif abil==3
                  return h2 if h2>0
                  abil=(@personalID&1)
                  elsif abil==4
                  return h3 if h3>0
                  abil=(@personalID&1)
                  elsif abil==5
                  return h4 if h4>0
                  abil=(@personalID&1)
                  end
                  if abil==1
                  ret=ret2
                  ret=ret1 if ret2==0
                  end
                  return ret
                  end

                  # Sets this Pokémon's ability to a particular ability (if possible).
                  def setAbility(value)
                  @abilityflag=value
                  end

                  # Returns the list of abilities this Pokémon can have.
                  def getAbilityList
                  abils=[]; ret=[[],[]]
                  dexdata=pbOpenDexData
                  pbDexDataOffset(dexdata,@species,29)
                  abils.push(dexdata.fgetb)
                  abils.push(dexdata.fgetb)
                  pbDexDataOffset(dexdata,@species,40)
                  abils.push(dexdata.fgetb)
                  abils.push(dexdata.fgetb)
                  abils.push(dexdata.fgetb)
                  abils.push(dexdata.fgetb)
                  dexdata.close
                  for i in 0...abils.length
                  next if !abils[i] || abils[i]<=0
                  ret[0].push(abils[i]); ret[1].push(i)
                  end
                  return ret
                  end

                  ################################################################################
                  # Nature
                  ################################################################################
                  # Returns the ID of this Pokémon's nature.
                  def nature
                  return @natureflag if @natureflag!=nil
                  return @personalID%25
                  end

                  # Sets this Pokémon's nature to a particular nature.
                  def setNature(value)
                  if value.is_a?(String) || value.is_a?(Symbol)
                  value=getID(PBNatures,value)
                  end
                  @natureflag=value
                  self.calcStats
                  end

                  ################################################################################
                  # Shininess
                  ################################################################################
                  # Returns whether this Pokemon is shiny (differently colored).
                  def isShiny?
                  return @shinyflag if @shinyflag!=nil
                  [email protected]^@trainerID
                  b=a&0xFFFF
                  c=(a>>16)&0xFFFF
                  d=b^c
                  return (d<SHINYPOKEMONCHANCE)
                  end

                  # Makes this Pokemon shiny.
                  def makeShiny
                  @shinyflag=true
                  end

                  # Makes this Pokemon not shiny.
                  def makeNotShiny
                  @shinyflag=false
                  end

                  ################################################################################
                  # Pokérus
                  ################################################################################
                  # Gives this Pokemon Pokérus (either the specified strain or a random one).
                  def givePokerus(strain=0)
                  return if self.pokerusStage==2 # Can't re-infect a cured Pokémon
                  if strain<=0 || strain>=16
                  strain=1+rand(15)
                  end
                  time=1+(strain%4)
                  @pokerus=time
                  @pokerus|=strain<<4
                  end

                  # Resets the infection time for this Pokemon's Pokérus (even if cured).
                  def resetPokerusTime
                  return if @pokerus==0
                  [email protected]%16
                  time=1+(strain%4)
                  @pokerus=time
                  @pokerus|=strain<<4
                  end

                  # Reduces the time remaining for this Pokemon's Pokérus (if infected).
                  def lowerPokerusCount
                  return if self.pokerusStage!=1
                  @pokerus-=1
                  end

                  # Returns the Pokérus infection stage for this Pokemon.
                  def pokerusStage
                  return 0 if [email protected] || @pokerus==0 # Not infected
                  return 2 if @pokerus>0 && (@pokerus%16)==0 # Cured
                  return 1 # Infected
                  end

                  ################################################################################
                  # Types
                  ################################################################################
                  # Returns whether this Pokémon has the specified type.
                  def hasType?(type)
                  if type.is_a?(String) || type.is_a?(Symbol)
                  return isConst?(self.type1,PBTypes,type) || isConst?(self.type2,PBTypes,type)
                  else
                  return self.type1==type || self.type2==type
                  end
                  end

                  # Returns this Pokémon's first type.
                  def type1
                  dexdata=pbOpenDexData
                  pbDexDataOffset(dexdata,@species,8)
                  ret=dexdata.fgetb
                  dexdata.close
                  return ret
                  end

                  # Returns this Pokémon's second type.
                  def type2
                  dexdata=pbOpenDexData
                  pbDexDataOffset(dexdata,@species,9)
                  ret=dexdata.fgetb
                  dexdata.close
                  return ret
                  end

                  ################################################################################
                  # Moves
                  ################################################################################
                  # Returns the number of moves known by the Pokémon.
                  def numMoves
                  ret=0
                  for i in 0...4
                  ret+=1 if @moves[i].id!=0
                  end
                  return ret
                  end

                  # Returns true if the Pokémon knows the given move.
                  def knowsMove?(move)
                  if move.is_a?(String) || move.is_a?(Symbol)
                  move=getID(PBMoves,move)
                  end
                  return false if !move || move<=0
                  for i in 0...4
                  return true if @moves[i].id==move
                  end
                  return false
                  end

                  # Returns the list of moves this Pokémon can learn by levelling up.
                  def getMoveList
                  movelist=[]
                  atkdata=pbRgssOpen("Data/attacksRS.dat","rb")
                  offset=atkdata.getOffset(@species-1)
                  length=atkdata.getLength(@species-1)>>1
                  atkdata.pos=offset
                  for k in 0..length-1
                  level=atkdata.fgetw
                  move=atkdata.fgetw
                  movelist.push([level,move])
                  end
                  atkdata.close
                  return movelist
                  end

                  # Sets this Pokémon's movelist to the default movelist it originally had.
                  def resetMoves
                  moves=self.getMoveList
                  movelist=[]
                  for i in moves
                  if i[0]<=self.level
                  movelist[movelist.length]=i[1]
                  end
                  end
                  movelist|=[] # Remove duplicates
                  listend=movelist.length-4
                  listend=0 if listend<0
                  j=0
                  for i in listend...listend+4
                  moveid=(i>=movelist.length) ? 0 : movelist[i]
                  @moves[j]=PBMove.new(moveid)
                  j+=1
                  end
                  end

                  # Silently learns the given move. Will erase the first known move if it has to.
                  def pbLearnMove(move)
                  if move.is_a?(String) || move.is_a?(Symbol)
                  move=getID(PBMoves,move)
                  end
                  return if move<=0
                  for i in 0...4
                  if @moves[i].id==move
                  j=i+1; while j<4
                  break if @moves[j].id==0
                  [email protected][j]
                  @moves[j][email protected][j-1]
                  @moves[j-1]=tmp
                  j+=1
                  end
                  return
                  end
                  end
                  for i in 0...4
                  if @moves[i].id==0
                  @moves[i]=PBMove.new(move)
                  return
                  end
                  end
                  @moves[0][email protected][1]
                  @moves[1][email protected][2]
                  @moves[2][email protected][3]
                  @moves[3]=PBMove.new(move)
                  end

                  # Deletes the given move from the Pokémon.
                  def pbDeleteMove(move)
                  if move.is_a?(String) || move.is_a?(Symbol)
                  move=getID(PBMoves,move)
                  end
                  return if !move || move<=0
                  newmoves=[]
                  for i in 0...4
                  newmoves.push(@moves[i]) if @moves[i].id!=move
                  end
                  newmoves.push(PBMove.new(0))
                  for i in 0...4
                  @moves[i]=newmoves[i]
                  end
                  end

                  # Deletes the move at the given index from the Pokémon.
                  def pbDeleteMoveAtIndex(index)
                  newmoves=[]
                  for i in 0...4
                  newmoves.push(@moves[i]) if i!=index
                  end
                  newmoves.push(PBMove.new(0))
                  for i in 0...4
                  @moves[i]=newmoves[i]
                  end
                  end

                  # Deletes all moves from the Pokémon.
                  def pbDeleteAllMoves
                  for i in 0...4
                  @moves[i]=PBMove.new(0)
                  end
                  end

                  # Copies currently known moves into a separate array, for Move Relearner.
                  def pbRecordFirstMoves
                  @firstmoves=[]
                  for i in 0...4
                  @firstmoves.push(@moves[i].id) if @moves[i].id>0
                  end
                  end

                  ################################################################################
                  # Contest attributes, ribbons
                  ################################################################################
                  def cool; @cool ? @cool : 0; end
                  def beauty; @beauty ? @beauty : 0; end
                  def cute; @cute ? @cute : 0; end
                  def smart; @smart ? @smart : 0; end
                  def tough; @tough ? @tough : 0; end
                  def sheen; @sheen ? @sheen : 0; end

                  # Returns the number of ribbons this Pokemon has.
                  def ribbonCount
                  @ribbons=[] if [email protected]
                  return @ribbons.length
                  end

                  # Returns whether this Pokémon has the specified ribbon.
                  def hasRibbon?(ribbon)
                  @ribbons=[] if [email protected]
                  ribbon=getID(PBRibbons,ribbon) if !ribbon.is_a?(Integer)
                  return false if ribbon==0
                  return @ribbons.include?(ribbon)
                  end

                  # Gives this Pokémon the specified ribbon.
                  def giveRibbon(ribbon)
                  @ribbons=[] if [email protected]
                  ribbon=getID(PBRibbons,ribbon) if !ribbon.is_a?(Integer)
                  return if ribbon==0
                  @ribbons.push(ribbon) if [email protected]?(ribbon)
                  end

                  # Replaces one ribbon with the next one along, if possible.
                  def upgradeRibbon(*arg)
                  @ribbons=[] if [email protected]
                  for i in 0...arg.length-1
                  for j in [email protected]
                  thisribbon=(arg[i].is_a?(Integer)) ? arg[i] : getID(PBRibbons,arg[i])
                  if @ribbons[j]==thisribbon
                  nextribbon=(arg[i+1].is_a?(Integer)) ? arg[i+1] : getID(PBRibbons,arg[i+1])
                  @ribbons[j]=nextribbon
                  return nextribbon
                  end
                  end
                  end
                  if !hasRibbon?(arg[arg.length-1])
                  firstribbon=(arg[0].is_a?(Integer)) ? arg[0] : getID(PBRibbons,arg[0])
                  giveRibbon(firstribbon)
                  return firstribbon
                  end
                  return 0
                  end

                  # Removes the specified ribbon from this Pokémon.
                  def takeRibbon(ribbon)
                  return if [email protected]
                  ribbon=getID(PBRibbons,ribbon) if !ribbon.is_a?(Integer)
                  return if ribbon==0
                  for i in [email protected]
                  if @ribbons[i]==ribbon
                  @ribbons[i]=nil; break
                  end
                  end
                  @ribbons.compact!
                  end

                  # Removes all ribbons from this Pokémon.
                  def clearAllRibbons
                  @ribbons=[]
                  end

                  ################################################################################
                  # Other
                  ################################################################################
                  # Returns whether this Pokémon has a hold item.
                  def hasItem?(value=0)
                  if value==0
                  return self.item>0
                  else
                  if value.is_a?(String) || value.is_a?(Symbol)
                  value=getID(PBItems,value)
                  end
                  return self.item==value
                  end
                  return false
                  end

                  # Sets this Pokémon's item. Accepts symbols.
                  def setItem(value)
                  if value.is_a?(String) || value.is_a?(Symbol)
                  value=getID(PBItems,value)
                  end
                  self.item=value
                  end

                  # Returns the items this species can be found holding in the wild.
                  def wildHoldItems
                  dexdata=pbOpenDexData
                  pbDexDataOffset(dexdata,@species,48)
                  itemcommon=dexdata.fgetw
                  itemuncommon=dexdata.fgetw
                  itemrare=dexdata.fgetw
                  dexdata.close
                  itemcommon=0 if !itemcommon
                  itemuncommon=0 if !itemuncommon
                  itemrare=0 if !itemrare
                  return [itemcommon,itemuncommon,itemrare]
                  end

                  # Returns this Pokémon's mail.
                  def mail
                  return nil if [email protected]
                  if @mail.item==0 || !self.hasItem? || @mail.item!=self.item
                  @mail=nil
                  return nil
                  end
                  return @mail
                  end

                  # Returns this Pokémon's language.
                  def language; @language ? @language : 0; end

                  # Returns the markings this Pokémon has.
                  def markings
                  @markings=0 if [email protected]
                  return @markings
                  end

                  # Returns a string stating the Unown form of this Pokémon.
                  def unownShape
                  return "ABCDEFGHIJKLMNOPQRSTUVWXYZ?!"[@form,1]
                  end

                  # Returns the weight of this Pokémon.
                  def weight
                  dexdata=pbOpenDexData
                  pbDexDataOffset(dexdata,@species,35)
                  weight=dexdata.fgetw
                  dexdata.close
                  return weight
                  end

                  # Returns the EV yield of this Pokémon.
                  def evYield
                  ret=[]
                  dexdata=pbOpenDexData
                  pbDexDataOffset(dexdata,@species,23)
                  for i in 0...6
                  v=dexdata.fgetb
                  v=0 if !v
                  ret.push(v)
                  end
                  dexdata.close
                  return ret
                  end

                  # Sets this Pokémon's HP.
                  def hp=(value)
                  value=0 if value<0
                  @hp=value
                  if @hp==0
                  @status=0
                  @statusCount=0
                  end
                  end

                  # Heals all HP of this Pokémon.
                  def healHP
                  return if egg?
                  @[email protected]
                  end

                  # Heals the status problem of this Pokémon.
                  def healStatus
                  return if egg?
                  @status=0
                  @statusCount=0
                  end

                  # Heals all PP of this Pokémon.
                  def healPP(index=-1)
                  return if egg?
                  if index>=0
                  @moves[index][email protected][index].totalpp
                  else
                  for i in 0...4
                  @moves[i][email protected][i].totalpp
                  end
                  end
                  end

                  # Heals all HP, PP, and status problems of this Pokémon.
                  def heal
                  return if egg?
                  healHP
                  healStatus
                  healPP
                  end

                  # Changes the happiness of this Pokémon depending on what happened to change it.
                  def changeHappiness(method)
                  gain=0; luxury=false
                  case method
                  when "walking"
                  gain=1
                  gain+=1 if @happiness<200
                  gain+=1 if @obtainMap==$game_map.map_id
                  luxury=true
                  when "level up"
                  gain=2
                  gain=3 if @happiness<200
                  gain=5 if @happiness<100
                  luxury=true
                  when "groom"
                  gain=4
                  gain=10 if @happiness<200
                  luxury=true
                  when "faint"
                  gain=-1
                  when "vitamin"
                  gain=2
                  gain=3 if @happiness<200
                  gain=5 if @happiness<100
                  when "EV berry"
                  gain=2
                  gain=5 if @happiness<200
                  gain=10 if @happiness<100
                  when "powder"
                  gain=-10
                  gain=-5 if @happiness<200
                  when "Energy Root"
                  gain=-15
                  gain=-10 if @happiness<200
                  when "Revival Herb"
                  gain=-20
                  gain=-15 if @happiness<200
                  else
                  Kernel.pbMessage(_INTL("Unknown happiness-changing method."))
                  end
                  gain+=1 if luxury && self.ballused==pbGetBallType(:LUXURYBALL)
                  if isConst?(self.item,PBItems,:SOOTHEBELL) && gain>0
                  gain=(gain*3.0/2).round
                  end
                  @happiness+=gain
                  @happiness=[[255,@happiness].min,0].max
                  end

                  ################################################################################
                  # Stat calculations, Pokémon creation
                  ################################################################################
                  # Returns this Pokémon's base stats. An array of six values.
                  def baseStats
                  dexdata=pbOpenDexData
                  pbDexDataOffset(dexdata,@species,10)
                  ret=[
                  dexdata.fgetb, # HP
                  dexdata.fgetb, # Attack
                  dexdata.fgetb, # Defense
                  dexdata.fgetb, # Speed
                  dexdata.fgetb, # Special Attack
                  dexdata.fgetb # Special Defense
                  ]
                  dexdata.close
                  return ret
                  end

                  # Returns the maximum HP of this Pokémon.
                  def calcHP(base,level,iv,ev)
                  return 1 if base==1
                  return ((base*2+iv+(ev>>2))*level/100).floor+level+10
                  end

                  # Returns the specified stat of this Pokémon (not used for total HP).
                  def calcStat(base,level,iv,ev,pv)
                  return ((((base*2+iv+(ev>>2))*level/100).floor+5)*pv/100).floor
                  end

                  # Recalculates this Pokémon's stats.
                  def calcStats
                  nature=self.nature
                  stats=[]
                  pvalues=[100,100,100,100,100]
                  nd5=(nature/5).floor
                  nm5=(nature%5).floor
                  if nd5!=nm5
                  pvalues[nd5]=110
                  pvalues[nm5]=90
                  end
                  level=self.level
                  bs=self.baseStats
                  for i in 0..5
                  base=bs[i]
                  if i==PBStats::HP
                  stats[i]=calcHP(base,level,@iv[i],@ev[i])
                  else
                  stats[i]=calcStat(base,level,@iv[i],@ev[i],pvalues[i-1])
                  end
                  end
                  [email protected]@hp
                  @totalhp=stats[0]
                  if @hp>0
                  @[email protected]
                  @hp=1 if @hp<=0
                  @[email protected] if @hp>@totalhp
                  end
                  @attack=stats[1]
                  @defense=stats[2]
                  @speed=stats[3]
                  @spatk=stats[4]
                  @spdef=stats[5]
                  end

                  # Creates a new Pokémon object.
                  # species - Pokémon species.
                  # level - Pokémon level.
                  # player - PokeBattle_Trainer object for the original trainer.
                  # withMoves - If false, this Pokémon has no moves.
                  def initialize(species,level,player=nil,withMoves=true)
                  if species.is_a?(String) || species.is_a?(Symbol)
                  species=getID(PBSpecies,species)
                  end
                  cname=getConstantName(PBSpecies,species) rescue nil
                  if !species || species<1 || species>PBSpecies.maxValue || !cname
                  raise ArgumentError.new(_INTL("The species number (no. {1} of {2}) is invalid.",
                  species,PBSpecies.maxValue))
                  return nil
                  end
                  time=pbGetTimeNow
                  @timeReceived=time.getgm.to_i # Use GMT
                  @form_change_time=pbGetTimeNow
                  @species=species
                  # Individual Values
                  @personalID=rand(256)
                  @personalID|=rand(256)<<8
                  @personalID|=rand(256)<<16
                  @personalID|=rand(256)<<24
                  @hp=1
                  @totalhp=1
                  @ev=[0,0,0,0,0,0]
                  @iv=[]
                  @iv[0]=rand(32)
                  @iv[1]=rand(32)
                  @iv[2]=rand(32)
                  @iv[3]=rand(32)
                  @iv[4]=rand(32)
                  @iv[5]=rand(32)
                  if player
                  @trainerID=player.id
                  @ot=player.name
                  @otgender=player.gender
                  @language=player.language
                  else
                  @trainerID=0
                  @ot=""
                  @otgender=2
                  end
                  dexdata=pbOpenDexData
                  pbDexDataOffset(dexdata,@species,19)
                  @happiness=dexdata.fgetb
                  dexdata.close
                  @name=PBSpecies.getName(@species)
                  @eggsteps=0
                  @status=0
                  @statusCount=0
                  @item=0
                  @mail=nil
                  @fused=nil
                  @ribbons=[]
                  @moves=[]
                  self.ballused=0
                  self.level=level
                  calcStats
                  @[email protected]
                  if $game_map
                  @obtainMap=$game_map.map_id
                  @obtainText=nil
                  @obtainLevel=level
                  else
                  @obtainMap=0
                  @obtainText=nil
                  @obtainLevel=level
                  end
                  @obtainMode=0 # Met
                  @obtainMode=4 if $game_switches && $game_switches[FATEFUL_ENCOUNTER_SWITCH]
                  @hatchedMap=0
                  if withMoves
                  atkdata=pbRgssOpen("Data/attacksRS.dat","rb")
                  offset=atkdata.getOffset(species-1)
                  length=atkdata.getLength(species-1)>>1
                  atkdata.pos=offset
                  # Generating move list
                  movelist=[]
                  for i in 0..length-1
                  alevel=atkdata.fgetw
                  move=atkdata.fgetw
                  if alevel<=level
                  movelist[movelist.length]=move
                  end
                  end
                  atkdata.close
                  movelist|=[] # Remove duplicates
                  # Use the last 4 items in the move list
                  listend=movelist.length-4
                  listend=0 if listend<0
                  j=0
                  for i in listend...listend+4
                  moveid=(i>=movelist.length) ? 0 : movelist[i]
                  @moves[j]=PBMove.new(moveid)
                  j+=1
                  end
                  end
                  end
                  end


                  PScreen_Party
                  Spoiler:
                  Quote:
                  # Data structure representing mail that the Pokémon can hold
                  class PokemonMail
                  attr_accessor :item,:message,:sender,:poke1,:poke2,:poke3

                  def initialize(item,message,sender,poke1=nil,poke2=nil,poke3=nil)
                  @item=item # Item represented by this mail
                  @message=message # Message text
                  @sender=sender # Name of the message's sender
                  @poke1=poke1 # [species,gender,shininess,form,shadowness,is egg]
                  @poke2=poke2
                  @poke3=poke3
                  end
                  end



                  def pbMoveToMailbox(pokemon)
                  $PokemonGlobal.mailbox=[] if !$PokemonGlobal.mailbox
                  return false if $PokemonGlobal.mailbox.length>=10
                  return false if !pokemon.mail
                  $PokemonGlobal.mailbox.push(pokemon.mail)
                  pokemon.mail=nil
                  return true
                  end

                  def pbStoreMail(pkmn,item,message,poke1=nil,poke2=nil,poke3=nil)
                  raise _INTL("Pokémon already has mail") if pkmn.mail
                  pkmn.mail=PokemonMail.new(item,message,$Trainer.name,poke1,poke2,poke3)
                  end

                  def pbDisplayMail(mail,bearer=nil)
                  sprites={}
                  viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
                  viewport.z=99999
                  addBackgroundPlane(sprites,"background","mailbg",viewport)
                  sprites["card"]=IconSprite.new(0,0,viewport)
                  sprites["card"].setBitmap(pbMailBackFile(mail.item))
                  sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,viewport)
                  overlay=sprites["overlay"].bitmap
                  pbSetSystemFont(overlay)
                  if $ItemData[mail.item][ITEMTYPE]==2
                  if mail.poke1
                  sprites["bearer"]=IconSprite.new(64,288,viewport)
                  bitmapFileName=pbCheckPokemonIconFiles(mail.poke1,mail.poke1[5])
                  sprites["bearer"].setBitmap(bitmapFileName)
                  sprites["bearer"].src_rect.set(0,0,64,64)
                  end
                  if mail.poke2
                  sprites["bearer2"]=IconSprite.new(144,288,viewport)
                  bitmapFileName=pbCheckPokemonIconFiles(mail.poke2,mail.poke2[5])
                  sprites["bearer2"].setBitmap(bitmapFileName)
                  sprites["bearer2"].src_rect.set(0,0,64,64)
                  end
                  if mail.poke3
                  sprites["bearer3"]=IconSprite.new(224,288,viewport)
                  bitmapFileName=pbCheckPokemonIconFiles(mail.poke3,mail.poke3[5])
                  sprites["bearer3"].setBitmap(bitmapFileName)
                  sprites["bearer3"].src_rect.set(0,0,64,64)
                  end
                  end
                  baseForDarkBG=Color.new(248,248,248)
                  shadowForDarkBG=Color.new(72,80,88)
                  baseForLightBG=Color.new(80,80,88)
                  shadowForLightBG=Color.new(168,168,176)
                  if mail.message && mail.message!=""
                  isDark=isDarkBackground(sprites["card"].bitmap,Rect.new(48,48,Graphics.width-96,32*7))
                  drawTextEx(overlay,48,48,Graphics.width-96,7,mail.message,
                  isDark ? baseForDarkBG : baseForLightBG,
                  isDark ? shadowForDarkBG : shadowForLightBG)
                  end
                  if mail.sender && mail.sender!=""
                  isDark=isDarkBackground(sprites["card"].bitmap,Rect.new(336,322,144,32*1))
                  drawTextEx(overlay,336,322,144,1,_INTL("{1}",mail.sender),
                  isDark ? baseForDarkBG : baseForLightBG,
                  isDark ? shadowForDarkBG : shadowForLightBG)
                  end
                  pbFadeInAndShow(sprites)
                  loop do
                  Graphics.update
                  Input.update
                  pbUpdateSpriteHash(sprites)
                  if Input.trigger?(Input::B) || Input.trigger?(Input::C)
                  break
                  end
                  end
                  pbFadeOutAndHide(sprites)
                  pbDisposeSpriteHash(sprites)
                  viewport.dispose
                  end


                  ###########################


                  class PokeSelectionPlaceholderSprite < SpriteWrapper
                  attr_accessor :text

                  def initialize(pokemon,index,viewport=nil)
                  super(viewport)
                  xvalues=[0,256,0,256,0,256]
                  yvalues=[0,16,96,112,192,208]
                  @pbitmap=AnimatedBitmap.new("Graphics/Pictures/partyPanelBlank")
                  [email protected]
                  self.x=xvalues[index]
                  self.y=yvalues[index]
                  @text=nil
                  end

                  def update
                  super
                  @pbitmap.update
                  [email protected]
                  end

                  def selected
                  return false
                  end

                  def selected=(value)
                  end

                  def preselected
                  return false
                  end

                  def preselected=(value)
                  end

                  def switching
                  return false
                  end

                  def switching=(value)
                  end

                  def refresh
                  end

                  def dispose
                  @pbitmap.dispose
                  super
                  end
                  end



                  class PokeSelectionConfirmCancelSprite < SpriteWrapper
                  attr_reader :selected

                  def initialize(text,x,y,narrowbox=false,viewport=nil)
                  super(viewport)
                  @refreshBitmap=true
                  @bgsprite=ChangelingSprite.new(0,0,viewport)
                  if narrowbox
                  @bgsprite.addBitmap("deselbitmap","Graphics/Pictures/partyCancelNarrow")
                  @bgsprite.addBitmap("selbitmap","Graphics/Pictures/partyCancelSelNarrow")
                  else
                  @bgsprite.addBitmap("deselbitmap","Graphics/Pictures/partyCancel")
                  @bgsprite.addBitmap("selbitmap","Graphics/Pictures/partyCancelSel")
                  end
                  @bgsprite.changeBitmap("deselbitmap")
                  @overlaysprite=BitmapSprite.new(@bgsprite.bitmap.width,@bgsprite.bitmap.height,viewport)
                  @yoffset=8
                  ynarrow=narrowbox ? -6 : 0
                  pbSetSystemFont(@overlaysprite.bitmap)
                  textpos=[[text,56,8+ynarrow,2,Color.new(248,248,248),Color.new(40,40,40)]]
                  pbDrawTextPositions(@overlaysprite.bitmap,textpos)
                  @overlaysprite.z=self.z+1 # For compatibility with RGSS2
                  self.x=x
                  self.y=y
                  end

                  def dispose
                  @overlaysprite.bitmap.dispose
                  @overlaysprite.dispose
                  @bgsprite.dispose
                  super
                  end

                  def viewport=(value)
                  super
                  refresh
                  end

                  def color=(value)
                  super
                  refresh
                  end

                  def x=(value)
                  super
                  refresh
                  end

                  def y=(value)
                  super
                  refresh
                  end

                  def selected=(value)
                  @selected=value
                  refresh
                  end

                  def refresh
                  @bgsprite.changeBitmap((@selected) ? "selbitmap" : "deselbitmap")
                  if @bgsprite && [email protected]?
                  @bgsprite.x=self.x
                  @bgsprite.y=self.y
                  @overlaysprite.x=self.x
                  @overlaysprite.y=self.y
                  @bgsprite.color=self.color
                  @overlaysprite.color=self.color
                  end
                  end
                  end



                  class PokeSelectionCancelSprite < PokeSelectionConfirmCancelSprite
                  def initialize(viewport=nil)
                  super(_INTL("CANCEL"),398,328,false,viewport)
                  end
                  end



                  class PokeSelectionConfirmSprite < PokeSelectionConfirmCancelSprite
                  def initialize(viewport=nil)
                  super(_INTL("CONFIRM"),398,308,true,viewport)
                  end
                  end



                  class PokeSelectionCancelSprite2 < PokeSelectionConfirmCancelSprite
                  def initialize(viewport=nil)
                  super(_INTL("CANCEL"),398,346,true,viewport)
                  end
                  end



                  class ChangelingSprite < SpriteWrapper
                  def initialize(x=0,y=0,viewport=nil)
                  super(viewport)
                  self.x=x
                  self.y=y
                  @bitmaps={}
                  @currentBitmap=nil
                  end

                  def addBitmap(key,path)
                  if @bitmaps[key]
                  @bitmaps[key].dispose
                  end
                  @bitmaps[key]=AnimatedBitmap.new(path)
                  end

                  def changeBitmap(key)
                  @[email protected][key]
                  [email protected] ? @currentBitmap.bitmap : nil
                  end

                  def dispose
                  return if disposed?
                  for bm in @bitmaps.values; bm.dispose; end
                  @bitmaps.clear
                  super
                  end

                  def update
                  return if disposed?
                  for bm in @bitmaps.values; bm.update; end
                  [email protected] ? @currentBitmap.bitmap : nil
                  end
                  end



                  class PokeSelectionSprite < SpriteWrapper
                  attr_reader :selected
                  attr_reader :preselected
                  attr_reader :switching
                  attr_reader :pokemon
                  attr_reader :active
                  attr_accessor :text

                  def initialize(pokemon,index,viewport=nil)
                  super(viewport)
                  @pokemon=pokemon
                  active=(index==0)
                  @active=active
                  if active # Rounded panel
                  @deselbitmap=AnimatedBitmap.new("Graphics/Pictures/partyPanelRound")
                  @selbitmap=AnimatedBitmap.new("Graphics/Pictures/partyPanelRoundSel")
                  @deselfntbitmap=AnimatedBitmap.new("Graphics/Pictures/partyPanelRoundFnt")
                  @selfntbitmap=AnimatedBitmap.new("Graphics/Pictures/partyPanelRoundSelFnt")
                  @deselswapbitmap=AnimatedBitmap.new("Graphics/Pictures/partyPanelRoundSwap")
                  @selswapbitmap=AnimatedBitmap.new("Graphics/Pictures/partyPanelRoundSelSwap")
                  else # Rectangular panel
                  @deselbitmap=AnimatedBitmap.new("Graphics/Pictures/partyPanelRect")
                  @selbitmap=AnimatedBitmap.new("Graphics/Pictures/partyPanelRectSel")
                  @deselfntbitmap=AnimatedBitmap.new("Graphics/Pictures/partyPanelRectFnt")
                  @selfntbitmap=AnimatedBitmap.new("Graphics/Pictures/partyPanelRectSelFnt")
                  @deselswapbitmap=AnimatedBitmap.new("Graphics/Pictures/partyPanelRectSwap")
                  @selswapbitmap=AnimatedBitmap.new("Graphics/Pictures/partyPanelRectSelSwap")
                  end
                  @spriteXOffset=28
                  @spriteYOffset=0
                  @pokeballXOffset=10
                  @pokeballYOffset=0
                  @pokenameX=96
                  @pokenameY=16
                  @levelX=20
                  @levelY=62
                  @statusX=80
                  @statusY=68
                  @genderX=224
                  @genderY=16
                  @hpX=224
                  @hpY=60
                  @hpbarX=96
                  @hpbarY=50
                  @gaugeX=128
                  @gaugeY=52
                  @itemXOffset=62
                  @itemYOffset=48
                  @annotX=96
                  @annotY=58
                  xvalues=[0,256,0,256,0,256]
                  yvalues=[0,16,96,112,192,208]
                  @text=nil
                  @statuses=AnimatedBitmap.new(_INTL("Graphics/Pictures/statuses"))
                  @hpbar=AnimatedBitmap.new("Graphics/Pictures/partyHP")
                  @hpbarfnt=AnimatedBitmap.new("Graphics/Pictures/partyHPfnt")
                  @hpbarswap=AnimatedBitmap.new("Graphics/Pictures/partyHPswap")
                  @pokeballsprite=ChangelingSprite.new(0,0,viewport)
                  @pokeballsprite.addBitmap("pokeballdesel","Graphics/Pictures/partyBall")
                  @pokeballsprite.addBitmap("pokeballsel","Graphics/Pictures/partyBallSel")
                  @pkmnsprite=PokemonIconSprite.new(pokemon,viewport)
                  @pkmnsprite.active=active
                  @itemsprite=ChangelingSprite.new(0,0,viewport)
                  @itemsprite.addBitmap("itembitmap","Graphics/Pictures/item")
                  @itemsprite.addBitmap("mailbitmap","Graphics/Pictures/mail")
                  @spriteX=xvalues[index]
                  @spriteY=yvalues[index]
                  @refreshBitmap=true
                  @refreshing=false
                  @preselected=false
                  @switching=false
                  @pkmnsprite.z=self.z+2 # For compatibility with RGSS2
                  @itemsprite.z=self.z+3 # For compatibility with RGSS2
                  @pokeballsprite.z=self.z+1 # For compatibility with RGSS2
                  self.selected=false
                  [email protected]
                  [email protected]
                  refresh
                  end

                  def dispose
                  @selbitmap.dispose
                  @statuses.dispose
                  @hpbar.dispose
                  @deselbitmap.dispose
                  @itemsprite.dispose
                  @pkmnsprite.dispose
                  @pokeballsprite.dispose
                  self.bitmap.dispose
                  super
                  end

                  def selected=(value)
                  @selected=value
                  @refreshBitmap=true
                  refresh
                  end

                  def text=(value)
                  @text=value
                  @refreshBitmap=true
                  refresh
                  end

                  def pokemon=(value)
                  @pokemon=value
                  if @pkmnsprite && [email protected]?
                  @pkmnsprite.pokemon=value
                  end
                  @refreshBitmap=true
                  refresh
                  end

                  def preselected=(value)
                  if [email protected]
                  @preselected=value
                  refresh
                  end
                  end

                  def switching=(value)
                  if [email protected]
                  @switching=value
                  refresh
                  end
                  end

                  def color=(value)
                  super
                  refresh
                  end

                  def x=(value)
                  super
                  refresh
                  end

                  def y=(value)
                  super
                  refresh
                  end

                  def hp
                  return @pokemon.hp
                  end

                  def refresh
                  return if @refreshing
                  return if disposed?
                  @refreshing=true
                  if !self.bitmap || self.bitmap.disposed?
                  self.bitmap=BitmapWrapper.new(@selbitmap.width,@selbitmap.height)
                  end
                  if @pkmnsprite && [email protected]?
                  @[email protected]
                  @[email protected]
                  @pkmnsprite.color=pbSrcOver(@pkmnsprite.color,self.color)
                  @pkmnsprite.selected=self.selected
                  end
                  if @pokeballsprite && [email protected]?
                  @[email protected]
                  @[email protected]
                  @pokeballsprite.color=self.color
                  @pokeballsprite.changeBitmap(self.selected ? "pokeballsel" : "pokeballdesel")
                  end
                  if @itemsprite && [email protected]?
                  @itemsprite.visible=(@pokemon.item>0)
                  if @itemsprite.visible
                  @itemsprite.changeBitmap(@pokemon.mail ? "mailbitmap" : "itembitmap")
                  @[email protected]
                  @[email protected]
                  @itemsprite.color=self.color
                  end
                  end
                  if @refreshBitmap
                  @refreshBitmap=false
                  self.bitmap.clear if self.bitmap
                  if self.selected
                  if self.preselected
                  self.bitmap.blt(0,0,@selswapbitmap.bitmap,Rect.new(0,0,@selswapbitmap.width,@selswapbitmap.height))
                  self.bitmap.blt(0,0,@deselswapbitmap.bitmap,Rect.new(0,0,@deselswapbitmap.width,@deselswapbitmap.height))
                  elsif @switching
                  self.bitmap.blt(0,0,@selswapbitmap.bitmap,Rect.new(0,0,@selswapbitmap.width,@selswapbitmap.height))
                  elsif @pokemon.hp<=0 && [email protected]?
                  self.bitmap.blt(0,0,@selfntbitmap.bitmap,Rect.new(0,0,@selfntbitmap.width,@selfntbitmap.height))
                  else
                  self.bitmap.blt(0,0,@selbitmap.bitmap,Rect.new(0,0,@selbitmap.width,@selbitmap.height))
                  end
                  else
                  if self.preselected
                  self.bitmap.blt(0,0,@deselswapbitmap.bitmap,Rect.new(0,0,@deselswapbitmap.width,@deselswapbitmap.height))
                  elsif @pokemon.hp<=0 && [email protected]?
                  self.bitmap.blt(0,0,@deselfntbitmap.bitmap,Rect.new(0,0,@deselfntbitmap.width,@deselfntbitmap.height))
                  else
                  self.bitmap.blt(0,0,@deselbitmap.bitmap,Rect.new(0,0,@deselbitmap.width,@deselbitmap.height))
                  end
                  end
                  base=Color.new(248,248,248)
                  shadow=Color.new(40,40,40)
                  pbSetSystemFont(self.bitmap)
                  [email protected]
                  textpos=[[pokename,@pokenameX,@pokenameY,0,base,shadow]]
                  if [email protected]?
                  if [email protected] || @text.length==0
                  [email protected]
                  textpos.push([_ISPRINTF("{1: 3d}/{2: 3d}",@pokemon.hp,tothp),
                  @hpX,@hpY,1,base,shadow])
                  barbg=(@pokemon.hp<=0) ? @hpbarfnt : @hpbar
                  barbg=(self.preselected || (self.selected && @switching)) ? @hpbarswap : barbg
                  self.bitmap.blt(@hpbarX,@hpbarY,barbg.bitmap,Rect.new(0,0,@hpbar.width,@hpbar.height))
                  [email protected]==0 ? 0 : (self.hp*96/@pokemon.totalhp)
                  hpgauge=1 if hpgauge==0 && self.hp>0
                  hpzone=0
                  hpzone=1 if self.hp<=(@pokemon.totalhp/2).floor
                  hpzone=2 if self.hp<=(@pokemon.totalhp/4).floor
                  hpcolors=[
                  Color.new(24,192,32),Color.new(96,248,96), # Green
                  Color.new(232,168,0),Color.new(248,216,0), # Orange
                  Color.new(248,72,56),Color.new(248,152,152) # Red
                  ]
                  # fill with HP color
                  self.bitmap.fill_rect(@gaugeX,@gaugeY,hpgauge,2,hpcolors[hpzone*2])
                  self.bitmap.fill_rect(@gaugeX,@gaugeY+2,hpgauge,4,hpcolors[hpzone*2+1])
                  self.bitmap.fill_rect(@gaugeX,@gaugeY+6,hpgauge,2,hpcolors[hpzone*2])
                  if @pokemon.hp==0 || @pokemon.status>0
                  status=(@pokemon.hp==0) ? 5 : @pokemon.status-1
                  statusrect=Rect.new(0,16*status,44,16)
                  self.bitmap.blt(@statusX,@statusY,@statuses.bitmap,statusrect)
                  end
                  end
                  if @pokemon.isMale?
                  textpos.push([_INTL("♂"),@genderX,@genderY,0,Color.new(0,112,248),Color.new(120,184,232)])
                  elsif @pokemon.isFemale?
                  textpos.push([_INTL("♀"),@genderX,@genderY,0,Color.new(232,32,16),Color.new(248,168,184)])
                  end
                  end
                  pbDrawTextPositions(self.bitmap,textpos)
                  if [email protected]?
                  pbSetSmallFont(self.bitmap)
                  leveltext=[([_INTL("Lv.{1}",@pokemon.level),@levelX,@levelY,0,base,shadow])]
                  pbDrawTextPositions(self.bitmap,leveltext)
                  end
                  if @text && @text.length>0
                  pbSetSystemFont(self.bitmap)
                  annotation=[[@text,@annotX,@annotY,0,base,shadow]]
                  pbDrawTextPositions(self.bitmap,annotation)
                  end
                  end
                  @refreshing=false
                  end

                  def update
                  super
                  @pokeballsprite.update if @pokeballsprite && [email protected]?
                  @itemsprite.update if @itemsprite && [email protected]?
                  if @pkmnsprite && [email protected]?
                  @pkmnsprite.update
                  end
                  end

                  end


                  ##############################


                  class PokemonScreen_Scene
                  def pbShowCommands(helptext,commands,index=0)
                  ret=-1
                  [email protected]["helpwindow"]
                  helpwindow.visible=true
                  using(cmdwindow=Window_CommandPokemon.new(commands)) {
                  [email protected]+1
                  cmdwindow.index=index
                  pbBottomRight(cmdwindow)
                  helpwindow.text=""
                  helpwindow.resizeHeightToFit(helptext,Graphics.width-cmdwindow.width)
                  helpwindow.text=helptext
                  pbBottomLeft(helpwindow)
                  loop do
                  Graphics.update
                  Input.update
                  cmdwindow.update
                  self.update
                  if Input.trigger?(Input::B)
                  pbPlayCancelSE()
                  ret=-1
                  break
                  end
                  if Input.trigger?(Input::C)
                  pbPlayDecisionSE()
                  ret=cmdwindow.index
                  break
                  end
                  end
                  }
                  return ret
                  end

                  def update
                  pbUpdateSpriteHash(@sprites)
                  end

                  def pbSetHelpText(helptext)
                  [email protected]["helpwindow"]
                  pbBottomLeftLines(helpwindow,1)
                  helpwindow.text=helptext
                  helpwindow.width=398
                  helpwindow.visible=true
                  end

                  def pbStartScene(party,starthelptext,annotations=nil,multiselect=false)
                  @sprites={}
                  @party=party
                  @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
                  @viewport.z=99999
                  @multiselect=multiselect
                  addBackgroundPlane(@sprites,"partybg","partybg",@viewport)
                  @sprites["messagebox"]=Window_AdvancedTextPokemon.new("")
                  @sprites["helpwindow"]=Window_UnformattedTextPokemon.new(starthelptext)
                  @sprites["messagebox"][email protected]
                  @sprites["messagebox"].visible=false
                  @sprites["messagebox"].letterbyletter=true
                  @sprites["helpwindow"][email protected]
                  @sprites["helpwindow"].visible=true
                  pbBottomLeftLines(@sprites["messagebox"],2)
                  pbBottomLeftLines(@sprites["helpwindow"],1)
                  pbSetHelpText(starthelptext)
                  # Add party Pokémon sprites
                  for i in 0...6
                  if @party[i]
                  @sprites["pokemon#{i}"]=PokeSelectionSprite.new(
                  @party[i],i,@viewport)
                  else
                  @sprites["pokemon#{i}"]=PokeSelectionPlaceholderSprite.new(
                  @party[i],i,@viewport)
                  end
                  if annotations
                  @sprites["pokemon#{i}"].text=annotations[i]
                  end
                  end
                  if @multiselect
                  @sprites["pokemon6"]=PokeSelectionConfirmSprite.new(@viewport)
                  @sprites["pokemon7"]=PokeSelectionCancelSprite2.new(@viewport)
                  else
                  @sprites["pokemon6"]=PokeSelectionCancelSprite.new(@viewport)
                  end
                  # Select first Pokémon
                  @activecmd=0
                  @sprites["pokemon0"].selected=true
                  pbFadeInAndShow(@sprites) { update }
                  end

                  def pbEndScene
                  pbFadeOutAndHide(@sprites) { update }
                  pbDisposeSpriteHash(@sprites)
                  @viewport.dispose
                  end

                  def pbChangeSelection(key,currentsel)
                  numsprites=(@multiselect) ? 8 : 7
                  case key
                  when Input::LEFT
                  begin
                  currentsel-=1
                  end while currentsel>0 && currentsel<@party.length && [email protected][currentsel]
                  if currentsel>[email protected] && currentsel<6
                  [email protected]
                  end
                  currentsel=numsprites-1 if currentsel<0
                  when Input::RIGHT
                  begin
                  currentsel+=1
                  end while currentsel<@party.length && [email protected][currentsel]
                  if [email protected]
                  currentsel=6
                  elsif currentsel==numsprites
                  currentsel=0
                  end
                  when Input::UP
                  if currentsel>=6
                  begin
                  currentsel-=1
                  end while currentsel>0 && [email protected][currentsel]
                  else
                  begin
                  currentsel-=2
                  end while currentsel>0 && [email protected][currentsel]
                  end
                  if currentsel>[email protected] && currentsel<6
                  [email protected]
                  end
                  currentsel=numsprites-1 if currentsel<0
                  when Input::DOWN
                  if currentsel>=5
                  currentsel+=1
                  else
                  currentsel+=2
                  currentsel=6 if currentsel<6 && [email protected][currentsel]
                  end
                  if currentsel>[email protected] && currentsel<6
                  currentsel=6
                  elsif currentsel>=numsprites
                  currentsel=0
                  end
                  end
                  return currentsel
                  end

                  def pbRefresh
                  for i in 0...6
                  [email protected]["pokemon#{i}"]
                  if sprite
                  if sprite.is_a?(PokeSelectionSprite)
                  sprite.pokemon=sprite.pokemon
                  else
                  sprite.refresh
                  end
                  end
                  end
                  end

                  def pbRefreshSingle(i)
                  [email protected]["pokemon#{i}"]
                  if sprite
                  if sprite.is_a?(PokeSelectionSprite)
                  sprite.pokemon=sprite.pokemon
                  else
                  sprite.refresh
                  end
                  end
                  end

                  def pbHardRefresh
                  oldtext=[]
                  lastselected=-1
                  for i in 0...6
                  oldtext.push(@sprites["pokemon#{i}"].text)
                  lastselected=i if @sprites["pokemon#{i}"].selected
                  @sprites["pokemon#{i}"].dispose
                  end
                  [email protected] if lastselected>[email protected]
                  lastselected=0 if lastselected<0
                  for i in 0...6
                  if @party[i]
                  @sprites["pokemon#{i}"]=PokeSelectionSprite.new(
                  @party[i],i,@viewport)
                  else
                  @sprites["pokemon#{i}"]=PokeSelectionPlaceholderSprite.new(
                  @party[i],i,@viewport)
                  end
                  @sprites["pokemon#{i}"].text=oldtext[i]
                  end
                  pbSelect(lastselected)
                  end

                  def pbPreSelect(pkmn)
                  @activecmd=pkmn
                  end

                  def pbChoosePokemon(switching=false)
                  for i in 0...6
                  @sprites["pokemon#{i}"].preselected=(switching&&[email protected])
                  @sprites["pokemon#{i}"].switching=switching
                  end
                  pbRefresh
                  loop do
                  Graphics.update
                  Input.update
                  self.update
                  [email protected]
                  key=-1
                  key=Input::DOWN if Input.repeat?(Input::DOWN)
                  key=Input::RIGHT if Input.repeat?(Input::RIGHT)
                  key=Input::LEFT if Input.repeat?(Input::LEFT)
                  key=Input::UP if Input.repeat?(Input::UP)
                  if key>=0
                  @activecmd=pbChangeSelection(key,@activecmd)
                  end
                  if @activecmd!=oldsel # Changing selection
                  pbPlayCursorSE()
                  numsprites=(@multiselect) ? 8 : 7
                  for i in 0...numsprites
                  @sprites["pokemon#{i}"].selected=([email protected])
                  end
                  end
                  if Input.trigger?(Input::B)
                  return -1
                  end
                  if Input.trigger?(Input::C)
                  pbPlayDecisionSE()
                  cancelsprite=(@multiselect) ? 7 : 6
                  return (@activecmd==cancelsprite) ? -1 : @activecmd
                  end
                  end
                  end

                  def pbSelect(item)
                  @activecmd=item
                  numsprites=(@multiselect) ? 8 : 7
                  for i in 0...numsprites
                  @sprites["pokemon#{i}"].selected=([email protected])
                  end
                  end

                  def pbDisplay(text)
                  @sprites["messagebox"].text=text
                  @sprites["messagebox"].visible=true
                  @sprites["helpwindow"].visible=false
                  pbPlayDecisionSE()
                  loop do
                  Graphics.update
                  Input.update
                  self.update
                  if @sprites["messagebox"].busy? && Input.trigger?(Input::C)
                  pbPlayDecisionSE() if @sprites["messagebox"].pausing?
                  @sprites["messagebox"].resume
                  end
                  if [email protected]["messagebox"].busy? &&
                  (Input.trigger?(Input::C) || Input.trigger?(Input::B))
                  break
                  end
                  end
                  @sprites["messagebox"].visible=false
                  @sprites["helpwindow"].visible=true
                  end

                  def pbSwitchBegin(oldid,newid)
                  [email protected]["pokemon#{oldid}"]
                  [email protected]["pokemon#{newid}"]
                  22.times do
                  oldsprite.x+=(oldid&1)==0 ? -12 : 12
                  newsprite.x+=(newid&1)==0 ? -12 : 12
                  Graphics.update
                  Input.update
                  self.update
                  end
                  end

                  def pbSwitchEnd(oldid,newid)
                  [email protected]["pokemon#{oldid}"]
                  [email protected]["pokemon#{newid}"]
                  [email protected][oldid]
                  [email protected][newid]
                  22.times do
                  oldsprite.x-=(oldid&1)==0 ? -12 : 12
                  newsprite.x-=(newid&1)==0 ? -12 : 12
                  Graphics.update
                  Input.update
                  self.update
                  end
                  for i in 0...6
                  @sprites["pokemon#{i}"].preselected=false
                  @sprites["pokemon#{i}"].switching=false
                  end
                  pbRefresh
                  end

                  def pbDisplayConfirm(text)
                  ret=-1
                  @sprites["messagebox"].text=text
                  @sprites["messagebox"].visible=true
                  @sprites["helpwindow"].visible=false
                  using(cmdwindow=Window_CommandPokemon.new([_INTL("Yes"),_INTL("No")])){
                  [email protected]+1
                  cmdwindow.visible=false
                  pbBottomRight(cmdwindow)
                  [email protected]["messagebox"].height
                  loop do
                  Graphics.update
                  Input.update
                  cmdwindow.visible=true if [email protected]["messagebox"].busy?
                  cmdwindow.update
                  self.update
                  if Input.trigger?(Input::B) && [email protected]["messagebox"].busy?
                  ret=false
                  break
                  end
                  if Input.trigger?(Input::C) && @sprites["messagebox"].resume && [email protected]["messagebox"].busy?
                  ret=(cmdwindow.index==0)
                  break
                  end
                  end
                  }
                  @sprites["messagebox"].visible=false
                  @sprites["helpwindow"].visible=true
                  return ret
                  end

                  def pbAnnotate(annot)
                  for i in 0...6
                  if annot
                  @sprites["pokemon#{i}"].text=annot[i]
                  end
                  end
                  end

                  def pbSummary(pkmnid)
                  oldsprites=pbFadeOutAndHide(@sprites)
                  scene=PokemonSummaryScene.new
                  screen=PokemonSummary.new(scene)
                  screen.pbStartScreen(@party,pkmnid)
                  pbFadeInAndShow(@sprites,oldsprites)
                  end

                  def pbChooseItem(bag)
                  oldsprites=pbFadeOutAndHide(@sprites)
                  @sprites["helpwindow"].visible=false
                  @sprites["messagebox"].visible=false
                  scene=PokemonBag_Scene.new
                  screen=PokemonBagScreen.new(scene,bag)
                  ret=screen.pbGiveItemScreen
                  pbFadeInAndShow(@sprites,oldsprites)
                  return ret
                  end

                  def pbUseItem(bag,pokemon)
                  oldsprites=pbFadeOutAndHide(@sprites)
                  @sprites["helpwindow"].visible=false
                  @sprites["messagebox"].visible=false
                  scene=PokemonBag_Scene.new
                  screen=PokemonBagScreen.new(scene,bag)
                  ret=screen.pbUseItemScreen(pokemon)
                  pbFadeInAndShow(@sprites,oldsprites)
                  return ret
                  end

                  def pbMessageFreeText(text,startMsg,maxlength)
                  return Kernel.pbMessageFreeText(
                  _INTL("Please enter a message (max. {1} characters).",maxlength),
                  _INTL("{1}",startMsg),false,maxlength,Graphics.width) { update }
                  end
                  end


                  ######################################


                  class PokemonScreen
                  def initialize(scene,party)
                  @party=party
                  @scene=scene
                  end

                  def pbHardRefresh
                  @scene.pbHardRefresh
                  end

                  def pbRefresh
                  @scene.pbRefresh
                  end

                  def pbRefreshSingle(i)
                  @scene.pbRefreshSingle(i)
                  end

                  def pbDisplay(text)
                  @scene.pbDisplay(text)
                  end

                  def pbConfirm(text)
                  return @scene.pbDisplayConfirm(text)
                  end

                  def pbSwitch(oldid,newid)
                  if oldid!=newid
                  @scene.pbSwitchBegin(oldid,newid)
                  [email protected][oldid]
                  @party[oldid][email protected][newid]
                  @party[newid]=tmp
                  @scene.pbSwitchEnd(oldid,newid)
                  end
                  end

                  def pbMailScreen(item,pkmn,pkmnid)
                  message=""
                  loop do
                  [email protected](
                  _INTL("Please enter a message (max. 256 characters)."),"",256)
                  if message!=""
                  # Store mail if a message was written
                  poke1=poke2=poke3=nil
                  if $Trainer.party[pkmnid+2]
                  p=$Trainer.party[pkmnid+2]
                  poke1=[p.species,p.gender,p.isShiny?,(p.form rescue 0),(p.isShadow? rescue false)]
                  poke1.push(true) if p.isEgg?
                  end
                  if $Trainer.party[pkmnid+1]
                  p=$Trainer.party[pkmnid+1]
                  poke2=[p.species,p.gender,p.isShiny?,(p.form rescue 0),(p.isShadow? rescue false)]
                  poke2.push(true) if p.isEgg?
                  end
                  poke3=[pkmn.species,pkmn.gender,pkmn.isShiny?,(pkmn.form rescue 0),(pkmn.isShadow? rescue false)]
                  poke3.push(true) if pkmn.isEgg?
                  pbStoreMail(pkmn,item,message,poke1,poke2,poke3)
                  return true
                  else
                  return false if pbConfirm(_INTL("Stop giving the Pokémon Mail?"))
                  end
                  end
                  end

                  def pbTakeMail(pkmn)
                  if !pkmn.hasItem?
                  pbDisplay(_INTL("{1} isn't holding anything.",pkmn.name))
                  elsif !$PokemonBag.pbCanStore?(pkmn.item)
                  pbDisplay(_INTL("The Bag is full. The Pokémon's item could not be removed."))
                  elsif pkmn.mail
                  if pbConfirm(_INTL("Send the removed mail to your PC?"))
                  if !pbMoveToMailbox(pkmn)
                  pbDisplay(_INTL("Your PC's Mailbox is full."))
                  else
                  pbDisplay(_INTL("The mail was sent to your PC."))
                  pkmn.setItem(0)
                  end
                  elsif pbConfirm(_INTL("If the mail is removed, the message will be lost. OK?"))
                  pbDisplay(_INTL("Mail was taken from the Pokémon."))
                  $PokemonBag.pbStoreItem(pkmn.item)
                  pkmn.setItem(0)
                  pkmn.mail=nil
                  end
                  else
                  $PokemonBag.pbStoreItem(pkmn.item)
                  itemname=PBItems.getName(pkmn.item)
                  pbDisplay(_INTL("Received the {1} from {2}.",itemname,pkmn.name))
                  pkmn.setItem(0)
                  end
                  end

                  def pbGiveMail(item,pkmn,pkmnid=0)
                  thisitemname=PBItems.getName(item)
                  if pkmn.isEgg?
                  pbDisplay(_INTL("Eggs can't hold items."))
                  return false
                  end
                  if pkmn.mail
                  pbDisplay(_INTL("Mail must be removed before holding an item."))
                  return false
                  end
                  if pkmn.item!=0
                  itemname=PBItems.getName(pkmn.item)
                  pbDisplay(_INTL("{1} is already holding one {2}.\1",pkmn.name,itemname))
                  if pbConfirm(_INTL("Would you like to switch the two items?"))
                  $PokemonBag.pbDeleteItem(item)
                  if !$PokemonBag.pbStoreItem(pkmn.item)
                  if !$PokemonBag.pbStoreItem(item) # Compensate
                  raise _INTL("Can't re-store deleted item in bag")
                  end
                  pbDisplay(_INTL("The Bag is full. The Pokémon's item could not be removed."))
                  else
                  if pbIsMail?(item)
                  if pbMailScreen(item,pkmn,pkmnid)
                  pkmn.setItem(item)
                  pbDisplay(_INTL("The {1} was taken and replaced with the {2}.",itemname,thisitemname))
                  return true
                  else
                  if !$PokemonBag.pbStoreItem(item) # Compensate
                  raise _INTL("Can't re-store deleted item in bag")
                  end
                  end
                  else
                  pkmn.setItem(item)
                  pbDisplay(_INTL("The {1} was taken and replaced with the {2}.",itemname,thisitemname))
                  return true
                  end
                  end
                  end
                  else
                  if !pbIsMail?(item) || pbMailScreen(item,pkmn,pkmnid) # Open the mail screen if necessary
                  $PokemonBag.pbDeleteItem(item)
                  pkmn.setItem(item)
                  pbDisplay(_INTL("{1} was given the {2} to hold.",pkmn.name,thisitemname))
                  return true
                  end
                  end
                  return false
                  end

                  def pbPokemonGiveScreen(item)
                  @scene.pbStartScene(@party,_INTL("Give to which Pokémon?"))
                  [email protected]
                  ret=false
                  if pkmnid>=0
                  ret=pbGiveMail(item,@party[pkmnid],pkmnid)
                  end
                  pbRefreshSingle(pkmnid)
                  @scene.pbEndScene
                  return ret
                  end

                  def pbPokemonGiveMailScreen(mailIndex)
                  @scene.pbStartScene(@party,_INTL("Give to which Pokémon?"))
                  [email protected]
                  if pkmnid>=0
                  [email protected][pkmnid]
                  if pkmn.item!=0 || pkmn.mail
                  pbDisplay(_INTL("This Pokémon is holding an item. It can't hold mail."))
                  elsif pkmn.isEgg?
                  pbDisplay(_INTL("Eggs can't hold mail."))
                  else
                  pbDisplay(_INTL("Mail was transferred from the Mailbox."))
                  pkmn.mail=$PokemonGlobal.mailbox[mailIndex]
                  pkmn.setItem(pkmn.mail.item)
                  $PokemonGlobal.mailbox.delete_at(mailIndex)
                  pbRefreshSingle(pkmnid)
                  end
                  end
                  @scene.pbEndScene
                  end

                  def pbStartScene(helptext,doublebattle,annotations=nil)
                  @scene.pbStartScene(@party,helptext,annotations)
                  end

                  def pbChoosePokemon(helptext=nil)
                  @scene.pbSetHelpText(helptext) if helptext
                  return @scene.pbChoosePokemon
                  end

                  def pbChooseMove(pokemon,helptext)
                  movenames=[]
                  for i in pokemon.moves
                  break if i.id==0
                  if i.totalpp==0
                  movenames.push(_INTL("{1} (PP: ---)",PBMoves.getName(i.id),i.pp,i.totalpp))
                  else
                  movenames.push(_INTL("{1} (PP: {2}/{3})",PBMoves.getName(i.id),i.pp,i.totalpp))
                  end
                  end
                  return @scene.pbShowCommands(helptext,movenames)
                  end

                  def pbEndScene
                  @scene.pbEndScene
                  end

                  # Checks for identical species
                  def pbCheckSpecies(array)
                  for i in 0...array.length
                  for j in i+1...array.length
                  return false if array[i].species==array[j].species
                  end
                  end
                  return true
                  end

                  # Checks for identical held items
                  def pbCheckItems(array)
                  for i in 0...array.length
                  next if !array[i].hasItem?
                  for j in i+1...array.length
                  return false if array[i].item==array[j].item
                  end
                  end
                  return true
                  end

                  def pbPokemonMultipleEntryScreenEx(ruleset)
                  annot=[]
                  statuses=[]
                  ordinals=[
                  _INTL("INELIGIBLE"),
                  _INTL("NOT ENTERED"),
                  _INTL("BANNED"),
                  _INTL("FIRST"),
                  _INTL("SECOND"),
                  _INTL("THIRD"),
                  _INTL("FOURTH"),
                  _INTL("FIFTH"),
                  _INTL("SIXTH")
                  ]
                  if !ruleset.hasValidTeam?(@party)
                  return nil
                  end
                  ret=nil
                  addedEntry=false
                  for i in [email protected]
                  if ruleset.isPokemonValid?(@party[i])
                  statuses[i]=1
                  else
                  statuses[i]=2
                  end
                  end
                  for i in [email protected]
                  annot[i]=ordinals[statuses[i]]
                  end
                  @scene.pbStartScene(@party,_INTL("Choose Pokémon and confirm."),annot,true)
                  loop do
                  realorder=[]
                  for i in [email protected]
                  for j in [email protected]
                  if statuses[j]==i+3
                  realorder.push(j)
                  break
                  end
                  end
                  end
                  for i in 0...realorder.length
                  statuses[realorder[i]]=i+3
                  end
                  for i in [email protected]
                  annot[i]=ordinals[statuses[i]]
                  end
                  @scene.pbAnnotate(annot)
                  if realorder.length==ruleset.number && addedEntry
                  @scene.pbSelect(6)
                  end
                  @scene.pbSetHelpText(_INTL("Choose Pokémon and confirm."))
                  [email protected]
                  addedEntry=false
                  if pkmnid==6 # Confirm was chosen
                  ret=[]
                  for i in realorder
                  ret.push(@party[i])
                  end
                  error=[]
                  if !ruleset.isValid?(ret,error)
                  pbDisplay(error[0])
                  ret=nil
                  else
                  break
                  end
                  end
                  if pkmnid<0 # Canceled
                  break
                  end
                  cmdEntry=-1
                  cmdNoEntry=-1
                  cmdSummary=-1
                  commands=[]
                  if (statuses[pkmnid] || 0) == 1
                  commands[cmdEntry=commands.length]=_INTL("Entry")
                  elsif (statuses[pkmnid] || 0) > 2
                  commands[cmdNoEntry=commands.length]=_INTL("No Entry")
                  end
                  [email protected][pkmnid]
                  commands[cmdSummary=commands.length]=_INTL("DATOS")
                  commands[commands.length]=_INTL("Cancelar")
                  [email protected](_INTL("Que quieres hacer con {1}?",pkmn.name),commands) if pkmn
                  if cmdEntry>=0 && command==cmdEntry
                  if realorder.length>=ruleset.number && ruleset.number>0
                  pbDisplay(_INTL("No more than {1} Pokémon may enter.",ruleset.number))
                  else
                  statuses[pkmnid]=realorder.length+3
                  addedEntry=true
                  pbRefreshSingle(pkmnid)
                  end
                  elsif cmdNoEntry>=0 && command==cmdNoEntry
                  statuses[pkmnid]=1
                  pbRefreshSingle(pkmnid)
                  elsif cmdSummary>=0 && command==cmdSummary
                  @scene.pbSummary(pkmnid)
                  end
                  end
                  @scene.pbEndScene
                  return ret
                  end

                  def pbChooseAblePokemon(ableProc,allowIneligible=false)
                  annot=[]
                  eligibility=[]
                  for pkmn in @party
                  elig=ableProc.call(pkmn)
                  eligibility.push(elig)
                  annot.push(elig ? _INTL("ABLE") : _INTL("NOT ABLE"))
                  end
                  ret=-1
                  @scene.pbStartScene(@party,
                  @party.length>1 ? _INTL("Selecciona un Pokemon") : _INTL("Elejir un pokemon o cancelar."),annot)
                  loop do
                  @scene.pbSetHelpText(
                  @party.length>1 ? _INTL("Selecciona un Pokemon.") : _INTL("Elejir un pokemon o cancelar."))
                  [email protected]
                  if pkmnid<0
                  break
                  elsif !eligibility[pkmnid] && !allowIneligible
                  pbDisplay(_INTL("Este pokemon no puede ser seleccionado."))
                  else
                  ret=pkmnid
                  break
                  end
                  end
                  @scene.pbEndScene
                  return ret
                  end

                  def pbRefreshAnnotations(ableProc) # For after using an evolution stone
                  annot=[]
                  for pkmn in @party
                  elig=ableProc.call(pkmn)
                  annot.push(elig ? _INTL("ABLE") : _INTL("NOT ABLE"))
                  end
                  @scene.pbAnnotate(annot)
                  end

                  def pbPokemonDebug(pkmn,pkmnid)
                  command=0
                  loop do
                  [email protected](_INTL("Do what with {1}?",pkmn.name),[
                  _INTL("HP/Status"),
                  _INTL("Level"),
                  _INTL("Species"),
                  _INTL("Moves"),
                  _INTL("Gender"),
                  _INTL("Ability"),
                  _INTL("Nature"),
                  _INTL("Shininess"),
                  _INTL("Form"),
                  _INTL("Happiness"),
                  _INTL("EV/IV/pID"),
                  _INTL("Pokérus"),
                  _INTL("Ownership"),
                  _INTL("Nickname"),
                  _INTL("Poké Ball"),
                  _INTL("Ribbons"),
                  _INTL("Egg"),
                  _INTL("Shadow Pokémon"),
                  _INTL("Make Mystery Gift"),
                  _INTL("Duplicate"),
                  _INTL("Delete"),
                  _INTL("Force Evo"),
                  _INTL("Cancel")
                  ],command)
                  case command
                  ### Cancel ###
                  when -1, 22
                  break
                  ### HP/Status ###
                  when 0
                  cmd=0
                  loop do
                  [email protected](_INTL("Do what with {1}?",pkmn.name),[
                  _INTL("Set HP"),
                  _INTL("Status: Sleep"),
                  _INTL("Status: Poison"),
                  _INTL("Status: Burn"),
                  _INTL("Status: Paralysis"),
                  _INTL("Status: Frozen"),
                  _INTL("Fainted"),
                  _INTL("Heal")
                  ],cmd)
                  # Break
                  if cmd==-1
                  break
                  # Set HP
                  elsif cmd==0
                  params=ChooseNumberParams.new
                  params.setRange(0,pkmn.totalhp)
                  params.setDefaultValue(pkmn.hp)
                  newhp=Kernel.pbMessageChooseNumber(
                  _INTL("Set the Pokémon's HP (max. {1}).",pkmn.totalhp),params) { @scene.update }
                  if newhp!=pkmn.hp
                  pkmn.hp=newhp
                  pbDisplay(_INTL("{1}'s HP was set to {2}.",pkmn.name,pkmn.hp))
                  pbRefreshSingle(pkmnid)
                  end
                  # Set status
                  elsif cmd>=1 && cmd<=5
                  if pkmn.hp>0
                  pkmn.status=cmd
                  pkmn.statusCount=0
                  if pkmn.status==PBStatuses::SLEEP
                  params=ChooseNumberParams.new
                  params.setRange(0,9)
                  params.setDefaultValue(0)
                  sleep=Kernel.pbMessageChooseNumber(
                  _INTL("Set the Pokémon's sleep count."),params) { @scene.update }
                  pkmn.statusCount=sleep
                  end
                  pbDisplay(_INTL("{1}'s status was changed.",pkmn.name))
                  pbRefreshSingle(pkmnid)
                  else
                  pbDisplay(_INTL("{1}'s status could not be changed.",pkmn.name))
                  end
                  # Faint
                  elsif cmd==6
                  pkmn.hp=0
                  pbDisplay(_INTL("{1}'s HP was set to 0.",pkmn.name))
                  pbRefreshSingle(pkmnid)
                  # Heal
                  elsif cmd==7
                  pkmn.heal
                  pbDisplay(_INTL("{1} was fully healed.",pkmn.name))
                  pbRefreshSingle(pkmnid)
                  end
                  end
                  ### Level ###
                  when 1
                  params=ChooseNumberParams.new
                  params.setRange(1,PBExperience::MAXLEVEL)
                  params.setDefaultValue(pkmn.level)
                  level=Kernel.pbMessageChooseNumber(
                  _INTL("Set the Pokémon's level (max. {1}).",PBExperience::MAXLEVEL),params) { @scene.update }
                  if level!=pkmn.level
                  pkmn.level=level
                  pkmn.calcStats
                  pbDisplay(_INTL("{1}'s level was set to {2}.",pkmn.name,pkmn.level))
                  pbRefreshSingle(pkmnid)
                  end
                  ### Species ###
                  when 2
                  species=pbChooseSpecies(pkmn.species)
                  if species!=0
                  oldspeciesname=PBSpecies.getName(pkmn.species)
                  pkmn.species=species
                  pkmn.calcStats
                  oldname=pkmn.name
                  pkmn.name=PBSpecies.getName(pkmn.species) if pkmn.name==oldspeciesname
                  pbDisplay(_INTL("{1}'s species was changed to {2}.",oldname,PBSpecies.getName(pkmn.species)))
                  pbSeenForm(pkmn)
                  pbRefreshSingle(pkmnid)
                  end
                  ### Moves ###
                  when 3
                  cmd=0
                  loop do
                  [email protected](_INTL("Do what with {1}?",pkmn.name),[
                  _INTL("Teach move"),
                  _INTL("Forget move"),
                  _INTL("Reset movelist"),
                  _INTL("Reset initial moves")],cmd)
                  # Break
                  if cmd==-1
                  break
                  # Teach move
                  elsif cmd==0
                  move=pbChooseMoveList
                  if move!=0
                  pbLearnMove(pkmn,move)
                  pbRefreshSingle(pkmnid)
                  end
                  # Forget move
                  elsif cmd==1
                  move=pbChooseMove(pkmn,_INTL("Choose move to forget."))
                  if move>=0
                  movename=PBMoves.getName(pkmn.moves[move].id)
                  pbDeleteMove(pkmn,move)
                  pbDisplay(_INTL("{1} forgot {2}.",pkmn.name,movename))
                  pbRefreshSingle(pkmnid)
                  end
                  # Reset movelist
                  elsif cmd==2
                  pkmn.resetMoves
                  pbDisplay(_INTL("{1}'s moves were reset.",pkmn.name))
                  pbRefreshSingle(pkmnid)
                  # Reset initial moves
                  elsif cmd==3
                  pkmn.pbRecordFirstMoves
                  pbDisplay(_INTL("{1}'s moves were set as its first-known moves.",pkmn.name))
                  pbRefreshSingle(pkmnid)
                  end
                  end
                  ### Gender ###
                  when 4
                  if pkmn.gender==2
                  pbDisplay(_INTL("{1} is genderless.",pkmn.name))
                  else
                  cmd=0
                  loop do
                  oldgender=(pkmn.isMale?) ? _INTL("male") : _INTL("female")
                  msg=[_INTL("Gender {1} is natural.",oldgender),
                  _INTL("Gender {1} is being forced.",oldgender)][pkmn.genderflag ? 1 : 0]
                  [email protected](msg,[
                  _INTL("Make male"),
                  _INTL("Make female"),
                  _INTL("Remove override")],cmd)
                  # Break
                  if cmd==-1
                  break
                  # Make male
                  elsif cmd==0
                  pkmn.setGender(0)
                  if pkmn.isMale?
                  pbDisplay(_INTL("{1} is now male.",pkmn.name))
                  else
                  pbDisplay(_INTL("{1}'s gender couldn't be changed.",pkmn.name))
                  end
                  # Make female
                  elsif cmd==1
                  pkmn.setGender(1)
                  if pkmn.isFemale?
                  pbDisplay(_INTL("{1} is now female.",pkmn.name))
                  else
                  pbDisplay(_INTL("{1}'s gender couldn't be changed.",pkmn.name))
                  end
                  # Remove override
                  elsif cmd==2
                  pkmn.genderflag=nil
                  pbDisplay(_INTL("Gender override removed."))
                  end
                  pbSeenForm(pkmn)
                  pbRefreshSingle(pkmnid)
                  end
                  end
                  ### Ability ###
                  when 5
                  cmd=0
                  loop do
                  abils=pkmn.getAbilityList
                  oldabil=PBAbilities.getName(pkmn.ability)
                  commands=[]
                  for i in 0...abils[0].length
                  commands.push((abils[1][i]<2 ? "" : "(H) ")+PBAbilities.getName(abils[0][i]))
                  end
                  commands.push(_INTL("Remove override"))
                  msg=[_INTL("Ability {1} is natural.",oldabil),
                  _INTL("Ability {1} is being forced.",oldabil)][pkmn.abilityflag ? 1 : 0]
                  [email protected](msg,commands,cmd)
                  # Break
                  if cmd==-1
                  break
                  # Set ability override
                  elsif cmd>=0 && cmd<abils[0].length
                  pkmn.setAbility(abils[1][cmd])
                  # Remove override
                  elsif cmd==abils[0].length
                  pkmn.abilityflag=nil
                  end
                  pbRefreshSingle(pkmnid)
                  end
                  ### Nature ###
                  when 6
                  cmd=0
                  loop do
                  oldnature=PBNatures.getName(pkmn.nature)
                  commands=[]
                  (PBNatures.getCount).times do |i|
                  commands.push(PBNatures.getName(i))
                  end
                  commands.push(_INTL("Remove override"))
                  msg=[_INTL("Nature {1} is natural.",oldnature),
                  _INTL("Nature {1} is being forced.",oldnature)][pkmn.natureflag ? 1 : 0]
                  [email protected](msg,commands,cmd)
                  # Break
                  if cmd==-1
                  break
                  # Set nature override
                  elsif cmd>=0 && cmd<PBNatures.getCount
                  pkmn.setNature(cmd)
                  pkmn.calcStats
                  # Remove override
                  elsif cmd==PBNatures.getCount
                  pkmn.natureflag=nil
                  end
                  pbRefreshSingle(pkmnid)
                  end
                  ### Shininess ###
                  when 7
                  cmd=0
                  loop do
                  oldshiny=(pkmn.isShiny?) ? _INTL("shiny") : _INTL("normal")
                  msg=[_INTL("Shininess ({1}) is natural.",oldshiny),
                  _INTL("Shininess ({1}) is being forced.",oldshiny)][pkmn.shinyflag!=nil ? 1 : 0]
                  [email protected](msg,[
                  _INTL("Make shiny"),
                  _INTL("Make normal"),
                  _INTL("Remove override")],cmd)
                  # Break
                  if cmd==-1
                  break
                  # Make shiny
                  elsif cmd==0
                  pkmn.makeShiny
                  # Make normal
                  elsif cmd==1
                  pkmn.makeNotShiny
                  # Remove override
                  elsif cmd==2
                  pkmn.shinyflag=nil
                  end
                  pbRefreshSingle(pkmnid)
                  end
                  ### Form ###
                  when 8
                  params=ChooseNumberParams.new
                  params.setRange(0,100)
                  params.setDefaultValue(pkmn.form)
                  f=Kernel.pbMessageChooseNumber(
                  _INTL("Set the Pokémon's form."),params) { @scene.update }
                  if f!=pkmn.form
                  pkmn.form=f
                  pbDisplay(_INTL("{1}'s form was set to {2}.",pkmn.name,pkmn.form))
                  pbSeenForm(pkmn)
                  pbRefreshSingle(pkmnid)
                  end
                  ### Happiness ###
                  when 9
                  params=ChooseNumberParams.new
                  params.setRange(0,255)
                  params.setDefaultValue(pkmn.happiness)
                  h=Kernel.pbMessageChooseNumber(
                  _INTL("Set the Pokémon's happiness (max. 255)."),params) { @scene.update }
                  if h!=pkmn.happiness
                  pkmn.happiness=h
                  pbDisplay(_INTL("{1}'s happiness was set to {2}.",pkmn.name,pkmn.happiness))
                  pbRefreshSingle(pkmnid)
                  end
                  ### EV/IV/pID ###
                  when 10
                  stats=[_INTL("HP"),_INTL("Attack"),_INTL("Defense"),
                  _INTL("Speed"),_INTL("Sp. Attack"),_INTL("Sp. Defense")]
                  cmd=0
                  loop do
                  persid=sprintf("0x%08X",pkmn.personalID)
                  [email protected](_INTL("Personal ID is {1}.",persid),[
                  _INTL("Set EVs"),
                  _INTL("Set IVs"),
                  _INTL("Randomise pID")],cmd)
                  case cmd
                  # Break
                  when -1
                  break
                  # Set EVs
                  when 0
                  cmd2=0
                  loop do
                  evcommands=[]
                  for i in 0...stats.length
                  evcommands.push(stats[i]+" (#{pkmn.ev[i]})")
                  end
                  [email protected](_INTL("Change which EV?"),evcommands,cmd2)
                  if cmd2==-1
                  break
                  elsif cmd2>=0 && cmd2<stats.length
                  params=ChooseNumberParams.new
                  params.setRange(0,255)
                  params.setDefaultValue(pkmn.ev[cmd2])
                  params.setCancelValue(pkmn.ev[cmd2])
                  f=Kernel.pbMessageChooseNumber(
                  _INTL("Set the EV for {1} (max. 255).",stats[cmd2]),params) { @scene.update }
                  pkmn.ev[cmd2]=f
                  pkmn.totalhp
                  pkmn.calcStats
                  pbRefreshSingle(pkmnid)
                  end
                  end
                  # Set IVs
                  when 1
                  cmd2=0
                  loop do
                  hiddenpower=pbHiddenPower(pkmn.iv)
                  msg=_INTL("Hidden Power:\n{1}, power {2}.",PBTypes.getName(hiddenpower[0]),hiddenpower[1])
                  ivcommands=[]
                  for i in 0...stats.length
                  ivcommands.push(stats[i]+" (#{pkmn.iv[i]})")
                  end
                  ivcommands.push(_INTL("Randomise all"))
                  [email protected](msg,ivcommands,cmd2)
                  if cmd2==-1
                  break
                  elsif cmd2>=0 && cmd2<stats.length
                  params=ChooseNumberParams.new
                  params.setRange(0,31)
                  params.setDefaultValue(pkmn.iv[cmd2])
                  params.setCancelValue(pkmn.iv[cmd2])
                  f=Kernel.pbMessageChooseNumber(
                  _INTL("Set the IV for {1} (max. 31).",stats[cmd2]),params) { @scene.update }
                  pkmn.iv[cmd2]=f
                  pkmn.calcStats
                  pbRefreshSingle(pkmnid)
                  elsif cmd2==ivcommands.length-1
                  pkmn.iv[0]=rand(32)
                  pkmn.iv[1]=rand(32)
                  pkmn.iv[2]=rand(32)
                  pkmn.iv[3]=rand(32)
                  pkmn.iv[4]=rand(32)
                  pkmn.iv[5]=rand(32)
                  pkmn.calcStats
                  pbRefreshSingle(pkmnid)
                  end
                  end
                  # Randomise pID
                  when 2
                  pkmn.personalID=rand(256)
                  pkmn.personalID|=rand(256)<<8
                  pkmn.personalID|=rand(256)<<16
                  pkmn.personalID|=rand(256)<<24
                  pkmn.calcStats
                  pbRefreshSingle(pkmnid)
                  end
                  end
                  ### Pokérus ###
                  when 11
                  cmd=0
                  loop do
                  pokerus=(pkmn.pokerus) ? pkmn.pokerus : 0
                  msg=[_INTL("{1} doesn't have Pokérus.",pkmn.name),
                  _INTL("Has strain {1}, infectious for {2} more days.",pokerus/16,pokerus%16),
                  _INTL("Has strain {1}, not infectious.",pokerus/16)][pkmn.pokerusStage]
                  [email protected](msg,[
                  _INTL("Give random strain"),
                  _INTL("Make not infectious"),
                  _INTL("Clear Pokérus")],cmd)
                  # Break
                  if cmd==-1
                  break
                  # Give random strain
                  elsif cmd==0
                  pkmn.givePokerus
                  # Make not infectious
                  elsif cmd==1
                  strain=pokerus/16
                  p=strain<<4
                  pkmn.pokerus=p
                  # Clear Pokérus
                  elsif cmd==2
                  pkmn.pokerus=0
                  end
                  end
                  ### Ownership ###
                  when 12
                  cmd=0
                  loop do
                  gender=[_INTL("Male"),_INTL("Female"),_INTL("Unknown")][pkmn.otgender]
                  msg=[_INTL("Player's Pokémon\n{1}\n{2}\n{3} ({4})",pkmn.ot,gender,pkmn.publicID,pkmn.trainerID),
                  _INTL("Foreign Pokémon\n{1}\n{2}\n{3} ({4})",pkmn.ot,gender,pkmn.publicID,pkmn.trainerID)
                  ][pkmn.isForeign?($Trainer) ? 1 : 0]
                  [email protected](msg,[
                  _INTL("Make player's"),
                  _INTL("Set OT's name"),
                  _INTL("Set OT's gender"),
                  _INTL("Random foreign ID"),
                  _INTL("Set foreign ID")],cmd)
                  # Break
                  if cmd==-1
                  break
                  # Make player's
                  elsif cmd==0
                  pkmn.trainerID=$Trainer.id
                  pkmn.ot=$Trainer.name
                  pkmn.otgender=$Trainer.gender
                  # Set OT's name
                  elsif cmd==1
                  newot=pbEnterPlayerName(_INTL("{1}'s OT's name?",pkmn.name),1,7)
                  pkmn.ot=newot
                  # Set OT's gender
                  elsif cmd==2
                  [email protected](_INTL("Set OT's gender."),
                  [_INTL("Male"),_INTL("Female"),_INTL("Unknown")])
                  pkmn.otgender=cmd2 if cmd2>=0
                  # Random foreign ID
                  elsif cmd==3
                  pkmn.trainerID=$Trainer.getForeignID
                  # Set foreign ID
                  elsif cmd==4
                  params=ChooseNumberParams.new
                  params.setRange(0,65535)
                  params.setDefaultValue(pkmn.publicID)
                  val=Kernel.pbMessageChooseNumber(
                  _INTL("Set the new ID (max. 65535)."),params) { @scene.update }
                  pkmn.trainerID=val
                  pkmn.trainerID|=val<<16
                  end
                  end
                  ### Nickname ###
                  when 13
                  cmd=0
                  loop do
                  speciesname=PBSpecies.getName(pkmn.species)
                  msg=[_INTL("{1} has the nickname {2}.",speciesname,pkmn.name),
                  _INTL("{1} has no nickname.",speciesname)][pkmn.name==speciesname ? 1 : 0]
                  [email protected](msg,[
                  _INTL("Rename"),
                  _INTL("Erase name")],cmd)
                  # Break
                  if cmd==-1
                  break
                  # Rename
                  elsif cmd==0
                  newname=pbEnterPokemonName(_INTL("{1}'s nickname?",speciesname),0,10,"",pkmn)
                  pkmn.name=(newname=="") ? speciesname : newname
                  pbRefreshSingle(pkmnid)
                  # Erase name
                  elsif cmd==1
                  pkmn.name=speciesname
                  end
                  end
                  ### Poké Ball ###
                  when 14
                  cmd=0
                  loop do
                  oldball=PBItems.getName(pbBallTypeToBall(pkmn.ballused))
                  commands=[]; balls=[]
                  for key in $BallTypes.keys
                  item=getID(PBItems,$BallTypes[key])
                  balls.push([key,PBItems.getName(item)]) if item && item>0
                  end
                  balls.sort! {|a,b| a[1]<=>b[1]}
                  for i in 0...commands.length
                  cmd=i if pkmn.ballused==balls[i][0]
                  end
                  for i in balls
                  commands.push(i[1])
                  end
                  [email protected](_INTL("{1} uso.",oldball),commands,cmd)
                  if cmd==-1
                  break
                  else
                  pkmn.ballused=balls[cmd][0]
                  end
                  end
                  ### Ribbons ###
                  when 15
                  cmd=0
                  loop do
                  commands=[]
                  for i in 1..PBRibbons.maxValue
                  commands.push(_INTL("{1} {2}",
                  pkmn.hasRibbon?(i) ? "[X]" : "[ ]",PBRibbons.getName(i)))
                  end
                  [email protected](_INTL("{1} Listones",pkmn.ribbonCount),commands,cmd)
                  if cmd==-1
                  break
                  elsif cmd>=0 && cmd<commands.length
                  if pkmn.hasRibbon?(cmd+1)
                  pkmn.takeRibbon(cmd+1)
                  else
                  pkmn.giveRibbon(cmd+1)
                  end
                  end
                  end
                  ### Egg ###
                  when 16
                  cmd=0
                  loop do
                  msg=[_INTL("Not an egg"),
                  _INTL("Egg with eggsteps: {1}.",pkmn.eggsteps)][pkmn.isEgg? ? 1 : 0]
                  [email protected](msg,[
                  _INTL("Make egg"),
                  _INTL("Make Pokémon"),
                  _INTL("Set eggsteps to 1")],cmd)
                  # Break
                  if cmd==-1
                  break
                  # Make egg
                  elsif cmd==0
                  if pbHasEgg?(pkmn.species) ||
                  pbConfirm(_INTL("{1} cannot be an egg. Make egg anyway?",PBSpecies.getName(pkmn.species)))
                  pkmn.level=EGGINITIALLEVEL
                  pkmn.calcStats
                  pkmn.name=_INTL("Egg")
                  dexdata=pbOpenDexData
                  pbDexDataOffset(dexdata,pkmn.species,21)
                  pkmn.eggsteps=dexdata.fgetw
                  dexdata.close
                  pkmn.hatchedMap=0
                  pkmn.obtainMode=1
                  pbRefreshSingle(pkmnid)
                  end
                  # Make Pokémon
                  elsif cmd==1
                  pkmn.name=PBSpecies.getName(pkmn.species)
                  pkmn.eggsteps=0
                  pkmn.hatchedMap=0
                  pkmn.obtainMode=0
                  pbRefreshSingle(pkmnid)
                  # Set eggsteps to 1
                  elsif cmd==2
                  pkmn.eggsteps=1 if pkmn.eggsteps>0
                  end
                  end
                  ### Shadow Pokémon ###
                  when 17
                  cmd=0
                  loop do
                  msg=[_INTL("Not a Shadow Pokémon."),
                  _INTL("Heart gauge is {1}.",pkmn.heartgauge)][(pkmn.isShadow? rescue false) ? 1 : 0]
                  [email protected](msg,[
                  _INTL("Make Shadow"),
                  _INTL("Lower heart gauge")],cmd)
                  # Break
                  if cmd==-1
                  break
                  # Make Shadow
                  elsif cmd==0
                  if !(pkmn.isShadow? rescue false) && pkmn.respond_to?("makeShadow")
                  pkmn.makeShadow
                  pbDisplay(_INTL("{1} is now a Shadow Pokémon.",pkmn.name))
                  pbRefreshSingle(pkmnid)
                  else
                  pbDisplay(_INTL("{1} is already a Shadow Pokémon.",pkmn.name))
                  end
                  # Lower heart gauge
                  elsif cmd==1
                  if (pkmn.isShadow? rescue false)
                  prev=pkmn.heartgauge
                  pkmn.adjustHeart(-700)
                  Kernel.pbMessage(_INTL("{1}'s heart gauge was lowered from {2} to {3} (now stage {4}).",
                  pkmn.name,prev,pkmn.heartgauge,pkmn.heartStage))
                  pbReadyToPurify(pkmn)
                  else
                  Kernel.pbMessage(_INTL("{1} is not a Shadow Pokémon.",pkmn.name))
                  end
                  end
                  end
                  ### Make Mystery Gift ###
                  when 18
                  pbCreateMysteryGift(0,pkmn)
                  ### Duplicate ###
                  when 19
                  if pbConfirm(_INTL("Are you sure you want to copy this Pokémon?"))
                  clonedpkmn=pkmn.clone
                  clonedpkmn.iv=pkmn.iv.clone
                  clonedpkmn.ev=pkmn.ev.clone
                  pbStorePokemon(clonedpkmn)
                  pbHardRefresh
                  pbDisplay(_INTL("The Pokémon was duplicated."))
                  break
                  end
                  ### Delete ###
                  when 20
                  if pbConfirm(_INTL("Are you sure you want to delete this Pokémon?"))
                  @party[pkmnid]=nil
                  @party.compact!
                  pbHardRefresh
                  pbDisplay(_INTL("The Pokémon was deleted."))
                  break
                  end
                  ## Force Evolution##
                  when 21
                  pbForceEvo(pkmn)
                  pbHardRefresh
                  end
                  end
                  end

                  def pbPokemonScreen
                  @scene.pbStartScene(@party,
                  @party.length>1 ? _INTL("Elige un Pokemon") : _INTL("Elige un pokemon o cancela"),nil)
                  loop do
                  @scene.pbSetHelpText(
                  @party.length>1 ? _INTL("Elige un Pokemon.") : _INTL("Elige un Pokemon o Cancela."))
                  [email protected]
                  if pkmnid<0
                  break
                  end
                  [email protected][pkmnid]
                  commands=[]
                  cmdSummary=-1
                  cmdSwitch=-1
                  # Birthsigns - Menu Options (Softboiled, Teleport, Flash)
                  #===============================================================================
                  cmdSoftboiled=-1
                  cmdTeleport=-1
                  cmdFlash=-1
                  #===============================================================================
                  cmdItem=-1
                  cmdDebug=-1
                  cmdMail=-1
                  # Build the commands
                  commands[cmdSummary=commands.length]=_INTL("DATOS")
                  if $DEBUG
                  # Commands for debug mode only
                  commands[cmdDebug=commands.length]=_INTL("Debug")
                  end
                  cmdMoves=[-1,-1,-1,-1]
                  for i in 0...pkmn.moves.length
                  move=pkmn.moves[i]
                  # Check for hidden moves and add any that were found
                  if !pkmn.isEgg? && (
                  isConst?(move.id,PBMoves,:MILKDRINK) ||
                  isConst?(move.id,PBMoves,:SOFTBOILED) ||
                  HiddenMoveHandlers.hasHandler(move.id)
                  )
                  commands[cmdMoves[i]=commands.length]=PBMoves.getName(move.id)
                  end
                  end
                  #===============================================================================
                  # Birthsigns - Menu Options (Softboiled, Teleport, Flash)
                  #
                  #If you changed the names for 'The Martyr', 'The Voyager', or 'The Beacon' in
                  #PField_Time, then you must change their names below to match your new names.
                  #===============================================================================
                  if pkmn.birthsign==_INTL("'The Martyr'")
                  commands[cmdSoftboiled=commands.length]=_INTL("Soft-Boiled")
                  end
                  if pkmn.birthsign==_INTL("'The Voyager'")
                  commands[cmdTeleport=commands.length]=_INTL("Teleport")
                  end
                  if pkmn.birthsign==_INTL("'The Beacon'")
                  commands[cmdFlash=commands.length]=_INTL("Flash")
                  end
                  #===============================================================================
                  commands[cmdSwitch=commands.length]=_INTL("Switch") if @party.length>1
                  if !pkmn.isEgg?
                  if pkmn.mail
                  commands[cmdMail=commands.length]=_INTL("Mail")
                  else
                  commands[cmdItem=commands.length]=_INTL("Item")
                  end
                  end
                  commands[commands.length]=_INTL("Cancel")
                  [email protected](_INTL("Do what with {1}?",pkmn.name),commands)
                  havecommand=false
                  for i in 0...4
                  if cmdMoves[i]>=0 && command==cmdMoves[i]
                  havecommand=true
                  if isConst?(pkmn.moves[i].id,PBMoves,:SOFTBOILED) ||
                  isConst?(pkmn.moves[i].id,PBMoves,:MILKDRINK)
                  if pkmn.hp<=pkmn.totalhp/5
                  pbDisplay(_INTL("Not enough HP..."))
                  break
                  end
                  @scene.pbSetHelpText(_INTL("Use on which Pokémon?"))
                  oldpkmnid=pkmnid
                  loop do
                  @scene.pbPreSelect(oldpkmnid)
                  [email protected](true)
                  break if pkmnid<0
                  [email protected][pkmnid]
                  if newpkmn.isEgg? || newpkmn.hp==0 || newpkmn.hp==newpkmn.totalhp || pkmnid==oldpkmnid
                  pbDisplay(_INTL("This item can't be used on that Pokémon."))
                  else
                  pkmn.hp-=pkmn.totalhp/5
                  hpgain=pbItemRestoreHP(newpkmn,pkmn.totalhp/5)
                  @scene.pbDisplay(_INTL("{1}'s HP was restored by {2} points.",newpkmn.name,hpgain))
                  pbRefresh
                  end
                  end
                  break
                  elsif Kernel.pbCanUseHiddenMove?(pkmn,pkmn.moves[i].id)
                  @scene.pbEndScene
                  if isConst?(pkmn.moves[i].id,PBMoves,:FLY)
                  scene=PokemonRegionMapScene.new(-1,false)
                  screen=PokemonRegionMap.new(scene)
                  ret=screen.pbStartFlyScreen
                  if ret
                  $PokemonTemp.flydata=ret
                  return [pkmn,pkmn.moves[i].id]
                  end
                  @scene.pbStartScene(@party,
                  @party.length>1 ? _INTL("Elige un Pokemon") : _INTL("Elige un Pokemon o Cancela"))
                  break
                  end
                  return [pkmn,pkmn.moves[i].id]
                  else
                  break
                  end
                  end
                  end
                  next if havecommand
                  if cmdSummary>=0 && command==cmdSummary
                  @scene.pbSummary(pkmnid)
                  #===============================================================================
                  # Birthsigns - Softboiled Effect
                  #
                  #If you changed the name for 'The Martyr', in PField_Time, then you
                  #must change the name below to match your new name. Changes will
                  #also need to be made in PScreen_Summary.
                  #===============================================================================
                  elsif pkmn.birthsign==_INTL("'The Martyr'") && command==cmdSoftboiled
                  @scene.pbSetHelpText(_INTL("Use on which Pokémon?"))
                  oldpkmnid=pkmnid
                  loop do
                  @scene.pbPreSelect(oldpkmnid)
                  [email protected](true)
                  [email protected][pkmnid]
                  if newpkmn.isEgg? || newpkmn.hp==0 || newpkmn.hp==newpkmn.totalhp || newpkmn==pkmn
                  pbDisplay(_INTL("Can't be used on that Pokémon."))
                  break
                  pbRefresh
                  elsif pkmn.hp<=pkmn.totalhp/5
                  pbDisplay(_INTL("Not enough HP..."))
                  break
                  pbRefresh
                  else
                  pkmn.hp-=pkmn.totalhp/5
                  hpgain=pbItemRestoreHP(newpkmn,pkmn.totalhp/5)
                  @scene.pbDisplay(_INTL("{1}'s HP was restored by {2} points.",newpkmn.name,hpgain))
                  break
                  pbRefresh
                  end
                  end
                  #===============================================================================
                  # Birthsigns - Teleport Effect
                  #
                  #If you changed the name for 'The Voyager', in PField_Time, then you
                  #must change the name below to match your new name. Changes will
                  #also need to be made in PScreen_Summary.
                  #===============================================================================
                  elsif pkmn.birthsign==_INTL("'The Voyager'") && command==cmdTeleport
                  if !pbGetMetadata($game_map.map_id,MetadataOutdoor)
                  Kernel.pbMessage(_INTL("Can't use that here."))
                  break
                  pbRefresh
                  end
                  if $game_player.pbHasDependentEvents?
                  Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
                  break
                  pbRefresh
                  end
                  healing=$PokemonGlobal.healingSpot
                  if !healing
                  healing=pbGetMetadata(0,MetadataHome) # Home
                  end
                  if healing
                  mapname=pbGetMapNameFromId(healing[0])
                  if Kernel.pbConfirmMessage(_INTL("Want to return to the healing spot used last in {1}?",mapname))
                  if true
                  healing=$PokemonGlobal.healingSpot
                  if !healing
                  healing=pbGetMetadata(0,MetadataHome)
                  end
                  if healing
                  if !pbHiddenMoveAnimation(pkmn)
                  Kernel.pbMessage(_INTL("{1} used Teleport!",pkmn.name))
                  end
                  pbFadeOutIn(99999){
                  Kernel.pbCancelVehicles
                  $game_temp.player_new_map_id=healing[0]
                  $game_temp.player_new_x=healing[1]
                  $game_temp.player_new_y=healing[2]
                  $game_temp.player_new_direction=2
                  $scene.transfer_player
                  $game_map.autoplay
                  $game_map.refresh
                  }
                  pbEraseEscapePoint
                  pbDisplay(_INTL("{1} transported you back to {2}!",pkmn.name,mapname))
                  end
                  else
                  break
                  pbRefresh
                  end
                  end
                  end
                  #===============================================================================
                  # Birthsigns - Flash Effect
                  #
                  #If you changed the name for 'The Beacon', in PField_Time, then you
                  #must change the name below to match your new name. Changes will
                  #also need to be made in PScreen_Summary.
                  #===============================================================================
                  elsif pkmn.birthsign==_INTL("'The Beacon'") && command==cmdFlash
                  if !pbGetMetadata($game_map.map_id,MetadataDarkMap)
                  Kernel.pbMessage(_INTL("Can't use that here."))
                  break
                  pbRefresh
                  end
                  if $PokemonGlobal.flashUsed
                  Kernel.pbMessage(_INTL("This is in use already."))
                  break
                  pbRefresh
                  end
                  darkness=$PokemonTemp.darknessSprite
                  if !darkness || darkness.disposed?
                  darkness!=$PokemonTemp.darknessSprite
                  end
                  if !pbHiddenMoveAnimation(pkmn)
                  pbDisplay(_INTL("{1} used Flash!",pkmn.name))
                  end
                  pbDisplay(_INTL("{1} lit up the area!",pkmn.name))
                  $PokemonGlobal.flashUsed=true
                  while darkness.radius<176
                  Graphics.update
                  Input.update
                  pbUpdateSceneMap
                  darkness.radius+=4
                  end
                  #===============================================
                  elsif cmdSwitch>=0 && command==cmdSwitch
                  @scene.pbSetHelpText(_INTL("Mover a donde?"))
                  oldpkmnid=pkmnid
                  [email protected](true)
                  if pkmnid>=0 && pkmnid!=oldpkmnid
                  pbSwitch(oldpkmnid,pkmnid)
                  end
                  elsif cmdDebug>=0 && command==cmdDebug
                  pbPokemonDebug(pkmn,pkmnid)
                  elsif cmdMail>=0 && command==cmdMail
                  [email protected](_INTL("Quieres ver el correo?"),[_INTL("Leer"),_INTL("Tomar"),_INTL("Cancelar")])
                  case command
                  when 0 # Read
                  pbFadeOutIn(99999){
                  pbDisplayMail(pkmn.mail,pkmn)
                  }
                  when 1 # Take
                  pbTakeMail(pkmn)
                  pbRefreshSingle(pkmnid)
                  end
                  elsif cmdItem>=0 && command==cmdItem
                  [email protected](_INTL("Do what with an item?"),[_INTL("Give"),_INTL("Take"),_INTL("Use"),_INTL("Move"),_INTL("Cancel")])
                  case command
                  when 0 # Give
                  [email protected]($PokemonBag)
                  if item>0
                  pbGiveMail(item,pkmn,pkmnid)
                  pbRefreshSingle(pkmnid)
                  end
                  when 1 # Take
                  pbTakeMail(pkmn)
                  pbRefreshSingle(pkmnid)
                  when 2 # Use
                  @scene.pbUseItem($PokemonBag,pkmn)
                  when 3
                  if pkmn.item>0
                  moveitem=pkmn.item
                  pkmn.item=0
                  pbRefreshSingle(pkmnid)
                  pokeid=pbChoosePokemon(_INTL("Give {1} to which Pokemon?",PBItems.getName(moveitem)))
                  poke=$Trainer.party[pokeid]
                  if pokeid>=0 && !poke.isEgg?
                  if poke.item>0
                  if pbConfirm(_INTL("{1} is already holding an item, would you like to put the {3} in your bag?",
                  poke.name,PBItems.getName(poke.item),PBItems.getName(poke.item)))
                  pbTakeMail(poke)
                  poke.item=moveitem
                  pbDisplay(_INTL("{1} was given {2} to hold",poke.name,PBItems.getName(poke.item)))
                  pbRefreshSingle(pokeid)
                  end
                  else
                  poke.item=moveitem
                  pbDisplay(_INTL("{1} was given {2} to hold",poke.name,PBItems.getName(poke.item)))
                  end
                  else
                  if poke.isEgg?
                  pbDisplay(_INTL("An egg can't hold an item!"))
                  end
                  pkmn.item=moveitem
                  end
                  else
                  pbDisplay(_INTL("{1} isn't holding an item",pkmn.name))
                  end
                  end
                  end
                  end
                  @scene.pbEndScene
                  return nil
                  end
                  end


                  PScreen_Summary
                  Spoiler:
                  Quote:
                  class MoveSelectionSprite < SpriteWrapper
                  attr_reader :preselected
                  attr_reader :index

                  def initialize(viewport=nil,fifthmove=false)
                  super(viewport)
                  @movesel=AnimatedBitmap.new("Graphics/Pictures/summarymovesel")
                  @frame=0
                  @index=0
                  @fifthmove=fifthmove
                  @preselected=false
                  @updating=false
                  @spriteVisible=true
                  refresh
                  end

                  def dispose
                  @movesel.dispose
                  super
                  end

                  def index=(value)
                  @index=value
                  refresh
                  end

                  def preselected=(value)
                  @preselected=value
                  refresh
                  end

                  def visible=(value)
                  super
                  @spriteVisible=value if [email protected]
                  end

                  def refresh
                  [email protected]
                  [email protected]/2
                  self.x=240
                  self.y=92+(self.index*64)
                  self.y-=76 if @fifthmove
                  self.y+=20 if @fifthmove && self.index==4
                  [email protected]
                  if self.preselected
                  self.src_rect.set(0,h,w,h)
                  else
                  self.src_rect.set(0,0,w,h)
                  end
                  end

                  def update
                  @updating=true
                  super
                  @movesel.update
                  @updating=false
                  refresh
                  end
                  end



                  class PokemonSummaryScene
                  def pbPokerus(pkmn)
                  return pkmn.pokerusStage
                  end

                  def pbUpdate
                  pbUpdateSpriteHash(@sprites)
                  end

                  def pbStartScene(party,partyindex)
                  @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
                  @viewport.z=99999
                  @viewport2=Viewport.new(0,220,Graphics.width,Graphics.height)
                  @viewport2.z=99999+1
                  @party=party
                  @partyindex=partyindex
                  @[email protected][@partyindex]
                  @sprites={}
                  @typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
                  @sprites["background"]=IconSprite.new(0,0,@viewport)
                  @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
                  @sprites["overlay2"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport2)
                  @sprites["overlaytxt"]=IconSprite.new(0,0,@viewport)
                  @sprites["overlaytxt"].visible=false
                  @sprites["overlaytxt"][email protected]["background"].z+1
                  @sprites["pokemon"]=PokemonBattlerSprite.new(false,0,@viewport)
                  @sprites["pokemon"].setPokemonBitmap(@pokemon)
                  @sprites["pokemon"].mirror=false
                  @sprites["pokemon"].color=Color.new(0,0,0,0)
                  @sprites["pokemon"].visible=true
                  pbPositionPokemonSprite(@sprites["pokemon"],40,144)
                  @sprites["pokeicon"]=PokemonBoxIcon.new(@pokemon,@viewport)
                  @sprites["pokeicon"].x=14
                  @sprites["pokeicon"].y=52
                  @sprites["pokeicon"].mirror=false
                  @sprites["pokeicon"].visible=false
                  @sprites["movepresel"]=MoveSelectionSprite.new(@viewport)
                  @sprites["movepresel"].visible=false
                  @sprites["movepresel"].preselected=true
                  @sprites["movesel"]=MoveSelectionSprite.new(@viewport)
                  @sprites["movesel"].visible=false
                  @page=0
                  drawPageOne(@pokemon)
                  pbFadeInAndShow(@sprites) { pbUpdate }
                  end

                  def pbStartForgetScene(party,partyindex,moveToLearn)
                  @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
                  @viewport.z=99999
                  @viewport2=Viewport.new(0,220,Graphics.width,Graphics.height)
                  @viewport2.z=99999+1
                  @party=party
                  @partyindex=partyindex
                  @[email protected][@partyindex]
                  @sprites={}
                  @page=3
                  @typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
                  @sprites["background"]=IconSprite.new(0,0,@viewport)
                  @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
                  @sprites["overlay2"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport2)
                  @sprites["overlaytxt"]=IconSprite.new(0,0,@viewport)
                  @sprites["overlaytxt"].visible=false
                  @sprites["overlaytxt"][email protected]["background"].z+1
                  @sprites["pokeicon"]=PokemonBoxIcon.new(@pokemon,@viewport)
                  @sprites["pokeicon"].x=14
                  @sprites["pokeicon"].y=52
                  @sprites["pokeicon"].mirror=false
                  @sprites["movesel"]=MoveSelectionSprite.new(@viewport,moveToLearn>0)
                  @sprites["movesel"].visible=false
                  @sprites["movesel"].visible=true
                  @sprites["movesel"].index=0
                  drawSelectedMove(@pokemon,moveToLearn,@pokemon.moves[0].id)
                  pbFadeInAndShow(@sprites)
                  end

                  def pbEndScene
                  pbFadeOutAndHide(@sprites) { pbUpdate }
                  pbDisposeSpriteHash(@sprites)
                  @typebitmap.dispose
                  @viewport.dispose
                  end

                  def drawMarkings(bitmap,x,y,width,height,markings)
                  totaltext=""
                  oldfontname=bitmap.font.name
                  oldfontsize=bitmap.font.size
                  oldfontcolor=bitmap.font.color
                  bitmap.font.size=24
                  bitmap.font.name="Arial"
                  PokemonStorage::MARKINGCHARS.each{|item| totaltext+=item }
                  totalsize=bitmap.text_size(totaltext)
                  realX=x+(width/2)-(totalsize.width/2)
                  realY=y+(height/2)-(totalsize.height/2)
                  i=0
                  PokemonStorage::MARKINGCHARS.each{|item|
                  marked=(markings&(1<<i))!=0
                  bitmap.font.color=(marked) ? Color.new(72,64,56) : Color.new(184,184,160)
                  itemwidth=bitmap.text_size(item).width
                  bitmap.draw_text(realX,realY,itemwidth+2,totalsize.height,item)
                  realX+=itemwidth
                  i+=1
                  }
                  bitmap.font.name=oldfontname
                  bitmap.font.size=oldfontsize
                  bitmap.font.color=oldfontcolor
                  end

                  def drawPageOne(pokemon)
                  if pokemon.isEgg?
                  drawPageOneEgg(pokemon)
                  return
                  end
                  [email protected]["overlay"].bitmap
                  overlay.clear
                  @sprites["background"].setBitmap("Graphics/Pictures/summary1")
                  imagepos=[]
                  if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
                  status=6 if pbPokerus(pokemon)==1
                  [email protected] if @pokemon.status>0
                  status=5 if pokemon.hp==0
                  imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
                  end
                  if pokemon.isShiny?
                  imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134,0,0,-1,-1])
                  end
                  if pbPokerus(pokemon)==2
                  imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),176,100,0,0,-1,-1])
                  end
                  [email protected] ? @pokemon.ballused : 0
                  ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
                  imagepos.push([ballimage,14,60,0,0,-1,-1])
                  if (pokemon.isShadow? rescue false)
                  imagepos.push(["Graphics/Pictures/summaryShadow",224,240,0,0,-1,-1])
                  shadowfract=pokemon.heartgauge*1.0/PokeBattle_Pokemon::HEARTGAUGESIZE
                  imagepos.push(["Graphics/Pictures/summaryShadowBar",242,280,0,0,(shadowfract*248).floor,-1])
                  end
                  pbDrawImagePositions(overlay,imagepos)
                  base=Color.new(248,248,248)
                  shadow=Color.new(104,104,104)
                  pbSetSystemFont(overlay)
                  numberbase=(pokemon.isShiny?) ? Color.new(248,56,32) : Color.new(64,64,64)
                  numbershadow=(pokemon.isShiny?) ? Color.new(224,152,144) : Color.new(176,176,176)
                  publicID=pokemon.publicID
                  speciesname=PBSpecies.getName(pokemon.species)
                  itemname=pokemon.hasItem? ? PBItems.getName(pokemon.item) : _INTL("None")
                  growthrate=pokemon.growthrate
                  startexp=PBExperience.pbGetStartExperience(pokemon.level,growthrate)
                  endexp=PBExperience.pbGetStartExperience(pokemon.level+1,growthrate)
                  [email protected]
                  textpos=[
                  [_INTL(" "),26,16,0,base,shadow],
                  [pokename,46,62,0,base,shadow],
                  [pokemon.level.to_s,46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
                  [_INTL("Item"),16,320,0,base,shadow],
                  [itemname,16,352,0,Color.new(64,64,64),Color.new(176,176,176)],
                  [_ISPRINTF("Dex No."),238,80,0,base,shadow],
                  [sprintf("%03d",pokemon.species),435,80,2,numberbase,numbershadow],
                  [_INTL("Species"),238,112,0,base,shadow],
                  [speciesname,435,112,2,Color.new(64,64,64),Color.new(176,176,176)],
                  [_INTL("Type"),238,144,0,base,shadow],
                  [_INTL("OT"),238,176,0,base,shadow],
                  [_INTL("ID No."),238,208,0,base,shadow],
                  ]
                  if (pokemon.isShadow? rescue false)
                  textpos.push([_INTL("Heart Gauge"),238,240,0,base,shadow])
                  heartmessage=[_INTL("The door to its heart is open! Undo the final lock!"),
                  _INTL("The door to its heart is almost fully open."),
                  _INTL("The door to its heart is nearly open."),
                  _INTL("The door to its heart is opening wider."),
                  _INTL("The door to its heart is opening up."),
                  _INTL("The door to its heart is tightly shut.")
                  ][pokemon.heartStage]
                  memo=sprintf("<c3=404040,B0B0B0>%s\n",heartmessage)
                  drawFormattedTextEx(overlay,238,304,276,memo)
                  else
                  textpos.push([_INTL("Exp. Points"),238,240,0,base,shadow])
                  textpos.push([sprintf("%d",pokemon.exp),488,272,1,Color.new(64,64,64),Color.new(176,176,176)])
                  textpos.push([_INTL("To Next Lv."),238,304,0,base,shadow])
                  textpos.push([sprintf("%d",endexp-pokemon.exp),488,336,1,Color.new(64,64,64),Color.new(176,176,176)])
                  end
                  idno=(pokemon.ot=="") ? "?????" : sprintf("%05d",publicID)
                  textpos.push([idno,435,208,2,Color.new(64,64,64),Color.new(176,176,176)])
                  if pokemon.ot==""
                  textpos.push([_INTL("RENTAL"),435,176,2,Color.new(64,64,64),Color.new(176,176,176)])
                  else
                  ownerbase=Color.new(64,64,64)
                  ownershadow=Color.new(176,176,176)
                  if pokemon.otgender==0 # male OT
                  ownerbase=Color.new(24,112,216)
                  ownershadow=Color.new(136,168,208)
                  elsif pokemon.otgender==1 # female OT
                  ownerbase=Color.new(248,56,32)
                  ownershadow=Color.new(224,152,144)
                  end
                  textpos.push([pokemon.ot,435,176,2,ownerbase,ownershadow])
                  end
                  if pokemon.isMale?
                  textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
                  elsif pokemon.isFemale?
                  textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
                  end
                  pbDrawTextPositions(overlay,textpos)
                  drawMarkings(overlay,15,291,72,20,pokemon.markings)
                  type1rect=Rect.new(0,pokemon.type1*28,64,28)
                  type2rect=Rect.new(0,pokemon.type2*28,64,28)
                  if pokemon.type1==pokemon.type2
                  overlay.blt(402,146,@typebitmap.bitmap,type1rect)
                  else
                  overlay.blt(370,146,@typebitmap.bitmap,type1rect)
                  overlay.blt(436,146,@typebitmap.bitmap,type2rect)
                  end
                  if pokemon.level<PBExperience::MAXLEVEL
                  overlay.fill_rect(362,372,(pokemon.exp-startexp)*128/(endexp-startexp),2,Color.new(72,120,160))
                  overlay.fill_rect(362,374,(pokemon.exp-startexp)*128/(endexp-startexp),4,Color.new(24,144,248))
                  end
                  end

                  def drawPageOneEgg(pokemon)
                  [email protected]["overlay"].bitmap
                  overlay.clear
                  @sprites["background"].setBitmap("Graphics/Pictures/summaryEgg")
                  imagepos=[]
                  [email protected] ? @pokemon.ballused : 0
                  ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
                  imagepos.push([ballimage,14,60,0,0,-1,-1])
                  pbDrawImagePositions(overlay,imagepos)
                  base=Color.new(248,248,248)
                  shadow=Color.new(104,104,104)
                  pbSetSystemFont(overlay)
                  itemname=pokemon.hasItem? ? PBItems.getName(pokemon.item) : _INTL("None")
                  textpos=[
                  [_INTL(" "),26,16,0,base,shadow],
                  [pokemon.name,46,62,0,base,shadow],
                  [_INTL("Item"),16,320,0,base,shadow],
                  [itemname,16,352,0,Color.new(64,64,64),Color.new(176,176,176)],
                  ]
                  pbDrawTextPositions(overlay,textpos)
                  memo=""
                  if pokemon.timeReceived
                  month=pbGetAbbrevMonthName(pokemon.timeReceived.mon)
                  date=pokemon.timeReceived.day
                  year=pokemon.timeReceived.year
                  memo+=_INTL("<c3=404040,B0B0B0>{1} {2}, {3}\n",month,date,year)
                  end
                  mapname=pbGetMapNameFromId(pokemon.obtainMap)
                  if (pokemon.obtainText rescue false) && pokemon.obtainText!=""
                  mapname=pokemon.obtainText
                  end
                  if mapname && mapname!=""
                  memo+=_INTL("<c3=404040,B0B0B0>A mysterious Pokémon Egg received from <c3=F83820,E09890>{1}<c3=404040,B0B0B0>.\n",mapname)
                  end
                  memo+="<c3=404040,B0B0B0>\n"
                  memo+=_INTL("<c3=404040,B0B0B0>\"The Egg Watch\"\n")
                  eggstate=_INTL("It looks like this Egg will take a long time to hatch.")
                  eggstate=_INTL("What will hatch from this? It doesn't seem close to hatching.") if pokemon.eggsteps<10200
                  eggstate=_INTL("It appears to move occasionally. It may be close to hatching.") if pokemon.eggsteps<2550
                  eggstate=_INTL("Sounds can be heard coming from inside! It will hatch soon!") if pokemon.eggsteps<1275
                  memo+=sprintf("<c3=404040,B0B0B0>%s\n",eggstate)
                  drawFormattedTextEx(overlay,232,78,276,memo)
                  drawMarkings(overlay,15,291,72,20,pokemon.markings)
                  end

                  def drawPageTwo(pokemon)
                  [email protected]["overlay"].bitmap
                  overlay.clear
                  @sprites["background"].setBitmap("Graphics/Pictures/summary2")
                  imagepos=[]
                  if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
                  status=6 if pbPokerus(pokemon)==1
                  [email protected] if @pokemon.status>0
                  status=5 if pokemon.hp==0
                  imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
                  end
                  if pokemon.isShiny?
                  imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134,0,0,-1,-1])
                  end
                  if pbPokerus(pokemon)==2
                  imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),176,100,0,0,-1,-1])
                  end
                  [email protected] ? @pokemon.ballused : 0
                  ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
                  imagepos.push([ballimage,14,60,0,0,-1,-1])
                  zodiactoken=sprintf("Graphics/Pictures/Birthsigns/token%02d",zodiacValue(@pokemon.timeEggHatched.mon))
                  if @pokemon.obtainMode==1
                  imagepos.push([zodiactoken,150,260,0,0,-1,-1])
                  end
                  pbDrawImagePositions(overlay,imagepos)
                  base=Color.new(248,248,248)
                  shadow=Color.new(104,104,104)
                  pbSetSystemFont(overlay)
                  naturename=PBNatures.getName(pokemon.nature)
                  itemname=pokemon.hasItem? ? PBItems.getName(pokemon.item) : _INTL("None")
                  [email protected]
                  textpos=[
                  [_INTL(" "),26,16,0,base,shadow],
                  [pokename,46,62,0,base,shadow],
                  [pokemon.level.to_s,46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
                  [_INTL(" "),16,320,0,base,shadow],
                  [itemname,16,352,0,Color.new(64,64,64),Color.new(176,176,176)],
                  ]
                  if pokemon.isMale?
                  textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
                  elsif pokemon.isFemale?
                  textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
                  end
                  pbDrawTextPositions(overlay,textpos)
                  memo=""
                  shownature=(!(pokemon.isShadow? rescue false)) || pokemon.heartStage<=3
                  if shownature
                  memo+=_INTL("<c3=F83820,E09890>{1}<c3=404040,B0B0B0> nature.\n",naturename)
                  end
                  if pokemon.timeReceived
                  month=pbGetAbbrevMonthName(pokemon.timeReceived.mon)
                  date=pokemon.timeReceived.day
                  year=pokemon.timeReceived.year
                  memo+=_INTL("<c3=404040,B0B0B0>{1} {2}, {3}\n",month,date,year)
                  end
                  mapname=pbGetMapNameFromId(pokemon.obtainMap)
                  if (pokemon.obtainText rescue false) && pokemon.obtainText!=""
                  mapname=pokemon.obtainText
                  end
                  if mapname && mapname!=""
                  memo+=sprintf("<c3=F83820,E09890>%s\n",mapname)
                  else
                  memo+=_INTL("<c3=F83820,E09890>Faraway place\n")
                  end
                  if pokemon.obtainMode
                  mettext=[_INTL("Encontrado a Nivel {1}.",pokemon.obtainLevel),
                  _INTL("Huevo recibido."),
                  _INTL("Intercambiado a nivel {1}.",pokemon.obtainLevel),
                  "",
                  _INTL("Fue Encontrado a {1}.",pokemon.obtainLevel)
                  ][pokemon.obtainMode]
                  memo+=sprintf("<c3=404040,B0B0B0>%s\n",mettext)
                  if pokemon.obtainMode==1 # hatched
                  if pokemon.timeEggHatched
                  month=pbGetAbbrevMonthName(pokemon.timeEggHatched.mon)
                  date=pokemon.timeEggHatched.day
                  year=pokemon.timeEggHatched.year
                  memo+=_INTL("<c3=404040,B0B0B0>{1} {2}, {3}\n",month,date,year)
                  end
                  mapname=pbGetMapNameFromId(pokemon.hatchedMap)
                  if mapname && mapname!=""
                  memo+=sprintf("<c3=F83820,E09890>%s\n",mapname)
                  else
                  memo+=_INTL("<c3=F83820,E09890>Faraway place\n")
                  end
                  memo+=_INTL("<c3=404040,B0B0B0>Egg hatched.\n")
                  else
                  memo+="<c3=404040,B0B0B0>\n"
                  end
                  end
                  if shownature
                  bestiv=0
                  tiebreaker=pokemon.personalID%6
                  for i in 0...6
                  if pokemon.iv[i]==pokemon.iv[bestiv]
                  bestiv=i if i>=tiebreaker && bestiv<tiebreaker
                  elsif pokemon.iv[i]>pokemon.iv[bestiv]
                  bestiv=i
                  end
                  end
                  characteristic=[_INTL("Loves to eat."),
                  _INTL("Often dozes off."),
                  _INTL("Often scatters things."),
                  _INTL("Scatters things often."),
                  _INTL("Likes to relax."),
                  _INTL("Proud of its power."),
                  _INTL("Likes to thrash about."),
                  _INTL("A little quick tempered."),
                  _INTL("Likes to fight."),
                  _INTL("Quick tempered."),
                  _INTL("Sturdy body."),
                  _INTL("Capable of taking hits."),
                  _INTL("Highly persistent."),
                  _INTL("Good endurance."),
                  _INTL("Good perseverance."),
                  _INTL("Likes to run."),
                  _INTL("Alert to sounds."),
                  _INTL("Impetuous and silly."),
                  _INTL("Somewhat of a clown."),
                  _INTL("Quick to flee."),
                  _INTL("Highly curious."),
                  _INTL("Mischievous."),
                  _INTL("Thoroughly cunning."),
                  _INTL("Often lost in thought."),
                  _INTL("Very finicky."),
                  _INTL("Strong willed."),
                  _INTL("Somewhat vain."),
                  _INTL("Strongly defiant."),
                  _INTL("Hates to lose."),
                  _INTL("Somewhat stubborn.")
                  ][bestiv*5+pokemon.iv[bestiv]%5]
                  memo+=sprintf("<c3=404040,B0B0B0>%s\n",characteristic)
                  end
                  drawFormattedTextEx(overlay,232,78,276,memo)
                  drawMarkings(overlay,15,291,72,20,pokemon.markings)
                  end

                  def drawPageThree(pokemon)
                  [email protected]["overlay"].bitmap
                  overlay.clear
                  @sprites["background"].setBitmap("Graphics/Pictures/summary3")
                  imagepos=[]
                  if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
                  status=6 if pbPokerus(pokemon)==1
                  [email protected] if @pokemon.status>0
                  status=5 if pokemon.hp==0
                  imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
                  end
                  if pokemon.isShiny?
                  imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134,0,0,-1,-1])
                  end
                  if pbPokerus(pokemon)==2
                  imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),176,100,0,0,-1,-1])
                  end
                  [email protected] ? @pokemon.ballused : 0
                  ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
                  imagepos.push([ballimage,14,60,0,0,-1,-1])
                  zodiactoken=sprintf("Graphics/Pictures/Birthsigns/token%02d",zodiacValue(@pokemon.timeEggHatched.mon))
                  if @pokemon.obtainMode==1
                  imagepos.push([zodiactoken,150,260,0,0,-1,-1])
                  end
                  pbDrawImagePositions(overlay,imagepos)
                  base=Color.new(248,248,248)
                  shadow=Color.new(104,104,104)
                  statshadows=[]
                  for i in 0...5; statshadows[i]=shadow; end
                  if !(pokemon.isShadow? rescue false) || pokemon.heartStage<=3
                  natup=(pokemon.nature/5).floor
                  natdn=(pokemon.nature%5).floor
                  statshadows[natup]=Color.new(136,96,72) if natup!=natdn
                  statshadows[natdn]=Color.new(64,120,152) if natup!=natdn
                  end
                  pbSetSystemFont(overlay)
                  abilityname=PBAbilities.getName(pokemon.ability)
                  abilitydesc=pbGetMessage(MessageTypes::AbilityDescs,pokemon.ability)
                  itemname=pokemon.hasItem? ? PBItems.getName(pokemon.item) : _INTL("None")
                  [email protected]
                  textpos=[
                  [_INTL(" "),26,16,0,base,shadow],
                  [pokename,46,62,0,base,shadow],
                  [pokemon.level.to_s,46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
                  [_INTL("Item"),16,320,0,base,shadow],
                  [itemname,16,352,0,Color.new(64,64,64),Color.new(176,176,176)],
                  [_INTL("HP"),292,76,2,base,shadow],
                  [sprintf("%3d/%3d",pokemon.hp,pokemon.totalhp),462,76,1,Color.new(64,64,64),Color.new(176,176,176)],
                  [_INTL("Attack"),248,120,0,base,statshadows[0]],
                  [sprintf("%d",pokemon.attack),456,120,1,Color.new(64,64,64),Color.new(176,176,176)],
                  [_INTL("Defense"),248,152,0,base,statshadows[1]],
                  [sprintf("%d",pokemon.defense),456,152,1,Color.new(64,64,64),Color.new(176,176,176)],
                  [_INTL("Sp. Atk"),248,184,0,base,statshadows[3]],
                  [sprintf("%d",pokemon.spatk),456,184,1,Color.new(64,64,64),Color.new(176,176,176)],
                  [_INTL("Sp. Def"),248,216,0,base,statshadows[4]],
                  [sprintf("%d",pokemon.spdef),456,216,1,Color.new(64,64,64),Color.new(176,176,176)],
                  [_INTL("Speed"),248,248,0,base,statshadows[2]],
                  [sprintf("%d",pokemon.speed),456,248,1,Color.new(64,64,64),Color.new(176,176,176)],
                  [_INTL("Ability"),224,284,0,base,shadow],
                  [abilityname,362,284,0,Color.new(64,64,64),Color.new(176,176,176)],
                  ]
                  if pokemon.isMale?
                  textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
                  elsif pokemon.isFemale?
                  textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
                  end
                  pbDrawTextPositions(overlay,textpos)
                  drawTextEx(overlay,224,316,282,2,abilitydesc,Color.new(64,64,64),Color.new(176,176,176))
                  drawMarkings(overlay,15,291,72,20,pokemon.markings)
                  if pokemon.hp>0
                  hpcolors=[
                  Color.new(24,192,32),Color.new(0,144,0), # Green
                  Color.new(248,184,0),Color.new(184,112,0), # Orange
                  Color.new(240,80,32),Color.new(168,48,56) # Red
                  ]
                  hpzone=0
                  hpzone=1 if pokemon.hp<=(@pokemon.totalhp/2).floor
                  hpzone=2 if pokemon.hp<=(@pokemon.totalhp/4).floor
                  overlay.fill_rect(360,110,pokemon.hp*96/pokemon.totalhp,2,hpcolors[hpzone*2+1])
                  overlay.fill_rect(360,112,pokemon.hp*96/pokemon.totalhp,4,hpcolors[hpzone*2])
                  end
                  end

                  def drawPageFour(pokemon)
                  [email protected]["overlay"].bitmap
                  overlay.clear
                  [email protected]["overlay2"].bitmap
                  overlay2.clear
                  @sprites["background"].setBitmap("Graphics/Pictures/summary4")
                  @sprites["overlaytxt"].visible=false
                  @sprites["pokemon"].visible=true
                  @sprites["pokeicon"].visible=false
                  imagepos=[]
                  if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
                  status=6 if pbPokerus(pokemon)==1
                  [email protected] if @pokemon.status>0
                  status=5 if pokemon.hp==0
                  imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
                  end
                  if pokemon.isShiny?
                  imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134,0,0,-1,-1])
                  end
                  if pbPokerus(pokemon)==2
                  imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),176,100,0,0,-1,-1])
                  end
                  [email protected] ? @pokemon.ballused : 0
                  ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
                  imagepos.push([ballimage,14,60,0,0,-1,-1])
                  zodiactoken=sprintf("Graphics/Pictures/Birthsigns/token%02d",zodiacValue(@pokemon.timeEggHatched.mon))
                  if @pokemon.obtainMode==1
                  imagepos.push([zodiactoken,150,260,0,0,-1,-1])
                  end
                  pbDrawImagePositions(overlay,imagepos)
                  base=Color.new(248,248,248)
                  shadow=Color.new(104,104,104)
                  pbSetSystemFont(overlay)
                  itemname=pokemon.hasItem? ? PBItems.getName(pokemon.item) : _INTL("None")
                  [email protected]
                  textpos=[
                  [_INTL(" "),26,16,0,base,shadow],
                  [pokename,46,62,0,base,shadow],
                  [pokemon.level.to_s,46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
                  [_INTL("Item"),16,320,0,base,shadow],
                  [itemname,16,352,0,Color.new(64,64,64),Color.new(176,176,176)],
                  ]
                  if pokemon.isMale?
                  textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
                  elsif pokemon.isFemale?
                  textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
                  end
                  pbDrawTextPositions(overlay,textpos)
                  imagepos=[]
                  yPos=98
                  for i in 0...pokemon.moves.length
                  if pokemon.moves[i].id>0
                  imagepos.push(["Graphics/Pictures/types",248,yPos+2,0,
                  pokemon.moves[i].type*28,64,28])
                  textpos.push([PBMoves.getName(pokemon.moves[i].id),316,yPos,0,
                  Color.new(64,64,64),Color.new(176,176,176)])
                  if pokemon.moves[i].totalpp>0
                  textpos.push([_ISPRINTF("PP"),342,yPos+32,0,
                  Color.new(64,64,64),Color.new(176,176,176)])
                  textpos.push([sprintf("%d/%d",pokemon.moves[i].pp,pokemon.moves[i].totalpp),
                  460,yPos+32,1,Color.new(64,64,64),Color.new(176,176,176)])
                  end
                  else
                  textpos.push(["-",316,yPos,0,Color.new(64,64,64),Color.new(176,176,176)])
                  textpos.push(["--",442,yPos+32,1,Color.new(64,64,64),Color.new(176,176,176)])
                  end
                  yPos+=64
                  end
                  pbDrawTextPositions(overlay,textpos)
                  pbDrawImagePositions(overlay,imagepos)
                  drawMarkings(overlay,15,291,72,20,pokemon.markings)
                  end

                  def drawSelectedMove(pokemon,moveToLearn,moveid)
                  [email protected]["overlay"].bitmap
                  [email protected]["overlay2"].bitmap
                  overlay2.clear
                  @sprites["overlay2"].y=0
                  @sprites["pokemon"].visible=false if @sprites["pokemon"]
                  @sprites["pokeicon"].setBitmap(pbPokemonIconFile(pokemon))
                  @sprites["pokeicon"].src_rect=Rect.new(0,0,64,64)
                  @sprites["pokeicon"].visible=true
                  movedata=PBMoveData.new(moveid)
                  basedamage=movedata.basedamage
                  type=movedata.type
                  category=movedata.category
                  accuracy=movedata.accuracy
                  drawMoveSelection(pokemon,moveToLearn)
                  pbSetSystemFont(overlay)
                  pbSetSystemFont(overlay2)
                  move=moveid
                  textpos=[
                  [basedamage<=1 ? basedamage==1 ? "???" : "---" : sprintf("%d",basedamage),
                  216,154,1,Color.new(64,64,64),Color.new(176,176,176)],
                  [accuracy==0 ? "---" : sprintf("%d",accuracy),
                  216,186,1,Color.new(64,64,64),Color.new(176,176,176)]
                  ]
                  pbDrawTextPositions(overlay,textpos)
                  imagepos=[["Graphics/Pictures/category",166,124,0,category*28,64,28]]
                  pbDrawImagePositions(overlay,imagepos)
                  desclength=pbGetMessage(MessageTypes::MoveDescriptions,moveid)
                  desclength=getLineBrokenChunks(overlay2,desclength,238,nil,true)
                  $desclength=desclength.collect{|x| x[1]}.grep(0).size
                  drawTextEx(overlay2,4,0,238,$desclength,
                  pbGetMessage(MessageTypes::MoveDescriptions,moveid),
                  Color.new(64,64,64),Color.new(176,176,176))
                  end

                  def drawMoveSelection(pokemon,moveToLearn)
                  [email protected]["overlay"].bitmap
                  overlay.clear
                  [email protected]["overlay2"].bitmap
                  overlay2.clear
                  base=Color.new(248,248,248)
                  shadow=Color.new(104,104,104)
                  @sprites["background"].setBitmap("Graphics/Pictures/summary4details")
                  if moveToLearn!=0
                  @sprites["background"].setBitmap("Graphics/Pictures/summary4learning")
                  end
                  @sprites["overlaytxt"].setBitmap("Graphics/Pictures/summary4overlay")
                  pbSetSystemFont(overlay)
                  pbSetSystemFont(overlay2)
                  textpos=[
                  [_INTL("MOVES"),26,16,0,base,shadow],
                  [_INTL("CATEGORY"),20,122,0,base,shadow],
                  [_INTL("POWER"),20,154,0,base,shadow],
                  [_INTL("ACCURACY"),20,186,0,base,shadow]
                  ]
                  type1rect=Rect.new(0,pokemon.type1*28,64,28)
                  type2rect=Rect.new(0,pokemon.type2*28,64,28)
                  if pokemon.type1==pokemon.type2
                  overlay.blt(130,78,@typebitmap.bitmap,type1rect)
                  else
                  overlay.blt(96,78,@typebitmap.bitmap,type1rect)
                  overlay.blt(166,78,@typebitmap.bitmap,type2rect)
                  end
                  imagepos=[]
                  yPos=98
                  yPos-=76 if moveToLearn!=0
                  for i in 0...5
                  moveobject=nil
                  if i==4
                  moveobject=PBMove.new(moveToLearn) if moveToLearn!=0
                  yPos+=20
                  else
                  moveobject=pokemon.moves[i]
                  end
                  if moveobject
                  if moveobject.id!=0
                  imagepos.push(["Graphics/Pictures/types",248,yPos+2,0,
                  moveobject.type*28,64,28])
                  textpos.push([PBMoves.getName(moveobject.id),316,yPos,0,
                  Color.new(64,64,64),Color.new(176,176,176)])
                  if moveobject.totalpp>0
                  textpos.push([_ISPRINTF("PP"),342,yPos+32,0,
                  Color.new(64,64,64),Color.new(176,176,176)])
                  textpos.push([sprintf("%d/%d",moveobject.pp,moveobject.totalpp),
                  460,yPos+32,1,Color.new(64,64,64),Color.new(176,176,176)])
                  end
                  else
                  textpos.push(["-",316,yPos,0,Color.new(64,64,64),Color.new(176,176,176)])
                  textpos.push(["--",442,yPos+32,1,Color.new(64,64,64),Color.new(176,176,176)])
                  end
                  end
                  yPos+=64
                  end
                  pbDrawTextPositions(overlay,textpos)
                  pbDrawImagePositions(overlay,imagepos)
                  end

                  def drawPageFive(pokemon)
                  [email protected]["overlay"].bitmap
                  overlay.clear
                  [email protected]["overlay2"].bitmap
                  overlay2.clear
                  @sprites["background"].setBitmap("Graphics/Pictures/summary5")
                  imagepos=[]
                  if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
                  status=6 if pbPokerus(pokemon)==1
                  [email protected] if @pokemon.status>0
                  status=5 if pokemon.hp==0
                  imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
                  end
                  if pokemon.isShiny?
                  imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134,0,0,-1,-1])
                  end
                  if pbPokerus(pokemon)==2
                  imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),176,100,0,0,-1,-1])
                  end
                  [email protected] ? @pokemon.ballused : 0
                  ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
                  imagepos.push([ballimage,14,60,0,0,-1,-1])
                  zodiactoken=sprintf("Graphics/Pictures/Birthsigns/token%02d",zodiacValue(@pokemon.timeEggHatched.mon))
                  if @pokemon.obtainMode==1
                  imagepos.push([zodiactoken,150,260,0,0,-1,-1])
                  end
                  pbDrawImagePositions(overlay,imagepos)
                  base=Color.new(248,248,248)
                  shadow=Color.new(104,104,104)
                  pbSetSystemFont(overlay)
                  itemname=pokemon.hasItem? ? PBItems.getName(pokemon.item) : _INTL("None")
                  [email protected]
                  textpos=[
                  [_INTL(" "),26,16,0,base,shadow],
                  [pokename,46,62,0,base,shadow],
                  [pokemon.level.to_s,46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
                  [_INTL("Item"),16,320,0,base,shadow],
                  [itemname,16,352,0,Color.new(64,64,64),Color.new(176,176,176)],
                  [_INTL("No. de Listones:"),234,342,0,Color.new(64,64,64),Color.new(176,176,176)],
                  [pokemon.ribbonCount.to_s,450,342,1,Color.new(64,64,64),Color.new(176,176,176)],
                  ]
                  if pokemon.isMale?
                  textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
                  elsif pokemon.isFemale?
                  textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
                  end
                  pbDrawTextPositions(overlay,textpos)
                  imagepos=[]
                  coord=0
                  if pokemon.ribbons
                  for i in pokemon.ribbons
                  ribn=i-1
                  imagepos.push(["Graphics/Pictures/ribbons",236+64*(coord%4),86+80*(coord/4).floor,
                  64*(ribn%8),64*(ribn/8).floor,64,64])
                  coord+=1
                  break if coord>=12
                  end
                  end
                  pbDrawImagePositions(overlay,imagepos)
                  drawMarkings(overlay,15,291,72,20,pokemon.markings)
                  end

                  def pbChooseMoveToForget(moveToLearn)
                  selmove=0
                  ret=0
                  descpos=0
                  maxmove=(moveToLearn>0) ? 4 : 3
                  loop do
                  Graphics.update
                  Input.update
                  pbUpdate
                  if Input.trigger?(Input::B)
                  ret=4
                  break
                  end
                  if Input.trigger?(Input::C)
                  break
                  end
                  if Input.trigger?(Input::DOWN)
                  descpos=0
                  selmove+=1
                  if selmove<4 && selmove>[email protected]
                  selmove=(moveToLearn>0) ? maxmove : 0
                  end
                  selmove=0 if selmove>maxmove
                  @sprites["movesel"].index=selmove
                  newmove=(selmove==4) ? moveToLearn : @pokemon.moves[selmove].id
                  drawSelectedMove(@pokemon,moveToLearn,newmove)
                  ret=selmove
                  end
                  if Input.trigger?(Input::UP)
                  descpos=0
                  selmove-=1
                  selmove=maxmove if selmove<0
                  if selmove<4 && selmove>[email protected]
                  [email protected]
                  end
                  @sprites["movesel"].index=selmove
                  newmove=(selmove==4) ? moveToLearn : @pokemon.moves[selmove].id
                  drawSelectedMove(@pokemon,moveToLearn,newmove)
                  ret=selmove
                  end
                  if Input.trigger?(Input::L) || Input.repeat?(Input::L)
                  if descpos>0
                  descpos-=1
                  @sprites["overlay2"].y+=32
                  end
                  end
                  if Input.trigger?(Input::R) || Input.repeat?(Input::R)
                  if descpos<$desclength-5 && descpos>=0 && $desclength>5
                  descpos+=1
                  @sprites["overlay2"].y-=32
                  end
                  end
                  if descpos %2 == 1
                  @sprites["overlaytxt"].visible=true
                  else
                  @sprites["overlaytxt"].visible=false
                  end
                  end
                  return (ret==4) ? -1 : ret
                  end

                  def pbMoveSelection
                  @sprites["movesel"].visible=true
                  @sprites["movesel"].index=0
                  selmove=0
                  oldselmove=0
                  switching=false
                  drawSelectedMove(@pokemon,0,@pokemon.moves[selmove].id)
                  descpos=0
                  loop do
                  Graphics.update
                  Input.update
                  pbUpdate
                  if @sprites["movepresel"][email protected]["movesel"].index
                  @sprites["movepresel"][email protected]["movesel"].z+1
                  else
                  @sprites["movepresel"][email protected]["movesel"].z
                  end
                  if Input.trigger?(Input::B)
                  break if !switching
                  @sprites["movepresel"].visible=false
                  switching=false
                  end
                  if Input.trigger?(Input::C)
                  if selmove==4
                  break if !switching
                  @sprites["movepresel"].visible=false
                  switching=false
                  else
                  if !(@pokemon.isShadow? rescue false)
                  if !switching
                  @sprites["movepresel"].index=selmove
                  oldselmove=selmove
                  @sprites["movepresel"].visible=true
                  switching=true
                  else
                  [email protected][oldselmove]
                  @pokemon.moves[oldselmove][email protected][selmove]
                  @pokemon.moves[selmove]=tmpmove
                  @sprites["movepresel"].visible=false
                  switching=false
                  drawSelectedMove(@pokemon,0,@pokemon.moves[selmove].id)
                  end
                  end
                  end
                  end
                  if Input.trigger?(Input::DOWN)
                  descpos=0
                  selmove+=1
                  selmove=0 if selmove<4 && selmove>[email protected]
                  selmove=0 if selmove>=4
                  selmove=4 if selmove<0
                  @sprites["movesel"].index=selmove
                  [email protected][selmove].id
                  pbPlayCursorSE()
                  drawSelectedMove(@pokemon,0,@pokemon.moves[selmove].id)
                  end
                  if Input.trigger?(Input::UP)
                  descpos=0
                  selmove-=1
                  if selmove<4 && selmove>[email protected]
                  [email protected]
                  end
                  selmove=0 if selmove>=4
                  [email protected] if selmove<0
                  @sprites["movesel"].index=selmove
                  [email protected][selmove].id
                  pbPlayCursorSE()
                  drawSelectedMove(@pokemon,0,@pokemon.moves[selmove].id)
                  end
                  if Input.trigger?(Input::L) || Input.repeat?(Input::L)
                  if descpos>0
                  descpos-=1
                  @sprites["overlay2"].y+=32
                  end
                  end
                  if Input.trigger?(Input::R) || Input.repeat?(Input::R)
                  if descpos<$desclength-5 && descpos>=0 && $desclength>5
                  descpos+=1
                  @sprites["overlay2"].y-=32
                  end
                  end
                  if descpos %2 == 1
                  @sprites["overlaytxt"].visible=true
                  else
                  @sprites["overlaytxt"].visible=false
                  end
                  end
                  @sprites["movesel"].visible=false
                  end
                  #=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
                  # Birthsign Page
                  #=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
                  def drawBirthsignPage(pokemon)
                  [email protected]["overlay"].bitmap
                  overlay.clear
                  @sprites["background"].setBitmap("Graphics/Pictures/Birthsigns/summaryzodiac")
                  imagepos=[]
                  zodiacimage=sprintf("Graphics/Pictures/Birthsigns/birthsign%02d",zodiacValue(@pokemon.timeEggHatched.mon))
                  imagepos.push([zodiacimage,0,0,0,0,-1,-1])
                  imagepos.push(["Graphics/Pictures/Birthsigns/summaryzboarder",0,0,0,0,-1,-1])
                  zodiactoken=sprintf("Graphics/Pictures/Birthsigns/token%02d",zodiacValue(@pokemon.timeEggHatched.mon))
                  imagepos.push([zodiactoken,4,122,0,0,-1,-1])
                  pbDrawImagePositions(overlay,imagepos)
                  [email protected]
                  zodiac=pbGetZodiacName(zodiacValue(@pokemon.timeEggHatched.mon))
                  zodiacdesc=pbGetZodiacDesc(zodiacValue(@pokemon.timeEggHatched.mon))
                  base=Color.new(248,248,248)
                  shadow=Color.new(104,104,104)
                  pbSetSystemFont(overlay)
                  textpos=[
                  [_INTL("BIRTHSIGN"),26,16,0,base,shadow],
                  [_INTL("{1}'s Birthsign",pokename),8,62,0,base,shadow],
                  [zodiac,42,90,0,Color.new(64,64,64),Color.new(176,176,176)]
                  ]
                  if pokemon.obtainMode==1
                  if pokemon.timeEggHatched
                  month=pbGetAbbrevMonthName(pokemon.timeEggHatched.mon)
                  date=pokemon.timeEggHatched.day
                  year=pokemon.timeEggHatched.year
                  textpos.push([_INTL("Birthday: {1} {2}, {3}\n",month,date,year),4,320,0,base,shadow])
                  end
                  end
                  #If you changed the range of dates for any of the Birthsigns in PField_Time, then you need to
                  #change the text in the section below to match your new date ranges.
                  #
                  #If you changed the names for any of the Birthsigns in PField_Time, then you need to change
                  #the text in the section below to match your new names. Changes must also be made in
                  #PScreen_Party, and PScreen_EggHatching.
                  if pokemon.birthsign==_INTL("'The Apprentice'")
                  textpos.push([_INTL("Sign: Jan. 1st - 31st"),4,352,0,Color.new(64,64,64),Color.new(176,176,176)])
                  elsif pokemon.birthsign==_INTL("'The Companion'")
                  textpos.push([_INTL("Sign: Feb. 1st - 28th"),4,352,0,Color.new(64,64,64),Color.new(176,176,176)])
                  elsif pokemon.birthsign==_INTL("'The Beacon'")
                  textpos.push([_INTL("Sign: Mar. 1st - 31st"),4,352,0,Color.new(64,64,64),Color.new(176,176,176)])
                  elsif pokemon.birthsign==_INTL("'The Savage'")
                  textpos.push([_INTL("Sign: Apr. 1st - 30th"),4,352,0,Color.new(64,64,64),Color.new(176,176,176)])
                  elsif pokemon.birthsign==_INTL("'The Prodigy'")
                  textpos.push([_INTL("Sign: May. 1st - 31st"),4,352,0,Color.new(64,64,64),Color.new(176,176,176)])
                  elsif pokemon.birthsign==_INTL("'The Martyr'")
                  textpos.push([_INTL("Sign: Jun. 1st - 30th"),4,352,0,Color.new(64,64,64),Color.new(176,176,176)])
                  elsif pokemon.birthsign==_INTL("'The Maiden'")
                  textpos.push([_INTL("Sign: Jul. 1st - 31st"),4,352,0,Color.new(64,64,64),Color.new(176,176,176)])
                  elsif pokemon.birthsign==_INTL("'The Gladiator'")
                  textpos.push([_INTL("Sign: Aug. 1st - 31st"),4,352,0,Color.new(64,64,64),Color.new(176,176,176)])
                  elsif pokemon.birthsign==_INTL("'The Voyager'")
                  textpos.push([_INTL("Sign: Sep. 1st - 30th"),4,352,0,Color.new(64,64,64),Color.new(176,176,176)])
                  elsif pokemon.birthsign==_INTL("'The Thief'")
                  textpos.push([_INTL("Sign: Oct. 1st - 31st"),4,352,0,Color.new(64,64,64),Color.new(176,176,176)])
                  elsif pokemon.birthsign==_INTL("'The Glutton'")
                  textpos.push([_INTL("Sign: Nov. 1st - 30th"),4,352,0,Color.new(64,64,64),Color.new(176,176,176)])
                  elsif pokemon.birthsign==_INTL("'The Wishmaker'")
                  textpos.push([_INTL("Sign: Dec. 1st - 31st"),4,352,0,Color.new(64,64,64),Color.new(176,176,176)])
                  end
                  pbDrawTextPositions(overlay,textpos)
                  pbSetSmallFont(overlay)
                  #If you changed the description text for any of the Birthsigns in PField_Time,
                  #then you can adjust the positioning of the text in the following line.
                  drawTextEx(overlay,260,320,258,0,zodiacdesc,base,shadow)
                  end

                  #===============================================================================
                  def pbGoToPrevious
                  if @page!=0 && !(SHOWFAMILYEGG && @page==5)
                  [email protected]
                  while newindex>0
                  newindex-=1
                  if @party[newindex] && [email protected][newindex].isEgg?
                  @partyindex=newindex
                  break
                  end
                  end
                  else
                  [email protected]
                  while newindex>0
                  newindex-=1
                  if @party[newindex]
                  @partyindex=newindex
                  break
                  end
                  end
                  end
                  end

                  def pbGoToNext
                  if @page!=0 && !(SHOWFAMILYEGG && @page==5)
                  [email protected]
                  while newindex<@party.length-1
                  newindex+=1
                  if @party[newindex] && [email protected][newindex].isEgg?
                  @partyindex=newindex
                  break
                  end
                  end
                  else
                  newind[email protected]
                  while newindex<@party.length-1
                  newindex+=1
                  if @party[newindex]
                  @partyindex=newindex
                  break
                  end
                  end
                  end
                  end

                  def pbScene
                  pbPlayCry(@pokemon)
                  loop do
                  Graphics.update
                  Input.update
                  pbUpdate
                  if Input.trigger?(Input::B)
                  break
                  end
                  dorefresh=false
                  if Input.trigger?(Input::C)
                  if @page==0
                  break
                  elsif @page==3
                  pbMoveSelection
                  dorefresh=true
                  drawPageFour(@pokemon)
                  elsif @page==1 && @pokemon.obtainMode==1
                  drawBirthsignPage(@pokemon)
                  end
                  end
                  handleInputsEgg
                  if Input.trigger?(Input::UP) && @partyindex>0
                  pbGoToPrevious
                  @[email protected][@partyindex]
                  @sprites["pokemon"].setPokemonBitmap(@pokemon)
                  @sprites["pokemon"].color=Color.new(0,0,0,0)
                  pbPositionPokemonSprite(@sprites["pokemon"],40,144)
                  dorefresh=true
                  pbPlayCry(@pokemon)
                  end
                  if Input.trigger?(Input::DOWN) && @partyindex<@party.length-1
                  pbGoToNext
                  @[email protected][@partyindex]
                  @sprites["pokemon"].setPokemonBitmap(@pokemon)
                  @sprites["pokemon"].color=Color.new(0,0,0,0)
                  pbPositionPokemonSprite(@sprites["pokemon"],40,144)
                  dorefresh=true
                  pbPlayCry(@pokemon)
                  end
                  if Input.trigger?(Input::LEFT) && [email protected]?
                  [email protected]
                  @page-=1
                  @page=0 if @page<0
                  @page=5 if @page>5
                  dorefresh=true
                  if @page!=oldpage # Move to next page
                  pbPlayCursorSE()
                  dorefresh=true
                  end
                  end
                  if Input.trigger?(Input::RIGHT) && [email protected]?
                  [email protected]
                  @page+=1
                  @page=0 if @page<0
                  @page=5 if @page>5
                  if @page!=oldpage # Move to next page
                  pbPlayCursorSE()
                  dorefresh=true
                  end
                  end
                  if dorefresh
                  case @page
                  when 0
                  drawPageOne(@pokemon)
                  when 1
                  drawPageTwo(@pokemon)
                  when 2
                  drawPageThree(@pokemon)
                  when 3
                  drawPageFour(@pokemon)
                  when 4
                  drawPageFive(@pokemon)
                  when 5
                  drawPageSix(@pokemon)
                  end
                  end
                  end
                  return @partyindex
                  end
                  end



                  class PokemonSummary
                  def initialize(scene)
                  @scene=scene
                  end

                  def pbStartScreen(party,partyindex)
                  @scene.pbStartScene(party,partyindex)
                  [email protected]
                  @scene.pbEndScene
                  return ret
                  end

                  def pbStartForgetScreen(party,partyindex,moveToLearn)
                  ret=-1
                  @scene.pbStartForgetScene(party,partyindex,moveToLearn)
                  loop do
                  [email protected](moveToLearn)
                  if ret>=0 && moveToLearn!=0 && pbIsHiddenMove?(party[partyindex].moves[ret].id) && !$DEBUG
                  Kernel.pbMessage(_INTL("HM moves can't be forgotten now.")){ @scene.pbUpdate }
                  else
                  break
                  end
                  end
                  @scene.pbEndScene
                  return ret
                  end

                  def pbStartChooseMoveScreen(party,partyindex,message)
                  ret=-1
                  @scene.pbStartForgetScene(party,partyindex,0)
                  Kernel.pbMessage(message){ @scene.pbUpdate }
                  loop do
                  [email protected](0)
                  if ret<0
                  Kernel.pbMessage(_INTL("You must choose a move!")){ @scene.pbUpdate }
                  else
                  break
                  end
                  end
                  @scene.pbEndScene
                  return ret
                  end
                  end



                  PScreen_EggHatching,
                  Spoiler:
                  Quote:
                  #===============================================================================
                  # * Egg Hatch Animation - by FL (Credits will be apreciated)
                  # Tweaked by Maruno
                  #===============================================================================
                  # This script is for Pokémon Essentials. It's an egg hatch animation that
                  # works even with special eggs like Manaphy egg.
                  #===============================================================================
                  # To this script works, put it above Main and put a picture (a 5 frames
                  # sprite sheet) with egg sprite height and 5 times the egg sprite width at
                  # Graphics/Battlers/eggCracks.
                  #===============================================================================
                  class PokemonEggHatchScene
                  def pbStartScene(pokemon)
                  @sprites={}
                  @pokemon=pokemon
                  @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
                  @viewport.z=99999
                  @pokemon.eggsteps=1 # Just for drawing the egg
                  addBackgroundOrColoredPlane(@sprites,"background","hatchbg",
                  Color.new(248,248,248),@viewport)
                  @sprites["pokemon"]=PokemonSprite.new(@viewport)
                  @sprites["pokemon"].setPokemonBitmap(@pokemon)
                  @sprites["pokemon"].x=Graphics.width/[email protected]["pokemon"].src_rect.width/2
                  @sprites["pokemon"].y=48+Graphics.height/[email protected]["pokemon"].src_rect.width/2
                  @sprites["hatch"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
                  @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
                  @sprites["overlay"].z=200
                  @sprites["overlay"].bitmap=Bitmap.new(Graphics.width,Graphics.height)
                  @sprites["overlay"].bitmap.fill_rect(0,0,Graphics.width,Graphics.height,
                  Color.new(255,255,255))
                  @sprites["overlay"].opacity=0
                  @pokemon.eggsteps=0 # Correct egg steps again
                  pbFadeInAndShow(@sprites)
                  end

                  def pbMain
                  crackfilename=sprintf("Graphics/Battlers/%seggCracks",getConstantName(PBSpecies,@pokemon.species)) rescue nil
                  if !pbResolveBitmap(crackfilename)
                  crackfilename=sprintf("Graphics/Battlers/%03deggCracks",@pokemon.species)
                  if !pbResolveBitmap(crackfilename)
                  crackfilename=sprintf("Graphics/Battlers/eggCracks")
                  end
                  end
                  crackfilename=pbResolveBitmap(crackfilename)
                  hatchSheet=AnimatedBitmap.new(crackfilename)
                  pbBGMPlay("evolv")
                  # Egg animation
                  updateScene(60)
                  pbPositionHatchMask(hatchSheet,0)
                  pbSEPlay("ballshake")
                  swingEgg(2)
                  updateScene(8)
                  pbPositionHatchMask(hatchSheet,1)
                  pbSEPlay("ballshake")
                  swingEgg(2)
                  updateScene(16)
                  pbPositionHatchMask(hatchSheet,2)
                  pbSEPlay("ballshake")
                  swingEgg(4,2)
                  updateScene(16)
                  pbPositionHatchMask(hatchSheet,3)
                  pbSEPlay("ballshake")
                  swingEgg(8,4)
                  updateScene(8)
                  pbPositionHatchMask(hatchSheet,4)
                  pbSEPlay("recall")
                  # Fade and change the sprite
                  fadeSpeed=15
                  for i in 1..(255/fadeSpeed)
                  @sprites["pokemon"].tone=Tone.new(i*fadeSpeed,i*fadeSpeed,i*fadeSpeed)
                  @sprites["overlay"].opacity=i*fadeSpeed
                  updateScene
                  end
                  updateScene(30)
                  pbDisposeSprite(@sprites,"pokemon")
                  @sprites["pokemon"]=PokemonBattlerSprite.new(0,false,@viewport)
                  @sprites["pokemon"].setPokemonBitmap(@pokemon)
                  @sprites["pokemon"].x=Graphics.width/[email protected]["pokemon"].src_rect.width/2
                  @sprites["pokemon"].y=48+Graphics.height/[email protected]["pokemon"].src_rect.width/2
                  @sprites["pokemon"].visible=true
                  Graphics.update
                  @sprites["hatch"].visible=false
                  for i in 1..(255/fadeSpeed)
                  @sprites["pokemon"].tone=Tone.new(255-i*fadeSpeed,255-i*fadeSpeed,255-i*fadeSpeed)
                  @sprites["overlay"].opacity=255-i*fadeSpeed
                  updateScene
                  end
                  @sprites["pokemon"].tone=Tone.new(0,0,0)
                  @sprites["overlay"].opacity=0
                  # Finish scene
                  frames=pbCryFrameLength(@pokemon.species)
                  pbBGMStop()
                  pbPlayCry(@pokemon)
                  frames.times do
                  Graphics.update
                  end
                  pbMEPlay("004-Victory04")
                  Kernel.setMessageSprites(@sprites)
                  Kernel.pbMessage(_INTL("\\se[]{1} hatched from the Egg!\\wt[80]",@pokemon.name))
                  if Kernel.pbConfirmMessage(
                  _INTL("Would you like to nickname the newly hatched {1}?",@pokemon.name))
                  nickname=pbEnterPokemonName(_INTL("{1}'s nickname?",@pokemon.name),0,10,"",@pokemon)
                  @pokemon.name=nickname if nickname!=""
                  end
                  end

                  def pbPositionHatchMask(hatchSheet,index)
                  @sprites["hatch"].bitmap.clear
                  frames = 5
                  frameWidth = hatchSheet.width/frames
                  rect = Rect.new(frameWidth*index,0,frameWidth,hatchSheet.height)
                  @sprites["hatch"].bitmap.blt(@sprites["pokemon"].x,@sprites["pokemon"].y,
                  hatchSheet.bitmap,rect)
                  end

                  def swingEgg(speed,swingTimes=1) # Only accepts 2, 4 or 8 for speed.
                  limit = 8
                  targets = [@sprites["pokemon"].x-limit,@sprites["pokemon"].x+limit,
                  @sprites["pokemon"].x]
                  swingTimes.times do
                  usedSpeed=speed
                  for target in targets
                  usedSpeed*=-1
                  while [email protected]["pokemon"].x
                  @sprites["pokemon"].x+=usedSpeed
                  @sprites["hatch"].x+=usedSpeed
                  updateScene
                  end
                  end
                  end
                  end

                  def updateScene(frames=1) # Can be used for "wait" effect
                  frames.times do
                  Graphics.update
                  Input.update
                  self.update
                  @sprites["pokemon"].update
                  end
                  end

                  def update
                  pbUpdateSpriteHash(@sprites)
                  end

                  def pbEndScene
                  Kernel.setMessageSprites(nil)
                  pbFadeOutAndHide(@sprites) { update }
                  pbDisposeSpriteHash(@sprites)
                  @viewport.dispose
                  end
                  end



                  class PokemonEggHatchScreen
                  def initialize(scene)
                  @scene=scene
                  end

                  def pbStartScreen(pokemon)
                  @scene.pbStartScene(pokemon)
                  @scene.pbMain
                  @scene.pbEndScene
                  end
                  end



                  def pbHatchAnimation(pokemon)
                  Kernel.pbMessage(_INTL("Huh?\1"))
                  pbFadeOutInWithMusic(99999) {
                  scene=PokemonEggHatchScene.new
                  screen=PokemonEggHatchScreen.new(scene)
                  screen.pbStartScreen(pokemon)
                  }
                  return true
                  end

                  def pbHatch(pokemon)
                  speciesname=PBSpecies.getName(pokemon.species)
                  pokemon.name=speciesname
                  pokemon.trainerID=$Trainer.id
                  pokemon.ot=$Trainer.name
                  pokemon.happiness=120
                  pokemon.timeEggHatched=pbGetTimeNow
                  pokemon.obtainMode=1 # hatched from egg
                  pokemon.hatchedMap=$game_map.map_id
                  #=================================================
                  # Applies Birthsign Effects
                  #
                  #If you changed any Birthsign names in PField_Time, you must
                  #also change the names below to match your changes.
                  #Changes will also need to be made in PScreen_Summary and
                  #PScreen_Party
                  #=================================================
                  if pokemon.birthsign==_INTL("'The Apprentice'")
                  pokemon.pokerus=16 #Gives cured Pokerus
                  end
                  if pokemon.birthsign==_INTL("'The Companion'")
                  #Happiness ranges from 0-255.
                  #You can change the value to whatever you want.
                  pokemon.happiness=255 #Gives max happiness
                  end
                  if pokemon.birthsign==_INTL("'The Savage'")
                  #The number in brackets next to "iv" corresponds to the 6 stats.
                  #0=HP, 1=Atk, 2=Def, 3=Speed, 4=Sp.Atk, 5=Sp.Def
                  #The number after the '=' sign is the value that will be given to the
                  #IV of that stat.
                  pokemon.iv[0]=0 #HP
                  pokemon.iv[1]=31 #ATK
                  pokemon.iv[3]=31 #SPEED
                  pokemon.iv[4]=31 #SPATK
                  end
                  if pokemon.birthsign==_INTL("'The Prodigy'")
                  #abilityflag=0 or =1 will yield either the first or second
                  #natural abilities, respectively.
                  pokemon.abilityflag=2 #Gives Hidden Ability
                  end
                  if pokemon.birthsign==_INTL("'The Maiden'")
                  #setGender(0) will make them male, instead.
                  pokemon.setGender(1) #Makes female
                  end
                  if pokemon.birthsign==_INTL("'The Gladiator'")
                  #The numbers in brackets next to 'ev' correspond to the 6 stats,
                  #exactly how the IV example works.
                  pokemon.ev[1]=100 #ATK
                  pokemon.ev[4]=100 #SPATK
                  end
                  if pokemon.birthsign==_INTL("'The Thief'")
                  pokemon.ev[3]=252 #SPEED
                  end
                  if pokemon.birthsign==_INTL("'The Glutton'")
                  pokemon.iv[0]=31 #HP
                  pokemon.iv[2]=31 #DEF
                  pokemon.iv[3]=0 #SPEED
                  pokemon.iv[5]=31 #SPDEF
                  end
                  if pokemon.birthsign==_INTL("'The Wishmaker'")
                  pokemon.shinyflag=true #Makes shiny
                  end
                  #=================================================
                  $Trainer.seen[pokemon.species]=true
                  $Trainer.owned[pokemon.species]=true
                  pbSeenForm(pokemon)
                  pokemon.pbRecordFirstMoves
                  if !pbHatchAnimation(pokemon)
                  Kernel.pbMessage(_INTL("Huh?\1"))
                  Kernel.pbMessage(_INTL("...\1"))
                  Kernel.pbMessage(_INTL("... .... .....\1"))
                  Kernel.pbMessage(_INTL("{1} hatched from the Egg!",speciesname))
                  if Kernel.pbConfirmMessage(_INTL("Would you like to nickname the newly hatched {1}?",speciesname))
                  species=PBSpecies.getName(pokemon.species)
                  nickname=pbEnterPokemonName(_INTL("{1}'s nickname?",speciesname),0,10,"",pokemon)
                  pokemon.name=nickname if nickname!=""
                  end
                  end
                  end

                  Events.onStepTaken+=proc {|sender,e|
                  next if !$Trainer
                  for egg in $Trainer.party
                  if egg.eggsteps>0
                  egg.eggsteps-=1
                  for i in $Trainer.party
                  if !i.isEgg? && (isConst?(i.ability,PBAbilities,:FLAMEBODY) ||
                  isConst?(i.ability,PBAbilities,:MAGMAARMOR))
                  egg.eggsteps-=1
                  break
                  end
                  end
                  if egg.eggsteps<=0
                  egg.eggsteps=0
                  pbHatch(egg)
                  end
                  end
                  end
                  }
                  Reply With Quote
                    #9    
                  Old May 7th, 2015 (2:42 PM).
                  akane159 akane159 is offline
                     
                    Join Date: Oct 2012
                    Gender: Female
                    Posts: 72
                    :S i hatch a mudkip , but he has "torrent"
                    Spoiler:



                    and this is me file "pictures"
                    Spoiler:
                    Reply With Quote
                      #10    
                    Old May 7th, 2015 (2:52 PM).
                    Lucidious89 Lucidious89 is offline
                       
                      Join Date: Apr 2014
                      Gender: Male
                      Posts: 173
                      Hmm, I'm not sure what to tell you, because everything looks correct at a glance.

                      The only thing I can see that you missed was putting
                      Code:
                      zodiactoken=sprintf("Graphics/Pictures/Birthsigns/token%02d",zodiacValue(@pokemon.timeEggHatched.mon))
                          if @pokemon.obtainMode==1
                            imagepos.push([zodiactoken,150,260,0,0,-1,-1])
                          end
                      under the first instance of imagepos.push([ballimage in PScreen_Summary, but that shouldn't be causing these issues.

                      So either I forgot to include a step in the instructions, you have other modifications that are overriding everything, or there's a mistake you made that I'm not seeing. Give me a minute and I'll look it all over again.
                      Reply With Quote
                        #11    
                      Old May 7th, 2015 (2:57 PM).
                      Lucidious89 Lucidious89 is offline
                         
                        Join Date: Apr 2014
                        Gender: Male
                        Posts: 173
                        Quote:
                        Originally Posted by akane159 View Post
                        this is me script
                        PField_Time



                        PokeBattle_Pokemon



                        PScreen_Party


                        PScreen_Summary



                        PScreen_EggHatching,
                        Oh wait, I see what you did. In PField_Time, this whole section:
                        Code:
                        # Calculates the zodiac sign based on the given month and day:
                        # 0 is Aries, 11 is Pisces. Month is 1 if January, and so on.
                        def zodiac(month,day)
                        time=[
                        3,21,4,19, # Aries
                        4,20,5,20, # Taurus
                        5,21,6,20, # Gemini
                        6,21,7,20, # Cancer
                        7,23,8,22, # Leo
                        8,23,9,22, # Virgo 
                        9,23,10,22, # Libra
                        10,23,11,21, # Scorpio
                        11,22,12,21, # Sagittarius
                        12,22,1,19, # Capricorn
                        1,20,2,18, # Aquarius
                        2,19,3,20 # Pisces
                        ]
                        for i in 0...12
                        return i if month==time[i*4] && day>=time[i*4+1]
                        return i if month==time[i*4+2] && day<=time[i*4+2]
                        end
                        return 0
                        end
                        Needs to be commented out or deleted. You were supposed to paste over it, but you just pasted the changes above it but still kept the default in there. I probably should've worded that step better.
                        Reply With Quote
                          #12    
                        Old May 7th, 2015 (3:17 PM).
                        akane159 akane159 is offline
                           
                          Join Date: Oct 2012
                          Gender: Female
                          Posts: 72
                          Quote:
                          Originally Posted by Lucidious89 View Post
                          Oh wait, I see what you did. In PField_Time, this whole section:
                          Needs to be commented out or deleted. You were supposed to paste over it, but you just pasted the changes above it but still kept the default in there. I probably should've worded that step better.
                          i change the script, but still not work :S
                          Reply With Quote
                            #13    
                          Old May 7th, 2015 (3:56 PM).
                          Lucidious89 Lucidious89 is offline
                             
                            Join Date: Apr 2014
                            Gender: Male
                            Posts: 173
                            Quote:
                            Originally Posted by akane159 View Post
                            i change the script, but still not work :S
                            Well then I hate to say it, but I'm stumped. I just re-downloaded a clean copy of v.15.1, followed all the steps myself, and was able to get it working as intended. So this leads me to believe that you have other modifications in your scripts that are conflicting with the steps I provided. Either that, or there's some mistake in your scripts that I'm somehow overlooking that is interfering with everything.

                            Make sure you're actually hatching an egg to test this with, not just generating a new Pokemon. The Pokemon *must* be obtained via an egg for anything to take effect. If you're still not getting anything, try starting a new game and see if it works. A new game shouldn't be necessary, but who knows.
                            Reply With Quote
                              #14    
                            Old May 7th, 2015 (4:04 PM).
                            akane159 akane159 is offline
                               
                              Join Date: Oct 2012
                              Gender: Female
                              Posts: 72
                              Quote:
                              Originally Posted by Lucidious89 View Post
                              Well then I hate to say it, but I'm stumped. I just re-downloaded a clean copy of v.15.1, followed all the steps myself, and was able to get it working as intended. So this leads me to believe that you have other modifications in your scripts that are conflicting with the steps I provided. Either that, or there's some mistake in your scripts that I'm somehow overlooking that is interfering with everything.

                              Make sure you're actually hatching an egg to test this with, not just generating a new Pokemon. The Pokemon *must* be obtained via an egg for anything to take effect. If you're still not getting anything, try starting a new game and see if it works. A new game shouldn't be necessary, but who knows.
                              you can put that clean copy of v.15.1 , but with this script added , in MEGA , so i can download it and comparing , apologizes for any inconvenience :)
                              Reply With Quote
                                #15    
                              Old May 7th, 2015 (5:18 PM).
                              Lucidious89 Lucidious89 is offline
                                 
                                Join Date: Apr 2014
                                Gender: Male
                                Posts: 173
                                Quote:
                                Originally Posted by akane159 View Post
                                you can put that clean copy of v.15.1 , but with this script added , in MEGA , so i can download it and comparing , apologizes for any inconvenience :)
                                Sure, try this:
                                https://mega.co.nz/#F!aEw0BR7L!9MS9otLZH3LB2RqpKxOOWg
                                Reply With Quote
                                  #16    
                                Old May 7th, 2015 (6:56 PM).
                                akane159 akane159 is offline
                                   
                                  Join Date: Oct 2012
                                  Gender: Female
                                  Posts: 72
                                  :D ! it worked , it was not your fault, was me xD i tried to hatching the egg in "debug mode" , and dont work, so i tried to hatching walking around and it worked :D !

                                  Spoiler:


                                  thnx, for all :D!
                                  Reply With Quote
                                    #17    
                                  Old May 7th, 2015 (7:50 PM).
                                  akane159 akane159 is offline
                                     
                                    Join Date: Oct 2012
                                    Gender: Female
                                    Posts: 72
                                    xD now i have this problem, i tried some month and in december they pokemon not born shiny :S they are born normal, look

                                    Spoiler:
                                    Reply With Quote
                                      #18    
                                    Old May 7th, 2015 (8:13 PM).
                                    Lucidious89 Lucidious89 is offline
                                       
                                      Join Date: Apr 2014
                                      Gender: Male
                                      Posts: 173
                                      Quote:
                                      Originally Posted by akane159 View Post
                                      xD now i have this problem, i tried some month and in december they pokemon not born shiny :S they are born normal, look

                                      Spoiler:
                                      Make sure that 'The Wishmaker' in PScreen_EggHatching matches your new name.
                                      Code:
                                      if pokemon.birthsign==_INTL("'The Wishmaker'") 
                                          pokemon.shinyflag=true #Makes shiny
                                        end
                                      Should now say
                                      Code:
                                      if pokemon.birthsign==_INTL("El Cumple Deseos") 
                                          pokemon.shinyflag=true #Makes shiny
                                        end
                                      You have to match up all the names if you change any of the names for the birthsigns in PField_Time.
                                      Reply With Quote
                                        #19    
                                      Old May 14th, 2015 (10:51 AM).
                                      Richard PT's Avatar
                                      Richard PT Richard PT is offline
                                         
                                        Join Date: Aug 2014
                                        Location: Portugal
                                        Gender: Male
                                        Nature: Calm
                                        Posts: 93
                                        Lucidious89, your script is awsome and it works so beautiful, i maked some grafics changes and script too. Good work.
                                        Reply With Quote
                                          #20    
                                        Old May 14th, 2015 (2:45 PM). Edited May 14th, 2015 by Lucidious89.
                                        Lucidious89 Lucidious89 is offline
                                           
                                          Join Date: Apr 2014
                                          Gender: Male
                                          Posts: 173
                                          Update 5/14/15: Birthsign Set 2
                                          I've managed to create a whole new set of birthsigns in addition to the original 12.
                                          You can now mix and match from the defaults and the new options to create your own personal zodiac for your game.
                                          The first post has been updated with all the changes and additions, so check there to see what's new!

                                          Here's a rundown of the new birthsigns:


                                          The New Birthsigns
                                          1. 'The Phoenix'
                                            Constellation: Ho-oh
                                            Type: Skill
                                            Effect: When born under this sign, the Pokemon has access to the 'Revive' skill from the menu; allowing the Pokemon to revive themselves from the KO status while on the field.


                                          2. 'The Scholar'
                                            Constellation: Slowking
                                            Type: Passive
                                            Effect: When born under this sign, the Pokemon gains an additional 20% bonus to experience gained from battles. This stacks with similar effects.


                                          3. 'The Fugitive'
                                            Constellation: Klefki
                                            Type: Skill
                                            Effect: When born under this sign, the Pokemon has access to the 'Escape' skill from the menu; allowing the Pokemon to flee to the exit of any dungeon with its trainer.


                                          4. 'The Aristocrat'
                                            Constellation: Meowth
                                            Type: Passive
                                            Effect: When born under this sign, the Pokemon demands double the prize money awarded from trainer battles when leading the party. This effect does not stack with similar effects on the same Pokemon. However, this can stack with similar effects used by other party members.


                                          5. 'The Cleric'
                                            Constellation: Audino
                                            Type: Skill
                                            Effect: When born under this sign, the Pokemon has access to the 'Cure' skill from the menu; allowing the Pokemon to heal themselves of any harmful status conditions while on the field.


                                          6. 'The Monk'
                                            Constellation: Medicham
                                            Type: Skill
                                            Effect: When born under this sign, the Pokemon has access to the 'Trance' skill from the menu; allowing the Pokemon to enter a meditative state and recall any past moves that have long since been forgotten. No Heart Scales are required.


                                          7. 'The Ancestor'
                                            Constellation: Sigilyph
                                            Type: Passive
                                            Effect: When born under this sign, any Eggs yielded by the Pokemon will only require half the necessary steps to hatch. This effect can stack if shared by both parents; yielding Eggs that only require 1/4th the necessary steps to hatch.


                                          8. 'The Specialist'
                                            Constellation: Smeargle
                                            Type: Skill
                                            Effect: When born under this sign, the Pokemon has access to the 'Reroll' skill from the menu; allowing the Pokemon to reshuffle its IV's to align with a particular Hidden Power type. The new IV's will be randomized, but will always yield combinations that correspond with a chosen type.


                                          9. 'The Assassin'
                                            Constellation: Darkrai
                                            Type: Passive
                                            Effect: When born under this sign, the Pokemon has a high chance of seeking out vulnerable wild Pokemon who are asleep when encountered.


                                          10. 'The Parent'
                                            Constellation: Kangaskahn
                                            Type: Skill
                                            Effect: When born under this sign, the Pokemon has access to the 'Incubate' skill from the menu; allowing the Pokemon to nurture any Eggs in the party that are close to hatching, and bring down their remaining step count to 1. The Egg must have less than 1,000 steps left for this to work.


                                          11. 'The Hunter'
                                            Constellation: Houndoom
                                            Type: Passive
                                            Effect: When born under this sign, the Pokemon increases the capture rate of wild Pokemon by 20% when leading the party. This stacks with other effects.


                                          12. 'The Eternal'
                                            Constellation: Mew
                                            Type: Skill
                                            Effect: When born under this sign, the Pokemon has access to the 'Reincarnate' skill from the menu; allowing the Pokemon to be reborn with a new birthsign. Reincarnated Pokemon begin their life anew, as if they have just been born. Level, EV's, Happiness, Pokerus, Birthdate and Birthsign are all reset; and any effects of the new birthsign will be applied. IV's, Nature, Ability, Gender, Moves, Shinyness and Evolutionary Stages are NOT reset, unless a newly inherited birthsign alters them.

                                            Once Reincarnated, you are given an opportunity to rename the reborn Pokemon. Also, the text in the Pokemon's Memo Page in the Summary will now read "From a previous life" instead of "Day-Care Couple" on the line pertaining to how the Pokemon was obtained; and "Reincarnated" instead of "Egg Hatched" on the line pertaining to how the Pokemon was met. The Pokemon is also given a "Second Step Ribbon" to commemorate its new life.


                                          Attached are a few screenshots of the new birthsigns
                                          Attached Thumbnails
                                          phoenix.jpg‎   scholar.jpg‎   aristocrat.jpg‎   fugitive.jpg‎   hunter.jpg‎  

                                          Reply With Quote
                                            #21    
                                          Old May 14th, 2015 (3:02 PM).
                                          Lucidious89 Lucidious89 is offline
                                             
                                            Join Date: Apr 2014
                                            Gender: Male
                                            Posts: 173
                                            Here's are some visual examples of the effect of 'The Ancestor'.

                                            -The first screenshot displays Volcarona with 'The Ancestor' birthsign.
                                            -The second screenshot shows what the default step count is for a new Larvesta Egg.
                                            -The third screenshot shows what the step count is for a new Larvesta Egg if one parent has 'The Ancestor' birthsign.
                                            -The fourth screenshot shows what the step count is for a new Larvesta Egg if BOTH parents have 'The Ancestor' birthsign.


                                            Combine this with the 'The Parent' birthsign's Incubate skill, along with the effects of Flame Body/Magma Armor to hatch Eggs in no time!
                                            Attached Thumbnails
                                            ancestor1.jpg‎   ancestor2.jpg‎   ancestor3.jpg‎   ancestor4.jpg‎  
                                            Reply With Quote
                                              #22    
                                            Old May 14th, 2015 (3:17 PM). Edited May 14th, 2015 by Lucidious89.
                                            Lucidious89 Lucidious89 is offline
                                               
                                              Join Date: Apr 2014
                                              Gender: Male
                                              Posts: 173
                                              Here are some visual examples of the effect of 'The Eternal'.

                                              -The first screenshot shows Salamence with 'The Eternal' birthsign.
                                              -The second screenshot shows the Reincarnate skill in Salamence's menu options.
                                              -The third screenshot shows Salamence's Memo Page BEFORE using Reincarnate.
                                              -The fourth screenshot shows Salamence's Memo Page AFTER using Reincarnate. Notice the new text to describe its met conditions, and its new date of birth. Salamence's birthsign is reset to his new birthday (May - 'The Cleric') and his level is reset back to 1.
                                              -The fifth screenshot shows Salamence with the "Second Step Ribbon", which is added automatically whenever a Pokemon is reincarnated.


                                              Use 'The Eternal' to reset your Pokemon for new birthsign effects! Wait for a month with a birthsign you really want, and reincarnate your Pokemon for the new effect.

                                              Be careful! Using Reincarnate will reset the Level, Happiness, EV's, birthsign and probably more I'm not thinking of. The Pokemon is treated as if it was born from an egg - but random attributes (gender, IV's, Nature, shinyness, etc) will NOT be reset. Make absolutely sure you want to reset your Pokemon before using this skill!
                                              Attached Thumbnails
                                              eternal1.jpg‎   eternal2.jpg‎   eternal3.jpg‎   eternal4.jpg‎   eternal5.jpg‎  

                                              Reply With Quote
                                                #23    
                                              Old May 14th, 2015 (7:33 PM).
                                              Lucidious89 Lucidious89 is offline
                                                 
                                                Join Date: Apr 2014
                                                Gender: Male
                                                Posts: 173
                                                Mini-update to the first post:

                                                Fixed a spacing issue in the PField_Time scripts that could prevent the game from loading up. Corrected some typos, and went a little more in-depth with some of the Birthsign descriptions. Everything should be complete now and ready to go.
                                                Reply With Quote
                                                  #24    
                                                Old May 15th, 2015 (1:52 AM).
                                                Super Dedenne's Avatar
                                                Super Dedenne Super Dedenne is offline
                                                   
                                                  Join Date: Apr 2014
                                                  Gender: Other
                                                  Posts: 32
                                                  First and foremost, AMAZING job. GREAT changes! As always, the information you supplied is easy to follow and easy to implement. The Pokemon you've chosen for the new Zodiac are quite clever. You know, with a bit of tinkering, one could make several "weekly Birthsigns" per month to allow for an even more options, even an "Ordinary Time" where nothing happens to a Pokemon's birth in between ranges... but then again it wouldn't exactly be a 12-month Zodiac anymore, haha.

                                                  I'm loving the new ribbon. Looks wonderful, especially if the user is using my Ribbon Description/Selection script and finds that curious new ribbon as a delightful surprise. (You reminded me that seriously need to update it for 15.1.)
                                                  I'll tell you what I gathered in just a moment.
                                                  __________________
                                                  Public Additions/Snippets:
                                                  Trainer Outfit: Acro/MachBike Fix
                                                  (Needs 15.1 update) Pokemon Summary Add-On: Improved Ribbons + Scroll!
                                                  I might release some of my private plug-n'-play scripts in the future.
                                                  Reply With Quote
                                                    #25    
                                                  Old May 15th, 2015 (2:18 AM).
                                                  Lucidious89 Lucidious89 is offline
                                                     
                                                    Join Date: Apr 2014
                                                    Gender: Male
                                                    Posts: 173
                                                    Quote:
                                                    Originally Posted by Super Dedenne View Post
                                                    First and foremost, AMAZING job. GREAT changes! As always, the information you supplied is easy to follow and easy to implement. The Pokemon you've chosen for the new Zodiac are quite clever. You know, with a bit of tinkering, one could make several "weekly Birthsigns" per month to allow for an even more options, even an "Ordinary Time" where nothing happens to a Pokemon's birth in between ranges... but then again it wouldn't exactly be a 12-month Zodiac anymore, haha.

                                                    I'm loving the new ribbon. Looks wonderful, especially if the user is using my Ribbon Description/Selection script and finds that curious new ribbon as a delightful surprise. (You reminded me that seriously need to update it for 15.1.)
                                                    I'll tell you what I gathered in just a moment.
                                                    Thanks for the support, I'm glad you like it.

                                                    And I agree that there's a lot of potential with what could be done with this system. One of my goals when designing this was to give people options, and just lay the groundwork to allow them to create their own systems using this as a base.

                                                    And I actually use your Ribbon script! Haha that's part of what gave me the idea to add that in as part of the effect.
                                                    Reply With Quote
                                                    Reply

                                                    Quick Reply

                                                    Join the conversation!

                                                    Create an account to post a reply in this thread, participate in other discussions, and more!

                                                    Create a PokéCommunity Account

                                                    Sponsored Links
                                                    Thread Tools

                                                    Posting Rules
                                                    You may not post new threads
                                                    You may not post replies
                                                    You may not post attachments
                                                    You may not edit your posts

                                                    BB code is On
                                                    Smilies are On
                                                    [IMG] code is On
                                                    HTML code is Off

                                                    Forum Jump


                                                    All times are GMT -8. The time now is 1:21 AM.