Advertisement
Guest User

RotationBattle_Scene

a guest
Nov 12th, 2017
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 52.71 KB | None | 0 0
  1. #============================================================
  2. #Rotation_Battle script by leilou
  3. #
  4. #This script is ment to make rotation battles possible in Pokémon Essentials
  5. #
  6. #Pokémon Essentials is created by Poccil, based on Flameguru's
  7. #Pokémon Starter Kit and managed and updated by Maruno
  8. #
  9. #I don't claim this script to be perfect.
  10. #Please report bugs at the resources thread on Relic Castle.
  11. #=============================================================
  12. #The Scenes section contains all the changed scenes and graphic related stuff
  13. #=============================================================
  14.  
  15. #constants that may or may not be already be defined depending on which
  16. #scripts you use ... ignore the already defined ones
  17. BATTLERZOOM = 1 unless defined? BATTLERZOOM #scale pokemon
  18. STARTZOOM = 0.125 unless defined? STARTZOOM #this is to determine how big your
  19.                                             #pkmn are right after coming out of
  20.                                             #the pokeball at the beginning of a
  21.                                             #battle
  22. SPRITESTEPS = 10 unless defined? SPRITESTEPS#how many frames a pkmn needs to
  23.                                             #appear at the start of a battle
  24.                                            
  25. #some more constants for rotation battle
  26. module PokeBattle_SceneConstants
  27.   FOEBASE_ROT_XSHIFT = 0
  28.   FOEBASE_ROT_YSHIFT = -70
  29.   FOESHADOW_ROT_R_XSHIFT = 70
  30.   FOESHADOW_ROT_L_XSHIFT = -70
  31.   FOESHADOW_ROT_RL_YSHIFT = -100
  32.   FOEBATTLER_ROT_R_XSHIFT = 70
  33.   FOEBATTLER_ROT_L_XSHIFT = -70
  34.   FOEBATTLER_ROT_RL_YSHIFT = -100
  35. end
  36.  
  37. #extension of class PokeBattle_Scene
  38. class RotationBattle_Scene < PokeBattle_Scene
  39.  
  40.   def pbFrameUpdate(cw=nil)
  41.     super
  42.     @sprites["battleboxL"].update if @sprites["battleboxL"]
  43.     @sprites["battleboxM"].update if @sprites["battleboxM"]
  44.     @sprites["battleboxR"].update if @sprites["battleboxR"]
  45.   end
  46.  
  47.   def pbRefresh
  48.     super
  49.     @sprites["battleboxL"].refresh if @sprites["battleboxL"]
  50.     @sprites["battleboxM"].refresh if @sprites["battleboxM"]
  51.     @sprites["battleboxR"].refresh if @sprites["battleboxR"]
  52.   end
  53.  
  54.   def enemyRotateRight(showmessage = true)
  55.     length = 14
  56.     right_x = PokeBattle_SceneConstants::FOEBATTLER_X + PokeBattle_SceneConstants::FOEBATTLER_ROT_R_XSHIFT
  57.     right_x -= @sprites["pokemon1"].width*0.5/2
  58.     right_y = adjustBattleSpriteY(@sprites["pokemon1"],@battle.pokeTrainer[2].pokemon.species,1)/2
  59.     right_y += PokeBattle_SceneConstants::FOEBATTLER_Y + PokeBattle_SceneConstants::FOEBATTLER_ROT_RL_YSHIFT
  60.     #right_y -= @sprites["pokemonL"].height*0.5
  61.    
  62.     left_x = PokeBattle_SceneConstants::FOEBATTLER_X + PokeBattle_SceneConstants::FOEBATTLER_ROT_L_XSHIFT
  63.     left_x -= @sprites["pokemonR"].width*0.5/2
  64.     left_y = adjustBattleSpriteY(@sprites["pokemonR"],@battle.pokeTrainer[1].pokemon.species,1)/2
  65.     left_y += PokeBattle_SceneConstants::FOEBATTLER_Y + PokeBattle_SceneConstants::FOEBATTLER_ROT_RL_YSHIFT
  66.     #left_y -= @sprites["pokemon1"].height*0.5
  67.    
  68.     middle_x = PokeBattle_SceneConstants::FOEBATTLER_X
  69.     middle_x -= @sprites["pokemonL"].width/2
  70.     middle_y = adjustBattleSpriteY(@sprites["pokemonL"],@battle.pokeTrainer[0].pokemon.species,1)
  71.     middle_y += PokeBattle_SceneConstants::FOEBATTLER_Y
  72.    
  73.     middle_x_step = (right_x - @sprites["pokemon1"].x)/length
  74.     middle_y_step = (right_y - @sprites["pokemon1"].y)/length
  75.     middle_zoom_step = (0.5 - @sprites["pokemon1"].zoom_x)/length
  76.     middle_shadow_step_x = (@right_shadow_x - @sprites["shadow1"].x)/length
  77.     middle_shadow_step_y = (@right_shadow_y - @sprites["shadow1"].y)/length + 1
  78.     right_x_step = (left_x - @sprites["pokemonR"].x)/length
  79.     right_y_step = (left_y - @sprites["pokemonR"].y)/length
  80.     right_shadow_step_x = (@left_shadow_x - @sprites["shadowR"].x)/length
  81.     right_shadow_step_y = (@left_shadow_y - @sprites["shadowR"].y)/length
  82.     left_x_step = (middle_x - @sprites["pokemonL"].x)/length
  83.     left_y_step = (middle_y - @sprites["pokemonL"].y)/length
  84.     left_zoom_step = (1 - @sprites["pokemonL"].zoom_x)/length
  85.     left_shadow_step_x = (@middle_shadow_x - @sprites["shadowL"].x)/length
  86.     left_shadow_step_y = (@middle_shadow_y - @sprites["shadowL"].y)/length
  87.    
  88.     length.times do
  89.       @sprites["pokemon1"].x += middle_x_step
  90.       @sprites["pokemon1"].y += middle_y_step
  91.       @sprites["pokemon1"].zoom_x += middle_zoom_step
  92.       @sprites["pokemon1"].zoom_y += middle_zoom_step
  93.       @sprites["shadow1"].x += middle_shadow_step_x
  94.       @sprites["shadow1"].y += middle_shadow_step_y
  95.       @sprites["pokemonR"].x += right_x_step
  96.       @sprites["pokemonR"].y += right_y_step
  97.       @sprites["shadowR"].x += right_shadow_step_x
  98.       @sprites["shadowR"].y += right_shadow_step_y
  99.       @sprites["pokemonL"].x += left_x_step
  100.       @sprites["pokemonL"].y += left_y_step
  101.       @sprites["pokemonL"].zoom_x += left_zoom_step
  102.       @sprites["pokemonL"].zoom_y += left_zoom_step
  103.       @sprites["shadowL"].x += left_shadow_step_x
  104.       @sprites["shadowL"].y += left_shadow_step_y
  105.       pbWait(1)
  106.     end
  107.      
  108.     #change positions
  109.     @sprites["pokemon1"].x = right_x
  110.     @sprites["pokemon1"].y = right_y
  111.     @sprites["pokemon1"].zoom_x = 0.5
  112.     @sprites["pokemon1"].zoom_y = 0.5
  113.     @sprites["shadow1"].x = @right_shadow_x
  114.     @sprites["shadow1"].y = @right_shadow_y
  115.     @sprites["pokemonR"].x = left_x
  116.     @sprites["pokemonR"].y = left_y
  117.     @sprites["pokemonR"].zoom_x = 0.5
  118.     @sprites["pokemonR"].zoom_y = 0.5
  119.     @sprites["shadowR"].x = @left_shadow_x
  120.     @sprites["shadowR"].y = @left_shadow_y
  121.     @sprites["pokemonL"].x = middle_x
  122.     @sprites["pokemonL"].y = middle_y
  123.     @sprites["pokemonL"].zoom_x = 1
  124.     @sprites["pokemonL"].zoom_y = 1
  125.     @sprites["shadowL"].x = @middle_shadow_x
  126.     @sprites["shadowL"].y = @middle_shadow_y
  127.     #assign the right names to the right sprites
  128.     tempSprite = @sprites["pokemon1"]
  129.     @sprites["pokemon1"] = @sprites["pokemonL"]
  130.     @sprites["pokemonL"] = @sprites["pokemonR"]
  131.     @sprites["pokemonR"] = tempSprite
  132.     tempSprite = @sprites["shadow1"]
  133.     @sprites["shadow1"] = @sprites["shadowL"]
  134.     @sprites["shadowL"] = @sprites["shadowR"]
  135.     @sprites["shadowR"] = tempSprite
  136.    
  137.     Graphics.update #to make it look smooth
  138.    
  139.     @sprites["battleboxM"].place=2
  140.     @sprites["battleboxL"].place=1
  141.     @sprites["battleboxR"].place=0
  142.    
  143.     tempBox = @sprites["battleboxM"]
  144.     @sprites["battleboxM"] = @sprites["battleboxL"]
  145.     @sprites["battleboxL"] = @sprites["battleboxR"]
  146.     @sprites["battleboxR"] = tempBox
  147.    
  148.     #@sprites["battlebox1"] = @sprites["battleboxM"]
  149.    
  150.    
  151.     @sprites["battleboxM"].refresh
  152.     @sprites["battleboxR"].refresh
  153.     @sprites["battleboxL"].refresh
  154.     if showmessage
  155.       trainerName = @battle.pbGetOwner(1).name
  156.       pbDisplayMessage("#{trainerName}'s Pokémon rotated to the right!",true)
  157.       @battle.pbDisplayBrief("")
  158.     end
  159.   end
  160.  
  161.   def enemyRotateLeft(showmessage = true)
  162.     length = 14
  163.    
  164.     right_x = PokeBattle_SceneConstants::FOEBATTLER_X + PokeBattle_SceneConstants::FOEBATTLER_ROT_R_XSHIFT
  165.     right_x -= @sprites["pokemonL"].width*0.5/2
  166.     right_y = adjustBattleSpriteY(@sprites["pokemonL"],@battle.pokeTrainer[2].pokemon.species,1)/2
  167.     right_y += PokeBattle_SceneConstants::FOEBATTLER_Y + PokeBattle_SceneConstants::FOEBATTLER_ROT_RL_YSHIFT
  168.     #right_y -= @sprites["pokemonL"].height*0.5
  169.    
  170.     left_x = PokeBattle_SceneConstants::FOEBATTLER_X + PokeBattle_SceneConstants::FOEBATTLER_ROT_L_XSHIFT
  171.     left_x -= @sprites["pokemon1"].width*0.5/2
  172.     left_y = adjustBattleSpriteY(@sprites["pokemon1"],@battle.pokeTrainer[1].pokemon.species,1)/2
  173.     left_y += PokeBattle_SceneConstants::FOEBATTLER_Y + PokeBattle_SceneConstants::FOEBATTLER_ROT_RL_YSHIFT
  174.     #left_y -= @sprites["pokemon1"].height*0.5
  175.    
  176.     middle_x = PokeBattle_SceneConstants::FOEBATTLER_X
  177.     middle_x -= @sprites["pokemonR"].width/2
  178.     middle_y = adjustBattleSpriteY(@sprites["pokemonR"],@battle.pokeTrainer[0].pokemon.species,1)
  179.     middle_y += PokeBattle_SceneConstants::FOEBATTLER_Y
  180.    
  181.     middle_x_step = (left_x - @sprites["pokemon1"].x)/length
  182.     middle_y_step = (left_y - @sprites["pokemon1"].y)/length
  183.     middle_zoom_step = (0.5 - @sprites["pokemon1"].zoom_x)/length
  184.     middle_shadow_step_x = (@left_shadow_x - @sprites["shadow1"].x)/length
  185.     middle_shadow_step_y = (@left_shadow_y - @sprites["shadow1"].y)/length + 1
  186.     right_x_step = (middle_x - @sprites["pokemonR"].x)/length
  187.     right_y_step = (middle_y - @sprites["pokemonR"].y)/length
  188.     right_zoom_step = (1 - @sprites["pokemonR"].zoom_x)/length
  189.     right_shadow_step_x = (@middle_shadow_x - @sprites["shadowR"].x)/length
  190.     right_shadow_step_y = (@middle_shadow_y - @sprites["shadowR"].y)/length
  191.     left_x_step = (right_x - @sprites["pokemonL"].x)/length
  192.     left_y_step = (right_y - @sprites["pokemonL"].y)/length
  193.     left_shadow_step_x = (@right_shadow_x - @sprites["shadowL"].x)/length
  194.     left_shadow_step_y = (@right_shadow_y - @sprites["shadowL"].y)/length
  195.    
  196.     length.times do
  197.       @sprites["pokemon1"].x += middle_x_step
  198.       @sprites["pokemon1"].y += middle_y_step
  199.       @sprites["pokemon1"].zoom_x += middle_zoom_step
  200.       @sprites["pokemon1"].zoom_y += middle_zoom_step
  201.       @sprites["shadow1"].x += middle_shadow_step_x
  202.       @sprites["shadow1"].y += middle_shadow_step_y
  203.       @sprites["pokemonR"].x += right_x_step
  204.       @sprites["pokemonR"].y += right_y_step
  205.       @sprites["pokemonR"].zoom_x += right_zoom_step
  206.       @sprites["pokemonR"].zoom_y += right_zoom_step
  207.       @sprites["shadowR"].x += right_shadow_step_x
  208.       @sprites["shadowR"].y += right_shadow_step_y
  209.       @sprites["pokemonL"].x += left_x_step
  210.       @sprites["pokemonL"].y += left_y_step
  211.       @sprites["shadowL"].x += left_shadow_step_x
  212.       @sprites["shadowL"].y += left_shadow_step_y
  213.       pbWait(1)
  214.     end
  215.     #change positions
  216.     @sprites["pokemon1"].x = left_x
  217.     @sprites["pokemon1"].y = left_y
  218.     @sprites["pokemon1"].zoom_x = 0.5
  219.     @sprites["pokemon1"].zoom_y = 0.5
  220.     @sprites["shadow1"].x = @left_shadow_x
  221.     @sprites["shadow1"].y = @left_shadow_y
  222.     @sprites["pokemonL"].x = right_x
  223.     @sprites["pokemonL"].y = right_y
  224.     @sprites["pokemonL"].zoom_x = 0.5
  225.     @sprites["pokemonL"].zoom_y = 0.5
  226.     @sprites["shadowL"].x = @right_shadow_x
  227.     @sprites["shadowL"].y = @right_shadow_y
  228.     @sprites["pokemonR"].x = middle_x
  229.     @sprites["pokemonR"].y = middle_y
  230.     @sprites["pokemonR"].zoom_x = 1
  231.     @sprites["pokemonR"].zoom_y = 1
  232.     @sprites["shadowR"].x = @middle_shadow_x
  233.     @sprites["shadowR"].y = @middle_shadow_y
  234.     #assign the right names to the right sprites
  235.     tempSprite = @sprites["pokemon1"]
  236.     @sprites["pokemon1"] = @sprites["pokemonR"]
  237.     @sprites["pokemonR"] = @sprites["pokemonL"]
  238.     @sprites["pokemonL"] = tempSprite
  239.     tempSprite = @sprites["shadow1"]
  240.     @sprites["shadow1"] = @sprites["shadowR"]
  241.     @sprites["shadowR"] = @sprites["shadowL"]
  242.     @sprites["shadowL"] = tempSprite
  243.    
  244.     Graphics.update #to make it look smooth
  245.    
  246.     @sprites["battleboxM"].place=0
  247.     @sprites["battleboxL"].place=2
  248.     @sprites["battleboxR"].place=1
  249.    
  250.     tempBox = @sprites["battleboxM"]
  251.     @sprites["battleboxM"] = @sprites["battleboxR"]
  252.     @sprites["battleboxR"] = @sprites["battleboxL"]
  253.     @sprites["battleboxL"] = tempBox
  254.    
  255.     #@sprites["battlebox1"] = @sprites["battleboxM"]
  256.    
  257.     @sprites["battleboxM"].refresh
  258.     @sprites["battleboxR"].refresh
  259.     @sprites["battleboxL"].refresh
  260.     if showmessage
  261.       trainerName = @battle.pbGetOwner(1).name
  262.       pbDisplayMessage("#{trainerName}'s Pokémon rotated to the left!",true)
  263.       @battle.pbDisplayBrief("")
  264.     end
  265.   end
  266.  
  267.   def rotateLeft(nextPoke,showmessage = true)
  268.     @sprites["battlebox0"].dispose
  269.     @sprites["battlebox0"]=PokemonDataBox.new(nextPoke,@battle.doublebattle,@viewport)
  270.     @sprites["battlebox0"].appear
  271.     newPokeSprite = PokemonBattlerSprite.new(false,0,@viewport)
  272.     newPokeSprite.setPokemonBitmap(nextPoke.pokemon,true)
  273.     oldX = PokeBattle_SceneConstants::PLAYERBATTLER_X - newPokeSprite.width/2
  274.     oldY = PokeBattle_SceneConstants::PLAYERBATTLER_Y - newPokeSprite.height
  275.     newPokeSprite.x = oldX + 200
  276.     newPokeSprite.y = oldY + 100
  277.     newPokeSprite.z = @sprites["pokemon0"].z
  278.     newPokeSprite.visible = true
  279.    
  280.     #this is for the battlebox ... wanna do it in the same loop as the animation
  281.     #because I want it both to happen at the same time
  282.     pbWaitMessage
  283.     pbRefresh
  284.     pbShowWindow(MESSAGEBOX)
  285.     cw=@sprites["messagewindow"]
  286.     playerName = @battle.pbGetOwner(0).name
  287.     cw.text="#{playerName}'s Pokémon rotated to the left!"
  288.    
  289.     loop do
  290.       #break if everything is ready
  291.       if !@sprites["battlebox0"].appearing && newPokeSprite.x <= oldX && !cw.busy?
  292.         break
  293.       end
  294.       #animate Pokémon
  295.       if newPokeSprite.x > oldX
  296.         newPokeSprite.x-=10
  297.         newPokeSprite.y-=5
  298.         @sprites["pokemon0"].x-=10
  299.         @sprites["pokemon0"].y+=5
  300.       end
  301.       @sprites["battlebox0"].update
  302.       #do the text
  303.       pbGraphicsUpdate
  304.       pbInputUpdate
  305.       pbFrameUpdate(cw)
  306.       if Input.trigger?(Input::C) || @abortable
  307.         if cw.pausing?
  308.           pbPlayDecisionSE() if !@abortable
  309.           cw.resume
  310.         end
  311.       end
  312.     end
  313.     @sprites["pokemon0"].visible = false
  314.     @sprites["pokemon0"].dispose
  315.     @sprites["pokemon0"] = newPokeSprite
  316.     #@sprites["battlebox1"] = @sprites["battleboxM"]
  317.   end
  318.  
  319.   def rotateRight(nextPoke, showmessage = true)
  320.     @sprites["battlebox0"].dispose
  321.     @sprites["battlebox0"]=PokemonDataBox.new(nextPoke,@battle.doublebattle,@viewport)
  322.     @sprites["battlebox0"].appear
  323.     newPokeSprite = PokemonBattlerSprite.new(false,0,@viewport)
  324.     newPokeSprite.setPokemonBitmap(nextPoke.pokemon,true)
  325.     oldX = PokeBattle_SceneConstants::PLAYERBATTLER_X - newPokeSprite.width/2
  326.     oldY = PokeBattle_SceneConstants::PLAYERBATTLER_Y - newPokeSprite.height
  327.     newPokeSprite.x = oldX - 200
  328.     newPokeSprite.y = oldY + 100
  329.     newPokeSprite.z = @sprites["pokemon0"].z
  330.     newPokeSprite.visible = true
  331.    
  332.     #this is for the battlebox ... wanna do it in the same loop as the animation
  333.     #because I want it both to happen at the same time
  334.     pbWaitMessage
  335.     pbRefresh
  336.     pbShowWindow(MESSAGEBOX)
  337.     cw=@sprites["messagewindow"]
  338.     playerName = @battle.pbGetOwner(0).name
  339.     cw.text="#{playerName}'s Pokémon rotated to the right!"
  340.    
  341.     loop do
  342.       #break if everything is ready
  343.       if !@sprites["battlebox0"].appearing && newPokeSprite.x >= oldX && !cw.busy?
  344.         break
  345.       end
  346.       #animate Pokémon
  347.       if newPokeSprite.x < oldX
  348.         newPokeSprite.x+=10
  349.         newPokeSprite.y-=5
  350.         @sprites["pokemon0"].x+=10
  351.         @sprites["pokemon0"].y+=6
  352.       end
  353.       @sprites["battlebox0"].update
  354.       #do the text
  355.       pbGraphicsUpdate
  356.       pbInputUpdate
  357.       pbFrameUpdate(cw)
  358.       if Input.trigger?(Input::C) || @abortable
  359.         if cw.pausing?
  360.           pbPlayDecisionSE() if !@abortable
  361.           cw.resume
  362.         end
  363.       end
  364.     end
  365.     @sprites["pokemon0"].visible = false
  366.     @sprites["pokemon0"].dispose
  367.     @sprites["pokemon0"] = newPokeSprite
  368.     #@sprites["battlebox1"] = @sprites["battleboxM"]
  369.   end
  370.  
  371.   #the initial thing where all 3 Pokémon are send out
  372.   def pbTrainerSendOutRotationBattle(battlerindex,pkmn)
  373.     @briefmessage=false
  374.     fadeanim=nil
  375.     while inPartyAnimation?; end
  376.     if @showingenemy
  377.       fadeanim=TrainerFadeAnimation.new(@sprites)
  378.     end
  379.     frame=0
  380.     @sprites["pokemon#{battlerindex}"].setPokemonBitmap(pkmn[0].pokemon,false)
  381.     if @battle.battlers[battlerindex].effects[PBEffects::Illusion] != nil #Illusion
  382.       @sprites["pokemon#{battlerindex}"].setPokemonBitmap(
  383.       @battle.battlers[battlerindex].effects[PBEffects::Illusion],false)
  384.     end
  385.     @sprites["pokemonL"]=PokemonBattlerSprite.new(false,1,@viewport)
  386.     @sprites["pokemonL"].setPokemonBitmap(pkmn[1].pokemon,false)
  387.     if @battle.battlers[battlerindex].effects[PBEffects::Illusion] != nil #Illusion
  388.       @sprites["pokemonL"].setPokemonBitmap(
  389.       @battle.battlers[battlerindex].effects[PBEffects::Illusion],false)
  390.     end
  391.     @sprites["pokemonR"]=PokemonBattlerSprite.new(false,1,@viewport)
  392.     @sprites["pokemonR"].setPokemonBitmap(pkmn[2].pokemon,false)
  393.     if @battle.battlers[battlerindex].effects[PBEffects::Illusion] != nil #Illusion
  394.       @sprites["pokemonR"].setPokemonBitmap(
  395.       @battle.battlers[battlerindex].effects[PBEffects::Illusion],false)
  396.     end
  397.     sendout=PokeballSendOutAnimation.new(@sprites["pokemon#{battlerindex}"],
  398.        @sprites,@battle.pokeTrainer[0],@battle.doublebattle,
  399.        @battle.battlers[battlerindex].effects[PBEffects::Illusion]) #Illusion
  400.     sendoutL=PokeballSendOutAnimationRotation.new(@sprites["pokemonL"],
  401.        @sprites,@battle.pokeTrainer[1],
  402.        @battle.battlers[battlerindex].effects[PBEffects::Illusion], #Illusion
  403.        PokeBattle_SceneConstants::FOEBATTLER_X + PokeBattle_SceneConstants::FOEBATTLER_ROT_L_XSHIFT,
  404.        PokeBattle_SceneConstants::FOEBATTLER_Y + PokeBattle_SceneConstants::FOEBATTLER_ROT_RL_YSHIFT,
  405.        0.5,"L",self)
  406.     sendoutR=PokeballSendOutAnimationRotation.new(@sprites["pokemonR"],
  407.        @sprites,@battle.pokeTrainer[2],
  408.        @battle.battlers[battlerindex].effects[PBEffects::Illusion], #Illusion
  409.        PokeBattle_SceneConstants::FOEBATTLER_X + PokeBattle_SceneConstants::FOEBATTLER_ROT_R_XSHIFT,
  410.        PokeBattle_SceneConstants::FOEBATTLER_Y + PokeBattle_SceneConstants::FOEBATTLER_ROT_RL_YSHIFT,
  411.        0.5,"R",self)
  412.     @sprites["battleboxM"] = PokemonDataBoxRotation.new(pkmn[0],@battle.doublebattle,@viewport,1)
  413.     @sprites["battleboxL"] = PokemonDataBoxRotation.new(pkmn[1],@battle.doublebattle,@viewport,0)
  414.     @sprites["battleboxR"] = PokemonDataBoxRotation.new(pkmn[2],@battle.doublebattle,@viewport,2)
  415.     loop do
  416.       pbGraphicsUpdate
  417.       #ADDED
  418.       pbFrameUpdate(nil)
  419.       #///
  420.       pbInputUpdate
  421.       fadeanim.update if fadeanim
  422.       frame+=1    
  423.       if frame==1
  424.         @sprites["battleboxM"].appear
  425.         @sprites["battleboxL"].appear
  426.         @sprites["battleboxR"].appear
  427.       end
  428.       if frame>=10
  429.         sendout.update
  430.         sendoutL.update
  431.         sendoutR.update
  432.       end
  433.       @sprites["battleboxM"].update
  434.         @sprites["battleboxL"].update
  435.         @sprites["battleboxR"].update
  436.       break if (!fadeanim || fadeanim.animdone?) && sendout.animdone? &&
  437.          !@sprites["battleboxM"].appearing
  438.     end
  439.     if @battle.battlers[battlerindex].pokemon.isShiny?
  440.       if @battle.battlers[battlerindex].effects[PBEffects::Illusion] == nil
  441.         pbCommonAnimation("Shiny",@battle.battlers[battlerindex],nil)
  442.       else
  443.         if @battle.battlers[battlerindex].effects[PBEffects::Illusion].isShiny?
  444.           pbCommonAnimation("Shiny",@battle.battlers[battlerindex],nil)
  445.         end
  446.       end
  447.     elsif (@battle.battlers[battlerindex].effects[PBEffects::Illusion] != nil &&
  448.            @battle.battlers[battlerindex].effects[PBEffects::Illusion].isShiny?) #ILLUSION
  449.        pbCommonAnimation("Shiny",@battle.battlers[battlerindex],nil)
  450.     end
  451.     sendout.dispose
  452.     if @showingenemy
  453.       @showingenemy=false
  454.       pbDisposeSprite(@sprites,"trainer")
  455.       pbDisposeSprite(@sprites,"partybarfoe")
  456.       for i in 0...6
  457.         pbDisposeSprite(@sprites,"enemy#{i}")
  458.       end
  459.     end
  460.     pbRefresh
  461.    
  462.     #this is nessecairy because somehow the shadows disappear if the enemy sprite is too big...
  463.     @sprites["shadow1"].visible = true
  464.     @sprites["shadowL"].visible = true
  465.     @sprites["shadowR"].visible = true
  466.    
  467.     #some variables because i'm dumb...
  468.     @middle_x = @sprites["pokemon#{battlerindex}"].x
  469.     @middle_y = @sprites["pokemon#{battlerindex}"].y
  470.     @middle_shadow_y = @sprites["shadow1"].y
  471.     @middle_shadow_x = @sprites["shadow1"].x
  472.     @left_x = @sprites["pokemonL"].x
  473.     @left_y = @sprites["pokemonL"].y
  474.     @left_shadow_x = @sprites["shadowL"].x
  475.     @left_shadow_y = @sprites["shadowL"].y
  476.     @right_x = @sprites["pokemonR"].x
  477.     @right_y = @sprites["pokemonR"].y
  478.     @right_shadow_x = @sprites["shadowR"].x
  479.     @right_shadow_y = @sprites["shadowR"].y
  480.    
  481.   end
  482.  
  483.   def pbTrainerSendOut(battlerindex,pkmn)
  484.     illusionpoke=@battle.battlers[battlerindex].effects[PBEffects::Illusion]
  485.     @briefmessage=false
  486.     fadeanim=nil
  487.     while inPartyAnimation?; end
  488.     if @showingenemy
  489.       fadeanim=TrainerFadeAnimation.new(@sprites)
  490.     end
  491.     frame=0
  492.     @sprites["pokemon#{battlerindex}"].setPokemonBitmap(pkmn,false)
  493.     if illusionpoke
  494.       @sprites["pokemon#{battlerindex}"].setPokemonBitmap(illusionpoke,false)
  495.     end
  496.     sendout=PokeballSendOutAnimation.new(@sprites["pokemon#{battlerindex}"],
  497.        @sprites,@battle.battlers[battlerindex],illusionpoke,@battle.doublebattle)
  498.     loop do
  499.       fadeanim.update if fadeanim
  500.       frame+=1    
  501.       if frame==1
  502.         @sprites["battleboxM"].appear
  503.       end
  504.       if frame>=10
  505.         sendout.update
  506.       end
  507.       pbGraphicsUpdate
  508.       pbInputUpdate
  509.       pbFrameUpdate
  510.       break if (!fadeanim || fadeanim.animdone?) && sendout.animdone? &&
  511.          !@sprites["battleboxM"].appearing
  512.     end
  513.     if @battle.battlers[battlerindex].isShiny? && @battle.battlescene
  514.       pbCommonAnimation("Shiny",@battle.battlers[battlerindex],nil)
  515.     end
  516.     sendout.dispose
  517.     if @showingenemy
  518.       @showingenemy=false
  519.       pbDisposeSprite(@sprites,"trainer")
  520.       pbDisposeSprite(@sprites,"partybarfoe")
  521.       for i in 0...6
  522.         pbDisposeSprite(@sprites,"enemy#{i}")
  523.       end
  524.     end
  525.     pbRefresh
  526.   end
  527.  
  528. #  alias pbBackdropOriginal pbBackdrop
  529. #  
  530. #  def pbBackdrop
  531. #    if @battle.rotationbattle == true
  532. #      pbRotationBackdrop
  533. #    else
  534. #      pbBackdropOriginal
  535. #    end
  536. #  end
  537.  
  538.   ROTATIONBOX = 4
  539.  
  540.   def pbFightMenuRotation(index, rotstate)
  541.     #this is for showing the right rotation arrows ...
  542.     #not altering the real rotstate in the logic...
  543.    
  544.     pbShowWindowRotation(ROTATIONBOX)
  545.     cw = @sprites["fightrotationwindow"]
  546.     battler=@battle.battlers[index]
  547.     cw.battler=battler
  548.     lastIndex=@lastmove[index]
  549.     if battler.moves[lastIndex].id!=0
  550.       cw.setIndex(lastIndex)
  551.     else
  552.       cw.setIndex(2)
  553.     end
  554.     if cw.index == 0 || cw.index == 1
  555.       cw.setIndex(2)
  556.     end
  557.     cw.megaButton=0
  558.     cw.megaButton=1 if @battle.pbCanMegaEvolve?(index)
  559.     if rotstate == 1
  560.       if !@battle.canRotateRight(rotstate) && !@battle.canRotateLeft(rotstate)
  561.         rotstate = 0
  562.       elsif !@battle.canRotateRight(rotstate)
  563.         rotstate = 2
  564.       elsif !@battle.canRotateLeft(rotstate)
  565.         rotstate = 3
  566.       end
  567.     end
  568.     cw.rotation = rotstate
  569.     pbSelectBattler(index)
  570.     pbRefresh
  571.     loop do
  572.      
  573.       pbGraphicsUpdate
  574.       pbInputUpdate
  575.       pbFrameUpdate(cw)
  576.      
  577.       # Update selected command
  578.       if Input.trigger?(Input::LEFT) && (cw.index&1)==1 && !(cw.index == 1 && rotstate == 3)
  579.         pbPlayCursorSE() if cw.setIndex(cw.index-1)
  580.       elsif Input.trigger?(Input::RIGHT) &&  (cw.index&1)==0 && !(cw.index == 0 && rotstate == 2)
  581.         pbPlayCursorSE() if cw.setIndex(cw.index+1)
  582.       elsif Input.trigger?(Input::UP) && !((cw.index&6)==0) && !(rotstate == 0 && (rotstate&2) == 2)
  583.         if (cw.index == 2 && rotstate == 3)
  584.           cw.setIndex(1)
  585.         elsif (cw.index == 3 && rotstate == 2)
  586.           cw.setIndex()
  587.         else
  588.           pbPlayCursorSE() if cw.setIndex(cw.index-2)
  589.         end
  590.       elsif Input.trigger?(Input::DOWN) && !((cw.index&4)==4)
  591.         pbPlayCursorSE() if cw.setIndex(cw.index+2)
  592.       end
  593.       if Input.trigger?(Input::C)   # Confirm choice
  594.         ret=cw.index
  595.         pbPlayDecisionSE()
  596.         @lastmove[index]=ret
  597.         pbShowWindowRotation(BLANK)
  598.         return ret
  599.       elsif Input.trigger?(Input::A)   # Use Mega Evolution
  600.         if @battle.pbCanMegaEvolve?(index)
  601.           @battle.pbRegisterMegaEvolution(index)
  602.           cw.megaButton=2
  603.           pbPlayDecisionSE()
  604.         end
  605.       elsif Input.trigger?(Input::B)   # Cancel fight menu
  606.         @lastmove[index]=cw.index
  607.         pbPlayCancelSE()
  608.         pbShowWindowRotation(BLANK)
  609.         return -1
  610.       end
  611.     end
  612.   end
  613.  
  614.   def pbShowWindowRotation(windowtype)
  615.     if windowtype==ROTATIONBOX && !@sprites["fightrotationwindow"]
  616.       @sprites["fightrotationwindow"]=FightRotationMenuDisplay.new(nil,@viewport)
  617.       @sprites["fightrotationwindow"].z=100
  618.     end
  619.     @sprites["messagebox"].visible = (windowtype==MESSAGEBOX ||
  620.                                       windowtype==COMMANDBOX ||
  621.                                       windowtype==FIGHTBOX ||
  622.                                       windowtype==BLANK ||
  623.                                       windowtype==ROTATIONBOX)
  624.     @sprites["messagewindow"].visible = (windowtype==MESSAGEBOX)
  625.     @sprites["commandwindow"].visible = (windowtype==COMMANDBOX)
  626.     @sprites["fightwindow"].visible = (windowtype==FIGHTBOX)
  627.     @sprites["fightrotationwindow"].visible = (windowtype==ROTATIONBOX)
  628.   end
  629.  
  630.   def pbBackdrop
  631.     environ=@battle.environment
  632.     # Choose backdrop
  633.     backdrop="Field"
  634.     if environ==PBEnvironment::Cave
  635.       backdrop="Cave"
  636.     elsif environ==PBEnvironment::MovingWater || environ==PBEnvironment::StillWater
  637.       backdrop="Water"
  638.     elsif environ==PBEnvironment::Underwater
  639.       backdrop="Underwater"
  640.     elsif environ==PBEnvironment::Rock
  641.       backdrop="Mountain"
  642.     else
  643.       if !$game_map || !pbGetMetadata($game_map.map_id,MetadataOutdoor)
  644.         backdrop="IndoorA"
  645.       end
  646.     end
  647.     if $game_map
  648.       back=pbGetMetadata($game_map.map_id,MetadataBattleBack)
  649.       if back && back!=""
  650.         backdrop=back
  651.       end
  652.     end
  653.     if $PokemonGlobal && $PokemonGlobal.nextBattleBack
  654.       backdrop=$PokemonGlobal.nextBattleBack
  655.     end
  656.     # Choose bases
  657.     base=""
  658.     trialname=""
  659.     if environ==PBEnvironment::Grass || environ==PBEnvironment::TallGrass
  660.       trialname="Grass"
  661.     elsif environ==PBEnvironment::Sand
  662.       trialname="Sand"
  663.     elsif $PokemonGlobal.surfing
  664.       trialname="Water"
  665.     end
  666.     if pbResolveBitmap(sprintf("Graphics/Battlebacks/playerbase"+backdrop+trialname))
  667.       base=trialname
  668.     end
  669.     # Choose time of day
  670.     time=""
  671.     if ENABLESHADING
  672.       trialname=""
  673.       timenow=pbGetTimeNow
  674.       if PBDayNight.isNight?(timenow)
  675.         trialname="Night"
  676.       elsif PBDayNight.isEvening?(timenow)
  677.         trialname="Eve"
  678.       end
  679.       if pbResolveBitmap(sprintf("Graphics/Battlebacks/battlebg"+backdrop+trialname))
  680.         time=trialname
  681.       end
  682.     end
  683.     # Apply graphics
  684.     battlebg="Graphics/Battlebacks/battlebg"+backdrop+time
  685.     #enemybase="Graphics/Battlebacks/enemybase"+backdrop+base+time
  686.     enemybase="Graphics/Battlebacks/enemybaseRotation"
  687.     playerbase="Graphics/Battlebacks/playerbase"+backdrop+base+time
  688.     pbAddPlane("battlebg",battlebg,@viewport)
  689.     pbAddSprite("playerbase",
  690.        PokeBattle_SceneConstants::PLAYERBASEX,
  691.        PokeBattle_SceneConstants::PLAYERBASEY,playerbase,@viewport)
  692.     @sprites["playerbase"].x-=@sprites["playerbase"].bitmap.width/2 if @sprites["playerbase"].bitmap!=nil
  693.     @sprites["playerbase"].y-=@sprites["playerbase"].bitmap.height if @sprites["playerbase"].bitmap!=nil
  694.     pbAddSprite("enemybase",
  695.        PokeBattle_SceneConstants::FOEBATTLER_X + PokeBattle_SceneConstants::FOEBASE_ROT_XSHIFT,
  696.        PokeBattle_SceneConstants::FOEBATTLER_Y + PokeBattle_SceneConstants::FOEBASE_ROT_YSHIFT,enemybase,@viewport)
  697.     @sprites["enemybase"].x-=@sprites["enemybase"].bitmap.width/2 if @sprites["enemybase"].bitmap!=nil
  698.     @sprites["enemybase"].y-=@sprites["enemybase"].bitmap.height/2 if @sprites["enemybase"].bitmap!=nil
  699.     @sprites["battlebg"].z=0
  700.     @sprites["playerbase"].z=1
  701.     @sprites["enemybase"].z=1
  702.   end
  703.  
  704.   # Use this method to display the inventory
  705.   # The return value is the item chosen, or 0 if the choice was canceled.
  706.   #TODO alter to where all 3 battlers are affected
  707.   def pbItemMenu(index)
  708.     ret=0
  709.     retindex=-1
  710.     pkmnid=-1
  711.     endscene=true
  712.     oldsprites=pbFadeOutAndHide(@sprites)
  713.     itemscene=PokemonBag_Scene.new
  714.     itemscene.pbStartScene($PokemonBag)
  715.     loop do
  716.       item=itemscene.pbChooseItem
  717.       break if item==0
  718.       usetype=$ItemData[item][ITEMBATTLEUSE]
  719.       cmdUse=-1
  720.       commands=[]
  721.       if usetype==0
  722.         commands[commands.length]=_INTL("Cancel")
  723.       else
  724.         commands[cmdUse=commands.length]=_INTL("Use")
  725.         commands[commands.length]=_INTL("Cancel")
  726.       end
  727.       itemname=PBItems.getName(item)
  728.       command=itemscene.pbShowCommands(_INTL("{1} is selected.",itemname),commands)
  729.       if cmdUse>=0 && command==cmdUse
  730.         if usetype==1 || usetype==3
  731.           modparty=[]
  732.           for i in 0...6
  733.             modparty.push(@battle.party1[@battle.party1order[i]])
  734.           end
  735.           pkmnlist=PokemonScreen_Scene.new
  736.           pkmnscreen=PokemonScreen.new(pkmnlist,modparty)
  737.           itemscene.pbEndScene
  738.           pkmnscreen.pbStartScene(_INTL("Use on which Pokémon?"),@battle.doublebattle)
  739.           activecmd=pkmnscreen.pbChoosePokemon
  740.           pkmnid=@battle.party1order[activecmd]
  741.           if activecmd>=0 && pkmnid>=0 && ItemHandlers.hasBattleUseOnPokemon(item)
  742.             pkmnlist.pbEndScene
  743.             ret=item
  744.             retindex=pkmnid
  745.             endscene=false
  746.             break
  747.           end
  748.           pkmnlist.pbEndScene
  749.           itemscene.pbStartScene($PokemonBag)
  750.         elsif usetype==2 || usetype==4
  751.           #this is if the item is used on an active Pokémon which requires
  752.           #asking the player for a target
  753.           #loosing a round if you choose a wrong target is on purpose
  754.           if ItemHandlers.hasBattleUseOnBattler(item)
  755.             modparty=[]
  756.             for i in 0...6
  757.               modparty.push(@battle.party1[@battle.party1order[i]])
  758.             end
  759.             pkmnlist=PokemonScreen_Scene.new
  760.             pkmnscreen=PokemonScreen.new(pkmnlist,modparty)
  761.             itemscene.pbEndScene
  762.             pkmnscreen.pbStartScene(_INTL("Use on which Pokémon?"),@battle.doublebattle)
  763.             activecmd=pkmnscreen.pbChoosePokemon
  764.             pkmnid=@battle.party1order[activecmd]
  765.             if activecmd>=0 && pkmnid>=0 #Pokémon selected
  766.               pkmnlist.pbEndScene
  767.               ret=item
  768.               retindex=pkmnid
  769.               endscene=false
  770.               break
  771.             end
  772.             #canceled
  773.             pkmnlist.pbEndScene
  774.             itemscene.pbStartScene($PokemonBag)
  775.           end
  776.         end
  777.       end
  778.     end
  779.     pbConsumeItemInBattle($PokemonBag,ret) if ret>0
  780.     itemscene.pbEndScene if endscene
  781.     pbFadeInAndShow(@sprites,oldsprites)
  782.     return [ret,retindex]
  783.   end
  784.  
  785.  
  786.   def pbCommonAnimation(animname,user,target,hitnum=0)
  787.     if(user != @battle.pokePlayer[0] && user != @battle.pokeTrainer[0])
  788.       return #don't show aimation if the Pokémon is not in the middle
  789.     end
  790.     animations=load_data("Data/PkmnAnimations.rxdata")
  791.     for i in 0...animations.length
  792.       if animations[i] && animations[i].name=="Common:"+animname
  793.         pbAnimationCore(animations[i],user,(target!=nil) ? target : user)
  794.         return
  795.       end
  796.     end
  797.   end
  798.  
  799. # This method is called whenever a Pokémon's HP changes.
  800. # Used to animate the HP bar.
  801. #changed to work on both battlers battleboxes(changed naming conventions...)
  802.   def pbHPChanged(pkmn,oldhp,anim=false)
  803.     @briefmessage=false
  804.     hpchange=pkmn.hp-oldhp
  805.     if hpchange<0
  806.       hpchange=-hpchange
  807.       PBDebug.log("[HP change] #{pkmn.pbThis} lost #{hpchange} HP (#{oldhp}=>#{pkmn.hp})")
  808.     else
  809.       PBDebug.log("[HP change] #{pkmn.pbThis} gained #{hpchange} HP (#{oldhp}=>#{pkmn.hp})")
  810.     end
  811.     if anim && @battle.battlescene
  812.       if pkmn.hp>oldhp
  813.         pbCommonAnimation("HealthUp",pkmn,nil)
  814.       elsif pkmn.hp<oldhp
  815.         pbCommonAnimation("HealthDown",pkmn,nil)
  816.       end
  817.     end
  818.     sprite= pkmn.index == 0 ? @sprites["battlebox0"]:@sprites["battleboxM"]
  819.     sprite.animateHP(oldhp,pkmn.hp)
  820.     while sprite.animatingHP
  821.       pbGraphicsUpdate
  822.       pbInputUpdate
  823.       pbFrameUpdate
  824.       sprite.update
  825.     end
  826.   end
  827.  
  828.   # This method is called whenever a Pokémon faints.
  829.   def pbFainted(pkmn)
  830.     frames=pbCryFrameLength(pkmn.pokemon)
  831.     pbPlayCry(pkmn.pokemon)
  832.     frames.times do
  833.       pbGraphicsUpdate
  834.       pbInputUpdate
  835.       pbFrameUpdate
  836.     end
  837.     @sprites["shadow#{pkmn.index}"].visible=false
  838.     pkmnsprite=@sprites["pokemon#{pkmn.index}"]
  839.     ycoord=0
  840.     if @battle.doublebattle
  841.       ycoord=PokeBattle_SceneConstants::PLAYERBATTLERD1_Y if pkmn.index==0
  842.       ycoord=PokeBattle_SceneConstants::FOEBATTLERD1_Y if pkmn.index==1
  843.       ycoord=PokeBattle_SceneConstants::PLAYERBATTLERD2_Y if pkmn.index==2
  844.       ycoord=PokeBattle_SceneConstants::FOEBATTLERD2_Y if pkmn.index==3
  845.     else
  846.       if @battle.pbIsOpposing?(pkmn.index)
  847.         ycoord=PokeBattle_SceneConstants::FOEBATTLER_Y
  848.       else
  849.         ycoord=PokeBattle_SceneConstants::PLAYERBATTLER_Y
  850.       end
  851.     end
  852.     pbSEPlay("faint")
  853.     loop do
  854.       pkmnsprite.y+=8
  855.       if pkmnsprite.y-pkmnsprite.oy+pkmnsprite.src_rect.height>=ycoord
  856.         pkmnsprite.src_rect.height=ycoord-pkmnsprite.y+pkmnsprite.oy
  857.       end
  858.       pbGraphicsUpdate
  859.       pbInputUpdate
  860.       pbFrameUpdate
  861.       break if pkmnsprite.y>=ycoord
  862.     end
  863.     pkmnsprite.visible=false
  864.     battlebox = pkmn.index == 0 ? @sprites["battlebox0"] : @sprites["battleboxM"]
  865.     8.times do
  866.       battlebox.opacity-=32
  867.       pbGraphicsUpdate
  868.       pbInputUpdate
  869.       pbFrameUpdate
  870.     end
  871.     battlebox.visible=false
  872.     pkmn.pbResetForm
  873.   end
  874. end
  875.  
  876. #send out the other pkmn
  877. class PokeballSendOutAnimationRotation
  878.   #initializes the class and throws a pokemon to the position assigned
  879.   def initialize(sprite,spritehash,pkmn,illusionpoke,x,y,zoom,nameExtension,scene)
  880.     @disposed=false
  881.     @pkmn = pkmn
  882.     @ballused=pkmn.pokemon ? pkmn.pokemon.ballused : 0
  883.     @PokemonBattlerSprite=sprite
  884.     @PokemonBattlerSprite.visible=false
  885.     @PokemonBattlerSprite.tone=Tone.new(248,248,248,248)
  886.     @PokemonBattlerSprite.y=0
  887.     @pokeballsprite=IconSprite.new(0,0,sprite.viewport)
  888.     @pokeballsprite.setBitmap(sprintf("Graphics/Pictures/ball%02d",@ballused))
  889.     @viewport = scene.viewport
  890.     @scene = scene
  891.     @zoom = zoom
  892.    
  893.     @spritex=x
  894.     @spritey=y
  895.    
  896.     @illusionpoke = illusionpoke #ILLUSION
  897.     if illusionpoke != nil #ILLUSION
  898.       #@spritey+=adjustBattleSpriteY(sprite,illusionpoke.species,pkmn.index,nil,true,illusionpoke.formOffsetY)
  899.     else
  900.       #@spritey+=adjustBattleSpriteY(sprite,pkmn.species,pkmn.index,nil,true,pkmn.formOffsetY)
  901.     end #ILLUSION
  902.     @endspritey=@spritey
  903.     @spritehash=spritehash
  904.     @pokeballsprite.x=@spritex-@pokeballsprite.bitmap.width/2
  905.     @pokeballsprite.y=@spritey-@pokeballsprite.bitmap.height/2-4
  906.     @pokeballsprite.z=@PokemonBattlerSprite.z+1
  907.     @pkmn=pkmn
  908.    
  909.     @shadowName = "shadow" + nameExtension
  910.     @shadowX=@spritex
  911.     @shadowY=PokeBattle_SceneConstants::FOEBASEY + PokeBattle_SceneConstants::FOESHADOW_ROT_RL_YSHIFT
  912.     @scene.pbAddSprite(@shadowName,@shadowX,@shadowY,"Graphics/Pictures/battleShadow",
  913.         @viewport)
  914.     if @spritehash[@shadowName] && @spritehash[@shadowName].bitmap!=nil
  915.       @spritehash[@shadowName].z=2
  916.       @shadowX-=@spritehash[@shadowName].bitmap.width/2
  917.       @shadowY-=@spritehash[@shadowName].bitmap.height/2
  918.       @spritehash[@shadowName].x=@shadowX
  919.       @spritehash[@shadowName].y=@shadowY
  920.     end
  921.     if illusionpoke != nil #ILLUSION
  922.       @shadowVisible=showShadow?(illusionpoke.species)
  923.     else
  924.       @shadowVisible=showShadow?(pkmn.species)
  925.     end #ILLUSION
  926.     @stepspritey=(@spritey-@endspritey)
  927.     @stepspritey=(@spritey-@endspritey)
  928.     @zoomstep=(1.0-STARTZOOM)/SPRITESTEPS * @zoom
  929.     @animdone=false
  930.     @frame=0
  931.   end
  932.  
  933.     def disposed?
  934.     return @disposed
  935.   end
  936.  
  937.   def animdone?
  938.     return @animdone
  939.   end
  940.  
  941.   def dispose
  942.     return if disposed?
  943.     @pokeballsprite.dispose
  944.     @disposed=true
  945.   end
  946.  
  947.   def update
  948.     return if disposed?
  949.     @pokeballsprite.update
  950.     @frame+=1
  951.     if @frame==2
  952.       pbSEPlay("recall")
  953.     end
  954.     if @frame==4
  955.       @PokemonBattlerSprite.visible=true
  956.       @PokemonBattlerSprite.z=26
  957.       @PokemonBattlerSprite.zoom_x=STARTZOOM * @zoom
  958.       @PokemonBattlerSprite.zoom_y=STARTZOOM * @zoom
  959.       pbSpriteSetCenter(@PokemonBattlerSprite,@spritex,@spritey)
  960.       if @illusionpoke != nil #ILLUSION
  961.         pbPlayCry(@illusionpoke)
  962.       else
  963.         pbPlayCry(@pkmn.pokemon ? @pkmn.pokemon : @pkmn.species)
  964.       end #ILLUSION
  965.       @pokeballsprite.setBitmap(sprintf("Graphics/Pictures/ball%02d_open",@ballused))
  966.     end
  967.     if @frame==8
  968.       @pokeballsprite.visible=false
  969.     end
  970.     if @frame>8 && @frame<=16
  971.       color=Color.new(248,248,248,256-(16-@frame)*32)
  972.       @spritehash["enemybase"].color=color
  973.       @spritehash["playerbase"].color=color  
  974.       @spritehash["battlebg"].color=color
  975.       for i in 0...4
  976.         @spritehash["shadow#{i}"].color=color if @spritehash["shadow#{i}"]
  977.       end
  978.       @spritehash[@shadowName].color=color if @spritehash[@shadowName]
  979.     end
  980.     if @frame>16 && @frame<=24
  981.       color=Color.new(248,248,248,(24-@frame)*32)
  982.       tone=(24-@frame)*32
  983.       @PokemonBattlerSprite.tone=Tone.new(tone,tone,tone,tone)
  984.       @spritehash["enemybase"].color=color
  985.       @spritehash["playerbase"].color=color  
  986.       @spritehash["battlebg"].color=color
  987.       for i in 0...4
  988.         @spritehash["shadow#{i}"].color=color if @spritehash["shadow#{i}"]
  989.       end
  990.       @spritehash[@shadowName].color=color if @spritehash[@shadowName]
  991.     end
  992.     #CHANGED
  993.     if @frame>5 && @PokemonBattlerSprite.zoom_x<BATTLERZOOM * @zoom
  994.       @PokemonBattlerSprite.zoom_x+=@zoomstep
  995.       @PokemonBattlerSprite.zoom_y+=@zoomstep
  996.       @PokemonBattlerSprite.zoom_x=BATTLERZOOM * @zoom if @PokemonBattlerSprite.zoom_x > BATTLERZOOM * @zoom
  997.       @PokemonBattlerSprite.zoom_y=BATTLERZOOM * @zoom if @PokemonBattlerSprite.zoom_y > BATTLERZOOM * @zoom
  998.       #currentY=@spritey - @PokemonBattlerSprite.height*@PokemonBattlerSprite.zoom_y
  999.       currentY = adjustBattleSpriteY(@PokemonBattlerSprite,@pkmn.pokemon.species,1)*@PokemonBattlerSprite.zoom_y
  1000.       currentY += PokeBattle_SceneConstants::FOEBATTLER_Y + PokeBattle_SceneConstants::FOEBATTLER_ROT_RL_YSHIFT
  1001.       @PokemonBattlerSprite.x=@spritex - @PokemonBattlerSprite.width*@PokemonBattlerSprite.zoom_x/2
  1002.       @PokemonBattlerSprite.y=currentY
  1003.      
  1004.       end
  1005.     if @PokemonBattlerSprite.tone.gray<=0 && @PokemonBattlerSprite.zoom_x>=BATTLERZOOM * @zoom
  1006.       #///
  1007.       @animdone=true
  1008.       if @spritehash[@shadowName]
  1009.         @spritehash[@shadowName].x=@shadowX
  1010.         @spritehash[@shadowName].y=@shadowY
  1011.         @spritehash[@shadowName].visible=@shadowVisible
  1012.       end
  1013.     end
  1014.   end
  1015. end
  1016.  
  1017. #the moves/rotation/mega selection
  1018. class FightRotationMenuDisplay
  1019.   attr_reader :battler
  1020.   attr_reader :index
  1021.   attr_accessor :megaButton
  1022.   attr_accessor :rotation
  1023.  
  1024.   def initialize(battler,viewport=nil)
  1025.     @display=nil
  1026.     if PokeBattle_SceneConstants::USEFIGHTBOX
  1027.       @display=IconSprite.new(0,Graphics.height-96,viewport)
  1028.       @display.setBitmap("Graphics/Pictures/battleFight")
  1029.     end
  1030.     @window=Window_CommandPokemon.newWithSize([],0,Graphics.height-96,320,96,viewport)
  1031.     @window.columns=2
  1032.     @window.columnSpacing=4
  1033.     @window.ignore_input=true
  1034.     pbSetNarrowFont(@window.contents)
  1035.     @info=Window_AdvancedTextPokemon.newWithSize(
  1036.        "",320,Graphics.height-96,Graphics.width-320,96,viewport)
  1037.     pbSetNarrowFont(@info.contents)
  1038.     @ctag=shadowctag(PokeBattle_SceneConstants::MENUBASECOLOR,
  1039.                      PokeBattle_SceneConstants::MENUSHADOWCOLOR)
  1040.     @buttons=nil
  1041.     @battler=battler
  1042.     @index=0
  1043.     @megaButton=0 # 0=don't show, 1=show, 2=pressed
  1044.     @rotation=1 #0=don't show, 1=rotate both sides, 2=rotate left only, 3=rotate right only
  1045.     if PokeBattle_SceneConstants::USEFIGHTBOX
  1046.       @window.opacity=0
  1047.       @window.x=Graphics.width
  1048.       @info.opacity=0
  1049.       @info.x=Graphics.width+Graphics.width-96
  1050.       @buttons=FightRotationMenuButtons.new(self.index,nil,viewport)
  1051.     end
  1052.     refresh
  1053.   end
  1054.  
  1055.   def x; @window.x; end
  1056.   def x=(value)
  1057.     @window.x=value
  1058.     @info.x=value
  1059.     @display.x=value if @display
  1060.     @buttons.x=value if @buttons
  1061.   end
  1062.  
  1063.   def y; @window.y; end
  1064.   def y=(value)
  1065.     @window.y=value
  1066.     @info.y=value
  1067.     @display.y=value if @display
  1068.     @buttons.y=value if @buttons
  1069.   end
  1070.  
  1071.   def z; @window.z; end
  1072.   def z=(value)
  1073.     @window.z=value
  1074.     @info.z=value
  1075.     @display.z=value if @display
  1076.     @buttons.z=value+1 if @buttons
  1077.   end
  1078.  
  1079.   def ox; @window.ox; end
  1080.   def ox=(value)
  1081.     @window.ox=value
  1082.     @info.ox=value
  1083.     @display.ox=value if @display
  1084.     @buttons.ox=value if @buttons
  1085.   end
  1086.  
  1087.   def oy; @window.oy; end
  1088.   def oy=(value)
  1089.     @window.oy=value
  1090.     @info.oy=value
  1091.     @display.oy=value if @display
  1092.     @buttons.oy=value if @buttons
  1093.   end
  1094.  
  1095.   def visible; @window.visible; end
  1096.   def visible=(value)
  1097.     @window.visible=value
  1098.     @info.visible=value
  1099.     @display.visible=value if @display
  1100.     @buttons.visible=value if @buttons
  1101.   end
  1102.  
  1103.   def color; @window.color; end
  1104.   def color=(value)
  1105.     @window.color=value
  1106.     @info.color=value
  1107.     @display.color=value if @display
  1108.     @buttons.color=value if @buttons
  1109.   end
  1110.  
  1111.   def disposed?
  1112.     return @info.disposed? || @window.disposed?
  1113.   end
  1114.  
  1115.   def dispose
  1116.     return if disposed?
  1117.     @info.dispose
  1118.     @display.dispose if @display
  1119.     @buttons.dispose if @buttons
  1120.     @window.dispose
  1121.   end
  1122.  
  1123.   def battler=(value)
  1124.     @battler=value
  1125.     refresh
  1126.   end
  1127.  
  1128.   def setIndex(value)
  1129.     if @battler && (@battler.moves[value].id!=0 || value > 4)
  1130.       @index=value
  1131.       @window.index=value
  1132.       refresh
  1133.       return true
  1134.     end
  1135.     return false
  1136.   end
  1137.  
  1138.   def refresh
  1139.     return if !@battler
  1140.     commands=[]
  1141.     for i in 0...4
  1142.       break if @battler.moves[i].id==0
  1143.       commands.push(@battler.moves[i].name)
  1144.     end
  1145.     @window.commands=commands
  1146.     selmove=@battler.moves[@index-2]
  1147.     movetype=PBTypes.getName(selmove.type)
  1148.     if selmove.totalpp==0
  1149.       @info.text=_ISPRINTF("{1:s}PP: ---<br>TYPE/{2:s}",@ctag,movetype)
  1150.     else
  1151.       @info.text=_ISPRINTF("{1:s}PP: {2: 2d}/{3: 2d}<br>TYPE/{4:s}",
  1152.          @ctag,selmove.pp,selmove.totalpp,movetype)
  1153.     end
  1154.   end
  1155.  
  1156.   def update
  1157.     @info.update
  1158.     @window.update
  1159.     @display.update if @display
  1160.     if @buttons
  1161.       moves=@battler ? @battler.moves : nil
  1162.       @buttons.update(self.index,moves,@megaButton,@rotation)
  1163.     end
  1164.   end
  1165. end
  1166.  
  1167. #actually show the fight buttons
  1168. class FightRotationMenuButtons < BitmapSprite
  1169.   UPPERGAP=46
  1170.  
  1171.   def initialize(index=0,moves=nil,viewport=nil)
  1172.     super(Graphics.width,96+UPPERGAP,viewport)
  1173.     self.x=0
  1174.     self.y=Graphics.height-96-UPPERGAP
  1175.     pbSetNarrowFont(self.bitmap)
  1176.     @buttonbitmap=AnimatedBitmap.new("Graphics/Pictures/battleFightButtons")
  1177.     @typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
  1178.     @megaevobitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/battleMegaEvo"))
  1179.     @rotleftbitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/battleRotateLeft"))
  1180.     @rotrightbitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/battleRotateRight"))
  1181.     refresh(index,moves,0,0)
  1182.   end
  1183.  
  1184.   def dispose
  1185.     @buttonbitmap.dispose
  1186.     @typebitmap.dispose
  1187.     @megaevobitmap.dispose
  1188.     @rotleftbitmap.dispose
  1189.     @rotrightbitmap.dispose
  1190.     super
  1191.   end
  1192.  
  1193.   def update(index=0,moves=nil,megaButton=0,rotationbattle=1)
  1194.     refresh(index,moves,megaButton,rotationbattle)
  1195.   end
  1196.  
  1197.   def refresh(index,moves,megaButton,rotationbattle)
  1198.     return if !moves
  1199.     self.bitmap.clear
  1200.     moveboxes=_INTL("Graphics/Pictures/battleFightButtons")
  1201.     textpos=[]
  1202.     for i in 0...4
  1203.       next if i==index-2
  1204.       next if moves[i].id==0
  1205.       x=((i%2)==0) ? 4 : 192
  1206.       y=((i/2)==0) ? 6 : 48
  1207.       y+=UPPERGAP
  1208.       self.bitmap.blt(x,y,@buttonbitmap.bitmap,Rect.new(0,moves[i].type*46,192,46))
  1209.       textpos.push([_INTL("{1}",moves[i].name),x+96,y+8,2,
  1210.          PokeBattle_SceneConstants::MENUBASECOLOR,PokeBattle_SceneConstants::MENUSHADOWCOLOR])
  1211.     end
  1212.     ppcolors=[
  1213.        PokeBattle_SceneConstants::PPTEXTBASECOLOR,PokeBattle_SceneConstants::PPTEXTSHADOWCOLOR,
  1214.        PokeBattle_SceneConstants::PPTEXTBASECOLOR,PokeBattle_SceneConstants::PPTEXTSHADOWCOLOR,
  1215.        PokeBattle_SceneConstants::PPTEXTBASECOLORYELLOW,PokeBattle_SceneConstants::PPTEXTSHADOWCOLORYELLOW,
  1216.        PokeBattle_SceneConstants::PPTEXTBASECOLORORANGE,PokeBattle_SceneConstants::PPTEXTSHADOWCOLORORANGE,
  1217.        PokeBattle_SceneConstants::PPTEXTBASECOLORRED,PokeBattle_SceneConstants::PPTEXTSHADOWCOLORRED
  1218.     ]
  1219.     for i in 0...4
  1220.       next if i!=index-2
  1221.       next if moves[i].id==0
  1222.       x=((i%2)==0) ? 4 : 192
  1223.       y=((i/2)==0) ? 6 : 48
  1224.       y+=UPPERGAP
  1225.       self.bitmap.blt(x,y,@buttonbitmap.bitmap,Rect.new(192,moves[i].type*46,192,46))
  1226.       self.bitmap.blt(416,20+UPPERGAP,@typebitmap.bitmap,Rect.new(0,moves[i].type*28,64,28))
  1227.       textpos.push([_INTL("{1}",moves[i].name),x+96,y+8,2,
  1228.          PokeBattle_SceneConstants::MENUBASECOLOR,PokeBattle_SceneConstants::MENUSHADOWCOLOR])
  1229.       if moves[i].totalpp>0
  1230.         ppfraction=(4.0*moves[i].pp/moves[i].totalpp).ceil
  1231.         textpos.push([_INTL("PP: {1}/{2}",moves[i].pp,moves[i].totalpp),
  1232.            448,50+UPPERGAP,2,ppcolors[(4-ppfraction)*2],ppcolors[(4-ppfraction)*2+1]])
  1233.       end
  1234.     end
  1235.     pbDrawTextPositions(self.bitmap,textpos)
  1236.     if megaButton>0
  1237.       self.bitmap.blt(146,0,@megaevobitmap.bitmap,Rect.new(0,(megaButton-1)*46,96,46))
  1238.     end
  1239.    
  1240.     #show rotation buttons
  1241.     case rotationbattle
  1242.     when 0
  1243.     when 1
  1244.       self.bitmap.blt(0,0,@rotleftbitmap.bitmap,Rect.new(0,54,54,54))
  1245.       self.bitmap.blt(54,0,@rotrightbitmap.bitmap,Rect.new(0,54,54,54))
  1246.       if index == 0
  1247.         self.bitmap.blt(0,0,@rotleftbitmap.bitmap,Rect.new(0,108,54,54))
  1248.       end
  1249.       if index == 1
  1250.         self.bitmap.blt(54,0,@rotrightbitmap.bitmap,Rect.new(0,108,54,54))
  1251.       end
  1252.     when 2
  1253.       self.bitmap.blt(0,0,@rotleftbitmap.bitmap,Rect.new(0,54,54,54))
  1254.       self.bitmap.blt(54,0,@rotrightbitmap.bitmap,Rect.new(0,0,54,54))
  1255.       if index == 0 #shouldn't happen ...
  1256.         self.bitmap.blt(0,0,@rotleftbitmap.bitmap,Rect.new(0,108,54,54))
  1257.       end
  1258.       if index == 1
  1259.         self.bitmap.blt(54,0,@rotrightbitmap.bitmap,Rect.new(0,108,54,54))
  1260.       end
  1261.     when 3
  1262.       self.bitmap.blt(0,0,@rotleftbitmap.bitmap,Rect.new(0,0,54,54))
  1263.       self.bitmap.blt(54,0,@rotrightbitmap.bitmap,Rect.new(0,54,54,54))
  1264.       if index == 0
  1265.         self.bitmap.blt(0,0,@rotleftbitmap.bitmap,Rect.new(0,108,54,54))
  1266.       end
  1267.       if index == 1 #shouldn't happen ...
  1268.         self.bitmap.blt(54,0,@rotrightbitmap.bitmap,Rect.new(0,108,54,54))
  1269.       end
  1270.     end
  1271.   end
  1272. end
  1273.  
  1274. #databox for the enemy
  1275. class PokemonDataBoxRotation < SpriteWrapper
  1276.   attr_accessor :place #0 left, 1 middle, 2 right
  1277.   attr_reader :battler
  1278.   attr_accessor :selected
  1279.   attr_accessor :appearing
  1280.   attr_reader :animatingHP
  1281.  
  1282.   def initialize(battler,doublebattle,viewport=nil,place=0)
  1283.     super(viewport)
  1284.     @place = place
  1285.     @battler=battler
  1286.     @selected=0
  1287.     @frame=0
  1288.     @showhp=false
  1289.     @appearing=false
  1290.     @animatingHP=false
  1291.     @starthp=0
  1292.     @currenthp=0
  1293.     @endhp=0
  1294.     if (@battler.index&1)==0 # if player's Pokémon
  1295.       @spritebaseX=34
  1296.     else
  1297.       @spritebaseX=16
  1298.     end
  1299.     @databox=AnimatedBitmap.new("Graphics/Pictures/battleFoeBoxS")
  1300.     @spriteX=PokeBattle_SceneConstants::FOEBOX_X
  1301.     @spriteY=@place * @databox.bitmap.height
  1302.     @statuses=AnimatedBitmap.new(_INTL("Graphics/Pictures/battleStatuses"))
  1303.     @contents=BitmapWrapper.new(@databox.width,@databox.height)
  1304.     self.bitmap=@contents
  1305.     self.visible=false
  1306.     self.z=50
  1307.     refresh
  1308.   end
  1309.  
  1310.   def dispose
  1311.     @statuses.dispose
  1312.     @databox.dispose
  1313.     @contents.dispose
  1314.     super
  1315.   end
  1316.  
  1317.   def hp
  1318.     return @animatingHP ? @currenthp : @battler.hp
  1319.   end
  1320.  
  1321.   def animateHP(oldhp,newhp)
  1322.     @starthp=oldhp
  1323.     @currenthp=oldhp
  1324.     @endhp=newhp
  1325.     @animatingHP=true
  1326.   end
  1327.  
  1328.   def appear
  1329.     refresh
  1330.     self.visible=true
  1331.     self.opacity=255
  1332.     if (@battler.index&1)==0 # if player's Pokémon
  1333.       self.x=@spriteX+320
  1334.     else
  1335.       self.x=@spriteX-320
  1336.     end
  1337.     self.y=@spriteY
  1338.     @appearing=true
  1339.   end
  1340.  
  1341.   def refresh
  1342.     self.bitmap.clear
  1343.     return if !@battler.pokemon
  1344.     self.bitmap.blt(0,0,@databox.bitmap,Rect.new(0,0,@databox.width,@databox.height))
  1345.     base=PokeBattle_SceneConstants::BOXTEXTBASECOLOR
  1346.     shadow=PokeBattle_SceneConstants::BOXTEXTSHADOWCOLOR
  1347.     pokename=@battler.name
  1348.     pbSetSystemFont(self.bitmap)
  1349.     textpos=[
  1350.        [pokename,@spritebaseX+8,6,false,base,shadow]
  1351.     ]
  1352.     genderX=self.bitmap.text_size(pokename).width
  1353.     genderX+=@spritebaseX+14
  1354.     case @battler.displayGender
  1355.     when 0 # Male
  1356.       textpos.push([_INTL("♂"),genderX,6,false,Color.new(48,96,216),shadow])
  1357.     when 1 # Female
  1358.       textpos.push([_INTL("♀"),genderX,6,false,Color.new(248,88,40),shadow])
  1359.     end
  1360.     pbDrawTextPositions(self.bitmap,textpos)
  1361.     pbSetSmallFont(self.bitmap)
  1362.     textpos=[
  1363.        [_INTL("Lv{1}",@battler.level),@spritebaseX+202,8,true,base,shadow]
  1364.     ]
  1365.     if @showhp
  1366.       hpstring=_ISPRINTF("{1: 2d}/{2: 2d}",self.hp,@battler.totalhp)
  1367.       textpos.push([hpstring,@spritebaseX+188,48,true,base,shadow])
  1368.     end
  1369.     pbDrawTextPositions(self.bitmap,textpos)
  1370.     imagepos=[]
  1371.     if @battler.isShiny?
  1372.       shinyX=206
  1373.       shinyX=-6 if (@battler.index&1)==0 # If player's Pokémon
  1374.       imagepos.push(["Graphics/Pictures/shiny.png",@spritebaseX+shinyX,36,0,0,-1,-1])
  1375.     end
  1376.     if @battler.isMega?
  1377.       imagepos.push(["Graphics/Pictures/battleMegaEvoBox.png",@spritebaseX+8,34,0,0,-1,-1])
  1378.     elsif @battler.isPrimal?
  1379.       if isConst?(@battler.pokemon.species,PBSpecies,:KYOGRE)
  1380.         imagepos.push(["Graphics/Pictures/battlePrimalKyogreBox.png",@spritebaseX+140,4,0,0,-1,-1])
  1381.       elsif isConst?(@battler.pokemon.species,PBSpecies,:GROUDON)
  1382.         imagepos.push(["Graphics/Pictures/battlePrimalGroudonBox.png",@spritebaseX+140,4,0,0,-1,-1])
  1383.       end
  1384.     end
  1385.     if @battler.owned && (@battler.index&1)==1
  1386.       imagepos.push(["Graphics/Pictures/battleBoxOwned.png",@spritebaseX+8,36,0,0,-1,-1])
  1387.     end
  1388.     pbDrawImagePositions(self.bitmap,imagepos)
  1389.     if @battler.status>0
  1390.       self.bitmap.blt(@spritebaseX+24,36,@statuses.bitmap,
  1391.          Rect.new(0,(@battler.status-1)*16,44,16))
  1392.     end
  1393.     hpGaugeSize=PokeBattle_SceneConstants::HPGAUGESIZE
  1394.     hpgauge=@battler.totalhp==0 ? 0 : (self.hp*hpGaugeSize/@battler.totalhp)
  1395.     hpgauge=2 if hpgauge==0 && self.hp>0
  1396.     hpzone=0
  1397.     hpzone=1 if self.hp<=(@battler.totalhp/2).floor
  1398.     hpzone=2 if self.hp<=(@battler.totalhp/4).floor
  1399.     hpcolors=[
  1400.        PokeBattle_SceneConstants::HPCOLORGREENDARK,
  1401.        PokeBattle_SceneConstants::HPCOLORGREEN,
  1402.        PokeBattle_SceneConstants::HPCOLORYELLOWDARK,
  1403.        PokeBattle_SceneConstants::HPCOLORYELLOW,
  1404.        PokeBattle_SceneConstants::HPCOLORREDDARK,
  1405.        PokeBattle_SceneConstants::HPCOLORRED
  1406.     ]
  1407.     # fill with black (shows what the HP used to be)
  1408.     hpGaugeX=PokeBattle_SceneConstants::HPGAUGE_X
  1409.     hpGaugeY=PokeBattle_SceneConstants::HPGAUGE_Y
  1410.     if @animatingHP && self.hp>0
  1411.       self.bitmap.fill_rect(@spritebaseX+hpGaugeX,hpGaugeY,
  1412.          @starthp*hpGaugeSize/@battler.totalhp,6,Color.new(0,0,0))
  1413.     end
  1414.     # fill with HP color
  1415.     self.bitmap.fill_rect(@spritebaseX+hpGaugeX,hpGaugeY,hpgauge,2,hpcolors[hpzone*2])
  1416.     self.bitmap.fill_rect(@spritebaseX+hpGaugeX,hpGaugeY+2,hpgauge,4,hpcolors[hpzone*2+1])
  1417.   end
  1418.  
  1419.   def update
  1420.     super
  1421.     @frame+=1
  1422.     if @animatingHP
  1423.       if @currenthp<@endhp
  1424.         @currenthp+=[1,(@battler.totalhp/PokeBattle_SceneConstants::HPGAUGESIZE).floor].max
  1425.         @currenthp=@endhp if @currenthp>@endhp
  1426.       elsif @currenthp>@endhp
  1427.         @currenthp-=[1,(@battler.totalhp/PokeBattle_SceneConstants::HPGAUGESIZE).floor].max
  1428.         @currenthp=@endhp if @currenthp<@endhp
  1429.       end
  1430.       @animatingHP=false if @currenthp==@endhp
  1431.       refresh
  1432.     end
  1433.     if @appearing
  1434.       if (@battler.index&1)==0 # if player's Pokémon
  1435.         self.x-=12
  1436.         self.x=@spriteX if self.x<@spriteX
  1437.         @appearing=false if self.x<=@spriteX
  1438.       else
  1439.         self.x+=12
  1440.         self.x=@spriteX if self.x>@spriteX
  1441.         @appearing=false if self.x>=@spriteX
  1442.       end
  1443.       self.y=@spriteY
  1444.       return
  1445.     end
  1446.     @spriteY=@place * @databox.bitmap.height
  1447.     self.x=@spriteX
  1448.     self.y=@spriteY
  1449.     # Data box bobbing while Pokémon is selected
  1450.     if ((@frame/10).floor&1)==1 && @selected==1   # Choosing commands for this Pokémon
  1451.       self.y=@spriteY+2
  1452.     elsif ((@frame/10).floor&1)==1 && @selected==2   # When targeted or damaged
  1453.       self.y=@spriteY+2
  1454.     end
  1455.   end
  1456. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement