查看: 2111|回复: 6

[已经过期] 【RMXP】熊式横版特技使用方 动画问题

[复制链接]
梦石
0
星屑
2292
在线时间
195 小时
注册时间
2014-6-21
回帖
104
发表于 2022-4-26 03:35:30 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 link756367658 于 2022-4-26 03:39 编辑

有个小问题 就是给别的伙伴施法就可以显示 给自己施法的时候不显示使用动画  求各位大佬给看看 怎么修改

  1. def update_animation
  2. #==============================================================================
  3. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  4. #
  5. # ■ 熊式横版战斗 by 弗雷德   真移位:神思
  6. #==============================================================================
  7. #如果要需要Game_Battler3类的攻击、特技、物品的方法,请移至161-470行
  8. #因为重写过这三个方法,在原方法里改是不会生效的。





  9. #--------------------------------------------------------------------------
  10. #  ● 设定开始
  11. #--------------------------------------------------------------------------
  12. #伤害为0的时候是否显示无效文字,1为显示,0为不显示。
  13. INVALIDSWITCH = 1

  14. # 是否显示死亡图 1为显示,0为不显示。
  15. DEADPIC = 1

  16. # 是否显示总伤害 1为显示,0为不显示。
  17. SHOW_TOTAL_DAMAGE = 1

  18. # 是否显示连击数值 1为显示,0为不显示。
  19. HITSWITCH = 1

  20. # 是否显示SP伤害数值 1为显示,0为不显示。
  21. SDMGSWITCH = 1

  22. # 不是主状态的时候是否稍稍降低点透明度  1为降低,0为不降低
  23. NACTSWITCH = 0

  24. # 会心一击时的音效,不设置为不使用音效。
  25. CRIVOICE = "会心一击"

  26. # 会心一击是否开启画面晃动 1为开启,0为关闭
  27. CRISHAKE = 1

  28. # 会心一击是否开启画面闪烁,1为开启,0为关闭
  29. CRIFLASH = 1

  30. # 攻击时不移动的属性编号 默认为29号 参考数据库的设置
  31. # 比如职业枪兵勾上了29号属性,那么当枪兵使用普通攻击时将不会移动。技能也是如此。
  32. UNMOVE = 29

  33. # 攻击到与敌人同一水平线前的属性编号 默认为30号 参考数据库的设置
  34. HOMOVE = 30

  35. ##################################################################
  36. module Scene_BattleName
  37.   # 设定移动速度
  38.   Move_Duration = 0
  39.   #设定人物的单帧图,如果不做设定,将直接使用默认的战斗图。
  40.   BattlerName = {
  41.   "吕莨" => {
  42.   "待机" => ["吕莨待机-1","吕莨待机-2","吕莨待机-1","吕莨待机-3"],
  43.   "移动" => [""],
  44.   "返回" => [""],
  45.   "受伤" => ["吕莨受伤"],
  46.   "防御" => ["吕莨防御"],
  47.   "死亡" => ["死亡"]
  48.   },
  49.   
  50.   "杜勇" => {
  51.   "待机" => ["杜勇待机-3","杜勇待机-1","杜勇待机-2","杜勇待机-1"],
  52.   "移动" => [""],
  53.   "返回" => [""],
  54.   "受伤" => ["杜勇受伤"],
  55.   "防御" => ["杜勇防御"],
  56.   "死亡" => ["死亡"]
  57.   },
  58.    
  59.   "野狼" => {
  60.   "待机" => ["野狼待机-1","野狼待机-2","野狼待机-1","野狼待机-3"],
  61.   "移动" => [""],
  62.   "返回" => [""],
  63.   "受伤" => ["野狼待机-1","野狼待机-2","野狼待机-1","野狼待机-3"],
  64.   "防御" => ["野狼待机-1","野狼待机-2","野狼待机-1","野狼待机-3"],
  65.   "死亡" => ["死亡"]
  66.   },
  67.   
  68.   "校尉统领" => {
  69.   "待机" => ["校尉统领待机-1","校尉统领待机-2","校尉统领待机-1","校尉统领待机-3"],
  70.   "移动" => [""],
  71.   "返回" => [""],
  72.   "受伤" => ["校尉统领待机-1","校尉统领待机-2","校尉统领待机-1","校尉统领待机-3"],
  73.   "防御" => ["校尉统领待机-1","校尉统领待机-2","校尉统领待机-1","校尉统领待机-3"],
  74.   "死亡" => ["死亡"]
  75.   },
  76.    
  77.   "枪兵" => {
  78.   "待机" => ["枪兵橙待机-1","枪兵橙待机-2","枪兵橙待机-1","枪兵橙待机-3"],
  79.   "移动" => [""],
  80.   "返回" => [""],
  81.   "受伤" => ["枪兵橙待机-1","枪兵橙待机-2","枪兵橙待机-1","枪兵橙待机-3"],
  82.   "防御" => ["枪兵橙待机-1","枪兵橙待机-2","枪兵橙待机-1","枪兵橙待机-3"],
  83.   "死亡" => ["死亡"]
  84.   },

  85.   "阿蔡" => {
  86.   "待机" => ["阿蔡待机-2","阿蔡待机-1","阿蔡待机-3","阿蔡待机-1"],
  87.   "移动" => [""],
  88.   "返回" => [""],
  89.   "受伤" => ["阿蔡受伤"],
  90.   "防御" => ["阿蔡防御"],
  91.   "死亡" => ["死亡"]
  92.   },
  93.   }
  94. end
  95. #至于其它的:

  96. #HP伤害数字间距偏移在602行修改。

  97. #SP伤害数字间距偏移在667行修改。

  98. #连击数字间距偏移在713行修改。

  99. #总伤害数字间距偏移在759行修改。

  100. #--------------------------------------------------------------------------
  101. #  ● 设定结束
  102. #--------------------------------------------------------------------------










  103. class Game_Battler
  104.   attr_accessor :movex                    # X坐标修正
  105.   attr_accessor :movey                    # Y坐标修正
  106.   attr_accessor :startactive              # 行为
  107.   attr_accessor :damage_sp                # 精神伤害值
  108.   alias bearrpg_initialize initialize
  109.   def initialize
  110.     bearrpg_initialize
  111.     @damage_sp = 0
  112.     @movex = 0
  113.     @movey = 0
  114.     @startactive = "待机"
  115.   end
  116.   def width #获取战斗图宽
  117.     return RPG::Cache.battler(@battler_name, @battler_hue).width
  118.   end
  119.   def height #获取战斗图高
  120.     return RPG::Cache.battler(@battler_name, @battler_hue).height
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 应用通常攻击效果
  124.   #     attacker : 攻击者 (battler)
  125.   #--------------------------------------------------------------------------
  126.   def attack_effect(attacker)
  127.     # 清除会心一击标志
  128.     self.critical = false
  129.     #######伤害开关初始化##################################################bearrpg
  130.     $damage_hp = false
  131.     $damage_sp = false
  132.     # 第一命中判定
  133.     hit_result = (rand(100) < attacker.hit)
  134.     # 命中的情况下
  135.     if hit_result == true
  136.       # 计算基本伤害
  137.       atk = [attacker.atk - self.pdef / 2, 0].max
  138.       self.damage = atk * (20 + attacker.str) / 20
  139.       # 属性修正
  140.       self.damage *= elements_correct(attacker.element_set)
  141.       self.damage /= 100
  142.       # 伤害符号正确的情况下
  143.       if self.damage > 0
  144.         # 会心一击修正
  145.         if rand(100) < 4 * attacker.dex / self.agi
  146.           self.damage *= 2
  147.           self.critical = true
  148.         end
  149.         # 防御修正
  150.         if self.guarding?
  151.           self.damage /= 2
  152.         end
  153.       end
  154.       $damage_hp = true if self.damage.is_a?(Numeric)
  155.     #  $damage_sp = true if self.damage_sp != 0 SP伤害数值开关
  156.       # 分散
  157.       if self.damage.abs > 0
  158.         amp = [self.damage.abs * 15 / 100, 1].max
  159.         self.damage += rand(amp+1) + rand(amp+1) - amp
  160.       end
  161.       # 第二命中判定
  162.       eva = 8 * self.agi / attacker.dex + self.eva
  163.       hit = self.damage < 0 ? 100 : 100 - eva
  164.       hit = self.cant_evade? ? 100 : hit
  165.       hit_result = (rand(100) < hit)
  166.     end
  167.     #####################################bearrpg
  168.     # 命中的情况下
  169.     if hit_result == true
  170.       # 状态冲击解除
  171.       remove_states_shock
  172.       # HP 的伤害计算
  173.       self.hp -= self.damage
  174.       # 状态变化
  175.       @state_changed = false
  176.       states_plus(attacker.plus_state_set)
  177.       states_minus(attacker.minus_state_set)
  178.       if self.damage == 0
  179.            self.damage = "无效" if INVALIDSWITCH >0
  180.          self.critical = false
  181.        end
  182.     # Miss 的情况下
  183.     else
  184.       # 伤害设置为 "Miss"
  185.       self.damage = "Miss"
  186.       # 清除会心一击标志
  187.       self.critical = false
  188.     end
  189.     # 过程结束
  190.     return true
  191.   end
  192.   #############################################bearrpg
  193.   #--------------------------------------------------------------------------
  194.   # ● 应用特技效果
  195.   #     user  : 特技的使用者 (battler)
  196.   #     skill : 特技
  197.   #--------------------------------------------------------------------------
  198.   def skill_effect(user, skill)
  199.     #######伤害开关初始化##################################################bearrpg
  200.     $damage_hp = false
  201.     $damage_sp = false
  202.     # 清除会心一击标志
  203.     self.critical = false
  204.     # 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  205.     # 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  206.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  207.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  208.       # 过程结束
  209.       return false
  210.     end
  211.     # 清除有效标志
  212.     effective = false
  213.     # 公共事件 ID 是有效的情况下,设置为有效标志
  214.     effective |= skill.common_event_id > 0
  215.     # 第一命中判定
  216.     hit = skill.hit
  217.     if skill.atk_f > 0
  218.       hit *= user.hit / 100
  219.     end
  220.     hit_result = (rand(100) < hit)
  221.     # 不确定的特技的情况下设置为有效标志
  222.     effective |= hit < 100
  223.     # 命中的情况下
  224.     if hit_result == true
  225.       # 计算威力
  226.       power = skill.power + user.atk * skill.atk_f / 100
  227.       if power > 0
  228.         power -= self.pdef * skill.pdef_f / 200
  229.         power -= self.mdef * skill.mdef_f / 200
  230.         power = [power, 0].max
  231.       end
  232.       # 计算倍率
  233.       rate = 20
  234.       rate += (user.str * skill.str_f / 100)
  235.       rate += (user.dex * skill.dex_f / 100)
  236.       rate += (user.agi * skill.agi_f / 100)
  237.       rate += (user.int * skill.int_f / 100)
  238.       # 计算基本伤害
  239.       self.damage = power * rate / 20
  240.       # 属性修正
  241.       self.damage *= elements_correct(skill.element_set)
  242.       self.damage /= 100
  243.       # 伤害符号正确的情况下
  244.       if self.damage > 0
  245.         # 防御修正
  246.         if self.guarding?
  247.           self.damage /= 2
  248.         end
  249.       end
  250.       # 分散
  251.       if skill.variance > 0 and self.damage.abs > 0
  252.         amp = [self.damage.abs * skill.variance / 100, 1].max
  253.         self.damage += rand(amp+1) + rand(amp+1) - amp
  254.       end
  255.       # 第二命中判定
  256.       eva = 8 * self.agi / user.dex + self.eva
  257.       hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  258.       hit = self.cant_evade? ? 100 : hit
  259.       hit_result = (rand(100) < hit)
  260.       # 不确定的特技的情况下设置为有效标志
  261.       effective |= hit < 100
  262.     end
  263.     $damage_hp = true if self.damage.is_a?(Numeric)
  264.    # $damage_sp = true if self.damage_sp != 0 SP伤害数值开关
  265.     # 命中的情况下
  266.     if hit_result == true
  267.       # 威力 0 以外的物理攻击的情况下
  268.       if skill.power != 0 and skill.atk_f > 0
  269.         # 状态冲击解除
  270.         remove_states_shock
  271.         # 设置有效标志
  272.         effective = true
  273.       end
  274.       # HP 的伤害减法运算
  275.       last_hp = self.hp
  276.       self.hp -= self.damage
  277.       effective |= self.hp != last_hp
  278.       # 状态变化
  279.       @state_changed = false
  280.       effective |= states_plus(skill.plus_state_set)
  281.       effective |= states_minus(skill.minus_state_set)
  282.       #############################################bearrpg
  283.       # 威力为 0 的场合
  284.       if skill.power == 0
  285.         # 伤害设置为空的字串
  286.         self.damage = ""
  287.         # 状态没有变化的情况下
  288.         unless @state_changed
  289.           # 伤害设置为 "Miss"
  290.           self.damage = "Miss"
  291.         end
  292.       elsif self.damage == 0
  293.         unless @state_changed
  294.            self.damage = "无效" if INVALIDSWITCH >0
  295.          else
  296.           self.damage = ""
  297.         end
  298.       end
  299.     # Miss 的情况下
  300.     else
  301.       # 伤害设置为 "Miss"
  302.       self.damage = "Miss"
  303.     end
  304.     # 不在战斗中的情况下
  305.     unless $game_temp.in_battle
  306.       # 伤害设置为 nil
  307.       self.damage = nil
  308.     end
  309.     # 过程结束
  310.     return effective
  311.   end
  312.   #############################################bearrpg
  313.   #--------------------------------------------------------------------------
  314.   # ● 应用物品效果
  315.   #     item : 物品
  316.   #--------------------------------------------------------------------------
  317.   def item_effect(item)
  318.     # 清除会心一击标志
  319.     self.critical = false
  320.     # 物品的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  321.     # 或者物品的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  322.     if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
  323.        ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  324.       # 过程结束
  325.       return false
  326.     end
  327.     # 清除有效标志
  328.     effective = false
  329.     # 公共事件 ID 是有效的情况下,设置为有效标志
  330.     effective |= item.common_event_id > 0
  331.     # 命中判定
  332.     hit_result = (rand(100) < item.hit)
  333.     # 不确定的特技的情况下设置为有效标志
  334.     effective |= item.hit < 100
  335.     # 命中的情况
  336.     if hit_result == true
  337.       # 计算回复量
  338.       recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
  339.       recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
  340.       if recover_hp < 0
  341.         recover_hp += self.pdef * item.pdef_f / 20
  342.         recover_hp += self.mdef * item.mdef_f / 20
  343.         recover_hp = [recover_hp, 0].min
  344.       end
  345.       # 属性修正
  346.       recover_hp *= elements_correct(item.element_set)
  347.       recover_hp /= 100
  348.       recover_sp *= elements_correct(item.element_set)
  349.       recover_sp /= 100
  350.       # 分散
  351.       if item.variance > 0 and recover_hp.abs > 0
  352.         amp = [recover_hp.abs * item.variance / 100, 1].max
  353.         recover_hp += rand(amp+1) + rand(amp+1) - amp
  354.       end
  355.       if item.variance > 0 and recover_sp.abs > 0
  356.         amp = [recover_sp.abs * item.variance / 100, 1].max
  357.         recover_sp += rand(amp+1) + rand(amp+1) - amp
  358.       end
  359.       # 回复量符号为负的情况下
  360.       if recover_hp < 0
  361.         # 防御修正
  362.         if self.guarding?
  363.           recover_hp /= 2
  364.         end
  365.       end
  366.       # HP 回复量符号的反转、设置伤害值
  367.       self.damage = -recover_hp
  368.       self.damage_sp = -recover_sp  
  369.       # HP 以及 SP 的回复
  370.       last_hp = self.hp
  371.       last_sp = self.sp
  372.       self.hp += recover_hp
  373.       self.sp += recover_sp
  374.       ###################################################################bearrpg
  375.       $damage_hp = true if self.damage.is_a?(Numeric)
  376.       $damage_sp = true if self.damage_sp.is_a?(Numeric) and recover_sp != 0
  377.       ###################################################################bearrpg
  378.       effective |= self.hp != last_hp
  379.       effective |= self.sp != last_sp
  380.       # 状态变化
  381.       @state_changed = false
  382.       effective |= states_plus(item.plus_state_set)
  383.       effective |= states_minus(item.minus_state_set)
  384.       # 能力上升值有效的情况下
  385.       if item.parameter_type > 0 and item.parameter_points != 0
  386.         # 能力值的分支
  387.         case item.parameter_type
  388.         when 1  # MaxHP
  389.           @maxhp_plus += item.parameter_points
  390.         when 2  # MaxSP
  391.           @maxsp_plus += item.parameter_points
  392.         when 3  # 力量
  393.           @str_plus += item.parameter_points
  394.         when 4  # 灵巧
  395.           @dex_plus += item.parameter_points
  396.         when 5  # 速度
  397.           @agi_plus += item.parameter_points
  398.         when 6  # 魔力
  399.           @int_plus += item.parameter_points
  400.         end
  401.         # 设置有效标志
  402.         effective = true
  403.       end
  404.       # HP 回复率与回复量为 0 的情况下
  405.       if item.recover_hp_rate == 0 and item.recover_hp == 0
  406.         # 设置伤害为空的字符串
  407.         self.damage = ""
  408.         # SP 回复率与回复量为 0、能力上升值无效的情况下
  409.         if item.recover_sp_rate == 0 and item.recover_sp == 0 and
  410.            (item.parameter_type == 0 or item.parameter_points == 0)
  411.           # 状态没有变化的情况下
  412.           unless @state_changed
  413.             # 伤害设置为 "Miss"
  414.             self.damage = "Miss"
  415.           end
  416.         end
  417.       end
  418.     # Miss 的情况下
  419.     else
  420.       # 伤害设置为 "Miss"
  421.       self.damage = "Miss"
  422.     end
  423.     # 不在战斗中的情况下
  424.     unless $game_temp.in_battle
  425.       # 伤害设置为 nil
  426.       self.damage = nil
  427.     end
  428.     # 过程结束
  429.     return effective
  430.   end
  431. end

  432. #############################################################################
  433. #                                横版修改   
  434. #改角色的坐标#
  435. ###注意,此处虽然按照5人制改了坐标,但是因为前面未设置,所以无效

  436. #############################################################################
  437. class Game_Actor < Game_Battler
  438.   
  439. #--------------------------------------------------------------------------
  440.   # ● 取得战斗画面的 X 坐标
  441.   #--------------------------------------------------------------------------
  442.   def screen_x
  443.     case self.index  
  444.     when 0
  445.        return 414
  446.        #角色1的横坐标
  447.       when 1
  448.        return 414
  449.        #角色2的横坐标
  450.       when 2
  451.        return 506
  452.        #角色3的横坐标
  453.       when 3
  454.        return 506
  455.        #角色4的横坐标
  456.       when 4
  457.        return 468
  458.        #角色4的横坐标
  459.     else
  460.       return 640
  461.     end
  462.   end
  463.   #----
  464.   #--------------------------------------------------------------------------
  465.   # ● 取得战斗画面的 Y 坐标
  466.   #--------------------------------------------------------------------------
  467.   def screen_y
  468.     # 返回计算后的队伍 Y 坐标的排列顺序
  469.     case self.index  
  470.     when 0
  471.        return 216
  472.        #角色1的纵坐标
  473.       when 1
  474.        return 296
  475.        #角色2的纵坐标
  476.       when 2
  477.        return 192
  478.        #角色3的纵坐标
  479.       when 3
  480.        return 320
  481.        #角色4的纵坐标
  482.       when 4
  483.        return 256
  484.        #角色4的纵坐标
  485.     else
  486.       return 1000320
  487.     end
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # ● 取得战斗画面的 Z 坐标
  491.   #--------------------------------------------------------------------------
  492.   def screen_z
  493.     # 返回计算后的队伍 Z 坐标的排列顺序
  494.     case self.index
  495.     when 0
  496.       return 100
  497.     when 1
  498.       return 110
  499.     when 2
  500.       return 120
  501.     when 3
  502.       return 130
  503.     when 4
  504.       return 140
  505.     else
  506.       return 0
  507.     end
  508.   end
  509. end

  510. class Scene_Battle

  511. #--------------------------------------------------------------------------
  512.   # ● 取得战斗画面的 X 坐标
  513.   #--------------------------------------------------------------------------
  514.   def screen_x
  515.     # 返回计算后的队伍 X 坐标的排列顺序
  516.     if self.index != nil
  517.       #......................................................................
  518.       return self.index * 90 + 500
  519.       #......................................................................
  520.     else
  521.       return 0
  522.     end
  523.   end
  524.   #--------------------------------------------------------------------------
  525.   # ● 取得战斗画面的 Y 坐标
  526.   #--------------------------------------------------------------------------
  527.   def screen_y
  528.     #........................................................................
  529.     return 464 - self.index * 110
  530.     #........................................................................
  531.   end
  532.    #--------------------------------------------------------------------------
  533.   # ● 取得战斗画面的 Z 坐标
  534.   #--------------------------------------------------------------------------
  535.   def screen_z
  536.     # 返回计算后的队伍 Z 坐标的排列顺序
  537.     case self.index
  538.     when 0
  539.       return 100
  540.     when 1
  541.       return 90
  542.     when 2
  543.       return 80
  544.     when 3
  545.       return 70
  546.     when 4
  547.       return 60
  548.     else
  549.       return 0
  550.     end
  551.   end
  552. end

  553. ###########################################################
  554. class Sprite_Battler
  555.   include Scene_BattleName
  556. end
  557. module RPG
  558. class Sprite < ::Sprite
  559. #==========================================
  560. def initialize(viewport = nil)
  561. super(viewport)
  562. @_whiten_duration = 0
  563. @_appear_duration = 0
  564. @_escape_duration = 0
  565. @_collapse_duration = 0
  566. @_damage_duration = 0
  567. @_animation_duration = 0
  568. @_blink = false  
  569. @flash_shake = 0
  570. @_damage = []  
  571. @_damage_sp = []
  572. @_total_damage = 0
  573. @_total_damage_duration = 0
  574. @p_dam=0
  575. @hits=0
  576. end
  577. def animation_set_sprites(sprites, cell_data, position)
  578.    for i in 0..15
  579.    sprite = sprites[i]
  580.    pattern = cell_data[i, 0]
  581.    if sprite == nil or pattern == nil or pattern == -1
  582.      sprite.visible = false if sprite != nil
  583.      next
  584.    end
  585.    sprite.visible = true
  586.    sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  587.    if position == 3
  588.      if self.viewport != nil
  589.        sprite.x = self.viewport.rect.width / 2
  590.        sprite.y = self.viewport.rect.height - 160
  591.      else
  592.        sprite.x = 320
  593.        sprite.y = 240
  594.      end
  595.      else
  596.      sprite.x = self.x - self.ox + self.src_rect.width / 2
  597.      sprite.y = self.y - self.oy + self.src_rect.height / 2
  598.      sprite.y -= self.src_rect.height / 4 if position == 0
  599.      sprite.y += self.src_rect.height / 4 if position == 2
  600.    end
  601.    sprite.x += cell_data[i, 1]
  602.    sprite.y += cell_data[i, 2]
  603.    if $scene.is_a?(Scene_Battle)
  604.    sprite.z = battler.screen_z+20
  605. else
  606.    sprite.z = 9990
  607.    end
  608.    sprite.ox = 96
  609.    sprite.oy = 96
  610.    sprite.zoom_x = cell_data[i, 3] / 100.0
  611.    sprite.zoom_y = cell_data[i, 3] / 100.0
  612.    sprite.angle = cell_data[i, 4]
  613.    sprite.mirror = (cell_data[i, 5] == 1)
  614.    sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  615.    sprite.blend_type = cell_data[i, 7]
  616.    end
  617. end
  618. def damage(value, critical)
  619.   dispose_hit
  620.     if value.is_a?(Numeric)
  621.       damage_string = value.abs.to_s
  622.     else
  623.       damage_string = value.to_s
  624.     end
  625.     bitmap = Bitmap.new(300, 150)
  626.     bitmap.font.name = ["黑体","华文行楷", "宋体"]
  627.     bitmap.font.size = 32
  628.     if value.is_a?(Numeric)
  629.   # 分割伤害值字符串
  630.       damage_array = damage_string.scan(/./)
  631.       damage_x = 81 - damage_string.size * 9
  632.   # 会心一击标志打开的情况
  633.       if critical and value != "无效"
  634.   # 显示会心一击图画
  635.         cri_bitmap = RPG::Cache.picture("Critital")
  636.         bitmap.blt(damage_x+cri_bitmap.width, cri_bitmap.height*2, cri_bitmap, Rect.new(0, 0, cri_bitmap.width, cri_bitmap.height))
  637.         Audio.se_play("Audio/SE/"+CRIVOICE,100,100) if CRIVOICE != nil and CRIVOICE != ""
  638.         $game_screen.start_flash(Color.new(255, 5, 5, 155), 5) if CRIFLASH >0
  639.         $game_screen.start_shake(2,9,3) if CRISHAKE >0
  640.       end
  641.   # 伤害值为负的情况下
  642.     dmg_bitmap = RPG::Cache.picture("Normal_Damage")
  643.       if value < 0
  644.   # 调用回复数字表
  645.         bitmap.blt(damage_x-14, 32,dmg_bitmap,Rect.new(dmg_bitmap.width/12*10, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  646.       else
  647.   # 调用伤害数字表
  648.         bitmap.blt(damage_x-14, 32, dmg_bitmap,Rect.new(dmg_bitmap.width/12*11, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  649.       end
  650.   # 循环伤害值字符串
  651.       for char in damage_array
  652.         number = char.to_i
  653.   # 显示伤害数字
  654.         bitmap.blt(damage_x, 32, dmg_bitmap,
  655.         Rect.new(number * dmg_bitmap.width/12, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  656. #################################################################普通伤害数值
  657.         damage_x += dmg_bitmap.width/12 - 4#间距缩小4个像素,可以自行调整
  658. #################################################################普通伤害数值
  659.       end  
  660.     else
  661.       if value == "Miss"
  662.         miss_dmg = RPG::Cache.picture("miss")
  663.         bitmap.blt(miss_dmg.width, 0,miss_dmg, Rect.new(0, 0, miss_dmg.width, miss_dmg.height))
  664.       elsif value == "无效"
  665.         invalid_dmg = RPG::Cache.picture("invalid")
  666.         bitmap.blt(invalid_dmg.width, 0,invalid_dmg, Rect.new(0, 0, invalid_dmg.width,invalid_dmg.height))
  667.       #end
  668.       end
  669.     end
  670. # 伤害值定位
  671.     @_damage_sprite = ::Sprite.new(self.viewport)
  672.     @_damage_sprite.bitmap = bitmap
  673.     @_damage_sprite.ox = 80
  674.     @_damage_sprite.oy = 20
  675.     @_damage_sprite.x = self.x
  676.     @_damage_sprite.y = self.y - self.oy / 2
  677.     @_damage_sprite.z = 3000
  678.     @_damage_duration = 40
  679.     @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  680.     make_total_damage(value)
  681.   end
  682. ##################################################################sp伤害数值
  683. def damage_sp(value, critical)
  684.   dispose_hit
  685.     if value.is_a?(Numeric)
  686.       damage_string = value.abs.to_s
  687.     else
  688.       damage_string = value.to_s
  689.     end
  690.     bitmap = Bitmap.new(300, 150)
  691.     bitmap.font.name = ["黑体","华文行楷", "宋体"]
  692.     bitmap.font.size = 32
  693.     if value.is_a?(Numeric)
  694.   # 分割伤害值字符串
  695.       damage_array = damage_string.scan(/./)
  696.       damage_x = 81 - damage_string.size * 9
  697.   # 会心一击标志打开的情况
  698.       if critical and value != "无效"
  699.   # 显示会心一击图画
  700.         cri_bitmap = RPG::Cache.picture("Critital")
  701.         bitmap.blt(damage_x+cri_bitmap.width, cri_bitmap.height*2, cri_bitmap, Rect.new(0, 0, cri_bitmap.width, cri_bitmap.height))
  702.         Audio.se_play("Audio/SE/"+CRIVOICE,100,100) if CRIVOICE != nil and CRIVOICE != ""
  703.         $game_screen.start_flash(Color.new(255, 5, 5, 155), 5) if CRIFLASH >0
  704.         $game_screen.start_shake(2,9,3) if CRISHAKE >0
  705.       end
  706.   # 伤害值为负的情况下
  707.     dmg_bitmap = RPG::Cache.picture("Normal_Damage")
  708.       if value < 0
  709.   # 调用回复数字表
  710.         bitmap.blt(damage_x-14, 32,dmg_bitmap,Rect.new(dmg_bitmap.width/12*10, dmg_bitmap.height/2, dmg_bitmap.width/12, dmg_bitmap.height/2))
  711.       else
  712.   # 调用伤害数字表
  713.         bitmap.blt(damage_x-14, 32, dmg_bitmap,Rect.new(dmg_bitmap.width/12*11, dmg_bitmap.height/2, dmg_bitmap.width/12, dmg_bitmap.height/2))
  714.       end
  715.   # 循环伤害值字符串
  716.       for char in damage_array
  717.         number = char.to_i
  718.   # 显示伤害数字
  719.         bitmap.blt(damage_x, 32, dmg_bitmap,
  720.         Rect.new(number * dmg_bitmap.width/12, dmg_bitmap.height/2, dmg_bitmap.width/12, dmg_bitmap.height/2))
  721. #################################################################普通伤害数值
  722.         damage_x += dmg_bitmap.width/12 - 4#间距缩小4个像素,可以自行调整
  723. #################################################################普通伤害数值
  724.       end  
  725.     else
  726.       if value == "Miss"
  727.         miss_dmg = RPG::Cache.picture("miss")
  728.         bitmap.blt(miss_dmg.width, 0,miss_dmg, Rect.new(0, 0, miss_dmg.width, miss_dmg.height))
  729.       elsif value == "无效"
  730.         invalid_dmg = RPG::Cache.picture("invalid")
  731.         bitmap.blt(invalid_dmg.width, 0,invalid_dmg, Rect.new(0, 0, invalid_dmg.width,invalid_dmg.height))
  732.       #end
  733.       end
  734.     end
  735. # 伤害值定位
  736.     @_damage_sprite = ::Sprite.new(self.viewport)
  737.     @_damage_sprite.bitmap = bitmap
  738.     @_damage_sprite.ox = 80
  739.     @_damage_sprite.oy = 20
  740.     @_damage_sprite.x = self.x
  741.     @_damage_sprite.y = self.y - self.oy / 2
  742.     @_damage_sprite.z = 3000
  743.     @_damage_duration = 40
  744.     @_damage_sp.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  745.    # make_total_damage(value)
  746.   end  
  747. def hit
  748. # 如果伤害值是数值
  749. # 转为字符串
  750. value=@hits
  751. hits_string = value.to_s
  752. # 初始化位图
  753. bitmap = Bitmap.new(320, 64)
  754. bitmap.font.name = "Arial Black"
  755. bitmap.font.size = 32
  756. # 分割伤害值字符串
  757. hits_array = hits_string.scan(/./)
  758. hits_x = 81 - hits_string.size * 18.1
  759. rect_y = 0
  760. # 循环伤害值字符串
  761. for char in hits_array
  762. number = char.to_i
  763. # 显示伤害数字
  764. combo_num = RPG::Cache.picture("combo_num")
  765. bitmap.blt(hits_x, 0, combo_num,
  766. Rect.new(number * combo_num.width/10, 0, combo_num.width/10, combo_num.height))
  767. #################################################################连击数数值
  768. hits_x += combo_num.width/10 - 3#间距缩小3个像素,可以自行调整
  769. #################################################################连击数数值
  770. end
  771. combo_tx = RPG::Cache.picture("combo_text")
  772. bitmap.blt(hits_x, 0,combo_tx ,
  773. Rect.new(0, 0, combo_tx.width, combo_tx.height))
  774. # 伤害值定位
  775. @_hits_sprite = ::Sprite.new(self.viewport)
  776. @_hits_sprite.bitmap = bitmap
  777. @_hits_sprite.ox = 81
  778. @_hits_sprite.oy = 20
  779. @_hits_sprite.x = 500
  780. @_hits_sprite.y = 100
  781. @_hits_sprite.opacity = HITSWITCH > 0 ? 255 : 0
  782. @_hits_sprite.z = 3000
  783. @_hits_duration = 40
  784. end
  785. #--------------------------------------------------------------------------
  786. # ● 总伤害处理
  787. #--------------------------------------------------------------------------
  788. def make_total_damage(value)
  789. if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE > 0
  790. @_total_damage += value
  791. # 绝对值转为字符串
  792. damage_string = @_total_damage.abs.to_s
  793. else
  794. return
  795. end
  796. # 初始化位图
  797. bitmap = Bitmap.new(350, 150)
  798. bitmap.font.name = "Arial Black"
  799. bitmap.font.size = 32
  800. # 伤害值是数值的情况下
  801. if value.is_a?(Numeric)
  802. # 分割伤害值字符串
  803. damage_array = damage_string.scan(/./)
  804. damage_x = 40 - damage_string.size * 9
  805. # 伤害值为负的情况下
  806. name=RPG::Cache.picture("total_damage")
  807. # 循环伤害值字符串
  808. for char in damage_array
  809. number = char.to_i
  810. # 显示伤害数字
  811. bitmap.blt(damage_x, 0, name,
  812. Rect.new(number * name.width/10, 0, name.width/10, name.height))
  813. #################################################################总伤害数值
  814. damage_x += name.width/10 - 3 #间距缩小3个像素,可以自行调整
  815. #################################################################总伤害数值
  816. end
  817. end
  818. if @_total_damage_sprite.nil?
  819. @_total_damage_sprite = ::Sprite.new(self.viewport)
  820. @_total_damage_sprite.ox = 80
  821. @_total_damage_sprite.oy = 40
  822. @_total_damage_sprite.z = 3000
  823. end
  824. @_total_damage_sprite.bitmap = bitmap
  825. @_total_damage_sprite.zoom_x = 1.0
  826. @_total_damage_sprite.zoom_y = 1.0
  827. @_total_damage_sprite.x = self.x
  828. @_total_damage_sprite.y = self.y - self.oy / 2
  829. @_total_damage_sprite.z = 3001
  830. @_total_damage_duration = 80
  831. #hit数描绘
  832. @hits+=1
  833. if @_total_damage > 0
  834.   hit
  835. end
  836. end
  837. def animation(animation, hit, battler_damage="", battler_damage_sp="",battler_critical=false)
  838. dispose_animation
  839. @battler_damage = battler_damage
  840. @battler_damage_sp = battler_damage_sp
  841. @battler_critical = battler_critical
  842. @_animation = animation
  843. return if @_animation == nil
  844. @_animation_hit = hit
  845. @_animation_duration = @_animation.frame_max
  846. animation_name = @_animation.animation_name
  847. animation_hue = @_animation.animation_hue
  848. bitmap = RPG::Cache.animation(animation_name, animation_hue)
  849. for timing in @_animation.timings
  850. quanzhong = animation_process_timing(timing, @_animation_hit,true)
  851. @all_quanzhong += quanzhong
  852. @_last_frame = timing.frame if quanzhong != 0
  853. end
  854. if @@_reference_count.include?(bitmap)
  855. @@_reference_count[bitmap] += 1
  856. else
  857. @@_reference_count[bitmap] = 1
  858. end  
  859. if $scene.is_a?(Scene_Battle)
  860. if $scene.animation1_id == @battler.animation_id
  861. @battler_damage = ""
  862. @battler_damage_sp = ""
  863. end
  864. end
  865. @_animation_sprites = []
  866. if @_animation.position != 3 or not @@_animations.include?(animation)
  867. for i in 0..15
  868. sprite = ::Sprite.new(self.viewport)
  869. sprite.bitmap = bitmap
  870. sprite.visible = false
  871. @_animation_sprites.push(sprite)
  872. end
  873. unless @@_animations.include?(animation)
  874. @@_animations.push(animation)
  875. end
  876. end
  877. update_animation
  878. end  
  879. def dispose_damage
  880. for damage in @_damage.reverse
  881. damage[0].bitmap.dispose
  882. damage[0].dispose
  883. @_damage.delete(damage)
  884. end
  885. for damage_sp in @_damage_sp.reverse
  886. damage_sp[0].bitmap.dispose
  887. damage_sp[0].dispose
  888. @_damage_sp.delete(damage_sp)
  889. end
  890. @_total_damage = 0
  891. @_last_frame = -1
  892. if @_total_damage_sprite != nil
  893. @_total_damage_duration = 0
  894. @_total_damage_sprite.bitmap.dispose
  895. @_total_damage_sprite.dispose
  896. @_total_damage_sprite = nil
  897. end
  898. end
  899. def dispose_hit
  900. if @_hits_sprite != nil
  901. @_hits_sprite.bitmap.dispose
  902. @_hits_sprite.dispose
  903. @_hits_sprite = nil
  904. end
  905. end
  906. def dispose_animation
  907. @battler_damage = nil
  908. @battler_damage_sp = nil
  909. @battler_critical = nil
  910. @all_quanzhong = 1
  911. @_total_damage = 0
  912. @_last_frame = -1
  913. if @_animation_sprites != nil
  914. sprite = @_animation_sprites[0]
  915. if sprite != nil
  916. @@_reference_count[sprite.bitmap] -= 1
  917. if @@_reference_count[sprite.bitmap] == 0
  918. sprite.bitmap.dispose
  919. end
  920. end
  921. for sprite in @_animation_sprites
  922. sprite.dispose
  923. end
  924. @_animation_sprites = nil
  925. @_animation = nil
  926. end
  927. end
  928. def update
  929. super
  930. if @_whiten_duration > 0
  931. @_whiten_duration -= 1
  932. self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  933. end
  934. if @_appear_duration > 0
  935. @_appear_duration -= 1
  936. self.opacity = (16 - @_appear_duration) * 16
  937. end
  938. if @_escape_duration > 0
  939. @_escape_duration -= 1
  940. self.opacity = 256 - (32 - @_escape_duration) * 10
  941. end
  942. if @_collapse_duration > 0
  943. @_collapse_duration -= 1
  944. self.opacity = 256 - (48 - @_collapse_duration) * 6
  945. end
  946. if @_damage_duration > 0
  947. @_damage_duration -= 1
  948. for damage in @_damage
  949. damage[0].x = self.x + self.viewport.rect.x -
  950. self.ox + self.src_rect.width / 2 +
  951. (40 - damage[1]) * damage[3] / 10
  952. damage[0].y -= damage[4]+damage[1]/10
  953. damage[0].opacity = damage[1]*20
  954. damage[1] -= 1
  955. if damage[1]==0
  956. damage[0].bitmap.dispose
  957. damage[0].dispose
  958. @_damage.delete(damage)
  959. next
  960. end
  961. end
  962. for damage_sp in @_damage_sp
  963. damage_sp[0].x = self.x + self.viewport.rect.x -
  964. self.ox + self.src_rect.width / 2 +
  965. (40 - damage_sp[1]) * damage_sp[3] / 10
  966. damage_sp[0].y -= damage_sp[4]+damage_sp[1]/10
  967. damage_sp[0].opacity = damage_sp[1]*20
  968. damage_sp[1] -= 1
  969. if damage_sp[1]==0
  970. damage_sp[0].bitmap.dispose
  971. damage_sp[0].dispose
  972. @_damage_sp.delete(damage_sp)
  973. next
  974. end
  975. end
  976. end
  977. if @_total_damage_duration > 0
  978. @_total_damage_duration -= 1
  979. @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
  980. if @_total_damage_sprite.zoom_x > 1.0
  981. @_total_damage_sprite.zoom_x -= 0.05
  982. end
  983. if @_total_damage_sprite.zoom_y > 1.0
  984. @_total_damage_sprite.zoom_y -= 0.05
  985. end
  986. @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
  987. if @_total_damage_duration <= 0
  988. dispose_hit
  989. @_total_damage = 0
  990. @_total_damage_duration = 0
  991. @_total_damage_sprite.bitmap.dispose
  992. @_total_damage_sprite.dispose
  993. @_total_damage_sprite = nil
  994. end
  995. end
  996. #=======================================
  997.     if @_animation != nil and (Graphics.frame_count % 2 == 0)
  998.       @_animation_duration -= 1
  999.       update_animation
  1000.     end
  1001.   if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  1002.       update_loop_animation
  1003.       @_loop_animation_index += 1
  1004.       @_loop_animation_index %= @_loop_animation.frame_max
  1005.     end
  1006.   if @_blink
  1007.     @_blink_count = (@_blink_count + 1) % 32
  1008.       if @_blink_count < 16
  1009.         alpha = (16 - @_blink_count) * 6
  1010.       else
  1011.         alpha = (@_blink_count - 16) * 6
  1012.       end
  1013.       self.color.set(255, 255, 255, alpha)
  1014.     end
  1015.     @@_animations.clear
  1016.   end
  1017. def update_animation
  1018.   if @_animation_duration > 0
  1019.     frame_index = @_animation.frame_max - @_animation_duration
  1020.     cell_data = @_animation.frames[frame_index].cell_data
  1021.     position = @_animation.position
  1022.     animation_set_sprites(@_animation_sprites, cell_data, position)
  1023.       for timing in @_animation.timings
  1024.         if timing.frame == frame_index
  1025.           t = 1.0 * animation_process_timing(timing, @_animation_hit)
  1026.           ts = 1.0 * animation_process_timing(timing, @_animation_hit)
  1027.           if timing.se.name != ""
  1028.             se=timing.se
  1029.             Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  1030.           end
  1031.           if @battler_damage.is_a?(Numeric) and t != 0
  1032.             if @battler.guarding?
  1033.               @battler.startactive = "防御" if @battler_damage > 0
  1034.            else
  1035.               @battler.startactive = "受伤" if @battler_damage > 0
  1036.             end
  1037.             t *= @battler_damage
  1038.             t /= @all_quanzhong
  1039.             ts *= @battler_damage_sp
  1040.             ts /= @all_quanzhong
  1041.             t = t.to_i
  1042.             ts = ts.to_i
  1043.   if frame_index != @_last_frame
  1044.     @p_dam+= t
  1045.   end
  1046.       if frame_index == @_last_frame
  1047.         t=@battler_damage-@p_dam
  1048.       end
  1049.     if frame_index == @_last_frame
  1050.       @_total_damage = @battler_damage - t
  1051.       @p_dam=0
  1052.     end
  1053.       damage(t,@battler_critical) if $damage_hp == true
  1054.       damage_sp(ts,@battler_critical) if $damage_sp == true
  1055.     if frame_index == @_last_frame
  1056.       @hits=0
  1057.      end
  1058.       elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  1059.         damage(@battler_damage,@battler_critical)
  1060.         damage_sp(@battler_damage_sp,@battler_critical) if $damage_sp == true
  1061.        end
  1062.       end
  1063.       end
  1064.     else
  1065.       dispose_animation
  1066.     end
  1067.   end
  1068. def animation_process_timing(timing, hit,dontflash=false)
  1069.   if (timing.condition == 0) or
  1070.     (timing.condition == 1 and hit == true) or
  1071.     (timing.condition == 2 and hit == false)
  1072.   case timing.flash_scope
  1073.     when 1
  1074.       unless dontflash
  1075.         self.flash(timing.flash_color, timing.flash_duration * 2)
  1076.         if @_total_damage >0
  1077.           @flash_shake_switch = true
  1078.           @flash_shake = 10
  1079.         end
  1080.       end
  1081.       return timing.flash_color.alpha * timing.flash_duration
  1082.     when 2
  1083.       unless dontflash
  1084.         if self.viewport != nil
  1085.           self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  1086.         end
  1087.       end
  1088.       return timing.flash_color.alpha * timing.flash_duration
  1089.     when 3
  1090.       unless dontflash
  1091.         self.flash(nil, timing.flash_duration * 2)
  1092.       end
  1093.         return timing.flash_color.alpha * timing.flash_duration
  1094.       end
  1095.     end
  1096.       return 0
  1097.     end
  1098.   end
  1099. end

  1100. class Sprite_Battler < RPG::Sprite
  1101.   def initialize(viewport, battler = nil)
  1102.     super(viewport)
  1103.     @battler = battler
  1104.     @battler_visible = false
  1105.     @flash_shake_switch = true
  1106.     @number = 0#初始化编号
  1107.   end
  1108.   def update
  1109.     super
  1110.     # 战斗者为 nil 的情况下
  1111.     if @battler == nil
  1112.       self.bitmap = nil
  1113.       loop_animation(nil)
  1114.       return
  1115.     end
  1116.     # 文件名和色相与当前情况有差异的情况下
  1117.     if @battler.battler_name != @battler_name or
  1118.        @battler.battler_hue != @battler_hue
  1119.       # 获取、设置位图
  1120.       @battler_name = @battler.battler_name
  1121.       @battler_hue = @battler.battler_hue
  1122.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  1123.       @width = bitmap.width
  1124.       @height = bitmap.height
  1125.       self.ox = @width / 2
  1126.       self.oy = @height
  1127.       # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  1128.       if @battler.dead? or @battler.hidden
  1129.         self.opacity = 0  if DEADPIC != 1
  1130.       end
  1131.     end
  1132.     ###################################万兽熊最高#########################################
  1133.         if @battler.startactive == "移动" or @battler.startactive == "返回"
  1134.       if Graphics.frame_count % 4 == 0
  1135.         unless BattlerName[@battler.name].nil?
  1136.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  1137.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1138.         end
  1139.       end
  1140.     elsif @battler.startactive == "死亡"
  1141.        if Graphics.frame_count % 4 == 0
  1142.         unless BattlerName[@battler.name].nil?
  1143.           if @number +1 <= BattlerName[@battler.name][@battler.startactive].size
  1144.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1145.           @number += 1
  1146.         else
  1147.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][BattlerName[@battler.name][@battler.startactive].size-1], @battler_hue)
  1148.           end
  1149.         end
  1150.       end
  1151.       else
  1152.       if Graphics.frame_count % 10 == 0
  1153.         unless BattlerName[@battler.name].nil?
  1154.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  1155.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1156.         end
  1157.       end
  1158.     end
  1159.     #######################################################################################
  1160.     # 动画 ID 与当前的情况有差异的情况下
  1161.     if @battler.damage == nil and
  1162.        @battler.state_animation_id != @state_animation_id
  1163.       @state_animation_id = @battler.state_animation_id
  1164.       loop_animation($data_animations[@state_animation_id])
  1165.     end
  1166.     # 应该被显示的角色的情况下
  1167.    if NACTSWITCH > 0
  1168.     if @battler.is_a?(Game_Actor) and @battler_visible
  1169.       # 不是主状态的时候稍稍降低点透明度
  1170.       if $game_temp.battle_main_phase
  1171.         self.opacity += 3 if self.opacity < 255
  1172.       else
  1173.         self.opacity -= 3 if self.opacity > 207
  1174.       end
  1175.     end
  1176.   end
  1177.     if @battler.blink
  1178.       blink_on
  1179.     else
  1180.       blink_off
  1181.     end
  1182.     unless @battler_visible
  1183.       if not @battler.hidden and not @battler.dead? and
  1184.          (@battler.damage == nil or @battler.damage_pop)
  1185.         appear
  1186.         @battler_visible = true
  1187.       end
  1188.     end
  1189.     if @battler_visible
  1190.       if @battler.hidden
  1191.         $game_system.se_play($data_system.escape_se)
  1192.         escape
  1193.         @battler_visible = false
  1194.       end
  1195.       if @battler.white_flash
  1196.         whiten
  1197.         @battler.white_flash = false   
  1198.       end
  1199.         if @battler.animation_id != 0
  1200.         animation = $data_animations[@battler.animation_id]
  1201.         animation(animation, @battler.animation_hit,@battler.damage,@battler.damage_sp, @battler.critical)
  1202.         @battler.animation_id = 0
  1203.       end
  1204.       if @battler.damage_pop
  1205.         @battler.damage = nil
  1206.         @battler.damage_sp = 0
  1207.         @battler.critical = false
  1208.         @battler.damage_pop = false
  1209.       end
  1210.       if @battler.damage == nil and @battler.dead?
  1211.         if DEADPIC >0
  1212.           @battler.startactive = "死亡"
  1213.           else
  1214.         if @battler.is_a?(Game_Enemy)
  1215.           $game_system.se_play($data_system.enemy_collapse_se)
  1216.         else
  1217.           $game_system.se_play($data_system.actor_collapse_se)
  1218.         end
  1219.         collapse
  1220.         @battler_visible = false
  1221.         end
  1222.       end
  1223.     end
  1224.      self.x = @battler.screen_x
  1225.      self.y = @battler.screen_y
  1226.      self.z = @battler.screen_z
  1227.   end
  1228. end

  1229. class Spriteset_Battle
  1230. alias bearrpg_initialize initialize
  1231.   def initialize
  1232.     @enemy_sprites = []
  1233.     for enemy in $game_troop.enemies.reverse
  1234.       #####修改敌人显示端口,与角色一样。
  1235.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  1236.     end
  1237.     bearrpg_initialize
  1238.   end
  1239. end

  1240. class Arrow_Enemy < Arrow_Base
  1241.   def update
  1242.     super
  1243.     $game_troop.enemies.size.times do
  1244.       break if self.enemy.exist?
  1245.       @index += 1
  1246.       @index %= $game_troop.enemies.size
  1247.     end
  1248.     if Input.repeat?(Input::UP)
  1249.       $game_system.se_play($data_system.cursor_se)
  1250.       $game_troop.enemies.size.times do
  1251.         @index += 1
  1252.         @index %= $game_troop.enemies.size
  1253.         break if self.enemy.exist?
  1254.       end
  1255.     end
  1256.     if Input.repeat?(Input::DOWN)
  1257.       $game_system.se_play($data_system.cursor_se)
  1258.       $game_troop.enemies.size.times do
  1259.         @index += $game_troop.enemies.size - 1
  1260.         @index %= $game_troop.enemies.size
  1261.         break if self.enemy.exist?
  1262.       end
  1263.     end
  1264.     if self.enemy != nil
  1265.       self.x = self.enemy.screen_x
  1266.       self.y = self.enemy.screen_y
  1267.     end
  1268.   end
  1269. end

  1270. class Arrow_Actor < Arrow_Base
  1271.   def update
  1272.     super
  1273.     if Input.repeat?(Input::UP)
  1274.       $game_system.se_play($data_system.cursor_se)
  1275.       @index += 1
  1276.       @index %= $game_party.actors.size
  1277.     end
  1278.     if Input.repeat?(Input::DOWN)
  1279.       $game_system.se_play($data_system.cursor_se)
  1280.       @index += $game_party.actors.size - 1
  1281.       @index %= $game_party.actors.size
  1282.     end
  1283.     if self.actor != nil
  1284.       self.x = self.actor.screen_x
  1285.       self.y = self.actor.screen_y
  1286.     end
  1287.   end
  1288. end

  1289. class Scene_Battle
  1290. include Scene_BattleName
  1291. attr_reader :animation1_id
  1292.   def main
  1293.     $game_temp.in_battle = true
  1294.     $game_temp.battle_turn = 0
  1295.     $game_temp.battle_event_flags.clear
  1296.     $game_temp.battle_abort = false
  1297.     $game_temp.battle_main_phase = false
  1298.     $game_temp.battleback_name = $game_map.battleback_name
  1299.     $game_temp.forcing_battler = nil
  1300.     @_move_duration = 0
  1301.     $game_system.battle_interpreter.setup(nil, 0)
  1302.     @troop_id = $game_temp.battle_troop_id
  1303.     $game_troop.setup(@troop_id)
  1304.     s1 = $data_system.words.attack
  1305.     s2 = $data_system.words.skill
  1306.     s3 = $data_system.words.guard
  1307.     s4 = $data_system.words.item
  1308.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  1309.     @actor_command_window.z = 900
  1310.     @actor_command_window.y = 160
  1311.     @actor_command_window.back_opacity = 160
  1312.     @actor_command_window.active = false
  1313.     @actor_command_window.visible = false
  1314.     @party_command_window = Window_PartyCommand.new
  1315.     @party_command_window.z = 910
  1316.     @help_window = Window_Help.new
  1317.     @help_window.back_opacity = 160
  1318.     @help_window.z = 920
  1319.     @help_window.visible = false
  1320.     @status_window = Window_BattleStatus.new
  1321.     @status_window.z = 930
  1322.     @message_window = Window_Message.new
  1323.     @message_window.z = 940
  1324.     @spriteset = Spriteset_Battle.new
  1325.     @wait_count = 0
  1326.     if $data_system.battle_transition == ""
  1327.       Graphics.transition(20)
  1328.     else
  1329.       Graphics.transition(40, "Graphics/Transitions/" +
  1330.         $data_system.battle_transition)
  1331.     end
  1332.     start_phase1
  1333.     loop do
  1334.       Graphics.update
  1335.       Input.update
  1336.       update
  1337.       if $scene != self
  1338.         break
  1339.       end
  1340.     end
  1341.     $game_map.refresh
  1342.     Graphics.freeze
  1343.     @actor_command_window.dispose
  1344.     @party_command_window.dispose
  1345.     @help_window.dispose
  1346.     @status_window.dispose
  1347.     @message_window.dispose
  1348.     if @skill_window != nil
  1349.       @skill_window.dispose
  1350.     end
  1351.     if @item_window != nil
  1352.       @item_window.dispose
  1353.     end
  1354.     if @result_window != nil
  1355.       @result_window.dispose
  1356.     end
  1357.     @spriteset.dispose
  1358.     if $scene.is_a?(Scene_Title)
  1359.       Graphics.transition
  1360.       Graphics.freeze
  1361.     end
  1362.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  1363.       $scene = nil
  1364.     end
  1365.   end
  1366.   def start_phase1
  1367.     # 转移到回合 1
  1368.     @phase = 1
  1369.     # 清除全体同伴的行动
  1370.     $game_party.clear_actions
  1371.     for actor in $game_party.actors
  1372.      actor.startactive = actor.hp>0? "待机" : "死亡"
  1373.     end
  1374.     # 设置战斗事件
  1375.     setup_battle_event
  1376.   end
  1377.   alias bearrpg_start_phase5 start_phase5
  1378. def start_phase5
  1379.    bearrpg_start_phase5
  1380.     @result_window.z = 999
  1381.     @phase5_wait_count = 100
  1382.   end
  1383.   def start_enemy_select
  1384.     @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
  1385.     @enemy_arrow.help_window = @help_window
  1386.     @actor_command_window.active = false
  1387.     @actor_command_window.visible = false
  1388.   end
  1389.   alias bearrpg_start_skill_select start_skill_select
  1390.    def start_skill_select
  1391.       bearrpg_start_skill_select
  1392.       @skill_window.z = 999
  1393.     end
  1394.    alias bearrpg_start_item_select start_item_select
  1395.     def start_item_select
  1396.       bearrpg_start_item_select
  1397.       @item_window.z = 999
  1398.     end
  1399.   def move(active_battler, target, ox, oy, 返回标记 = false)
  1400.     ta_x = target[0]
  1401.     ta_y = target[1]
  1402.     if 返回标记
  1403.       active_battler.movex = (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox) / @_move_duration
  1404.       active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy) / @_move_duration
  1405.     else
  1406.       if @active_battler.is_a?(Game_Enemy)
  1407.         active_battler.movex = (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox ) / @_move_duration
  1408.         active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy ) / @_move_duration
  1409.       else
  1410.         active_battler.movex =  (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox ) / @_move_duration
  1411.         active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy ) / @_move_duration
  1412.       end
  1413.     end
  1414.   end
  1415.   def update_phase4_step3
  1416.     ####普通攻击的场合############################################################
  1417.     if @active_battler.current_action.basic == 0 and
  1418.       @active_battler.current_action.kind == 0
  1419.       #开始执行移动
  1420.      if not @active_battler.element_rate(UNMOVE)>100# 如果属性“不移动”不大于100
  1421.         @active_battler.startactive = "移动"
  1422.         @oldxy = [@active_battler.screen_x,@active_battler.screen_y]
  1423.         ox,oy = @active_battler.screen_x,@active_battler.screen_y
  1424.       if @active_battler.element_rate(HOMOVE)>100# 如果属性“半距离”大于100
  1425.         @_move_duration = Move_Duration/2
  1426.        while @_move_duration > 0
  1427.         Graphics.update
  1428.         Input.update
  1429.         @spriteset.update
  1430.         if @target_battlers[0].is_a?(Game_Actor)
  1431.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width-(@target_battlers[0].screen_x-ox).abs/2.abs,@target_battlers[0].screen_y+1]
  1432.         else
  1433.         tag = [(@target_battlers[0].screen_x+@target_battlers[0].width/1.5)+(@target_battlers[0].screen_x-ox).abs/2,@target_battlers[0].screen_y+2]
  1434.         end
  1435.         move(@active_battler, tag, ox, oy)
  1436.         @_move_duration -= 1
  1437.       end
  1438.     else
  1439.       @_move_duration = Move_Duration
  1440.         while @_move_duration > 0
  1441.         Graphics.update
  1442.         Input.update
  1443.         @spriteset.update
  1444.         if @target_battlers[0].is_a?(Game_Actor)
  1445.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width/2,@target_battlers[0].screen_y+1]
  1446.         else
  1447.         tag = [@target_battlers[0].screen_x+@target_battlers[0].width/1.5,@target_battlers[0].screen_y+2]
  1448.         end
  1449.         move(@active_battler, tag, ox, oy)
  1450.         @_move_duration -= 1
  1451.       end
  1452.       end
  1453.     end
  1454.    ####普通攻击的场合############################################################
  1455.     elsif @active_battler.current_action.kind == 1
  1456.     ####使用特技的场合############################################################
  1457.       if not @skill.element_set.include?(UNMOVE)# 如果技能不包含“不移动属性”
  1458.         @active_battler.startactive = "移动"
  1459.         @oldxy = [@active_battler.screen_x,@active_battler.screen_y]
  1460.         ox,oy = @active_battler.screen_x,@active_battler.screen_y
  1461.       if @skill.element_set.include?(HOMOVE)#如果技能不包含“半距离”属性
  1462.         @_move_duration = Move_Duration/2
  1463.        while @_move_duration > 0
  1464.         Graphics.update
  1465.         Input.update
  1466.         @spriteset.update
  1467.         if @target_battlers[0].is_a?(Game_Actor)
  1468.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width-(@target_battlers[0].screen_x-ox).abs/2.abs,@target_battlers[0].screen_y+1]
  1469.         else
  1470.         tag = [(@target_battlers[0].screen_x+@target_battlers[0].width/1.5)+(@target_battlers[0].screen_x-ox).abs/2,@target_battlers[0].screen_y+2]
  1471.         end
  1472.         move(@active_battler, tag, ox, oy)
  1473.         @_move_duration -= 1
  1474.       end
  1475.     else
  1476.       @_move_duration = Move_Duration
  1477.         while @_move_duration > 0
  1478.         Graphics.update
  1479.         Input.update
  1480.         @spriteset.update
  1481.         if @target_battlers[0].is_a?(Game_Actor)
  1482.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width,@target_battlers[0].screen_y+1]
  1483.         else
  1484.         tag = [@target_battlers[0].screen_x+@target_battlers[0].width/1.5,@target_battlers[0].screen_y+2]
  1485.         end
  1486.         move(@active_battler, tag, ox, oy)
  1487.         @_move_duration -= 1
  1488.       end
  1489.       end
  1490.     end
  1491.    #####使用特技的场合##############################################################
  1492. end
  1493. if @active_battler.startactive != "防御"
  1494.     @active_battler.startactive = "待机"
  1495.    end
  1496.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  1497.     if @animation1_id == 0
  1498.       @active_battler.white_flash = true
  1499.     else
  1500.       @active_battler.animation_id = @animation1_id
  1501.       @active_battler.animation_hit = true
  1502.     end
  1503.     for target in @target_battlers
  1504.       if target.guarding? and target.damage.is_a?(Numeric)
  1505.         target.startactive = "防御" if target.damage > 0
  1506.         end
  1507.       target.animation_id = @animation2_id
  1508.       target.animation_hit = (target.damage != "Miss")
  1509.     end
  1510.     # 移至步骤 4
  1511.     @phase4_step = 4
  1512.   end
  1513.   ##############################################################################
  1514.   def update_phase4_step4
  1515.    ###########################万兽熊最高########################################
  1516.     # 对像方动画
  1517.      for target in @target_battlers
  1518.        if target.damage != nil
  1519.          target.damage_pop = true
  1520.        end
  1521.      end
  1522.     # 限制动画长度、最低 8 帧
  1523.   #  @wait_count = 8
  1524.   ##############################################################################
  1525.     # 移至步骤 5
  1526.     @phase4_step = 5
  1527.   end
  1528. ####################万兽熊最高############################
  1529.   def update_phase4_step5
  1530.     # 隐藏帮助窗口
  1531.     @help_window.visible = false
  1532.     if @active_battler.current_action.basic == 0 and
  1533.       @active_battler.current_action.kind == 0
  1534.    ####普通攻击的场合############################################################   
  1535.       #执行返回
  1536.     if not @active_battler.element_rate(UNMOVE)>100# 如果属性“不移动”不大于100
  1537.       @active_battler.startactive = "返回"
  1538.       if @active_battler.element_rate(HOMOVE)>100# 如果属性“半距离”大于100
  1539.       @_move_duration = Move_Duration/2
  1540.       else
  1541.       @_move_duration = Move_Duration   
  1542.       end
  1543.       ox,oy = @active_battler.screen_x - @active_battler.movex,\
  1544.       @active_battler.screen_y - @active_battler.movey
  1545.       while @_move_duration > 0
  1546.         Graphics.update
  1547.         Input.update
  1548.         @spriteset.update
  1549.         move(@active_battler, @oldxy, ox, oy, true)
  1550.         @_move_duration -= 1
  1551.       end
  1552.     end
  1553.    ####普通攻击的场合############################################################
  1554.     elsif @active_battler.current_action.kind == 1
  1555.       if not @skill.element_set.include?(UNMOVE)#如果技能不包含“不移动”属性
  1556.       @active_battler.startactive = "返回"
  1557.       if @skill.element_set.include?(HOMOVE)#如果技能包含“半距离”属性
  1558.       @_move_duration = Move_Duration/2
  1559.       else
  1560.       @_move_duration = Move_Duration   
  1561.       end
  1562.       ox,oy = @active_battler.screen_x - @active_battler.movex,\
  1563.       @active_battler.screen_y - @active_battler.movey
  1564.       while @_move_duration > 0
  1565.         Graphics.update
  1566.         Input.update
  1567.         @spriteset.update
  1568.         move(@active_battler, @oldxy, ox, oy, true)
  1569.         @_move_duration -= 1
  1570.       end
  1571.     end
  1572.    ####使用特技的场合############################################################
  1573. end
  1574. if @active_battler.startactive != "防御"
  1575.     @active_battler.startactive = "待机"
  1576.    end
  1577.     # 刷新状态窗口
  1578.     @status_window.refresh
  1579.     # 显示伤害
  1580.     for target in @target_battlers
  1581.       target.startactive = "待机"
  1582.       if target.damage != nil
  1583.         target.damage_pop = true
  1584.       end
  1585.     end
  1586.     # 移至步骤 6
  1587.     @phase4_step = 6
  1588.   end
  1589.   def update_phase4_step6
  1590.     # 清除强制行动对像的战斗者
  1591.     $game_temp.forcing_battler = nil
  1592.     @active_battler.movex = 0
  1593.     @active_battler.movey = 0
  1594.     @active_battler.startactive = "待机" if @active_battler.startactive != "死亡"
  1595.     # 公共事件 ID 有效的情况下
  1596.     if @common_event_id > 0
  1597.       # 设置事件
  1598.       common_event = $data_common_events[@common_event_id]
  1599.       $game_system.battle_interpreter.setup(common_event.list, 0)
  1600.     end
  1601.     # 移至步骤 1
  1602.     @phase4_step = 1
  1603.   end
  1604. end
复制代码
梦石
0
星屑
42345
在线时间
6022 小时
注册时间
2006-11-10
回帖
6975
发表于 2022-4-26 10:05:21 | 显示全部楼层
本帖最后由 灯笼菜刀王 于 2022-4-26 10:07 编辑

原因, 一个萝卜一坑, 而技能动画有两个萝卜, 一般就是使用方插一根, 对象方插一根, 如果你要往一个坑里同时插两个萝卜, 那自然是后面的萝卜挤掉前面的, 所以就只播放对象方的动画

想把对象方和使用方的萝卜都插到一起, 有四种方法
1, 默认的做法:  两根萝卜不同时插, 一根插完换一根插
2, 改造坑, 让它能同时插两根萝卜
3, 改造萝卜, 让它能多个一起插
4, 去把两个萝卜合并到一起

点评

很懵  发表于 2022-4-27 21:40
你把楼主整懵了  发表于 2022-4-27 14:01
回复

使用道具 举报

梦石
0
星屑
2292
在线时间
195 小时
注册时间
2014-6-21
回帖
104
 楼主| 发表于 2022-4-27 12:05:34 | 显示全部楼层
灯笼菜刀王 发表于 2022-4-26 10:05
原因, 一个萝卜一坑, 而技能动画有两个萝卜, 一般就是使用方插一根, 对象方插一根, 如果你要往一个坑里同时 ...

可能是我没说明白 我还是截图吧

02 (2).png 04 (2).png 02 (1).png 04 (1).png

当给队友使用技能 有使用方的动画 当给自己使用技能没有使用方的动画

点评

怎么处理呢 ...  发表于 2022-4-27 21:42
其实菜刀大大说的就是你问题发生的原因,你这个是齐动画,行动方和对象方是同一个对象,所以就会出现后面的覆盖前面的。  发表于 2022-4-27 17:00
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部