Vendily

PB_Scene Changes/Additions

Oct 4th, 2018
191
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   def pbDreamStart
  2.     @briefmessage=false
  3.     @sprites["battlebox0"]=DreamWorldDataBox.new(@battle.battlers[0],@battle.doublebattle,@viewport)
  4.     @sprites["battlebox0"].appear
  5.     loop do
  6.       @sprites["battlebox0"].update
  7.       pbGraphicsUpdate
  8.       pbInputUpdate
  9.       pbFrameUpdate
  10.       break if !@sprites["battlebox0"].appearing
  11.     end
  12.     pbRefresh
  13.   end
  14.  
  15.   def pbStartDreamBattle(battle)
  16.     # Called whenever the battle begins
  17.     $lowHPbattle=false
  18.     @battle=battle
  19.     @lastcmd=[0,0,0,0]
  20.     @lastmove=[0,0,0,0]
  21.     @showingplayer=true
  22.     @showingenemy=true
  23.     @sprites.clear
  24.     @viewport=Viewport.new(0,Graphics.height/2,Graphics.width,0)
  25.     @viewport.z=99999
  26.     #@sprites["weather"] = RPG::BattleWeather.new(@viewport) if !@safaribattle
  27.     @traineryoffset=(Graphics.height-320) # Adjust player's side for screen size
  28.     @foeyoffset=(@traineryoffset*3/4).floor  # Adjust foe's side for screen size
  29.     pbBackdrop
  30.     pbAddSprite("partybarfoe",
  31.        PokeBattle_SceneConstants::FOEPARTYBAR_X,
  32.        PokeBattle_SceneConstants::FOEPARTYBAR_Y,
  33.        "Graphics/Pictures/battleLineup",@viewport)
  34.     pbAddSprite("partybarplayer",
  35.        PokeBattle_SceneConstants::PLAYERPARTYBAR_X,
  36.        PokeBattle_SceneConstants::PLAYERPARTYBAR_Y,
  37.        "Graphics/Pictures/battleLineup",@viewport)
  38.     @sprites["partybarfoe"].x-=@sprites["partybarfoe"].bitmap.width
  39.     @sprites["partybarplayer"].mirror=true
  40.     @sprites["partybarfoe"].z=40
  41.     @sprites["partybarplayer"].z=40
  42.     @sprites["partybarfoe"].visible=false
  43.     @sprites["partybarplayer"].visible=false
  44.     if @battle.player.is_a?(Array)
  45.       trainerfile=pbPlayerSpriteBackFile(@battle.player[0].trainertype)
  46.       pbAddSprite("player",
  47.            PokeBattle_SceneConstants::PLAYERTRAINERD1_X,
  48.            PokeBattle_SceneConstants::PLAYERTRAINERD1_Y,trainerfile,@viewport)
  49.       trainerfile=pbTrainerSpriteBackFile(@battle.player[1].trainertype)
  50.       pbAddSprite("playerB",
  51.            PokeBattle_SceneConstants::PLAYERTRAINERD2_X,
  52.            PokeBattle_SceneConstants::PLAYERTRAINERD2_Y,trainerfile,@viewport)
  53.       if @sprites["player"].bitmap
  54.         if @sprites["player"].bitmap.width>@sprites["player"].bitmap.height
  55.           @sprites["player"].src_rect.x=0
  56.           @sprites["player"].src_rect.width=@sprites["player"].bitmap.width/5
  57.         end
  58.         @sprites["player"].x-=(@sprites["player"].src_rect.width/2)
  59.         @sprites["player"].y-=@sprites["player"].bitmap.height
  60.         @sprites["player"].z=30
  61.       end
  62.       if @sprites["playerB"].bitmap
  63.         if @sprites["playerB"].bitmap.width>@sprites["playerB"].bitmap.height
  64.           @sprites["playerB"].src_rect.x=0
  65.           @sprites["playerB"].src_rect.width=@sprites["playerB"].bitmap.width/5
  66.         end
  67.         @sprites["playerB"].x-=(@sprites["playerB"].src_rect.width/2)
  68.         @sprites["playerB"].y-=@sprites["playerB"].bitmap.height
  69.         @sprites["playerB"].z=31
  70.       end
  71.     else
  72.       trainerfile=pbPlayerSpriteBackFile(@battle.player.trainertype)
  73.       pbAddSprite("player",
  74.            PokeBattle_SceneConstants::PLAYERTRAINER_X,
  75.            PokeBattle_SceneConstants::PLAYERTRAINER_Y,trainerfile,@viewport)
  76.       if @sprites["player"].bitmap
  77.         if @sprites["player"].bitmap.width>@sprites["player"].bitmap.height
  78.           @sprites["player"].src_rect.x=0
  79.           @sprites["player"].src_rect.width=@sprites["player"].bitmap.width/5
  80.         end
  81.         @sprites["player"].x-=(@sprites["player"].src_rect.width/2)
  82.         @sprites["player"].y-=@sprites["player"].bitmap.height
  83.         @sprites["player"].z=30
  84.       end
  85.     end
  86.     if @battle.opponent
  87.       if @battle.opponent.is_a?(Array)
  88.         trainerfile=pbTrainerSpriteFile(@battle.opponent[1].trainertype)
  89.         pbAddSprite("trainer2",
  90.            PokeBattle_SceneConstants::FOETRAINERD2_X,
  91.            PokeBattle_SceneConstants::FOETRAINERD2_Y,trainerfile,@viewport)
  92.         trainerfile=pbTrainerSpriteFile(@battle.opponent[0].trainertype)
  93.         pbAddSprite("trainer",
  94.            PokeBattle_SceneConstants::FOETRAINERD1_X,
  95.            PokeBattle_SceneConstants::FOETRAINERD1_Y,trainerfile,@viewport)
  96.       else
  97.         trainerfile=pbTrainerSpriteFile(@battle.opponent.trainertype)
  98.         pbAddSprite("trainer",
  99.            PokeBattle_SceneConstants::FOETRAINER_X,
  100.            PokeBattle_SceneConstants::FOETRAINER_Y,trainerfile,@viewport)
  101.       end
  102.     else
  103.       trainerfile="Graphics/Characters/trfront"
  104.       pbAddSprite("trainer",
  105.            PokeBattle_SceneConstants::FOETRAINER_X,
  106.            PokeBattle_SceneConstants::FOETRAINER_Y,trainerfile,@viewport)
  107.     end
  108.     if @sprites["trainer"].bitmap
  109.       @sprites["trainer"].x-=(@sprites["trainer"].bitmap.width/2)
  110.       @sprites["trainer"].y-=@sprites["trainer"].bitmap.height
  111.       @sprites["trainer"].z=8
  112.     end
  113.     if @sprites["trainer2"] && @sprites["trainer2"].bitmap
  114.       @sprites["trainer2"].x-=(@sprites["trainer2"].bitmap.width/2)
  115.       @sprites["trainer2"].y-=@sprites["trainer2"].bitmap.height
  116.       @sprites["trainer2"].z=7
  117.     end
  118.     @sprites["shadow0"]=IconSprite.new(0,0,@viewport)
  119.     @sprites["shadow0"].z=3
  120.     pbAddSprite("shadow1",0,0,"Graphics/Pictures/battleShadow",@viewport)
  121.     @sprites["shadow1"].z=3
  122.     @sprites["shadow1"].visible=false
  123.     @sprites["pokemon0"]=PokemonBattlerSprite.new(battle.doublebattle,0,@viewport)
  124.     @sprites["pokemon0"].z=21
  125.     @sprites["pokemon1"]=PokemonBattlerSprite.new(battle.doublebattle,1,@viewport)
  126.     @sprites["pokemon1"].z=16
  127.     if battle.doublebattle
  128.       @sprites["shadow2"]=IconSprite.new(0,0,@viewport)
  129.       @sprites["shadow2"].z=3
  130.       pbAddSprite("shadow3",0,0,"Graphics/Pictures/battleShadow",@viewport)
  131.       @sprites["shadow3"].z=3
  132.       @sprites["shadow3"].visible=false
  133.       @sprites["pokemon2"]=PokemonBattlerSprite.new(battle.doublebattle,2,@viewport)
  134.       @sprites["pokemon2"].z=26
  135.       @sprites["pokemon3"]=PokemonBattlerSprite.new(battle.doublebattle,3,@viewport)
  136.       @sprites["pokemon3"].z=11
  137.     end
  138.     @sprites["battlebox0"]=PokemonDataBox.new(battle.battlers[0],battle.doublebattle,@viewport)
  139.     @sprites["battlebox1"]=PokemonDataBox.new(battle.battlers[1],battle.doublebattle,@viewport)
  140.     if battle.doublebattle
  141.       @sprites["battlebox2"]=PokemonDataBox.new(battle.battlers[2],battle.doublebattle,@viewport)
  142.       @sprites["battlebox3"]=PokemonDataBox.new(battle.battlers[3],battle.doublebattle,@viewport)
  143.     end
  144.     pbAddSprite("messagebox",0,Graphics.height-96,"Graphics/Pictures/battleMessage",@viewport)
  145.     @sprites["messagebox"].z=90
  146.     @sprites["helpwindow"]=Window_UnformattedTextPokemon.newWithSize("",0,0,32,32,@viewport)
  147.     @sprites["helpwindow"].visible=false
  148.     @sprites["helpwindow"].z=90
  149.     @sprites["messagewindow"]=Window_AdvancedTextPokemon.new("")
  150.     @sprites["messagewindow"].letterbyletter=true
  151.     @sprites["messagewindow"].viewport=@viewport
  152.     @sprites["messagewindow"].z=100
  153.     @sprites["commandwindow"]=CommandMenuDisplay.new(@viewport)
  154.     @sprites["commandwindow"].z=100
  155.     @sprites["fightwindow"]=FightMenuDisplay.new(nil,@viewport)
  156.     @sprites["fightwindow"].z=100
  157.     pbShowWindow(MESSAGEBOX)
  158.     pbSetMessageMode(false)
  159.     playersprite1=@sprites["player"]
  160.     playersprite2=@sprites["playerB"]
  161.     trainersprite1=@sprites["trainer"]
  162.     trainersprite2=@sprites["trainer2"]
  163.     if @battle.party1.length>=1
  164.         if @battle.party1.length==1
  165.           @sprites["player"].visible=false
  166.           species=@battle.party1[0].species
  167.           @sprites["pokemon0"].setPokemonBitmap(@battle.party1[0],true)
  168.           @sprites["pokemon0"].tone=Tone.new(-128,-128,-128,-128)
  169.           @sprites["pokemon0"].x=PokeBattle_SceneConstants::PLAYERBATTLER_X
  170.           @sprites["pokemon0"].x-=@sprites["pokemon0"].width/2
  171.           @sprites["pokemon0"].y=PokeBattle_SceneConstants::PLAYERBATTLER_Y
  172.           #@sprites["pokemon0"].y=PokeBattle_SceneConstants::PLAYERBATTLER_Y_TOTEM if @battle.party2[0].isTotem?
  173.           @sprites["pokemon0"].y+=adjustBattleSpriteY(@sprites["pokemon0"],species,0)
  174.           @sprites["pokemon0"].visible=true
  175.           @sprites["shadow0"].x=PokeBattle_SceneConstants::PLAYERBATTLER_X
  176.           @sprites["shadow0"].y=PokeBattle_SceneConstants::PLAYERBATTLER_Y
  177.           @sprites["shadow0"].x-=@sprites["shadow0"].bitmap.width/2 if @sprites["shadow0"].bitmap!=nil
  178.           @sprites["shadow0"].y-=@sprites["shadow0"].bitmap.height/2 if @sprites["shadow0"].bitmap!=nil
  179.           @sprites["shadow0"].visible=showShadow?(species)
  180.           playersprite1=@sprites["pokemon0"]
  181.         elsif @battle.party1.length==2
  182.           @sprites["player"].visible=false
  183.           @sprites["playerB"].visible=false
  184.           species=@battle.party1[0].species
  185.           @sprites["pokemon0"].setPokemonBitmap(@battle.party1[0],true)
  186.           @sprites["pokemon0"].tone=Tone.new(-128,-128,-128,-128)
  187.           @sprites["pokemon0"].x=PokeBattle_SceneConstants::PLAYERBATTLERD1_X
  188.           @sprites["pokemon0"].x-=@sprites["pokemon1"].width/2
  189.           @sprites["pokemon0"].y=PokeBattle_SceneConstants::PLAYERBATTLERD1_Y
  190.           @sprites["pokemon0"].y+=adjustBattleSpriteY(@sprites["pokemon0"],species,0)
  191.           @sprites["pokemon0"].visible=true
  192.           @sprites["shadow0"].x=PokeBattle_SceneConstants::PLAYERBATTLERD1_X
  193.           @sprites["shadow0"].y=PokeBattle_SceneConstants::PLAYERBATTLERD1_Y
  194.           @sprites["shadow0"].x-=@sprites["shadow0"].bitmap.width/2 if @sprites["shadow0"].bitmap!=nil
  195.           @sprites["shadow0"].y-=@sprites["shadow0"].bitmap.height/2 if @sprites["shadow0"].bitmap!=nil
  196.           @sprites["shadow0"].visible=showShadow?(species)
  197.           playersprite1=@sprites["pokemon0"]
  198.           species=@battle.party1[1].species
  199.           @sprites["pokemon2"].setPokemonBitmap(@battle.party1[1],true)
  200.           @sprites["pokemon2"].tone=Tone.new(-128,-128,-128,-128)
  201.           @sprites["pokemon2"].x=PokeBattle_SceneConstants::PLAYERBATTLERD2_X
  202.           @sprites["pokemon2"].x-=@sprites["pokemon2"].width/2
  203.           @sprites["pokemon2"].y=PokeBattle_SceneConstants::PLAYERBATTLERD2_Y
  204.           @sprites["pokemon2"].y+=adjustBattleSpriteY(@sprites["pokemon2"],species,2)
  205.           @sprites["pokemon2"].visible=true
  206.           @sprites["shadow2"].x=PokeBattle_SceneConstants::PLAYERBATTLERD2_X
  207.           @sprites["shadow2"].y=PokeBattle_SceneConstants::PLAYERBATTLERD2_Y
  208.           @sprites["shadow2"].x-=@sprites["shadow2"].bitmap.width/2 if @sprites["shadow2"].bitmap!=nil
  209.           @sprites["shadow2"].y-=@sprites["shadow2"].bitmap.height/2 if @sprites["shadow2"].bitmap!=nil
  210.           @sprites["shadow2"].visible=showShadow?(species)
  211.           playersprite2=@sprites["pokemon2"]
  212.         end
  213.       end
  214.     if !@battle.opponent
  215.       @sprites["trainer"].visible=false
  216.       if @battle.party2.length>=1
  217.         if @battle.party2.length==1
  218.           species=@battle.party2[0].species
  219.           @sprites["pokemon1"].setPokemonBitmap(@battle.party2[0],false)
  220.           @sprites["pokemon1"].tone=Tone.new(-128,-128,-128,-128)
  221.           @sprites["pokemon1"].x=PokeBattle_SceneConstants::FOEBATTLER_X
  222.           @sprites["pokemon1"].x-=@sprites["pokemon1"].width/2
  223.           @sprites["pokemon1"].y=PokeBattle_SceneConstants::FOEBATTLER_Y
  224.           @sprites["pokemon1"].y=PokeBattle_SceneConstants::FOEBATTLER_Y_TOTEM if @battle.party2[0].isTotem?
  225.           @sprites["pokemon1"].y+=adjustBattleSpriteY(@sprites["pokemon1"],species,1)
  226.           @sprites["pokemon1"].visible=true
  227.           @sprites["shadow1"].x=PokeBattle_SceneConstants::FOEBATTLER_X
  228.           @sprites["shadow1"].y=PokeBattle_SceneConstants::FOEBATTLER_Y
  229.           @sprites["shadow1"].x-=@sprites["shadow1"].bitmap.width/2 if @sprites["shadow1"].bitmap!=nil
  230.           @sprites["shadow1"].y-=@sprites["shadow1"].bitmap.height/2 if @sprites["shadow1"].bitmap!=nil
  231.           @sprites["shadow1"].visible=showShadow?(species)
  232.           trainersprite1=@sprites["pokemon1"]
  233.         elsif @battle.party2.length==2
  234.           species=@battle.party2[0].species
  235.           @sprites["pokemon1"].setPokemonBitmap(@battle.party2[0],false)
  236.           @sprites["pokemon1"].tone=Tone.new(-128,-128,-128,-128)
  237.           @sprites["pokemon1"].x=PokeBattle_SceneConstants::FOEBATTLERD1_X
  238.           @sprites["pokemon1"].x-=@sprites["pokemon1"].width/2
  239.           @sprites["pokemon1"].y=PokeBattle_SceneConstants::FOEBATTLERD1_Y
  240.           @sprites["pokemon1"].y+=adjustBattleSpriteY(@sprites["pokemon1"],species,1)
  241.           @sprites["pokemon1"].visible=true
  242.           @sprites["shadow1"].x=PokeBattle_SceneConstants::FOEBATTLERD1_X
  243.           @sprites["shadow1"].y=PokeBattle_SceneConstants::FOEBATTLERD1_Y
  244.           @sprites["shadow1"].x-=@sprites["shadow1"].bitmap.width/2 if @sprites["shadow1"].bitmap!=nil
  245.           @sprites["shadow1"].y-=@sprites["shadow1"].bitmap.height/2 if @sprites["shadow1"].bitmap!=nil
  246.           @sprites["shadow1"].visible=showShadow?(species)
  247.           trainersprite1=@sprites["pokemon1"]
  248.           species=@battle.party2[1].species
  249.           @sprites["pokemon3"].setPokemonBitmap(@battle.party2[1],false)
  250.           @sprites["pokemon3"].tone=Tone.new(-128,-128,-128,-128)
  251.           @sprites["pokemon3"].x=PokeBattle_SceneConstants::FOEBATTLERD2_X
  252.           @sprites["pokemon3"].x-=@sprites["pokemon3"].width/2
  253.           @sprites["pokemon3"].y=PokeBattle_SceneConstants::FOEBATTLERD2_Y
  254.           @sprites["pokemon3"].y+=adjustBattleSpriteY(@sprites["pokemon3"],species,3)
  255.           @sprites["pokemon3"].visible=true
  256.           @sprites["shadow3"].x=PokeBattle_SceneConstants::FOEBATTLERD2_X
  257.           @sprites["shadow3"].y=PokeBattle_SceneConstants::FOEBATTLERD2_Y
  258.           @sprites["shadow3"].x-=@sprites["shadow3"].bitmap.width/2 if @sprites["shadow3"].bitmap!=nil
  259.           @sprites["shadow3"].y-=@sprites["shadow3"].bitmap.height/2 if @sprites["shadow3"].bitmap!=nil
  260.           @sprites["shadow3"].visible=showShadow?(species)
  261.           trainersprite2=@sprites["pokemon3"]
  262.         end
  263.       end
  264.     end
  265.     #################
  266.     # Move trainers/bases/etc. off-screen
  267.     oldx=[]
  268.     oldx[0]=@sprites["playerbase"].x; @sprites["playerbase"].x+=Graphics.width
  269.     oldx[1]=playersprite1.x; playersprite1.x+=Graphics.width
  270.     if playersprite2
  271.       oldx[2]=playersprite2.x; playersprite2.x+=Graphics.width
  272.     end
  273.     oldx[3]=@sprites["enemybase"].x; @sprites["enemybase"].x-=Graphics.width
  274.     oldx[4]=trainersprite1.x; trainersprite1.x-=Graphics.width
  275.     if trainersprite2
  276.       oldx[5]=trainersprite2.x; trainersprite2.x-=Graphics.width
  277.     end
  278.     oldx[6]=@sprites["shadow1"].x; @sprites["shadow1"].x-=Graphics.width
  279.     if @sprites["shadow3"]
  280.       oldx[7]=@sprites["shadow3"].x; @sprites["shadow3"].x-=Graphics.width
  281.     end
  282.     @sprites["partybarfoe"].x-=PokeBattle_SceneConstants::FOEPARTYBAR_X
  283.     @sprites["partybarplayer"].x+=Graphics.width-PokeBattle_SceneConstants::PLAYERPARTYBAR_X
  284.     #################
  285.     appearspeed=12
  286.     (1+Graphics.width/appearspeed).times do
  287.       tobreak=true
  288.       if @viewport.rect.y>0
  289.         @viewport.rect.y-=appearspeed/2
  290.         @viewport.rect.y=0 if @viewport.rect.y<0
  291.         @viewport.rect.height+=appearspeed
  292.         @viewport.rect.height=Graphics.height if @viewport.rect.height>Graphics.height
  293.         tobreak=false
  294.       end
  295.       if !tobreak
  296.         for i in @sprites
  297.           i[1].ox=@viewport.rect.x
  298.           i[1].oy=@viewport.rect.y
  299.         end
  300.       end
  301.       if @sprites["playerbase"].x>oldx[0]
  302.         @sprites["playerbase"].x-=appearspeed; tobreak=false
  303.         @sprites["playerbase"].x=oldx[0] if @sprites["playerbase"].x<oldx[0]
  304.       end
  305.       if playersprite1.x>oldx[1]
  306.         playersprite1.x-=appearspeed; tobreak=false
  307.         playersprite1.x=oldx[1] if @sprites["player"].x<oldx[1]
  308.       end
  309.       if playersprite2 && playersprite2.x>oldx[2]
  310.         playersprite2.x-=appearspeed; tobreak=false
  311.         playersprite2.x=oldx[2] if @sprites["playerB"].x<oldx[2]
  312.       end
  313.       if @sprites["enemybase"].x<oldx[3]
  314.         @sprites["enemybase"].x+=appearspeed; tobreak=false
  315.         @sprites["enemybase"].x=oldx[3] if @sprites["enemybase"].x>oldx[3]
  316.       end
  317.       if trainersprite1.x<oldx[4]
  318.         trainersprite1.x+=appearspeed; tobreak=false
  319.         trainersprite1.x=oldx[4] if trainersprite1.x>oldx[4]
  320.       end
  321.       if trainersprite2 && trainersprite2.x<oldx[5]
  322.         trainersprite2.x+=appearspeed; tobreak=false
  323.         trainersprite2.x=oldx[5] if trainersprite2.x>oldx[5]
  324.       end
  325.       if @sprites["shadow1"].x<oldx[6]
  326.         @sprites["shadow1"].x+=appearspeed; tobreak=false
  327.         @sprites["shadow1"].x=oldx[6] if @sprites["shadow1"].x>oldx[6]
  328.       end
  329.       if @sprites["shadow3"] && @sprites["shadow3"].x<oldx[7]
  330.         @sprites["shadow3"].x+=appearspeed; tobreak=false
  331.         @sprites["shadow3"].x=oldx[7] if @sprites["shadow3"].x>oldx[7]
  332.       end
  333.       pbGraphicsUpdate
  334.       pbInputUpdate
  335.       pbFrameUpdate
  336.       break if tobreak
  337.     end
  338.     #################
  339.     if @battle.opponent
  340.       @enablePartyAnim=true
  341.       @partyAnimPhase=0
  342.       @sprites["partybarfoe"].visible=true
  343.       @sprites["partybarplayer"].visible=true
  344.     else
  345.       pbPlayCry(@battle.party2[0])   # Play cry for wild Pokémon
  346.       @sprites["battlebox1"].appear
  347.       @sprites["battlebox3"].appear if @battle.party2.length==2
  348.       appearing=true
  349.       begin
  350.         pbGraphicsUpdate
  351.         pbInputUpdate
  352.         pbFrameUpdate
  353.         @sprites["pokemon0"].tone.red+=8 if @sprites["pokemon0"].tone.red<0
  354.         @sprites["pokemon0"].tone.blue+=8 if @sprites["pokemon0"].tone.blue<0
  355.         @sprites["pokemon0"].tone.green+=8 if @sprites["pokemon0"].tone.green<0
  356.         @sprites["pokemon0"].tone.gray+=8 if @sprites["pokemon0"].tone.gray<0
  357.         appearing=@sprites["battlebox0"].appearing
  358.         @sprites["pokemon1"].tone.red+=8 if @sprites["pokemon1"].tone.red<0
  359.         @sprites["pokemon1"].tone.blue+=8 if @sprites["pokemon1"].tone.blue<0
  360.         @sprites["pokemon1"].tone.green+=8 if @sprites["pokemon1"].tone.green<0
  361.         @sprites["pokemon1"].tone.gray+=8 if @sprites["pokemon1"].tone.gray<0
  362.         appearing=@sprites["battlebox1"].appearing
  363.         if @battle.party2.length==2
  364.           @sprites["pokemon2"].tone.red+=8 if @sprites["pokemon2"].tone.red<0
  365.           @sprites["pokemon2"].tone.blue+=8 if @sprites["pokemon2"].tone.blue<0
  366.           @sprites["pokemon2"].tone.green+=8 if @sprites["pokemon2"].tone.green<0
  367.           @sprites["pokemon2"].tone.gray+=8 if @sprites["pokemon2"].tone.gray<0
  368.           appearing=(appearing || @sprites["battlebox3"].appearing)
  369.           @sprites["pokemon3"].tone.red+=8 if @sprites["pokemon3"].tone.red<0
  370.           @sprites["pokemon3"].tone.blue+=8 if @sprites["pokemon3"].tone.blue<0
  371.           @sprites["pokemon3"].tone.green+=8 if @sprites["pokemon3"].tone.green<0
  372.           @sprites["pokemon3"].tone.gray+=8 if @sprites["pokemon3"].tone.gray<0
  373.           appearing=(appearing || @sprites["battlebox3"].appearing)
  374.         end
  375.       end while appearing
  376.       # Show shiny animation for wild Pokémon
  377.       if @battle.battlers[1].isShiny? && @battle.battlescene
  378.         pbCommonAnimation("Shiny",@battle.battlers[1],nil)
  379.       end
  380.       if @battle.party2.length==2
  381.         if @battle.battlers[3].isShiny? && @battle.battlescene
  382.           pbCommonAnimation("Shiny",@battle.battlers[3],nil)
  383.         end
  384.       end
  385.     end
  386.     pbAddSprite("EffectFoe",0,90,"Graphics/Pictures/battleEffectFoe",@viewport)
  387.     pbAddSprite("EffectPlayer",Graphics.width-192,158,"Graphics/Pictures/battleEffectPlayer",@viewport)
  388.     @sprites["EffectFoe"].visible=false
  389.     @sprites["EffectFoe"].z=95
  390.     @sprites["EffectPlayer"].visible=false
  391.     @sprites["EffectPlayer"].z=95
  392.   end
  393.  
  394.   def pbDreamItemMenu(index)
  395.     ret=0
  396.     retindex=-1
  397.     pkmnid=-1
  398.     endscene=true
  399.     oldsprites=pbFadeOutAndHide(@sprites)
  400.     itemscene=PokemonBag_Scene.new
  401.     itemscene.pbStartScene($Trainer.dreambag)
  402.     loop do
  403.       item=itemscene.pbChooseItem
  404.       break if item==0
  405.       usetype=$ItemData[item][ITEMBATTLEUSE]
  406.       cmdUse=-1
  407.       commands=[]
  408.       if usetype==0
  409.         commands[commands.length]=_INTL("Cancel")
  410.       else
  411.         commands[cmdUse=commands.length]=_INTL("Use")
  412.         commands[commands.length]=_INTL("Cancel")
  413.       end
  414.       itemname=PBItems.getName(item)
  415.       command=itemscene.pbShowCommands(_INTL("{1} is selected.",itemname),commands)
  416.       if cmdUse>=0 && command==cmdUse
  417.         if usetype==1 || usetype==3
  418.           modparty=[]
  419.           for i in 0...6
  420.             modparty.push(@battle.party1[@battle.party1order[i]])
  421.           end
  422.           pkmnlist=PokemonScreen_Scene.new
  423.           pkmnscreen=PokemonScreen.new(pkmnlist,modparty)
  424.           itemscene.pbEndScene
  425.           pkmnscreen.pbStartScene(_INTL("Use on which Pokémon?"),@battle.doublebattle)
  426.           activecmd=pkmnscreen.pbChoosePokemon
  427.           pkmnid=@battle.party1order[activecmd]
  428.           if activecmd>=0 && pkmnid>=0 && ItemHandlers.hasBattleUseOnPokemon(item)
  429.             pkmnlist.pbEndScene
  430.             ret=item
  431.             retindex=pkmnid
  432.             endscene=false
  433.             break
  434.           end
  435.           pkmnlist.pbEndScene
  436.           itemscene.pbStartScene($Trainer.dreambag)
  437.         elsif usetype==2 || usetype==4
  438.           if ItemHandlers.hasBattleUseOnBattler(item)
  439.             ret=item
  440.             retindex=index
  441.             break
  442.           end
  443.         end
  444.       end
  445.     end
  446.     pbConsumeItemInBattle($Trainer.dreambag,ret) if ret>0
  447.     itemscene.pbEndScene if endscene
  448.     pbFadeInAndShow(@sprites,oldsprites)
  449.     return [ret,retindex]
  450.   end
  451.  
  452.   def pbDreamCommandMenu(index)
  453.     pbCommandMenuEx(index,[
  454.        _INTL("What will\n{1} do?",@battle.pbPlayer.name),
  455.        _INTL("Fight"),
  456.        _INTL("Bag"),
  457.        _INTL("Ball"),
  458.        _INTL("Run")
  459.     ],4)
  460.   end
  461.  
  462. # Must go under class PokemonDataBox, remember to remove the old one
  463. class DreamWorldDataBox < PokemonDataBox
  464.  
  465.   def refresh
  466.     self.bitmap.clear
  467.     return if !@battler.pokemon
  468.     self.bitmap.blt(0,0,@databox.bitmap,Rect.new(0,0,@databox.width,@databox.height))
  469.     base=PokeBattle_SceneConstants::BOXTEXTBASECOLOR
  470.     shadow=PokeBattle_SceneConstants::BOXTEXTSHADOWCOLOR
  471.     pokename=@battler.name
  472.     pbSetSystemFont(self.bitmap)
  473.     textpos=[
  474.        [pokename,@spritebaseX+8,6,false,base,shadow]
  475.     ]
  476.     genderX=self.bitmap.text_size(pokename).width
  477.     genderX+=@spritebaseX+14
  478.     case @battler.displayGender
  479.     when 0 # Male
  480.       textpos.push([_INTL("♂"),genderX,6,false,Color.new(48,96,216),shadow])
  481.     when 1 # Female
  482.       textpos.push([_INTL("♀"),genderX,6,false,Color.new(248,88,40),shadow])
  483.     end
  484.     textpos.push([_INTL("Dream Balls"),30,8,false,base,shadow])
  485.     textpos.push([_INTL("Left: {1}",@battler.battle.ballcount),30,38,false,base,shadow]) # Edit
  486.     pbDrawTextPositions(self.bitmap,textpos)
  487.     pbSetSmallFont(self.bitmap)
  488.     textpos=[
  489.        [_INTL("Lv{1}",@battler.level),@spritebaseX+202,8,true,base,shadow]
  490.     ]
  491.     if @showhp
  492.       hpstring=_ISPRINTF("{1: 2d}/{2: 2d}",self.hp,@battler.totalhp)
  493.       textpos.push([hpstring,@spritebaseX+188,48,true,base,shadow])
  494.     end
  495.     pbDrawTextPositions(self.bitmap,textpos)
  496.     imagepos=[]
  497.     if @battler.isShiny?
  498.       shinyX=206
  499.       shinyX=-6 if (@battler.index&1)==0 # If player's Pokémon
  500.       imagepos.push(["Graphics/Pictures/shiny.png",@spritebaseX+shinyX,36,0,0,-1,-1])
  501.     end
  502.     if @battler.isDelta?
  503.       deltaX=206
  504.       deltaX=-6 if (@battler.index&1)==0 # If player's Pokémon
  505.       deltaX+=18 if @battler.isShiny?
  506.       disptype1=@battler.type1
  507.       disptype2=@battler.type2
  508.       if @battler.effects[PBEffects::Illusion] != nil
  509.         disptype1=illusionpoke.effects[PBEffects::Illusion].type1
  510.         disptype2=illusionpoke.effects[PBEffects::Illusion].type2
  511.       end
  512.       if disptype1==disptype2
  513.         imagepos.push(["Graphics/Pictures/delta.png",@spritebaseX+deltaX,36,20*disptype1,0,20,-1])
  514.       else
  515.         imagepos.push(["Graphics/Pictures/delta.png",@spritebaseX+deltaX-4,30,20*disptype1,0,20,-1])
  516.         imagepos.push(["Graphics/Pictures/delta.png",@spritebaseX+deltaX+4,34+4,20*disptype2,0,20,-1])
  517.       end
  518.     end
  519.     if @battler.isMega?
  520.       imagepos.push(["Graphics/Pictures/battleMegaEvoBox.png",@spritebaseX+8,34,0,0,-1,-1])
  521.     elsif @battler.isPrimal?
  522.       if isConst?(@battler.pokemon.species,PBSpecies,:KYOGRE)
  523.         imagepos.push(["Graphics/Pictures/battlePrimalKyogreBox.png",@spritebaseX+140,4,0,0,-1,-1])
  524.       elsif isConst?(@battler.pokemon.species,PBSpecies,:GROUDON)
  525.         imagepos.push(["Graphics/Pictures/battlePrimalGroudonBox.png",@spritebaseX+140,4,0,0,-1,-1])
  526.       elsif isConst?(@battler.pokemon.species,PBSpecies,:DIALGA)
  527.         imagepos.push(["Graphics/Pictures/battlePrimalDialgaBox.png",@spritebaseX+140,4,0,0,-1,-1])
  528.       end
  529.     end
  530.     if @battler.owned && (@battler.index&1)==1
  531.       imagepos.push(["Graphics/Pictures/battleBoxOwned.png",@spritebaseX+8,36,0,0,-1,-1])
  532.     end
  533.     pbDrawImagePositions(self.bitmap,imagepos)
  534.     if @battler.status>0
  535.       self.bitmap.blt(@spritebaseX+24,36,@statuses.bitmap,
  536.          Rect.new(0,(@battler.status-1)*16,44,16))
  537.     end
  538.     hpGaugeSize=PokeBattle_SceneConstants::HPGAUGESIZE
  539.     hpgauge=@battler.totalhp==0 ? 0 : (self.hp*hpGaugeSize/@battler.totalhp)
  540.     hpgauge=2 if hpgauge==0 && self.hp>0
  541.     hpzone=0
  542.     hpzone=1 if self.hp<=(@battler.totalhp/2).floor
  543.     hpzone=2 if self.hp<=(@battler.totalhp/4).floor
  544.     hpcolors=[
  545.        PokeBattle_SceneConstants::HPCOLORGREENDARK,
  546.        PokeBattle_SceneConstants::HPCOLORGREEN,
  547.        PokeBattle_SceneConstants::HPCOLORYELLOWDARK,
  548.        PokeBattle_SceneConstants::HPCOLORYELLOW,
  549.        PokeBattle_SceneConstants::HPCOLORREDDARK,
  550.        PokeBattle_SceneConstants::HPCOLORRED
  551.     ]
  552.     # fill with black (shows what the HP used to be)
  553.     hpGaugeX=PokeBattle_SceneConstants::HPGAUGE_X
  554.     hpGaugeY=PokeBattle_SceneConstants::HPGAUGE_Y
  555.     if @animatingHP && self.hp>0
  556.       self.bitmap.fill_rect(@spritebaseX+hpGaugeX,hpGaugeY,
  557.          @starthp*hpGaugeSize/@battler.totalhp,6,Color.new(0,0,0))
  558.     end
  559.     # fill with HP color
  560.     self.bitmap.fill_rect(@spritebaseX+hpGaugeX,hpGaugeY,hpgauge,2,hpcolors[hpzone*2])
  561.     self.bitmap.fill_rect(@spritebaseX+hpGaugeX,hpGaugeY+2,hpgauge,4,hpcolors[hpzone*2+1])
  562.     if @showexp
  563.       # fill with EXP color
  564.       expGaugeX=PokeBattle_SceneConstants::EXPGAUGE_X
  565.       expGaugeY=PokeBattle_SceneConstants::EXPGAUGE_Y
  566.       self.bitmap.fill_rect(@spritebaseX+expGaugeX,expGaugeY,self.exp,2,
  567.          PokeBattle_SceneConstants::EXPCOLORSHADOW)
  568.       self.bitmap.fill_rect(@spritebaseX+expGaugeX,expGaugeY+2,self.exp,2,
  569.          PokeBattle_SceneConstants::EXPCOLORBASE)
  570.     end
  571.   end
  572. end
RAW Paste Data