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

Project1

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

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

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2050
在线时间
162 小时
注册时间
2014-6-21
帖子
120
跳转到指定楼层
1
发表于 2022-4-26 03:35:30 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

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

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

RUBY 代码复制
  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.  
  13.  
  14. #--------------------------------------------------------------------------
  15. #  ● 设定开始
  16. #--------------------------------------------------------------------------
  17. #伤害为0的时候是否显示无效文字,1为显示,0为不显示。
  18. INVALIDSWITCH = 1
  19.  
  20. # 是否显示死亡图 1为显示,0为不显示。
  21. DEADPIC = 1
  22.  
  23. # 是否显示总伤害 1为显示,0为不显示。
  24. SHOW_TOTAL_DAMAGE = 1
  25.  
  26. # 是否显示连击数值 1为显示,0为不显示。
  27. HITSWITCH = 1
  28.  
  29. # 是否显示SP伤害数值 1为显示,0为不显示。
  30. SDMGSWITCH = 1
  31.  
  32. # 不是主状态的时候是否稍稍降低点透明度  1为降低,0为不降低
  33. NACTSWITCH = 0
  34.  
  35. # 会心一击时的音效,不设置为不使用音效。
  36. CRIVOICE = "会心一击"
  37.  
  38. # 会心一击是否开启画面晃动 1为开启,0为关闭
  39. CRISHAKE = 1
  40.  
  41. # 会心一击是否开启画面闪烁,1为开启,0为关闭
  42. CRIFLASH = 1
  43.  
  44. # 攻击时不移动的属性编号 默认为29号 参考数据库的设置
  45. # 比如职业枪兵勾上了29号属性,那么当枪兵使用普通攻击时将不会移动。技能也是如此。
  46. UNMOVE = 29
  47.  
  48. # 攻击到与敌人同一水平线前的属性编号 默认为30号 参考数据库的设置
  49. HOMOVE = 30
  50.  
  51. ##################################################################
  52. module Scene_BattleName
  53.   # 设定移动速度
  54.   Move_Duration = 0
  55.   #设定人物的单帧图,如果不做设定,将直接使用默认的战斗图。
  56.   BattlerName = {
  57.   "吕莨" => {
  58.   "待机" => ["吕莨待机-1","吕莨待机-2","吕莨待机-1","吕莨待机-3"],
  59.   "移动" => [""],
  60.   "返回" => [""],
  61.   "受伤" => ["吕莨受伤"],
  62.   "防御" => ["吕莨防御"],
  63.   "死亡" => ["死亡"]
  64.   },
  65.  
  66.   "杜勇" => {
  67.   "待机" => ["杜勇待机-3","杜勇待机-1","杜勇待机-2","杜勇待机-1"],
  68.   "移动" => [""],
  69.   "返回" => [""],
  70.   "受伤" => ["杜勇受伤"],
  71.   "防御" => ["杜勇防御"],
  72.   "死亡" => ["死亡"]
  73.   },
  74.  
  75.   "野狼" => {
  76.   "待机" => ["野狼待机-1","野狼待机-2","野狼待机-1","野狼待机-3"],
  77.   "移动" => [""],
  78.   "返回" => [""],
  79.   "受伤" => ["野狼待机-1","野狼待机-2","野狼待机-1","野狼待机-3"],
  80.   "防御" => ["野狼待机-1","野狼待机-2","野狼待机-1","野狼待机-3"],
  81.   "死亡" => ["死亡"]
  82.   },
  83.  
  84.   "校尉统领" => {
  85.   "待机" => ["校尉统领待机-1","校尉统领待机-2","校尉统领待机-1","校尉统领待机-3"],
  86.   "移动" => [""],
  87.   "返回" => [""],
  88.   "受伤" => ["校尉统领待机-1","校尉统领待机-2","校尉统领待机-1","校尉统领待机-3"],
  89.   "防御" => ["校尉统领待机-1","校尉统领待机-2","校尉统领待机-1","校尉统领待机-3"],
  90.   "死亡" => ["死亡"]
  91.   },
  92.  
  93.   "枪兵" => {
  94.   "待机" => ["枪兵橙待机-1","枪兵橙待机-2","枪兵橙待机-1","枪兵橙待机-3"],
  95.   "移动" => [""],
  96.   "返回" => [""],
  97.   "受伤" => ["枪兵橙待机-1","枪兵橙待机-2","枪兵橙待机-1","枪兵橙待机-3"],
  98.   "防御" => ["枪兵橙待机-1","枪兵橙待机-2","枪兵橙待机-1","枪兵橙待机-3"],
  99.   "死亡" => ["死亡"]
  100.   },
  101.  
  102.   "阿蔡" => {
  103.   "待机" => ["阿蔡待机-2","阿蔡待机-1","阿蔡待机-3","阿蔡待机-1"],
  104.   "移动" => [""],
  105.   "返回" => [""],
  106.   "受伤" => ["阿蔡受伤"],
  107.   "防御" => ["阿蔡防御"],
  108.   "死亡" => ["死亡"]
  109.   },
  110.   }
  111. end
  112. #至于其它的:
  113.  
  114. #HP伤害数字间距偏移在602行修改。
  115.  
  116. #SP伤害数字间距偏移在667行修改。
  117.  
  118. #连击数字间距偏移在713行修改。
  119.  
  120. #总伤害数字间距偏移在759行修改。
  121.  
  122. #--------------------------------------------------------------------------
  123. #  ● 设定结束
  124. #--------------------------------------------------------------------------
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135. class Game_Battler
  136.   attr_accessor :movex                    # X坐标修正
  137.   attr_accessor :movey                    # Y坐标修正
  138.   attr_accessor :startactive              # 行为
  139.   attr_accessor :damage_sp                # 精神伤害值
  140.   alias bearrpg_initialize initialize
  141.   def initialize
  142.     bearrpg_initialize
  143.     @damage_sp = 0
  144.     @movex = 0
  145.     @movey = 0
  146.     @startactive = "待机"
  147.   end
  148.   def width #获取战斗图宽
  149.     return RPG::Cache.battler(@battler_name, @battler_hue).width
  150.   end
  151.   def height #获取战斗图高
  152.     return RPG::Cache.battler(@battler_name, @battler_hue).height
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 应用通常攻击效果
  156.   #     attacker : 攻击者 (battler)
  157.   #--------------------------------------------------------------------------
  158.   def attack_effect(attacker)
  159.     # 清除会心一击标志
  160.     self.critical = false
  161.     #######伤害开关初始化##################################################bearrpg
  162.     $damage_hp = false
  163.     $damage_sp = false
  164.     # 第一命中判定
  165.     hit_result = (rand(100) < attacker.hit)
  166.     # 命中的情况下
  167.     if hit_result == true
  168.       # 计算基本伤害
  169.       atk = [attacker.atk - self.pdef / 2, 0].max
  170.       self.damage = atk * (20 + attacker.str) / 20
  171.       # 属性修正
  172.       self.damage *= elements_correct(attacker.element_set)
  173.       self.damage /= 100
  174.       # 伤害符号正确的情况下
  175.       if self.damage > 0
  176.         # 会心一击修正
  177.         if rand(100) < 4 * attacker.dex / self.agi
  178.           self.damage *= 2
  179.           self.critical = true
  180.         end
  181.         # 防御修正
  182.         if self.guarding?
  183.           self.damage /= 2
  184.         end
  185.       end
  186.       $damage_hp = true if self.damage.is_a?(Numeric)
  187.     #  $damage_sp = true if self.damage_sp != 0 SP伤害数值开关
  188.       # 分散
  189.       if self.damage.abs > 0
  190.         amp = [self.damage.abs * 15 / 100, 1].max
  191.         self.damage += rand(amp+1) + rand(amp+1) - amp
  192.       end
  193.       # 第二命中判定
  194.       eva = 8 * self.agi / attacker.dex + self.eva
  195.       hit = self.damage < 0 ? 100 : 100 - eva
  196.       hit = self.cant_evade? ? 100 : hit
  197.       hit_result = (rand(100) < hit)
  198.     end
  199.     #####################################bearrpg
  200.     # 命中的情况下
  201.     if hit_result == true
  202.       # 状态冲击解除
  203.       remove_states_shock
  204.       # HP 的伤害计算
  205.       self.hp -= self.damage
  206.       # 状态变化
  207.       @state_changed = false
  208.       states_plus(attacker.plus_state_set)
  209.       states_minus(attacker.minus_state_set)
  210.       if self.damage == 0
  211.            self.damage = "无效" if INVALIDSWITCH >0
  212.          self.critical = false
  213.        end
  214.     # Miss 的情况下
  215.     else
  216.       # 伤害设置为 "Miss"
  217.       self.damage = "Miss"
  218.       # 清除会心一击标志
  219.       self.critical = false
  220.     end
  221.     # 过程结束
  222.     return true
  223.   end
  224.   #############################################bearrpg
  225.   #--------------------------------------------------------------------------
  226.   # ● 应用特技效果
  227.   #     user  : 特技的使用者 (battler)
  228.   #     skill : 特技
  229.   #--------------------------------------------------------------------------
  230.   def skill_effect(user, skill)
  231.     #######伤害开关初始化##################################################bearrpg
  232.     $damage_hp = false
  233.     $damage_sp = false
  234.     # 清除会心一击标志
  235.     self.critical = false
  236.     # 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  237.     # 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  238.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  239.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  240.       # 过程结束
  241.       return false
  242.     end
  243.     # 清除有效标志
  244.     effective = false
  245.     # 公共事件 ID 是有效的情况下,设置为有效标志
  246.     effective |= skill.common_event_id > 0
  247.     # 第一命中判定
  248.     hit = skill.hit
  249.     if skill.atk_f > 0
  250.       hit *= user.hit / 100
  251.     end
  252.     hit_result = (rand(100) < hit)
  253.     # 不确定的特技的情况下设置为有效标志
  254.     effective |= hit < 100
  255.     # 命中的情况下
  256.     if hit_result == true
  257.       # 计算威力
  258.       power = skill.power + user.atk * skill.atk_f / 100
  259.       if power > 0
  260.         power -= self.pdef * skill.pdef_f / 200
  261.         power -= self.mdef * skill.mdef_f / 200
  262.         power = [power, 0].max
  263.       end
  264.       # 计算倍率
  265.       rate = 20
  266.       rate += (user.str * skill.str_f / 100)
  267.       rate += (user.dex * skill.dex_f / 100)
  268.       rate += (user.agi * skill.agi_f / 100)
  269.       rate += (user.int * skill.int_f / 100)
  270.       # 计算基本伤害
  271.       self.damage = power * rate / 20
  272.       # 属性修正
  273.       self.damage *= elements_correct(skill.element_set)
  274.       self.damage /= 100
  275.       # 伤害符号正确的情况下
  276.       if self.damage > 0
  277.         # 防御修正
  278.         if self.guarding?
  279.           self.damage /= 2
  280.         end
  281.       end
  282.       # 分散
  283.       if skill.variance > 0 and self.damage.abs > 0
  284.         amp = [self.damage.abs * skill.variance / 100, 1].max
  285.         self.damage += rand(amp+1) + rand(amp+1) - amp
  286.       end
  287.       # 第二命中判定
  288.       eva = 8 * self.agi / user.dex + self.eva
  289.       hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  290.       hit = self.cant_evade? ? 100 : hit
  291.       hit_result = (rand(100) < hit)
  292.       # 不确定的特技的情况下设置为有效标志
  293.       effective |= hit < 100
  294.     end
  295.     $damage_hp = true if self.damage.is_a?(Numeric)
  296.    # $damage_sp = true if self.damage_sp != 0 SP伤害数值开关
  297.     # 命中的情况下
  298.     if hit_result == true
  299.       # 威力 0 以外的物理攻击的情况下
  300.       if skill.power != 0 and skill.atk_f > 0
  301.         # 状态冲击解除
  302.         remove_states_shock
  303.         # 设置有效标志
  304.         effective = true
  305.       end
  306.       # HP 的伤害减法运算
  307.       last_hp = self.hp
  308.       self.hp -= self.damage
  309.       effective |= self.hp != last_hp
  310.       # 状态变化
  311.       @state_changed = false
  312.       effective |= states_plus(skill.plus_state_set)
  313.       effective |= states_minus(skill.minus_state_set)
  314.       #############################################bearrpg
  315.       # 威力为 0 的场合
  316.       if skill.power == 0
  317.         # 伤害设置为空的字串
  318.         self.damage = ""
  319.         # 状态没有变化的情况下
  320.         unless @state_changed
  321.           # 伤害设置为 "Miss"
  322.           self.damage = "Miss"
  323.         end
  324.       elsif self.damage == 0
  325.         unless @state_changed
  326.            self.damage = "无效" if INVALIDSWITCH >0
  327.          else
  328.           self.damage = ""
  329.         end
  330.       end
  331.     # Miss 的情况下
  332.     else
  333.       # 伤害设置为 "Miss"
  334.       self.damage = "Miss"
  335.     end
  336.     # 不在战斗中的情况下
  337.     unless $game_temp.in_battle
  338.       # 伤害设置为 nil
  339.       self.damage = nil
  340.     end
  341.     # 过程结束
  342.     return effective
  343.   end
  344.   #############################################bearrpg
  345.   #--------------------------------------------------------------------------
  346.   # ● 应用物品效果
  347.   #     item : 物品
  348.   #--------------------------------------------------------------------------
  349.   def item_effect(item)
  350.     # 清除会心一击标志
  351.     self.critical = false
  352.     # 物品的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  353.     # 或者物品的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  354.     if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
  355.        ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  356.       # 过程结束
  357.       return false
  358.     end
  359.     # 清除有效标志
  360.     effective = false
  361.     # 公共事件 ID 是有效的情况下,设置为有效标志
  362.     effective |= item.common_event_id > 0
  363.     # 命中判定
  364.     hit_result = (rand(100) < item.hit)
  365.     # 不确定的特技的情况下设置为有效标志
  366.     effective |= item.hit < 100
  367.     # 命中的情况
  368.     if hit_result == true
  369.       # 计算回复量
  370.       recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
  371.       recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
  372.       if recover_hp < 0
  373.         recover_hp += self.pdef * item.pdef_f / 20
  374.         recover_hp += self.mdef * item.mdef_f / 20
  375.         recover_hp = [recover_hp, 0].min
  376.       end
  377.       # 属性修正
  378.       recover_hp *= elements_correct(item.element_set)
  379.       recover_hp /= 100
  380.       recover_sp *= elements_correct(item.element_set)
  381.       recover_sp /= 100
  382.       # 分散
  383.       if item.variance > 0 and recover_hp.abs > 0
  384.         amp = [recover_hp.abs * item.variance / 100, 1].max
  385.         recover_hp += rand(amp+1) + rand(amp+1) - amp
  386.       end
  387.       if item.variance > 0 and recover_sp.abs > 0
  388.         amp = [recover_sp.abs * item.variance / 100, 1].max
  389.         recover_sp += rand(amp+1) + rand(amp+1) - amp
  390.       end
  391.       # 回复量符号为负的情况下
  392.       if recover_hp < 0
  393.         # 防御修正
  394.         if self.guarding?
  395.           recover_hp /= 2
  396.         end
  397.       end
  398.       # HP 回复量符号的反转、设置伤害值
  399.       self.damage = -recover_hp
  400.       self.damage_sp = -recover_sp  
  401.       # HP 以及 SP 的回复
  402.       last_hp = self.hp
  403.       last_sp = self.sp
  404.       self.hp += recover_hp
  405.       self.sp += recover_sp
  406.       ###################################################################bearrpg
  407.       $damage_hp = true if self.damage.is_a?(Numeric)
  408.       $damage_sp = true if self.damage_sp.is_a?(Numeric) and recover_sp != 0
  409.       ###################################################################bearrpg
  410.       effective |= self.hp != last_hp
  411.       effective |= self.sp != last_sp
  412.       # 状态变化
  413.       @state_changed = false
  414.       effective |= states_plus(item.plus_state_set)
  415.       effective |= states_minus(item.minus_state_set)
  416.       # 能力上升值有效的情况下
  417.       if item.parameter_type > 0 and item.parameter_points != 0
  418.         # 能力值的分支
  419.         case item.parameter_type
  420.         when 1  # MaxHP
  421.           @maxhp_plus += item.parameter_points
  422.         when 2  # MaxSP
  423.           @maxsp_plus += item.parameter_points
  424.         when 3  # 力量
  425.           @str_plus += item.parameter_points
  426.         when 4  # 灵巧
  427.           @dex_plus += item.parameter_points
  428.         when 5  # 速度
  429.           @agi_plus += item.parameter_points
  430.         when 6  # 魔力
  431.           @int_plus += item.parameter_points
  432.         end
  433.         # 设置有效标志
  434.         effective = true
  435.       end
  436.       # HP 回复率与回复量为 0 的情况下
  437.       if item.recover_hp_rate == 0 and item.recover_hp == 0
  438.         # 设置伤害为空的字符串
  439.         self.damage = ""
  440.         # SP 回复率与回复量为 0、能力上升值无效的情况下
  441.         if item.recover_sp_rate == 0 and item.recover_sp == 0 and
  442.            (item.parameter_type == 0 or item.parameter_points == 0)
  443.           # 状态没有变化的情况下
  444.           unless @state_changed
  445.             # 伤害设置为 "Miss"
  446.             self.damage = "Miss"
  447.           end
  448.         end
  449.       end
  450.     # Miss 的情况下
  451.     else
  452.       # 伤害设置为 "Miss"
  453.       self.damage = "Miss"
  454.     end
  455.     # 不在战斗中的情况下
  456.     unless $game_temp.in_battle
  457.       # 伤害设置为 nil
  458.       self.damage = nil
  459.     end
  460.     # 过程结束
  461.     return effective
  462.   end
  463. end
  464.  
  465. #############################################################################
  466. #                                横版修改   
  467. #改角色的坐标#
  468. ###注意,此处虽然按照5人制改了坐标,但是因为前面未设置,所以无效
  469.  
  470. #############################################################################
  471. class Game_Actor < Game_Battler
  472.  
  473. #--------------------------------------------------------------------------
  474.   # ● 取得战斗画面的 X 坐标
  475.   #--------------------------------------------------------------------------
  476.   def screen_x
  477.     case self.index  
  478.     when 0
  479.        return 414
  480.        #角色1的横坐标
  481.       when 1
  482.        return 414
  483.        #角色2的横坐标
  484.       when 2
  485.        return 506
  486.        #角色3的横坐标
  487.       when 3
  488.        return 506
  489.        #角色4的横坐标
  490.       when 4
  491.        return 468
  492.        #角色4的横坐标
  493.     else
  494.       return 640
  495.     end
  496.   end
  497.   #----
  498.   #--------------------------------------------------------------------------
  499.   # ● 取得战斗画面的 Y 坐标
  500.   #--------------------------------------------------------------------------
  501.   def screen_y
  502.     # 返回计算后的队伍 Y 坐标的排列顺序
  503.     case self.index  
  504.     when 0
  505.        return 216
  506.        #角色1的纵坐标
  507.       when 1
  508.        return 296
  509.        #角色2的纵坐标
  510.       when 2
  511.        return 192
  512.        #角色3的纵坐标
  513.       when 3
  514.        return 320
  515.        #角色4的纵坐标
  516.       when 4
  517.        return 256
  518.        #角色4的纵坐标
  519.     else
  520.       return 1000320
  521.     end
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ● 取得战斗画面的 Z 坐标
  525.   #--------------------------------------------------------------------------
  526.   def screen_z
  527.     # 返回计算后的队伍 Z 坐标的排列顺序
  528.     case self.index
  529.     when 0
  530.       return 100
  531.     when 1
  532.       return 110
  533.     when 2
  534.       return 120
  535.     when 3
  536.       return 130
  537.     when 4
  538.       return 140
  539.     else
  540.       return 0
  541.     end
  542.   end
  543. end
  544.  
  545. class Scene_Battle
  546.  
  547. #--------------------------------------------------------------------------
  548.   # ● 取得战斗画面的 X 坐标
  549.   #--------------------------------------------------------------------------
  550.   def screen_x
  551.     # 返回计算后的队伍 X 坐标的排列顺序
  552.     if self.index != nil
  553.       #......................................................................
  554.       return self.index * 90 + 500
  555.       #......................................................................
  556.     else
  557.       return 0
  558.     end
  559.   end
  560.   #--------------------------------------------------------------------------
  561.   # ● 取得战斗画面的 Y 坐标
  562.   #--------------------------------------------------------------------------
  563.   def screen_y
  564.     #........................................................................
  565.     return 464 - self.index * 110
  566.     #........................................................................
  567.   end
  568.    #--------------------------------------------------------------------------
  569.   # ● 取得战斗画面的 Z 坐标
  570.   #--------------------------------------------------------------------------
  571.   def screen_z
  572.     # 返回计算后的队伍 Z 坐标的排列顺序
  573.     case self.index
  574.     when 0
  575.       return 100
  576.     when 1
  577.       return 90
  578.     when 2
  579.       return 80
  580.     when 3
  581.       return 70
  582.     when 4
  583.       return 60
  584.     else
  585.       return 0
  586.     end
  587.   end
  588. end
  589.  
  590. ###########################################################
  591. class Sprite_Battler
  592.   include Scene_BattleName
  593. end
  594. module RPG
  595. class Sprite < ::Sprite
  596. #==========================================
  597. def initialize(viewport = nil)
  598. super(viewport)
  599. @_whiten_duration = 0
  600. @_appear_duration = 0
  601. @_escape_duration = 0
  602. @_collapse_duration = 0
  603. @_damage_duration = 0
  604. @_animation_duration = 0
  605. @_blink = false  
  606. @flash_shake = 0
  607. @_damage = []  
  608. @_damage_sp = []
  609. @_total_damage = 0
  610. @_total_damage_duration = 0
  611. @p_dam=0
  612. @hits=0
  613. end
  614. def animation_set_sprites(sprites, cell_data, position)
  615.    for i in 0..15
  616.    sprite = sprites[i]
  617.    pattern = cell_data[i, 0]
  618.    if sprite == nil or pattern == nil or pattern == -1
  619.      sprite.visible = false if sprite != nil
  620.      next
  621.    end
  622.    sprite.visible = true
  623.    sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  624.    if position == 3
  625.      if self.viewport != nil
  626.        sprite.x = self.viewport.rect.width / 2
  627.        sprite.y = self.viewport.rect.height - 160
  628.      else
  629.        sprite.x = 320
  630.        sprite.y = 240
  631.      end
  632.      else
  633.      sprite.x = self.x - self.ox + self.src_rect.width / 2
  634.      sprite.y = self.y - self.oy + self.src_rect.height / 2
  635.      sprite.y -= self.src_rect.height / 4 if position == 0
  636.      sprite.y += self.src_rect.height / 4 if position == 2
  637.    end
  638.    sprite.x += cell_data[i, 1]
  639.    sprite.y += cell_data[i, 2]
  640.    if $scene.is_a?(Scene_Battle)
  641.    sprite.z = battler.screen_z+20
  642. else
  643.    sprite.z = 9990
  644.    end
  645.    sprite.ox = 96
  646.    sprite.oy = 96
  647.    sprite.zoom_x = cell_data[i, 3] / 100.0
  648.    sprite.zoom_y = cell_data[i, 3] / 100.0
  649.    sprite.angle = cell_data[i, 4]
  650.    sprite.mirror = (cell_data[i, 5] == 1)
  651.    sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  652.    sprite.blend_type = cell_data[i, 7]
  653.    end
  654. end
  655. def damage(value, critical)
  656.   dispose_hit
  657.     if value.is_a?(Numeric)
  658.       damage_string = value.abs.to_s
  659.     else
  660.       damage_string = value.to_s
  661.     end
  662.     bitmap = Bitmap.new(300, 150)
  663.     bitmap.font.name = ["黑体","华文行楷", "宋体"]
  664.     bitmap.font.size = 32
  665.     if value.is_a?(Numeric)
  666.   # 分割伤害值字符串
  667.       damage_array = damage_string.scan(/./)
  668.       damage_x = 81 - damage_string.size * 9
  669.   # 会心一击标志打开的情况
  670.       if critical and value != "无效"
  671.   # 显示会心一击图画
  672.         cri_bitmap = RPG::Cache.picture("Critital")
  673.         bitmap.blt(damage_x+cri_bitmap.width, cri_bitmap.height*2, cri_bitmap, Rect.new(0, 0, cri_bitmap.width, cri_bitmap.height))
  674.         Audio.se_play("Audio/SE/"+CRIVOICE,100,100) if CRIVOICE != nil and CRIVOICE != ""
  675.         $game_screen.start_flash(Color.new(255, 5, 5, 155), 5) if CRIFLASH >0
  676.         $game_screen.start_shake(2,9,3) if CRISHAKE >0
  677.       end
  678.   # 伤害值为负的情况下
  679.     dmg_bitmap = RPG::Cache.picture("Normal_Damage")
  680.       if value < 0
  681.   # 调用回复数字表
  682.         bitmap.blt(damage_x-14, 32,dmg_bitmap,Rect.new(dmg_bitmap.width/12*10, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  683.       else
  684.   # 调用伤害数字表
  685.         bitmap.blt(damage_x-14, 32, dmg_bitmap,Rect.new(dmg_bitmap.width/12*11, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  686.       end
  687.   # 循环伤害值字符串
  688.       for char in damage_array
  689.         number = char.to_i
  690.   # 显示伤害数字
  691.         bitmap.blt(damage_x, 32, dmg_bitmap,
  692.         Rect.new(number * dmg_bitmap.width/12, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  693. #################################################################普通伤害数值
  694.         damage_x += dmg_bitmap.width/12 - 4#间距缩小4个像素,可以自行调整
  695. #################################################################普通伤害数值
  696.       end  
  697.     else
  698.       if value == "Miss"
  699.         miss_dmg = RPG::Cache.picture("miss")
  700.         bitmap.blt(miss_dmg.width, 0,miss_dmg, Rect.new(0, 0, miss_dmg.width, miss_dmg.height))
  701.       elsif value == "无效"
  702.         invalid_dmg = RPG::Cache.picture("invalid")
  703.         bitmap.blt(invalid_dmg.width, 0,invalid_dmg, Rect.new(0, 0, invalid_dmg.width,invalid_dmg.height))
  704.       #end
  705.       end
  706.     end
  707. # 伤害值定位
  708.     @_damage_sprite = ::Sprite.new(self.viewport)
  709.     @_damage_sprite.bitmap = bitmap
  710.     @_damage_sprite.ox = 80
  711.     @_damage_sprite.oy = 20
  712.     @_damage_sprite.x = self.x
  713.     @_damage_sprite.y = self.y - self.oy / 2
  714.     @_damage_sprite.z = 3000
  715.     @_damage_duration = 40
  716.     @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  717.     make_total_damage(value)
  718.   end
  719. ##################################################################sp伤害数值
  720. def damage_sp(value, critical)
  721.   dispose_hit
  722.     if value.is_a?(Numeric)
  723.       damage_string = value.abs.to_s
  724.     else
  725.       damage_string = value.to_s
  726.     end
  727.     bitmap = Bitmap.new(300, 150)
  728.     bitmap.font.name = ["黑体","华文行楷", "宋体"]
  729.     bitmap.font.size = 32
  730.     if value.is_a?(Numeric)
  731.   # 分割伤害值字符串
  732.       damage_array = damage_string.scan(/./)
  733.       damage_x = 81 - damage_string.size * 9
  734.   # 会心一击标志打开的情况
  735.       if critical and value != "无效"
  736.   # 显示会心一击图画
  737.         cri_bitmap = RPG::Cache.picture("Critital")
  738.         bitmap.blt(damage_x+cri_bitmap.width, cri_bitmap.height*2, cri_bitmap, Rect.new(0, 0, cri_bitmap.width, cri_bitmap.height))
  739.         Audio.se_play("Audio/SE/"+CRIVOICE,100,100) if CRIVOICE != nil and CRIVOICE != ""
  740.         $game_screen.start_flash(Color.new(255, 5, 5, 155), 5) if CRIFLASH >0
  741.         $game_screen.start_shake(2,9,3) if CRISHAKE >0
  742.       end
  743.   # 伤害值为负的情况下
  744.     dmg_bitmap = RPG::Cache.picture("Normal_Damage")
  745.       if value < 0
  746.   # 调用回复数字表
  747.         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))
  748.       else
  749.   # 调用伤害数字表
  750.         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))
  751.       end
  752.   # 循环伤害值字符串
  753.       for char in damage_array
  754.         number = char.to_i
  755.   # 显示伤害数字
  756.         bitmap.blt(damage_x, 32, dmg_bitmap,
  757.         Rect.new(number * dmg_bitmap.width/12, dmg_bitmap.height/2, dmg_bitmap.width/12, dmg_bitmap.height/2))
  758. #################################################################普通伤害数值
  759.         damage_x += dmg_bitmap.width/12 - 4#间距缩小4个像素,可以自行调整
  760. #################################################################普通伤害数值
  761.       end  
  762.     else
  763.       if value == "Miss"
  764.         miss_dmg = RPG::Cache.picture("miss")
  765.         bitmap.blt(miss_dmg.width, 0,miss_dmg, Rect.new(0, 0, miss_dmg.width, miss_dmg.height))
  766.       elsif value == "无效"
  767.         invalid_dmg = RPG::Cache.picture("invalid")
  768.         bitmap.blt(invalid_dmg.width, 0,invalid_dmg, Rect.new(0, 0, invalid_dmg.width,invalid_dmg.height))
  769.       #end
  770.       end
  771.     end
  772. # 伤害值定位
  773.     @_damage_sprite = ::Sprite.new(self.viewport)
  774.     @_damage_sprite.bitmap = bitmap
  775.     @_damage_sprite.ox = 80
  776.     @_damage_sprite.oy = 20
  777.     @_damage_sprite.x = self.x
  778.     @_damage_sprite.y = self.y - self.oy / 2
  779.     @_damage_sprite.z = 3000
  780.     @_damage_duration = 40
  781.     @_damage_sp.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  782.    # make_total_damage(value)
  783.   end  
  784. def hit
  785. # 如果伤害值是数值
  786. # 转为字符串
  787. value=@hits
  788. hits_string = value.to_s
  789. # 初始化位图
  790. bitmap = Bitmap.new(320, 64)
  791. bitmap.font.name = "Arial Black"
  792. bitmap.font.size = 32
  793. # 分割伤害值字符串
  794. hits_array = hits_string.scan(/./)
  795. hits_x = 81 - hits_string.size * 18.1
  796. rect_y = 0
  797. # 循环伤害值字符串
  798. for char in hits_array
  799. number = char.to_i
  800. # 显示伤害数字
  801. combo_num = RPG::Cache.picture("combo_num")
  802. bitmap.blt(hits_x, 0, combo_num,
  803. Rect.new(number * combo_num.width/10, 0, combo_num.width/10, combo_num.height))
  804. #################################################################连击数数值
  805. hits_x += combo_num.width/10 - 3#间距缩小3个像素,可以自行调整
  806. #################################################################连击数数值
  807. end
  808. combo_tx = RPG::Cache.picture("combo_text")
  809. bitmap.blt(hits_x, 0,combo_tx ,
  810. Rect.new(0, 0, combo_tx.width, combo_tx.height))
  811. # 伤害值定位
  812. @_hits_sprite = ::Sprite.new(self.viewport)
  813. @_hits_sprite.bitmap = bitmap
  814. @_hits_sprite.ox = 81
  815. @_hits_sprite.oy = 20
  816. @_hits_sprite.x = 500
  817. @_hits_sprite.y = 100
  818. @_hits_sprite.opacity = HITSWITCH > 0 ? 255 : 0
  819. @_hits_sprite.z = 3000
  820. @_hits_duration = 40
  821. end
  822. #--------------------------------------------------------------------------
  823. # ● 总伤害处理
  824. #--------------------------------------------------------------------------
  825. def make_total_damage(value)
  826. if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE > 0
  827. @_total_damage += value
  828. # 绝对值转为字符串
  829. damage_string = @_total_damage.abs.to_s
  830. else
  831. return
  832. end
  833. # 初始化位图
  834. bitmap = Bitmap.new(350, 150)
  835. bitmap.font.name = "Arial Black"
  836. bitmap.font.size = 32
  837. # 伤害值是数值的情况下
  838. if value.is_a?(Numeric)
  839. # 分割伤害值字符串
  840. damage_array = damage_string.scan(/./)
  841. damage_x = 40 - damage_string.size * 9
  842. # 伤害值为负的情况下
  843. name=RPG::Cache.picture("total_damage")
  844. # 循环伤害值字符串
  845. for char in damage_array
  846. number = char.to_i
  847. # 显示伤害数字
  848. bitmap.blt(damage_x, 0, name,
  849. Rect.new(number * name.width/10, 0, name.width/10, name.height))
  850. #################################################################总伤害数值
  851. damage_x += name.width/10 - 3 #间距缩小3个像素,可以自行调整
  852. #################################################################总伤害数值
  853. end
  854. end
  855. if @_total_damage_sprite.nil?
  856. @_total_damage_sprite = ::Sprite.new(self.viewport)
  857. @_total_damage_sprite.ox = 80
  858. @_total_damage_sprite.oy = 40
  859. @_total_damage_sprite.z = 3000
  860. end
  861. @_total_damage_sprite.bitmap = bitmap
  862. @_total_damage_sprite.zoom_x = 1.0
  863. @_total_damage_sprite.zoom_y = 1.0
  864. @_total_damage_sprite.x = self.x
  865. @_total_damage_sprite.y = self.y - self.oy / 2
  866. @_total_damage_sprite.z = 3001
  867. @_total_damage_duration = 80
  868. #hit数描绘
  869. @hits+=1
  870. if @_total_damage > 0
  871.   hit
  872. end
  873. end
  874. def animation(animation, hit, battler_damage="", battler_damage_sp="",battler_critical=false)
  875. dispose_animation
  876. @battler_damage = battler_damage
  877. @battler_damage_sp = battler_damage_sp
  878. @battler_critical = battler_critical
  879. @_animation = animation
  880. return if @_animation == nil
  881. @_animation_hit = hit
  882. @_animation_duration = @_animation.frame_max
  883. animation_name = @_animation.animation_name
  884. animation_hue = @_animation.animation_hue
  885. bitmap = RPG::Cache.animation(animation_name, animation_hue)
  886. for timing in @_animation.timings
  887. quanzhong = animation_process_timing(timing, @_animation_hit,true)
  888. @all_quanzhong += quanzhong
  889. @_last_frame = timing.frame if quanzhong != 0
  890. end
  891. if @@_reference_count.include?(bitmap)
  892. @@_reference_count[bitmap] += 1
  893. else
  894. @@_reference_count[bitmap] = 1
  895. end  
  896. if $scene.is_a?(Scene_Battle)
  897. if $scene.animation1_id == @battler.animation_id
  898. @battler_damage = ""
  899. @battler_damage_sp = ""
  900. end
  901. end
  902. @_animation_sprites = []
  903. if @_animation.position != 3 or not @@_animations.include?(animation)
  904. for i in 0..15
  905. sprite = ::Sprite.new(self.viewport)
  906. sprite.bitmap = bitmap
  907. sprite.visible = false
  908. @_animation_sprites.push(sprite)
  909. end
  910. unless @@_animations.include?(animation)
  911. @@_animations.push(animation)
  912. end
  913. end
  914. update_animation
  915. end  
  916. def dispose_damage
  917. for damage in @_damage.reverse
  918. damage[0].bitmap.dispose
  919. damage[0].dispose
  920. @_damage.delete(damage)
  921. end
  922. for damage_sp in @_damage_sp.reverse
  923. damage_sp[0].bitmap.dispose
  924. damage_sp[0].dispose
  925. @_damage_sp.delete(damage_sp)
  926. end
  927. @_total_damage = 0
  928. @_last_frame = -1
  929. if @_total_damage_sprite != nil
  930. @_total_damage_duration = 0
  931. @_total_damage_sprite.bitmap.dispose
  932. @_total_damage_sprite.dispose
  933. @_total_damage_sprite = nil
  934. end
  935. end
  936. def dispose_hit
  937. if @_hits_sprite != nil
  938. @_hits_sprite.bitmap.dispose
  939. @_hits_sprite.dispose
  940. @_hits_sprite = nil
  941. end
  942. end
  943. def dispose_animation
  944. @battler_damage = nil
  945. @battler_damage_sp = nil
  946. @battler_critical = nil
  947. @all_quanzhong = 1
  948. @_total_damage = 0
  949. @_last_frame = -1
  950. if @_animation_sprites != nil
  951. sprite = @_animation_sprites[0]
  952. if sprite != nil
  953. @@_reference_count[sprite.bitmap] -= 1
  954. if @@_reference_count[sprite.bitmap] == 0
  955. sprite.bitmap.dispose
  956. end
  957. end
  958. for sprite in @_animation_sprites
  959. sprite.dispose
  960. end
  961. @_animation_sprites = nil
  962. @_animation = nil
  963. end
  964. end
  965. def update
  966. super
  967. if @_whiten_duration > 0
  968. @_whiten_duration -= 1
  969. self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  970. end
  971. if @_appear_duration > 0
  972. @_appear_duration -= 1
  973. self.opacity = (16 - @_appear_duration) * 16
  974. end
  975. if @_escape_duration > 0
  976. @_escape_duration -= 1
  977. self.opacity = 256 - (32 - @_escape_duration) * 10
  978. end
  979. if @_collapse_duration > 0
  980. @_collapse_duration -= 1
  981. self.opacity = 256 - (48 - @_collapse_duration) * 6
  982. end
  983. if @_damage_duration > 0
  984. @_damage_duration -= 1
  985. for damage in @_damage
  986. damage[0].x = self.x + self.viewport.rect.x -
  987. self.ox + self.src_rect.width / 2 +
  988. (40 - damage[1]) * damage[3] / 10
  989. damage[0].y -= damage[4]+damage[1]/10
  990. damage[0].opacity = damage[1]*20
  991. damage[1] -= 1
  992. if damage[1]==0
  993. damage[0].bitmap.dispose
  994. damage[0].dispose
  995. @_damage.delete(damage)
  996. next
  997. end
  998. end
  999. for damage_sp in @_damage_sp
  1000. damage_sp[0].x = self.x + self.viewport.rect.x -
  1001. self.ox + self.src_rect.width / 2 +
  1002. (40 - damage_sp[1]) * damage_sp[3] / 10
  1003. damage_sp[0].y -= damage_sp[4]+damage_sp[1]/10
  1004. damage_sp[0].opacity = damage_sp[1]*20
  1005. damage_sp[1] -= 1
  1006. if damage_sp[1]==0
  1007. damage_sp[0].bitmap.dispose
  1008. damage_sp[0].dispose
  1009. @_damage_sp.delete(damage_sp)
  1010. next
  1011. end
  1012. end
  1013. end
  1014. if @_total_damage_duration > 0
  1015. @_total_damage_duration -= 1
  1016. @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
  1017. if @_total_damage_sprite.zoom_x > 1.0
  1018. @_total_damage_sprite.zoom_x -= 0.05
  1019. end
  1020. if @_total_damage_sprite.zoom_y > 1.0
  1021. @_total_damage_sprite.zoom_y -= 0.05
  1022. end
  1023. @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
  1024. if @_total_damage_duration <= 0
  1025. dispose_hit
  1026. @_total_damage = 0
  1027. @_total_damage_duration = 0
  1028. @_total_damage_sprite.bitmap.dispose
  1029. @_total_damage_sprite.dispose
  1030. @_total_damage_sprite = nil
  1031. end
  1032. end
  1033. #=======================================
  1034.     if @_animation != nil and (Graphics.frame_count % 2 == 0)
  1035.       @_animation_duration -= 1
  1036.       update_animation
  1037.     end
  1038.   if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  1039.       update_loop_animation
  1040.       @_loop_animation_index += 1
  1041.       @_loop_animation_index %= @_loop_animation.frame_max
  1042.     end
  1043.   if @_blink
  1044.     @_blink_count = (@_blink_count + 1) % 32
  1045.       if @_blink_count < 16
  1046.         alpha = (16 - @_blink_count) * 6
  1047.       else
  1048.         alpha = (@_blink_count - 16) * 6
  1049.       end
  1050.       self.color.set(255, 255, 255, alpha)
  1051.     end
  1052.     @@_animations.clear
  1053.   end
  1054. def update_animation
  1055.   if @_animation_duration > 0
  1056.     frame_index = @_animation.frame_max - @_animation_duration
  1057.     cell_data = @_animation.frames[frame_index].cell_data
  1058.     position = @_animation.position
  1059.     animation_set_sprites(@_animation_sprites, cell_data, position)
  1060.       for timing in @_animation.timings
  1061.         if timing.frame == frame_index
  1062.           t = 1.0 * animation_process_timing(timing, @_animation_hit)
  1063.           ts = 1.0 * animation_process_timing(timing, @_animation_hit)
  1064.           if timing.se.name != ""
  1065.             se=timing.se
  1066.             Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  1067.           end
  1068.           if @battler_damage.is_a?(Numeric) and t != 0
  1069.             if @battler.guarding?
  1070.               @battler.startactive = "防御" if @battler_damage > 0
  1071.            else
  1072.               @battler.startactive = "受伤" if @battler_damage > 0
  1073.             end
  1074.             t *= @battler_damage
  1075.             t /= @all_quanzhong
  1076.             ts *= @battler_damage_sp
  1077.             ts /= @all_quanzhong
  1078.             t = t.to_i
  1079.             ts = ts.to_i
  1080.   if frame_index != @_last_frame
  1081.     @p_dam+= t
  1082.   end
  1083.       if frame_index == @_last_frame
  1084.         t=@battler_damage-@p_dam
  1085.       end
  1086.     if frame_index == @_last_frame
  1087.       @_total_damage = @battler_damage - t
  1088.       @p_dam=0
  1089.     end
  1090.       damage(t,@battler_critical) if $damage_hp == true
  1091.       damage_sp(ts,@battler_critical) if $damage_sp == true
  1092.     if frame_index == @_last_frame
  1093.       @hits=0
  1094.      end
  1095.       elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  1096.         damage(@battler_damage,@battler_critical)
  1097.         damage_sp(@battler_damage_sp,@battler_critical) if $damage_sp == true
  1098.        end
  1099.       end
  1100.       end
  1101.     else
  1102.       dispose_animation
  1103.     end
  1104.   end
  1105. def animation_process_timing(timing, hit,dontflash=false)
  1106.   if (timing.condition == 0) or
  1107.     (timing.condition == 1 and hit == true) or
  1108.     (timing.condition == 2 and hit == false)
  1109.   case timing.flash_scope
  1110.     when 1
  1111.       unless dontflash
  1112.         self.flash(timing.flash_color, timing.flash_duration * 2)
  1113.         if @_total_damage >0
  1114.           @flash_shake_switch = true
  1115.           @flash_shake = 10
  1116.         end
  1117.       end
  1118.       return timing.flash_color.alpha * timing.flash_duration
  1119.     when 2
  1120.       unless dontflash
  1121.         if self.viewport != nil
  1122.           self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  1123.         end
  1124.       end
  1125.       return timing.flash_color.alpha * timing.flash_duration
  1126.     when 3
  1127.       unless dontflash
  1128.         self.flash(nil, timing.flash_duration * 2)
  1129.       end
  1130.         return timing.flash_color.alpha * timing.flash_duration
  1131.       end
  1132.     end
  1133.       return 0
  1134.     end
  1135.   end
  1136. end
  1137.  
  1138. class Sprite_Battler < RPG::Sprite
  1139.   def initialize(viewport, battler = nil)
  1140.     super(viewport)
  1141.     @battler = battler
  1142.     @battler_visible = false
  1143.     @flash_shake_switch = true
  1144.     @number = 0#初始化编号
  1145.   end
  1146.   def update
  1147.     super
  1148.     # 战斗者为 nil 的情况下
  1149.     if @battler == nil
  1150.       self.bitmap = nil
  1151.       loop_animation(nil)
  1152.       return
  1153.     end
  1154.     # 文件名和色相与当前情况有差异的情况下
  1155.     if @battler.battler_name != @battler_name or
  1156.        @battler.battler_hue != @battler_hue
  1157.       # 获取、设置位图
  1158.       @battler_name = @battler.battler_name
  1159.       @battler_hue = @battler.battler_hue
  1160.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  1161.       @width = bitmap.width
  1162.       @height = bitmap.height
  1163.       self.ox = @width / 2
  1164.       self.oy = @height
  1165.       # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  1166.       if @battler.dead? or @battler.hidden
  1167.         self.opacity = 0  if DEADPIC != 1
  1168.       end
  1169.     end
  1170.     ###################################万兽熊最高#########################################
  1171.         if @battler.startactive == "移动" or @battler.startactive == "返回"
  1172.       if Graphics.frame_count % 4 == 0
  1173.         unless BattlerName[@battler.name].nil?
  1174.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  1175.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1176.         end
  1177.       end
  1178.     elsif @battler.startactive == "死亡"
  1179.        if Graphics.frame_count % 4 == 0
  1180.         unless BattlerName[@battler.name].nil?
  1181.           if @number +1 <= BattlerName[@battler.name][@battler.startactive].size
  1182.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1183.           @number += 1
  1184.         else
  1185.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][BattlerName[@battler.name][@battler.startactive].size-1], @battler_hue)
  1186.           end
  1187.         end
  1188.       end
  1189.       else
  1190.       if Graphics.frame_count % 10 == 0
  1191.         unless BattlerName[@battler.name].nil?
  1192.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  1193.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1194.         end
  1195.       end
  1196.     end
  1197.     #######################################################################################
  1198.     # 动画 ID 与当前的情况有差异的情况下
  1199.     if @battler.damage == nil and
  1200.        @battler.state_animation_id != @state_animation_id
  1201.       @state_animation_id = @battler.state_animation_id
  1202.       loop_animation($data_animations[@state_animation_id])
  1203.     end
  1204.     # 应该被显示的角色的情况下
  1205.    if NACTSWITCH > 0
  1206.     if @battler.is_a?(Game_Actor) and @battler_visible
  1207.       # 不是主状态的时候稍稍降低点透明度
  1208.       if $game_temp.battle_main_phase
  1209.         self.opacity += 3 if self.opacity < 255
  1210.       else
  1211.         self.opacity -= 3 if self.opacity > 207
  1212.       end
  1213.     end
  1214.   end
  1215.     if @battler.blink
  1216.       blink_on
  1217.     else
  1218.       blink_off
  1219.     end
  1220.     unless @battler_visible
  1221.       if not @battler.hidden and not @battler.dead? and
  1222.          (@battler.damage == nil or @battler.damage_pop)
  1223.         appear
  1224.         @battler_visible = true
  1225.       end
  1226.     end
  1227.     if @battler_visible
  1228.       if @battler.hidden
  1229.         $game_system.se_play($data_system.escape_se)
  1230.         escape
  1231.         @battler_visible = false
  1232.       end
  1233.       if @battler.white_flash
  1234.         whiten
  1235.         @battler.white_flash = false   
  1236.       end
  1237.         if @battler.animation_id != 0
  1238.         animation = $data_animations[@battler.animation_id]
  1239.         animation(animation, @battler.animation_hit,@battler.damage,@battler.damage_sp, @battler.critical)
  1240.         @battler.animation_id = 0
  1241.       end
  1242.       if @battler.damage_pop
  1243.         @battler.damage = nil
  1244.         @battler.damage_sp = 0
  1245.         @battler.critical = false
  1246.         @battler.damage_pop = false
  1247.       end
  1248.       if @battler.damage == nil and @battler.dead?
  1249.         if DEADPIC >0
  1250.           @battler.startactive = "死亡"
  1251.           else
  1252.         if @battler.is_a?(Game_Enemy)
  1253.           $game_system.se_play($data_system.enemy_collapse_se)
  1254.         else
  1255.           $game_system.se_play($data_system.actor_collapse_se)
  1256.         end
  1257.         collapse
  1258.         @battler_visible = false
  1259.         end
  1260.       end
  1261.     end
  1262.      self.x = @battler.screen_x
  1263.      self.y = @battler.screen_y
  1264.      self.z = @battler.screen_z
  1265.   end
  1266. end
  1267.  
  1268. class Spriteset_Battle
  1269. alias bearrpg_initialize initialize
  1270.   def initialize
  1271.     @enemy_sprites = []
  1272.     for enemy in $game_troop.enemies.reverse
  1273.       #####修改敌人显示端口,与角色一样。
  1274.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  1275.     end
  1276.     bearrpg_initialize
  1277.   end
  1278. end
  1279.  
  1280. class Arrow_Enemy < Arrow_Base
  1281.   def update
  1282.     super
  1283.     $game_troop.enemies.size.times do
  1284.       break if self.enemy.exist?
  1285.       @index += 1
  1286.       @index %= $game_troop.enemies.size
  1287.     end
  1288.     if Input.repeat?(Input::UP)
  1289.       $game_system.se_play($data_system.cursor_se)
  1290.       $game_troop.enemies.size.times do
  1291.         @index += 1
  1292.         @index %= $game_troop.enemies.size
  1293.         break if self.enemy.exist?
  1294.       end
  1295.     end
  1296.     if Input.repeat?(Input::DOWN)
  1297.       $game_system.se_play($data_system.cursor_se)
  1298.       $game_troop.enemies.size.times do
  1299.         @index += $game_troop.enemies.size - 1
  1300.         @index %= $game_troop.enemies.size
  1301.         break if self.enemy.exist?
  1302.       end
  1303.     end
  1304.     if self.enemy != nil
  1305.       self.x = self.enemy.screen_x
  1306.       self.y = self.enemy.screen_y
  1307.     end
  1308.   end
  1309. end
  1310.  
  1311. class Arrow_Actor < Arrow_Base
  1312.   def update
  1313.     super
  1314.     if Input.repeat?(Input::UP)
  1315.       $game_system.se_play($data_system.cursor_se)
  1316.       @index += 1
  1317.       @index %= $game_party.actors.size
  1318.     end
  1319.     if Input.repeat?(Input::DOWN)
  1320.       $game_system.se_play($data_system.cursor_se)
  1321.       @index += $game_party.actors.size - 1
  1322.       @index %= $game_party.actors.size
  1323.     end
  1324.     if self.actor != nil
  1325.       self.x = self.actor.screen_x
  1326.       self.y = self.actor.screen_y
  1327.     end
  1328.   end
  1329. end
  1330.  
  1331. class Scene_Battle
  1332. include Scene_BattleName
  1333. attr_reader :animation1_id
  1334.   def main
  1335.     $game_temp.in_battle = true
  1336.     $game_temp.battle_turn = 0
  1337.     $game_temp.battle_event_flags.clear
  1338.     $game_temp.battle_abort = false
  1339.     $game_temp.battle_main_phase = false
  1340.     $game_temp.battleback_name = $game_map.battleback_name
  1341.     $game_temp.forcing_battler = nil
  1342.     @_move_duration = 0
  1343.     $game_system.battle_interpreter.setup(nil, 0)
  1344.     @troop_id = $game_temp.battle_troop_id
  1345.     $game_troop.setup(@troop_id)
  1346.     s1 = $data_system.words.attack
  1347.     s2 = $data_system.words.skill
  1348.     s3 = $data_system.words.guard
  1349.     s4 = $data_system.words.item
  1350.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  1351.     @actor_command_window.z = 900
  1352.     @actor_command_window.y = 160
  1353.     @actor_command_window.back_opacity = 160
  1354.     @actor_command_window.active = false
  1355.     @actor_command_window.visible = false
  1356.     @party_command_window = Window_PartyCommand.new
  1357.     @party_command_window.z = 910
  1358.     @help_window = Window_Help.new
  1359.     @help_window.back_opacity = 160
  1360.     @help_window.z = 920
  1361.     @help_window.visible = false
  1362.     @status_window = Window_BattleStatus.new
  1363.     @status_window.z = 930
  1364.     @message_window = Window_Message.new
  1365.     @message_window.z = 940
  1366.     @spriteset = Spriteset_Battle.new
  1367.     @wait_count = 0
  1368.     if $data_system.battle_transition == ""
  1369.       Graphics.transition(20)
  1370.     else
  1371.       Graphics.transition(40, "Graphics/Transitions/" +
  1372.         $data_system.battle_transition)
  1373.     end
  1374.     start_phase1
  1375.     loop do
  1376.       Graphics.update
  1377.       Input.update
  1378.       update
  1379.       if $scene != self
  1380.         break
  1381.       end
  1382.     end
  1383.     $game_map.refresh
  1384.     Graphics.freeze
  1385.     @actor_command_window.dispose
  1386.     @party_command_window.dispose
  1387.     @help_window.dispose
  1388.     @status_window.dispose
  1389.     @message_window.dispose
  1390.     if @skill_window != nil
  1391.       @skill_window.dispose
  1392.     end
  1393.     if @item_window != nil
  1394.       @item_window.dispose
  1395.     end
  1396.     if @result_window != nil
  1397.       @result_window.dispose
  1398.     end
  1399.     @spriteset.dispose
  1400.     if $scene.is_a?(Scene_Title)
  1401.       Graphics.transition
  1402.       Graphics.freeze
  1403.     end
  1404.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  1405.       $scene = nil
  1406.     end
  1407.   end
  1408.   def start_phase1
  1409.     # 转移到回合 1
  1410.     @phase = 1
  1411.     # 清除全体同伴的行动
  1412.     $game_party.clear_actions
  1413.     for actor in $game_party.actors
  1414.      actor.startactive = actor.hp>0? "待机" : "死亡"
  1415.     end
  1416.     # 设置战斗事件
  1417.     setup_battle_event
  1418.   end
  1419.   alias bearrpg_start_phase5 start_phase5
  1420. def start_phase5
  1421.    bearrpg_start_phase5
  1422.     @result_window.z = 999
  1423.     @phase5_wait_count = 100
  1424.   end
  1425.   def start_enemy_select
  1426.     @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
  1427.     @enemy_arrow.help_window = @help_window
  1428.     @actor_command_window.active = false
  1429.     @actor_command_window.visible = false
  1430.   end
  1431.   alias bearrpg_start_skill_select start_skill_select
  1432.    def start_skill_select
  1433.       bearrpg_start_skill_select
  1434.       @skill_window.z = 999
  1435.     end
  1436.    alias bearrpg_start_item_select start_item_select
  1437.     def start_item_select
  1438.       bearrpg_start_item_select
  1439.       @item_window.z = 999
  1440.     end
  1441.   def move(active_battler, target, ox, oy, 返回标记 = false)
  1442.     ta_x = target[0]
  1443.     ta_y = target[1]
  1444.     if 返回标记
  1445.       active_battler.movex = (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox) / @_move_duration
  1446.       active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy) / @_move_duration
  1447.     else
  1448.       if @active_battler.is_a?(Game_Enemy)
  1449.         active_battler.movex = (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox ) / @_move_duration
  1450.         active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy ) / @_move_duration
  1451.       else
  1452.         active_battler.movex =  (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox ) / @_move_duration
  1453.         active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy ) / @_move_duration
  1454.       end
  1455.     end
  1456.   end
  1457.   def update_phase4_step3
  1458.     ####普通攻击的场合############################################################
  1459.     if @active_battler.current_action.basic == 0 and
  1460.       @active_battler.current_action.kind == 0
  1461.       #开始执行移动
  1462.      if not @active_battler.element_rate(UNMOVE)>100# 如果属性“不移动”不大于100
  1463.         @active_battler.startactive = "移动"
  1464.         @oldxy = [@active_battler.screen_x,@active_battler.screen_y]
  1465.         ox,oy = @active_battler.screen_x,@active_battler.screen_y
  1466.       if @active_battler.element_rate(HOMOVE)>100# 如果属性“半距离”大于100
  1467.         @_move_duration = Move_Duration/2
  1468.        while @_move_duration > 0
  1469.         Graphics.update
  1470.         Input.update
  1471.         @spriteset.update
  1472.         if @target_battlers[0].is_a?(Game_Actor)
  1473.         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]
  1474.         else
  1475.         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]
  1476.         end
  1477.         move(@active_battler, tag, ox, oy)
  1478.         @_move_duration -= 1
  1479.       end
  1480.     else
  1481.       @_move_duration = Move_Duration
  1482.         while @_move_duration > 0
  1483.         Graphics.update
  1484.         Input.update
  1485.         @spriteset.update
  1486.         if @target_battlers[0].is_a?(Game_Actor)
  1487.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width/2,@target_battlers[0].screen_y+1]
  1488.         else
  1489.         tag = [@target_battlers[0].screen_x+@target_battlers[0].width/1.5,@target_battlers[0].screen_y+2]
  1490.         end
  1491.         move(@active_battler, tag, ox, oy)
  1492.         @_move_duration -= 1
  1493.       end
  1494.       end
  1495.     end
  1496.    ####普通攻击的场合############################################################
  1497.     elsif @active_battler.current_action.kind == 1
  1498.     ####使用特技的场合############################################################
  1499.       if not @skill.element_set.include?(UNMOVE)# 如果技能不包含“不移动属性”
  1500.         @active_battler.startactive = "移动"
  1501.         @oldxy = [@active_battler.screen_x,@active_battler.screen_y]
  1502.         ox,oy = @active_battler.screen_x,@active_battler.screen_y
  1503.       if @skill.element_set.include?(HOMOVE)#如果技能不包含“半距离”属性
  1504.         @_move_duration = Move_Duration/2
  1505.        while @_move_duration > 0
  1506.         Graphics.update
  1507.         Input.update
  1508.         @spriteset.update
  1509.         if @target_battlers[0].is_a?(Game_Actor)
  1510.         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]
  1511.         else
  1512.         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]
  1513.         end
  1514.         move(@active_battler, tag, ox, oy)
  1515.         @_move_duration -= 1
  1516.       end
  1517.     else
  1518.       @_move_duration = Move_Duration
  1519.         while @_move_duration > 0
  1520.         Graphics.update
  1521.         Input.update
  1522.         @spriteset.update
  1523.         if @target_battlers[0].is_a?(Game_Actor)
  1524.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width,@target_battlers[0].screen_y+1]
  1525.         else
  1526.         tag = [@target_battlers[0].screen_x+@target_battlers[0].width/1.5,@target_battlers[0].screen_y+2]
  1527.         end
  1528.         move(@active_battler, tag, ox, oy)
  1529.         @_move_duration -= 1
  1530.       end
  1531.       end
  1532.     end
  1533.    #####使用特技的场合##############################################################
  1534. end
  1535. if @active_battler.startactive != "防御"
  1536.     @active_battler.startactive = "待机"
  1537.    end
  1538.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  1539.     if @animation1_id == 0
  1540.       @active_battler.white_flash = true
  1541.     else
  1542.       @active_battler.animation_id = @animation1_id
  1543.       @active_battler.animation_hit = true
  1544.     end
  1545.     for target in @target_battlers
  1546.       if target.guarding? and target.damage.is_a?(Numeric)
  1547.         target.startactive = "防御" if target.damage > 0
  1548.         end
  1549.       target.animation_id = @animation2_id
  1550.       target.animation_hit = (target.damage != "Miss")
  1551.     end
  1552.     # 移至步骤 4
  1553.     @phase4_step = 4
  1554.   end
  1555.   ##############################################################################
  1556.   def update_phase4_step4
  1557.    ###########################万兽熊最高########################################
  1558.     # 对像方动画
  1559.      for target in @target_battlers
  1560.        if target.damage != nil
  1561.          target.damage_pop = true
  1562.        end
  1563.      end
  1564.     # 限制动画长度、最低 8 帧
  1565.   #  @wait_count = 8
  1566.   ##############################################################################
  1567.     # 移至步骤 5
  1568.     @phase4_step = 5
  1569.   end
  1570. ####################万兽熊最高############################
  1571.   def update_phase4_step5
  1572.     # 隐藏帮助窗口
  1573.     @help_window.visible = false
  1574.     if @active_battler.current_action.basic == 0 and
  1575.       @active_battler.current_action.kind == 0
  1576.    ####普通攻击的场合############################################################   
  1577.       #执行返回
  1578.     if not @active_battler.element_rate(UNMOVE)>100# 如果属性“不移动”不大于100
  1579.       @active_battler.startactive = "返回"
  1580.       if @active_battler.element_rate(HOMOVE)>100# 如果属性“半距离”大于100
  1581.       @_move_duration = Move_Duration/2
  1582.       else
  1583.       @_move_duration = Move_Duration   
  1584.       end
  1585.       ox,oy = @active_battler.screen_x - @active_battler.movex,\
  1586.       @active_battler.screen_y - @active_battler.movey
  1587.       while @_move_duration > 0
  1588.         Graphics.update
  1589.         Input.update
  1590.         @spriteset.update
  1591.         move(@active_battler, @oldxy, ox, oy, true)
  1592.         @_move_duration -= 1
  1593.       end
  1594.     end
  1595.    ####普通攻击的场合############################################################
  1596.     elsif @active_battler.current_action.kind == 1
  1597.       if not @skill.element_set.include?(UNMOVE)#如果技能不包含“不移动”属性
  1598.       @active_battler.startactive = "返回"
  1599.       if @skill.element_set.include?(HOMOVE)#如果技能包含“半距离”属性
  1600.       @_move_duration = Move_Duration/2
  1601.       else
  1602.       @_move_duration = Move_Duration   
  1603.       end
  1604.       ox,oy = @active_battler.screen_x - @active_battler.movex,\
  1605.       @active_battler.screen_y - @active_battler.movey
  1606.       while @_move_duration > 0
  1607.         Graphics.update
  1608.         Input.update
  1609.         @spriteset.update
  1610.         move(@active_battler, @oldxy, ox, oy, true)
  1611.         @_move_duration -= 1
  1612.       end
  1613.     end
  1614.    ####使用特技的场合############################################################
  1615. end
  1616. if @active_battler.startactive != "防御"
  1617.     @active_battler.startactive = "待机"
  1618.    end
  1619.     # 刷新状态窗口
  1620.     @status_window.refresh
  1621.     # 显示伤害
  1622.     for target in @target_battlers
  1623.       target.startactive = "待机"
  1624.       if target.damage != nil
  1625.         target.damage_pop = true
  1626.       end
  1627.     end
  1628.     # 移至步骤 6
  1629.     @phase4_step = 6
  1630.   end
  1631.   def update_phase4_step6
  1632.     # 清除强制行动对像的战斗者
  1633.     $game_temp.forcing_battler = nil
  1634.     @active_battler.movex = 0
  1635.     @active_battler.movey = 0
  1636.     @active_battler.startactive = "待机" if @active_battler.startactive != "死亡"
  1637.     # 公共事件 ID 有效的情况下
  1638.     if @common_event_id > 0
  1639.       # 设置事件
  1640.       common_event = $data_common_events[@common_event_id]
  1641.       $game_system.battle_interpreter.setup(common_event.list, 0)
  1642.     end
  1643.     # 移至步骤 1
  1644.     @phase4_step = 1
  1645.   end
  1646. end

Lv5.捕梦者

梦石
0
星屑
37799
在线时间
5402 小时
注册时间
2006-11-10
帖子
6546
2
发表于 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
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2050
在线时间
162 小时
注册时间
2014-6-21
帖子
120
3
 楼主| 发表于 2022-4-27 12:05:34 | 只看该作者
灯笼菜刀王 发表于 2022-4-26 10:05
原因, 一个萝卜一坑, 而技能动画有两个萝卜, 一般就是使用方插一根, 对象方插一根, 如果你要往一个坑里同时 ...

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



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

点评

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

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-27 07:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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