Project1
标题: 关于天气脚本 [打印本页]
作者: 风色瞳孔    时间: 2012-11-20 13:06
标题: 关于天气脚本
#-------------------------------------------------------------------------------
#  MAWS - Modified Advanced Weather Script for RPG Maker VX
#  Version: 1.1.
#  Based on Advanced Weather Script VX by Ccoa
#  Modifications created by Agckuu Coceg
#-------------------------------------------------------------------------------
# Thanks DerWulfman to his help with VX version of script.
#-------------------------------------------------------------------------------
#  Weather Types:
#    1 - 雨 (Ccoa)
#    2 - 风暴 (Ccoa) 
#    3 - 雪 (Ccoa)
#    4 - 冰雹 (Ccoa)
#    5 - 雷阵雨 (Ccoa)
#    6 - 下降棕色叶子 (Ccoa)
#    7 - 吹棕色叶子 (Ccoa)
#    8 - 袅袅棕色叶子 (Ccoa)
#    9 - 下降绿色叶子 (Ccoa)
#   10 - 樱花(樱)花瓣 (Ccoa)
#   11 - 玫瑰花瓣 (Ccoa)
#   12 - 羽毛 (Ccoa)
#   13 - 血雨 (Ccoa)
#   14 - 火花 (Ccoa)
#   15 - 用户自定义
#   16 - 吹雪 (Ccoa)
#   17 - 流星雨 (Ccoa)
#   18 - 落灰 (Ccoa)
#   19 - 气泡 (Ccoa)
#   20 - 气泡 2 (Ccoa)
#   21 - 火花上升 (Ccoa)
#-------------------------------------------------------------------------------
# Version 1.0 addons
#-------------------------------------------------------------------------------
#   Leaves effects:
#   22 - 吹绿叶 (Agckuu Coceg)
#   23 - 袅袅的绿叶 (Agckuu Coceg)
#   24 - 下降的黄叶 (Agckuu Coceg)
#   25 - 吹黄叶 (Agckuu Coceg)
#   26 - 袅袅的黄叶 (Agckuu Coceg)
#   Rain effects:
#   27 - 石油雨 (Agckuu Coceg)
#   28 - 金雨 (Agckuu Coceg)
#   Special effects:
#   29 - 火焰流星雨 (Agckuu Coceg)
#-------------------------------------------------------------------------------
# Version 1.1 addons
#-------------------------------------------------------------------------------
#   Starburst effects addons:
#   30 - 彩色星暴 v.2 (replaced Color Starburst)(Agckuu Coceg)
#   31 - 升级版彩色星暴 v.2 (replaced Uprising color Starburst) 
#   (Agckuu Coceg)
#   32 - 彩色星暴雨 v.2 (replaced Color Starburst rain)(Agckuu Coceg)
#   33 - 单色暴 (Agckuu Coceg)
#   34 - 升级版单色暴 (Agckuu Coceg) 
#   35 - 单色暴雨 (Agckuu Coceg)
#   Rain effects:
#   36 - 金雨雷电和闪光 (Agckuu Coceg)
#   37 - 金色风暴 (Agckuu Coceg)
#   38 - 石油风暴 (Agckuu Coceg)
#   39 - 酸雨 (Agckuu Coceg)
#   40 - 酸雨闪电和闪光 (Agckuu Coceg)
#   41 - 酸雨风暴 (Agckuu Coceg)
#   42 - 棕褐色雨 (Agckuu Coceg)
#   43 - 棕褐色雨闪电和闪光 (Agckuu Coceg)
#   44 - 棕褐色雨风暴 (Agckuu Coceg)
#   45 - 现实风暴 (Agckuu Coceg)
#   46 - 血雨赤红的闪电和雷声 (Agckuu Coceg)
#   47 - 血雨风暴 (Agckuu Coceg)
#   48 - 血暴雪 (Agckuu Coceg)
#   New leaves effects:
#   49 - 下降红枫叶 (Agckuu Coceg)
#   50 - 吹红枫叶 (Agckuu Coceg)
#   51 - 袅袅的红枫叶 (Agckuu Coceg)
#   Special effects:
#   52 - 水弹 (Agckuu Coceg)
#   53 - 冰弹 (Agckuu Coceg)
#   54 - 照明弹 (Agckuu Coceg)
#-------------------------------------------------------------------------------
#  Weather Power:
#    An integer from 0-40.  0 = no weather, 40 = 400 sprites
#-------------------------------------------------------------------------------
#  Usage:
#  Create a call script with the following: screen.weather(type, power, hue)
#-------------------------------------------------------------------------------
#  Usage of user-defined weather. Look at the following globals:
$WEATHER_UPDATE = false   # the $WEATHER_IMAGES array has changed, please update
$WEATHER_IMAGES = []      # the array of picture names to use
$WEATHER_X = 0           # the number of pixels the image should move horizontally (positive = right, negative = left)
$WEATHER_Y = 0            # the number of pizels the image should move vertically (positive = down, negative = up)
$WEATHER_FADE = 0         # how much the image should fade each update (0 = no fade, 255 = fade instantly)
$WEATHER_ANIMATED = true # whether or not the image should cycle through all the images
# Take these out if you are using screen resolution script of Ccoa.
  HEIGHT = 416
  WIDTH = 544
#==============================================================================
# ** Spriteset_Weather
#------------------------------------------------------------------------------
class Spriteset_Weather
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :type
  attr_reader :power
  attr_reader :ox
  attr_reader :oy
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(viewport = nil)
    @type = 0
    @power = 0
    @ox = 0
    @oy = 0
    
    @count = 0
    @current_pose = []
    @info = []
    @countarray = []
    
    make_bitmaps
    
    @sprites = []
    
    for i in 1..500
      sprite = Sprite.new(viewport)
      sprite.visible = false
      sprite.opacity = 0
      @sprites.push(sprite)
      @current_pose.push(0)
      @info.push(rand(50))
      @countarray.push(rand(15))
    end
    
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    for sprite in @sprites
      sprite.dispose
    end
    @rain_bitmap.dispose
    @storm_bitmap.dispose
    @snow_bitmap.dispose
    @hail_bitmap.dispose
    @petal_bitmap.dispose
    @blood_rain_bitmap.dispose
    @oil_rain_bitmap.dispose
    @golden_rain_bitmap.dispose
    @golden_storm_bitmap.dispose
    @acid_rain_bitmap.dispose
    @acid_storm_bitmap.dispose
    @sepia_rain_bitmap.dispose
    @sepia_storm_bitmap.dispose
    @blood_storm_bitmap.dispose
    @bloodblizz_bitmap.dispose
    @meteor_bitmap.dispose
    @flame_meteor_bitmap.dispose
    @waterbomb_bitmap.dispose
    @icybomb_bitmap.dispose
    @flarebomb_bitmap.dispose
    for image in @autumn_leaf_bitmaps
      image.dispose
    end
    for image in @green_leaf_bitmaps
      image.dispose
    end
    for image in @yellow_leaf_bitmaps
      image.dispose
    end
    for image in @redmaple_leaf_bitmaps
      image.dispose
    end
    for image in @rose_bitmaps
      image.dispose
    end
    for image in @feather_bitmaps
      image.dispose
    end
    for image in @sparkle_bitmaps
      image.dispose
    end
    for image in @starburst_bitmaps
      image.dispose
    end
    for image in @monostarburst_bitmaps
      image.dispose
    end
    for image in @user_bitmaps
      image.dispose
    end
    $WEATHER_UPDATE = true
  end
  #--------------------------------------------------------------------------
  # * Set weather type
  #     type : new weather type
  #--------------------------------------------------------------------------
  def type=(type)
    return if @type == type
    @type = type
    case @type
    when 1 # rain
      bitmap = @rain_bitmap
    when 2 # storm
      bitmap = @storm_bitmap
    when 3 # snow
      bitmap = @snow_bitmap
   when 4 # hail
      bitmap = @hail_bitmap
    when 5 # rain w/ thunder and lightning
      bitmap = @rain_bitmap
      @thunder = true
    when 6 # falling autumn leaves
      bitmap = @autumn_leaf_bitmaps[0]
    when 7 # blowing autumn leaves
      bitmap = @autumn_leaf_bitmaps[0]
    when 8 # swirling autumn leaves
      bitmap = @autumn_leaf_bitmaps[0]
    when 9 # falling green leaves
      bitmap = @green_leaf_bitmaps[0]
    when 10 # sakura petals
      bitmap = @petal_bitmap
    when 11 # rose petals
      bitmap = @rose_bitmaps[0]
    when 12 # feathers
      bitmap = @feather_bitmaps[0]
    when 13 # blood rain
      bitmap = @blood_rain_bitmap
    when 14 # sparkles
      bitmap = @sparkle_bitmaps[0]
    when 15 # user-defined
        bitmap = @user_bitmaps[rand(@user_bitmaps.size)]
    when 16 # blowing snow
      bitmap = @snow_bitmap
    when 17 # meteors
      bitmap = @meteor_bitmap
    when 18 # falling ash
      bitmap = @ash_bitmaps[rand(@ash_bitmaps.size)]
    when 19 # bubbles
      bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
    when 21 # sparkles up
      bitmap = @sparkle_bitmaps[0]
    when 22 # blowing green leaves
      bitmap = @green_leaf_bitmaps[0]
    when 23 # swirling green leaves
      bitmap = @green_leaf_bitmaps[0]
    when 24 # falling yellow leaves
      bitmap = @yellow_leaf_bitmaps[0]
    when 25 # blowing yellow leaves
      bitmap = @yellow_leaf_bitmaps[0]
    when 26 # swirling yellow leaves
      bitmap = @yellow_leaf_bitmaps[0]
    when 27 # oil rain
       bitmap = @oil_rain_bitmap
    when 28 # golden rain
       bitmap = @golden_rain_bitmap
    when 29 # flame meteors
       bitmap = @flame_meteor_bitmap
    when 30 # starburst
      bitmap = @starburst_bitmaps[0]
    when 31 # uprising starburst
      bitmap = @starburst_bitmaps[0]
    when 32 # starburst rain
      bitmap = @starburst_bitmaps[0]
    when 33 # mono-starburst
      bitmap = @monostarburst_bitmaps[0]
    when 34 # uprising mono-starburst
      bitmap = @monostarburst_bitmaps[0]
    when 35 # mono-starburst rain
      bitmap = @monostarburst_bitmaps[0]
    when 36 # Golden rain w\ thunder and ligthning
      bitmap = @golden_rain_bitmap
      @golden_thunder = true
    when 37 # Golden storm
      bitmap = @golden_storm_bitmap
    when 38 # Oil storm
      bitmap = @oil_storm_bitmap
    when 39 # # Acid rain
      bitmap = @acid_rain_bitmap
    when 40 # Acid rain w\thunder and lightning
      bitmap = @acid_rain_bitmap
      @acid_thunder = true
    when 41 # Acid storm
      bitmap = @acid_storm_bitmap
    when 42 # Sepia rain
      bitmap = @sepia_rain_bitmap
    when 43 # Sepia rain w\ thunder and lightning
      bitmap = @sepia_rain_bitmap
      @sepia_thunder = true
    when 44 # Sepia storm
      bitmap = @sepia_storm_bitmap
    when 45 # Realistic storm
      bitmap = @storm_bitmap
      @real_storm = true
    when 46 # Blood rain w\ thunder and lightning
      bitmap = @blood_rain_bitmap
      @crimson_thunder = true
    when 47 # Blood storm
      bitmap = @blood_storm_bitmap
    when 48 # Blood blizzard
      bitmap = @bloodblizz_bitmap
    when 49 # Falling red maple leaves
      bitmap = @redmaple_leaf_bitmaps[0]
    when 50 # Blowing red maple leaves
      bitmap = @redmaple_leaf_bitmaps[0]
    when 51 # Swirling red maple leaves
      bitmap = @redmaple_leaf_bitmaps[0]
    when 52
      bitmap = @waterbomb_bitmaps
    when 53
      bitmap = @icybomb_bitmaps
    when 54
      bitmap = @flarebomb_bitmaps
    else
      bitmap = nil
    end
    
    if @type != 5
      @thunder = false
    end
    
    if @type != 36
      @golden_thunder = false
    end
    
    if @type != 40
      @acid_thunder = false
    end
    
    if @type != 43
      @sepia_thunder = false
    end
    
    if @type != 45
      @real_storm = false
    end
    
    if @type != 46
      @crimson_thunder = false
    end
    
    for i in [email protected]
      sprite = @sprites
      sprite.visible = (i <= @power)
      if @type == 19
        sprite.bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
      elsif @type == 20
        sprite.bitmap = @bubble2_bitmaps[rand(@bubble2_bitmaps.size)]
      elsif @type == 3
        r = rand(@snow_bitmaps.size)
        @info = r
        sprite.bitmap = @snow_bitmaps[r]
      else
        sprite.bitmap = bitmap
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Set starting point X coordinate
  #     ox : starting point X coordinate
  #--------------------------------------------------------------------------
  def ox=(ox)
    return if @ox == ox;
    @ox = ox
    for sprite in @sprites
      sprite.ox = @ox
    end
  end
  #--------------------------------------------------------------------------
  # * Set starting point Y coordinate
  #     oy : starting point Y coordinate
  #--------------------------------------------------------------------------
  def oy=(oy)
    return if @oy == oy;
    @oy = oy
    for sprite in @sprites
      sprite.oy = @oy
    end
  end
  #--------------------------------------------------------------------------
  # * Set maximum number of sprites
  #     max : maximum number of sprites
  #--------------------------------------------------------------------------
  def power=(power)
    @power = power
    for i in 1..40
      sprite = @sprites
      sprite.visible = (i <= @power) if sprite != nil
      if @type == 19
          sprite.bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
        elsif @type == 20
          sprite.bitmap = @bubble2_bitmaps[rand(@bubble2_bitmaps.size)]
        elsif @type == 3
          r = rand(@snow_bitmaps.size)
          @info = r
          sprite.bitmap = @snow_bitmaps[r]
        end
    end
  end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
  def update
    return if @type == 0
    for i in 1..@power
      sprite = @sprites
      if @type == 1 or @type == 5 or @type == 13 or @type == 27 or @type == 28 or @type == 36 or @type == 39 or @type == 40 or @type == 42 or @type == 43 or @type == 46 #rain
        if sprite.opacity <= 150
          if @current_pose == 0
            sprite.y += @rain_bitmap.height
            sprite.x -= @rain_bitmap.width
            if @type == 1 or @type == 5
              sprite.bitmap = @rain_splash
            else
              sprite.bitmap = @blood_rain_splash
            end
            if @type == 27
              sprite.bitmap = @oil_rain_splash
            end
            if @type == 28
              sprite.bitmap = @golden_rain_splash
            end
            if @type == 36
              sprite.bitmap = @golden_rain_splash
            end
            if @type == 39
              sprite.bitmap = @acid_rain_splash
            end
            if @type == 40
              sprite.bitmap = @acid_rain_splash
            end
            if @type == 42
              sprite.bitmap = @sepia_rain_splash
            end
            if @type == 43
              sprite.bitmap = @sepia_rain_splash
            end
            if @type == 46
              sprite.bitmap = @blood_rain_splash
            end
            @current_pose = 1
          end
        else
          if @current_pose == 1
            if @type == 1 or @type == 5
              sprite.bitmap = @rain_bitmap
            else
              sprite.bitmap = @blood_rain_bitmap
            end
            if @type == 27
              sprite.bitmap = @oil_rain_bitmap
            end
            if @type == 28
              sprite.bitmap = @golden_rain_bitmap
            end
            if @type == 36
              sprite.bitmap = @golden_rain_bitmap
            end
            if @type == 39
              sprite.bitmap = @acid_rain_bitmap
            end
            if @type == 40
              sprite.bitmap = @acid_rain_bitmap
            end
            if @type == 42
              sprite.bitmap = @sepia_rain_bitmap
            end
            if @type == 43
              sprite.bitmap = @sepia_rain_bitmap
            end
            if @type == 46
              sprite.bitmap = @blood_rain_bitmap
            end
            @current_pose = 0
          end
          sprite.x -= 2
          sprite.y += 16
          if @thunder and (rand(8000 - @power) == 0)
            $game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
            Audio.se_play("Audio/SE/Thunder1")
          end
        if @golden_thunder and (rand(8000 - @power) == 0)
            $game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
            Audio.se_play("Audio/SE/Thunder1")
          end
       if @acid_thunder and (rand(5000 - @power) == 0)
            $game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
            Audio.se_play("Audio/SE/Thunder1")
          end
       if @sepia_thunder and (rand(8000 - @power) == 0)
            $game_map.screen.start_flash(Color.new(169, 152, 142, 255), 5)
            Audio.se_play("Audio/SE/Thunder1")
          end
       if @sepia_thunder and (rand(8000 - @power) == 0)
            $game_map.screen.start_flash(Color.new(169, 152, 142, 255), 5)
            Audio.se_play("Audio/SE/Thunder1")
          end
       if @crimson_thunder and (rand(8000 - @power) == 0)
          $game_map.screen.start_flash(Color.new(141, 9, 9, 255), 5)
          Audio.se_play("Audio/SE/Thunder1")
          end
        end
        sprite.opacity -= 8
      end
      if @type == 2 or @type == 37 or @type == 38 or @type == 41 or @type == 44 or @type == 45 or @type == 47 # storm
        sprite.x -= 8
        sprite.y += 16
        sprite.opacity -= 12
      end
        if @real_storm and (rand(5000 - @power) == 0)
        $game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
        $game_map.screen.start_shake(9, 4, 5)
        Audio.se_play("Audio/SE/Thunder9")
      end
      if @type == 3 # snow
        case @info
        when 0 # smallest flake, fall the slowest
          sprite.y += 1
        when 1
          sprite.y += 3
        when 2
          sprite.y += 5
        when 3
          sprite.y += 7
        end
        sprite.opacity -= 3
      end
      if @type == 4 # hail
        sprite.x -= 1
        sprite.y += 18
        sprite.opacity -= 15
      end
      if @type == 6 # falling autumn leaves
        @count = rand(20)
        if @count == 0
          sprite.bitmap = @autumn_leaf_bitmaps[@current_pose]
          @current_pose = (@current_pose + 1) % @autumn_leaf_bitmaps.size
        end
        sprite.x -= 1
        sprite.y += 1
      end
      if @type == 7 # blowing autumn leaves
        @count = rand(20)
        if @count == 0
          sprite.bitmap = @autumn_leaf_bitmaps[@current_pose]
          @current_pose = (@current_pose + 1) % @autumn_leaf_bitmaps.size
        end
        sprite.x -= 10
        sprite.y += (rand(4) - 2)
      end
      if @type == 8 # swirling autumn leaves
        @count = rand(20)
        if @count == 0
          sprite.bitmap = @autumn_leaf_bitmaps[@current_pose]
          @current_pose = (@current_pose + 1) % @autumn_leaf_bitmaps.size
        end
        if @info != 0
          if @info >= 1 and @info <= 10
            sprite.x -= 3
            sprite.y -= 1
          elsif @info >= 11 and @info <= 16
            sprite.x -= 1
            sprite.y -= 2
          elsif @info >= 17 and @info <= 20
            sprite.y -= 3
          elsif @info >= 21 and @info <= 30
            sprite.y -= 2
            sprite.x += 1
          elsif @info >= 31 and @info <= 36
            sprite.y -= 1
            sprite.x += 3
          elsif @info >= 37 and @info <= 40
            sprite.x += 5
          elsif @info >= 41 and @info <= 46
            sprite.y += 1
            sprite.x += 3
          elsif @info >= 47 and @info <= 58
            sprite.y += 2
            sprite.x += 1
          elsif @info >= 59 and @info <= 64
            sprite.y += 3
          elsif @info >= 65 and @info <= 70
            sprite.x -= 1
            sprite.y += 2
          elsif @info >= 71 and @info <= 81
            sprite.x -= 3
            sprite.y += 1
          elsif @info >= 82 and @info <= 87
            sprite.x -= 5
          end
          @info = (@info + 1) % 88
        else
          if rand(200) == 0
            @info = 1
          end
          sprite.x -= 5
          sprite.y += 1
        end
      end
        if @type == 49 # falling red maple leaves
        @count = rand(20)
        if @count == 0
          sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose]
          @current_pose = (@current_pose + 1) % @redmaple_leaf_bitmaps.size
        end
        sprite.x -= 1
        sprite.y += 1
      end
      if @type == 50 # blowing red maple leaves
        @count = rand(20)
        if @count == 0
          sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose]
          @current_pose = (@current_pose + 1) % @redmaple_leaf_bitmaps.size
        end
        sprite.x -= 10
        sprite.y += (rand(4) - 2)
      end
      if @type == 51 # swirling red maple leaves
        @count = rand(20)
        if @count == 0
          sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose]
          @current_pose = (@current_pose + 1) % @redmaple_leaf_bitmaps.size
        end
        if @info != 0
          if @info >= 1 and @info <= 10
            sprite.x -= 3
            sprite.y -= 1
          elsif @info >= 11 and @info <= 16
            sprite.x -= 1
            sprite.y -= 2
          elsif @info >= 17 and @info <= 20
            sprite.y -= 3
          elsif @info >= 21 and @info <= 30
            sprite.y -= 2
            sprite.x += 1
          elsif @info >= 31 and @info <= 36
            sprite.y -= 1
            sprite.x += 3
          elsif @info >= 37 and @info <= 40
            sprite.x += 5
          elsif @info >= 41 and @info <= 46
            sprite.y += 1
            sprite.x += 3
          elsif @info >= 47 and @info <= 58
            sprite.y += 2
            sprite.x += 1
          elsif @info >= 59 and @info <= 64
            sprite.y += 3
          elsif @info >= 65 and @info <= 70
            sprite.x -= 1
            sprite.y += 2
          elsif @info >= 71 and @info <= 81
            sprite.x -= 3
            sprite.y += 1
          elsif @info >= 82 and @info <= 87
            sprite.x -= 5
          end
          @info = (@info + 1) % 88
        else
          if rand(200) == 0
            @info = 1
          end
          sprite.x -= 5
          sprite.y += 1
        end
      end
      if @type == 9 # falling green leaves
        if @countarray == 0
          @current_pose = (@current_pose + 1) % @green_leaf_bitmaps.size
          sprite.bitmap = @green_leaf_bitmaps[@current_pose]
          @countarray = rand(15)
        end
        @countarray = (@countarray + 1) % 15
        sprite.y += 1
      end
      if @type == 10 # sakura petals
        if @info < 25
          sprite.x -= 1
        else
          sprite.x += 1
        end
        @info = (@info + 1) % 50
        sprite.y += 1
      end
      if @type == 11 # rose petals
        @count = rand(20)
        if @count == 0
          sprite.bitmap = @rose_bitmaps[@current_pose]
          @current_pose = (@current_pose + 1) % @rose_bitmaps.size
        end
        if @info % 2 == 0
          if @info < 10
            sprite.x -= 1
          elsif
            sprite.x += 1
          end
        end
        sprite.y += 1
      end
      if @type == 12 # feathers
        if @countarray == 0
          @current_pose = (@current_pose + 1) % @feather_bitmaps.size
          sprite.bitmap = @feather_bitmaps[@current_pose]
        end
        @countarray = (@countarray + 1) % 15
        if rand(100) == 0
          sprite.x -= 1
        end
        if rand(100) == 0
          sprite.y -= 1
        end
        if @info < 50
          if rand(2) == 0
            sprite.x -= 1
          else
            sprite.y -= 1
          end
        else
          if rand(2) == 0
            sprite.x += 1
          else
            sprite.y += 1
          end
        end
        @info = (@info + 1) % 100
      end
      
       if @type == 30 # starburst
        if @countarray == 0
          @current_pose = (@current_pose + 1) % @starburst_bitmaps.size
          sprite.bitmap = @starburst_bitmaps[@current_pose]
        end
        @countarray = (@countarray + 1) % 15
        sprite.y += 1
        sprite.opacity -= 1
      end
      if @type == 31 # starburst up
        if @countarray == 0
          @current_pose = (@current_pose + 1) % @starburst_bitmaps.size
          sprite.bitmap = @starburst_bitmaps[@current_pose]
        end
        @countarray = (@countarray + 1) % 15
        sprite.y -= 1
        sprite.opacity -= 1
      end
      if @type == 32 # starburst up
        if @countarray == 0
          @current_pose = (@current_pose + 1) % @starburst_bitmaps.size
          sprite.bitmap = @starburst_bitmaps[@current_pose]
        end
        @countarray = (@countarray + 1) % 15
        sprite.x -= 2
        sprite.y += 8
        sprite.opacity -= 1
      end     
      
      if @type == 33 # mono-starburst
        if @countarray == 0
          @current_pose = (@current_pose + 1) % @monostarburst_bitmaps.size
          sprite.bitmap = @monostarburst_bitmaps[@current_pose]
        end
        @countarray = (@countarray + 1) % 15
        sprite.y += 1
        sprite.opacity -= 1
      end
      if @type == 34 # mono-starburst up
        if @countarray == 0
          @current_pose = (@current_pose + 1) % @monostarburst_bitmaps.size
          sprite.bitmap = @monostarburst_bitmaps[@current_pose]
        end
        @countarray = (@countarray + 1) % 15
        sprite.y -= 1
        sprite.opacity -= 1
      end
      if @type == 35 # mono-starburst rain
        if @countarray == 0
          @current_pose = (@current_pose + 1) % @monostarburst_bitmaps.size
          sprite.bitmap = @monostarburst_bitmaps[@current_pose]
        end
        @countarray = (@countarray + 1) % 15
        sprite.x -= 2
        sprite.y += 8
        sprite.opacity -= 1
      end           
        if @type == 29 # meteors
        if @countarray > 0
          if rand(20) == 0
            sprite.bitmap = @flame_impact_bitmap
            @countarray = -5
          else
            sprite.x -= 6
            sprite.y += 10
          end
        else
          @countarray += 1
          if @countarray == 0
            sprite.bitmap = @flame_meteor_bitmap
            sprite.opacity = 0
            @count_array = 1
          end
        end
      end
      if @type == 18 # ash
        sprite.y += 2
        case @countarray % 3
        when 0
          sprite.x -= 1
        when 1
          sprite.x += 1
        end
      end      
      
      if @type == 14 # sparkles
        if @countarray == 0
          @current_pose = (@current_pose + 1) % @sparkle_bitmaps.size
          sprite.bitmap = @sparkle_bitmaps[@current_pose]
        end
        @countarray = (@countarray + 1) % 15
        sprite.y += 1
        sprite.opacity -= 1
      end
      if @type == 15 # user-defined
        if $WEATHER_UPDATE
          update_user_defined
          $WEATHER_UPDATE = false
        end
        if $WEATHER_ANIMATED and @countarray == 0
          @current_pose = (@current_pose + 1) % @user_bitmaps.size
          sprite.bitmap = @user_bitmaps[@current_pose]
        end
        sprite.x += $WEATHER_X
        sprite.y += $WEATHER_Y
        sprite.opacity -= $WEATHER_FADE
      end
      if @type == 16 # blowing snow
        sprite.x -= 10
        sprite.y += 6
        sprite.opacity -= 4
      end
      if @type == 48 # blood blizzard
        sprite.x -= 10
        sprite.y += 6
        sprite.opacity -= 4
      end
      if @type == 52 # water bombs
        if @countarray > 0
          if rand(20) == 0
            sprite.bitmap = @waterbomb_impact_bitmap
            @countarray = -5
          else
            sprite.x -= 3
            sprite.y += 5
          end
        else
          @countarray += 1
          if @countarray == 0
            sprite.bitmap = @waterbomb_bitmap
            sprite.opacity = 0
            @count_array = 1
          end
        end
      end
        if @type == 53 # icy bombs
        if @countarray > 0
          if rand(20) == 0
            sprite.bitmap = @icybomb_impact_bitmap
            @countarray = -5
          else
            sprite.x -= 3
            sprite.y += 5
          end
        else
          @countarray += 1
          if @countarray == 0
            sprite.bitmap = @icybomb_bitmap
            sprite.opacity = 0
            @count_array = 1
          end
        end
      end
      if @type == 54 # flare bombs
        if @countarray > 0
          if rand(20) == 0
            sprite.bitmap = @flarebomb_impact_bitmap
            @countarray = -5
          else
            sprite.x -= 3
            sprite.y += 5
          end
        else
          @countarray += 1
          if @countarray == 0
            sprite.bitmap = @flarebomb_bitmap
            sprite.opacity = 0
            @count_array = 1
          end
        end
      end
      if @type == 17 # meteors
        if @countarray > 0
          if rand(20) == 0
            sprite.bitmap = @impact_bitmap
            @countarray = -5
          else
            sprite.x -= 6
            sprite.y += 10
          end
        else
          @countarray += 1
          if @countarray == 0
            sprite.bitmap = @meteor_bitmap
            sprite.opacity = 0
            @count_array = 1
          end
        end
      end
      if @type == 18 # ash
        sprite.y += 2
        case @countarray % 3
        when 0
          sprite.x -= 1
        when 1
          sprite.x += 1
        end
      end
      if @type == 19 or @type == 20 # bubbles
        switch = rand(75) + rand(75) + 1
        if @info < switch / 2
          sprite.x -= 1
        else
          sprite.x += 1
        end
        @info = (@info + 1) % switch
        sprite.y -= 1
        if switch % 2 == 0
          sprite.opacity -= 1
        end
      end
      if @type == 21 # sparkles up
        if @countarray == 0
          @current_pose = (@current_pose + 1) % @sparkle_bitmaps.size
          sprite.bitmap = @sparkle_bitmaps[@current_pose]
        end
        @countarray = (@countarray + 1) % 15
        sprite.y -= 1
        sprite.opacity -= 1
      end
         if @type == 24 # falling yellow leaves
        @count = rand(20)
        if @count == 0
          sprite.bitmap = @yellow_leaf_bitmaps[@current_pose]
          @current_pose = (@current_pose + 1) % @yellow_leaf_bitmaps.size
        end
        sprite.x -= 1
        sprite.y += 1
      end
       if @type == 22 # blowing green leaves
        @count = rand(20)
        if @count == 0
          sprite.bitmap = @green_leaf_bitmaps[@current_pose]
          @current_pose = (@current_pose + 1) % @green_leaf_bitmaps.size
        end
        sprite.x -= 10
        sprite.y += (rand(4) - 2)
      end      
      if @type == 23 # swirling green leaves
        @count = rand(20)
        if @count == 0
          sprite.bitmap = @green_leaf_bitmaps[@current_pose]
          @current_pose = (@current_pose + 1) % @green_leaf_bitmaps.size
        end
        if @info != 0
          if @info >= 1 and @info <= 10
            sprite.x -= 3
            sprite.y -= 1
          elsif @info >= 11 and @info <= 16
            sprite.x -= 1
            sprite.y -= 2
          elsif @info >= 17 and @info <= 20
            sprite.y -= 3
          elsif @info >= 21 and @info <= 30
            sprite.y -= 2
            sprite.x += 1
          elsif @info >= 31 and @info <= 36
            sprite.y -= 1
            sprite.x += 3
          elsif @info >= 37 and @info <= 40
            sprite.x += 5
          elsif @info >= 41 and @info <= 46
            sprite.y += 1
            sprite.x += 3
          elsif @info >= 47 and @info <= 58
            sprite.y += 2
            sprite.x += 1
          elsif @info >= 59 and @info <= 64
            sprite.y += 3
          elsif @info >= 65 and @info <= 70
            sprite.x -= 1
            sprite.y += 2
          elsif @info >= 71 and @info <= 81
            sprite.x -= 3
            sprite.y += 1
          elsif @info >= 82 and @info <= 87
            sprite.x -= 5
          end
          @info = (@info + 1) % 88
        else
          if rand(200) == 0
            @info = 1
          end
          sprite.x -= 5
          sprite.y += 1
        end
      end
        if @type == 24 # falling yellow leaves
        @count = rand(20)
        if @count == 0
          sprite.bitmap = @yellow_leaf_bitmaps[@current_pose]
          @current_pose = (@current_pose + 1) % @yellow_leaf_bitmaps.size
        end
        sprite.x -= 1
        sprite.y += 1
      end      
     if @type == 25 # blowing yellow leaves
        @count = rand(20)
        if @count == 0
          sprite.bitmap = @yellow_leaf_bitmaps[@current_pose]
          @current_pose = (@current_pose + 1) % @yellow_leaf_bitmaps.size
        end
        sprite.x -= 10
        sprite.y += (rand(4) - 2)
      end 
       if @type == 26 # swirling yellow leaves
        @count = rand(20)
        if @count == 0
          sprite.bitmap = @yellow_leaf_bitmaps[@current_pose]
          @current_pose = (@current_pose + 1) % @yellow_leaf_bitmaps.size
        end
        if @info != 0
          if @info >= 1 and @info <= 10
            sprite.x -= 3
            sprite.y -= 1
          elsif @info >= 11 and @info <= 16
            sprite.x -= 1
            sprite.y -= 2
          elsif @info >= 17 and @info <= 20
            sprite.y -= 3
          elsif @info >= 21 and @info <= 30
            sprite.y -= 2
            sprite.x += 1
          elsif @info >= 31 and @info <= 36
            sprite.y -= 1
            sprite.x += 3
          elsif @info >= 37 and @info <= 40
            sprite.x += 5
          elsif @info >= 41 and @info <= 46
            sprite.y += 1
            sprite.x += 3
          elsif @info >= 47 and @info <= 58
            sprite.y += 2
            sprite.x += 1
          elsif @info >= 59 and @info <= 64
            sprite.y += 3
          elsif @info >= 65 and @info <= 70
            sprite.x -= 1
            sprite.y += 2
          elsif @info >= 71 and @info <= 81
            sprite.x -= 3
            sprite.y += 1
          elsif @info >= 82 and @info