查看: 2195|回复: 4

[已经过期] 动画问题

[复制链接]
梦石
0
星屑
106
在线时间
0 小时
注册时间
2012-6-2
回帖
0
发表于 2012-6-3 13:49:33 | 显示全部楼层 |阅读模式

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

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

×
     问下关于战斗动画Damage  Number     HITS是什么  貌似  或者谁给个全动画的工程参考参考  .....


‘‘──wsqjkws于2012-6-3 13:59补充以下内容:

[code]#==============================================================================
# ■ 全动画战斗系统(修改加强再加强版)
#------------------------------------------------------------------------------
#  By whbm
#   应用脚本 彩虹神剑 By 66
#==============================================================================
    $fangyu = 0
#   修改内容:
#   1.修改战斗失败继续后被怪打就出现死亡静态或者不再出现死亡动态的BUG
#   2.改变防御方式,怪打的时候防御动作才显现,打完就恢复
#   3.修正一个角色死亡后,其他角色添加第6号状态的问题,就是那个一个死了,其他的都要被
#     打好几次的BUG.
#   4.修正不显示战斗胜利图的BUG
#                                        by 星云
#   5.在此脚本中增加了施法动画(放在第八个★动画里面)
#   6.修复了伤害数值与动画被敌人挡住的情况
#   7.修复了攻击动画帧数过多的情况下和人物死亡判定情况下的挨打动画(闪烁判定)
#   8.增加了伤害美化效果(可选,素材放在Pictures文件夹的子文件夹Srting中)
#   9.修改了总伤害与分段伤害显示不一致的BUG
#   10.修复了全画面动画向下的错误
#   11.修复了使用复活出现的错误
#   12.修改了坐标,横纵版均支持
#   13.其他问题会继续跟进(即将加入动态扣血,正在排除BUG中- -,想优先使用的可以来联系我)
#                                        by 果冻叮当猫
#==============================================================================
#简要介绍:
#    本脚本实现了战斗的动态效果,其中包含了待机、攻击、防御、挨打、胜利、死亡。类似于超级横版、超级战斗。但是本系统特色在于所有效果的实现并不是靠庞大的战斗图,而是使用了数据库中的动画。这样不仅突破了不同人不同祯数量的限制,并且方便了单动画单祯的修改。
#使用方法:
#    个人觉得还是比较简单,但是大量的怪物还是会令人头痛。
#    1.数据库的设置
#      敌人必要的动画有待机、挨打、死亡三个必要的动画
#      角色必要的动画有待机、挨打、防御、死亡动态、胜利动态、死亡静态、胜利静态
#
#      死亡静态与胜利静态:动画中只有1祯,为相应动态动画的最后一祯
#      
#      剩下的就是人物攻击的动画,和正常的动画是一样设置
#      如图中的攻击等待动画只是为了在播放攻击动画的同时消除人物本身(素材原因,人物攻击的时候离开了原位,如果是在原位置放魔法是用不上的)
#    2.战斗图的设置
#      战斗图其实只是一个透明的图片,它只是用来描述一个敌人或者角色的大小,并与相应的战斗动画编号相衔接。
#      战斗图的文件名格式如下:
#          名字★待机★防御★挨打★死亡动态★死亡静态★胜利动态★胜利静态★施法动画(本人自己添加的).png
#          (其中“名字”一项与动画无关)
#          例如:
#          紫烟★140★141★148★149★150★144★145★146.png
#      对于敌人无胜利动画或者防御动画,请保持该位置为空,例如:
#          蓝若冰★124★★126★127★128★★★129.png
#    综上,设置就这么完成了。
#注意事项:
#    1.由于系统中待机由动画实现,所以无法使用状态附带动画的功能。
#    2.可以在脚本中使用Ctrl+Shift+F通篇搜索“小改动”,可以修改某些窗口的Z值。
#    3.当您将此系统向您的工程中移植的时候也要注意事项2中的“小改动”。
#    4.系统是从游戏“石焚刃暖”中提取出来的,或许会有疏漏与多余的东西,BUG也是不免的。大家尽管提便是。     
#==============================================================================
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # ● 初始化变量
  #--------------------------------------------------------------------------
  def initialize
    # 生成显示端口
    @viewport1 = Viewport.new(0, 0, 640, 480)
    @viewport2 = Viewport.new(0, 0, 640, 480)
    @viewport3 = Viewport.new(0, 0, 640, 480)
    @viewport4 = Viewport.new(0, 0, 640, 480)
    @viewport2.z = 101
    @viewport3.z = 200
    @viewport4.z = 5000
    # 生成战斗背景活动块
    @battleback_sprite = Sprite.new(@viewport1)
    # 生成敌人活动块
    @enemy_sprites = []
    for enemy in $game_troop.enemies.reverse
#      @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
      @enemy_sprites.push(Sprite_Battler.new(@viewport4, enemy))#敌人的显示高度
    end
    # 生成敌人活动块
    @actor_sprites = []
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    # 生成天候
    @weather = RPG::Weather.new(@viewport1)
    # 生成图片活动块
    @picture_sprites = []
    for i in 51..100
      @picture_sprites.push(Sprite_Picture.new(@viewport3,
        $game_screen.pictures[i]))
    end
    # 生成计时器块
    @timer_sprite = Sprite_Timer.new
    # 刷新画面
    update
  end
  #..........................................................................
  #--------------------------------------------------------------------------
  # ● 胜利图
  #--------------------------------------------------------------------------
  def win
    for sprite in @actor_sprites
      sprite.win
    end
  end
  #..........................................................................
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    # 刷新角色的活动块 (对应角色的替换)
    @actor_sprites[0].battler = $game_party.actors[0]
    @actor_sprites[1].battler = $game_party.actors[1]
    @actor_sprites[2].battler = $game_party.actors[2]
    @actor_sprites[3].battler = $game_party.actors[3]
    # 战斗背景的文件名与现在情况有差异的情况下
    if @battleback_name != $game_temp.battleback_name
      @battleback_name = $game_temp.battleback_name
      if @battleback_sprite.bitmap != nil
        @battleback_sprite.bitmap.dispose
      end
      @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
      @battleback_sprite.src_rect.set(0, 0, 640, 480)
    end
    # 刷新战斗者的活动块
    for sprite in @enemy_sprites + @actor_sprites
      sprite.update
    end
    # 刷新天气图形
    @weather.type = $game_screen.weather_type
    @weather.max = $game_screen.weather_max
    @weather.update
    # 刷新图片活动块
    for sprite in @picture_sprites
      sprite.update
    end
    # 刷新计时器活动块
    @timer_sprite.update
    # 设置画面的色调与震动位置
    @viewport1.tone = $game_screen.tone
    @viewport1.ox = $game_screen.shake
    # 设置画面的闪烁色
    @viewport4.color = $game_screen.flash_color
    # 刷新显示端口
    @viewport1.update
    @viewport2.update
    @viewport4.update
  end
end
class Arrow_Enemy < Arrow_Base
  #--------------------------------------------------------------------------
  # ● 获取光标指向的敌人
  #--------------------------------------------------------------------------
  def enemy
    return $game_troop.enemies[@index]
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    super
    # 如果指向不存在的敌人就离开
    $game_troop.enemies.size.times do
      break if self.enemy.exist?
      @index += 1
      @index %= $game_troop.enemies.size
    end
    # 光标右
    if Input.repeat?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      $game_troop.enemies.size.times do
        @index += 1
        @index %= $game_troop.enemies.size
        break if self.enemy.exist?
      end
    end
    # 光标左
    if Input.repeat?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      $game_troop.enemies.size.times do
        @index += $game_troop.enemies.size - 1
        @index %= $game_troop.enemies.size
        break if self.enemy.exist?
      end
    end
    # 设置活动块坐标
    if self.enemy != nil
      self.x = self.enemy.screen_x + self.ox
      self.y = self.enemy.screen_y + self.oy
    end
  end
end
class Arrow_Actor < Arrow_Base
  #--------------------------------------------------------------------------
  # ● 获取光标指向的角色
  #--------------------------------------------------------------------------
  def actor
    return $game_party.actors[@index]
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    super
    # 光标右
    if Input.repeat?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      @index += 1
      @index %= $game_party.actors.size
    end
    # 光标左
    if Input.repeat?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      @index += $game_party.actors.size - 1
      @index %= $game_party.actors.size
    end
    # 设置活动块坐标
    if self.actor != nil
      self.x = self.actor.screen_x + self.ox
      self.y = self.actor.screen_y + self.oy
    end
  end
end
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● 刷新画面 (主回合步骤 3 : 行动方动画)
  #--------------------------------------------------------------------------
  def update_phase4_step3
    # 行动方动画 (ID 为 0 的情况下是白色闪烁)
    if @animation1_id == 0
      @active_battler.white_flash = true
    else
    # 添加施法动画
      @active_battler.setup_battler_ani(@active_battler.battler_name.split(/★/)[8], 1)
      @active_battler.animation_id = @animation1_id
      @active_battler.animation_hit = true
    end
    # 对像方动画
    for target in @target_battlers
      target.animation_id = @animation2_id
      target.animation_hit = (target.damage != "Miss")
      ###########################################################
      target.setup_battler_dead_ani(0)
      ############################################################
      #.......................................................................
      if target.is_a?(Game_Actor)
        ##############
        if target.guarding?
          $fangyu = 1
        end
        ##############
        if target.current_action.kind == 0 and target.current_action.basic == 1
           target.setup_battler_ani(target.battler_name.split(/★/)[2], 1)
        else
         target.setup_battler_hurt_ani(0)
        end
      end
      if target.is_a?(Game_Enemy)
       if target.current_action.kind == 0 and target.current_action.basic == 1
          target.setup_battler_ani(target.battler_name.split(/★/)[1])
        else
          target.setup_battler_hurt_ani(0)
        end
      end
      #.......................................................................
    end
    # 对像方动画
    for target in @target_battlers
      target.animation_id = @animation2_id
      target.animation_hit = (target.damage != "Miss")
      #......................................................................
    end
    # 限制动画长度、最低 8 帧
    @wait_count = 8
    # 移至步骤 5
    @phase4_step = 5
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面 (主回合步骤 4 : 对像方动画) ★
  #--------------------------------------------------------------------------
  def update_phase4_step4
    # 移至步骤 5
    @phase4_step = 5
  end
end
class Game_Actor < Game_Battler
  
#小改动
#############################################################################
#                                横版修改                                   #
#############################################################################
  
  #--------------------------------------------------------------------------
  # ● 取得战斗画面的 X 坐标
  #--------------------------------------------------------------------------
  SCREEN_X = 50
  
  def screen_x
    case self.index
    when 0
      return 515 + SCREEN_X
    when 1
      return 440 + SCREEN_X
    when 2
      return 590 + SCREEN_X
    when 3
      return 390 + SCREEN_X
    else
      return 640 + SCREEN_X
    end
  end
  #--------------------------------------------------------------------------
  # ● 取得战斗画面的 Y 坐标
  #--------------------------------------------------------------------------
  SCREEN_Y = 60
  
  def screen_y
    case self.index
    when 0
      return 310 + SCREEN_Y
    when 1
      return 295 + SCREEN_Y
    when 2
      return 325 + SCREEN_Y
    when 3
      return 340 + SCREEN_Y
    else
      return 1000 + SCREEN_Y
    end
  end
  #--------------------------------------------------------------------------
  # ● 取得战斗画面的 Z 坐标
  #--------------------------------------------------------------------------
  def screen_z
    case self.index
    when 0
      return 1
    when 1
      return 0
    when 2
      return 2
    when 3
      return 3
    else
      return 0
    end
  end
  
  
#############################################################################
  
  
  
  #--------------------------------------------------------------------------
  # ● 取得战斗画面的 X 坐标
  #--------------------------------------------------------------------------
#  def screen_x
    # 返回计算后的队伍 X 坐标的排列顺序
#    if self.index != nil
      #......................................................................
#      return self.index * 90 + 500
      #......................................................................
#    else
#      return 0
#    end
#  end
  #--------------------------------------------------------------------------
  # ● 取得战斗画面的 Y 坐标
  #--------------------------------------------------------------------------
#  def screen_y
    #........................................................................
#    return 464 - self.index * 110
    #........................................................................
#  end
  #--------------------------------------------------------------------------
  # ● 取得战斗画面的 Z 坐标
  #--------------------------------------------------------------------------
#  def screen_z
    # 返回计算后的队伍 Z 坐标的排列顺序
#    if self.index != nil
#      return 4 - self.index
#    else
#      return 0
#    end
#  end
end

class Scene_Battle
  #..........................................................................
  #--------------------------------------------------------------------------
  # ● 返回phase
  #--------------------------------------------------------------------------
  def phase
    return @phase
  end
  #--------------------------------------------------------------------------
  # ● 返回phase4_step
  #--------------------------------------------------------------------------
  def phase4_step
    return @phase4_step
  end
  #--------------------------------------------------------------------------
  # ● 返回phase4_step
  #--------------------------------------------------------------------------
  def actor_command_active?
    return @actor_command_window.active
  end
  #..........................................................................
end
class Game_Battler
  #..........................................................................
  #--------------------------------------------------------------------------
  # ● 获取循环的动画 ID
  #--------------------------------------------------------------------------  
  def show_damage(value)
    @show_damage_value = value
  end
  #--------------------------------------------------------------------------
  # ● 获取循环的动画 ID
  #--------------------------------------------------------------------------
  def show_damage_value
    return @show_damage_value
  end
  #--------------------------------------------------------------------------
  # ● 获取循环的动画 ID
  #--------------------------------------------------------------------------
  def battler_ani
    return @battler_ani
  end
  #--------------------------------------------------------------------------
  # ● 获取循环的动画 ID
  #--------------------------------------------------------------------------
  def setup_battler_ani(battler_ani, once = 0)
    @battler_ani = battler_ani
    @once = once
  end
  #--------------------------------------------------------------------------
  # ● 获取循环的动画 ID
  #--------------------------------------------------------------------------
  def setup_battler_hurt_ani(hurt)
    @hurt = hurt
  end  
  #--------------------------------------------------------------------------
  # ● 获取循环的动画 ID
  #--------------------------------------------------------------------------
  def setup_battler_dead_ani(over)
    @over = over
  end
  #--------------------------------------------------------------------------
  # ● 获取循环的动画 ID
  #--------------------------------------------------------------------------
  def battler_dead_ani
    return @over
  end
  #--------------------------------------------------------------------------
  # ● 获取循环的动画 ID
  #--------------------------------------------------------------------------
  def battler_ani_once
    return @once
  end
  #--------------------------------------------------------------------------
  # ● 获取循环的动画 ID
  #--------------------------------------------------------------------------
  def battler_hurt_ani
    return @hurt
  end
  #..........................................................................
end
class Sprite_Battler < RPG::Sprite
  #..........................................................................
  #--------------------------------------------------------------------------
  # ● 胜利图
  #--------------------------------------------------------------------------
  def win
    if @battler_name != nil and not @battler.hidden and not @battler.dead?
      @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1)
    end
  end
  #..........................................................................
  #--------------------------------------------------------------------------
  # ● 释放
  #--------------------------------------------------------------------------
  def dispose
    if self.bitmap != nil
      self.bitmap.dispose
    end
    super
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    super
    # 战斗者为 nil 的情况下
    if @battler == nil
      self.bitmap = nil
      loop_animation(nil)
      return
    end
    # 文件名和色相与当前情况有差异的情况下
    if @battler.battler_name != @battler_name or
       @battler.battler_hue != @battler_hue
      @battler_hue = @battler.battler_hue
      # 获取、设置位图
      @battler_name = @battler.battler_name
      self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
      #.......................................................................
      @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
      #.......................................................................
      @width = bitmap.width
      @height = bitmap.height
      self.ox = @width / 2
      self.oy = @height
      # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
      if @battler.is_a?(Game_Enemy)
        if @battler.dead? or @battler.hidden
          self.opacity = 0
        end
      end
    end
    # 动画 ID 与当前的情况有差异的情况下
    #.........................................................................
    if @battler.battler_ani != @battler_ani
      @battler_ani = @battler.battler_ani
      loop_animation($data_animations[@battler_ani.to_i])
    end
    #.........................................................................
    # 应该被显示的角色的情况下
    if @battler.is_a?(Game_Actor) and @battler_visible
      # 不是主状态的时候稍稍降低点透明度
      if $game_temp.battle_main_phase
        self.opacity += 3 if self.opacity < 255
      else
        self.opacity -= 3 if self.opacity > 207
      end
    end
    # 明灭
    if @battler.blink
      blink_on
    else
      blink_off
    end
    # 不可见的情况下
    unless @battler_visible
      # 出现 ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
      if not @battler.hidden and not @battler.dead? and
         (@battler.damage == nil or @battler.damage_pop)
        if @battler.is_a?(Game_Enemy)
          appear
        else
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
        end
        @battler_visible = true
      end
    end
    # 可见的情况下
    if @battler_visible
      # 逃跑
      if @battler.hidden
        $game_system.se_play($data_system.escape_se)
        escape
        @battler_visible = false
      end
      # 白色闪烁
      if @battler.white_flash
        whiten
        @battler.white_flash = false
      end
      # 动画
      if @battler.animation_id != 0
        animation = $data_animations[@battler.animation_id]
        animation(animation, @battler.animation_hit)
        @battler.animation_id = 0
      end
      # 伤害
      if @battler.damage_pop
        damage(@battler.damage, @battler.critical)
        @battler.damage = nil
        @battler.critical = false
        @battler.damage_pop = false
      end
      # korapusu
      if @battler.damage == nil and @battler.dead?
        #....................................................................
        if @battler.is_a?(Game_Enemy)
          $game_system.se_play($data_system.enemy_collapse_se)
          #collapse
        else
          $game_system.se_play($data_system.actor_collapse_se)
        end
        #....................................................................
        @battler_visible = false
      end
    end
    # 设置活动块的坐标
    self.x = @battler.screen_x
    self.y = @battler.screen_y
    self.z = @battler.screen_z
  end
end
module RPG
  class Sprite < ::Sprite
    def damage(value, critical)
      dispose_damage
      if value.is_a?(Numeric)
        damage_string = value.abs.to_s
      else
        damage_string = value.to_s
      end
      bitmap = Bitmap.new(160, 48)
      bitmap.font.name = "Arial Black"
      bitmap.font.size = 32
      bitmap.font.color.set(0, 0, 0)
      bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
      if value.is_a?(Numeric) and value < 0
        bitmap.font.color.set(176, 255, 144)
      else
        bitmap.font.color.set(255, 255, 255)
      end
      bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
      if critical
        bitmap.font.size = 20
        bitmap.font.color.set(0, 0, 0)
        bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
        bitmap.font.color.set(255, 255, 255)
        bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
      end
      @_damage_sprite = ::Sprite.new(self.viewport)
      @_damage_sprite.bitmap = bitmap
      @_damage_sprite.ox = 80
      @_damage_sprite.oy = 20
      @_damage_sprite.x = self.x
      @_damage_sprite.x -= self.bitmap.width/2 if @battler.is_a?(Game_Actor)
      @_damage_sprite.y = self.y - self.oy / 2
      @_damage_sprite.z = 3000
      @_damage_duration = 40
    end
  end
end
module RPG
#--------------------------------------------------------------------------
# ● 常量设定
#--------------------------------------------------------------------------
# 是否显示总伤害
SHOW_TOTAL_DAMAGE = false
# 角色受攻击时是否跳一下
BATTLER_JUMP = true
# 伤害美化字符串文件夹名(放在Pictures文件夹中的子文件夹)
STRING_DOCUMENTS = "String/"
# 是否使用伤害美化效果
USE_DAMAGE = true
# 会心一击音效
CRITICAL_SE="Audio/SE/1267.wav"

class Sprite < ::Sprite
   #==========================================
   # 修改说明:
   # @flash_shake用来制作挨打时候跳跃
   # @_damage    用来记录每次打击之后弹出数字
   # @_total_damage 记录总伤害
   # @_total_damage_duration 总伤害持续帧
   #==========================================
   #alias 66RPG_rainbow_initialize : initialize
   def initialize(viewport = nil)
     #66RPG_rainbow_initialize(viewport)
     super(viewport)
     @_whiten_duration = 0
     @_appear_duration = 0
     @_escape_duration = 0
     @_collapse_duration = 0
     @_damage_duration = 0
     @_animation_duration = 0
     @_blink = false
     # 挨打时候跳跃
     @flash_shake = 0
     # 伤害记录数组
     @_damage = []
     # 总伤害数字
     @_total_damage = 0
     # 总伤害持续帧
     @_total_damage_duration = 0
     #.........................................................................
     #记录已经发生的伤害的变量
     @p_dam=0
     @d_dam=0
     @hits=0
     ############ #小改动
     #记录前一次攻击次数
     @temp_hits=0
     #判断是否为最后一次攻击
     @last_hits=0
     ############
     #.........................................................................
   end
   #--------------------------------------------------------------------------
   #美化的伤害处理
   #--------------------------------------------------------------------------
    def damage(value, critical)
      
if USE_DAMAGE == true then
  
      # 释放伤害,效果是伤害数字快速消失,觉得不如不消失好看......
      #dispose_damage
      #清除hit数
      dispose_hit
      # 如果伤害值是数值
      if value.is_a?(Numeric)
        # 绝对值转为字符串
        damage_string = value.abs.to_s
      else
        # 转为字符串
        damage_string = value.to_s
      end
      # 初始化位图
      bitmap = Bitmap.new(162, 64)
      bitmap.font.name = ["华文行楷","黑体", "宋体"]
      bitmap.font.size = 32
      # 伤害值是数值的情况下
      if value.is_a?(Numeric)
        # 分割伤害值字符串
        damage_array = damage_string.scan(/./)
        damage_x = 81 - damage_string.size * 9
        # 伤害值为负的情况下
        if value < 0
          # 调用回复数字表
          rect_y = 32
        else
          # 调用伤害数字表
          rect_y = 0
        end
        # 循环伤害值字符串
        for char in damage_array
          number = char.to_i
          # 显示伤害数字
          bitmap.blt(damage_x, 32, RPG::Cache.picture(STRING_DOCUMENTS + "Damage"),#"Damagenew"),
          Rect.new(number * 18, rect_y, 18, 32))
          # 后移一位
          damage_x += 18
        end
      # 伤害值不是数值的情况
      else
        # 如果伤害值不是 Miss
        unless value == "Miss"
          # 系统默认描画字符串
          bitmap.font.color.set(0, 0, 0)
          bitmap.draw_text(-1, 27, 162, 36, damage_string, 1)
          bitmap.draw_text(+1, 27, 162, 36, damage_string, 1)
          bitmap.draw_text(-1, 29, 162, 36, damage_string, 1)
          bitmap.draw_text(+1, 29, 162, 36, damage_string, 1)
          bitmap.font.color.set(255, 255, 255)
          bitmap.draw_text(0, 28, 162, 36, damage_string, 1)
        # Miss 的情况下
        else
          # 显示未击中图画
          bitmap.blt(36, 28, RPG::Cache.picture(STRING_DOCUMENTS + "Damage"), Rect.new(90, 64, 90, 32))
        end
      end
      # 会心一击标志打开的情况
      if critical
        #会心一击伤害效果
###########################################################
        Audio.se_play(CRITICAL_SE,90,100) if CRITICAL_SE != "" and !$use_skill
        $game_screen.start_flash(Color.new(255,255,255,255),5)
###########################################################
        # 显示会心一击图画
        bitmap.blt(36, 0, RPG::Cache.picture(STRING_DOCUMENTS + "Damage"), Rect.new(0, 64, 90, 32))
      end
      
else
      
     #.........................................................................
     #清除hit数
     dispose_hit
     #.........................................................................
     if value.is_a?(Numeric)
       damage_string = value.abs.to_s
     else
       damage_string = value.to_s
     end
     bitmap = Bitmap.new(160, 48)
     bitmap.font.name = "Arial Black"
     bitmap.font.size = 32
     bitmap.font.color.set(0, 0, 0)
     bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
     bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
     bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
     bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
     #=======================================
     # 修改:颜色
     #=======================================
     if value.is_a?(Numeric) and value < 0
       bitmap.font.color.set(176, 255, 144)
     else
       bitmap.font.color.set(255, 55, 55)
     end
     bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
     if critical
       #会心一击伤害效果
###########################################################
       Audio.se_play(CRITICAL_SE,50,100) if CRITICAL_SE != "" and !$use_skill
       $game_screen.start_flash(Color.new(255,255,255,255),5)
###########################################################
       bitmap.font.size = 20
       bitmap.font.color.set(0, 0, 0)
       bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
       bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
       bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
       bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
       bitmap.font.color.set(255, 255, 255)
       bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
     end
     
end
   
     # 伤害值定位     
     @_damage_sprite = ::Sprite.new#(self.viewport)
     @_damage_sprite.bitmap = bitmap
     @_damage_sprite.ox = 80
     @_damage_sprite.oy = 20
     @_damage_sprite.x = self.x
     @_damage_sprite.y = self.y - self.oy / 2
     @_damage_sprite.z = 30000
     @_damage_duration = 40
     #=======================================
     # 修改:推入新的伤害
     #=======================================
     @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
     # 总伤害处理
     make_total_damage(value)
     
     
     
    end
   #--------------------------------------------------------------------------
   # ● 返回 @hits
   #--------------------------------------------------------------------------
   def get_hit
     return @hits
   end
   #--------------------------------------------------------------------------
   # ● hit数的美化描绘
   #--------------------------------------------------------------------------
   #..........................................................................
   def hit
     # 如果伤害值是数值
     # 转为字符串
     value=@hits
     hits_string = value.to_s
     # 初始化位图
     bitmap = Bitmap.new(320, 64)
     bitmap.font.name = "Arial Black"
     bitmap.font.size = 32
     # 分割伤害值字符串
     hits_array = hits_string.scan(/./)
     hits_x = - 36.2#hits_string.size * 18.1 # 81 - hits_string.size * 18.1
     rect_y = 0
     # 循环伤害值字符串
     for char in hits_array
       # 后移一位
       hits_x += 36.2
       number = char.to_i
       # 显示伤害数字
       bitmap.blt(hits_x, 0, RPG::Cache.picture(STRING_DOCUMENTS + "Number"),
       Rect.new(number * 36.2, rect_y, 36.2, 50))
     end
     hits_x += 18.1
     bitmap.blt(hits_x, 0, RPG::Cache.picture(STRING_DOCUMENTS + "HITS"),
                Rect.new(0, -21, 90, 50))
     # 伤害值定位
     @_hits_sprite = ::Sprite.new(self.viewport)
     @_hits_sprite.bitmap = bitmap
     @_hits_sprite.x = 560 - hits_string.size * 36.2
     @_hits_sprite.y = 70
     @_hits_sprite.z = 30000
     @_hits_duration = 40
   end
   #..........................................................................
   #--------------------------------------------------------------------------
   # ● 美化的总伤害处理
   #--------------------------------------------------------------------------
   def make_total_damage(value)
     
if USE_DAMAGE == true then     
     
     if value.is_a?(Numeric)# and SHOW_TOTAL_DAMAGE
       @_total_damage += value
        # 绝对值转为字符串
        damage_string = @_total_damage.abs.to_s
      else
        return
      end
#####################################################小改动
     if SHOW_TOTAL_DAMAGE
#####################################################
      # 初始化位图
      bitmap = Bitmap.new(300, 150)
      bitmap.font.name = "Arial Black"
      bitmap.font.size = 32
      # 伤害值是数值的情况下
      if value.is_a?(Numeric)
        # 分割伤害值字符串
        damage_array = damage_string.scan(/./)
        damage_x = 40 - damage_string.size * 9
        # 伤害值为负的情况下
        if value < 0
          # 调用回复数字表
          name= STRING_DOCUMENTS + "Number3"
        else
          # 调用伤害数字表
          name= STRING_DOCUMENTS + "Number2"
        end
        # 循环伤害值字符串
        for char in damage_array
          number = char.to_i
          # 显示伤害数字
          bitmap.blt(damage_x, 0, RPG::Cache.picture(name),
          Rect.new(number * 36.2, 0, 36.2, 50))
          # 后移一位
          damage_x += 36.2
        end
#####################################################小改动
     end
#####################################################
      end
      
else
            
   #--------------------------------------------------------------------------
   # ● 总伤害处理
   #--------------------------------------------------------------------------
     if value.is_a?(Numeric)# and SHOW_TOTAL_DAMAGE
       @_total_damage += value
     else
       return
     end
#####################################################小改动
     if SHOW_TOTAL_DAMAGE
#####################################################
     bitmap = Bitmap.new(300, 150)
     bitmap.font.name = "Arial Black"
     bitmap.font.size = 48
     bitmap.font.color.set(0, 0, 0)
     bitmap.draw_text(+2, 12+2, 160, 36, @_total_damage.abs.to_s, 1)
     if @_total_damage < 0
       bitmap.font.color.set(80, 255, 00)
     else
       bitmap.font.color.set(255, 140, 0)
     end
     bitmap.draw_text(0, 12, 160, 36, @_total_damage.abs.to_s, 1)
#####################################################小改动
     end
#####################################################
end

     if @_total_damage_sprite.nil?
       @_total_damage_sprite = ::Sprite.new#(self.viewport)
       @_total_damage_sprite.ox = 80
       @_total_damage_sprite.oy = 20
       @_total_damage_sprite.z = 30000
     end
     @_total_damage_sprite.bitmap = bitmap
     @_total_damage_sprite.zoom_x = 1.5
     @_total_damage_sprite.zoom_y = 1.5
     @_total_damage_sprite.x = self.x
     @_total_damage_sprite.y = self.y  - self.oy / 2 - 64
     @_total_damage_sprite.z = 30001
     #.........................................................................
     @_total_damage_duration = 40
     #.........................................................................
     #.........................................................................
     #hit数描绘
     @hits+=1
     hit
     #.........................................................................
   end
   def animation(animation, hit, battler_damage="", battler_critical=false)
     dispose_animation      
     #=======================================
     # 修改:记录伤害和critical
     #=======================================
     @battler_damage = battler_damage
     @battler_critical = battler_critical
     @_animation = animation
     return if @_animation == nil
     @_animation_hit = hit
     @_animation_duration = @_animation.frame_max
     animation_name = @_animation.animation_name
     animation_hue = @_animation.animation_hue
     bitmap = RPG::Cache.animation(animation_name, animation_hue)
     #=======================================
     # 修改:计算总闪光权限值
     #=======================================
     for timing in @_animation.timings
       quanzhong = animation_process_timing(timing, @_animation_hit,true)
       @all_quanzhong += quanzhong
       # 记录最后一次闪光
       @_last_frame = timing.frame if quanzhong != 0
     end
     #.........................................................................
     @last_frame = @_last_frame
     #.........................................................................
     if @@_reference_count.include?(bitmap)
       @@_reference_count[bitmap] += 1
     else
       @@_reference_count[bitmap] = 1
     end
     #=======================================
     # 修改:行动方动画不显示伤害
     #=======================================
     if $scene.is_a?(Scene_Battle)
       if $scene.animation1_id == @battler.animation_id
         @battler_damage = ""
       end
     end
     @_animation_sprites = []
     if @_animation.position != 3 or not @@_animations.include?(animation)
       for i in 0..15
         sprite = ::Sprite.new(self.viewport)
         sprite.bitmap = bitmap
         sprite.visible = false
         @_animation_sprites.push(sprite)
       end
       unless @@_animations.include?(animation)
         @@_animations.push(animation)
       end
     end
     update_animation
   end
   #=======================================
   # 修改:更换清除伤害的算法,以防万一
   #       本内容在脚本中没有使用过
   #=======================================
   def dispose_damage
     for damage in @_damage.reverse
       damage[0].bitmap.dispose
       damage[0].dispose
       @_damage.delete(damage)
     end
     @_total_damage = 0
     @_last_frame = -1
     if @_total_damage_sprite != nil
       @_total_damage_duration = 0
       @_total_damage_sprite.bitmap.dispose
       @_total_damage_sprite.dispose
       @_total_damage_sprite = nil
     end
   end
   #=======================================
   # 清除hit数
   #=======================================
   #...........................................................................
   def dispose_hit
     if @_hits_sprite != nil
       @_hits_sprite.bitmap.dispose
       @_hits_sprite.dispose
       @_hits_sprite = nil
     end
   end
   #...........................................................................
   def dispose_animation
     #=======================================
     # 修改:清除记录的伤害,清除权重记录
     #=======================================
     @battler_damage = nil
     @battler_critical = nil
     @all_quanzhong = 1
     @_total_damage = 0
     @_last_frame = -1
     #.........................................................................
     @hits = 0
     #.........................................................................
     if @_animation_sprites != nil
       sprite = @_animation_sprites[0]
       if sprite != nil
         @@_reference_count[sprite.bitmap] -= 1
         if @@_reference_count[sprite.bitmap] == 0
           sprite.bitmap.dispose
         end
       end
       for sprite in @_animation_sprites
         sprite.dispose
       end
       @_animation_sprites = nil
       @_animation = nil
     end
   end
   def update
     super
     if @_whiten_duration > 0
       @_whiten_duration -= 1
       self.color.alpha = 128 - (16 - @_whiten_duration) * 10
     end
     if @_appear_duration > 0
       @_appear_duration -= 1
       self.opacity = (16 - @_appear_duration) * 16
     end
     if @_escape_duration > 0
       @_escape_duration -= 1
       self.opacity = 256 - (32 - @_escape_duration) * 10
     end
     if @_collapse_duration > 0
       @_collapse_duration -= 1
       self.opacity = 256 - (48 - @_collapse_duration) * 6
     end
     #=======================================
     # 修改:更新算法,更新弹出
     #=======================================
     if @_damage_duration > 0
       @_damage_duration -= 1
       for damage in @_damage
         damage[0].x = self.x + self.viewport.rect.x -
                       self.ox + self.src_rect.width / 2 +
                       (40 - damage[1]) * damage[3] / 10
         damage[0].y -= damage[4]+damage[1]/10
         damage[0].opacity = damage[1]*20
         damage[1] -= 1
         if damage[1]==0
           damage[0].bitmap.dispose
           damage[0].dispose
           @_damage.delete(damage)
           next
         end
       end
     end
     #=======================================
     # 添加:弹出总伤害
     #=======================================
     if @_total_damage_duration > 0
       @_total_damage_duration -= 1
       @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
       if @_total_damage_sprite.zoom_x > 1.0
         @_total_damage_sprite.zoom_x -= 0.05
       end
       if @_total_damage_sprite.zoom_y > 1.0
         @_total_damage_sprite.zoom_y -= 0.05
       end
       @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
       #......................................................................
       if @_total_damage_duration <= 7 and @_total_damage_duration > 0
         @_hits_sprite.opacity -= 32
         @_hits_sprite.x += 1
       end
       #......................................................................
       if @_total_damage_duration <= 0
         #.....................................................................
         dispose_hit
##########################
         @_total_damage = 0
##########################
         #.....................................................................
         @_total_damage = 0
         @_total_damage_duration = 0
#####################################################小改动
         if SHOW_TOTAL_DAMAGE
         @_total_damage_sprite.bitmap.dispose
         end
#####################################################
         @_total_damage_sprite.dispose
         @_total_damage_sprite = nil
       end
     end
     #=======================================
     if @_animation != nil and (Graphics.frame_count % 2 == 0)
       @_animation_duration -= 1
       update_animation
     end
     if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
       update_loop_animation
       @_loop_animation_index += 1
       #......................................................................
       @loop_animation_once = 0
       @loop_animation_once = 1 if @once == 1 and @_loop_animation_index == @_loop_animation.frame_max
       #......................................................................
       @_loop_animation_index %= @_loop_animation.frame_max
     end
     if @_blink
       @_blink_count = (@_blink_count + 1) % 32
       if @_blink_count < 16
         alpha = (16 - @_blink_count) * 6
       else
         alpha = (@_blink_count - 16) * 6
       end
       self.color.set(255, 255, 255, alpha)
     end
     @@_animations.clear
   end
   #..........................................................................
   def loop_animation_once
     return @_loop_animation_once
   end
   #..........................................................................
   def update_animation
     if @_animation_duration > 0
       frame_index = @_animation.frame_max - @_animation_duration
       @frame_index = frame_index
       cell_data = @_animation.frames[frame_index].cell_data
       position = @_animation.position
       animation_set_sprites(@_animation_sprites, cell_data, position)
       #=======================================
       # 修改:弹出伤害,权重计算
       #=======================================
       for timing in @_animation.timings
         if timing.frame == frame_index
           t = 1.0 * animation_process_timing(timing, @_animation_hit)            
           #p t,"当前权重", @all_quanzhong,"总权重"
           if @battler_damage.is_a?(Numeric) and t != 0
             t *= @battler_damage
             t /= @all_quanzhong
             t = t.to_i
             #在闪光不是最后一次的情况下,把这次伤害加入到已经发生的伤害中★★★★★★★★★★★★★★★★★★★★★★★★★★
             if frame_index != @_last_frame
             @p_dam+= t
             ##########
             @d_dam = t if $动态扣血
             ##########
             end
             #p @p_dam,"已发生伤害",@battler_damage,"总伤害"(调试用)★★★★★★★★★★★★★★★★★★★★★★★★★★
             #闪光为最后一次的情况下,改变这次伤害的计算方法(总伤害-已经发生伤害)★★★★★★★★★★★★★★★★★★★★★★★★★★
             if frame_index == @_last_frame
               t=@battler_damage-@p_dam
             end
             #p t,"当前伤害",@battler_damage,"总伤害"
             # 最后一次闪光的话,伤害修正
             if frame_index == @_last_frame
               @_total_damage = @battler_damage - t
               #############
               @d_dam = @battler_damage-@p_dam  if $动态扣血
               #############
               @p_dam=0      #已经发生的伤害归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
            end
             #p t,@battler_damage,@all_quanzhong
             damage(t,@battler_critical)
            #连击次数归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
            if frame_index == @_last_frame
                      ############ #小改动
                      @last_hits=1
                      @temp_hits=0
                      ############
                      @hits=0
                      ##################
                      $use_skill = false
                      ##################
            end
           # 防止重复播放miss
           elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
             damage(@battler_damage,@battler_critical)
           end
         end
       end
     else
       dispose_animation
     end
   end
   #=======================================
   # 修改:敌人跳跃的功能 + 添加返回数值
   #=======================================
   def update_loop_animation
     frame_index = @_loop_animation_index
     cell_data = @_loop_animation.frames[frame_index].cell_data
     position = @_loop_animation.position
     #·改·
     if @wait_count.to_i <= 0
       @wait_count = 0
       animation_set_sprites(@_loop_animation_sprites, cell_data, position)
     else
       @wait_count -= 1
       for sprite in @_loop_animation_sprites
         sprite.visible = false
       end
     end
     if @wait_flash.to_i <= 0
       @wait_flash = 0
     else
       @wait_flash -= 1
       for sprite in @_loop_animation_sprites
         sprite.blend_type = 1
       end
     end
     #·改·
     for timing in @_loop_animation.timings
       if timing.frame == frame_index
         animation_process_timing(timing, true)
       end
     end
   end
   #=======================================
   # 修改:敌人跳跃的功能 + 添加返回数值
   #=======================================
   def loop_animation(animation)
     return if animation == @_loop_animation
     dispose_loop_animation
     @_loop_animation = animation
     return if @_loop_animation == nil
     @_loop_animation_index = 0
     animation_name = @_loop_animation.animation_name
     animation_hue = @_loop_animation.animation_hue
     bitmap = RPG::Cache.animation(animation_name, animation_hue)
     if @@_reference_count.include?(bitmap)
       @@_reference_count[bitmap] += 1
     else
       @@_reference_count[bitmap] = 1
     end
     @_loop_animation_sprites = []
     for i in 0..15
       sprite = ::Sprite.new
       sprite.bitmap = bitmap
       sprite.visible = false
       @_loop_animation_sprites.push(sprite)
     end
     update_loop_animation
   end
   #=======================================
   # 修改:敌人跳跃的功能 + 添加返回数值
   #=======================================
    def animation_process_timing(timing, hit,dontflash=false)
      if (timing.condition == 0) or
         (timing.condition == 1 and hit == true) or
         (timing.condition == 2 and hit == false)
        unless dontflash
          if timing.se.name != ""
            se = timing.se
            Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
          end
        end
        case timing.flash_scope
        when 1
          unless dontflash
            self.flash(timing.flash_color, timing.flash_duration * 2)
            #....................................................................
            @wait_flash = timing.flash_duration
            #....................................................................
            if @_total_damage >0
              @flash_shake_switch = true
              @flash_shake = 10
            end
          end
          return timing.flash_color.alpha * timing.flash_duration
        when 2
          unless dontflash
            if self.viewport != nil
              self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
              return timing.flash_color.alpha * timing.flash_duration
            end
          end
        when 3
          unless dontflash
            self.flash(nil, timing.flash_duration * 2)
            #@_loop_animation_count = 1
            #·改·
            @wait_count = timing.flash_duration
            #·改·
          end
          return timing.flash_color.alpha * timing.flash_duration
        end
      end      
      return 0
    end   
end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● 初始化对像
#    添加跳跃记录
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
  super(viewport)
  @battler = battler
  @battler_visible = false
  @flash_shake_switch = true
  #........................................................................
  @once = 0
  @frame_index = -1
  @last_frame = 0
  #........................................................................
end
#--------------------------------------------------------------------------
# ● 刷新画面
#    增添跳跃功能
#--------------------------------------------------------------------------
def update
  super
  # 战斗者为 nil 的情况下
  if @battler == nil
    self.bitmap = nil
    loop_animation(nil)
    return
  end
  # 文件名和色相与当前情况有差异的情况下
  if @battler.battler_name != @battler_name or
     @battler.battler_hue != @battler_hue
    # 获取、设置位图
    @battler_name = @battler.battler_name
    @battler_hue = @battler.battler_hue
    self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
    #.......................................................................
    if not @battler.hidden and not @battler.dead?
      @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
    end
    #.......................................................................
    @width = bitmap.width
    @height = bitmap.height
    self.ox = @width / 2
    self.oy = @height
  end
  #.......................................................................
  update_actor_animation
  update_enemy_animation
  #.......................................................................
  # 动画 ID 与当前的情况有差异的情况下
  #.........................................................................
  if @battler.is_a?(Game_Enemy)
    if @once == 1 and @loop_animation_once == 1 and
       @battler.battler_dead_ani == 1
      @battler.setup_battler_ani(@battler.battler_name.split(/★/)[5])
    elsif @once == 1 and @loop_animation_once == 1 and $scene.phase != 5
      @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
    end
  end
  if @battler.is_a?(Game_Actor)
    ####################################################################
    if @once == 1 and @loop_animation_once == 1 and $scene.phase != 5 and
       @battler.battler_dead_ani == 1 and @battler.dead?
      @battler.setup_battler_ani(@battler.battler_name.split(/★/)[5])
    #######################################################################
    elsif @once == 1 and @loop_animation_once == 1 and $scene.phase != 5
      @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
      #################################################################
      $fangyu = 0
      @battler.setup_battler_dead_ani(0)
      ########################################################
    elsif @once == 1 and @loop_animation_once == 1 and $scene.phase == 5 and
          not @battler.dead?
      @battler.setup_battler_ani(@battler.battler_name.split(/★/)[7])
      ######################################################
      $fangyu = 0
      @battler.setup_battler_dead_ani(0)
      ######################################################
    end
  end
  if @battler.battler_ani != @battler_ani
    @battler_ani = @battler.battler_ani
    @once = @battler.battler_ani_once
    loop_animation($data_animations[@battler_ani.to_i])
  end
  #.........................................................................
  # 明灭
  if @battler.blink
    blink_on
  else
    blink_off
  end
  # 不可见的情况下
  unless @battler_visible
    # 出现
    if not @battler.hidden and not @battler.dead? and
       (@battler.damage == nil or @battler.damage_pop)
      #.......................................................................
      if @battler.is_a?(Game_Enemy)
        @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
        #appear
      else
        @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
      end
      #.......................................................................
      @battler_visible = true
    end
  end
  # 可见的情况下
  if @battler_visible
    # 逃跑
    if @battler.hidden
      $game_system.se_play($data_system.escape_se)
      escape
      @battler_visible = false
    end
    # 白色闪烁
    if @battler.white_flash
      whiten
      @battler.white_flash = false
    end
    # 动画
    if @battler.animation_id != 0
      animation = $data_animations[@battler.animation_id]
      animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
      @battler.animation_id = 0
    end
    # 伤害
    if @battler.damage_pop
      @battler.damage = nil
      @battler.critical = false
      @battler.damage_pop = false
    end
    # korapusu
    if @battler.damage == nil and @battler.dead?
      if @battler.is_a?(Game_Enemy)
        if @battler.battler_dead_ani != 1
          #p "Battler Death Error"
          $game_system.se_play($data_system.enemy_collapse_se)
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
          @battler.setup_battler_dead_ani(1)
        end
        #.....................................................................
        collapse
        #.....................................................................
      else
        #.....................................................................
        if @battler.battler_dead_ani != 1
          #p "Battler Death Error"
          $game_system.se_play($data_system.enemy_collapse_se)
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
          @battler.setup_battler_dead_ani(1)
        end
        #.....................................................................
      end
      @battler_visible = false
    end
  end
  # 设置活动块的坐标
  if @flash_shake_switch == true
    self.x = @battler.screen_x
    self.y = @battler.screen_y
    self.z = @battler.screen_z
    @flash_shake_switch = false
  end
  if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
    if @battler.is_a?(Game_Enemy)
      case @flash_shake
      when 9..10
        self.x -=4
        self.y -=4
        self.z = @battler.screen_z
      when 6..8
        self.x -=2
        self.y -=2
        self.z = @battler.screen_z
      when 3..5
        self.x +=2
        self.y +=2
        self.z = @battler.screen_z
      when 1..2
        self.x +=4
        self.y +=4
        self.z = @battler.screen_z
      end
    end
    if @battler.is_a?(Game_Actor)
      case @flash_shake
      when 9..10
        self.x +=4
        self.y +=4
        self.z = @battler.screen_z
      when 6..8
        self.x +=2
        self.y +=2
        self.z = @battler.screen_z
      when 3..5
        self.x -=2
        self.y -=2
        self.z = @battler.screen_z
      when 1..2
        self.x -=4
        self.y -=4
        self.z = @battler.screen_z
      end
    end
    @flash_shake -= 1
  end
end
end

#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
#  处理战斗画面的类。
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader   :animation1_id                    # 行动方动画ID
end
class Sprite_Battler < RPG::Sprite
  #--------------------------------------------------------------------------
  # ● 处理角色动作
  #--------------------------------------------------------------------------
  def update_actor_animation
    if @battler.is_a?(Game_Actor)
      if @battler.show_damage_value != nil
        self.damage(@battler.show_damage_value, false)
        @battler.show_damage(nil)
        @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
        @battler.setup_battler_hurt_ani(1)
      end
      if @battler.current_action.kind == 0 and @battler.current_action.basic == 1 and @battler.show_damage_value != nil
        # 防御的时候
        if @hits > @temp_hits and not @battler.dead?
          #########################
          @battler.temphp -= @d_dam if $动态扣血
          #########################
          ############ #小改动
          @temp_hits+=1
          ############
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
          @battler.setup_battler_hurt_ani(1)
          #################################################################
        elsif @last_hits == 1 and not @battler.dead?
          #########################
          @battler.temphp -= @d_dam if $动态扣血
          #########################
          ############ #小改动
          @last_hits = 0
          ############
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
          @battler.setup_battler_hurt_ani(1)
          #################################################################
        elsif @frame_index != -1 and @frame_index != @last_frame and not @battler.dead? and !@battler.damage.is_a?(Numeric)
          #########################
          @battler.temphp -= @d_dam if $动态扣血
          #########################
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
          @battler.setup_battler_hurt_ani(1)
          #################################################################
        elsif @last_hits == 1 and not @battler.dead? and !@battler.damage.is_a?(Numeric)
          #########################
          @battler.temphp -= @d_dam if $动态扣血
          #########################
          ############ #小改动
          @last_hits = 0
          ############
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
          @battler.setup_battler_hurt_ani(1)
          #################################################################
        end
      else
        # 单回合只有一次攻击
        if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1
          #########################
          @battler.temphp -= @d_dam if $动态扣血
          #########################
          ############ #小改动
          @last_hits = 0
          ############
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
          @battler.setup_battler_hurt_ani(1)
          #################################################################
        # 单回合多次攻击
        elsif @hits > @temp_hits and @frame_index != @last_frame and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1
          #########################
          @battler.temphp -= @d_dam if $动态扣血
          #########################
          ############ #小改动
          @temp_hits+=1
          ############
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
          @battler.setup_battler_hurt_ani(1)
        ########################################################################
        # 死亡之前攻击
        elsif @hits > @temp_hits and @frame_index != @last_frame and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1 and @battler.dead? and @battler.battler_dead_ani != 1
          #########################
          @battler.temphp -= @d_dam if $动态扣血
          @battler.temphp = @battler.hp if $动态扣血
          #########################
          ############ #小改动
          @temp_hits+=1
          ############
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
          @battler.setup_battler_hurt_ani(1)
          #################################################################
        # 闪避的回合
        elsif !@battler_damage.is_a?(Numeric) and @last_hits == 1 and @frame_index == @last_frame
          #########################
          @battler.temphp -= @d_dam  if $动态扣血
          #########################
          @last_hits = 0
          #################################################################
        # 无伤害的攻击
        elsif @battler_damage.is_a?(Numeric) and @battler.damage == 0 and @last_hits == 1 and @frame_index == @last_frame
          #########################
          @battler.temphp -= @d_dam  if $动态扣血
          #########################
          @last_hits = 0
          ######################################################
          $fangyu = 0
          @battler.setup_battler_dead_ani(0)
          ######################################################
          #################################################################
        # 死亡判定
        elsif @last_hits == 1 and @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
#          for actor in $game_party.actors
#            if @battler != actor
#              actor.add_state(6)
#            end
#          end
          #########################
          @battler.temphp -= @d_dam  if $动态扣血
          @battler.temphp = @battler.hp  if $动态扣血
          #########################
          @last_hits = 0
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
          @battler.setup_battler_dead_ani(1)
          #################################################################
        # 胜利判定
        elsif $scene.phase == 5 and @once == 0 and @battler_name != nil and not @battler.hidden and not @battler.dead? and $game_temp.battle_proc == nil
             @once = 1
             @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1)
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 处理敌人动作
  #--------------------------------------------------------------------------
  def update_enemy_animation
    if @battler.is_a?(Game_Enemy)
      if @battler.show_damage_value != nil
        self.damage(@battler.show_damage_value, false)
        @battler.show_damage(nil)
        @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
        @battler.setup_battler_hurt_ani(1)
      end
      if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
      else
        # 单回合只有一次攻击
        if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0
          ############ #小改动
          @last_hits = 0
          ############
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
          @battler.setup_battler_hurt_ani(1)
          #################################################################
        # 单回合多次攻击
        elsif @hits > @temp_hits and @frame_index != @last_frame and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0
          ############ #小改动
          @temp_hits+=1
          ############
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
          @battler.setup_battler_hurt_ani(1)
          #################################################################
        # 死亡之前攻击
        elsif @hits > @temp_hits and @frame_index != @last_frame and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and @battler.dead? and @battler.battler_dead_ani != 1
          ############ #小改动
          @temp_hits+=1
          ############
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
          @battler.setup_battler_hurt_ani(1)
          #################################################################
        # 无伤害的攻击
        elsif @battler_damage.is_a?(Numeric) and @battler.damage <= 0 and @last_hits == 1 and @frame_index == @last_frame
          @last_hits = 0
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
          ######################################################
          $fangyu = 0
          @battler.setup_battler_dead_ani(0)
          ######################################################
          #################################################################
        # 闪避的回合
        elsif !@battler_damage.is_a?(Numeric) and @last_hits == 1 and @frame_index == @last_frame
          @last_hits = 0
          #################################################################
        # 死亡判定
        elsif @last_hits == 1 and @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
          @last_hits = 0
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
          @battler.setup_battler_dead_ani(1)
          collapse
        end
      end
    end
  end
end
[/code]
’’
梦石
0
星屑
47
在线时间
412 小时
注册时间
2012-6-1
回帖
1008
发表于 2012-6-3 16:16:54 | 显示全部楼层
什么问题呀呀呀
这里是新人 明特·布兰马修
脚本盲 事件盲 美工盲
还是色盲ORZ
XP\VX略懂VA无助很抱歉
所以问题什么如果答不好就不要提醒我了
短篇7已经放弃,但是坑在继续补上。所以回答和现身次数少之。
有事烧纸或者留言即可。

还有我不是正太啊ORZ
回复

使用道具 举报

梦石
0
星屑
49
在线时间
186 小时
注册时间
2012-5-8
回帖
939
发表于 2012-6-3 19:18:29 | 显示全部楼层
问题不完整,请及时修正。
看什么看,没看过大坑啊!
-------------------------炫翼-----------------------------
剧情:4%
地图:2%
系统:7%
优化:3%
脚本:25%
--------------------------炫翼----------------------------

      工作室


广告位招租....  
回复

使用道具 举报

梦石
0
星屑
62
在线时间
29 小时
注册时间
2011-12-9
回帖
33
发表于 2012-6-3 20:57:45 | 显示全部楼层
你不说什么问题神也没法帮你。
回复

使用道具 举报

虚空人形

梦石
0
星屑
4866
在线时间
2037 小时
注册时间
2011-8-11
回帖
3260

贵宾

发表于 2012-6-3 22:15:58 | 显示全部楼层
本帖最后由 hcm 于 2012-6-3 22:18 编辑

貌似1楼损坏了,在这里重发一下:   
问下关于战斗动画Damage  Number     HITS是什么  貌似  或者谁给个全动画的工程参考参考  .....


‘‘──wsqjkws于2012-6-3 13:59补充以下内容:
  1. #==============================================================================
  2. # ■ 全动画战斗系统(修改加强再加强版)
  3. #------------------------------------------------------------------------------
  4. #  By whbm
  5. #   应用脚本 彩虹神剑 By 66
  6. #==============================================================================
  7.     $fangyu = 0
  8. #   修改内容:
  9. #   1.修改战斗失败继续后被怪打就出现死亡静态或者不再出现死亡动态的BUG
  10. #   2.改变防御方式,怪打的时候防御动作才显现,打完就恢复
  11. #   3.修正一个角色死亡后,其他角色添加第6号状态的问题,就是那个一个死了,其他的都要被
  12. #     打好几次的BUG.
  13. #   4.修正不显示战斗胜利图的BUG
  14. #                                        by 星云
  15. #   5.在此脚本中增加了施法动画(放在第八个★动画里面)
  16. #   6.修复了伤害数值与动画被敌人挡住的情况
  17. #   7.修复了攻击动画帧数过多的情况下和人物死亡判定情况下的挨打动画(闪烁判定)
  18. #   8.增加了伤害美化效果(可选,素材放在Pictures文件夹的子文件夹Srting中)
  19. #   9.修改了总伤害与分段伤害显示不一致的BUG
  20. #   10.修复了全画面动画向下的错误
  21. #   11.修复了使用复活出现的错误
  22. #   12.修改了坐标,横纵版均支持
  23. #   13.其他问题会继续跟进(即将加入动态扣血,正在排除BUG中- -,想优先使用的可以来联系我)
  24. #                                        by 果冻叮当猫
  25. #==============================================================================
  26. #简要介绍:
  27. #    本脚本实现了战斗的动态效果,其中包含了待机、攻击、防御、挨打、胜利、死亡。类似于超级横版、超级战斗。但是本系统特色在于所有效果的实现并不是靠庞大的战斗图,而是使用了数据库中的动画。这样不仅突破了不同人不同祯数量的限制,并且方便了单动画单祯的修改。
  28. #使用方法:
  29. #    个人觉得还是比较简单,但是大量的怪物还是会令人头痛。
  30. #    1.数据库的设置
  31. #      敌人必要的动画有待机、挨打、死亡三个必要的动画
  32. #      角色必要的动画有待机、挨打、防御、死亡动态、胜利动态、死亡静态、胜利静态
  33. #
  34. #      死亡静态与胜利静态:动画中只有1祯,为相应动态动画的最后一祯
  35. #      
  36. #      剩下的就是人物攻击的动画,和正常的动画是一样设置
  37. #      如图中的攻击等待动画只是为了在播放攻击动画的同时消除人物本身(素材原因,人物攻击的时候离开了原位,如果是在原位置放魔法是用不上的)
  38. #    2.战斗图的设置
  39. #      战斗图其实只是一个透明的图片,它只是用来描述一个敌人或者角色的大小,并与相应的战斗动画编号相衔接。
  40. #      战斗图的文件名格式如下:
  41. #          名字★待机★防御★挨打★死亡动态★死亡静态★胜利动态★胜利静态★施法动画(本人自己添加的).png
  42. #          (其中“名字”一项与动画无关)
  43. #          例如:
  44. #          紫烟★140★141★148★149★150★144★145★146.png
  45. #      对于敌人无胜利动画或者防御动画,请保持该位置为空,例如:
  46. #          蓝若冰★124★★126★127★128★★★129.png
  47. #    综上,设置就这么完成了。
  48. #注意事项:
  49. #    1.由于系统中待机由动画实现,所以无法使用状态附带动画的功能。
  50. #    2.可以在脚本中使用Ctrl+Shift+F通篇搜索“小改动”,可以修改某些窗口的Z值。
  51. #    3.当您将此系统向您的工程中移植的时候也要注意事项2中的“小改动”。
  52. #    4.系统是从游戏“石焚刃暖”中提取出来的,或许会有疏漏与多余的东西,BUG也是不免的。大家尽管提便是。     
  53. #==============================================================================
  54. class Spriteset_Battle
  55.   #--------------------------------------------------------------------------
  56.   # ● 初始化变量
  57.   #--------------------------------------------------------------------------
  58.   def initialize
  59.     # 生成显示端口
  60.     @viewport1 = Viewport.new(0, 0, 640, 480)
  61.     @viewport2 = Viewport.new(0, 0, 640, 480)
  62.     @viewport3 = Viewport.new(0, 0, 640, 480)
  63.     @viewport4 = Viewport.new(0, 0, 640, 480)
  64.     @viewport2.z = 101
  65.     @viewport3.z = 200
  66.     @viewport4.z = 5000
  67.     # 生成战斗背景活动块
  68.     @battleback_sprite = Sprite.new(@viewport1)
  69.     # 生成敌人活动块
  70.     @enemy_sprites = []
  71.     for enemy in $game_troop.enemies.reverse
  72. #      @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  73.       @enemy_sprites.push(Sprite_Battler.new(@viewport4, enemy))#敌人的显示高度
  74.     end
  75.     # 生成敌人活动块
  76.     @actor_sprites = []
  77.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  78.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  79.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  80.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  81.     # 生成天候
  82.     @weather = RPG::Weather.new(@viewport1)
  83.     # 生成图片活动块
  84.     @picture_sprites = []
  85.     for i in 51..100
  86.       @picture_sprites.push(Sprite_Picture.new(@viewport3,
  87.         $game_screen.pictures[i]))
  88.     end
  89.     # 生成计时器块
  90.     @timer_sprite = Sprite_Timer.new
  91.     # 刷新画面
  92.     update
  93.   end
  94.   #..........................................................................
  95.   #--------------------------------------------------------------------------
  96.   # ● 胜利图
  97.   #--------------------------------------------------------------------------
  98.   def win
  99.     for sprite in @actor_sprites
  100.       sprite.win
  101.     end
  102.   end
  103.   #..........................................................................
  104.   #--------------------------------------------------------------------------
  105.   # ● 刷新画面
  106.   #--------------------------------------------------------------------------
  107.   def update
  108.     # 刷新角色的活动块 (对应角色的替换)
  109.     @actor_sprites[0].battler = $game_party.actors[0]
  110.     @actor_sprites[1].battler = $game_party.actors[1]
  111.     @actor_sprites[2].battler = $game_party.actors[2]
  112.     @actor_sprites[3].battler = $game_party.actors[3]
  113.     # 战斗背景的文件名与现在情况有差异的情况下
  114.     if @battleback_name != $game_temp.battleback_name
  115.       @battleback_name = $game_temp.battleback_name
  116.       if @battleback_sprite.bitmap != nil
  117.         @battleback_sprite.bitmap.dispose
  118.       end
  119.       @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  120.       @battleback_sprite.src_rect.set(0, 0, 640, 480)
  121.     end
  122.     # 刷新战斗者的活动块
  123.     for sprite in @enemy_sprites + @actor_sprites
  124.       sprite.update
  125.     end
  126.     # 刷新天气图形
  127.     @weather.type = $game_screen.weather_type
  128.     @weather.max = $game_screen.weather_max
  129.     @weather.update
  130.     # 刷新图片活动块
  131.     for sprite in @picture_sprites
  132.       sprite.update
  133.     end
  134.     # 刷新计时器活动块
  135.     @timer_sprite.update
  136.     # 设置画面的色调与震动位置
  137.     @viewport1.tone = $game_screen.tone
  138.     @viewport1.ox = $game_screen.shake
  139.     # 设置画面的闪烁色
  140.     @viewport4.color = $game_screen.flash_color
  141.     # 刷新显示端口
  142.     @viewport1.update
  143.     @viewport2.update
  144.     @viewport4.update
  145.   end
  146. end
  147. class Arrow_Enemy < Arrow_Base
  148.   #--------------------------------------------------------------------------
  149.   # ● 获取光标指向的敌人
  150.   #--------------------------------------------------------------------------
  151.   def enemy
  152.     return $game_troop.enemies[@index]
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 刷新画面
  156.   #--------------------------------------------------------------------------
  157.   def update
  158.     super
  159.     # 如果指向不存在的敌人就离开
  160.     $game_troop.enemies.size.times do
  161.       break if self.enemy.exist?
  162.       @index += 1
  163.       @index %= $game_troop.enemies.size
  164.     end
  165.     # 光标右
  166.     if Input.repeat?(Input::RIGHT)
  167.       $game_system.se_play($data_system.cursor_se)
  168.       $game_troop.enemies.size.times do
  169.         @index += 1
  170.         @index %= $game_troop.enemies.size
  171.         break if self.enemy.exist?
  172.       end
  173.     end
  174.     # 光标左
  175.     if Input.repeat?(Input::LEFT)
  176.       $game_system.se_play($data_system.cursor_se)
  177.       $game_troop.enemies.size.times do
  178.         @index += $game_troop.enemies.size - 1
  179.         @index %= $game_troop.enemies.size
  180.         break if self.enemy.exist?
  181.       end
  182.     end
  183.     # 设置活动块坐标
  184.     if self.enemy != nil
  185.       self.x = self.enemy.screen_x + self.ox
  186.       self.y = self.enemy.screen_y + self.oy
  187.     end
  188.   end
  189. end
  190. class Arrow_Actor < Arrow_Base
  191.   #--------------------------------------------------------------------------
  192.   # ● 获取光标指向的角色
  193.   #--------------------------------------------------------------------------
  194.   def actor
  195.     return $game_party.actors[@index]
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ● 刷新画面
  199.   #--------------------------------------------------------------------------
  200.   def update
  201.     super
  202.     # 光标右
  203.     if Input.repeat?(Input::RIGHT)
  204.       $game_system.se_play($data_system.cursor_se)
  205.       @index += 1
  206.       @index %= $game_party.actors.size
  207.     end
  208.     # 光标左
  209.     if Input.repeat?(Input::LEFT)
  210.       $game_system.se_play($data_system.cursor_se)
  211.       @index += $game_party.actors.size - 1
  212.       @index %= $game_party.actors.size
  213.     end
  214.     # 设置活动块坐标
  215.     if self.actor != nil
  216.       self.x = self.actor.screen_x + self.ox
  217.       self.y = self.actor.screen_y + self.oy
  218.     end
  219.   end
  220. end
  221. class Scene_Battle
  222.   #--------------------------------------------------------------------------
  223.   # ● 刷新画面 (主回合步骤 3 : 行动方动画)
  224.   #--------------------------------------------------------------------------
  225.   def update_phase4_step3
  226.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  227.     if @animation1_id == 0
  228.       @active_battler.white_flash = true
  229.     else
  230.     # 添加施法动画
  231.       @active_battler.setup_battler_ani(@active_battler.battler_name.split(/★/)[8], 1)
  232.       @active_battler.animation_id = @animation1_id
  233.       @active_battler.animation_hit = true
  234.     end
  235.     # 对像方动画
  236.     for target in @target_battlers
  237.       target.animation_id = @animation2_id
  238.       target.animation_hit = (target.damage != "Miss")
  239.       ###########################################################
  240.       target.setup_battler_dead_ani(0)
  241.       ############################################################
  242.       #.......................................................................
  243.       if target.is_a?(Game_Actor)
  244.         ##############
  245.         if target.guarding?
  246.           $fangyu = 1
  247.         end
  248.         ##############
  249.         if target.current_action.kind == 0 and target.current_action.basic == 1
  250.            target.setup_battler_ani(target.battler_name.split(/★/)[2], 1)
  251.         else
  252.          target.setup_battler_hurt_ani(0)
  253.         end
  254.       end
  255.       if target.is_a?(Game_Enemy)
  256.        if target.current_action.kind == 0 and target.current_action.basic == 1
  257.           target.setup_battler_ani(target.battler_name.split(/★/)[1])
  258.         else
  259.           target.setup_battler_hurt_ani(0)
  260.         end
  261.       end
  262.       #.......................................................................
  263.     end
  264.     # 对像方动画
  265.     for target in @target_battlers
  266.       target.animation_id = @animation2_id
  267.       target.animation_hit = (target.damage != "Miss")
  268.       #......................................................................
  269.     end
  270.     # 限制动画长度、最低 8 帧
  271.     @wait_count = 8
  272.     # 移至步骤 5
  273.     @phase4_step = 5
  274.   end
  275.   #--------------------------------------------------------------------------
  276.   # ● 刷新画面 (主回合步骤 4 : 对像方动画) ★
  277.   #--------------------------------------------------------------------------
  278.   def update_phase4_step4
  279.     # 移至步骤 5
  280.     @phase4_step = 5
  281.   end
  282. end
  283. class Game_Actor < Game_Battler
  284.   
  285. #小改动
  286. #############################################################################
  287. #                                横版修改                                   #
  288. #############################################################################
  289.   
  290.   #--------------------------------------------------------------------------
  291.   # ● 取得战斗画面的 X 坐标
  292.   #--------------------------------------------------------------------------
  293.   SCREEN_X = 50
  294.   
  295.   def screen_x
  296.     case self.index
  297.     when 0
  298.       return 515 + SCREEN_X
  299.     when 1
  300.       return 440 + SCREEN_X
  301.     when 2
  302.       return 590 + SCREEN_X
  303.     when 3
  304.       return 390 + SCREEN_X
  305.     else
  306.       return 640 + SCREEN_X
  307.     end
  308.   end
  309.   #--------------------------------------------------------------------------
  310.   # ● 取得战斗画面的 Y 坐标
  311.   #--------------------------------------------------------------------------
  312.   SCREEN_Y = 60
  313.   
  314.   def screen_y
  315.     case self.index
  316.     when 0
  317.       return 310 + SCREEN_Y
  318.     when 1
  319.       return 295 + SCREEN_Y
  320.     when 2
  321.       return 325 + SCREEN_Y
  322.     when 3
  323.       return 340 + SCREEN_Y
  324.     else
  325.       return 1000 + SCREEN_Y
  326.     end
  327.   end
  328.   #--------------------------------------------------------------------------
  329.   # ● 取得战斗画面的 Z 坐标
  330.   #--------------------------------------------------------------------------
  331.   def screen_z
  332.     case self.index
  333.     when 0
  334.       return 1
  335.     when 1
  336.       return 0
  337.     when 2
  338.       return 2
  339.     when 3
  340.       return 3
  341.     else
  342.       return 0
  343.     end
  344.   end
  345.   
  346.   
  347. #############################################################################
  348.   
  349.   
  350.   
  351.   #--------------------------------------------------------------------------
  352.   # ● 取得战斗画面的 X 坐标
  353.   #--------------------------------------------------------------------------
  354. #  def screen_x
  355.     # 返回计算后的队伍 X 坐标的排列顺序
  356. #    if self.index != nil
  357.       #......................................................................
  358. #      return self.index * 90 + 500
  359.       #......................................................................
  360. #    else
  361. #      return 0
  362. #    end
  363. #  end
  364.   #--------------------------------------------------------------------------
  365.   # ● 取得战斗画面的 Y 坐标
  366.   #--------------------------------------------------------------------------
  367. #  def screen_y
  368.     #........................................................................
  369. #    return 464 - self.index * 110
  370.     #........................................................................
  371. #  end
  372.   #--------------------------------------------------------------------------
  373.   # ● 取得战斗画面的 Z 坐标
  374.   #--------------------------------------------------------------------------
  375. #  def screen_z
  376.     # 返回计算后的队伍 Z 坐标的排列顺序
  377. #    if self.index != nil
  378. #      return 4 - self.index
  379. #    else
  380. #      return 0
  381. #    end
  382. #  end
  383. end

  384. class Scene_Battle
  385.   #..........................................................................
  386.   #--------------------------------------------------------------------------
  387.   # ● 返回phase
  388.   #--------------------------------------------------------------------------
  389.   def phase
  390.     return @phase
  391.   end
  392.   #--------------------------------------------------------------------------
  393.   # ● 返回phase4_step
  394.   #--------------------------------------------------------------------------
  395.   def phase4_step
  396.     return @phase4_step
  397.   end
  398.   #--------------------------------------------------------------------------
  399.   # ● 返回phase4_step
  400.   #--------------------------------------------------------------------------
  401.   def actor_command_active?
  402.     return @actor_command_window.active
  403.   end
  404.   #..........................................................................
  405. end
  406. class Game_Battler
  407.   #..........................................................................
  408.   #--------------------------------------------------------------------------
  409.   # ● 获取循环的动画 ID
  410.   #--------------------------------------------------------------------------  
  411.   def show_damage(value)
  412.     @show_damage_value = value
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● 获取循环的动画 ID
  416.   #--------------------------------------------------------------------------
  417.   def show_damage_value
  418.     return @show_damage_value
  419.   end
  420.   #--------------------------------------------------------------------------
  421.   # ● 获取循环的动画 ID
  422.   #--------------------------------------------------------------------------
  423.   def battler_ani
  424.     return @battler_ani
  425.   end
  426.   #--------------------------------------------------------------------------
  427.   # ● 获取循环的动画 ID
  428.   #--------------------------------------------------------------------------
  429.   def setup_battler_ani(battler_ani, once = 0)
  430.     @battler_ani = battler_ani
  431.     @once = once
  432.   end
  433.   #--------------------------------------------------------------------------
  434.   # ● 获取循环的动画 ID
  435.   #--------------------------------------------------------------------------
  436.   def setup_battler_hurt_ani(hurt)
  437.     @hurt = hurt
  438.   end  
  439.   #--------------------------------------------------------------------------
  440.   # ● 获取循环的动画 ID
  441.   #--------------------------------------------------------------------------
  442.   def setup_battler_dead_ani(over)
  443.     @over = over
  444.   end
  445.   #--------------------------------------------------------------------------
  446.   # ● 获取循环的动画 ID
  447.   #--------------------------------------------------------------------------
  448.   def battler_dead_ani
  449.     return @over
  450.   end
  451.   #--------------------------------------------------------------------------
  452.   # ● 获取循环的动画 ID
  453.   #--------------------------------------------------------------------------
  454.   def battler_ani_once
  455.     return @once
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   # ● 获取循环的动画 ID
  459.   #--------------------------------------------------------------------------
  460.   def battler_hurt_ani
  461.     return @hurt
  462.   end
  463.   #..........................................................................
  464. end
  465. class Sprite_Battler < RPG::Sprite
  466.   #..........................................................................
  467.   #--------------------------------------------------------------------------
  468.   # ● 胜利图
  469.   #--------------------------------------------------------------------------
  470.   def win
  471.     if @battler_name != nil and not @battler.hidden and not @battler.dead?
  472.       @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1)
  473.     end
  474.   end
  475.   #..........................................................................
  476.   #--------------------------------------------------------------------------
  477.   # ● 释放
  478.   #--------------------------------------------------------------------------
  479.   def dispose
  480.     if self.bitmap != nil
  481.       self.bitmap.dispose
  482.     end
  483.     super
  484.   end
  485.   #--------------------------------------------------------------------------
  486.   # ● 刷新画面
  487.   #--------------------------------------------------------------------------
  488.   def update
  489.     super
  490.     # 战斗者为 nil 的情况下
  491.     if @battler == nil
  492.       self.bitmap = nil
  493.       loop_animation(nil)
  494.       return
  495.     end
  496.     # 文件名和色相与当前情况有差异的情况下
  497.     if @battler.battler_name != @battler_name or
  498.        @battler.battler_hue != @battler_hue
  499.       @battler_hue = @battler.battler_hue
  500.       # 获取、设置位图
  501.       @battler_name = @battler.battler_name
  502.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  503.       #.......................................................................
  504.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  505.       #.......................................................................
  506.       @width = bitmap.width
  507.       @height = bitmap.height
  508.       self.ox = @width / 2
  509.       self.oy = @height
  510.       # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  511.       if @battler.is_a?(Game_Enemy)
  512.         if @battler.dead? or @battler.hidden
  513.           self.opacity = 0
  514.         end
  515.       end
  516.     end
  517.     # 动画 ID 与当前的情况有差异的情况下
  518.     #.........................................................................
  519.     if @battler.battler_ani != @battler_ani
  520.       @battler_ani = @battler.battler_ani
  521.       loop_animation($data_animations[@battler_ani.to_i])
  522.     end
  523.     #.........................................................................
  524.     # 应该被显示的角色的情况下
  525.     if @battler.is_a?(Game_Actor) and @battler_visible
  526.       # 不是主状态的时候稍稍降低点透明度
  527.       if $game_temp.battle_main_phase
  528.         self.opacity += 3 if self.opacity < 255
  529.       else
  530.         self.opacity -= 3 if self.opacity > 207
  531.       end
  532.     end
  533.     # 明灭
  534.     if @battler.blink
  535.       blink_on
  536.     else
  537.       blink_off
  538.     end
  539.     # 不可见的情况下
  540.     unless @battler_visible
  541.       # 出现 ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  542.       if not @battler.hidden and not @battler.dead? and
  543.          (@battler.damage == nil or @battler.damage_pop)
  544.         if @battler.is_a?(Game_Enemy)
  545.           appear
  546.         else
  547.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  548.         end
  549.         @battler_visible = true
  550.       end
  551.     end
  552.     # 可见的情况下
  553.     if @battler_visible
  554.       # 逃跑
  555.       if @battler.hidden
  556.         $game_system.se_play($data_system.escape_se)
  557.         escape
  558.         @battler_visible = false
  559.       end
  560.       # 白色闪烁
  561.       if @battler.white_flash
  562.         whiten
  563.         @battler.white_flash = false
  564.       end
  565.       # 动画
  566.       if @battler.animation_id != 0
  567.         animation = $data_animations[@battler.animation_id]
  568.         animation(animation, @battler.animation_hit)
  569.         @battler.animation_id = 0
  570.       end
  571.       # 伤害
  572.       if @battler.damage_pop
  573.         damage(@battler.damage, @battler.critical)
  574.         @battler.damage = nil
  575.         @battler.critical = false
  576.         @battler.damage_pop = false
  577.       end
  578.       # korapusu
  579.       if @battler.damage == nil and @battler.dead?
  580.         #....................................................................
  581.         if @battler.is_a?(Game_Enemy)
  582.           $game_system.se_play($data_system.enemy_collapse_se)
  583.           #collapse
  584.         else
  585.           $game_system.se_play($data_system.actor_collapse_se)
  586.         end
  587.         #....................................................................
  588.         @battler_visible = false
  589.       end
  590.     end
  591.     # 设置活动块的坐标
  592.     self.x = @battler.screen_x
  593.     self.y = @battler.screen_y
  594.     self.z = @battler.screen_z
  595.   end
  596. end
  597. module RPG
  598.   class Sprite < ::Sprite
  599.     def damage(value, critical)
  600.       dispose_damage
  601.       if value.is_a?(Numeric)
  602.         damage_string = value.abs.to_s
  603.       else
  604.         damage_string = value.to_s
  605.       end
  606.       bitmap = Bitmap.new(160, 48)
  607.       bitmap.font.name = "Arial Black"
  608.       bitmap.font.size = 32
  609.       bitmap.font.color.set(0, 0, 0)
  610.       bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  611.       bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  612.       bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  613.       bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  614.       if value.is_a?(Numeric) and value < 0
  615.         bitmap.font.color.set(176, 255, 144)
  616.       else
  617.         bitmap.font.color.set(255, 255, 255)
  618.       end
  619.       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  620.       if critical
  621.         bitmap.font.size = 20
  622.         bitmap.font.color.set(0, 0, 0)
  623.         bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
  624.         bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
  625.         bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
  626.         bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
  627.         bitmap.font.color.set(255, 255, 255)
  628.         bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
  629.       end
  630.       @_damage_sprite = ::Sprite.new(self.viewport)
  631.       @_damage_sprite.bitmap = bitmap
  632.       @_damage_sprite.ox = 80
  633.       @_damage_sprite.oy = 20
  634.       @_damage_sprite.x = self.x
  635.       @_damage_sprite.x -= self.bitmap.width/2 if @battler.is_a?(Game_Actor)
  636.       @_damage_sprite.y = self.y - self.oy / 2
  637.       @_damage_sprite.z = 3000
  638.       @_damage_duration = 40
  639.     end
  640.   end
  641. end
  642. module RPG
  643. #--------------------------------------------------------------------------
  644. # ● 常量设定
  645. #--------------------------------------------------------------------------
  646. # 是否显示总伤害
  647. SHOW_TOTAL_DAMAGE = false
  648. # 角色受攻击时是否跳一下
  649. BATTLER_JUMP = true
  650. # 伤害美化字符串文件夹名(放在Pictures文件夹中的子文件夹)
  651. STRING_DOCUMENTS = "String/"
  652. # 是否使用伤害美化效果
  653. USE_DAMAGE = true
  654. # 会心一击音效
  655. CRITICAL_SE="Audio/SE/1267.wav"

  656. class Sprite < ::Sprite
  657.    #==========================================
  658.    # 修改说明:
  659.    # @flash_shake用来制作挨打时候跳跃
  660.    # @_damage    用来记录每次打击之后弹出数字
  661.    # @_total_damage 记录总伤害
  662.    # @_total_damage_duration 总伤害持续帧
  663.    #==========================================
  664.    #alias 66RPG_rainbow_initialize : initialize
  665.    def initialize(viewport = nil)
  666.      #66RPG_rainbow_initialize(viewport)
  667.      super(viewport)
  668.      @_whiten_duration = 0
  669.      @_appear_duration = 0
  670.      @_escape_duration = 0
  671.      @_collapse_duration = 0
  672.      @_damage_duration = 0
  673.      @_animation_duration = 0
  674.      @_blink = false
  675.      # 挨打时候跳跃
  676.      @flash_shake = 0
  677.      # 伤害记录数组
  678.      @_damage = []
  679.      # 总伤害数字
  680.      @_total_damage = 0
  681.      # 总伤害持续帧
  682.      @_total_damage_duration = 0
  683.      #.........................................................................
  684.      #记录已经发生的伤害的变量
  685.      @p_dam=0
  686.      @d_dam=0
  687.      @hits=0
  688.      ############ #小改动
  689.      #记录前一次攻击次数
  690.      @temp_hits=0
  691.      #判断是否为最后一次攻击
  692.      @last_hits=0
  693.      ############
  694.      #.........................................................................
  695.    end
  696.    #--------------------------------------------------------------------------
  697.    #美化的伤害处理
  698.    #--------------------------------------------------------------------------
  699.     def damage(value, critical)
  700.       
  701. if USE_DAMAGE == true then
  702.   
  703.       # 释放伤害,效果是伤害数字快速消失,觉得不如不消失好看......
  704.       #dispose_damage
  705.       #清除hit数
  706.       dispose_hit
  707.       # 如果伤害值是数值
  708.       if value.is_a?(Numeric)
  709.         # 绝对值转为字符串
  710.         damage_string = value.abs.to_s
  711.       else
  712.         # 转为字符串
  713.         damage_string = value.to_s
  714.       end
  715.       # 初始化位图
  716.       bitmap = Bitmap.new(162, 64)
  717.       bitmap.font.name = ["华文行楷","黑体", "宋体"]
  718.       bitmap.font.size = 32
  719.       # 伤害值是数值的情况下
  720.       if value.is_a?(Numeric)
  721.         # 分割伤害值字符串
  722.         damage_array = damage_string.scan(/./)
  723.         damage_x = 81 - damage_string.size * 9
  724.         # 伤害值为负的情况下
  725.         if value < 0
  726.           # 调用回复数字表
  727.           rect_y = 32
  728.         else
  729.           # 调用伤害数字表
  730.           rect_y = 0
  731.         end
  732.         # 循环伤害值字符串
  733.         for char in damage_array
  734.           number = char.to_i
  735.           # 显示伤害数字
  736.           bitmap.blt(damage_x, 32, RPG::Cache.picture(STRING_DOCUMENTS + "Damage"),#"Damagenew"),
  737.           Rect.new(number * 18, rect_y, 18, 32))
  738.           # 后移一位
  739.           damage_x += 18
  740.         end
  741.       # 伤害值不是数值的情况
  742.       else
  743.         # 如果伤害值不是 Miss
  744.         unless value == "Miss"
  745.           # 系统默认描画字符串
  746.           bitmap.font.color.set(0, 0, 0)
  747.           bitmap.draw_text(-1, 27, 162, 36, damage_string, 1)
  748.           bitmap.draw_text(+1, 27, 162, 36, damage_string, 1)
  749.           bitmap.draw_text(-1, 29, 162, 36, damage_string, 1)
  750.           bitmap.draw_text(+1, 29, 162, 36, damage_string, 1)
  751.           bitmap.font.color.set(255, 255, 255)
  752.           bitmap.draw_text(0, 28, 162, 36, damage_string, 1)
  753.         # Miss 的情况下
  754.         else
  755.           # 显示未击中图画
  756.           bitmap.blt(36, 28, RPG::Cache.picture(STRING_DOCUMENTS + "Damage"), Rect.new(90, 64, 90, 32))
  757.         end
  758.       end
  759.       # 会心一击标志打开的情况
  760.       if critical
  761.         #会心一击伤害效果
  762. ###########################################################
  763.         Audio.se_play(CRITICAL_SE,90,100) if CRITICAL_SE != "" and !$use_skill
  764.         $game_screen.start_flash(Color.new(255,255,255,255),5)
  765. ###########################################################
  766.         # 显示会心一击图画
  767.         bitmap.blt(36, 0, RPG::Cache.picture(STRING_DOCUMENTS + "Damage"), Rect.new(0, 64, 90, 32))
  768.       end
  769.       
  770. else
  771.       
  772.      #.........................................................................
  773.      #清除hit数
  774.      dispose_hit
  775.      #.........................................................................
  776.      if value.is_a?(Numeric)
  777.        damage_string = value.abs.to_s
  778.      else
  779.        damage_string = value.to_s
  780.      end
  781.      bitmap = Bitmap.new(160, 48)
  782.      bitmap.font.name = "Arial Black"
  783.      bitmap.font.size = 32
  784.      bitmap.font.color.set(0, 0, 0)
  785.      bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  786.      bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  787.      bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  788.      bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  789.      #=======================================
  790.      # 修改:颜色
  791.      #=======================================
  792.      if value.is_a?(Numeric) and value < 0
  793.        bitmap.font.color.set(176, 255, 144)
  794.      else
  795.        bitmap.font.color.set(255, 55, 55)
  796.      end
  797.      bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  798.      if critical
  799.        #会心一击伤害效果
  800. ###########################################################
  801.        Audio.se_play(CRITICAL_SE,50,100) if CRITICAL_SE != "" and !$use_skill
  802.        $game_screen.start_flash(Color.new(255,255,255,255),5)
  803. ###########################################################
  804.        bitmap.font.size = 20
  805.        bitmap.font.color.set(0, 0, 0)
  806.        bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
  807.        bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
  808.        bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
  809.        bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
  810.        bitmap.font.color.set(255, 255, 255)
  811.        bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
  812.      end
  813.      
  814. end
  815.    
  816.      # 伤害值定位     
  817.      @_damage_sprite = ::Sprite.new#(self.viewport)
  818.      @_damage_sprite.bitmap = bitmap
  819.      @_damage_sprite.ox = 80
  820.      @_damage_sprite.oy = 20
  821.      @_damage_sprite.x = self.x
  822.      @_damage_sprite.y = self.y - self.oy / 2
  823.      @_damage_sprite.z = 30000
  824.      @_damage_duration = 40
  825.      #=======================================
  826.      # 修改:推入新的伤害
  827.      #=======================================
  828.      @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  829.      # 总伤害处理
  830.      make_total_damage(value)
  831.      
  832.      
  833.      
  834.     end
  835.    #--------------------------------------------------------------------------
  836.    # ● 返回 @hits
  837.    #--------------------------------------------------------------------------
  838.    def get_hit
  839.      return @hits
  840.    end
  841.    #--------------------------------------------------------------------------
  842.    # ● hit数的美化描绘
  843.    #--------------------------------------------------------------------------
  844.    #..........................................................................
  845.    def hit
  846.      # 如果伤害值是数值
  847.      # 转为字符串
  848.      value=@hits
  849.      hits_string = value.to_s
  850.      # 初始化位图
  851.      bitmap = Bitmap.new(320, 64)
  852.      bitmap.font.name = "Arial Black"
  853.      bitmap.font.size = 32
  854.      # 分割伤害值字符串
  855.      hits_array = hits_string.scan(/./)
  856.      hits_x = - 36.2#hits_string.size * 18.1 # 81 - hits_string.size * 18.1
  857.      rect_y = 0
  858.      # 循环伤害值字符串
  859.      for char in hits_array
  860.        # 后移一位
  861.        hits_x += 36.2
  862.        number = char.to_i
  863.        # 显示伤害数字
  864.        bitmap.blt(hits_x, 0, RPG::Cache.picture(STRING_DOCUMENTS + "Number"),
  865.        Rect.new(number * 36.2, rect_y, 36.2, 50))
  866.      end
  867.      hits_x += 18.1
  868.      bitmap.blt(hits_x, 0, RPG::Cache.picture(STRING_DOCUMENTS + "HITS"),
  869.                 Rect.new(0, -21, 90, 50))
  870.      # 伤害值定位
  871.      @_hits_sprite = ::Sprite.new(self.viewport)
  872.      @_hits_sprite.bitmap = bitmap
  873.      @_hits_sprite.x = 560 - hits_string.size * 36.2
  874.      @_hits_sprite.y = 70
  875.      @_hits_sprite.z = 30000
  876.      @_hits_duration = 40
  877.    end
  878.    #..........................................................................
  879.    #--------------------------------------------------------------------------
  880.    # ● 美化的总伤害处理
  881.    #--------------------------------------------------------------------------
  882.    def make_total_damage(value)
  883.      
  884. if USE_DAMAGE == true then     
  885.      
  886.      if value.is_a?(Numeric)# and SHOW_TOTAL_DAMAGE
  887.        @_total_damage += value
  888.         # 绝对值转为字符串
  889.         damage_string = @_total_damage.abs.to_s
  890.       else
  891.         return
  892.       end
  893. #####################################################小改动
  894.      if SHOW_TOTAL_DAMAGE
  895. #####################################################
  896.       # 初始化位图
  897.       bitmap = Bitmap.new(300, 150)
  898.       bitmap.font.name = "Arial Black"
  899.       bitmap.font.size = 32
  900.       # 伤害值是数值的情况下
  901.       if value.is_a?(Numeric)
  902.         # 分割伤害值字符串
  903.         damage_array = damage_string.scan(/./)
  904.         damage_x = 40 - damage_string.size * 9
  905.         # 伤害值为负的情况下
  906.         if value < 0
  907.           # 调用回复数字表
  908.           name= STRING_DOCUMENTS + "Number3"
  909.         else
  910.           # 调用伤害数字表
  911.           name= STRING_DOCUMENTS + "Number2"
  912.         end
  913.         # 循环伤害值字符串
  914.         for char in damage_array
  915.           number = char.to_i
  916.           # 显示伤害数字
  917.           bitmap.blt(damage_x, 0, RPG::Cache.picture(name),
  918.           Rect.new(number * 36.2, 0, 36.2, 50))
  919.           # 后移一位
  920.           damage_x += 36.2
  921.         end
  922. #####################################################小改动
  923.      end
  924. #####################################################
  925.       end
  926.       
  927. else
  928.             
  929.    #--------------------------------------------------------------------------
  930.    # ● 总伤害处理
  931.    #--------------------------------------------------------------------------
  932.      if value.is_a?(Numeric)# and SHOW_TOTAL_DAMAGE
  933.        @_total_damage += value
  934.      else
  935.        return
  936.      end
  937. #####################################################小改动
  938.      if SHOW_TOTAL_DAMAGE
  939. #####################################################
  940.      bitmap = Bitmap.new(300, 150)
  941.      bitmap.font.name = "Arial Black"
  942.      bitmap.font.size = 48
  943.      bitmap.font.color.set(0, 0, 0)
  944.      bitmap.draw_text(+2, 12+2, 160, 36, @_total_damage.abs.to_s, 1)
  945.      if @_total_damage < 0
  946.        bitmap.font.color.set(80, 255, 00)
  947.      else
  948.        bitmap.font.color.set(255, 140, 0)
  949.      end
  950.      bitmap.draw_text(0, 12, 160, 36, @_total_damage.abs.to_s, 1)
  951. #####################################################小改动
  952.      end
  953. #####################################################
  954. end

  955.      if @_total_damage_sprite.nil?
  956.        @_total_damage_sprite = ::Sprite.new#(self.viewport)
  957.        @_total_damage_sprite.ox = 80
  958.        @_total_damage_sprite.oy = 20
  959.        @_total_damage_sprite.z = 30000
  960.      end
  961.      @_total_damage_sprite.bitmap = bitmap
  962.      @_total_damage_sprite.zoom_x = 1.5
  963.      @_total_damage_sprite.zoom_y = 1.5
  964.      @_total_damage_sprite.x = self.x
  965.      @_total_damage_sprite.y = self.y  - self.oy / 2 - 64
  966.      @_total_damage_sprite.z = 30001
  967.      #.........................................................................
  968.      @_total_damage_duration = 40
  969.      #.........................................................................
  970.      #.........................................................................
  971.      #hit数描绘
  972.      @hits+=1
  973.      hit
  974.      #.........................................................................
  975.    end
  976.    def animation(animation, hit, battler_damage="", battler_critical=false)
  977.      dispose_animation      
  978.      #=======================================
  979.      # 修改:记录伤害和critical
  980.      #=======================================
  981.      @battler_damage = battler_damage
  982.      @battler_critical = battler_critical
  983.      @_animation = animation
  984.      return if @_animation == nil
  985.      @_animation_hit = hit
  986.      @_animation_duration = @_animation.frame_max
  987.      animation_name = @_animation.animation_name
  988.      animation_hue = @_animation.animation_hue
  989.      bitmap = RPG::Cache.animation(animation_name, animation_hue)
  990.      #=======================================
  991.      # 修改:计算总闪光权限值
  992.      #=======================================
  993.      for timing in @_animation.timings
  994.        quanzhong = animation_process_timing(timing, @_animation_hit,true)
  995.        @all_quanzhong += quanzhong
  996.        # 记录最后一次闪光
  997.        @_last_frame = timing.frame if quanzhong != 0
  998.      end
  999.      #.........................................................................
  1000.      @last_frame = @_last_frame
  1001.      #.........................................................................
  1002.      if @@_reference_count.include?(bitmap)
  1003.        @@_reference_count[bitmap] += 1
  1004.      else
  1005.        @@_reference_count[bitmap] = 1
  1006.      end
  1007.      #=======================================
  1008.      # 修改:行动方动画不显示伤害
  1009.      #=======================================
  1010.      if $scene.is_a?(Scene_Battle)
  1011.        if $scene.animation1_id == @battler.animation_id
  1012.          @battler_damage = ""
  1013.        end
  1014.      end
  1015.      @_animation_sprites = []
  1016.      if @_animation.position != 3 or not @@_animations.include?(animation)
  1017.        for i in 0..15
  1018.          sprite = ::Sprite.new(self.viewport)
  1019.          sprite.bitmap = bitmap
  1020.          sprite.visible = false
  1021.          @_animation_sprites.push(sprite)
  1022.        end
  1023.        unless @@_animations.include?(animation)
  1024.          @@_animations.push(animation)
  1025.        end
  1026.      end
  1027.      update_animation
  1028.    end
  1029.    #=======================================
  1030.    # 修改:更换清除伤害的算法,以防万一
  1031.    #       本内容在脚本中没有使用过
  1032.    #=======================================
  1033.    def dispose_damage
  1034.      for damage in @_damage.reverse
  1035.        damage[0].bitmap.dispose
  1036.        damage[0].dispose
  1037.        @_damage.delete(damage)
  1038.      end
  1039.      @_total_damage = 0
  1040.      @_last_frame = -1
  1041.      if @_total_damage_sprite != nil
  1042.        @_total_damage_duration = 0
  1043.        @_total_damage_sprite.bitmap.dispose
  1044.        @_total_damage_sprite.dispose
  1045.        @_total_damage_sprite = nil
  1046.      end
  1047.    end
  1048.    #=======================================
  1049.    # 清除hit数
  1050.    #=======================================
  1051.    #...........................................................................
  1052.    def dispose_hit
  1053.      if @_hits_sprite != nil
  1054.        @_hits_sprite.bitmap.dispose
  1055.        @_hits_sprite.dispose
  1056.        @_hits_sprite = nil
  1057.      end
  1058.    end
  1059.    #...........................................................................
  1060.    def dispose_animation
  1061.      #=======================================
  1062.      # 修改:清除记录的伤害,清除权重记录
  1063.      #=======================================
  1064.      @battler_damage = nil
  1065.      @battler_critical = nil
  1066.      @all_quanzhong = 1
  1067.      @_total_damage = 0
  1068.      @_last_frame = -1
  1069.      #.........................................................................
  1070.      @hits = 0
  1071.      #.........................................................................
  1072.      if @_animation_sprites != nil
  1073.        sprite = @_animation_sprites[0]
  1074.        if sprite != nil
  1075.          @@_reference_count[sprite.bitmap] -= 1
  1076.          if @@_reference_count[sprite.bitmap] == 0
  1077.            sprite.bitmap.dispose
  1078.          end
  1079.        end
  1080.        for sprite in @_animation_sprites
  1081.          sprite.dispose
  1082.        end
  1083.        @_animation_sprites = nil
  1084.        @_animation = nil
  1085.      end
  1086.    end
  1087.    def update
  1088.      super
  1089.      if @_whiten_duration > 0
  1090.        @_whiten_duration -= 1
  1091.        self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  1092.      end
  1093.      if @_appear_duration > 0
  1094.        @_appear_duration -= 1
  1095.        self.opacity = (16 - @_appear_duration) * 16
  1096.      end
  1097.      if @_escape_duration > 0
  1098.        @_escape_duration -= 1
  1099.        self.opacity = 256 - (32 - @_escape_duration) * 10
  1100.      end
  1101.      if @_collapse_duration > 0
  1102.        @_collapse_duration -= 1
  1103.        self.opacity = 256 - (48 - @_collapse_duration) * 6
  1104.      end
  1105.      #=======================================
  1106.      # 修改:更新算法,更新弹出
  1107.      #=======================================
  1108.      if @_damage_duration > 0
  1109.        @_damage_duration -= 1
  1110.        for damage in @_damage
  1111.          damage[0].x = self.x + self.viewport.rect.x -
  1112.                        self.ox + self.src_rect.width / 2 +
  1113.                        (40 - damage[1]) * damage[3] / 10
  1114.          damage[0].y -= damage[4]+damage[1]/10
  1115.          damage[0].opacity = damage[1]*20
  1116.          damage[1] -= 1
  1117.          if damage[1]==0
  1118.            damage[0].bitmap.dispose
  1119.            damage[0].dispose
  1120.            @_damage.delete(damage)
  1121.            next
  1122.          end
  1123.        end
  1124.      end
  1125.      #=======================================
  1126.      # 添加:弹出总伤害
  1127.      #=======================================
  1128.      if @_total_damage_duration > 0
  1129.        @_total_damage_duration -= 1
  1130.        @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
  1131.        if @_total_damage_sprite.zoom_x > 1.0
  1132.          @_total_damage_sprite.zoom_x -= 0.05
  1133.        end
  1134.        if @_total_damage_sprite.zoom_y > 1.0
  1135.          @_total_damage_sprite.zoom_y -= 0.05
  1136.        end
  1137.        @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
  1138.        #......................................................................
  1139.        if @_total_damage_duration <= 7 and @_total_damage_duration > 0
  1140.          @_hits_sprite.opacity -= 32
  1141.          @_hits_sprite.x += 1
  1142.        end
  1143.        #......................................................................
  1144.        if @_total_damage_duration <= 0
  1145.          #.....................................................................
  1146.          dispose_hit
  1147. ##########################
  1148.          @_total_damage = 0
  1149. ##########################
  1150.          #.....................................................................
  1151.          @_total_damage = 0
  1152.          @_total_damage_duration = 0
  1153. #####################################################小改动
  1154.          if SHOW_TOTAL_DAMAGE
  1155.          @_total_damage_sprite.bitmap.dispose
  1156.          end
  1157. #####################################################
  1158.          @_total_damage_sprite.dispose
  1159.          @_total_damage_sprite = nil
  1160.        end
  1161.      end
  1162.      #=======================================
  1163.      if @_animation != nil and (Graphics.frame_count % 2 == 0)
  1164.        @_animation_duration -= 1
  1165.        update_animation
  1166.      end
  1167.      if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  1168.        update_loop_animation
  1169.        @_loop_animation_index += 1
  1170.        #......................................................................
  1171.        @loop_animation_once = 0
  1172.        @loop_animation_once = 1 if @once == 1 and @_loop_animation_index == @_loop_animation.frame_max
  1173.        #......................................................................
  1174.        @_loop_animation_index %= @_loop_animation.frame_max
  1175.      end
  1176.      if @_blink
  1177.        @_blink_count = (@_blink_count + 1) % 32
  1178.        if @_blink_count < 16
  1179.          alpha = (16 - @_blink_count) * 6
  1180.        else
  1181.          alpha = (@_blink_count - 16) * 6
  1182.        end
  1183.        self.color.set(255, 255, 255, alpha)
  1184.      end
  1185.      @@_animations.clear
  1186.    end
  1187.    #..........................................................................
  1188.    def loop_animation_once
  1189.      return @_loop_animation_once
  1190.    end
  1191.    #..........................................................................
  1192.    def update_animation
  1193.      if @_animation_duration > 0
  1194.        frame_index = @_animation.frame_max - @_animation_duration
  1195.        @frame_index = frame_index
  1196.        cell_data = @_animation.frames[frame_index].cell_data
  1197.        position = @_animation.position
  1198.        animation_set_sprites(@_animation_sprites, cell_data, position)
  1199.        #=======================================
  1200.        # 修改:弹出伤害,权重计算
  1201.        #=======================================
  1202.        for timing in @_animation.timings
  1203.          if timing.frame == frame_index
  1204.            t = 1.0 * animation_process_timing(timing, @_animation_hit)            
  1205.            #p t,"当前权重", @all_quanzhong,"总权重"
  1206.            if @battler_damage.is_a?(Numeric) and t != 0
  1207.              t *= @battler_damage
  1208.              t /= @all_quanzhong
  1209.              t = t.to_i
  1210.              #在闪光不是最后一次的情况下,把这次伤害加入到已经发生的伤害中★★★★★★★★★★★★★★★★★★★★★★★★★★
  1211.              if frame_index != @_last_frame
  1212.              @p_dam+= t
  1213.              ##########
  1214.              @d_dam = t if $动态扣血
  1215.              ##########
  1216.              end
  1217.              #p @p_dam,"已发生伤害",@battler_damage,"总伤害"(调试用)★★★★★★★★★★★★★★★★★★★★★★★★★★
  1218.              #闪光为最后一次的情况下,改变这次伤害的计算方法(总伤害-已经发生伤害)★★★★★★★★★★★★★★★★★★★★★★★★★★
  1219.              if frame_index == @_last_frame
  1220.                t=@battler_damage-@p_dam
  1221.              end
  1222.              #p t,"当前伤害",@battler_damage,"总伤害"
  1223.              # 最后一次闪光的话,伤害修正
  1224.              if frame_index == @_last_frame
  1225.                @_total_damage = @battler_damage - t
  1226.                #############
  1227.                @d_dam = @battler_damage-@p_dam  if $动态扣血
  1228.                #############
  1229.                @p_dam=0      #已经发生的伤害归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  1230.             end
  1231.              #p t,@battler_damage,@all_quanzhong
  1232.              damage(t,@battler_critical)
  1233.             #连击次数归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  1234.             if frame_index == @_last_frame
  1235.                       ############ #小改动
  1236.                       @last_hits=1
  1237.                       @temp_hits=0
  1238.                       ############
  1239.                       @hits=0
  1240.                       ##################
  1241.                       $use_skill = false
  1242.                       ##################
  1243.             end
  1244.            # 防止重复播放miss
  1245.            elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  1246.              damage(@battler_damage,@battler_critical)
  1247.            end
  1248.          end
  1249.        end
  1250.      else
  1251.        dispose_animation
  1252.      end
  1253.    end
  1254.    #=======================================
  1255.    # 修改:敌人跳跃的功能 + 添加返回数值
  1256.    #=======================================
  1257.    def update_loop_animation
  1258.      frame_index = @_loop_animation_index
  1259.      cell_data = @_loop_animation.frames[frame_index].cell_data
  1260.      position = @_loop_animation.position
  1261.      #·改·
  1262.      if @wait_count.to_i <= 0
  1263.        @wait_count = 0
  1264.        animation_set_sprites(@_loop_animation_sprites, cell_data, position)
  1265.      else
  1266.        @wait_count -= 1
  1267.        for sprite in @_loop_animation_sprites
  1268.          sprite.visible = false
  1269.        end
  1270.      end
  1271.      if @wait_flash.to_i <= 0
  1272.        @wait_flash = 0
  1273.      else
  1274.        @wait_flash -= 1
  1275.        for sprite in @_loop_animation_sprites
  1276.          sprite.blend_type = 1
  1277.        end
  1278.      end
  1279.      #·改·
  1280.      for timing in @_loop_animation.timings
  1281.        if timing.frame == frame_index
  1282.          animation_process_timing(timing, true)
  1283.        end
  1284.      end
  1285.    end
  1286.    #=======================================
  1287.    # 修改:敌人跳跃的功能 + 添加返回数值
  1288.    #=======================================
  1289.    def loop_animation(animation)
  1290.      return if animation == @_loop_animation
  1291.      dispose_loop_animation
  1292.      @_loop_animation = animation
  1293.      return if @_loop_animation == nil
  1294.      @_loop_animation_index = 0
  1295.      animation_name = @_loop_animation.animation_name
  1296.      animation_hue = @_loop_animation.animation_hue
  1297.      bitmap = RPG::Cache.animation(animation_name, animation_hue)
  1298.      if @@_reference_count.include?(bitmap)
  1299.        @@_reference_count[bitmap] += 1
  1300.      else
  1301.        @@_reference_count[bitmap] = 1
  1302.      end
  1303.      @_loop_animation_sprites = []
  1304.      for i in 0..15
  1305.        sprite = ::Sprite.new
  1306.        sprite.bitmap = bitmap
  1307.        sprite.visible = false
  1308.        @_loop_animation_sprites.push(sprite)
  1309.      end
  1310.      update_loop_animation
  1311.    end
  1312.    #=======================================
  1313.    # 修改:敌人跳跃的功能 + 添加返回数值
  1314.    #=======================================
  1315.     def animation_process_timing(timing, hit,dontflash=false)
  1316.       if (timing.condition == 0) or
  1317.          (timing.condition == 1 and hit == true) or
  1318.          (timing.condition == 2 and hit == false)
  1319.         unless dontflash
  1320.           if timing.se.name != ""
  1321.             se = timing.se
  1322.             Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  1323.           end
  1324.         end
  1325.         case timing.flash_scope
  1326.         when 1
  1327.           unless dontflash
  1328.             self.flash(timing.flash_color, timing.flash_duration * 2)
  1329.             #....................................................................
  1330.             @wait_flash = timing.flash_duration
  1331.             #....................................................................
  1332.             if @_total_damage >0
  1333.               @flash_shake_switch = true
  1334.               @flash_shake = 10
  1335.             end
  1336.           end
  1337.           return timing.flash_color.alpha * timing.flash_duration
  1338.         when 2
  1339.           unless dontflash
  1340.             if self.viewport != nil
  1341.               self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  1342.               return timing.flash_color.alpha * timing.flash_duration
  1343.             end
  1344.           end
  1345.         when 3
  1346.           unless dontflash
  1347.             self.flash(nil, timing.flash_duration * 2)
  1348.             #@_loop_animation_count = 1
  1349.             #·改·
  1350.             @wait_count = timing.flash_duration
  1351.             #·改·
  1352.           end
  1353.           return timing.flash_color.alpha * timing.flash_duration
  1354.         end
  1355.       end      
  1356.       return 0
  1357.     end   
  1358. end
  1359. end
  1360. #==============================================================================
  1361. # ■ Sprite_Battler
  1362. #==============================================================================
  1363. class Sprite_Battler < RPG::Sprite
  1364. #--------------------------------------------------------------------------
  1365. # ● 初始化对像
  1366. #    添加跳跃记录
  1367. #--------------------------------------------------------------------------
  1368. def initialize(viewport, battler = nil)
  1369.   super(viewport)
  1370.   @battler = battler
  1371.   @battler_visible = false
  1372.   @flash_shake_switch = true
  1373.   #........................................................................
  1374.   @once = 0
  1375.   @frame_index = -1
  1376.   @last_frame = 0
  1377.   #........................................................................
  1378. end
  1379. #--------------------------------------------------------------------------
  1380. # ● 刷新画面
  1381. #    增添跳跃功能
  1382. #--------------------------------------------------------------------------
  1383. def update
  1384.   super
  1385.   # 战斗者为 nil 的情况下
  1386.   if @battler == nil
  1387.     self.bitmap = nil
  1388.     loop_animation(nil)
  1389.     return
  1390.   end
  1391.   # 文件名和色相与当前情况有差异的情况下
  1392.   if @battler.battler_name != @battler_name or
  1393.      @battler.battler_hue != @battler_hue
  1394.     # 获取、设置位图
  1395.     @battler_name = @battler.battler_name
  1396.     @battler_hue = @battler.battler_hue
  1397.     self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  1398.     #.......................................................................
  1399.     if not @battler.hidden and not @battler.dead?
  1400.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1401.     end
  1402.     #.......................................................................
  1403.     @width = bitmap.width
  1404.     @height = bitmap.height
  1405.     self.ox = @width / 2
  1406.     self.oy = @height
  1407.   end
  1408.   #.......................................................................
  1409.   update_actor_animation
  1410.   update_enemy_animation
  1411.   #.......................................................................
  1412.   # 动画 ID 与当前的情况有差异的情况下
  1413.   #.........................................................................
  1414.   if @battler.is_a?(Game_Enemy)
  1415.     if @once == 1 and @loop_animation_once == 1 and
  1416.        @battler.battler_dead_ani == 1
  1417.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[5])
  1418.     elsif @once == 1 and @loop_animation_once == 1 and $scene.phase != 5
  1419.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1420.     end
  1421.   end
  1422.   if @battler.is_a?(Game_Actor)
  1423.     ####################################################################
  1424.     if @once == 1 and @loop_animation_once == 1 and $scene.phase != 5 and
  1425.        @battler.battler_dead_ani == 1 and @battler.dead?
  1426.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[5])
  1427.     #######################################################################
  1428.     elsif @once == 1 and @loop_animation_once == 1 and $scene.phase != 5
  1429.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1430.       #################################################################
  1431.       $fangyu = 0
  1432.       @battler.setup_battler_dead_ani(0)
  1433.       ########################################################
  1434.     elsif @once == 1 and @loop_animation_once == 1 and $scene.phase == 5 and
  1435.           not @battler.dead?
  1436.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[7])
  1437.       ######################################################
  1438.       $fangyu = 0
  1439.       @battler.setup_battler_dead_ani(0)
  1440.       ######################################################
  1441.     end
  1442.   end
  1443.   if @battler.battler_ani != @battler_ani
  1444.     @battler_ani = @battler.battler_ani
  1445.     @once = @battler.battler_ani_once
  1446.     loop_animation($data_animations[@battler_ani.to_i])
  1447.   end
  1448.   #.........................................................................
  1449.   # 明灭
  1450.   if @battler.blink
  1451.     blink_on
  1452.   else
  1453.     blink_off
  1454.   end
  1455.   # 不可见的情况下
  1456.   unless @battler_visible
  1457.     # 出现
  1458.     if not @battler.hidden and not @battler.dead? and
  1459.        (@battler.damage == nil or @battler.damage_pop)
  1460.       #.......................................................................
  1461.       if @battler.is_a?(Game_Enemy)
  1462.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1463.         #appear
  1464.       else
  1465.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1466.       end
  1467.       #.......................................................................
  1468.       @battler_visible = true
  1469.     end
  1470.   end
  1471.   # 可见的情况下
  1472.   if @battler_visible
  1473.     # 逃跑
  1474.     if @battler.hidden
  1475.       $game_system.se_play($data_system.escape_se)
  1476.       escape
  1477.       @battler_visible = false
  1478.     end
  1479.     # 白色闪烁
  1480.     if @battler.white_flash
  1481.       whiten
  1482.       @battler.white_flash = false
  1483.     end
  1484.     # 动画
  1485.     if @battler.animation_id != 0
  1486.       animation = $data_animations[@battler.animation_id]
  1487.       animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
  1488.       @battler.animation_id = 0
  1489.     end
  1490.     # 伤害
  1491.     if @battler.damage_pop
  1492.       @battler.damage = nil
  1493.       @battler.critical = false
  1494.       @battler.damage_pop = false
  1495.     end
  1496.     # korapusu
  1497.     if @battler.damage == nil and @battler.dead?
  1498.       if @battler.is_a?(Game_Enemy)
  1499.         if @battler.battler_dead_ani != 1
  1500.           #p "Battler Death Error"
  1501.           $game_system.se_play($data_system.enemy_collapse_se)
  1502.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  1503.           @battler.setup_battler_dead_ani(1)
  1504.         end
  1505.         #.....................................................................
  1506.         collapse
  1507.         #.....................................................................
  1508.       else
  1509.         #.....................................................................
  1510.         if @battler.battler_dead_ani != 1
  1511.           #p "Battler Death Error"
  1512.           $game_system.se_play($data_system.enemy_collapse_se)
  1513.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  1514.           @battler.setup_battler_dead_ani(1)
  1515.         end
  1516.         #.....................................................................
  1517.       end
  1518.       @battler_visible = false
  1519.     end
  1520.   end
  1521.   # 设置活动块的坐标
  1522.   if @flash_shake_switch == true
  1523.     self.x = @battler.screen_x
  1524.     self.y = @battler.screen_y
  1525.     self.z = @battler.screen_z
  1526.     @flash_shake_switch = false
  1527.   end
  1528.   if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
  1529.     if @battler.is_a?(Game_Enemy)
  1530.       case @flash_shake
  1531.       when 9..10
  1532.         self.x -=4
  1533.         self.y -=4
  1534.         self.z = @battler.screen_z
  1535.       when 6..8
  1536.         self.x -=2
  1537.         self.y -=2
  1538.         self.z = @battler.screen_z
  1539.       when 3..5
  1540.         self.x +=2
  1541.         self.y +=2
  1542.         self.z = @battler.screen_z
  1543.       when 1..2
  1544.         self.x +=4
  1545.         self.y +=4
  1546.         self.z = @battler.screen_z
  1547.       end
  1548.     end
  1549.     if @battler.is_a?(Game_Actor)
  1550.       case @flash_shake
  1551.       when 9..10
  1552.         self.x +=4
  1553.         self.y +=4
  1554.         self.z = @battler.screen_z
  1555.       when 6..8
  1556.         self.x +=2
  1557.         self.y +=2
  1558.         self.z = @battler.screen_z
  1559.       when 3..5
  1560.         self.x -=2
  1561.         self.y -=2
  1562.         self.z = @battler.screen_z
  1563.       when 1..2
  1564.         self.x -=4
  1565.         self.y -=4
  1566.         self.z = @battler.screen_z
  1567.       end
  1568.     end
  1569.     @flash_shake -= 1
  1570.   end
  1571. end
  1572. end

  1573. #==============================================================================
  1574. # ■ Scene_Battle
  1575. #------------------------------------------------------------------------------
  1576. #  处理战斗画面的类。
  1577. #==============================================================================

  1578. class Scene_Battle
  1579. #--------------------------------------------------------------------------
  1580. # ● 定义实例变量
  1581. #--------------------------------------------------------------------------
  1582. attr_reader   :animation1_id                    # 行动方动画ID
  1583. end
  1584. class Sprite_Battler < RPG::Sprite
  1585.   #--------------------------------------------------------------------------
  1586.   # ● 处理角色动作
  1587.   #--------------------------------------------------------------------------
  1588.   def update_actor_animation
  1589.     if @battler.is_a?(Game_Actor)
  1590.       if @battler.show_damage_value != nil
  1591.         self.damage(@battler.show_damage_value, false)
  1592.         @battler.show_damage(nil)
  1593.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1594.         @battler.setup_battler_hurt_ani(1)
  1595.       end
  1596.       if @battler.current_action.kind == 0 and @battler.current_action.basic == 1 and @battler.show_damage_value != nil
  1597.         # 防御的时候
  1598.         if @hits > @temp_hits and not @battler.dead?
  1599.           #########################
  1600.           @battler.temphp -= @d_dam if $动态扣血
  1601.           #########################
  1602.           ############ #小改动
  1603.           @temp_hits+=1
  1604.           ############
  1605.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  1606.           @battler.setup_battler_hurt_ani(1)
  1607.           #################################################################
  1608.         elsif @last_hits == 1 and not @battler.dead?
  1609.           #########################
  1610.           @battler.temphp -= @d_dam if $动态扣血
  1611.           #########################
  1612.           ############ #小改动
  1613.           @last_hits = 0
  1614.           ############
  1615.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  1616.           @battler.setup_battler_hurt_ani(1)
  1617.           #################################################################
  1618.         elsif @frame_index != -1 and @frame_index != @last_frame and not @battler.dead? and !@battler.damage.is_a?(Numeric)
  1619.           #########################
  1620.           @battler.temphp -= @d_dam if $动态扣血
  1621.           #########################
  1622.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  1623.           @battler.setup_battler_hurt_ani(1)
  1624.           #################################################################
  1625.         elsif @last_hits == 1 and not @battler.dead? and !@battler.damage.is_a?(Numeric)
  1626.           #########################
  1627.           @battler.temphp -= @d_dam if $动态扣血
  1628.           #########################
  1629.           ############ #小改动
  1630.           @last_hits = 0
  1631.           ############
  1632.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  1633.           @battler.setup_battler_hurt_ani(1)
  1634.           #################################################################
  1635.         end
  1636.       else
  1637.         # 单回合只有一次攻击
  1638.         if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1
  1639.           #########################
  1640.           @battler.temphp -= @d_dam if $动态扣血
  1641.           #########################
  1642.           ############ #小改动
  1643.           @last_hits = 0
  1644.           ############
  1645.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1646.           @battler.setup_battler_hurt_ani(1)
  1647.           #################################################################
  1648.         # 单回合多次攻击
  1649.         elsif @hits > @temp_hits and @frame_index != @last_frame and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1
  1650.           #########################
  1651.           @battler.temphp -= @d_dam if $动态扣血
  1652.           #########################
  1653.           ############ #小改动
  1654.           @temp_hits+=1
  1655.           ############
  1656.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1657.           @battler.setup_battler_hurt_ani(1)
  1658.         ########################################################################
  1659.         # 死亡之前攻击
  1660.         elsif @hits > @temp_hits and @frame_index != @last_frame and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1 and @battler.dead? and @battler.battler_dead_ani != 1
  1661.           #########################
  1662.           @battler.temphp -= @d_dam if $动态扣血
  1663.           @battler.temphp = @battler.hp if $动态扣血
  1664.           #########################
  1665.           ############ #小改动
  1666.           @temp_hits+=1
  1667.           ############
  1668.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1669.           @battler.setup_battler_hurt_ani(1)
  1670.           #################################################################
  1671.         # 闪避的回合
  1672.         elsif !@battler_damage.is_a?(Numeric) and @last_hits == 1 and @frame_index == @last_frame
  1673.           #########################
  1674.           @battler.temphp -= @d_dam  if $动态扣血
  1675.           #########################
  1676.           @last_hits = 0
  1677.           #################################################################
  1678.         # 无伤害的攻击
  1679.         elsif @battler_damage.is_a?(Numeric) and @battler.damage == 0 and @last_hits == 1 and @frame_index == @last_frame
  1680.           #########################
  1681.           @battler.temphp -= @d_dam  if $动态扣血
  1682.           #########################
  1683.           @last_hits = 0
  1684.           ######################################################
  1685.           $fangyu = 0
  1686.           @battler.setup_battler_dead_ani(0)
  1687.           ######################################################
  1688.           #################################################################
  1689.         # 死亡判定
  1690.         elsif @last_hits == 1 and @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  1691. #          for actor in $game_party.actors
  1692. #            if @battler != actor
  1693. #              actor.add_state(6)
  1694. #            end
  1695. #          end
  1696.           #########################
  1697.           @battler.temphp -= @d_dam  if $动态扣血
  1698.           @battler.temphp = @battler.hp  if $动态扣血
  1699.           #########################
  1700.           @last_hits = 0
  1701.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  1702.           @battler.setup_battler_dead_ani(1)
  1703.           #################################################################
  1704.         # 胜利判定
  1705.         elsif $scene.phase == 5 and @once == 0 and @battler_name != nil and not @battler.hidden and not @battler.dead? and $game_temp.battle_proc == nil
  1706.              @once = 1
  1707.              @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1)
  1708.         end
  1709.       end
  1710.     end
  1711.   end
  1712.   #--------------------------------------------------------------------------
  1713.   # ● 处理敌人动作
  1714.   #--------------------------------------------------------------------------
  1715.   def update_enemy_animation
  1716.     if @battler.is_a?(Game_Enemy)
  1717.       if @battler.show_damage_value != nil
  1718.         self.damage(@battler.show_damage_value, false)
  1719.         @battler.show_damage(nil)
  1720.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1721.         @battler.setup_battler_hurt_ani(1)
  1722.       end
  1723.       if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
  1724.       else
  1725.         # 单回合只有一次攻击
  1726.         if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0
  1727.           ############ #小改动
  1728.           @last_hits = 0
  1729.           ############
  1730.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1731.           @battler.setup_battler_hurt_ani(1)
  1732.           #################################################################
  1733.         # 单回合多次攻击
  1734.         elsif @hits > @temp_hits and @frame_index != @last_frame and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0
  1735.           ############ #小改动
  1736.           @temp_hits+=1
  1737.           ############
  1738.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1739.           @battler.setup_battler_hurt_ani(1)
  1740.           #################################################################
  1741.         # 死亡之前攻击
  1742.         elsif @hits > @temp_hits and @frame_index != @last_frame and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and @battler.dead? and @battler.battler_dead_ani != 1
  1743.           ############ #小改动
  1744.           @temp_hits+=1
  1745.           ############
  1746.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1747.           @battler.setup_battler_hurt_ani(1)
  1748.           #################################################################
  1749.         # 无伤害的攻击
  1750.         elsif @battler_damage.is_a?(Numeric) and @battler.damage <= 0 and @last_hits == 1 and @frame_index == @last_frame
  1751.           @last_hits = 0
  1752.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1753.           ######################################################
  1754.           $fangyu = 0
  1755.           @battler.setup_battler_dead_ani(0)
  1756.           ######################################################
  1757.           #################################################################
  1758.         # 闪避的回合
  1759.         elsif !@battler_damage.is_a?(Numeric) and @last_hits == 1 and @frame_index == @last_frame
  1760.           @last_hits = 0
  1761.           #################################################################
  1762.         # 死亡判定
  1763.         elsif @last_hits == 1 and @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  1764.           @last_hits = 0
  1765.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  1766.           @battler.setup_battler_dead_ani(1)
  1767.           collapse
  1768.         end
  1769.       end
  1770.     end
  1771.   end
  1772. end
复制代码
’’
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部