Vendily

PB_DW

Oct 4th, 2018
231
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class PokeBattle_FakeTrainer
  2.   attr_accessor(:id)
  3.   attr_accessor(:pokemon)
  4.  
  5.   def initialize(pokemon)
  6.     @id=$Trainer.id
  7.     @pokemon=pokemon
  8.   end
  9.  
  10.   def name
  11.     return @pokemon.name
  12.   end
  13.  
  14.   def fullname
  15.     return self.name
  16.   end
  17.  
  18.   def language
  19.     return $Trainer.language
  20.   end
  21.  
  22.  
  23.   def numbadges   # Number of badges
  24.     return 16
  25.   end
  26.  
  27.   def gender
  28.     return @pokemon.gender
  29.   end
  30.  
  31.   def isMale?; return self.gender==0; end
  32.   def isFemale?; return self.gender==1; end
  33.  
  34.   def party
  35.     return [@pokemon]
  36.   end
  37.    
  38.   def pokemonParty
  39.     return self.party.find_all {|item| item && !item.isEgg? }
  40.   end
  41.  
  42.   def ablePokemonParty
  43.     return self.party.find_all {|item| item && !item.isEgg? && item.hp>0 }
  44.   end
  45.  
  46.   def partyCount
  47.     return self.party.length
  48.   end
  49.  
  50.   def pokemonCount
  51.     ret=0
  52.     for i in 0...self.party.length
  53.       ret+=1 if self.party[i] && !self.party[i].isEgg?
  54.     end
  55.     return ret
  56.   end
  57.  
  58.   def ablePokemonCount
  59.     ret=0
  60.     for i in 0...self.party.length
  61.       ret+=1 if self.party[i] && !self.party[i].isEgg? && self.party[i].hp>0
  62.     end
  63.     return ret
  64.   end
  65.  
  66.   def firstParty
  67.     return nil if self.party.length==0
  68.     return self.party[0]
  69.   end
  70.  
  71.   def firstPokemon
  72.     p=self.pokemonParty
  73.     return nil if p.length==0
  74.     return p[0]
  75.   end
  76.  
  77.   def firstAblePokemon
  78.     p=self.ablePokemonParty
  79.     return nil if p.length==0
  80.     return p[0]
  81.   end
  82.  
  83.   def lastParty
  84.     return nil if self.party.length==0
  85.     return self.party[@party.length-1]
  86.   end
  87.  
  88.   def lastPokemon
  89.     p=self.pokemonParty
  90.     return nil if p.length==0
  91.     return p[p.length-1]
  92.   end
  93.  
  94.   def lastAblePokemon
  95.     p=self.ablePokemonParty
  96.     return nil if p.length==0
  97.     return p[p.length-1]
  98.   end
  99.  
  100.   def pokedexSeen(region=-1)   # Number of Pokémon seen
  101.     return $Trainer.pokedexSeen(region)
  102.   end
  103.  
  104.   def pokedexOwned(region=-1)   # Number of Pokémon owned
  105.     return $Trainer.pokedexOwned(region)
  106.   end
  107.  
  108.   def numFormsSeen(species)
  109.     return $Trainer.numFormsSeen(species)
  110.   end
  111.  
  112.   def hasSeen?(species)
  113.     return $Trainer.hasSeen?(species)
  114.   end
  115.  
  116.   def hasOwned?(species)
  117.     return $Trainer.hasOwned?(species)
  118.   end
  119.  
  120.   def setSeen(species)
  121.     $Trainer.setSeen(species)
  122.   end
  123.  
  124.   def setOwned(species)
  125.     $Trainer.setOwned(species)
  126.   end
  127.  
  128. end
  129.  
  130.  
  131. class PokeBattle_DreamWorld < PokeBattle_Battle
  132.   MAXPARTYSIZE = 6
  133.  
  134.   def ballcount
  135.     return (@ballcount<0) ? 0 : @ballcount
  136.   end
  137.  
  138.   def ballcount=(value)
  139.     @ballcount=(value<0) ? 0 : value
  140.   end
  141.  
  142.   alias __dw_initialize initialize
  143.  
  144.   def initialize(*args)
  145.     __dw_initialize(*args)
  146.     @ballcount=30
  147.     @faketrainer=PokeBattle_FakeTrainer.new(@party1[0])
  148.   end
  149.  
  150.   def pbSetSeen(pokemon)
  151.     if pokemon && @internalbattle
  152.       $Trainer.seen[pokemon.species]=true
  153.       pbSeenForm(pokemon)
  154.     end
  155.   end
  156.  
  157.   def pbPlayer(realplayer=false)
  158.     if realplayer
  159.       return $Trainer
  160.     end
  161.     return @faketrainer
  162.   end
  163.  
  164.   def pbEscapeRate(rareness)
  165.     ret=25
  166.     ret=50 if rareness<200
  167.     ret=75 if rareness<150
  168.     ret=100 if rareness<100
  169.     ret=125 if rareness<25
  170.     return ret
  171.   end
  172.  
  173.   def pbCanMegaEvolve?(index)
  174.     return false
  175.   end
  176.   def pbCanZMove?(index)
  177.     return false
  178.   end
  179.  
  180.   def pbDreamCommandMenu(i)
  181.     return @scene.pbDreamCommandMenu(i)
  182.   end
  183.  
  184.   def pbDreamItemMenu(i)
  185.     return @scene.pbDreamItemMenu(i)
  186.   end
  187.  
  188.  
  189.   def pbRegisterItem(idxPokemon,idxItem,idxTarget=nil)
  190.     if idxTarget!=nil && idxTarget>=0
  191.       for i in 0...4
  192.         if !@battlers[i].pbIsOpposing?(idxPokemon) &&
  193.            @battlers[i].pokemonIndex==idxTarget &&
  194.            @battlers[i].effects[PBEffects::Embargo]>0
  195.           pbDisplay(_INTL("Embargo's effect prevents the item's use on {1}!",@battlers[i].pbThis(true)))
  196.           if pbBelongsToPlayer?(@battlers[i].index)
  197.             if $Trainer.dreambag.pbCanStore?(idxItem)
  198.               $Trainer.dreambag.pbStoreItem(idxItem)
  199.             else
  200.               raise _INTL("Couldn't return unused item to Bag somehow.")
  201.             end
  202.           end
  203.           return false
  204.         end
  205.       end
  206.     end
  207.     if ItemHandlers.hasUseInBattle(idxItem)
  208. #      if idxPokemon==0 # Player's first Pokémon
  209.         if ItemHandlers.triggerBattleUseOnBattler(idxItem,@battlers[idxPokemon],self)
  210.           # Using Poké Balls or Poké Doll only
  211.           ItemHandlers.triggerUseInBattle(idxItem,@battlers[idxPokemon],self)
  212.           if @doublebattle
  213.             @battlers[(idxPokemon+2)%4].effects[PBEffects::SkipTurn]=true
  214.           end
  215.         else
  216.           if $Trainer.dreambag.pbCanStore?(idxItem)
  217.             $Trainer.dreambag.pbStoreItem(idxItem)
  218.           else
  219.             raise _INTL("Couldn't return unusable item to Bag somehow.")
  220.           end
  221.           return false
  222.         end
  223. #      else
  224. #        if ItemHandlers.triggerBattleUseOnBattler(idxItem,@battlers[idxPokemon],self)
  225. #          pbDisplay(_INTL("It's impossible to aim without being focused!"))
  226. #        end
  227. #        return false
  228. #      end
  229.     end
  230.     @choices[idxPokemon][0]=3         # "Use an item"
  231.     @choices[idxPokemon][1]=idxItem   # ID of item to be used
  232.     @choices[idxPokemon][2]=idxTarget # Index of Pokémon to use item on
  233.     side=(pbIsOpposing?(idxPokemon)) ? 1 : 0
  234.     owner=pbGetOwnerIndex(idxPokemon)
  235.     if @megaEvolution[side][owner]==idxPokemon
  236.       @megaEvolution[side][owner]=-1
  237.     end
  238.     if @zMove[side][owner]==idxPokemon
  239.       @zMove[side][owner]=-1
  240.     end    
  241.     return true
  242.   end
  243.  
  244.  
  245.   def pbStartBattleCore(canlose)
  246.     if !@fullparty1 && @party1.length>MAXPARTYSIZE
  247.       raise ArgumentError.new(_INTL("Party 1 has more than {1} Pokémon.",MAXPARTYSIZE))
  248.     end
  249.     if !@fullparty2 && @party2.length>MAXPARTYSIZE
  250.       raise ArgumentError.new(_INTL("Party 2 has more than {1} Pokémon.",MAXPARTYSIZE))
  251.     end
  252. #=====================================
  253. # Initialize players in double battles
  254. #=====================================
  255.     if @doublebattle
  256.       if @player.is_a?(Array)
  257.         sendout1=pbFindNextUnfainted(@party1,0,pbSecondPartyBegin(0))
  258.         raise _INTL("Player 1 has no unfainted Pokémon") if sendout1<0
  259.         sendout2=pbFindNextUnfainted(@party1,pbSecondPartyBegin(0))
  260.         raise _INTL("Player 2 has no unfainted Pokémon") if sendout2<0
  261.         @battlers[0].pbInitialize(@party1[sendout1],sendout1,false)
  262.         @battlers[2].pbInitialize(@party1[sendout2],sendout2,false)
  263.         pbSetSeen(@party1[sendout1])
  264.         pbSetSeen(@party1[sendout2])
  265.       else
  266.         sendout1=pbFindNextUnfainted(@party1,0)
  267.         sendout2=pbFindNextUnfainted(@party1,sendout1+1)
  268.         if sendout1<0 #|| sendout2<0
  269.           raise _INTL("Player doesn't have any unfainted Pokémon")
  270.         end
  271.         @battlers[0].pbInitialize(@party1[sendout1],sendout1,false)
  272.         @battlers[2].pbInitialize(@party1[sendout2],sendout2,false) if sendout2>=0
  273.         @scene.pbStartDreamBattle(self)
  274.       end
  275. #====================================
  276. # Initialize player in single battles
  277. #====================================
  278.     else
  279.       sendout=pbFindNextUnfainted(@party1,0)
  280.       if sendout<0
  281.         raise _INTL("Player has no unfainted Pokémon")
  282.       end
  283.       @battlers[0].pbInitialize(@party1[sendout],sendout,false)
  284.     end
  285. #========================
  286. # Initialize wild Pokémon
  287. #========================
  288.     if @party2.length==1
  289.       if @doublebattle
  290.         raise _INTL("Only two wild Pokémon are allowed in double battles")
  291.       end
  292.       wildpoke=@party2[0]
  293.       if pbIsUB? && !$Trainer.seen[wildpoke.species]
  294.         wildpoke.name=_INTL("???")
  295.       end
  296.       if $game_switches[70]
  297.         wildpoke.name=_INTL("Ghost")
  298.       end
  299.       @battlers[1].pbInitialize(wildpoke,0,false)
  300.       @peer.pbOnEnteringBattle(self,wildpoke)
  301.       pbSetSeen(wildpoke) if !pbIsUB?
  302.       @scene.pbStartDreamBattle(self)
  303.       if $game_switches[70]
  304.           pbDisplayPaused(_INTL("Ghost appeared!"))
  305.           pbDisplayPaused(_INTL("Darn. The Ghost can't be ID'd!"))
  306.        else
  307.           pbDisplayPaused(_INTL("Wild {1} appeared!",wildpoke.name)) if (!pbIsUB? || (pbIsUB? && $Trainer.seen[wildpoke.species])) && !wildpoke.isTotem?
  308.           pbDisplayPaused(_INTL("The Totem {1} appeared!",wildpoke.name)) if wildpoke.isTotem?
  309.           pbDisplayPaused(_INTL("??? appeared!")) if pbIsUB? && !$Trainer.seen[wildpoke.species]
  310.           if wildpoke.isTotem? || pbIsUB?
  311.             pbAuraStatRaise(@battlers[1])
  312.           end
  313.           if wildpoke.isDelta?
  314.             pbDisplayPaused(_INTL("Oh! It's a delta species!"))
  315.           end
  316.        end
  317.     elsif @party2.length==2
  318.       if !@doublebattle
  319.         raise _INTL("Only one wild Pokémon is allowed in single battles")
  320.       end
  321.       @battlers[1].pbInitialize(@party2[0],0,false)
  322.       @battlers[3].pbInitialize(@party2[1],0,false)
  323.       @peer.pbOnEnteringBattle(self,@party2[0])
  324.       @peer.pbOnEnteringBattle(self,@party2[1])
  325.       pbSetSeen(@party2[0])
  326.       pbSetSeen(@party2[1])
  327.       @scene.pbStartDreamBattle(self)
  328.       if $game_switches[70]
  329.           pbDisplayPaused(_INTL("Ghost and Ghost appeared!"))
  330.           pbDisplayPaused(_INTL("Darn. Those Ghosts can't be ID'd!"))
  331.       else
  332.         pbDisplayPaused(_INTL("Wild {1} and\r\n{2} appeared!",
  333.         @party2[0].name,@party2[1].name))
  334.         if (@party2[0].isDelta? || @party2[1].isDelta?)
  335.           pbDisplayPaused(_INTL("Oh! One of them is a delta species!"))
  336.         elsif @party2[0].isDelta? && @party2[1].isDelta?
  337.           pbDisplayPaused(_INTL("Oh! They're both delta species!"))
  338.         end
  339.       end
  340.     else
  341.       raise _INTL("Only one or two wild Pokémon are allowed")
  342.     end
  343.     @scene.pbDreamStart
  344.     for i in 0...4
  345.       @battlers[i].effects[PBEffects::Nativeness]=true if @battlers[i]
  346.     end
  347. #==================
  348. # Initialize battle
  349. #==================
  350.     if @weather==PBWeather::SUNNYDAY
  351.       pbCommonAnimation("Sunny",nil,nil)
  352.       pbDisplay(_INTL("The sunlight is strong."))
  353.     elsif @weather==PBWeather::RAINDANCE
  354.       pbCommonAnimation("Rain",nil,nil)
  355.       pbDisplay(_INTL("It is raining."))
  356.     elsif @weather==PBWeather::SANDSTORM
  357.       pbCommonAnimation("Sandstorm",nil,nil)
  358.       pbDisplay(_INTL("A sandstorm is raging."))
  359.     elsif @weather==PBWeather::HAIL
  360.       pbCommonAnimation("Hail",nil,nil)
  361.       pbDisplay(_INTL("Hail is falling."))
  362.     elsif @weather==PBWeather::HEAVYRAIN
  363.       pbCommonAnimation("HeavyRain",nil,nil)
  364.       pbDisplay(_INTL("It is raining heavily."))
  365.     elsif @weather==PBWeather::HARSHSUN
  366.       pbCommonAnimation("HarshSun",nil,nil)
  367.       pbDisplay(_INTL("The sunlight is extremely harsh."))
  368.     elsif @weather==PBWeather::STRONGWINDS
  369.       pbCommonAnimation("StrongWinds",nil,nil)
  370.       pbDisplay(_INTL("The wind is strong."))
  371.     elsif @weather==PBWeather::ACIDRAIN
  372.       pbCommonAnimation("AcidRain",nil,nil)
  373.       pbDisplay(_INTL("Acid rain falls from the sky."))
  374.     end
  375.     pbOnActiveAll   # Abilities
  376.     @turncount=0
  377.     loop do   # Now begin the battle loop
  378.       PBDebug.log("")
  379.       PBDebug.log("***Round #{@turncount+1}***")
  380.       if @debug && @turncount>=100
  381.         @decision=pbDecisionOnTime()
  382.         PBDebug.log("")
  383.         PBDebug.log("***Undecided after 100 rounds, aborting***")
  384.         pbAbort
  385.         break
  386.       end
  387.       PBDebug.logonerr{
  388.          pbCommandPhase
  389.       }
  390.       break if @decision>0
  391.       PBDebug.logonerr{
  392.          pbAttackPhase
  393.       }
  394.       break if @decision>0
  395.       PBDebug.logonerr{
  396.          pbEndOfRoundPhase
  397.       }
  398.       break if @decision>0
  399.       @turncount+=1
  400.     end
  401.     return pbEndOfBattle(canlose)
  402.   end
  403.  
  404.   def pbCommandPhase
  405.     @scene.pbBeginCommandPhase
  406.     @scene.pbResetCommandIndices
  407.     for i in 0...4   # Reset choices if commands can be shown
  408.       @battlers[i].effects[PBEffects::SkipTurn]=false
  409.       if pbCanShowCommands?(i) || @battlers[i].isFainted?
  410.         @choices[i][0]=0
  411.         @choices[i][1]=0
  412.         @choices[i][2]=nil
  413.         @choices[i][3]=-1
  414.       else
  415.         unless !@doublebattle && pbIsDoubleBattler?(i)
  416.           PBDebug.log("[Reusing commands] #{@battlers[i].pbThis(true)}")
  417.         end
  418.       end
  419.     end
  420.     # Reset choices to perform Mega Evolution if it wasn't done somehow
  421.     for i in 0...2
  422.       for j in 0...@megaEvolution[i].length
  423.         @megaEvolution[i][j]=-1 if @megaEvolution[i][j]>=0
  424.       end
  425.     end
  426.     for i in 0...@zMove[0].length
  427.       @zMove[0][i]=-1 if @zMove[0][i]>=0
  428.     end
  429.     for i in 0...@zMove[1].length
  430.       @zMove[1][i]=-1 if @zMove[1][i]>=0
  431.     end
  432.     for i in 0...4
  433.       break if @decision!=0
  434.       next if @choices[i][0]!=0
  435.       if !pbOwnedByPlayer?(i) || @controlPlayer
  436.         if !@battlers[i].isFainted? && pbCanShowCommands?(i)
  437.           @scene.pbChooseEnemyCommand(i)
  438.         end
  439.       else
  440.         commandDone=false
  441.         commandEnd=false
  442.         if pbCanShowCommands?(i)
  443.           loop do
  444.             cmd=pbDreamCommandMenu(i)
  445.             if cmd==0 # Fight
  446.               if $game_switches[70]# If you're in the graveyard
  447.                   wildbattle = !@opponent# && pbIsOpposing?(opponent.index)
  448.                   if wildbattle # this is dumb
  449.                     pbDisplay(_INTL("{1} is too scared to move!",@battlers[i].pbThis))
  450.                     return
  451.                 end
  452.               end
  453.               if pbCanShowFightMenu?(i)
  454.                 commandDone=true if pbAutoFightMenu(i)
  455.                 until commandDone
  456.                   index=@scene.pbFightMenu(i)
  457.                   if index<0
  458.                     side=(pbIsOpposing?(i)) ? 1 : 0
  459.                     owner=pbGetOwnerIndex(i)
  460.                     if @megaEvolution[side][owner]==i
  461.                       @megaEvolution[side][owner]=-1
  462.                     end
  463.                     if @zMove[side][owner]==i
  464.                       @zMove[side][owner]=-1
  465.                     end    
  466.                     break
  467.                   end
  468.                   next if !pbRegisterMove(i,index)
  469.                   if @doublebattle
  470.                     thismove=@battlers[i].moves[index]
  471.                     target=@battlers[i].pbTarget(thismove)
  472.                     if target==PBTargets::SingleNonUser # single non-user
  473.                       target=@scene.pbChooseTarget(i,target)
  474.                       next if target<0
  475.                       pbRegisterTarget(i,target)
  476.                     elsif target==PBTargets::UserOrPartner # Acupressure
  477.                       target=@scene.pbChooseTarget(i,target)
  478.                       next if target<0 || (target&1)==1
  479.                       pbRegisterTarget(i,target)
  480.                     end
  481.                   end
  482.                   commandDone=true
  483.                 end
  484.               else
  485.                 pbAutoChooseMove(i)
  486.                 commandDone=true
  487.               end
  488.             elsif cmd!=0 && @battlers[i].effects[PBEffects::SkyDrop]
  489.               pbDisplay(_INTL("Sky Drop won't let {1} go!",@battlers[i].pbThis(true)))
  490.             elsif cmd==1 # Bag
  491.               if !@internalbattle
  492.                 if pbOwnedByPlayer?(i)
  493.                   pbDisplay(_INTL("Items can't be used here."))
  494.                 end
  495.               else
  496.                 item=pbDreamItemMenu(i)
  497.                 if item[0]>0
  498.                   if pbRegisterItem(i,item[0],item[1])
  499.                     commandDone=true
  500.                   end
  501.                 end
  502.               end
  503.             elsif cmd==2 # Ball
  504.               if pbBoxesFull?
  505.                 pbDisplay(_INTL("The boxes are full! You can't catch any more Pokémon!"))
  506.               elsif @ballcount<=0
  507.                 pbDisplay(_INTL("You're out of Dream Balls!"))
  508.               else
  509.                 @ballcount-=1
  510.                 dreamBall=getConst(PBItems,:SAFARIBALL)
  511.                 if pbRegisterItem(i,dreamBall)
  512.                   commandDone=true
  513.                 end
  514.               end
  515.             elsif cmd==3   # Run
  516.               run=pbRun(i)
  517.               if run>0
  518.                 commandDone=true
  519.                 return
  520.               elsif run<0
  521.                 commandDone=true
  522.                 side=(pbIsOpposing?(i)) ? 1 : 0
  523.                 owner=pbGetOwnerIndex(i)
  524.                 if @megaEvolution[side][owner]==i
  525.                   @megaEvolution[side][owner]=-1
  526.                 end
  527.                 if @zMove[side][owner]==i
  528.                   @zMove[side][owner]=-1
  529.                 end
  530.               end
  531.             elsif cmd==4   # Call
  532.               thispkmn=@battlers[i]
  533.               @choices[i][0]=4   # "Call Pokémon"
  534.               @choices[i][1]=0
  535.               @choices[i][2]=nil
  536.               side=(pbIsOpposing?(i)) ? 1 : 0
  537.               owner=pbGetOwnerIndex(i)
  538.               if @megaEvolution[side][owner]==i
  539.                 @megaEvolution[side][owner]=-1
  540.               end
  541.               if @zMove[side][owner]==i
  542.                 @zMove[side][owner]=-1
  543.               end
  544.               commandDone=true
  545.             elsif cmd==-1   # Go back to first battler's choice
  546.               @megaEvolution[0][0]=-1 if @megaEvolution[0][0]>=0
  547.               @megaEvolution[1][0]=-1 if @megaEvolution[1][0]>=0
  548.               @zMove[0][0]=-1 if @zMove[0][0]>=0
  549.               @zMove[1][0]=-1 if @zMove[1][0]>=0
  550.               # Restore the item the player's first Pokémon was due to use
  551.               if @choices[0][0]==3 && $PokemonBag && $PokemonBag.pbCanStore?(@choices[0][1])
  552.                 $PokemonBag.pbStoreItem(@choices[0][1])
  553.               end
  554.               pbCommandPhase
  555.               return
  556.             end
  557.             break if commandDone
  558.           end
  559.         end
  560.       end
  561.     end
  562.   end
  563.  
  564.   def pbEndOfBattle(canlose=false)
  565.     case @decision
  566.     ##### WIN #####
  567.     when 1
  568.       PBDebug.log("")
  569.       PBDebug.log("***Player won***")
  570.     ##### LOSE, DRAW #####
  571.     when 2, 5
  572.       PBDebug.log("")
  573.       PBDebug.log("***Player lost***") if @decision==2
  574.       PBDebug.log("***Player drew with opponent***") if @decision==5
  575.       if @internalbattle
  576.         pbDisplayPaused(_INTL("{1} is out of usable Pokémon!",self.pbPlayer.name))
  577.         pbDisplayPaused(_INTL("{1} blacked out!",self.pbPlayer.name)) if !canlose
  578.       end
  579.     end
  580.     #### PICK UP POKEBALLS ####
  581.     if @decision == 1 || 4
  582.       pbrs = [] #pokeball retrieval service
  583.                 # This array has a pattern. POKEBALLTYPE, Number, POKEBALLTYPE, NUMBER
  584.       if $PokemonGlobal.ballsused[0] != nil #don't use unless there are pokeballs to regain          
  585.         pokeballs=$PokemonGlobal.ballsused
  586.         pokeballs.each do |ball| # This part repeats for each pokeball
  587.           chance=25
  588.           rnd=rand(100)
  589.             if rnd<chance
  590.               unless pbrs.include?(ball) #unless the array already has the ball
  591.                 pbrs.push(ball)
  592.                 pbrs.push(1)  
  593.               else
  594.                 temp = pbrs.index(ball) #finds where in the array the pokeball type is
  595.                 pbrs[temp+1] +=1 #adds another ball to the number
  596.               end
  597.             end
  598.           end
  599.         while pbrs[0] != nil #While there are still pokeballs left to retreive
  600.           balltype = pbrs.shift#destructively removes the first element (in this case, the pokeball name)
  601.           #pbDisplayPaused(_INTL("{1}!",balltype))
  602.           ballnumber = pbrs.shift #remember each even numbered item in the array is the pokeball number
  603.           #pbDisplayPaused(_INTL("{1}!",ballnumber))            
  604.           $Trainer.dreambag.pbStoreItem(balltype,ballnumber)
  605.           if ballnumber>1
  606.             pbDisplayPaused(_INTL("{1} picked up {2} {3} thrown during the battle.", @battler[0].name, ballnumber, PBItems.getNamePlural(balltype)))
  607.           else
  608.             pbDisplayPaused(_INTL("{1} picked up one {2} thrown during the battle.", @battler[0].name, PBItems.getName(balltype)))
  609.           end
  610.         end
  611.       end
  612.     end
  613.     $PokemonGlobal.ballsused=[] #to reset the array after the battle
  614.     @scene.pbEndBattle(@decision)
  615.     for i in @battlers
  616.       i.pbResetForm
  617.       if i.hasWorkingAbility(:NATURALCURE)
  618.         i.status=0
  619.       end
  620.     end
  621.     return @decision
  622.   end
  623.  end
RAW Paste Data