设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1854|回复: 1
打印 上一主题 下一主题

[已经过期] 彩虹神剑新修改版与全状态动画整合

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
37 小时
注册时间
2010-6-21
帖子
44
跳转到指定楼层
1
发表于 2015-2-10 21:44:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 hys111111 于 2015-3-4 06:15 编辑

请教各位大大,彩虹神剑可以显示连续伤害的数值,
但如果想加入连续回复的机能,脚本该如何修改呢?
麻烦大大们指点一下,谢谢~~

以下脚本
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4. #==============================================================================
  5. # ☆ 忧雪の伤整合,转载时请保留。
  6. #==============================================================================
  7. #==============================================================================
  8. # ■ 彩虹神剑新修改版与全状态动画整合版
  9. #------------------------------------------------------------------------------
  10. #   彩虹神剑 by 柳柳
  11. #   v1.0 -叶子
  12. #   v1.0a -叶子
  13. #   v1.0b -叶子
  14. #   v1.0c -柳柳
  15. #   v1.0d -柳柳
  16. #   v1.0e -叶子
  17. #   新修改版 -cftx
  18. #   同时显示多个状态动画原脚本 -后知后觉
  19. #   加入多状态动画显示 -忧雪之伤
  20. #==============================================================================

  21. # 一次最多显示多少个状态动画
  22. HZHJ_STATE_ANIMATION_ADD_NUMBER = 2

  23. class Game_Temp
  24.   attr_accessor :phase4step5
  25.   alias hzhj_ini initialize
  26.   def initialize
  27.     @phase4step5 = false
  28.     hzhj_ini
  29.   end
  30. end
  31. class Scene_Battle
  32.   alias hzhj_update_phase4_step2 update_phase4_step2
  33.   def update_phase4_step2
  34.     $game_temp.phase4step5 = false
  35.     hzhj_update_phase4_step2
  36.   end
  37.   alias hzhj_update_phase4_step5 update_phase4_step5
  38.   def update_phase4_step5
  39.     $game_temp.phase4step5 = true
  40.     hzhj_update_phase4_step5
  41.   end
  42. end

  43. module RPG
  44. #--------------------------------------------------------------------------
  45. # ● 常量设定
  46. #--------------------------------------------------------------------------
  47. # 是否显示总伤害
  48. SHOW_TOTAL_DAMAGE = true
  49. # 角色受攻击时是否跳一下
  50. BATTLER_JUMP = false
  51. # 连续伤害的动画ID
  52. SLIP_DAMAGE_ANIMATION_ID = 4
  53. SLIP_DAMAGE_ANIMATION_ID =15
  54. class Sprite < ::Sprite
  55.    #==========================================
  56.    # 修改说明:
  57.    # @flash_shake用来制作挨打时候跳跃
  58.    # @_damage    用来记录每次打击之后弹出数字
  59.    # @_total_damage 记录总伤害
  60.    # @_total_damage_duration 总伤害持续帧
  61.    #==========================================
  62.    #alias 66RPG_rainbow_initialize : initialize
  63.    
  64.    def initialize(viewport = nil)
  65.      #66RPG_rainbow_initialize(viewport)
  66.      super(viewport)
  67.      @_whiten_duration = 0
  68.      @_appear_duration = 0
  69.      @_escape_duration = 0
  70.      @_collapse_duration = 0
  71.      @_damage_duration = 0
  72.      @_animation_duration = 0
  73.      @_blink = false
  74.      # 挨打时候跳跃
  75.      @flash_shake = 0
  76.      # 伤害记录数组
  77.      @_damage = []
  78.      # 总伤害数字
  79.      @_total_damage = 0
  80.      # 总伤害持续帧
  81.      @_total_damage_duration = 0
  82.      #记录已经发生的伤害的变量★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  83.      @p_dam=0
  84.      @hits=0
  85.    end
  86. #美化的伤害处理★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  87. def damage(value, critical)
  88.       # 释放伤害,效果是伤害数字快速消失,觉得不如不消失好看......
  89.       #dispose_damage
  90.       #清除hit数
  91.       dispose_hit
  92.       # 如果伤害值是数值
  93.       if value.is_a?(Numeric)
  94.         # 绝对值转为字符串
  95.         damage_string = value.abs.to_s
  96.       else
  97.         # 转为字符串
  98.         damage_string = value.to_s
  99.       end
  100.       # 初始化位图
  101.       bitmap = Bitmap.new(162, 64)
  102.       bitmap.font.name = ["微軟正黑體","新細明體", "細明體"]
  103.       bitmap.font.size = 32
  104.       # 伤害值是数值的情况下
  105.       if value.is_a?(Numeric)
  106.         # 分割伤害值字符串
  107.         damage_array = damage_string.scan(/./)
  108.         damage_x = 81 - damage_string.size * 9
  109.         # 伤害值为负的情况下
  110.         if value < 0
  111.           # 调用回复数字表
  112.           rect_y = 32
  113.         else
  114.           # 调用伤害数字表
  115.           rect_y = 0
  116.         end
  117.         # 循环伤害值字符串
  118.         for char in damage_array
  119.           number = char.to_i
  120.           # 显示伤害数字
  121.           bitmap.blt(damage_x, 32, RPG::Cache.picture("damagenew"),
  122.           Rect.new(number * 18, rect_y, 18, 32))
  123.           # 后移一位
  124.           damage_x += 18
  125.         end
  126.       # 伤害值不是数值的情况
  127.       else
  128.         # 如果伤害值不是 Miss
  129.         unless value == "Miss"
  130.           # 系统默认描画字符串
  131.           bitmap.font.color.set(0, 0, 0)
  132.           bitmap.draw_text(-1, 27, 162, 36, damage_string, 1)
  133.           bitmap.draw_text(+1, 27, 162, 36, damage_string, 1)
  134.           bitmap.draw_text(-1, 29, 162, 36, damage_string, 1)
  135.           bitmap.draw_text(+1, 29, 162, 36, damage_string, 1)
  136.           bitmap.font.color.set(255, 255, 255)
  137.           bitmap.draw_text(0, 28, 162, 36, damage_string, 1)
  138.         # Miss 的情况下
  139.         else
  140.           # 显示未击中图画
  141.           bitmap.blt(36, 28, RPG::Cache.picture("damagenew"), Rect.new(90, 64, 90, 32))
  142.         end
  143.       end
  144.       # 会心一击标志打开的情况
  145.       if critical
  146.         # 显示会心一击图画
  147.         bitmap.blt(36, 0, RPG::Cache.picture("damagenew"), Rect.new(0, 64, 90, 32))
  148.       end
  149.       # 伤害值定位
  150.       @_damage_sprite = ::Sprite.new(self.viewport)
  151.       @_damage_sprite.bitmap = bitmap
  152.       @_damage_sprite.ox = 81
  153.       @_damage_sprite.oy = 20
  154.       @_damage_sprite.x = self.x
  155.       @_damage_sprite.y = self.y - self.oy / 2
  156.       @_damage_sprite.z = 3000
  157.       @_damage_duration = 40
  158.       @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  159.       make_total_damage(value)  

  160.     end

  161. #   ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  162. # hit数的美化描绘
  163.     def hit

  164.       # 如果伤害值是数值
  165.       # 转为字符串
  166.       value=@hits
  167.         hits_string = value.to_s
  168.       # 初始化位图
  169.        bitmap = Bitmap.new(320, 64)
  170.        bitmap.font.name = "Arial Black"
  171.        bitmap.font.size = 32
  172.        # 分割伤害值字符串
  173.         hits_array = hits_string.scan(/./)
  174.         hits_x = 81 - hits_string.size * 18.1
  175.           rect_y = 0
  176.         # 循环伤害值字符串
  177.         for char in hits_array
  178.           number = char.to_i
  179.           # 显示伤害数字
  180.           bitmap.blt(hits_x, 0, RPG::Cache.picture("Number"),
  181.           Rect.new(number * 36.2, rect_y, 36.2, 50))
  182.           # 后移一位
  183.           hits_x += 36.2
  184.         end
  185.         bitmap.blt(hits_x, 0, RPG::Cache.picture("HITS"),
  186.         Rect.new(0, -21, 90, 50))

  187.       # 伤害值定位
  188.       @_hits_sprite = ::Sprite.new(self.viewport)
  189.       @_hits_sprite.bitmap = bitmap
  190.       @_hits_sprite.ox = 81
  191.       @_hits_sprite.oy = 20
  192.       @_hits_sprite.x = 500
  193.       @_hits_sprite.y = 100
  194.       @_hits_sprite.z = 3000
  195.       @_hits_duration = 40
  196.     end
  197. #--------------------------------------------------------------------------
  198.    # ● 总伤害处理
  199.    #--------------------------------------------------------------------------
  200.    def make_total_damage(value)
  201.      if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
  202.        @_total_damage += value
  203.         # 绝对值转为字符串
  204.         damage_string = @_total_damage.abs.to_s
  205.       else
  206.         return
  207.       end
  208.       # 初始化位图
  209.       bitmap = Bitmap.new(300, 150)
  210.       bitmap.font.name = "Arial Black"
  211.       bitmap.font.size = 32
  212.       # 伤害值是数值的情况下
  213.       if value.is_a?(Numeric)
  214.         # 分割伤害值字符串
  215.         damage_array = damage_string.scan(/./)
  216.         damage_x = 40 - damage_string.size * 9
  217.         # 伤害值为负的情况下
  218.         if value < 0
  219.           # 调用回复数字表
  220.           name="Number3"
  221.         else
  222.           # 调用伤害数字表
  223.           name="Number2"
  224.         end
  225.         # 循环伤害值字符串
  226.         for char in damage_array
  227.           number = char.to_i
  228.           # 显示伤害数字
  229.           bitmap.blt(damage_x, 0, RPG::Cache.picture(name),
  230.           Rect.new(number * 36.2, 0, 36.2, 50))
  231.           # 后移一位
  232.           damage_x += 36.2
  233.         end
  234.       end
  235.       
  236.       
  237.         
  238.         
  239. #     if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
  240. #       @_total_damage += value
  241. #     else
  242. #       return
  243. #     end
  244. #     bitmap = Bitmap.new(300, 150)
  245. #     bitmap.font.name = "Arial Black"
  246. #     bitmap.font.size = 40
  247. #     bitmap.font.color.set(0, 0, 0)
  248. #     bitmap.draw_text(+2, 12+2, 160, 40, @_total_damage.abs.to_s, 1)
  249. #     if @_total_damage < 0
  250. #       bitmap.font.color.set(80, 255, 00)
  251. #    else
  252. #       bitmap.font.color.set(255, 140, 0)
  253. #     end
  254. #     bitmap.draw_text(0, 12, 160, 40, @_total_damage.abs.to_s, 1)
  255. #     bitmap.font.color.set(55, 55,255)
  256.      
  257.      
  258.      if @_total_damage_sprite.nil?
  259.        @_total_damage_sprite = ::Sprite.new(self.viewport)
  260.        @_total_damage_sprite.ox = 80
  261.        @_total_damage_sprite.oy = 20
  262.        @_total_damage_sprite.z = 3000

  263.      end
  264.      @_total_damage_sprite.bitmap = bitmap
  265.      @_total_damage_sprite.zoom_x = 0.8
  266.      @_total_damage_sprite.zoom_y = 0.8
  267.      @_total_damage_sprite.x = self.x
  268.      @_total_damage_sprite.y = self.y  - self.oy / 2 - 64
  269.      @_total_damage_sprite.z = 3001
  270.      @_total_damage_duration = 80
  271.      #hit数描绘
  272.      @hits+=1
  273.     if @_total_damage > 0
  274.       hit
  275.     end
  276.    end


  277.    def animation(animation, hit, battler_damage="", battler_critical=false)
  278.      dispose_animation      
  279.      #=======================================
  280.      # 修改:记录伤害和critical
  281.      #=======================================
  282.      @battler_damage = battler_damage
  283.      @battler_critical = battler_critical
  284.      @_animation = animation
  285.      return if @_animation == nil
  286.      @_animation_hit = hit
  287.      @_animation_duration = @_animation.frame_max
  288.      animation_name = @_animation.animation_name
  289.      animation_hue = @_animation.animation_hue
  290.      bitmap = RPG::Cache.animation(animation_name, animation_hue)
  291.      #=======================================
  292.      # 修改:计算总闪光权限值
  293.      #=======================================
  294.      for timing in @_animation.timings
  295.        quanzhong = animation_process_timing(timing, @_animation_hit,true)
  296.        @all_quanzhong += quanzhong
  297.        # 记录最后一次闪光
  298.        @_last_frame = timing.frame if quanzhong != 0
  299.      end      
  300.      if @@_reference_count.include?(bitmap)
  301.        @@_reference_count[bitmap] += 1
  302.      else
  303.        @@_reference_count[bitmap] = 1
  304.      end
  305.      #=======================================
  306.      # 修改:行动方动画不显示伤害
  307.      #=======================================
  308.      if $scene.is_a?(Scene_Battle)
  309.        if $scene.animation1_id == @battler.animation_id
  310.          @battler_damage = ""
  311.        end
  312.      end
  313.      @_animation_sprites = []
  314.      if @_animation.position != 3 or not @@_animations.include?(animation)
  315.        for i in 0..15
  316.          sprite = ::Sprite.new(self.viewport)
  317.          sprite.bitmap = bitmap
  318.          sprite.visible = false
  319.          @_animation_sprites.push(sprite)
  320.        end
  321.        unless @@_animations.include?(animation)
  322.          @@_animations.push(animation)
  323.        end
  324.      end
  325.      update_animation
  326.   end
  327.    #=======================================
  328.    # 修改:更换清除伤害的算法,以防万一
  329.    #       本内容在脚本中没有使用过
  330.    #=======================================
  331.    def dispose_damage
  332.      for damage in @_damage.reverse
  333.        damage[0].bitmap.dispose
  334.        damage[0].dispose
  335.        @_damage.delete(damage)
  336.      end
  337.      @_total_damage = 0
  338.      @_last_frame = -1
  339.      if @_total_damage_sprite != nil
  340.        @_total_damage_duration = 0
  341.        @_total_damage_sprite.bitmap.dispose
  342.        @_total_damage_sprite.dispose
  343.        @_total_damage_sprite = nil
  344.      end
  345.    end
  346.    #=======================================
  347.    # 清除hit数★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  348.    #=======================================
  349.    def dispose_hit
  350.      if @_hits_sprite != nil
  351.        @_hits_sprite.bitmap.dispose
  352.        @_hits_sprite.dispose
  353.        @_hits_sprite = nil
  354.      end
  355.    end
  356.    def dispose_animation
  357.      #=======================================
  358.      # 修改:清除记录的伤害,清除权重记录
  359.      #=======================================
  360.      @battler_damage = nil
  361.      @battler_critical = nil
  362.      @all_quanzhong = 1
  363.      @_total_damage = 0
  364.      @_last_frame = -1
  365.      if @_animation_sprites != nil
  366.        sprite = @_animation_sprites[0]
  367.        if sprite != nil
  368.          @@_reference_count[sprite.bitmap] -= 1
  369.          if @@_reference_count[sprite.bitmap] == 0
  370.            sprite.bitmap.dispose
  371.          end
  372.        end
  373.        for sprite in @_animation_sprites
  374.          sprite.dispose
  375.        end
  376.        @_animation_sprites = nil
  377.        @_animation = nil
  378.      end
  379.    end
  380.    def update
  381.      super
  382.      if @_whiten_duration > 0
  383.        @_whiten_duration -= 1
  384.        self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  385.      end
  386.      if @_appear_duration > 0
  387.        @_appear_duration -= 1
  388.        self.opacity = (16 - @_appear_duration) * 16
  389.      end
  390.      if @_escape_duration > 0
  391.        @_escape_duration -= 1
  392.        self.opacity = 256 - (32 - @_escape_duration) * 10
  393.      end
  394.      if @_collapse_duration > 0
  395.        @_collapse_duration -= 1
  396.        self.opacity = 256 - (48 - @_collapse_duration) * 6
  397.      end
  398.      #=======================================
  399.      # 修改:更新算法,更新弹出
  400.      #=======================================
  401.      if @_damage_duration > 0
  402.        @_damage_duration -= 1
  403.        for damage in @_damage
  404.          damage[0].x = self.x + self.viewport.rect.x -
  405.                        self.ox + self.src_rect.width / 2 +
  406.                        (40 - damage[1]) * damage[3] / 10
  407.          damage[0].y -= damage[4]+damage[1]/10
  408.          damage[0].opacity = damage[1]*20
  409.          damage[1] -= 1
  410.          if damage[1]==0
  411.            damage[0].bitmap.dispose
  412.            damage[0].dispose
  413.            @_damage.delete(damage)

  414.            next
  415.          end
  416.        end
  417.      end
  418.      #=======================================
  419.      # 添加:弹出总伤害
  420.      #=======================================
  421.      if @_total_damage_duration > 0
  422.        @_total_damage_duration -= 1
  423.        @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
  424.        if @_total_damage_sprite.zoom_x > 1.0
  425.          @_total_damage_sprite.zoom_x -= 0.05
  426.        end
  427.        if @_total_damage_sprite.zoom_y > 1.0
  428.          @_total_damage_sprite.zoom_y -= 0.05
  429.        end
  430.        @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
  431.        if @_total_damage_duration <= 0
  432.          dispose_hit#★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  433.          @_total_damage = 0
  434.          @_total_damage_duration = 0
  435.          @_total_damage_sprite.bitmap.dispose
  436.          @_total_damage_sprite.dispose
  437.          @_total_damage_sprite = nil
  438.        end
  439.      end
  440.      #=======================================
  441.      if @_animation != nil and (Graphics.frame_count % 2 == 0)
  442.        @_animation_duration -= 1
  443.        update_animation
  444.      end
  445.      if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  446.        update_loop_animation
  447.        @_loop_animation_index += 1
  448.        @_loop_animation_index %= @_loop_animation.frame_max
  449.      end
  450.      if @_blink
  451.        @_blink_count = (@_blink_count + 1) % 32
  452.        if @_blink_count < 16
  453.          alpha = (16 - @_blink_count) * 6
  454.        else
  455.          alpha = (@_blink_count - 16) * 6
  456.        end
  457.        self.color.set(255, 255, 255, alpha)
  458.      end
  459.      @@_animations.clear
  460.    end
  461.    def update_animation
  462.     if @_animation_duration > 0
  463.        frame_index = @_animation.frame_max - @_animation_duration
  464.        cell_data = @_animation.frames[frame_index].cell_data
  465.        position = @_animation.position
  466.        animation_set_sprites(@_animation_sprites, cell_data, position)
  467.        #=======================================
  468.        # 修改:弹出伤害,权重计算
  469.        #=======================================
  470.        for timing in @_animation.timings
  471.          if timing.frame == frame_index
  472.            t = 1.0 * animation_process_timing(timing, @_animation_hit)  
  473.                    if timing.se.name != ""
  474.           se=timing.se
  475.           Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  476.         end
  477.            #p t,"当前权重", @all_quanzhong,"总权重"
  478.            if @battler_damage.is_a?(Numeric) and t != 0
  479.              t *= @battler_damage
  480.              t /= @all_quanzhong
  481.              t = t.to_i
  482.              #在闪光不是最后一次的情况下,把这次伤害加入到已经发生的伤害中★★★★★★★★★★★★★★★★★★★★★★★★★★
  483.              if frame_index != @_last_frame
  484.              @p_dam+= t
  485.              end
  486.              #p @p_dam,"已发生伤害",@battler_damage,"总伤害"(调试用)★★★★★★★★★★★★★★★★★★★★★★★★★★
  487.              #闪光为最后一次的情况下,改变这次伤害的计算方法(总伤害-已经发生伤害)★★★★★★★★★★★★★★★★★★★★★★★★★★
  488.              if frame_index == @_last_frame
  489.                t=@battler_damage-@p_dam
  490.              end
  491.              #p t,"当前伤害",@battler_damage,"总伤害"
  492.              # 最后一次闪光的话,伤害修正
  493.              if frame_index == @_last_frame
  494.                @_total_damage = @battler_damage - t
  495.                @p_dam=0      #已经发生的伤害归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  496.             end
  497.              #p t,@battler_damage,@all_quanzhong
  498.              damage(t,@battler_critical)
  499.             #连击次数归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  500.             if frame_index == @_last_frame
  501.                       @hits=0  
  502.             end
  503.            # 防止重复播放miss
  504.            elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  505.              damage(@battler_damage,@battler_critical)
  506.            end
  507.          end
  508.        end
  509.      else
  510.        dispose_animation
  511.      end
  512.    end
  513.    #=======================================
  514.    # 修改:敌人跳跃的功能 + 添加返回数值
  515.    #=======================================
  516.     def animation_process_timing(timing, hit,dontflash=false)
  517.       if (timing.condition == 0) or
  518.          (timing.condition == 1 and hit == true) or
  519.          (timing.condition == 2 and hit == false)
  520.         case timing.flash_scope
  521.         when 1
  522.           unless dontflash
  523.             self.flash(timing.flash_color, timing.flash_duration * 2)
  524.             if @_total_damage >0
  525.               @flash_shake_switch = true
  526.               @flash_shake = 10
  527.             end
  528.           end
  529.           return timing.flash_color.alpha * timing.flash_duration
  530.         when 2
  531.           unless dontflash
  532.             if self.viewport != nil
  533.               self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  534.             end
  535.           end
  536.           return timing.flash_color.alpha * timing.flash_duration
  537.         when 3
  538.           unless dontflash
  539.             self.flash(nil, timing.flash_duration * 2)
  540.           end
  541.           return timing.flash_color.alpha * timing.flash_duration
  542.         end
  543.       end      
  544.       return 0
  545.     end   
  546. end
  547. end
  548. #==============================================================================
  549. # ■ Sprite_Battler
  550. #==============================================================================
  551. class Sprite_Battler < RPG::Sprite
  552.   attr_accessor :battler   
  553. #--------------------------------------------------------------------------
  554. # ● 初始化对像
  555. #    添加跳跃记录
  556. #--------------------------------------------------------------------------
  557. def initialize(viewport, battler = nil)
  558.   super(viewport)
  559.   [url=home.php?mod=space&uid=133701]@battler[/url] = battler
  560.   @battler_visible = false
  561.   @flash_shake_switch = true
  562. # 多状态动画 1/8
  563.     @state_sprites = []
  564.     for i in 0...HZHJ_STATE_ANIMATION_ADD_NUMBER
  565.     @state_sprites.push(RPG::Sprite.new(viewport))
  566.     end
  567.   end
  568.   def dispose
  569. #####################################################################
  570. # 多状态动画 2/8
  571.     for hzhj in @state_sprites
  572.       hzhj.dispose
  573.     end
  574.     if self.bitmap != nil
  575.       self.bitmap.dispose
  576.     end
  577.     super
  578.   end
  579. #--------------------------------------------------------------------------
  580. # ● 刷新画面
  581. #    增添跳跃功能
  582. #--------------------------------------------------------------------------
  583. def update
  584.   super
  585.     for hzhj in @state_sprites
  586.       hzhj.update
  587.     end
  588.   # 战斗者为 nil 的情况下
  589.   if @battler == nil
  590.     self.bitmap = nil
  591.     loop_animation(nil)
  592.       for hzhj in @state_sprites
  593.         hzhj.loop_animation(nil)
  594.       end
  595.     return
  596.   end
  597.   # 文件名和色相与当前情况有差异的情况下
  598.   if @battler.battler_name != @battler_name or
  599.      @battler.battler_hue != @battler_hue
  600.     # 获取、设置位图
  601.     @battler_name = @battler.battler_name
  602.     @battler_hue = @battler.battler_hue
  603.     self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  604.     @width = bitmap.width
  605.     @height = bitmap.height
  606.     self.ox = @width / 2
  607.     self.oy = @height
  608.     # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  609.     if @battler.dead? or @battler.hidden
  610.       self.opacity = 0
  611.     end
  612.   end
  613.   # 动画 ID 与当前的情况有差异的情况下
  614.   if @battler.damage == nil and
  615.      @battler.state_animation_id != @state_animation_id
  616.     @state_animation_id = @battler.state_animation_id
  617.     loop_animation($data_animations[@state_animation_id])
  618.   end
  619.   if @battler.damage == nil and $game_temp.phase4step5
  620.       for i in 0...HZHJ_STATE_ANIMATION_ADD_NUMBER
  621.         if @battler.states[i+1] != nil
  622.           @state_sprites[i].loop_animation($data_animations[$data_states[@battler.states[i+1]].animation_id])
  623.           @state_sprites[i].x = self.x
  624.           @state_sprites[i].y = self.y
  625.           @state_sprites[i].z = self.z
  626.           @state_sprites[i].ox = self.ox
  627.           @state_sprites[i].oy = self.oy
  628.           @state_sprites[i].opacity = self.opacity
  629.           @state_sprites[i].visible = self.visible
  630.           @state_sprites[i].src_rect = self.src_rect
  631.         else
  632.           @state_sprites[i].loop_animation($data_animations[0])
  633.         end
  634.       end
  635.     end
  636.   # 应该被显示的角色的情况下
  637.   if @battler.is_a?(Game_Actor) and @battler_visible
  638.     # 不是主状态的时候稍稍降低点透明度
  639.     if $game_temp.battle_main_phase
  640.       self.opacity += 3 if self.opacity < 255
  641.     else
  642.       self.opacity -= 3 if self.opacity > 207
  643.     end
  644.   end
  645.   # 明灭
  646.   if @battler.blink
  647.     blink_on
  648.   else
  649.     blink_off
  650.   end
  651.   # 不可见的情况下
  652.   unless @battler_visible
  653.     # 出现
  654.     if not @battler.hidden and not @battler.dead? and
  655.        (@battler.damage == nil or @battler.damage_pop)
  656.        # 多状态动画 6/8
  657.     for i in 0...HZHJ_STATE_ANIMATION_ADD_NUMBER
  658.       if @battler.states[i+1] != nil
  659.         @state_sprites[i].loop_animation($data_animations[$data_states[@battler.states[i+1]].animation_id])
  660.         @state_sprites[i].x = self.x
  661.         @state_sprites[i].y = self.y
  662.         @state_sprites[i].z = self.z
  663.         @state_sprites[i].ox = self.ox
  664.         @state_sprites[i].oy = self.oy
  665.         @state_sprites[i].opacity = self.opacity
  666.         @state_sprites[i].visible = self.visible
  667.         @state_sprites[i].src_rect = self.src_rect
  668.       else
  669.         @state_sprites[i].loop_animation($data_animations[0])
  670.       end
  671.     end
  672.       appear
  673.       @battler_visible = true
  674.     end
  675.   end
  676.   # 可见的情况下
  677.   if @battler_visible
  678.     # 逃跑
  679.     if @battler.hidden
  680.       $game_system.se_play($data_system.escape_se)
  681.       # 多状态动画 7/8
  682.     for i in 0...HZHJ_STATE_ANIMATION_ADD_NUMBER
  683.       if @battler.states[i+1] != nil
  684.         @state_sprites[i].loop_animation($data_animations[$data_states[@battler.states[i+1]].animation_id])
  685.         @state_sprites[i].x = self.x
  686.         @state_sprites[i].y = self.y
  687.         @state_sprites[i].z = self.z
  688.         @state_sprites[i].ox = self.ox
  689.         @state_sprites[i].oy = self.oy
  690.         @state_sprites[i].opacity = self.opacity
  691.         @state_sprites[i].visible = self.visible
  692.         @state_sprites[i].src_rect = self.src_rect
  693.       else
  694.         @state_sprites[i].loop_animation($data_animations[0])
  695.       end
  696.     end
  697.       escape
  698.       @battler_visible = false
  699.     end
  700.     # 白色闪烁
  701.     if @battler.white_flash
  702.       whiten
  703.       @battler.white_flash = false
  704.     end
  705.     # 动画
  706.     if @battler.animation_id != 0
  707.       animation = $data_animations[@battler.animation_id]
  708.       animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
  709.       @battler.animation_id = 0
  710.     end
  711.     # 伤害
  712.     if @battler.damage_pop
  713.       @battler.damage = nil
  714.       @battler.critical = false
  715.       @battler.damage_pop = false
  716.     end
  717.     # korapusu
  718.     if @battler.damage == nil and @battler.dead?
  719.       if @battler.is_a?(Game_Enemy)
  720.         $game_system.se_play($data_system.enemy_collapse_se)
  721.       else
  722.         $game_system.se_play($data_system.actor_collapse_se)
  723.       end
  724.       # 多状态动画 8/8
  725.       for i in 0...HZHJ_STATE_ANIMATION_ADD_NUMBER
  726.         if @battler.states[i+1] != nil
  727.           @state_sprites[i].loop_animation($data_animations[$data_states[@battler.states[i+1]].animation_id])
  728.           @state_sprites[i].x = self.x
  729.           @state_sprites[i].y = self.y
  730.           @state_sprites[i].z = self.z
  731.           @state_sprites[i].ox = self.ox
  732.           @state_sprites[i].oy = self.oy
  733.           @state_sprites[i].opacity = self.opacity
  734.           @state_sprites[i].visible = self.visible
  735.           @state_sprites[i].src_rect = self.src_rect
  736.         else
  737.           @state_sprites[i].loop_animation($data_animations[0])
  738.         end
  739.       end
  740.       collapse
  741.       @battler_visible = false
  742.     end
  743.   end
  744.   # 设置活动块的坐标
  745.   if @flash_shake_switch == true
  746.     self.x = @battler.screen_x
  747.     self.y = @battler.screen_y
  748.     self.z = @battler.screen_z
  749.     @flash_shake_switch = false
  750.   end
  751.   if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
  752.     case @flash_shake
  753.     when 9..10
  754.       self.x = @battler.screen_x
  755.       self.y -=4
  756.       self.z = @battler.screen_z
  757.     when 6..8
  758.       self.x = @battler.screen_x
  759.       self.y -=2
  760.       self.z = @battler.screen_z
  761.     when 3..5
  762.       self.x = @battler.screen_x
  763.       self.y +=2
  764.       self.z = @battler.screen_z
  765.     when 2
  766.       self.x = @battler.screen_x
  767.       self.y += 4
  768.       self.z = @battler.screen_z
  769.     when 1
  770.       self.x = @battler.screen_x
  771.       self.y = @battler.screen_y
  772.       self.z = @battler.screen_z
  773.     end
  774.     @flash_shake -= 1
  775.   end
  776. end
  777. end

  778. #==============================================================================
  779. # ■ Scene_Battle
  780. #------------------------------------------------------------------------------
  781. #  处理战斗画面的类。
  782. #==============================================================================

  783. class Scene_Battle
  784. #--------------------------------------------------------------------------
  785. # ● 定义实例变量
  786. #--------------------------------------------------------------------------
  787. attr_reader   :animation1_id                    # 行动方动画ID
  788. end

  789. #==============================================================================
  790. # ■ Game_Battler
  791. #------------------------------------------------------------------------------
  792. #  处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
  793. # 超级类来使用。
  794. #==============================================================================

  795. class Game_Battler
  796. #  #--------------------------------------------------------------------------
  797. #  # ● 应用连续伤害效果
  798. #  #--------------------------------------------------------------------------
  799.   alias rainbow_sword_slip_damage_effect slip_damage_effect
  800.   def slip_damage_effect
  801.     self.animation_id = RPG::SLIP_DAMAGE_ANIMATION_ID
  802.     self.animation_hit = true
  803.     rainbow_sword_slip_damage_effect
  804.   end
  805. end
  806. #==============================================================================
  807. # ☆ 忧雪の伤制作,转载时请保留。
  808. #==============================================================================
  809. #==============================================================================
  810. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  811. #==============================================================================
复制代码

Lv1.梦旅人

梦石
0
星屑
50
在线时间
37 小时
注册时间
2010-6-21
帖子
44
2
 楼主| 发表于 2015-2-17 13:35:14 | 只看该作者
最近我發的問題貌似都沒人能解答,自頂一下……(|||゚д゚)
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-22 17:39

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表