Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Pokémon Essentials

Notices
For all updates, view the main page.

Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.



Reply
Click here to go to the first staff post in this thread.  
Thread Tools
  #201    
Old July 6th, 2014 (04:02 AM).
FL's Avatar
FL
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
1. Remove the 'if $INTERNAL' for the line 'pbPrintException($!)'. This may helps developers while testing new effects since there is no reason for won't letting the error message pops and several times some error occurs when the dev forget/won't expect this bug. So, the dev must waste time reproducing this error when the flag is off. Sometimes the players may find an error, but can't inform the error message because there is no error message, only the battle with the "buggy screen".

2. The official games now are faster when changing the box at pokémon storage, so let's double it in Essentials. At 'pbSwitchBoxToRight' and 'pbSwitchBoxToLeft' change the 16 to 32. Maybe you need to reflect this at the others numbers at these defs, since the sum must be divisible by 32.

3.
Code:
def pbCheckPokemonIconFiles(params,egg=false)
  species=params[0]
  if egg
    bitmapFileName=sprintf("Graphics/Icons/icon%segg",getConstantName(PBSpecies,species)) rescue nil
    bitmapFileName=sprintf("Graphics/Icons/icon%03degg",species) if !pbResolveBitmap(bitmapFileName)
    bitmapFileName=sprintf("Graphics/Icons/iconEgg") if !pbResolveBitmap(bitmapFileName)
    return pbResolveBitmap(bitmapFileName)
  else
    for i in 0...2**(params.length-1)
      tgender=(i%2==0) ? params[1] : false
      tshiny=((i/2)%2==0) ? params[2] : false
      tform=((i/4)%2==0) ? params[3].to_s : ""
      tshadow=((i/8)%2==0) ? params[4] : false
      bitmapFileName=sprintf("Graphics/Icons/icon%s%s%s%s%s",
         getConstantName(PBSpecies,species),
         tgender ? "f" : "",
         tshiny ? "s" : "",
         (tform!="" ? "_"+tform : ""),
         tshadow ? "_shadow" : "") rescue nil
      bitmapFileName=sprintf("Graphics/Icons/icon%03d%s%s%s%s",
         species,
         tgender ? "f" : "",
         tshiny ? "s" : "",
         (tform!="" ? "_"+tform : ""),
         tshadow ? "_shadow" : "") if !pbResolveBitmap(bitmapFileName)
      return pbResolveBitmap(bitmapFileName) if pbResolveBitmap(bitmapFileName)
    end
  end
  return nil
end
This method has a very, very bad performance. If you tried to load a box full of Shadow Pokémon without shadow sprites, the game tries to load each sprite (at pbResolveBitmap call) around 24 times. 30*24 = 720. Loading sprite consumes a good time, so in this case (and even with fewer calls) generally consumes too much time that trigger the message "The script is taking too long. The game will restart.".

For the developers, I suggest to comment one of the two "sprintf" fields for making this twice as faster.

For base essentials, I suggest to change this def to:

Code:
def pbCheckPokemonIconFiles(params,egg=false)
  species=params[0]
  if egg
    bitmapFileName=sprintf("Graphics/Icons/icon%segg",getConstantName(PBSpecies,species)) rescue nil
    bitmapFileName=sprintf("Graphics/Icons/icon%03degg",species) if !pbResolveBitmap(bitmapFileName)
    bitmapFileName=sprintf("Graphics/Icons/iconEgg") if !pbResolveBitmap(bitmapFileName)
    return pbResolveBitmap(bitmapFileName)
  else
    loadedSpritesNames=[]
    for i in 0...2**(params.length-1)
      tgender=(i%2==0) ? params[1] : false
      tshiny=((i/2)%2==0) ? params[2] : false
      tform=((i/4)%2==0) ? params[3].to_s : ""
      tshadow=((i/8)%2==0) ? params[4] : false
      bitmapFileName=sprintf("Graphics/Icons/icon%s%s%s%s%s",
         getConstantName(PBSpecies,species),
         tgender ? "f" : "",
         tshiny ? "s" : "",
         (tform!="" ? "_"+tform : ""),
         tshadow ? "_shadow" : "") rescue nil
      next if !bitmapFileName || loadedSpritesNames.include?(bitmapFileName)
      loadedSpritesNames.push(bitmapFileName)
      bitmap=pbResolveBitmap(bitmapFileName)
      if !bitmap	
        bitmapFileName=sprintf("Graphics/Icons/icon%03d%s%s%s%s",
            species,
            tgender ? "f" : "",
            tshiny ? "s" : "",
            (tform!="" ? "_"+tform : ""),
            tshadow ? "_shadow" : "") if !bitmap
          bitmap=pbResolveBitmap(bitmapFileName)
      end
      return bitmap if bitmap
    end
  end
  return nil
end
The line "next if !bitmapFileName || loadedSpritesNames.include?(bitmapFileName)" save some calls. For example: When the pokémon is shadow and isn't shiny, the expression 'tshiny=((i/2)%2==0) ? params[2] : false' params[2] is false, so the same string combination is called twice in the old way.

The same thing need to be done at pbCheckPokemonBitmapFiles.
__________________
Reply With Quote
  #202    
Old July 8th, 2014 (04:47 PM).
mej71's Avatar
mej71
 
Join Date: Mar 2014
Location: Omnipresence
Gender: Male
Here's a replacement as per your suggestion FL
Code:
def pbCheckPokemonBitmapFiles(params)
  species=params[0]
  back=params[1]
  loadedSpriteNames=[]
  for i in 0...2**(params.length-2)
    tgender=(i%2==0) ? params[2] : false
    tshiny=((i/2)%2==0) ? params[3] : false
    tform=((i/4)%2==0) ? params[4].to_s : ""
    tshadow=((i/8)%2==0) ? params[5] : false
    bitmapFileName=sprintf("Graphics/Battlers/%s%s%s%s%s%s",
       getConstantName(PBSpecies,species),
       tgender ? "f" : "",
       tshiny ? "s" : "",
       back ? "b" : "",
       (tform!="" ? "_"+tform : ""),
       tshadow ? "_shadow" : "") rescue nil
    next if !bitmapFileName || loadedSpriteNames.include?(bitmapFileName)
    loadedSpriteNames.push(bitmapFileName)
    bitmap=pbResolveBitmap(bitmapFileName)
    if !bitmap
      bitmapFileName=sprintf("Graphics/Battlers/%03d%s%s%s%s%s",
       species,
       tgender ? "f" : "",
       tshiny ? "s" : "",
       back ? "b" : "",
       (tform!="" ? "_"+tform : ""),
       tshadow ? "_shadow" : "") if !bitmap
    bitmap=pbResolveBitmap(bitmapFileName)
    end
  return bitmap if bitmap
  end
 return nil
end
Reply With Quote
  #203    
Old September 30th, 2014 (08:21 AM). Edited September 30th, 2014 by Florio.
Florio's Avatar
Florio
Pokemon Crimson Skies Owner
 
Join Date: Nov 2008
Location: Canada
Gender: Male
Nature: Lax
Okay honestly, I know I shouldn't be saying anything since I don't script, but I think these are the two things that need to be completed the most for Pokemon Essentials.

-An improved AI, the smarter the better. As of right now the AI isn't very intelligent, but it isn't completely stupid either. For example the AI is smart enough to use Foresight on ghost-types, but not smart enough to set up Reflect/Light Screen's.

-A fully functioning battle/trading system, I think this is important because it is ideal for a Pokemon game to have this feature. It would allow people to play with each other, which is what Pokemon is all about. Maybe even a GTS System or Random Match up System (both would require a server though), but if the scripts were already there for them with simple instructions on setting them up, it would be amazing.

I also feel like if these features were completed, people would be more motivated to finish their games. I know I'm going to finish my game eventually, but sometimes I get lazy. And then I think of things like how the AI isn't perfect, or the fact that people might not be able to trade/battle properly by the time I finish the game, and I become somewhat less motivated (I haven't quit yet and don't plan to, but many people have quit).
__________________
Reply With Quote
  #204    
Old October 2nd, 2014 (08:02 AM).
KajiVenator's Avatar
KajiVenator
The Flame Huntzman
 
Join Date: Jan 2010
Location: California
Age: 22
Gender: Male
Nature: Modest
It was suggested earlier, probably, but I'd really like to see an implementation of Triple Battles in the game, as well as Horde Battles. These are features in the main games and, while one is gimmicky, the other is a very important feature which will probably become a mainstay in the series. Although Triples are gimmicky, I'd really like to see it done because I have an idea for a game which will have all battles be Triple Battles.
__________________
Reply With Quote
  #205    
Old October 4th, 2014 (02:50 AM).
Quilva's Avatar
Quilva
Pierce the sky escape your fate, the more you try the more you'll just breed hate
 
Join Date: Jan 2013
Location: Ljubljana
Age: 15
Gender: Other
Nature: Relaxed
Send a message via Skype™ to Quilva
I think how smart the AI is should be decided by a"Difficulty Number" for their trainer type rather than how much money they give.
__________________
Reply With Quote
  #206    
Old October 4th, 2014 (03:13 AM).
Maruno's Avatar
Maruno
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
Quote originally posted by Discord.:
I think how smart the AI is should be decided by a"Difficulty Number" for their trainer type rather than how much money they give.
It already is. It just happens that the number (AI level and money rewarded) are the same for most trainer types.
__________________
Reply With Quote
  #207    
Old October 4th, 2014 (03:22 AM).
Quilva's Avatar
Quilva
Pierce the sky escape your fate, the more you try the more you'll just breed hate
 
Join Date: Jan 2013
Location: Ljubljana
Age: 15
Gender: Other
Nature: Relaxed
Send a message via Skype™ to Quilva
Quote originally posted by Maruno:
It already is. It just happens that the number (AI level and money rewarded) are the same for most trainer types.
My bad then, must have overlooked that when i checked the trainertypes.txt file.
__________________
Reply With Quote
  #208    
Old October 5th, 2014 (07:19 PM).
mustafa505's Avatar
mustafa505
Developer
 
Join Date: Apr 2010
Location: Hoenn Region 4ver
Age: 16
Gender: Male
Nature: Lonely
Send a message via Windows Live Messenger to mustafa505 Send a message via Yahoo to mustafa505
I suggest fixing the glitch, when you move the events vibrate, they only vibrate when the player moves.
__________________
Reply With Quote
  #209    
Old October 7th, 2014 (02:39 PM).
Florio's Avatar
Florio
Pokemon Crimson Skies Owner
 
Join Date: Nov 2008
Location: Canada
Gender: Male
Nature: Lax
Quote originally posted by KajiVenator:
It was suggested earlier, probably, but I'd really like to see an implementation of Triple Battles in the game, as well as Horde Battles. These are features in the main games and, while one is gimmicky, the other is a very important feature which will probably become a mainstay in the series. Although Triples are gimmicky, I'd really like to see it done because I have an idea for a game which will have all battles be Triple Battles.
I honestly don't think it is possible, and if it is then it won't be an easy job at all. The whole battle system would have to be reworked. I know a scripter who said that you would have to redefine so many things that it would basically be a new battle system. Honestly, I don't even think triple battles are worth it. Horde Battle's actually have a unique purpose (EV Training), but triple's are just there. Although I guess it would still be a cool feature to have, I don't consider triple battles at all important. I would say Horde Battle's are more important.

If anything, I would like to see an implementation of Sky Battle's. I think they are a cool idea, and I don't think it would be too hard to script either. All you would need to do is define which pokemon are allowed in Sky Battle's, and which moves are prohibited. Also you would need to make a message for when Metronome/Sleep Talk selects a prohibited move that says "But this move won't work well in a Sky Battle."
Reply With Quote
  #210    
Old November 24th, 2014 (03:00 AM).
FL's Avatar
FL
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Change sandstorm in field colors at night to match with darkness (http://www.pokecommunity.com/showthread.php?t=338607).
__________________
Reply With Quote
  #211    
Old November 27th, 2014 (12:03 PM).
Richard PT's Avatar
Richard PT
 
Join Date: Aug 2014
Gender: Male
Hello, everybody!

I'm a pokemon fan and i'm making my pokemon fan game too.

I created this thread to sugest new features for pokemon essentials project so we can add more features and to improve more and more.

Note: I'm not a scripter or programer, I only do a few things in this matter, but I can provide some ideas or graphics.

Here I have a few ideas:

Vs seeker system to battle like in pokemon fire red;
New type of weather: Fog;
Pokémon navigator like in pokemon emerald;
Fame checker like in pokemon fire red;
Teaching TV like in pokemon fire red;
That's all for now...

What do you all think?
Reply With Quote
  #212    
Old November 28th, 2014 (12:12 PM).
Richard PT's Avatar
Richard PT
 
Join Date: Aug 2014
Gender: Male
I only know a few things, but i want to help to improve the pokemon essentials, i can provide graphics if you want, soon i will post here a script based in Unown words here for everyone. Sorry for anything else and for my bad english, i'm portuguese.

Note: If this thread is useless, please delete it. Thanks
Reply With Quote
  #213    
Old December 9th, 2014 (01:09 PM).
OliveCopper
Captain of Olive Kappa
 
Join Date: Apr 2013
Gender: Male
Fix the "Trainers' Pokémon not attacking" bug in Essentials 15. This is serious. Pokémon should use attacks!

I can tell because Kricketune isn't using ANY attacks. Is it because the Level exceeds 10? Is it the moveset? Seriously, I can't have games work like this! At least prove a challenge. Fix the "Opponent not attacking" problem in Essentials v15.
__________________
PLEDGE OLIVE KAPPA,
and don't lock this thread just because I posted here.
Reply With Quote
  #214    
Old December 10th, 2014 (07:03 AM).
Savordez's Avatar
Savordez
Life? Interesting, tell me more
 
Join Date: Dec 2013
Location: dunno
Gender: Male
Nature: Relaxed
Quote originally posted by OliveCopper:
Fix the "Trainers' Pokémon not attacking" bug in Essentials 15. This is serious. Pokémon should use attacks!

I can tell because Kricketune isn't using ANY attacks. Is it because the Level exceeds 10? Is it the moveset? Seriously, I can't have games work like this! At least prove a challenge. Fix the "Opponent not attacking" problem in Essentials v15.
*v14

The culprit should be its moveset. You should check out the bug & error reporting topic, there might be some solutions for you (heck, your complain should belong there). If there aren't, try to figure things out.
__________________
Reply With Quote
  #215    
Old December 13th, 2014 (03:29 AM).
FL's Avatar
FL
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
  1. Put the four battle debug commands (Wild Battle/Double Wild Battle/Trainer Battle/Double Trainer Battle) at a submenu like you did with Day Care.
  2. A system for Mega Forms that doesn't use forms, since it's can mess with pokémon that have several forms (no one yet, but think about custom pokémon).
  3. At particle engine, change 'setParameters' method to use a Hash as parameter, since it has too many parameters to handle.
  4. Allow script switches at conditional branch (http://www.pokecommunity.com/showthread.php?p=8518381#8518381).
  5. A function that allow to put a pokémon in middle of a Regional Pokédex, like the Steelix at a New Kanto Dex, shifting all positions after Onix with +1. Also, make a similar thing for removing a pokémon.
  6. Regional Dex type statistics.
__________________
Reply With Quote
  #216    
Old December 13th, 2014 (05:59 AM).
Maruno's Avatar
Maruno
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
Quote originally posted by FL:
  1. Put the four battle debug commands (Wild Battle/Double Wild Battle/Trainer Battle/Double Trainer Battle) at a submenu like you did with Day Care.
  2. A system for Mega Forms that doesn't use forms, since it's can mess with pokémon that have several forms (no one yet, but think about custom pokémon).
  3. At particle engine, change 'setParameters' method to use a Hash as parameter, since it has too many parameters to handle.
  4. Allow script switches at conditional branch (http://www.pokecommunity.com/showthread.php?p=8518381#8518381).
  5. A function that allow to put a pokémon in middle of a Regional Pokédex, like the Steelix at a New Kanto Dex, shifting all positions after Onix with +1. Also, make a similar thing for removing a pokémon.
  6. Regional Dex type statistics.
  1. Eh.
  2. The current system doesn't mess up Pokémon with forms. Rather than setting the form to a specific value when it Mega Evolves, just add/subtract some amount from the form number instead. A few tweaks to other scripts would need to be done, but they're easy enough.
  3. If you're fiddling with something like that, surely you can cope with a slew of parameters.
  4. Already have done.
  5. You can already do that in the Regional Dex editor in the External Editor. It's the "insert" and "delete" options.
  6. What do you mean? Like the number of seen/owned Pokémon in each Regional Dex? You can already get that with code like $Trainer.pokedexSeen(0) where 0 is the first Regional Dex. The Pokédex uses this.
__________________
Reply With Quote
  #217    
Old December 13th, 2014 (08:53 AM).
FL's Avatar
FL
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Quote originally posted by Maruno:
  1. Eh.
  2. The current system doesn't mess up Pokémon with forms. Rather than setting the form to a specific value when it Mega Evolves, just add/subtract some amount from the form number instead. A few tweaks to other scripts would need to be done, but they're easy enough.
  3. If you're fiddling with something like that, surely you can cope with a slew of parameters.
  4. Already have done.
  5. You can already do that in the Regional Dex editor in the External Editor. It's the "insert" and "delete" options.
  6. What do you mean? Like the number of seen/owned Pokémon in each Regional Dex? You can already get that with code like $Trainer.pokedexSeen(0) where 0 is the first Regional Dex. The Pokédex uses this.
  1. Ah.
  2. Ok I guess.
  3. This make a certain confusion, so I need to put labels before each paramether.

    Old code:

    Code:
    setParameters([0,0,1,20,0,1,-64,
           Graphics.height,-64,Graphics.width,2,2,-5,-13,30,0])
    My suggestion:

    Code:
    setParameters({
      "randomhue" => 0,
      "leftright" => 0,
      "fade" => 1,
      "maxparticless" => 20,
      "hue" => 0,
      "slowdown" => 1,
      "ytop" => -64,
      "ybottom" => Graphics.height,
      "xleft" => -64,
      "xright" => Graphics.width,
      "xgravity" => 2,
      "ygravity" => 2,
      "xoffset" => -5,
      "yoffset" => -13,
      "opacityvar" => 30,
      "originalopacity" => 0
    })
    It's very more clear, isn't? If you wish, I can do this for you.
  4. Nice!
  5. I can't belive that I didn't notice this!
  6. I mean something for the dev know how many pokémon the dex have for each type. It's a way of balancing the types. Example:
    16 Normal
    15 Water
    12 Grass
    5 Fire
    ...
    (in descending order, preferably)
__________________
Reply With Quote
  #218    
Old December 14th, 2014 (08:35 PM).
Umbreon's Avatar
Umbreon
Community Supporter
 
Join Date: Aug 2009
Location: Nearby my feet.
Age: 18
Gender: Male
Nature: Calm
Quote originally posted by FL:
  • I mean something for the dev know how many pokémon the dex have for each type. It's a way of balancing the types. Example:
    16 Normal
    15 Water
    12 Grass
    5 Fire
    ...
    (in descending order, preferably)
Couldn't you just use something like this:

Code:
def pbCountSpeciesType(typeID)
  count = 0
  for i in 0...PBSpecies.maxValue
    # get pokemon primary type
    count += 1 if type == typeID
  end
  return count
end
Getting all the type counts at once and ordering them from ascending to descending wouldn't be too hard to implement.
Reply With Quote
  #219    
Old December 14th, 2014 (09:05 PM).
mej71's Avatar
mej71
 
Join Date: Mar 2014
Location: Omnipresence
Gender: Male
Quote originally posted by Umbreon:
Couldn't you just use something like this:

Code:
def pbCountSpeciesType(typeID)
  count = 0
  for i in 0...PBSpecies.maxValue
    # get pokemon primary type
    count += 1 if type == typeID
  end
  return count
end
Getting all the type counts at once and ordering them from ascending to descending wouldn't be too hard to implement.
Wrote it for fun

Code:
def pbTypeCount
   typecount=[]
    for i in 0..PBTypes.maxValue #for each type
    count=0
        for j in 1..PBSpecies.maxValue
              dexdata=pbOpenDexData
              pbDexDataOffset(dexdata,j,8)
              type1=dexdata.fgetb
              #pbDexDataOffset(dexdata,j,9)
              #type2=dexdata.fgetb
              dexdata.close
              #only checking primary type
              count += 1 if type1 == i #|| type2== i
        end
        typecount[i]=count
      end
      for i in 0...typecount.length
        Kernel.pbMessage(_INTL("Type: {1}  Count {2}",PBTypes.getName(i),typecount[i]))
      end
  return typecount
end
This doesn't display in order, but I figure FL can do that if he wants
Reply With Quote
  #220    
Old December 23rd, 2014 (10:04 AM).
sbtb1
 
Join Date: Aug 2012
Gender: Male
It would be nice have a zoom panel for the map connection editor.
The window and the maps inside are too smaller.
Reply With Quote
  #221    
Old January 3rd, 2015 (11:05 AM).
mej71's Avatar
mej71
 
Join Date: Mar 2014
Location: Omnipresence
Gender: Male
Something I thought of that could make for a better AI. Moves and abilities can be revealed to the AI, and it can make decisions based on that. For the abilities, it starts off with a array of the possible abilities each pokemon has, and if something causes them to display a message ({1} is exerting it's pressure!) that ability is revealed, and it can make decisions using that instead of just by the skill level of the opponent. If the ability isn't revealed, it can either pick arbitrarily, or we can hardcode in which ones are generally competitive. Same goes with moves. If you use Ice Beam, the AI won't want to switch into Salamance, but if you don't use that move it won't know you have it and switch Salamance in.

I'll look more into the actual coding of this in a bit, this was just something I thought of.
Reply With Quote
  #222    
Old 2 Weeks Ago (09:22 PM).
mej71's Avatar
mej71
 
Join Date: Mar 2014
Location: Omnipresence
Gender: Male
A fixed version of Pokemon Summary, so that you can scroll move descriptions up/down for move selection and move replacement. Changes highlighted in red

Spoiler:
Code:
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 !@updating
  end

  def refresh
    w=@movesel.width
    h=@movesel.height/2
    self.x=240
    self.y=92+(self.index*64)
    self.y-=76 if @fifthmove
    self.y+=20 if @fifthmove && self.index==4
    self.bitmap=@movesel.bitmap
    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
    @pokemon=@party[@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["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
    @pokemon=@party[@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["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
    overlay=@sprites["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
      status=@pokemon.status-1 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
    ballused=@pokemon.ballused ? @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)
    pokename=@pokemon.name
    textpos=[
       [_INTL("INFO"),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)
    overlay=@sprites["overlay"].bitmap
    overlay.clear
    @sprites["background"].setBitmap("Graphics/Pictures/summaryEgg")
    imagepos=[]
    ballused=@pokemon.ballused ? @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("TRAINER MEMO"),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)
    overlay=@sprites["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
      status=@pokemon.status-1 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
    ballused=@pokemon.ballused ? @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)
    naturename=PBNatures.getName(pokemon.nature)
    itemname=pokemon.hasItem? ? PBItems.getName(pokemon.item) : _INTL("None")
    pokename=@pokemon.name
    textpos=[
       [_INTL("TRAINER MEMO"),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)
    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("Met at Lv. {1}.",pokemon.obtainLevel),
               _INTL("Egg received."),
               _INTL("Traded at Lv. {1}.",pokemon.obtainLevel),
               "",
               _INTL("Had a fateful encounter at Lv. {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)
    overlay=@sprites["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
      status=@pokemon.status-1 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
    ballused=@pokemon.ballused ? @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)
    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")
    pokename=@pokemon.name
    textpos=[
       [_INTL("SKILLS"),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)
    overlay=@sprites["overlay"].bitmap
    overlay.clear
    overlay2=@sprites["overlay2"].bitmap
    overlay2.clear
    @sprites["background"].setBitmap("Graphics/Pictures/summary4")
    @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
      status=@pokemon.status-1 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
    ballused=@pokemon.ballused ? @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")
    pokename=@pokemon.name
    textpos=[
       [_INTL("MOVES"),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)
    overlay=@sprites["overlay"].bitmap
    overlay2=@sprites["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)
    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)
    drawTextEx(overlay2,4,0,238,5,
       pbGetMessage(MessageTypes::MoveDescriptions,moveid),
       Color.new(64,64,64),Color.new(176,176,176))
  end

  def drawMoveSelection(pokemon,moveToLearn)
    overlay=@sprites["overlay"].bitmap
    overlay.clear
    overlay2=@sprites["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
    pbSetSystemFont(overlay)
    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)
    overlay=@sprites["overlay"].bitmap
    overlay.clear
    overlay2=@sprites["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
      status=@pokemon.status-1 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
    ballused=@pokemon.ballused ? @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")
    pokename=@pokemon.name
    textpos=[
       [_INTL("RIBBONS"),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. of Ribbons:"),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>=@pokemon.numMoves
          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>=@pokemon.numMoves
          selmove=@pokemon.numMoves-1
        end
        @sprites["movesel"].index=selmove
        newmove=(selmove==4) ? moveToLearn : @pokemon.moves[selmove].id
        drawSelectedMove(@pokemon,moveToLearn,newmove)
        ret=selmove
      end
      if Input.trigger?(Input::R)
        if descpos>0
          descpos-=1 
          @sprites["overlay2"].y+=32
        end
      end
      if Input.trigger?(Input::L)
        if descpos<=3 && descpos>=0
          descpos+=1 
          @sprites["overlay2"].y-=32
        end
      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"].index==@sprites["movesel"].index
        @sprites["movepresel"].z=@sprites["movesel"].z+1
      else
        @sprites["movepresel"].z=@sprites["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
              tmpmove=@pokemon.moves[oldselmove]
              @pokemon.moves[oldselmove]=@pokemon.moves[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>=@pokemon.numMoves
        selmove=0 if selmove>=4
        selmove=4 if selmove<0
        @sprites["movesel"].index=selmove
        newmove=@pokemon.moves[selmove].id
        pbPlayCursorSE()
        drawSelectedMove(@pokemon,0,@pokemon.moves[selmove].id)
      end
      if Input.trigger?(Input::UP)
        descpos=0
        selmove-=1
        if selmove<4 && selmove>=@pokemon.numMoves
          selmove=@pokemon.numMoves-1
        end
        selmove=0 if selmove>=4
        selmove=@pokemon.numMoves-1 if selmove<0
        @sprites["movesel"].index=selmove
        newmove=@pokemon.moves[selmove].id
        pbPlayCursorSE()
        drawSelectedMove(@pokemon,0,@pokemon.moves[selmove].id)
      end
      if Input.trigger?(Input::R)
        if descpos>0
          descpos-=1 
          @sprites["overlay2"].y+=32
        end
      end
      if Input.trigger?(Input::L)
        if descpos<=3 && descpos>=0
          descpos+=1 
          @sprites["overlay2"].y-=32
        end
      end
    end 
    @sprites["movesel"].visible=false
  end

  def pbGoToPrevious
    if @page!=0
      newindex=@partyindex
      while newindex>0
        newindex-=1
        if @party[newindex] && !@party[newindex].isEgg?
          @partyindex=newindex
          break
        end
      end
    else
      newindex=@partyindex
      while newindex>0
        newindex-=1
        if @party[newindex]
          @partyindex=newindex
          break
        end
      end
    end
  end

  def pbGoToNext
    if @page!=0
      newindex=@partyindex
      while newindex<@party.length-1
        newindex+=1
        if @party[newindex] && !@party[newindex].isEgg?
          @partyindex=newindex
          break
        end
      end
    else
      newindex=@partyindex
      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)
        end
      end
      if Input.trigger?(Input::UP) && @partyindex>0
        pbGoToPrevious
        @pokemon=@party[@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
        @pokemon=@party[@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) && !@pokemon.isEgg?
        oldpage=@page
        @page-=1
        @page=0 if @page<0
        @page=4 if @page>4
        dorefresh=true
        if @page!=oldpage # Move to next page
          pbPlayCursorSE()
          dorefresh=true
        end
      end
      if Input.trigger?(Input::RIGHT) && !@pokemon.isEgg?
        oldpage=@page
        @page+=1
        @page=0 if @page<0
        @page=4 if @page>4
        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)
        end
      end
    end
    return @partyindex
  end
end



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

  def pbStartScreen(party,partyindex)
    @scene.pbStartScene(party,partyindex)
    ret=@scene.pbScene
    @scene.pbEndScene
    return ret
  end

  def pbStartForgetScreen(party,partyindex,moveToLearn)
    ret=-1
    @scene.pbStartForgetScene(party,partyindex,moveToLearn)
    loop do
      ret=@scene.pbChooseMoveToForget(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
      ret=@scene.pbChooseMoveToForget(0)
      if ret<0
        Kernel.pbMessage(_INTL("You must choose a move!")){ @scene.pbUpdate }
      else
        break
      end
    end
    @scene.pbEndScene
    return ret
  end
end
Reply With Quote
Reply
Quick Reply

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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 02:44 PM.