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

Project1

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

[已经过期] 如何将熊式横版的施法动画也改为单帧动画

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2724
在线时间
227 小时
注册时间
2016-3-27
帖子
576
跳转到指定楼层
1
发表于 2022-5-27 13:13:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 WantMy蕙 于 2022-5-27 13:15 编辑

启用熊式横版作为战斗系统的初衷是因为可以突破xp原动画素材分辨率的限制,实操后发现在施法和平A的情况下还是用了原编辑器的动画。

于是想通过修改来做到施法和平A都是使用的战斗图换帧解决。

在脚本的1447行
RUBY 代码复制
  1. # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  2.     if @animation1_id == 0
  3.       @active_battler.white_flash = true
  4.     else
  5.       @active_battler.animation_id = @animation1_id   #攻击动画
  6.       @active_battler.animation_hit = true
  7.     end


中有详细注明攻击动画,就是施法方的动画,将该句做注释处理之后,角色方的攻击行为都不会有动画出现。
固判断需要在此处做文章,于是模仿待机动画,复制了1098行的内容来进行测试。
RUBY 代码复制
  1. if Graphics.frame_count % 1 == 0  #更改动画播放帧率
  2.         unless BattlerName[@battler.name].nil?
  3.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  4.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  5.         end
  6.       end

但实际使用中会出现battlername未定义的情况,想知道这是为什么并且如何解决,希望有大大可以帮忙看看,有偿也是可以的。
另外本问题如果解决,也只是实现了攻击行为有攻击动画的效果。并未做if判断是平A或者是技能1234的释放。

元脚本
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 = "Critital_hit"
  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 = 60
  54.   #设定人物的单帧图,如果不做设定,将直接使用默认的战斗图。
  55.   BattlerName = {
  56.   "熊大王" => {
  57.   "待机" => ["bear_s1","bear_s2","bear_s3","bear_s4"],
  58.   "移动" => ["bear_r1","bear_r2","bear_r3","bear_r4"],
  59.   "返回" => ["bear_b1","bear_b2","bear_b3","bear_b4"],
  60.   "受伤" => ["bear_h"],
  61.   "防御" => ["bear_d"],
  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.   "待机" => ["dog_s1","dog_s2","dog_s3","dog_s4"],
  102.   "移动" => ["dog_r1","dog_r2","dog_r3","dog_r4"],
  103.   "返回" => ["dog_b1","dog_b2","dog_b3","dog_b4"],
  104.   "受伤" => ["dog_h"],
  105.   "防御" => ["dog_h"],
  106.   "死亡" => ["dog_die"]
  107.   },
  108.  
  109.   "弗雷德" => {
  110.   "待机" => ["Fred_s0","Fred_s1","Fred_s2","Fred_s3","Fred_s4","Fred_s5","Fred_s6","Fred_s7","Fred_s8","Fred_s9","Fred_s10","Fred_s11","Fred_s12","Fred_s13","Fred_s14","Fred_s15","Fred_s16","Fred_s17","Fred_s18","Fred_s19","Fred_s20","Fred_s21","Fred_s22","Fred_s23","Fred_s24","Fred_s25","Fred_s26","Fred_s27","Fred_s28","Fred_s29","Fred_s30","Fred_s31","Fred_s32","Fred_s33","Fred_s34","Fred_s35","Fred_s36","Fred_s37","Fred_s38","Fred_s39","Fred_s40","Fred_s41","Fred_s42","Fred_s43","Fred_s44","Fred_s45","Fred_s46","Fred_s47","Fred_s48","Fred_s49","Fred_s50","Fred_s51","Fred_s52","Fred_s53","Fred_s54","Fred_s55","Fred_s56","Fred_s57","Fred_s61","Fred_s62","Fred_s63","Fred_s64","Fred_s65","Fred_s66"],
  111.   "移动" => ["Fred_r1","Fred_r2","Fred_r3","Fred_r4"],
  112.   "返回" => ["Fred_b1","Fred_b2","Fred_b3","Fred_b4"],
  113.   "受伤" => ["Fred_h"],
  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. class Game_Actor
  473.   def screen_x
  474.     if self.index != nil
  475.       return (1280-self.index*50)/2 + 240 + @movex
  476.     else
  477.       return 0
  478.     end
  479.   end
  480.   def screen_y
  481.     return self.index*70+self.height/2 + 420 + @movey #(320-self.index*91+self.height)/2 + 100 + @movey
  482.   end
  483.   def screen_z
  484.     return self.screen_y-self.index * 10
  485.   end
  486. end
  487. class Game_Enemy
  488.   def screen_x
  489.     return $data_troops[@troop_id].members[@member_index].x + @movex
  490.   end
  491.   def screen_y
  492.     return $data_troops[@troop_id].members[@member_index].y + @movey
  493.   end
  494.   def screen_z
  495.     return self.screen_y#+self.height
  496.   end
  497. end
  498.  
  499. class Sprite_Battler
  500.   include Scene_BattleName
  501. end
  502. module RPG
  503. class Sprite < ::Sprite
  504. #==========================================
  505. def initialize(viewport = nil)
  506. super(viewport)
  507. @_whiten_duration = 0
  508. @_appear_duration = 0
  509. @_escape_duration = 0
  510. @_collapse_duration = 0
  511. @_damage_duration = 0
  512. @_animation_duration = 0
  513. @_blink = false  
  514. @flash_shake = 0
  515. @_damage = []  
  516. @_damage_sp = []
  517. @_total_damage = 0
  518. @_total_damage_duration = 0
  519. @p_dam=0
  520. @hits=0
  521. end
  522. def animation_set_sprites(sprites, cell_data, position)
  523.    for i in 0..15
  524.    sprite = sprites[i]
  525.    pattern = cell_data[i, 0]
  526.    if sprite == nil or pattern == nil or pattern == -1
  527.      sprite.visible = false if sprite != nil
  528.      next
  529.    end
  530.    sprite.visible = true
  531.    sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  532.    if position == 3
  533.      if self.viewport != nil
  534.        sprite.x = self.viewport.rect.width / 2
  535.        sprite.y = self.viewport.rect.height - 160
  536.      else
  537.        sprite.x = 320
  538.        sprite.y = 240
  539.      end
  540.      else
  541.      sprite.x = self.x - self.ox + self.src_rect.width / 2
  542.      sprite.y = self.y - self.oy + self.src_rect.height / 2
  543.      sprite.y -= self.src_rect.height / 4 if position == 0
  544.      sprite.y += self.src_rect.height / 4 if position == 2
  545.    end
  546.    sprite.x += cell_data[i, 1]
  547.    sprite.y += cell_data[i, 2]
  548.    if $scene.is_a?(Scene_Battle)
  549.    sprite.z = battler.screen_z+20
  550. else
  551.    sprite.z = 9990
  552.    end
  553.    sprite.ox = 96
  554.    sprite.oy = 96
  555.    sprite.zoom_x = cell_data[i, 3] / 100.0
  556.    sprite.zoom_y = cell_data[i, 3] / 100.0
  557.    sprite.angle = cell_data[i, 4]
  558.    sprite.mirror = (cell_data[i, 5] == 1)
  559.    sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  560.    sprite.blend_type = cell_data[i, 7]
  561.    end
  562. end
  563. def damage(value, critical)
  564.   dispose_hit
  565.     if value.is_a?(Numeric)
  566.       damage_string = value.abs.to_s
  567.     else
  568.       damage_string = value.to_s
  569.     end
  570.     bitmap = Bitmap.new(300, 150)
  571.     bitmap.font.name = ["黑体","华文行楷", "宋体"]
  572.     bitmap.font.size = 32
  573.     if value.is_a?(Numeric)
  574.   # 分割伤害值字符串
  575.       damage_array = damage_string.scan(/./)
  576.       damage_x = 81 - damage_string.size * 9
  577.   # 会心一击标志打开的情况
  578.       if critical and value != "无效"
  579.   # 显示会心一击图画
  580.         cri_bitmap = RPG::Cache.picture("Critital")
  581.         bitmap.blt(damage_x+cri_bitmap.width, cri_bitmap.height*2, cri_bitmap, Rect.new(0, 0, cri_bitmap.width, cri_bitmap.height))
  582.         Audio.se_play("Audio/SE/"+CRIVOICE,100,100) if CRIVOICE != nil and CRIVOICE != ""
  583.         $game_screen.start_flash(Color.new(255, 5, 5, 155), 5) if CRIFLASH >0
  584.         $game_screen.start_shake(2,9,3) if CRISHAKE >0
  585.       end
  586.   # 伤害值为负的情况下
  587.     dmg_bitmap = RPG::Cache.picture("Normal_Damage")
  588.       if value < 0
  589.   # 调用回复数字表
  590.         bitmap.blt(damage_x-14, 32,dmg_bitmap,Rect.new(dmg_bitmap.width/12*10, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  591.       else
  592.   # 调用伤害数字表
  593.         bitmap.blt(damage_x-14, 32, dmg_bitmap,Rect.new(dmg_bitmap.width/12*11, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  594.       end
  595.   # 循环伤害值字符串
  596.       for char in damage_array
  597.         number = char.to_i
  598.   # 显示伤害数字
  599.         bitmap.blt(damage_x, 32, dmg_bitmap,
  600.         Rect.new(number * dmg_bitmap.width/12, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  601. #################################################################普通伤害数值
  602.         damage_x += dmg_bitmap.width/12 - 4#间距缩小4个像素,可以自行调整
  603. #################################################################普通伤害数值
  604.       end  
  605.     else
  606.       if value == "Miss"
  607.         miss_dmg = RPG::Cache.picture("miss")
  608.         bitmap.blt(miss_dmg.width, 0,miss_dmg, Rect.new(0, 0, miss_dmg.width, miss_dmg.height))
  609.       elsif value == "无效"
  610.         invalid_dmg = RPG::Cache.picture("invalid")
  611.         bitmap.blt(invalid_dmg.width, 0,invalid_dmg, Rect.new(0, 0, invalid_dmg.width,invalid_dmg.height))
  612.       #end
  613.       end
  614.     end
  615. # 伤害值定位
  616.     @_damage_sprite = ::Sprite.new(self.viewport)
  617.     @_damage_sprite.bitmap = bitmap
  618.     @_damage_sprite.ox = 80
  619.     @_damage_sprite.oy = 20
  620.     @_damage_sprite.x = self.x
  621.     @_damage_sprite.y = self.y - self.oy / 2
  622.     @_damage_sprite.z = 3000
  623.     @_damage_duration = 40
  624.     @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  625.     make_total_damage(value)
  626.   end
  627. ##################################################################sp伤害数值
  628. def damage_sp(value, critical)
  629.   dispose_hit
  630.     if value.is_a?(Numeric)
  631.       damage_string = value.abs.to_s
  632.     else
  633.       damage_string = value.to_s
  634.     end
  635.     bitmap = Bitmap.new(300, 150)
  636.     bitmap.font.name = ["黑体","华文行楷", "宋体"]
  637.     bitmap.font.size = 32
  638.     if value.is_a?(Numeric)
  639.   # 分割伤害值字符串
  640.       damage_array = damage_string.scan(/./)
  641.       damage_x = 81 - damage_string.size * 9
  642.   # 会心一击标志打开的情况
  643.       if critical and value != "无效"
  644.   # 显示会心一击图画
  645.         cri_bitmap = RPG::Cache.picture("Critital")
  646.         bitmap.blt(damage_x+cri_bitmap.width, cri_bitmap.height*2, cri_bitmap, Rect.new(0, 0, cri_bitmap.width, cri_bitmap.height))
  647.         Audio.se_play("Audio/SE/"+CRIVOICE,100,100) if CRIVOICE != nil and CRIVOICE != ""
  648.         $game_screen.start_flash(Color.new(255, 5, 5, 155), 5) if CRIFLASH >0
  649.         $game_screen.start_shake(2,9,3) if CRISHAKE >0
  650.       end
  651.   # 伤害值为负的情况下
  652.     dmg_bitmap = RPG::Cache.picture("Normal_Damage")
  653.       if value < 0
  654.   # 调用回复数字表
  655.         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))
  656.       else
  657.   # 调用伤害数字表
  658.         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))
  659.       end
  660.   # 循环伤害值字符串
  661.       for char in damage_array
  662.         number = char.to_i
  663.   # 显示伤害数字
  664.         bitmap.blt(damage_x, 32, dmg_bitmap,
  665.         Rect.new(number * dmg_bitmap.width/12, dmg_bitmap.height/2, dmg_bitmap.width/12, dmg_bitmap.height/2))
  666. #################################################################普通伤害数值
  667.         damage_x += dmg_bitmap.width/12 - 4#间距缩小4个像素,可以自行调整
  668. #################################################################普通伤害数值
  669.       end  
  670.     else
  671.       if value == "Miss"
  672.         miss_dmg = RPG::Cache.picture("miss")
  673.         bitmap.blt(miss_dmg.width, 0,miss_dmg, Rect.new(0, 0, miss_dmg.width, miss_dmg.height))
  674.       elsif value == "无效"
  675.         invalid_dmg = RPG::Cache.picture("invalid")
  676.         bitmap.blt(invalid_dmg.width, 0,invalid_dmg, Rect.new(0, 0, invalid_dmg.width,invalid_dmg.height))
  677.       #end
  678.       end
  679.     end
  680. # 伤害值定位
  681.     @_damage_sprite = ::Sprite.new(self.viewport)
  682.     @_damage_sprite.bitmap = bitmap
  683.     @_damage_sprite.ox = 80
  684.     @_damage_sprite.oy = 20
  685.     @_damage_sprite.x = self.x
  686.     @_damage_sprite.y = self.y - self.oy / 2
  687.     @_damage_sprite.z = 3000
  688.     @_damage_duration = 40
  689.     @_damage_sp.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  690.    # make_total_damage(value)
  691.   end  
  692. def hit
  693. # 如果伤害值是数值
  694. # 转为字符串
  695. value=@hits
  696. hits_string = value.to_s
  697. # 初始化位图
  698. bitmap = Bitmap.new(320, 64)
  699. bitmap.font.name = "Arial Black"
  700. bitmap.font.size = 32
  701. # 分割伤害值字符串
  702. hits_array = hits_string.scan(/./)
  703. hits_x = 81 - hits_string.size * 18.1
  704. rect_y = 0
  705. # 循环伤害值字符串
  706. for char in hits_array
  707. number = char.to_i
  708. # 显示伤害数字
  709. combo_num = RPG::Cache.picture("combo_num")
  710. bitmap.blt(hits_x, 0, combo_num,
  711. Rect.new(number * combo_num.width/10, 0, combo_num.width/10, combo_num.height))
  712. #################################################################连击数数值
  713. hits_x += combo_num.width/10 - 3#间距缩小3个像素,可以自行调整
  714. #################################################################连击数数值
  715. end
  716. combo_tx = RPG::Cache.picture("combo_text")
  717. bitmap.blt(hits_x, 0,combo_tx ,
  718. Rect.new(0, 0, combo_tx.width, combo_tx.height))
  719. # 伤害值定位
  720. @_hits_sprite = ::Sprite.new(self.viewport)
  721. @_hits_sprite.bitmap = bitmap
  722. @_hits_sprite.ox = 81
  723. @_hits_sprite.oy = 20
  724. @_hits_sprite.x = 500
  725. @_hits_sprite.y = 100
  726. @_hits_sprite.opacity = HITSWITCH > 0 ? 255 : 0
  727. @_hits_sprite.z = 3000
  728. @_hits_duration = 40
  729. end
  730. #--------------------------------------------------------------------------
  731. # ● 总伤害处理
  732. #--------------------------------------------------------------------------
  733. def make_total_damage(value)
  734. if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE > 0
  735. @_total_damage += value
  736. # 绝对值转为字符串
  737. damage_string = @_total_damage.abs.to_s
  738. else
  739. return
  740. end
  741. # 初始化位图
  742. bitmap = Bitmap.new(350, 150)
  743. bitmap.font.name = "Arial Black"
  744. bitmap.font.size = 32
  745. # 伤害值是数值的情况下
  746. if value.is_a?(Numeric)
  747. # 分割伤害值字符串
  748. damage_array = damage_string.scan(/./)
  749. damage_x = 40 - damage_string.size * 9
  750. # 伤害值为负的情况下
  751. name=RPG::Cache.picture("total_damage")
  752. # 循环伤害值字符串
  753. for char in damage_array
  754. number = char.to_i
  755. # 显示伤害数字
  756. bitmap.blt(damage_x, 0, name,
  757. Rect.new(number * name.width/10, 0, name.width/10, name.height))
  758. #################################################################总伤害数值
  759. damage_x += name.width/10 - 3 #间距缩小3个像素,可以自行调整
  760. #################################################################总伤害数值
  761. end
  762. end
  763. if @_total_damage_sprite.nil?
  764. @_total_damage_sprite = ::Sprite.new(self.viewport)
  765. @_total_damage_sprite.ox = 80
  766. @_total_damage_sprite.oy = 40
  767. @_total_damage_sprite.z = 3000
  768. end
  769. @_total_damage_sprite.bitmap = bitmap
  770. @_total_damage_sprite.zoom_x = 1.0
  771. @_total_damage_sprite.zoom_y = 1.0
  772. @_total_damage_sprite.x = self.x
  773. @_total_damage_sprite.y = self.y - self.oy / 2
  774. @_total_damage_sprite.z = 3001
  775. @_total_damage_duration = 80
  776. #hit数描绘
  777. @hits+=1
  778. if @_total_damage > 0
  779.   hit
  780. end
  781. end
  782. def animation(animation, hit, battler_damage="", battler_damage_sp="",battler_critical=false)
  783. dispose_animation
  784. @battler_damage = battler_damage
  785. @battler_damage_sp = battler_damage_sp
  786. @battler_critical = battler_critical
  787. @_animation = animation
  788. return if @_animation == nil
  789. @_animation_hit = hit
  790. @_animation_duration = @_animation.frame_max
  791. animation_name = @_animation.animation_name
  792. animation_hue = @_animation.animation_hue
  793. bitmap = RPG::Cache.animation(animation_name, animation_hue)
  794. for timing in @_animation.timings
  795. quanzhong = animation_process_timing(timing, @_animation_hit,true)
  796. @all_quanzhong += quanzhong
  797. @_last_frame = timing.frame if quanzhong != 0
  798. end
  799. if @@_reference_count.include?(bitmap)
  800. @@_reference_count[bitmap] += 1
  801. else
  802. @@_reference_count[bitmap] = 1
  803. end  
  804. if $scene.is_a?(Scene_Battle)
  805. if $scene.animation1_id == @battler.animation_id
  806. @battler_damage = ""
  807. @battler_damage_sp = ""
  808. end
  809. end
  810. @_animation_sprites = []
  811. if @_animation.position != 3 or not @@_animations.include?(animation)
  812. for i in 0..15
  813. sprite = ::Sprite.new(self.viewport)
  814. sprite.bitmap = bitmap
  815. sprite.visible = false
  816. @_animation_sprites.push(sprite)
  817. end
  818. unless @@_animations.include?(animation)
  819. @@_animations.push(animation)
  820. end
  821. end
  822. update_animation
  823. end  
  824. def dispose_damage
  825. for damage in @_damage.reverse
  826. damage[0].bitmap.dispose
  827. damage[0].dispose
  828. @_damage.delete(damage)
  829. end
  830. for damage_sp in @_damage_sp.reverse
  831. damage_sp[0].bitmap.dispose
  832. damage_sp[0].dispose
  833. @_damage_sp.delete(damage_sp)
  834. end
  835. @_total_damage = 0
  836. @_last_frame = -1
  837. if @_total_damage_sprite != nil
  838. @_total_damage_duration = 0
  839. @_total_damage_sprite.bitmap.dispose
  840. @_total_damage_sprite.dispose
  841. @_total_damage_sprite = nil
  842. end
  843. end
  844. def dispose_hit
  845. if @_hits_sprite != nil
  846. @_hits_sprite.bitmap.dispose
  847. @_hits_sprite.dispose
  848. @_hits_sprite = nil
  849. end
  850. end
  851. def dispose_animation
  852. @battler_damage = nil
  853. @battler_damage_sp = nil
  854. @battler_critical = nil
  855. @all_quanzhong = 1
  856. @_total_damage = 0
  857. @_last_frame = -1
  858. if @_animation_sprites != nil
  859. sprite = @_animation_sprites[0]
  860. if sprite != nil
  861. @@_reference_count[sprite.bitmap] -= 1
  862. if @@_reference_count[sprite.bitmap] == 0
  863. sprite.bitmap.dispose
  864. end
  865. end
  866. for sprite in @_animation_sprites
  867. sprite.dispose
  868. end
  869. @_animation_sprites = nil
  870. @_animation = nil
  871. end
  872. end
  873. def update
  874. super
  875. if @_whiten_duration > 0
  876. @_whiten_duration -= 1
  877. self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  878. end
  879. if @_appear_duration > 0
  880. @_appear_duration -= 1
  881. self.opacity = (16 - @_appear_duration) * 16
  882. end
  883. if @_escape_duration > 0
  884. @_escape_duration -= 1
  885. self.opacity = 256 - (32 - @_escape_duration) * 10
  886. end
  887. if @_collapse_duration > 0
  888. @_collapse_duration -= 1
  889. self.opacity = 256 - (48 - @_collapse_duration) * 6
  890. end
  891. if @_damage_duration > 0
  892. @_damage_duration -= 1
  893. for damage in @_damage
  894. damage[0].x = self.x + self.viewport.rect.x -
  895. self.ox + self.src_rect.width / 2 +
  896. (40 - damage[1]) * damage[3] / 10
  897. damage[0].y -= damage[4]+damage[1]/10
  898. damage[0].opacity = damage[1]*20
  899. damage[1] -= 1
  900. if damage[1]==0
  901. damage[0].bitmap.dispose
  902. damage[0].dispose
  903. @_damage.delete(damage)
  904. next
  905. end
  906. end
  907. for damage_sp in @_damage_sp
  908. damage_sp[0].x = self.x + self.viewport.rect.x -
  909. self.ox + self.src_rect.width / 2 +
  910. (40 - damage_sp[1]) * damage_sp[3] / 10
  911. damage_sp[0].y -= damage_sp[4]+damage_sp[1]/10
  912. damage_sp[0].opacity = damage_sp[1]*20
  913. damage_sp[1] -= 1
  914. if damage_sp[1]==0
  915. damage_sp[0].bitmap.dispose
  916. damage_sp[0].dispose
  917. @_damage_sp.delete(damage_sp)
  918. next
  919. end
  920. end
  921. end
  922. if @_total_damage_duration > 0
  923. @_total_damage_duration -= 1
  924. @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
  925. if @_total_damage_sprite.zoom_x > 1.0
  926. @_total_damage_sprite.zoom_x -= 0.05
  927. end
  928. if @_total_damage_sprite.zoom_y > 1.0
  929. @_total_damage_sprite.zoom_y -= 0.05
  930. end
  931. @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
  932. if @_total_damage_duration <= 0
  933. dispose_hit
  934. @_total_damage = 0
  935. @_total_damage_duration = 0
  936. @_total_damage_sprite.bitmap.dispose
  937. @_total_damage_sprite.dispose
  938. @_total_damage_sprite = nil
  939. end
  940. end
  941. #=======================================
  942.     if @_animation != nil and (Graphics.frame_count % 2 == 0)  #11
  943.       @_animation_duration -= 1
  944.       update_animation
  945.     end
  946.   if @_loop_animation != nil and (Graphics.frame_count % 2 == 0) #11
  947.       update_loop_animation
  948.       @_loop_animation_index += 1
  949.       @_loop_animation_index %= @_loop_animation.frame_max
  950.     end
  951.   if @_blink
  952.     @_blink_count = (@_blink_count + 1) % 32
  953.       if @_blink_count < 16
  954.         alpha = (16 - @_blink_count) * 6
  955.       else
  956.         alpha = (@_blink_count - 16) * 6
  957.       end
  958.       self.color.set(255, 255, 255, alpha)
  959.     end
  960.     @@_animations.clear
  961.   end
  962. def update_animation
  963.   if @_animation_duration > 0
  964.     frame_index = @_animation.frame_max - @_animation_duration
  965.     cell_data = @_animation.frames[frame_index].cell_data
  966.     position = @_animation.position
  967.     animation_set_sprites(@_animation_sprites, cell_data, position)
  968.       for timing in @_animation.timings
  969.         if timing.frame == frame_index
  970.           t = 1.0 * animation_process_timing(timing, @_animation_hit) #1111
  971.           ts = 1.0 * animation_process_timing(timing, @_animation_hit)
  972.           if timing.se.name != ""
  973.             se=timing.se
  974.             Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  975.           end
  976.           if @battler_damage.is_a?(Numeric) and t != 0
  977.             if @battler.guarding?
  978.               @battler.startactive = "防御" if @battler_damage > 0
  979.            else
  980.               @battler.startactive = "受伤" if @battler_damage > 0
  981.             end
  982.             t *= @battler_damage
  983.             t /= @all_quanzhong
  984.             ts *= @battler_damage_sp
  985.             ts /= @all_quanzhong
  986.             t = t.to_i
  987.             ts = ts.to_i
  988.   if frame_index != @_last_frame
  989.     @p_dam+= t
  990.   end
  991.       if frame_index == @_last_frame
  992.         t=@battler_damage-@p_dam
  993.       end
  994.     if frame_index == @_last_frame
  995.       @_total_damage = @battler_damage - t
  996.       @p_dam=0
  997.     end
  998.       damage(t,@battler_critical) if $damage_hp == true
  999.       damage_sp(ts,@battler_critical) if $damage_sp == true
  1000.     if frame_index == @_last_frame
  1001.       @hits=0
  1002.      end
  1003.       elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  1004.         damage(@battler_damage,@battler_critical)
  1005.         damage_sp(@battler_damage_sp,@battler_critical) if $damage_sp == true
  1006.        end
  1007.       end
  1008.       end
  1009.     else
  1010.       dispose_animation
  1011.     end
  1012.   end
  1013. def animation_process_timing(timing, hit,dontflash=false)
  1014.   if (timing.condition == 0) or
  1015.     (timing.condition == 1 and hit == true) or
  1016.     (timing.condition == 2 and hit == false)
  1017.   case timing.flash_scope
  1018.     when 1
  1019.       unless dontflash
  1020.         self.flash(timing.flash_color, timing.flash_duration * 2)
  1021.         if @_total_damage >0
  1022.           @flash_shake_switch = true
  1023.           @flash_shake = 10
  1024.         end
  1025.       end
  1026.       return timing.flash_color.alpha * timing.flash_duration
  1027.     when 2
  1028.       unless dontflash
  1029.         if self.viewport != nil
  1030.           self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  1031.         end
  1032.       end
  1033.       return timing.flash_color.alpha * timing.flash_duration
  1034.     when 3
  1035.       unless dontflash
  1036.         self.flash(nil, timing.flash_duration * 2)
  1037.       end
  1038.         return timing.flash_color.alpha * timing.flash_duration
  1039.       end
  1040.     end
  1041.       return 0
  1042.     end
  1043.   end
  1044. end
  1045.  
  1046. class Sprite_Battler < RPG::Sprite
  1047.   def initialize(viewport, battler = nil)
  1048.     super(viewport)
  1049.     @battler = battler
  1050.     @battler_visible = false
  1051.     @flash_shake_switch = true
  1052.     @number = 0#初始化编号
  1053.   end
  1054.   def update
  1055.     super
  1056.     # 战斗者为 nil 的情况下
  1057.     if @battler == nil
  1058.       self.bitmap = nil
  1059.       loop_animation(nil)
  1060.       return
  1061.     end
  1062.     # 文件名和色相与当前情况有差异的情况下
  1063.     if @battler.battler_name != @battler_name or
  1064.        @battler.battler_hue != @battler_hue
  1065.       # 获取、设置位图
  1066.       @battler_name = @battler.battler_name
  1067.       @battler_hue = @battler.battler_hue
  1068.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  1069.       @width = bitmap.width
  1070.       @height = bitmap.height
  1071.       self.ox = @width / 2
  1072.       self.oy = @height
  1073.       # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  1074.       if @battler.dead? or @battler.hidden
  1075.         self.opacity = 0  if DEADPIC != 1
  1076.       end
  1077.     end
  1078.     ###################################万兽熊最高#########################################
  1079.         if @battler.startactive == "移动" or @battler.startactive == "返回"
  1080.       if Graphics.frame_count % 4 == 0
  1081.         unless BattlerName[@battler.name].nil?
  1082.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  1083.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1084.         end
  1085.       end
  1086.     elsif @battler.startactive == "死亡"
  1087.        if Graphics.frame_count % 4 == 0
  1088.         unless BattlerName[@battler.name].nil?
  1089.           if @number +1 <= BattlerName[@battler.name][@battler.startactive].size
  1090.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1091.           @number += 1
  1092.         else
  1093.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][BattlerName[@battler.name][@battler.startactive].size-1], @battler_hue)
  1094.           end
  1095.         end
  1096.       end
  1097.       else
  1098.       if Graphics.frame_count % 1 == 0  #更改动画播放帧率
  1099.         unless BattlerName[@battler.name].nil?
  1100.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  1101.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1102.         end
  1103.       end
  1104.     end
  1105.     #######################################################################################
  1106.     # 动画 ID 与当前的情况有差异的情况下
  1107.     if @battler.damage == nil and
  1108.        @battler.state_animation_id != @state_animation_id
  1109.       @state_animation_id = @battler.state_animation_id
  1110.       loop_animation($data_animations[@state_animation_id])
  1111.     end
  1112.     # 应该被显示的角色的情况下
  1113.    if NACTSWITCH > 0
  1114.     if @battler.is_a?(Game_Actor) and @battler_visible
  1115.       # 不是主状态的时候稍稍降低点透明度
  1116.       if $game_temp.battle_main_phase
  1117.         self.opacity += 3 if self.opacity < 255
  1118.       else
  1119.         self.opacity -= 3 if self.opacity > 207
  1120.       end
  1121.     end
  1122.   end
  1123.     if @battler.blink
  1124.       blink_on
  1125.     else
  1126.       blink_off
  1127.     end
  1128.     unless @battler_visible
  1129.       if not @battler.hidden and not @battler.dead? and
  1130.          (@battler.damage == nil or @battler.damage_pop)
  1131.         appear
  1132.         @battler_visible = true
  1133.       end
  1134.     end
  1135.     if @battler_visible
  1136.       if @battler.hidden
  1137.         $game_system.se_play($data_system.escape_se)
  1138.         escape
  1139.         @battler_visible = false
  1140.       end
  1141.       if @battler.white_flash
  1142.         whiten
  1143.         @battler.white_flash = false   
  1144.       end
  1145.         if @battler.animation_id != 0
  1146.         animation = $data_animations[@battler.animation_id]
  1147.         animation(animation, @battler.animation_hit,@battler.damage,@battler.damage_sp, @battler.critical)
  1148.         @battler.animation_id = 0
  1149.       end
  1150.       if @battler.damage_pop
  1151.         @battler.damage = nil
  1152.         @battler.damage_sp = 0
  1153.         @battler.critical = false
  1154.         @battler.damage_pop = false
  1155.       end
  1156.       if @battler.damage == nil and @battler.dead?
  1157.         if DEADPIC >0
  1158.           @battler.startactive = "死亡"
  1159.           else
  1160.         if @battler.is_a?(Game_Enemy)
  1161.           $game_system.se_play($data_system.enemy_collapse_se)
  1162.         else
  1163.           $game_system.se_play($data_system.actor_collapse_se)
  1164.         end
  1165.         collapse
  1166.         @battler_visible = false
  1167.         end
  1168.       end
  1169.     end
  1170.      self.x = @battler.screen_x
  1171.      self.y = @battler.screen_y
  1172.      self.z = @battler.screen_z
  1173.   end
  1174. end
  1175.  
  1176. class Spriteset_Battle
  1177.  
  1178. alias bearrpg_initialize initialize
  1179.   def initialize
  1180.     @enemy_sprites = []
  1181.     for enemy in $game_troop.enemies.reverse
  1182.       #####修改敌人显示端口,与角色一样。
  1183.       @enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy))
  1184.     end
  1185.     bearrpg_initialize
  1186.   end
  1187. end
  1188.  
  1189. class Arrow_Enemy < Arrow_Base
  1190.   def update
  1191.     super
  1192.     $game_troop.enemies.size.times do
  1193.       break if self.enemy.exist?
  1194.       @index += 1
  1195.       @index %= $game_troop.enemies.size
  1196.     end
  1197.     if Input.repeat?(Input::UP)
  1198.       $game_system.se_play($data_system.cursor_se)
  1199.       $game_troop.enemies.size.times do
  1200.         @index += 1
  1201.         @index %= $game_troop.enemies.size
  1202.         break if self.enemy.exist?
  1203.       end
  1204.     end
  1205.     if Input.repeat?(Input::DOWN)
  1206.       $game_system.se_play($data_system.cursor_se)
  1207.       $game_troop.enemies.size.times do
  1208.         @index += $game_troop.enemies.size - 1
  1209.         @index %= $game_troop.enemies.size
  1210.         break if self.enemy.exist?
  1211.       end
  1212.     end
  1213.     if self.enemy != nil
  1214.       self.x = self.enemy.screen_x
  1215.       self.y = self.enemy.screen_y
  1216.     end
  1217.   end
  1218. end
  1219.  
  1220. class Arrow_Actor < Arrow_Base
  1221.   def update
  1222.     super
  1223.     if Input.repeat?(Input::UP)
  1224.       $game_system.se_play($data_system.cursor_se)
  1225.       @index += 1
  1226.       @index %= $game_party.actors.size
  1227.     end
  1228.     if Input.repeat?(Input::DOWN)
  1229.       $game_system.se_play($data_system.cursor_se)
  1230.       @index += $game_party.actors.size - 1
  1231.       @index %= $game_party.actors.size
  1232.     end
  1233.     if self.actor != nil
  1234.       self.x = self.actor.screen_x
  1235.       self.y = self.actor.screen_y
  1236.     end
  1237.   end
  1238. end
  1239.  
  1240. class Scene_Battle
  1241. include Scene_BattleName
  1242. attr_reader :animation1_id
  1243.   def main
  1244.     $game_temp.in_battle = true
  1245.     $game_temp.battle_turn = 0
  1246.     $game_temp.battle_event_flags.clear
  1247.     $game_temp.battle_abort = false
  1248.     $game_temp.battle_main_phase = false
  1249.     $game_temp.battleback_name = $game_map.battleback_name
  1250.     $game_temp.forcing_battler = nil
  1251.     @_move_duration = 0
  1252.     $game_system.battle_interpreter.setup(nil, 0)
  1253.     @troop_id = $game_temp.battle_troop_id
  1254.     $game_troop.setup(@troop_id)
  1255.     s1 = $data_system.words.attack
  1256.     s2 = $data_system.words.skill
  1257.     s3 = $data_system.words.guard
  1258.     s4 = $data_system.words.item
  1259.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  1260.     @actor_command_window.z = 900
  1261.     @actor_command_window.y = 160
  1262.     @actor_command_window.back_opacity = 160
  1263.     @actor_command_window.active = false
  1264.     @actor_command_window.visible = false
  1265.     @party_command_window = Window_PartyCommand.new
  1266.     @party_command_window.z = 910
  1267.     @help_window = Window_Help.new
  1268.     @help_window.back_opacity = 160
  1269.     @help_window.z = 920
  1270.     @help_window.visible = false
  1271.     @status_window = Window_BattleStatus.new
  1272.     @status_window.z = 930
  1273.     @message_window = Window_Message.new
  1274.     @message_window.z = 940
  1275.     @spriteset = Spriteset_Battle.new
  1276.     @wait_count = 0
  1277.     if $data_system.battle_transition == ""
  1278.       Graphics.transition(20)
  1279.     else
  1280.       Graphics.transition(40, "Graphics/Transitions/" +
  1281.         $data_system.battle_transition)
  1282.     end
  1283.     start_phase1
  1284.     loop do
  1285.       Graphics.update
  1286.       Input.update
  1287.       update
  1288.       if $scene != self
  1289.         break
  1290.       end
  1291.     end
  1292.     $game_map.refresh
  1293.     Graphics.freeze
  1294.     @actor_command_window.dispose
  1295.     @party_command_window.dispose
  1296.     @help_window.dispose
  1297.     @status_window.dispose
  1298.     @message_window.dispose
  1299.     if @skill_window != nil
  1300.       @skill_window.dispose
  1301.     end
  1302.     if @item_window != nil
  1303.       @item_window.dispose
  1304.     end
  1305.     if @result_window != nil
  1306.       @result_window.dispose
  1307.     end
  1308.     @spriteset.dispose
  1309.     if $scene.is_a?(Scene_Title)
  1310.       Graphics.transition
  1311.       Graphics.freeze
  1312.     end
  1313.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  1314.       $scene = nil
  1315.     end
  1316.   end
  1317.   def start_phase1
  1318.     # 转移到回合 1
  1319.     @phase = 1
  1320.     # 清除全体同伴的行动
  1321.     $game_party.clear_actions
  1322.     for actor in $game_party.actors
  1323.      actor.startactive = actor.hp>0? "待机" : "死亡"
  1324.     end
  1325.     # 设置战斗事件
  1326.     setup_battle_event
  1327.   end
  1328.   alias bearrpg_start_phase5 start_phase5
  1329. def start_phase5
  1330.    bearrpg_start_phase5
  1331.     @result_window.z = 999
  1332.     @phase5_wait_count = 100
  1333.   end
  1334.   def start_enemy_select
  1335.     @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
  1336.     @enemy_arrow.help_window = @help_window
  1337.     @actor_command_window.active = false
  1338.     @actor_command_window.visible = false
  1339.   end
  1340.   alias bearrpg_start_skill_select start_skill_select
  1341.    def start_skill_select
  1342.       bearrpg_start_skill_select
  1343.       @skill_window.z = 999
  1344.     end
  1345.    alias bearrpg_start_item_select start_item_select
  1346.     def start_item_select
  1347.       bearrpg_start_item_select
  1348.       @item_window.z = 999
  1349.     end
  1350.   def move(active_battler, target, ox, oy, 返回标记 = false)
  1351.     ta_x = target[0]
  1352.     ta_y = target[1]
  1353.     if 返回标记
  1354.       active_battler.movex = (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox) / @_move_duration
  1355.       active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy) / @_move_duration
  1356.     else
  1357.       if @active_battler.is_a?(Game_Enemy)
  1358.         active_battler.movex = (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox ) / @_move_duration
  1359.         active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy ) / @_move_duration
  1360.       else
  1361.         active_battler.movex =  (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox ) / @_move_duration
  1362.         active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy ) / @_move_duration
  1363.       end
  1364.     end
  1365.   end
  1366.   def update_phase4_step3
  1367.     ####普通攻击的场合############################################################
  1368.     if @active_battler.current_action.basic == 0 and
  1369.       @active_battler.current_action.kind == 0
  1370.       #开始执行移动
  1371.      if not @active_battler.element_rate(UNMOVE)>100# 如果属性“不移动”不大于100
  1372.         @active_battler.startactive = "移动"
  1373.         @oldxy = [@active_battler.screen_x,@active_battler.screen_y]
  1374.         ox,oy = @active_battler.screen_x,@active_battler.screen_y
  1375.       if @active_battler.element_rate(HOMOVE)>100# 如果属性“半距离”大于100
  1376.         @_move_duration = Move_Duration/2
  1377.        while @_move_duration > 0
  1378.         Graphics.update
  1379.         Input.update
  1380.         @spriteset.update
  1381.         if @target_battlers[0].is_a?(Game_Actor)
  1382.         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]
  1383.         else
  1384.         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]
  1385.         end
  1386.         move(@active_battler, tag, ox, oy)
  1387.         @_move_duration -= 1
  1388.       end
  1389.     else
  1390.       @_move_duration = Move_Duration
  1391.         while @_move_duration > 0
  1392.         Graphics.update
  1393.         Input.update
  1394.         @spriteset.update
  1395.         if @target_battlers[0].is_a?(Game_Actor)
  1396.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width/2,@target_battlers[0].screen_y+1]
  1397.         else
  1398.         tag = [@target_battlers[0].screen_x+@target_battlers[0].width/1.5,@target_battlers[0].screen_y+2]
  1399.         end
  1400.         move(@active_battler, tag, ox, oy)
  1401.         @_move_duration -= 1
  1402.       end
  1403.       end
  1404.     end
  1405.    ####普通攻击的场合############################################################
  1406.     elsif @active_battler.current_action.kind == 1
  1407.     ####使用特技的场合############################################################
  1408.       if not @skill.element_set.include?(UNMOVE)# 如果技能不包含“不移动属性”
  1409.         @active_battler.startactive = "移动"
  1410.         @oldxy = [@active_battler.screen_x,@active_battler.screen_y]
  1411.         ox,oy = @active_battler.screen_x,@active_battler.screen_y
  1412.       if @skill.element_set.include?(HOMOVE)#如果技能不包含“半距离”属性
  1413.         @_move_duration = Move_Duration/2
  1414.        while @_move_duration > 0
  1415.         Graphics.update
  1416.         Input.update
  1417.         @spriteset.update
  1418.         if @target_battlers[0].is_a?(Game_Actor)
  1419.         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]
  1420.         else
  1421.         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]
  1422.         end
  1423.         move(@active_battler, tag, ox, oy)
  1424.         @_move_duration -= 1
  1425.       end
  1426.     else
  1427.       @_move_duration = Move_Duration
  1428.         while @_move_duration > 0
  1429.         Graphics.update
  1430.         Input.update
  1431.         @spriteset.update
  1432.         if @target_battlers[0].is_a?(Game_Actor)
  1433.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width,@target_battlers[0].screen_y+1]
  1434.         else
  1435.         tag = [@target_battlers[0].screen_x+@target_battlers[0].width/1.5,@target_battlers[0].screen_y+2]
  1436.         end
  1437.         move(@active_battler, tag, ox, oy)
  1438.         @_move_duration -= 1
  1439.       end
  1440.       end
  1441.     end
  1442.    #####使用特技的场合##############################################################
  1443. end
  1444. if @active_battler.startactive != "防御"
  1445.     @active_battler.startactive = "待机"
  1446.    end
  1447.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  1448.     if @animation1_id == 0
  1449.       @active_battler.white_flash = true
  1450.     else
  1451.       @active_battler.animation_id = @animation1_id   #攻击动画
  1452.       @active_battler.animation_hit = true
  1453.     end
  1454.     for target in @target_battlers
  1455.       if target.guarding? and target.damage.is_a?(Numeric)
  1456.         target.startactive = "防御" if target.damage > 0
  1457.         end
  1458.       target.animation_id = @animation2_id
  1459.       target.animation_hit = (target.damage != "Miss")
  1460.     end
  1461.     # 移至步骤 4
  1462.     @phase4_step = 4
  1463.   end
  1464.   ##############################################################################
  1465.   def update_phase4_step4
  1466.    ###########################万兽熊最高########################################
  1467.     # 对像方动画
  1468.      for target in @target_battlers
  1469.        if target.damage != nil
  1470.          target.damage_pop = true
  1471.        end
  1472.      end
  1473.     # 限制动画长度、最低 8 帧
  1474.   #  @wait_count = 8
  1475.   ##############################################################################
  1476.     # 移至步骤 5
  1477.     @phase4_step = 5
  1478.   end
  1479. ####################万兽熊最高############################
  1480.   def update_phase4_step5
  1481.     # 隐藏帮助窗口
  1482.     @help_window.visible = false
  1483.     if @active_battler.current_action.basic == 0 and
  1484.       @active_battler.current_action.kind == 0
  1485.    ####普通攻击的场合############################################################   
  1486.       #执行返回
  1487.     if not @active_battler.element_rate(UNMOVE)>100# 如果属性“不移动”不大于100
  1488.       @active_battler.startactive = "返回"
  1489.       if @active_battler.element_rate(HOMOVE)>100# 如果属性“半距离”大于100
  1490.       @_move_duration = Move_Duration/2
  1491.       else
  1492.       @_move_duration = Move_Duration   
  1493.       end
  1494.       ox,oy = @active_battler.screen_x - @active_battler.movex,\
  1495.       @active_battler.screen_y - @active_battler.movey
  1496.       while @_move_duration > 0
  1497.         Graphics.update
  1498.         Input.update
  1499.         @spriteset.update
  1500.         move(@active_battler, @oldxy, ox, oy, true)
  1501.         @_move_duration -= 1
  1502.       end
  1503.     end
  1504.    ####普通攻击的场合############################################################
  1505.     elsif @active_battler.current_action.kind == 1
  1506.       if not @skill.element_set.include?(UNMOVE)#如果技能不包含“不移动”属性
  1507.       @active_battler.startactive = "返回"
  1508.       if @skill.element_set.include?(HOMOVE)#如果技能包含“半距离”属性
  1509.       @_move_duration = Move_Duration/2
  1510.       else
  1511.       @_move_duration = Move_Duration   
  1512.       end
  1513.       ox,oy = @active_battler.screen_x - @active_battler.movex,\
  1514.       @active_battler.screen_y - @active_battler.movey
  1515.       while @_move_duration > 0
  1516.         Graphics.update
  1517.         Input.update
  1518.         @spriteset.update
  1519.         move(@active_battler, @oldxy, ox, oy, true)
  1520.         @_move_duration -= 1
  1521.       end
  1522.     end
  1523.    ####使用特技的场合############################################################
  1524. end
  1525. if @active_battler.startactive != "防御"
  1526.     @active_battler.startactive = "待机"
  1527.    end
  1528.     # 刷新状态窗口
  1529.     @status_window.refresh
  1530.     # 显示伤害
  1531.     for target in @target_battlers
  1532.       target.startactive = "待机"
  1533.       if target.damage != nil
  1534.         target.damage_pop = true
  1535.       end
  1536.     end
  1537.     # 移至步骤 6
  1538.     @phase4_step = 6
  1539.   end
  1540.   def update_phase4_step6
  1541.     # 清除强制行动对像的战斗者
  1542.     $game_temp.forcing_battler = nil
  1543.     @active_battler.movex = 0
  1544.     @active_battler.movey = 0
  1545.     @active_battler.startactive = "待机" if @active_battler.startactive != "死亡"
  1546.     # 公共事件 ID 有效的情况下
  1547.     if @common_event_id > 0
  1548.       # 设置事件
  1549.       common_event = $data_common_events[@common_event_id]
  1550.       $game_system.battle_interpreter.setup(common_event.list, 0)
  1551.     end
  1552.     # 移至步骤 1
  1553.     @phase4_step = 1
  1554.   end
  1555. end

点评

实际上突破原分辨率也有非脚本的方法,但是通过数据库拼接动画的方式效率未免过低。  发表于 2022-5-27 13:16
现在还能改名吗qwq
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-4-25 01:00

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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