SHARE
TWEET

Current Effects

a guest Jul 11th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #===============================================================================
  2. # Terrain tags (initializes current terrain tags and adds water properties)
  3. #===============================================================================
  4. module PBTerrain
  5.   CurrentNorth    = 17
  6.   CurrentEast     = 18
  7.   CurrentSouth    = 19
  8.   CurrentWest     = 20
  9. end
  10.  
  11.   def PBTerrain.isSurfable?(tag)
  12.     return PBTerrain.isWater?(tag)
  13.   end
  14.  
  15.   def PBTerrain.isWater?(tag)
  16.     return tag==PBTerrain::Water ||
  17.            tag==PBTerrain::StillWater ||
  18.            tag==PBTerrain::DeepWater ||
  19.            tag==PBTerrain::WaterfallCrest ||
  20.            tag==PBTerrain::Waterfall ||
  21.            tag==PBTerrain::CurrentNorth ||
  22.            tag==PBTerrain::CurrentEast ||
  23.            tag==PBTerrain::CurrentSouth ||
  24.            tag==PBTerrain::CurrentWest
  25.            
  26.   end
  27.  
  28.   def PBTerrain.isPassableWater?(tag)
  29.     return tag==PBTerrain::Water ||
  30.            tag==PBTerrain::StillWater ||
  31.            tag==PBTerrain::DeepWater ||
  32.            tag==PBTerrain::WaterfallCrest ||
  33.            tag==PBTerrain::CurrentNorth ||
  34.            tag==PBTerrain::CurrentEast ||
  35.            tag==PBTerrain::CurrentSouth ||
  36.            tag==PBTerrain::CurrentWest
  37.   end
  38.  
  39.   def PBTerrain.isJustWater?(tag)
  40.     return tag==PBTerrain::Water ||
  41.            tag==PBTerrain::StillWater ||
  42.            tag==PBTerrain::DeepWater ||
  43.            tag==PBTerrain::CurrentNorth ||
  44.            tag==PBTerrain::CurrentEast ||
  45.            tag==PBTerrain::CurrentSouth ||
  46.            tag==PBTerrain::CurrentWest            
  47.          end
  48.          
  49.        
  50. #===============================================================================
  51. # Current Movement
  52. #===============================================================================
  53. def Kernel.pbWaterCurrent(event=nil)
  54.   event=$game_player if !event
  55.   return if !event
  56.   return if (pbGetTerrainTag(event)!=PBTerrain::CurrentSouth &&
  57.   pbGetTerrainTag(event)!=PBTerrain::CurrentWest && pbGetTerrainTag(event)!=PBTerrain::CurrentEast &&
  58.   pbGetTerrainTag(event)!=PBTerrain::CurrentNorth)
  59.   $PokemonGlobal.sliding=true
  60.   oldwalkanime=event.walk_anime
  61.   event.straighten
  62.   event.pattern=0
  63.   event.walk_anime=false
  64.   loop do
  65.     case pbGetTerrainTag(event)
  66.       when PBTerrain::CurrentSouth
  67.         direction=2
  68.       when PBTerrain::CurrentWest
  69.         direction=4
  70.       when PBTerrain::CurrentEast
  71.         direction=6
  72.       when PBTerrain::CurrentNorth
  73.         direction=8
  74.     end        
  75.     break if (pbGetTerrainTag(event)!=PBTerrain::CurrentSouth && pbGetTerrainTag(event)!=PBTerrain::CurrentWest &&
  76.     pbGetTerrainTag(event)!=PBTerrain::CurrentEast && pbGetTerrainTag(event)!=PBTerrain::CurrentNorth)
  77.     break if !event.passable?(event.x,event.y,direction)
  78.     case pbGetTerrainTag(event)
  79.       when PBTerrain::CurrentSouth
  80.         event.move_down(false)
  81.       when PBTerrain::CurrentWest
  82.         event.move_left(false)
  83.       when PBTerrain::CurrentEast
  84.         event.move_right(false)
  85.       when PBTerrain::CurrentNorth
  86.         event.move_up(false)
  87.     end      
  88.     while event.moving?
  89.       Graphics.update
  90.       Input.update
  91.       pbUpdateSceneMap
  92.     end
  93.   end
  94.   event.center(event.x,event.y) if event==$game_player
  95.   event.straighten
  96.   event.walk_anime=oldwalkanime
  97.   $PokemonGlobal.sliding=false
  98. end
  99.  
  100. Events.onStepTakenFieldMovement+=proc{|sender,e|
  101.   event=e[0] # Get the event affected by field movement
  102.   currentTag=pbGetTerrainTag(event)
  103.   if pbGetTerrainTag(event,true)==PBTerrain::Grass  # Won't show if under bridge
  104.     $scene.spriteset.addUserAnimation(GRASS_ANIMATION_ID,event.x,event.y,true)
  105.   elsif event==$game_player && currentTag==PBTerrain::WaterfallCrest
  106.      # Descend waterfall, but only if this event is the player
  107.     Kernel.pbDescendWaterfall(event)
  108.   elsif (currentTag==PBTerrain::CurrentSouth || currentTag==PBTerrain::CurrentWest ||
  109.     currentTag==PBTerrain::CurrentEast || currentTag==PBTerrain::CurrentNorth) && !$PokemonGlobal.sliding
  110.     Kernel.pbWaterCurrent(event)    
  111.   elsif currentTag==PBTerrain::Ice && !$PokemonGlobal.sliding
  112.     Kernel.pbSlideOnIce(event)
  113.   end
  114. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top