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

Project1

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

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

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2050
在线时间
162 小时
注册时间
2014-6-21
帖子
120
跳转到指定楼层
1
发表于 2020-2-11 01:38:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

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

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


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

Lv3.寻梦者

梦石
0
星屑
2050
在线时间
162 小时
注册时间
2014-6-21
帖子
120
2
 楼主| 发表于 2020-2-11 01:39:40 | 只看该作者
我自己稍微修改了一下代码 但是我提出的问题 是真不知道在哪里改
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
4881
在线时间
425 小时
注册时间
2019-10-22
帖子
666
3
发表于 2020-2-11 01:50:20 | 只看该作者
请使用代码折叠功能  图标是  <>

然后
  1. def update_animation
复制代码

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
















回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2050
在线时间
162 小时
注册时间
2014-6-21
帖子
120
4
 楼主| 发表于 2020-2-11 08:50:35 | 只看该作者
坏数据 发表于 2020-2-11 01:50
请使用代码折叠功能  图标是  

然后

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

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
4881
在线时间
425 小时
注册时间
2019-10-22
帖子
666
5
发表于 2020-2-11 12:16:34 | 只看该作者
link756367658 发表于 2020-2-11 08:50
好的 但是这段代码的下面 应该是弹出的伤害和权重计算吧

就是动画的刷新
















回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-20 10:24

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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