Advertisement
Vendily

NonBattle DW

Oct 4th, 2018
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.84 KB | None | 0 0
  1. class DreamState
  2.   attr_accessor :ballcount
  3.   attr_accessor :pokemon
  4.   attr_accessor :start
  5.  
  6.   def initialize
  7.     @start=nil
  8.     @pokemon=nil
  9.     @ballcount=0
  10.   end
  11.  
  12.   def pbGoToStart
  13.     if $scene.is_a?(Scene_Map)
  14.       pbFadeOutIn(99999){
  15.          $game_temp.player_transferring = true
  16.          $game_temp.transition_processing = true
  17.          $game_temp.player_new_map_id = @start[0]
  18.          $game_temp.player_new_x = @start[1]
  19.          $game_temp.player_new_y = @start[2]
  20.          $game_temp.player_new_direction = 2
  21.          $scene.transfer_player
  22.       }
  23.     end
  24.   end
  25.  
  26.   def pbStart(pokemon,balls)
  27.     @start=[$game_map.map_id,$game_player.x,$game_player.y,$game_player.direction]
  28.     @pokemon=pokemon
  29.     @ballcount=balls
  30.   end
  31.  
  32.   def inProgress?
  33.     return !@pokemon.nil?
  34.   end
  35.  
  36.   def pbEnd
  37.     @start=nil
  38.     @pokemon=nil
  39.     @ballcount=0
  40.   end
  41. end
  42.  
  43. def pbInDream?
  44.   return pbDreamState.inProgress?
  45. end
  46.  
  47. def pbDreamState
  48.   if !$PokemonGlobal.dreamState
  49.     $PokemonGlobal.dreamState=DreamState.new
  50.   end
  51.   return $PokemonGlobal.dreamState
  52. end
  53.  
  54. Events.onWildBattleOverride+= proc { |sender,e|
  55.    species=e[0]
  56.    level=e[1]
  57.    handled=e[2]
  58.    next if handled[0]!=nil
  59.    next if !pbInDream?
  60.    handled[0]=pbDreamBattle(species,level)
  61. }
  62.  
  63. def pbDreamBattle(species,level)
  64.   genwildpoke=pbGenerateWildPokemon(species,level)
  65.   scene=pbNewBattleScene
  66.   battle=PokeBattle_DreamWorld.new(scene,[pbDreamState.pokemon],[genwildpoke],$Trainer,nil)
  67.   battle.ballcount=pbDreamState.ballcount
  68.   battle.environment=pbGetEnvironment
  69.   decision=0
  70.   pbBattleAnimation(pbGetWildBattleBGM(species)) {
  71.      pbSceneStandby {
  72.         decision=battle.pbStartBattle
  73.      }
  74.   }
  75.   pbDreamState.ballcount=battle.ballcount
  76.   Input.update
  77.   Events.onWildBattleEnd.trigger(nil,species,level,decision)
  78.   return decision
  79. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement