查看: 2700|回复: 4

[已经过期] 【RMXP】熊式横版战斗的待机问题

[复制链接]
梦石
0
星屑
2292
在线时间
195 小时
注册时间
2014-6-21
回帖
104
发表于 2020-2-11 01:38:29 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 RyanBern 于 2020-2-28 16:51 编辑

就是怎么把待机那四张动画 能想做成动画那样的连贯性 4帧的图片 待机的时候感觉停顿的时间有点长 想把停顿的时间改短点 因为我每个人物都是找的不同的 待机的时候 发现有的看起来还可以 但是有的 感觉中间停顿的时间略长 想改4帧图片的切换时间但是不知道怎么改


下面是代码

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





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

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

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

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

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

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

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

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

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

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

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

  34. ##################################################################
  35. module Scene_BattleName
  36.   # 设定移动速度
  37.   Move_Duration = 0
  38.   #设定人物的单帧图,如果不做设定,将直接使用默认的战斗图。
  39.   BattlerName = {
  40.   "关羽" => {
  41.   "待机" => ["关羽待机-1","关羽待机-2","关羽待机-3","关羽待机-4"],
  42.   "移动" => [""],
  43.   "返回" => [""],
  44.   "受伤" => ["关羽待机-1","关羽待机-2","关羽待机-3","关羽待机-4"],
  45.   "防御" => ["关羽待机-1","关羽待机-2","关羽待机-3","关羽待机-4"],
  46.   "死亡" => ["bear_die1","bear_die2"]
  47.   },
  48.   
  49.   "蜘蛛侠" => {
  50.   "待机" => ["spider_s1"],
  51.   "移动" => ["spider_r1"],
  52.   "返回" => ["spider_b1"],
  53.   "受伤" => ["spider_h"],
  54.   "防御" => ["spider_h"],
  55.   "死亡" => ["spider_die1","spider_die2"]
  56.   },
  57.   
  58.   "桌布侠" => {
  59.   "待机" => ["ghost_s1","ghost_s2","ghost_s3","ghost_s4"],
  60.   "移动" => ["ghost_r1","ghost_r2","ghost_r3","ghost_r4"],
  61.   "返回" => ["ghost_b1","ghost_b2","ghost_b3","ghost_b4"],
  62.   "受伤" => ["ghost_h"],
  63.   "防御" => ["ghost_d"],
  64.   "死亡" => ["ghost_die1","ghost_die2"]
  65.   },

  66.   "山寨大帝" => {
  67.   "待机" => ["qq_s1","qq_s2","qq_s3","qq_s4"],
  68.   "移动" => ["qq_r1","qq_r2","qq_r3","qq_r4"],
  69.   "返回" => ["qq_B1","qq_B2","qq_B3","qq_B4"],
  70.   "受伤" => ["qq_h"],
  71.   "防御" => ["qq_d"],
  72.   "死亡" => ["qq_die1","qq_die2"]
  73.   },
  74.   "女" => {
  75.   "待机" => ["demon_s1","demon_s2","demon_s3","demon_s4"],
  76.   "移动" => ["demon_r1","demon_r2","demon_r3","demon_r4"],
  77.   "返回" => ["demon_b1","demon_b2","demon_b3","demon_b4"],
  78.   "受伤" => ["demon_h"],
  79.   "防御" => ["demon_d"],
  80.   "死亡" => ["demon_die1","demon_die2"]
  81.   },
  82.   
  83.   "廖化" => {
  84.   "待机" => ["廖化待机-1","廖化待机-2","廖化待机-3","廖化待机-4"],
  85.   "移动" => [""],
  86.   "返回" => [""],
  87.   "受伤" => ["廖化受伤-1"],
  88.   "防御" => ["dog_h"],
  89.   "死亡" => ["dog_die"]
  90.   },
  91.   
  92.   "吕良" => {
  93.   "待机" => ["吕良待机-1","吕良待机-2","吕良待机-3","吕良待机-4"],
  94.   "移动" => [""],
  95.   "返回" => [""],
  96.   "受伤" => ["吕良受伤-1"],
  97.   "防御" => ["Fred_d"],
  98.   "死亡" => ["Fred_die1","Fred_die2"]
  99.   },
  100. }
  101. end
  102. #至于其它的:

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

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

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

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

  107. #--------------------------------------------------------------------------
  108. #  ● 设定结束
  109. #--------------------------------------------------------------------------










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

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

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

  509. class Scene_Battle

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

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

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

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

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

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

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

使用道具 举报

梦石
0
星屑
4881
在线时间
425 小时
注册时间
2019-10-22
回帖
647
发表于 2020-2-11 01:50:20 | 显示全部楼层
请使用代码折叠功能  图标是  <>

然后
  1. def update_animation
复制代码

这个就是你要找的 底下都是相关的东西
看代码的刷新思路应该是  先取得图片的总帧数  然后每一帧刷新就显示对应的下一帧
这样还不流畅的话 考虑一下素材的问题?
















回复

使用道具 举报

梦石
0
星屑
2292
在线时间
195 小时
注册时间
2014-6-21
回帖
104
 楼主| 发表于 2020-2-11 08:50:35 | 显示全部楼层
坏数据 发表于 2020-2-11 01:50
请使用代码折叠功能  图标是  

然后

好的 但是这段代码的下面 应该是弹出的伤害和权重计算吧
回复

使用道具 举报

梦石
0
星屑
4881
在线时间
425 小时
注册时间
2019-10-22
回帖
647
发表于 2020-2-11 12:16:34 | 显示全部楼层
link756367658 发表于 2020-2-11 08:50
好的 但是这段代码的下面 应该是弹出的伤害和权重计算吧

就是动画的刷新
















回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部