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

Project1

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

[已经解决] 多人战斗不显示

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2245
在线时间
1015 小时
注册时间
2015-10-17
帖子
1288
跳转到指定楼层
1
发表于 2020-10-28 13:03:00 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 fjm 于 2020-10-28 13:06 编辑

改成5人参战后,第五个角色透明显现的,问下怎样才能让第五个角色正常显现,谢谢

战斗系统地址   https://rpg.blue/thread-216673-1-1.html

RUBY 代码复制
  1. #==============================================================================
  2. # ■ 此脚本来自 [url]www.66rpg.com[/url]
  3. #------------------------------------------------------------------------------
  4. #   名称:横版战斗模板
  5. #   作者:后知后觉([email protected])
  6. #   版本:v1.7  2012-02-09
  7. #   使用协议:在保留此脚本相关信息的情况下
  8. #             可任意使用、修改及修改后发布.
  9. #             如是修改后发布.请在作者标注那里加上 某某某改 等信息
  10. #             感谢你来这里谈谈你对这个工程的看法或报告BUG.
  11. #               [url]http://bbs.66rpg.com/thread-216673-1-1.html[/url]
  12. #   使用说明:
  13. #       请来发布帖查看:
  14. #           [url]http://bbs.66rpg.com/thread-216673-1-1.html[/url]
  15. #==============================================================================
  16.  
  17. module Hzhj
  18.   module HorizontalBattleSystem
  19.     # 取得参战角色的最大数.如果要改大.需要在下面的坐标设置里增加对应的条目
  20.     MaxBattleMembers = 5
  21.  
  22.     ActorsBattlePosition = {}
  23.     # 设置角色战斗图形的坐标
  24.     # 等号左边的[]号里面的1 2 3 4 表示角色在队伍里的位置
  25.     # 等号右边的[]号里面的两个数字分别表示 X坐标 Y坐标
  26.     # 每次进入战斗的时候都会以这里设置的信息作为初始化位置.
  27.     # 如果你把上面的 MaxBattleMembers 改大了.比如改成了 5.
  28.     # 那么你需要在下面新增一行代码设置队伍中第5位置的坐标.
  29.     # 就像这样 ActorsBattlePosition[5] = [X坐标, Y坐标]
  30.     ActorsBattlePosition[1] = [378, 228]
  31.     ActorsBattlePosition[2] = [422, 272]
  32.     ActorsBattlePosition[3] = [466, 228]
  33.     ActorsBattlePosition[4] = [510, 272]
  34.     ActorsBattlePosition[5] = [300, 272]
  35.  
  36.     # 设置伤害值图形的色相 取值范围 0~360
  37.     DamageBitmapHue = 0
  38.     # 伤害值分段显示的标志SE文件名
  39.     DamageSectionDisplaySEName = "DamageSection"
  40.  
  41.     # 动画 Z 坐标值默认变化量
  42.     DefaultAniAddZ = 768
  43.  
  44.     # 状态动画 Z 坐标值默认变化量
  45.     DefaultLoopAniAddZ = 20
  46.  
  47.     # 战斗中角色的面向
  48.     ActorDirection = 4
  49.  
  50.     # 真位移的帧数
  51.     RealMoveDuration = 20
  52.     # 真位移移动前会计算目标点.会获取攻防双方战斗图大小来进行计算.
  53.     # 下面2个是对战斗图 width height 进行修正.
  54.     # 为正则扩大 为负则缩小.单位 像素.
  55.     # 一般来说不必修改.只有像梦幻群侠传那种战斗图四边有很多透明区域时才修正.
  56.     RealMoveBmpAddW = 0
  57.     RealMoveBmpAddH = 0
  58.  
  59.     # 使用技能、物品的过程默认使用RMVA模式
  60.     # 在该模式下.本脚本提供的很多功能受限无法使用.
  61.     DefaultUseRmvaMode = false
  62.  
  63.     # 默认显示敌人的HP条、MP条、TP条
  64.     DefaultDisplayEnemyBar = true
  65.  
  66.     # 一张战斗图中有几个样式(帧、格)
  67.     DynamicPatternMax = 4
  68.     # 一张战斗图中的一个样式持续多少帧
  69.     OnePatternDuration = 15
  70.  
  71.     # 角色使用战斗死亡图形
  72.     UseActorDeadGraphic = false
  73.     # 敌人使用战斗死亡图形
  74.     UseEnemyDeadGraphic = false
  75.  
  76.     # 使用挨打图形
  77.     UseBeatenGraphic = true
  78.     # 挨打图形维持帧数
  79.     BeatenGraphicDuration = 30
  80.  
  81.     # 是否使用角色防御图 只有同时使用了挨打图.此项才有效.
  82.     UseActorGuardGraphic = true
  83.     # 是否使用敌人防御图 只有同时使用了挨打图.此项才有效.
  84.     UseEnemyGuardGraphic = false
  85.  
  86.     # 角色是否使用挨打SE
  87.     UseActorWBSE = true
  88.     # 敌人是否使用挨打SE
  89.     UseEnemyWBSE = true
  90.     # 角色是否使用防御SE
  91.     UseActorGDSE = true
  92.     # 敌人是否使用防御SE
  93.     UseEnemyGDSE = false
  94.   end
  95. end
  96.  
  97. class RPG::Actor < RPG::BaseItem
  98.   def battler_name
  99.     return @battler_name unless @battler_name.nil?
  100.     if /@btname\[(.+?)\]/ =~ @note
  101.       return (@battler_name = $1.clone)
  102.     else
  103.       return (@battler_name = "#{@name}_#{@nickname}")
  104.     end
  105.   end
  106.   def battler_hue
  107.     return @battler_hue unless @battler_hue.nil?
  108.     if /@bthue\[([0-9]+?)\]/ =~ @note
  109.       return (@battler_hue = $1.to_i.abs)
  110.     else
  111.       return (@battler_hue = 0)
  112.     end
  113.   end
  114.   attr_writer :battler_name
  115.   attr_writer :battler_hue
  116. end
  117. #==============================================================================
  118. # ■ Game_Actor
  119. #==============================================================================
  120. class Game_Actor < Game_Battler
  121.   #--------------------------------------------------------------------------
  122.   # ● 属性(新增定义)
  123.   #--------------------------------------------------------------------------
  124.   attr_writer   :battler_name             # 战斗图形文件名
  125.   attr_writer   :battler_hue              # 战斗图形色相
  126.   #--------------------------------------------------------------------------
  127.   # ● 设置(追加定义)
  128.   #--------------------------------------------------------------------------
  129.   alias hzhj_old_setup_for_add_actor_battle_graphic setup
  130.   def setup(actor_id)
  131.     hzhj_old_setup_for_add_actor_battle_graphic(actor_id)
  132.     @battler_name = actor.battler_name
  133.     @battler_hue = actor.battler_hue
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # ● 是否使用活动块(重定义)
  137.   #--------------------------------------------------------------------------
  138.   def use_sprite?
  139.     return true
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # ● 取得战斗画面 X 坐标(新增定义)
  143.   #--------------------------------------------------------------------------
  144.   def screen_x
  145.     return ActorsBattlePosition[index + 1][0]
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 取得战斗画面 Y 坐标(新增定义)
  149.   #--------------------------------------------------------------------------
  150.   def screen_y
  151.     return ActorsBattlePosition[index + 1][1]
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ● 取得战斗画面 Z 坐标(新增定义)
  155.   #--------------------------------------------------------------------------
  156.   def screen_z
  157.     return real_screen_y + 100
  158.   end
  159. end
  160. #==============================================================================
  161. # ■ Game_Enemy
  162. #==============================================================================
  163. class Game_Enemy < Game_Battler
  164.   #--------------------------------------------------------------------------
  165.   # ● 属性(新增定义)
  166.   #--------------------------------------------------------------------------
  167.   attr_writer   :battler_name             # 战斗图形文件名
  168.   attr_writer   :battler_hue              # 战斗图形色相
  169.   #--------------------------------------------------------------------------
  170.   # ● 取得战斗画面 Z 坐标(重定义)
  171.   #--------------------------------------------------------------------------
  172.   def screen_z
  173.     return real_screen_y + 100
  174.   end
  175. end
  176. #==============================================================================
  177. # ■ Game_Party
  178. #==============================================================================
  179. class Game_Party < Game_Unit
  180.   include Hzhj::HorizontalBattleSystem
  181.   #--------------------------------------------------------------------------
  182.   # ● 取得参战角色的最大数(重定义)
  183.   #--------------------------------------------------------------------------
  184.   def max_battle_members
  185.     return MaxBattleMembers
  186.   end
  187. end
  188.  
  189. class RPG::Animation
  190.   def wait_subject_duration
  191.     return @wait_subject_duration unless @wait_subject_duration.nil?
  192.     if /@w\[(\-??\d+?)\]/ =~ @name
  193.       @wait_subject_duration = $1.to_i
  194.     else
  195.       @wait_subject_duration = 0
  196.     end
  197.     return @wait_subject_duration
  198.   end
  199.   attr_writer :wait_subject_duration
  200. end
  201. class RPG::UsableItem < RPG::BaseItem
  202.   include Hzhj::HorizontalBattleSystem
  203.   def animation1_id
  204.     return @animation1_id unless @animation1_id.nil?
  205.     if /@a1id\[(\d+?)\]/i =~ @note
  206.       return (@animation1_id = $1.to_i)
  207.     else
  208.       return (@animation1_id = 0)
  209.     end
  210.   end
  211.   def wljn
  212.     return @wljn unless @wljn.nil?
  213.     if /@wljn/i =~ @note
  214.       return (@wljn = true)
  215.     else
  216.       return (@wljn = false)
  217.     end
  218.   end
  219.   def rmva_mode
  220.     return @rmva_mode unless @rmva_mode.nil?
  221.     if /@rmva/i =~ @note
  222.       return (@rmva_mode = !DefaultUseRmvaMode)
  223.     else
  224.       return (@rmva_mode = DefaultUseRmvaMode)
  225.     end
  226.   end
  227.   attr_writer :animation1_id
  228.   attr_writer :wljn
  229.   attr_writer :rmva_mode
  230. end
  231. class RPG::Weapon < RPG::EquipItem
  232.   def animation1_id
  233.     return @animation1_id unless @animation1_id.nil?
  234.     if /@a1id\[(\d+?)\]/ =~ @note
  235.       return (@animation1_id = $1.to_i)
  236.     else
  237.       return (@animation1_id = 0)
  238.     end
  239.   end
  240.   attr_writer :animation1_id
  241. end
  242. class RPG::Enemy < RPG::BaseItem
  243.   def animation1_id
  244.     return @animation1_id unless @animation1_id.nil?
  245.     if /@a1id\[(\d+?)\]/ =~ @note
  246.       return (@animation1_id = $1.to_i)
  247.     else
  248.       return (@animation1_id = 0)
  249.     end
  250.   end
  251.   def animation2_id
  252.     return @animation2_id unless @animation2_id.nil?
  253.     if /@a2id\[(\d+?)\]/ =~ @note
  254.       return (@animation2_id = $1.to_i)
  255.     else
  256.       return (@animation2_id = 0)
  257.     end
  258.   end
  259.   def animation3_id
  260.     return @animation3_id unless @animation3_id.nil?
  261.     if /@a3id\[(\d+?)\]/ =~ @note
  262.       return (@animation3_id = $1.to_i)
  263.     else
  264.       return (@animation3_id = 0)
  265.     end
  266.   end
  267.   attr_writer :animation1_id
  268.   attr_writer :animation2_id
  269.   attr_writer :animation3_id
  270. end
  271. #==============================================================================
  272. # ■ Game_Actor
  273. #==============================================================================
  274. class Game_Actor < Game_Battler
  275.   #--------------------------------------------------------------------------
  276.   # ● 取得普通攻击的行动方动画 ID (新增定义)
  277.   #--------------------------------------------------------------------------
  278.   def animation1_id
  279.     if dual_wield?
  280.       return weapons[0].animation1_id if weapons[0]
  281.       return weapons[1] ? weapons[1].animation1_id : 0
  282.     else
  283.       return weapons[0] ? weapons[0].animation1_id : 0
  284.     end
  285.   end
  286. end
  287. #==============================================================================
  288. # ■ Game_Enemy
  289. #==============================================================================
  290. class Game_Enemy < Game_Battler
  291.   #--------------------------------------------------------------------------
  292.   # ● 取得普通攻击的行动方动画 ID (新增定义)
  293.   #--------------------------------------------------------------------------
  294.   def animation1_id
  295.     return enemy.animation1_id
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # ● 取得普通攻击的动画 ID (新增定义)
  299.   #--------------------------------------------------------------------------
  300.   def atk_animation_id1
  301.     return enemy.animation2_id
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ● 取得普通攻击的动画 ID (二刀流:武器2)(新增定义)
  305.   #--------------------------------------------------------------------------
  306.   def atk_animation_id2
  307.     return enemy.animation3_id
  308.   end
  309. end
  310. #==============================================================================
  311. # ■ Scene_Battle
  312. #==============================================================================
  313. class Scene_Battle < Scene_Base
  314.   include Hzhj::HorizontalBattleSystem
  315.   #--------------------------------------------------------------------------
  316.   # ● 使用技能/物品(重定义)
  317.   #--------------------------------------------------------------------------
  318.   def use_item
  319.     item = @subject.current_action.item
  320.     @log_window.display_use_item(@subject, item)
  321.     @subject.use_item(item)
  322.     refresh_status
  323.     targets = @subject.current_action.make_targets.compact
  324.     show_animation(targets, item.animation_id)
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # ● 显示动画(重定义)
  328.   #--------------------------------------------------------------------------
  329.   def show_animation(targets, animation_id)
  330.     item = @subject.current_action.item
  331.     if item.rmva_mode
  332.       show_rmva_animation(targets, animation_id, item)
  333.     else
  334.       show_hzhj_animation(targets, animation_id, item)
  335.     end
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # ● RMVA模式显示动画(新增定义)
  339.   #--------------------------------------------------------------------------
  340.   def show_rmva_animation(targets, animation_id, item)
  341.     @subject.damage_section_displayed = false
  342.     @subject.not_damage_section = true
  343.     targets.each do |target|
  344.       target.damage_section_displayed = false
  345.       target.not_damage_section = true
  346.     end
  347.     if animation_id < 0
  348.       show_attack_animation(targets)
  349.     else
  350.       show_rmva_usable_animation(targets, animation_id, item)
  351.     end
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ● HZHJ模式显示动画(新增定义)
  355.   #--------------------------------------------------------------------------
  356.   def show_hzhj_animation(targets, animation_id, item)
  357.     if animation_id < 0
  358.       show_hzhj_attack_animation(targets, item)
  359.     else
  360.       if item.wljn
  361.         show_wljn_skill_animation(targets, animation_id, item)
  362.       else
  363.         show_magic_skill_animation(targets, animation_id, item)
  364.       end
  365.     end
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # ● HZHJ模式显示攻击动画(重定义)
  369.   #--------------------------------------------------------------------------
  370.   def show_hzhj_attack_animation(targets, item)
  371.     ary = []
  372.     need_move = false
  373.     animation1 = $data_animations[@subject.animation1_id]
  374.     need_move = animation1.need_move if animation1
  375.     come_back = true
  376.     targets.each_with_index do |target, i|
  377.       ary[0] = target
  378.       item.repeats.times do
  379.         next if target.dead? && item.damage.type == 1
  380.         next if @subject.dead?
  381.         next if !@subject.current_action
  382.         if need_move && come_back
  383.           come_back = false
  384.           @subject.setup_move_info(target, RealMoveDuration, animation1.move_se)
  385.           wait_for_move
  386.         end
  387.         damage_target = hzhj_apply_item_effects(target, item)
  388.         show_subject_animation(@subject.animation1_id)
  389.         show_normal_animation(ary, @subject.atk_animation_id1, false)
  390.         show_normal_animation(ary, @subject.atk_animation_id2, true)
  391.         @log_window.wait
  392.         wait_for_animation
  393.         hzhj_invoke_item(target, item, damage_target)
  394.       end
  395.       if need_move
  396.         if target != targets[i+1] or target.dead?
  397.           come_back = true
  398.           @subject.come_back_self_position(RealMoveDuration)
  399.           wait_for_move
  400.         else
  401.           come_back = false
  402.         end
  403.       end
  404.     end
  405.   end
  406.   #--------------------------------------------------------------------------
  407.   # ● HZHJ模式显示物理技能类动画(新增定义)
  408.   #--------------------------------------------------------------------------
  409.   def show_wljn_skill_animation(targets, animation_id, item)
  410.     ary = []
  411.     need_move = false
  412.     animation1 = $data_animations[item.animation1_id]
  413.     need_move = animation1.need_move if animation1
  414.     come_back = true
  415.     targets.each_with_index do |target, i|
  416.       ary[0] = target
  417.       item.repeats.times do
  418.         next if target.dead? && item.damage.type == 1
  419.         next if @subject.dead?
  420.         next if !@subject.current_action
  421.         if need_move && come_back
  422.           come_back = false
  423.           @subject.setup_move_info(target, RealMoveDuration, animation1.move_se)
  424.           wait_for_move
  425.         end
  426.         damage_target = hzhj_apply_item_effects(target, item)
  427.         show_subject_animation(item.animation1_id)
  428.         show_normal_animation(ary, animation_id, false)
  429.         @log_window.wait
  430.         wait_for_animation
  431.         hzhj_invoke_item(target, item, damage_target)
  432.       end
  433.       if need_move
  434.         if target != targets[i+1] or target.dead?
  435.           come_back = true
  436.           @subject.come_back_self_position(RealMoveDuration)
  437.           wait_for_move
  438.         else
  439.           come_back = false
  440.         end
  441.       end
  442.     end
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ● HZHJ模式显示魔法技能类动画(新增定义)
  446.   #--------------------------------------------------------------------------
  447.   def show_magic_skill_animation(targets, animation_id, item)
  448.     ary = []
  449.     damage_targets = {}
  450.     item.repeats.times do
  451.       next if @subject.dead?
  452.       next if !@subject.current_action
  453.       ary.clear
  454.       damage_targets.clear
  455.       targets.each do |target|
  456.         next if target.dead? && item.damage.type == 1
  457.         ary << target
  458.         damage_targets[target] = hzhj_apply_item_effects(target, item)
  459.       end
  460.       next if ary.empty?
  461.       show_subject_animation(item.animation1_id)
  462.       show_normal_animation(ary, animation_id)
  463.       @log_window.wait
  464.       wait_for_animation
  465.       ary.each do |target|
  466.         hzhj_invoke_item(target, item, damage_targets[target])
  467.       end
  468.       if [9, 10].include?(item.scope)
  469.         ary.each do |target|
  470.           if target.alive?
  471.             target.come_back_self_position(RealMoveDuration)
  472.           end
  473.         end
  474.         wait_for_move
  475.       end
  476.     end
  477.   end
  478.   #--------------------------------------------------------------------------
  479.   # ● RMVA模式显示攻击动画(重定义)
  480.   #--------------------------------------------------------------------------
  481.   def show_attack_animation(targets)
  482.     item = @subject.current_action.item
  483.     show_subject_animation(@subject.animation1_id)
  484.     show_normal_animation(targets, @subject.atk_animation_id1, false)
  485.     show_normal_animation(targets, @subject.atk_animation_id2, true)
  486.     @log_window.wait
  487.     wait_for_animation
  488.     targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  489.   end
  490.   #--------------------------------------------------------------------------
  491.   # ● RMVA模式显示技能、物品动画 (新增定义)
  492.   #--------------------------------------------------------------------------
  493.   def show_rmva_usable_animation(targets, animation_id, item)
  494.     show_subject_animation(item.animation1_id)
  495.     show_normal_animation(targets, animation_id)
  496.     @log_window.wait
  497.     wait_for_animation
  498.     targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  499.     if [9, 10].include?(item.scope)
  500.       targets.each do |target|
  501.         if target.alive?
  502.           target.come_back_self_position(RealMoveDuration)
  503.         end
  504.       end
  505.       wait_for_move
  506.     end
  507.   end
  508.   #--------------------------------------------------------------------------
  509.   # ● 显示行动方动画(新增定义)
  510.   #--------------------------------------------------------------------------
  511.   def show_subject_animation(animation_id, subject = @subject, mirror = false)
  512.     animation = $data_animations[animation_id]
  513.     if animation
  514.       subject.animation_id = animation_id
  515.       subject.animation_mirror = mirror
  516.       if animation.wait_subject_duration < 0
  517.         wait_for_animation
  518.       elsif animation.wait_subject_duration > 0
  519.         animation.wait_subject_duration.times{update_for_wait}
  520.       end
  521.     end
  522.   end
  523. end
  524.  
  525. class RPG::Animation
  526.   include Hzhj::HorizontalBattleSystem
  527.   def ani_z_correction
  528.     return @ani_z_correction unless @ani_z_correction.nil?
  529.     if /@az\[(\-??\d+?)\]/ =~ @name
  530.       return (@ani_z_correction = $1.to_i)
  531.     else
  532.       return (@ani_z_correction = DefaultAniAddZ)
  533.     end
  534.   end
  535.   def loop_z_correction
  536.     return @loop_z_correction unless @loop_z_correction.nil?
  537.     if /@lz\[(\-??\d+?)\]/ =~ @name
  538.       return (@loop_z_correction = $1.to_i)
  539.     else
  540.       return (@loop_z_correction = DefaultLoopAniAddZ)
  541.     end
  542.   end
  543.   attr_writer :ani_z_correction
  544.   attr_writer :loop_z_correction
  545. end
  546. class RPG::State < RPG::BaseItem
  547.   def animation_id
  548.     return @animation_id unless @animation_id.nil?
  549.     if /@aid\[(\d+?)\]/ =~ @note
  550.       return (@animation_id = $1.to_i)
  551.     else
  552.       return (@animation_id = 0)
  553.     end
  554.   end
  555.   attr_writer :animation_id
  556. end
  557. #==============================================================================
  558. # ■ Game_BattlerBase
  559. #==============================================================================
  560. class Game_BattlerBase
  561.   #--------------------------------------------------------------------------
  562.   # ● 实例变量(新增定义)
  563.   #--------------------------------------------------------------------------
  564.   attr_reader   :hzhj_add_state_id
  565.   attr_reader   :hzhj_remove_state_id
  566.   attr_accessor :need_update_state_animation
  567.   #--------------------------------------------------------------------------
  568.   # ● 初始化(追加定义)
  569.   #--------------------------------------------------------------------------
  570.   alias hzhj_old_init_for_state_ani_game_battler_base initialize
  571.   def initialize
  572.     @hzhj_add_state_id = []
  573.     @hzhj_remove_state_id = []
  574.     @need_update_state_animation = false
  575.     @states = []
  576.     @state_turns = {}
  577.     @state_steps = {}
  578.     hzhj_old_init_for_state_ani_game_battler_base
  579.   end
  580.   #--------------------------------------------------------------------------
  581.   # ● 清除状态信息(追加定义)
  582.   #--------------------------------------------------------------------------
  583.   alias hzhj_old_clear_states_for_state_ani_game_battler_base clear_states
  584.   def clear_states
  585.     old_states = @states.clone
  586.     hzhj_old_clear_states_for_state_ani_game_battler_base
  587.     bingji = old_states | @states
  588.     return if bingji.empty?
  589.     set_add_state_id(bingji & @states)
  590.     set_remove_state_id(bingji & old_states)
  591.   end
  592.   #--------------------------------------------------------------------------
  593.   # ● 消除状态(追加定义)
  594.   #--------------------------------------------------------------------------
  595.   alias hzhj_old_erase_state_for_state_ani_game_battler_base erase_state
  596.   def erase_state(state_id)
  597.     old_states = @states.clone
  598.     hzhj_old_erase_state_for_state_ani_game_battler_base(state_id)
  599.     bingji = old_states | @states
  600.     return if bingji.empty?
  601.     set_add_state_id(bingji & @states)
  602.     set_remove_state_id(bingji & old_states)
  603.   end
  604.   #--------------------------------------------------------------------------
  605.   # ● 设置增加的状态(新增定义)
  606.   #--------------------------------------------------------------------------
  607.   def set_add_state_id(zjdzt)
  608.     for i in zjdzt
  609.       if $data_states[i].animation_id > 0
  610.         if not @hzhj_add_state_id.include?(i)
  611.           @hzhj_add_state_id.push(i)
  612.         end
  613.       end
  614.     end
  615.   end
  616.   #--------------------------------------------------------------------------
  617.   # ● 设置解除的状态(新增定义)
  618.   #--------------------------------------------------------------------------
  619.   def set_remove_state_id(jsdzt)
  620.     for i in jsdzt
  621.       if $data_states[i].animation_id > 0
  622.         if not @hzhj_remove_state_id.include?(i)
  623.           ani_id = $data_states[i].animation_id
  624.           not_end_loop_animation = false
  625.           for state in self.states
  626.             if state.animation_id == ani_id
  627.               not_end_loop_animation = true
  628.               break
  629.             end
  630.           end
  631.           unless not_end_loop_animation
  632.             @hzhj_remove_state_id.push(i)
  633.           end
  634.         end
  635.       end
  636.     end
  637.   end
  638. end
  639. #==============================================================================
  640. # ■ Game_Battler
  641. #==============================================================================
  642. class Game_Battler < Game_BattlerBase
  643.   #--------------------------------------------------------------------------
  644.   # ● 附加新的状态(追加定义)
  645.   #--------------------------------------------------------------------------
  646.   alias hzhj_old_add_new_state_for_state_ani_game_battler add_new_state
  647.   def add_new_state(state_id)
  648.     old_states = @states.clone
  649.     hzhj_old_add_new_state_for_state_ani_game_battler(state_id)
  650.     bingji = old_states | @states
  651.     return if bingji.empty?
  652.     set_add_state_id(bingji & @states)
  653.     set_remove_state_id(bingji & old_states)
  654.   end
  655. end
  656. #==============================================================================
  657. # ■ Sprite_Base
  658. #==============================================================================
  659. class Sprite_Base < Sprite
  660.   #--------------------------------------------------------------------------
  661.   # ● 初始化(追加定义)
  662.   #--------------------------------------------------------------------------
  663.   alias hzhj_old_init_for_state_ani_spr_base initialize
  664.   def initialize(*args)
  665.     hzhj_old_init_for_state_ani_spr_base(*args)
  666.     @hzhj_loop_animations = []
  667.     @hzhj_loop_durations = {}
  668.     @hzhj_loop_sprites = {}
  669.     @hzhj_loop_bitmap1s = {}
  670.     @hzhj_loop_bitmap2s = {}
  671.     @hzhj_loop_ani_oxs = {}
  672.     @hzhj_loop_ani_oys = {}
  673.     @flash_nil_duration = 0
  674.   end
  675.   #--------------------------------------------------------------------------
  676.   # ● 释放(追加定义)
  677.   #--------------------------------------------------------------------------
  678.   alias hzhj_old_dispose_for_state_ani_spr_base dispose
  679.   def dispose
  680.     dispose_loop_animation
  681.     hzhj_old_dispose_for_state_ani_spr_base
  682.   end
  683.   #--------------------------------------------------------------------------
  684.   # ● 设定动画的活动块(追加定义)
  685.   #--------------------------------------------------------------------------
  686.   alias hzhj_old_ani_set_spr_for_state_ani_spr_base animation_set_sprites
  687.   def animation_set_sprites(*args)
  688.     hzhj_old_ani_set_spr_for_state_ani_spr_base(*args)
  689.     @ani_sprites.each{|sprite|sprite.z += @animation.ani_z_correction}
  690.   end
  691.   #--------------------------------------------------------------------------
  692.   # ● 判断是否有循环动画(新增定义)
  693.   #--------------------------------------------------------------------------
  694.   def loop_animation?
  695.     return (not @hzhj_loop_animations.empty?)
  696.   end
  697.   #--------------------------------------------------------------------------
  698.   # ● 开始播放循环动画(新增定义)
  699.   #--------------------------------------------------------------------------
  700.   def start_loop_animation(animation)
  701.     return if @hzhj_loop_animations.include?(animation)
  702.     if animation.nil?
  703.       dispose_loop_animation
  704.       return
  705.     end
  706.     set_animation_rate
  707.     @hzhj_loop_animations.push(animation)
  708.     init_loop_animation_duration(animation)
  709.     load_loop_animation_bitmap(animation)
  710.     make_loop_animation_sprites(animation)
  711.     set_loop_animation_origin(animation)
  712.   end
  713.   #--------------------------------------------------------------------------
  714.   # ● 初始化循环动画播放位置(新增定义)
  715.   #--------------------------------------------------------------------------
  716.   def init_loop_animation_duration(animation)
  717.     @hzhj_loop_durations[animation] = animation.frame_max * @ani_rate + 1
  718.   end
  719.   #--------------------------------------------------------------------------
  720.   # ● 读取循环动画图像(新增定义)
  721.   #--------------------------------------------------------------------------
  722.   def load_loop_animation_bitmap(animation)
  723.     animation1_name = animation.animation1_name
  724.     animation1_hue = animation.animation1_hue
  725.     animation2_name = animation.animation2_name
  726.     animation2_hue = animation.animation2_hue
  727.     bitmap1 = Cache.animation(animation1_name, animation1_hue)
  728.     bitmap2 = Cache.animation(animation2_name, animation2_hue)
  729.     if @@_reference_count.include?(bitmap1)
  730.       @@_reference_count[bitmap1] += 1
  731.     else
  732.       @@_reference_count[bitmap1] = 1
  733.     end
  734.     if @@_reference_count.include?(bitmap2)
  735.       @@_reference_count[bitmap2] += 1
  736.     else
  737.       @@_reference_count[bitmap2] = 1
  738.     end
  739.     @hzhj_loop_bitmap1s[animation] = bitmap1
  740.     @hzhj_loop_bitmap2s[animation] = bitmap2
  741.     Graphics.frame_reset
  742.   end
  743.   #--------------------------------------------------------------------------
  744.   # ● 生成循环动画活动块(新增定义)
  745.   #--------------------------------------------------------------------------
  746.   def make_loop_animation_sprites(animation)
  747.     sprites = []
  748.     if @use_sprite
  749.       16.times do
  750.         sprite = ::Sprite.new(viewport)
  751.         sprite.visible = false
  752.         sprites.push(sprite)
  753.       end
  754.     end
  755.     @hzhj_loop_sprites[animation] = sprites
  756.   end
  757.   #--------------------------------------------------------------------------
  758.   # ● 设定循环动画的原点(新增定义)
  759.   #--------------------------------------------------------------------------
  760.   def set_loop_animation_origin(animation)
  761.     if animation.position == 3
  762.       if viewport == nil
  763.         ani_ox = Graphics.width / 2
  764.         ani_oy = Graphics.height / 2
  765.       else
  766.         ani_ox = viewport.rect.width / 2
  767.         ani_oy = viewport.rect.height / 2
  768.       end
  769.     else
  770.       ani_ox = x - ox + width / 2
  771.       ani_oy = y - oy + height / 2
  772.       if animation.position == 0
  773.         ani_oy -= height / 2
  774.       elsif animation.position == 2
  775.         ani_oy += height / 2
  776.       end
  777.     end
  778.     @hzhj_loop_ani_oxs[animation] = ani_ox
  779.     @hzhj_loop_ani_oys[animation] = ani_oy
  780.   end
  781.   #--------------------------------------------------------------------------
  782.   # ● 释放所有循环动画(新增定义)
  783.   #--------------------------------------------------------------------------
  784.   def dispose_loop_animation
  785.     return unless loop_animation?
  786.     for animation in @hzhj_loop_animations.clone
  787.       end_loop_animation(animation)
  788.     end
  789.     @hzhj_loop_durations.clear
  790.     @hzhj_loop_sprites.clear
  791.     @hzhj_loop_bitmap1s.clear
  792.     @hzhj_loop_bitmap2s.clear
  793.     @hzhj_loop_ani_oxs.clear
  794.     @hzhj_loop_ani_oys.clear
  795.     @hzhj_loop_animations.clear
  796.   end
  797.   #--------------------------------------------------------------------------
  798.   # ● 结束某个循环动画(新增定义)
  799.   #--------------------------------------------------------------------------
  800.   def end_loop_animation(animation)
  801.     return if not @hzhj_loop_animations.include?(animation)
  802.     bitmap1 = @hzhj_loop_bitmap1s[animation]
  803.     @@_reference_count[bitmap1] -= 1
  804.     if @@_reference_count[bitmap1] == 0
  805.       @@_reference_count.delete(bitmap1)
  806.       bitmap1.dispose
  807.     end
  808.     bitmap2 = @hzhj_loop_bitmap2s[animation]
  809.     @@_reference_count[bitmap2] -= 1
  810.     if @@_reference_count[bitmap2] == 0
  811.       @@_reference_count.delete(bitmap2)
  812.       bitmap2.dispose
  813.     end
  814.     sprites = @hzhj_loop_sprites[animation]
  815.     for sprite in sprites
  816.       sprite.dispose
  817.     end
  818.     @hzhj_loop_durations.delete(animation)
  819.     @hzhj_loop_sprites.delete(animation)
  820.     @hzhj_loop_bitmap1s.delete(animation)
  821.     @hzhj_loop_bitmap2s.delete(animation)
  822.     @hzhj_loop_ani_oxs.delete(animation)
  823.     @hzhj_loop_ani_oys.delete(animation)
  824.     @hzhj_loop_animations.delete(animation)
  825.   end
  826.   #--------------------------------------------------------------------------
  827.   # ● 刷新(追加定义)
  828.   #--------------------------------------------------------------------------
  829.   alias hzhj_old_update_for_state_ani_spr_base update
  830.   def update
  831.     hzhj_old_update_for_state_ani_spr_base
  832.     update_loop_animation
  833.   end
  834.   #--------------------------------------------------------------------------
  835.   # ● 刷新循环动画(新增定义)
  836.   #--------------------------------------------------------------------------
  837.   def update_loop_animation
  838.     @flash_nil_duration -= 1 if @flash_nil_duration > 0
  839.     return unless loop_animation?
  840.     for animation in @hzhj_loop_animations
  841.       @hzhj_loop_durations[animation] -= 1
  842.       duration = @hzhj_loop_durations[animation]
  843.       if duration % @ani_rate == 0
  844.         if duration > 0
  845.           set_loop_animation_origin(animation)
  846.           frame_index = animation.frame_max
  847.           frame_index -= (duration + @ani_rate - 1) / @ani_rate
  848.           args = []
  849.           args[0] = @hzhj_loop_sprites[animation]
  850.           args[1] = @hzhj_loop_bitmap1s[animation]
  851.           args[2] = @hzhj_loop_bitmap2s[animation]
  852.           args[3] = @hzhj_loop_ani_oxs[animation]
  853.           args[4] = @hzhj_loop_ani_oys[animation]
  854.           args[5] = animation.loop_z_correction
  855.           args[6] = ((not flash_nil? or animation.to_screen?) and visible)
  856.           loop_animation_set_sprites(animation.frames[frame_index], args)
  857.           animation.timings.each do |timing|
  858.             loop_animation_process_timing(timing) if timing.frame == frame_index
  859.           end
  860.         else
  861.           init_loop_animation_duration(animation)
  862.           redo
  863.         end
  864.       end
  865.     end
  866.   end
  867.   #--------------------------------------------------------------------------
  868.   # ● 设定循环动画的活动块(新增定义)
  869.   #--------------------------------------------------------------------------
  870.   def loop_animation_set_sprites(frame, args)
  871.     sprites = args[0]
  872.     bitmap1 = args[1]
  873.     bitmap2 = args[2]
  874.     ani_ox = args[3]
  875.     ani_oy = args[4]
  876.     loop_z_correction = args[5]
  877.     state_visible = args[6]
  878.     cell_data = frame.cell_data
  879.     sprites.each_with_index do |sprite, i|
  880.       next unless sprite
  881.       pattern = cell_data[i, 0]
  882.       if !pattern || pattern < 0
  883.         sprite.visible = false
  884.         next
  885.       end
  886.       sprite.bitmap = pattern < 100 ? bitmap1 : bitmap2
  887.       sprite.visible = state_visible
  888.       sprite.src_rect.set(pattern % 5 * 192,
  889.         pattern % 100 / 5 * 192, 192, 192)
  890.       sprite.x = ani_ox + cell_data[i, 1]
  891.       sprite.y = ani_oy + cell_data[i, 2]
  892.       sprite.angle = cell_data[i, 4]
  893.       sprite.mirror = (cell_data[i, 5] == 1)
  894.       if loop_z_correction > 9999
  895.         sprite.z = loop_z_correction % 10000 + i
  896.       elsif loop_z_correction < -9999
  897.         sprite.z = loop_z_correction % -10000 + i
  898.       else
  899.         sprite.z = self.z + loop_z_correction + i
  900.       end
  901.       sprite.ox = 96
  902.       sprite.oy = 96
  903.       sprite.zoom_x = cell_data[i, 3] / 100.0
  904.       sprite.zoom_y = cell_data[i, 3] / 100.0
  905.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  906.       sprite.blend_type = cell_data[i, 7]
  907.     end
  908.   end
  909.   #--------------------------------------------------------------------------
  910.   # ● 循环动画SE 和闪烁时机的处理(新增定义)
  911.   #--------------------------------------------------------------------------
  912.   def loop_animation_process_timing(timing)
  913.     timing.se.play
  914.     case timing.flash_scope
  915.     when 1
  916.       self.flash(timing.flash_color, timing.flash_duration * @ani_rate)
  917.     when 2
  918.       if viewport
  919.         viewport.flash(timing.flash_color, timing.flash_duration * @ani_rate)
  920.       end
  921.     when 3
  922.       self.flash(nil, timing.flash_duration * @ani_rate)
  923.     end
  924.   end
  925.   #--------------------------------------------------------------------------
  926.   # ● 设置闪烁(追加定义)
  927.   #--------------------------------------------------------------------------
  928.   alias hzhj_old_flash_for_state_ani_spr_base flash
  929.   def flash(*args)
  930.     if args[0].nil?
  931.       @flash_nil_duration = args[1]
  932.     else
  933.       @flash_nil_duration = 0
  934.     end
  935.     hzhj_old_flash_for_state_ani_spr_base(*args)
  936.   end
  937.   #--------------------------------------------------------------------------
  938.   # ● 判断是否正处于【隐藏目标】(新增定义)
  939.   #--------------------------------------------------------------------------
  940.   def flash_nil?
  941.     return (@flash_nil_duration > 0)
  942.   end
  943. end
  944. #==============================================================================
  945. # ■ Sprite_Battler
  946. #==============================================================================
  947. class Sprite_Battler < Sprite_Base
  948.   #--------------------------------------------------------------------------
  949.   # ● 初始化(追加定义)
  950.   #--------------------------------------------------------------------------
  951.   alias hzhj_old_init_for_state_ani_spr_battler initialize
  952.   def initialize(*args)
  953.     hzhj_old_init_for_state_ani_spr_battler(*args)
  954.     init_battler_add_state_id
  955.   end
  956.   #--------------------------------------------------------------------------
  957.   # ● 初始化战斗者要播放状态动画的状态(新增定义)
  958.   #--------------------------------------------------------------------------
  959.   def init_battler_add_state_id
  960.     if @battler.nil?
  961.       dispose_loop_animation
  962.     else
  963.       @battler.hzhj_add_state_id.clear
  964.       @battler.hzhj_remove_state_id.clear
  965.       @battler.need_update_state_animation = true
  966.       for state in @battler.states
  967.         next if state.nil?
  968.         next if $data_animations[state.animation_id].nil?
  969.         @battler.hzhj_add_state_id.push(state.id)
  970.       end
  971.     end
  972.   end
  973.   #--------------------------------------------------------------------------
  974.   # ● 设置战斗者(追加定义)
  975.   #--------------------------------------------------------------------------
  976.   alias hzhj_old_battlerdy_for_state_ani_spr_battler battler=
  977.   def battler=(value)
  978.     old_battler = @battler
  979.     hzhj_old_battlerdy_for_state_ani_spr_battler(value)
  980.     if old_battler != @battler
  981.       init_battler_add_state_id
  982.     end
  983.   end
  984.   #--------------------------------------------------------------------------
  985.   # ● 刷新(追加定义)
  986.   #--------------------------------------------------------------------------
  987.   alias hzhj_old_update_for_state_ani_spr_battler update
  988.   def update
  989.     hzhj_old_update_for_state_ani_spr_battler
  990.     if @battler
  991.       if @battler.need_update_state_animation
  992.         @battler.need_update_state_animation = false
  993.         if not @battler.hzhj_add_state_id.empty?
  994.           for i in @battler.hzhj_add_state_id
  995.             if @battler.state?(i)
  996.               ani_id = $data_states[i].animation_id
  997.               animation = $data_animations[ani_id]
  998.               start_loop_animation(animation) if not animation.nil?
  999.             end
  1000.           end
  1001.           @battler.hzhj_add_state_id.clear
  1002.         end
  1003.         if not @battler.hzhj_remove_state_id.empty?
  1004.           for i in @battler.hzhj_remove_state_id
  1005.             if not @battler.state?(i)
  1006.               ani_id = $data_states[i].animation_id
  1007.               animation = $data_animations[ani_id]
  1008.               end_loop_animation(animation) if not animation.nil?
  1009.             end
  1010.           end
  1011.           @battler.hzhj_remove_state_id.clear
  1012.         end
  1013.       end
  1014.     end
  1015.   end
  1016. end
  1017. #==============================================================================
  1018. # ■ Window_BattleLog
  1019. #==============================================================================
  1020. class Window_BattleLog < Window_Selectable
  1021.   #--------------------------------------------------------------------------
  1022.   # ● 显示状态附加/解除(追加定义)
  1023.   #--------------------------------------------------------------------------
  1024.   alias hzhj_old_display_status_for_state_ani_wnd_btlog display_changed_states
  1025.   def display_changed_states(target)
  1026.     target.need_update_state_animation = true
  1027.     hzhj_old_display_status_for_state_ani_wnd_btlog(target)
  1028.   end
  1029. end
  1030.  
  1031. #==============================================================================
  1032. # ■ Sprite_Damage (新增类)
  1033. #==============================================================================
  1034. class Sprite_Damage < Sprite
  1035.   include Hzhj::HorizontalBattleSystem
  1036.   #--------------------------------------------------------------------------
  1037.   # ● 获取/生成伤害值源图
  1038.   #--------------------------------------------------------------------------
  1039.   @@obmp = nil
  1040.   def self.obmp
  1041.     if @@obmp.nil? or @@obmp.disposed?
  1042.       @@obmp = Bitmap.new(180, 256)
  1043.       @@obmp.font.bold = true
  1044.       @@obmp.font.shadow = false
  1045.       @@obmp.font.outline = true
  1046.       @@obmp.font.out_color = Color.new(255, 255, 255, 255)
  1047.       @@obmp.font.size = 32
  1048.       colors = []
  1049.       colors.push(Color.new(255,   0,   0, 255))
  1050.       colors.push(Color.new(255, 128, 128, 255))
  1051.       colors.push(Color.new(  0,   0, 255, 255))
  1052.       colors.push(Color.new(128, 128, 255, 255))
  1053.       colors.push(Color.new(  0, 255,   0, 255))
  1054.       colors.push(Color.new(128, 255, 128, 255))
  1055.       colors.each_with_index do |color, hi|
  1056.         @@obmp.font.color = color
  1057.         for wi in 0..9
  1058.           @@obmp.draw_text(wi * 18, hi * 32, 18, 32, "#{wi}", 1)
  1059.         end
  1060.       end
  1061.       @@obmp.font.size = 20
  1062.       @@obmp.font.italic = true
  1063.       @@obmp.font.out_color = Color.new(0, 0, 0, 255)
  1064.       @@obmp.font.color = Color.new(255, 255, 255, 255)
  1065.       @@obmp.draw_text( 0, 192, 90, 32, "Critical", 1)
  1066.       @@obmp.draw_text(90, 192, 90, 32, "Miss", 1)
  1067.       @@obmp.draw_text( 0, 224, 90, 32, "Evasion", 1)
  1068.       @@obmp.hue_change(DamageBitmapHue)
  1069.     end
  1070.     return @@obmp
  1071.   end
  1072.   #--------------------------------------------------------------------------
  1073.   # ● 初始化
  1074.   #--------------------------------------------------------------------------
  1075.   def initialize(viewport, args)
  1076.     super(viewport)
  1077.     @type = args[0]
  1078.     @value = args[1]
  1079.     @critical = args[2]
  1080.     self.x = args[4]
  1081.     self.y = args[5]
  1082.     self.z = args[6] + Graphics.height * 5
  1083.     make_move(args[3])
  1084.     refresh
  1085.   end
  1086.   #--------------------------------------------------------------------------
  1087.   # ● 生成移动数据
  1088.   #--------------------------------------------------------------------------
  1089.   def make_move(battler_obj_class)
  1090.     @move = []
  1091.     case battler_obj_class
  1092.     when :actor
  1093.       make_move_actor
  1094.     when :enemy
  1095.       make_move_enemy
  1096.     else
  1097.       make_move_default
  1098.     end
  1099.   end
  1100.   #--------------------------------------------------------------------------
  1101.   # ● 生成移动数据 默认
  1102.   #--------------------------------------------------------------------------
  1103.   def make_move_default
  1104.     45.times do |n|
  1105.       if n % 3 == 0
  1106.         ady = n < 21 ? -6 : -1
  1107.         opa = n < 21 ? 255 : 255-(n-21)*6
  1108.         @move.push([0, ady, opa])
  1109.       else
  1110.         @move.push([0, 0, -1])
  1111.       end
  1112.     end
  1113.   end
  1114.   #--------------------------------------------------------------------------
  1115.   # ● 生成移动数据 角色
  1116.   #--------------------------------------------------------------------------
  1117.   def make_move_actor
  1118.     make_move_default
  1119.   end
  1120.   #--------------------------------------------------------------------------
  1121.   # ● 生成移动数据 敌人
  1122.   #--------------------------------------------------------------------------
  1123.   def make_move_enemy
  1124.     make_move_default
  1125.   end
  1126.   #--------------------------------------------------------------------------
  1127.   # ● 描绘
  1128.   #--------------------------------------------------------------------------
  1129.   def refresh
  1130.     if not self.bitmap.nil?
  1131.       self.bitmap.dispose
  1132.       self.bitmap = nil
  1133.     end
  1134.     begin
  1135.       @obmp = Cache.animation("damage", DamageBitmapHue)
  1136.     rescue Errno::ENOENT
  1137.       @obmp = Sprite_Damage.obmp
  1138.     end
  1139.     @numw = @obmp.width / 10
  1140.     @numh = @obmp.height / 8
  1141.     @strw = @obmp.width / 2
  1142.     case @value
  1143.     when Numeric
  1144.       blt_obmp_numeric
  1145.     when Symbol
  1146.       blt_obmp_text
  1147.     end
  1148.   end
  1149.   #--------------------------------------------------------------------------
  1150.   # ● 通过源图描绘数字
  1151.   #--------------------------------------------------------------------------
  1152.   def blt_obmp_numeric
  1153.     nums = @value.to_i.abs.to_s.split("")
  1154.     nbmpw = nums.size * @numw
  1155.     bmph = @numh
  1156.     cbmpw = 0
  1157.     crect = nil
  1158.     dy = 0
  1159.     if @critical
  1160.       cbmpw = @strw
  1161.       bmph *= 2
  1162.       crect = Rect.new(0, @numh * 6, @strw, @numh)
  1163.       dy = @numh
  1164.     end
  1165.     self.bitmap = Bitmap.new([nbmpw, cbmpw, 32].max, [bmph, 32].max)
  1166.     self.ox = bitmap.width / 2
  1167.     self.oy = bmph /2
  1168.     bitmap.blt((bitmap.width - cbmpw) / 2, 0, @obmp, crect) if crect
  1169.     dx = (bitmap.width - nbmpw) / 2
  1170.     ry = 0
  1171.     case @type
  1172.     when :hp
  1173.       ry = @value >= 0 ? 0 : @numh
  1174.     when :mp
  1175.       ry = @value >= 0 ? @numh * 2 : @numh * 3
  1176.     when :tp
  1177.       ry = @value >= 0 ? @numh * 4 : @numh * 5
  1178.     else
  1179.       return
  1180.     end
  1181.     rect = Rect.new(0, ry, @numw, @numh)
  1182.     nums.each_with_index do |str, i|
  1183.       rect.x = str.to_i * @numw
  1184.       bitmap.blt(dx, dy, @obmp, rect)
  1185.       dx += @numw
  1186.     end
  1187.   end
  1188.   #--------------------------------------------------------------------------
  1189.   # ● 通过源图描绘文字
  1190.   #--------------------------------------------------------------------------
  1191.   def blt_obmp_text
  1192.     self.bitmap = Bitmap.new([@strw, 32].max, [@numh, 32].max)
  1193.     self.ox = @strw / 2
  1194.     self.oy = @numh / 2
  1195.     rx = ry = 0
  1196.     case @type
  1197.     when :miss
  1198.       rx = @strw
  1199.       ry = @numh * 6
  1200.     when :eva
  1201.       ry = @numh * 7
  1202.     else
  1203.       return
  1204.     end
  1205.     rect = Rect.new(rx, ry, @strw, @numh)
  1206.     bitmap.blt(0, 0, @obmp, rect)
  1207.   end
  1208.   #--------------------------------------------------------------------------
  1209.   # ● 释放
  1210.   #--------------------------------------------------------------------------
  1211.   def dispose
  1212.     bitmap.dispose if bitmap
  1213.     super
  1214.   end
  1215.   #--------------------------------------------------------------------------
  1216.   # ● 移动中判定
  1217.   #--------------------------------------------------------------------------
  1218.   def moving?
  1219.     return (not @move.empty?)
  1220.   end
  1221.   #--------------------------------------------------------------------------
  1222.   # ● 刷新
  1223.   #--------------------------------------------------------------------------
  1224.   def update
  1225.     super
  1226.     if moving?
  1227.       ary = @move.shift
  1228.       self.x += ary[0]
  1229.       self.y += ary[1]
  1230.       self.opacity = ary[2] if ary[2] >= 0
  1231.     end
  1232.   end
  1233. end
  1234. #==============================================================================
  1235. # ■ Game_BattlerBase
  1236. #==============================================================================
  1237. class Game_BattlerBase
  1238.   #--------------------------------------------------------------------------
  1239.   # ● 实例变量(新增定义)
  1240.   #--------------------------------------------------------------------------
  1241.   attr_accessor :hzhj_damage
  1242.   #--------------------------------------------------------------------------
  1243.   # ● 初始化(追加定义)
  1244.   #--------------------------------------------------------------------------
  1245.   alias hzhj_old_init_for_display_damage_game_battler_base initialize
  1246.   def initialize
  1247.     @hzhj_damage = []
  1248.     hzhj_old_init_for_display_damage_game_battler_base
  1249.   end
  1250. end
  1251. #==============================================================================
  1252. # ■ Sprite_Base
  1253. #==============================================================================
  1254. class Sprite_Base < Sprite
  1255.   #--------------------------------------------------------------------------
  1256.   # ● 初始化(追加定义)
  1257.   #--------------------------------------------------------------------------
  1258.   alias hzhj_old_init_for_display_damage_spr_base initialize
  1259.   def initialize(*args)
  1260.     hzhj_old_init_for_display_damage_spr_base(*args)
  1261.     @hzhj_damage_sprites = []
  1262.   end
  1263.   #--------------------------------------------------------------------------
  1264.   # ● 释放(追加定义)
  1265.   #--------------------------------------------------------------------------
  1266.   alias hzhj_old_dispose_for_display_damage_spr_base dispose
  1267.   def dispose
  1268.     hzhj_old_dispose_for_display_damage_spr_base
  1269.     dispose_damage
  1270.   end
  1271.   #--------------------------------------------------------------------------
  1272.   # ● 判断是否有伤害在显示(新增定义)
  1273.   #--------------------------------------------------------------------------
  1274.   def damage?
  1275.     return (not @hzhj_damage_sprites.empty?)
  1276.   end
  1277.   #--------------------------------------------------------------------------
  1278.   # ● 开始显示伤害(新增定义)
  1279.   #--------------------------------------------------------------------------
  1280.   def start_damage(args)
  1281.     args[4] = x - ox + width / 2
  1282.     args[5] = y - oy + height / 2
  1283.     args[6] = z
  1284.     @hzhj_damage_sprites.push(Sprite_Damage.new(viewport, args))
  1285.   end
  1286.   #--------------------------------------------------------------------------
  1287.   # ● 释放所有伤害显示(新增定义)
  1288.   #--------------------------------------------------------------------------
  1289.   def dispose_damage
  1290.     return unless damage?
  1291.     @hzhj_damage_sprites.each{|sprite|sprite.dispose}
  1292.     @hzhj_damage_sprites.clear
  1293.   end
  1294.   #--------------------------------------------------------------------------
  1295.   # ● 刷新(追加定义)
  1296.   #--------------------------------------------------------------------------
  1297.   alias hzhj_old_update_for_display_damage_spr_base update
  1298.   def update
  1299.     hzhj_old_update_for_display_damage_spr_base
  1300.     update_damage
  1301.   end
  1302.   #--------------------------------------------------------------------------
  1303.   # ● 刷新显示伤害(新增定义)
  1304.   #--------------------------------------------------------------------------
  1305.   def update_damage
  1306.     return unless damage?
  1307.     @hzhj_damage_sprites.each_with_index do |sprite, i|
  1308.       if sprite.moving?
  1309.         sprite.update
  1310.       else
  1311.         sprite.dispose
  1312.         @hzhj_damage_sprites[i] = nil
  1313.       end
  1314.     end
  1315.     @hzhj_damage_sprites.delete(nil)
  1316.   end
  1317. end
  1318. #==============================================================================
  1319. # ■ Sprite_Battler
  1320. #==============================================================================
  1321. class Sprite_Battler < Sprite_Base
  1322.   #--------------------------------------------------------------------------
  1323.   # ● 刷新(追加定义)
  1324.   #--------------------------------------------------------------------------
  1325.   alias hzhj_old_update_for_display_damage_spr_battler update
  1326.   def update
  1327.     hzhj_old_update_for_display_damage_spr_battler
  1328.     if @battler
  1329.       if not @battler.hzhj_damage.empty?
  1330.         unless @battler.damage_section_displayed
  1331.           args = @battler.hzhj_damage.clone
  1332.           args[3] = @battler.actor? ? :actor : (@battler.enemy? ? :enemy : nil)
  1333.           start_damage(args)
  1334.         end
  1335.         @battler.hzhj_damage.clear
  1336.       end
  1337.     end
  1338.   end
  1339. end
  1340. #==============================================================================
  1341. # ■ Window_BattleLog
  1342. #==============================================================================
  1343. class Window_BattleLog < Window_Selectable
  1344.   #--------------------------------------------------------------------------
  1345.   # ● 显示 MISS (追加定义)
  1346.   #--------------------------------------------------------------------------
  1347.   alias hzhj_old_display_miss_for_display_damage_wnd_btlog display_miss
  1348.   def display_miss(target, item)
  1349.     target.hzhj_damage = [:miss, :miss, false]
  1350.     hzhj_old_display_miss_for_display_damage_wnd_btlog(target, item)
  1351.   end
  1352.   #--------------------------------------------------------------------------
  1353.   # ● 显示回避 (追加定义)
  1354.   #--------------------------------------------------------------------------
  1355.   alias hzhj_old_display_evasion_for_display_damage_wnd_btlog display_evasion
  1356.   def display_evasion(target, item)
  1357.     target.hzhj_damage = [:eva, :evasion, false]
  1358.     hzhj_old_display_evasion_for_display_damage_wnd_btlog(target, item)
  1359.   end
  1360.   #--------------------------------------------------------------------------
  1361.   # ● 显示 HP 伤害 (追加定义)
  1362.   #--------------------------------------------------------------------------
  1363.   alias hzhj_old_display_hp_damage_for_display_damage_wnd_btlog display_hp_damage
  1364.   def display_hp_damage(target, item)
  1365.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  1366.     value = target.result.hp_damage
  1367.     critical = target.result.critical
  1368.     target.hzhj_damage = [:hp, value, critical]
  1369.     hzhj_old_display_hp_damage_for_display_damage_wnd_btlog(target, item)
  1370.   end
  1371.   #--------------------------------------------------------------------------
  1372.   # ● 显示 MP 伤害 (追加定义)
  1373.   #--------------------------------------------------------------------------
  1374.   alias hzhj_old_display_mp_damage_for_display_damage_wnd_btlog display_mp_damage
  1375.   def display_mp_damage(target, item)
  1376.     return if target.dead? || target.result.mp_damage == 0
  1377.     value = target.result.mp_damage
  1378.     critical = target.result.critical
  1379.     target.hzhj_damage = [:mp, value, critical]
  1380.     hzhj_old_display_mp_damage_for_display_damage_wnd_btlog(target, item)
  1381.   end
  1382.   #--------------------------------------------------------------------------
  1383.   # ● 显示 TP 伤害 (追加定义)
  1384.   #--------------------------------------------------------------------------
  1385.   alias hzhj_old_display_tp_damage_for_display_damage_wnd_btlog display_tp_damage
  1386.   def display_tp_damage(target, item)
  1387.     return if target.dead? || target.result.tp_damage == 0
  1388.     value = target.result.tp_damage
  1389.     critical = target.result.critical
  1390.     target.hzhj_damage = [:tp, value, critical]
  1391.     hzhj_old_display_tp_damage_for_display_damage_wnd_btlog(target, item)
  1392.   end
  1393. end
  1394.  
  1395. class RPG::Animation
  1396.   def need_move
  1397.     return @need_move unless @need_move.nil?
  1398.     if /@[Rr][Mm]/ =~ @name
  1399.       return (@need_move = true)
  1400.     else
  1401.       return (@need_move = false)
  1402.     end
  1403.   end
  1404.   def move_se
  1405.     return @move_se unless @move_se.nil?
  1406.     @move_se = RPG::SE.new
  1407.     if /@[Ss][Ee]\[(.+?)\]/ =~ @name
  1408.       @move_se.name = $1.clone
  1409.     end
  1410.     return @move_se
  1411.   end
  1412.   attr_writer :need_move
  1413.   attr_writer :move_se
  1414. end
  1415. #==============================================================================
  1416. # ■ Game_Battler
  1417. #==============================================================================
  1418. class Game_Battler < Game_BattlerBase
  1419.   include Hzhj::HorizontalBattleSystem
  1420.   #--------------------------------------------------------------------------
  1421.   # ● 属性
  1422.   #--------------------------------------------------------------------------
  1423.   attr_accessor :add_x                    # X 坐标变化量
  1424.   attr_accessor :add_y                    # Y 坐标变化量
  1425.   attr_accessor :move_speed_x             # 战斗图 X 移动速度
  1426.   attr_accessor :move_speed_y             # 战斗图 Y 移动速度
  1427.   #--------------------------------------------------------------------------
  1428.   # ● 初始化(追加定义)
  1429.   #--------------------------------------------------------------------------
  1430.   alias hzhj_old_init_for_real_move_game_battler initialize
  1431.   def initialize
  1432.     @add_x = 0
  1433.     @add_y = 0
  1434.     @move_speed_x = 0
  1435.     @move_speed_y = 0
  1436.     hzhj_old_init_for_real_move_game_battler
  1437.   end
  1438.   #--------------------------------------------------------------------------
  1439.   # ● 真实 X 坐标(新增定义)
  1440.   #--------------------------------------------------------------------------
  1441.   def real_screen_x
  1442.     return screen_x + add_x
  1443.   end
  1444.   #--------------------------------------------------------------------------
  1445.   # ● 真实 Y 坐标(新增定义)
  1446.   #--------------------------------------------------------------------------
  1447.   def real_screen_y
  1448.     return screen_y + add_y
  1449.   end
  1450.   #--------------------------------------------------------------------------
  1451.   # ● 返回自己的战斗位置(新增定义)
  1452.   #--------------------------------------------------------------------------
  1453.   def come_back_self_position(duration)
  1454.     return if dead?
  1455.     tx = screen_x
  1456.     ty = screen_y
  1457.     addx = tx - real_screen_x
  1458.     addy = ty - real_screen_y
  1459.     return if addx == 0 && addy == 0
  1460.     @add_x = 0
  1461.     @add_y = 0
  1462.     @move_speed_x = [(addx.abs / duration.to_f).ceil, 1].max
  1463.     @move_speed_y = [(addy.abs / duration.to_f).ceil, 1].max
  1464.   end
  1465.   #--------------------------------------------------------------------------
  1466.   # ● 设置移动信息(新增定义)
  1467.   #--------------------------------------------------------------------------
  1468.   def setup_move_info(target_battler, duration, move_se)
  1469.     return if dead?
  1470.     tbmp = Cache.battler(target_battler.battler_name, target_battler.battler_hue)
  1471.     sbmp = Cache.battler(@battler_name, @battler_hue)
  1472.     tbw = tbmp.width / DynamicPatternMax + RealMoveBmpAddW
  1473.     sbw = sbmp.width / DynamicPatternMax + RealMoveBmpAddW
  1474.     tbh = tbmp.height + RealMoveBmpAddH
  1475.     sbh = sbmp.height + RealMoveBmpAddH
  1476.     d = actor? ? ActorDirection : 10 - ActorDirection
  1477.     tx = target_battler.real_screen_x
  1478.     ty = target_battler.real_screen_y
  1479.     case d
  1480.     when 1
  1481.       tx = tx + tbw / 2 + sbw / 2
  1482.       ty = ty - sbh / 2
  1483.     when 2
  1484.       ty = ty - sbh / 2
  1485.     when 3
  1486.       tx = tx - tbw / 2 - sbw / 2
  1487.       ty = ty - sbh / 2
  1488.     when 4
  1489.       tx = tx + tbw / 2 + sbw / 2
  1490.     when 6
  1491.       tx = tx - tbw / 2 - sbw / 2
  1492.     when 7
  1493.       tx = tx + tbw / 2 + sbw / 2
  1494.       ty = ty + sbh / 2
  1495.     when 8
  1496.       ty = ty + sbh / 2
  1497.     when 9
  1498.       tx = tx - tbw / 2 - sbw / 2
  1499.       ty = ty + sbh / 2
  1500.     end
  1501.     addx = tx - real_screen_x
  1502.     addy = ty - real_screen_y
  1503.     return if addx == 0 && addy == 0
  1504.     @add_x = tx - screen_x if addx != 0
  1505.     @add_y = ty - screen_y if addy != 0
  1506.     @move_speed_x = [(addx.abs / duration.to_f).ceil, 1].max
  1507.     @move_speed_y = [(addy.abs / duration.to_f).ceil, 1].max
  1508.     move_se.play
  1509.   end
  1510. end
  1511. #==============================================================================
  1512. # ■ Sprite_Battler
  1513. #==============================================================================
  1514. class Sprite_Battler < Sprite_Base
  1515.   #--------------------------------------------------------------------------
  1516.   # ● 初始化(追加定义)
  1517.   #--------------------------------------------------------------------------
  1518.   alias hzhj_old_init_for_real_move_spr_battler initialize
  1519.   def initialize(viewport, battler = nil)
  1520.     hzhj_old_init_for_real_move_spr_battler(viewport, battler)
  1521.     init_position(@battler) if @battler
  1522.   end
  1523.   #--------------------------------------------------------------------------
  1524.   # ● 设置战斗者(追加定义)
  1525.   #--------------------------------------------------------------------------
  1526.   alias hzhj_old_set_battler_for_real_move_spr_battler battler=
  1527.   def battler=(value)
  1528.     if @battler != value && value
  1529.       init_position(value)
  1530.     end
  1531.     hzhj_old_set_battler_for_real_move_spr_battler(value)
  1532.   end
  1533.   #--------------------------------------------------------------------------
  1534.   # ● 初始化位置(新增定义)
  1535.   #--------------------------------------------------------------------------
  1536.   def init_position(battler)
  1537.     battler.add_x = 0
  1538.     battler.add_y = 0
  1539.     self.x = battler.real_screen_x
  1540.     self.y = battler.real_screen_y
  1541.     self.z = battler.screen_z
  1542.   end
  1543.   #--------------------------------------------------------------------------
  1544.   # ● 移动中判定(新增定义)
  1545.   #--------------------------------------------------------------------------
  1546.   def moving?
  1547.     return false unless @battler
  1548.     (x != @battler.real_screen_x or y != @battler.real_screen_y) && @battler
  1549.   end
  1550.   #--------------------------------------------------------------------------
  1551.   # ● 位置的更新(重定义)
  1552.   #--------------------------------------------------------------------------
  1553.   def update_position
  1554.     if !@battler.dead?
  1555.       if x < @battler.real_screen_x
  1556.         self.x = [x + @battler.move_speed_x, @battler.real_screen_x].min
  1557.       elsif x > @battler.real_screen_x
  1558.         self.x = [x - @battler.move_speed_x, @battler.real_screen_x].max
  1559.       end
  1560.       if y < @battler.real_screen_y
  1561.         self.y = [y + @battler.move_speed_y, @battler.real_screen_y].min
  1562.       elsif y > @battler.real_screen_y
  1563.         self.y = [y - @battler.move_speed_y, @battler.real_screen_y].max
  1564.       end
  1565.       self.z = y + 100
  1566.     end
  1567.   end
  1568. end
  1569. #==============================================================================
  1570. # ■ Spriteset_Battle
  1571. #==============================================================================
  1572. class Spriteset_Battle
  1573.   #--------------------------------------------------------------------------
  1574.   # ● 判定是否移动中(新增定义)
  1575.   #--------------------------------------------------------------------------
  1576.   def moving?
  1577.     battler_sprites.any? {|sprite| sprite.moving? }
  1578.   end
  1579. end
  1580. #==============================================================================
  1581. # ■ Scene_Battle
  1582. #==============================================================================
  1583. class Scene_Battle < Scene_Base
  1584.   #--------------------------------------------------------------------------
  1585.   # ● 等待战斗图移动的结束(新增定义)
  1586.   #--------------------------------------------------------------------------
  1587.   def wait_for_move
  1588.     update_for_wait
  1589.     update_for_wait while @spriteset.moving?
  1590.   end
  1591. end
  1592.  
  1593. class RPG::Troop
  1594.   include Hzhj::HorizontalBattleSystem
  1595.   def display_enemy_bar
  1596.     return @display_enemy_bar unless @display_enemy_bar.nil?
  1597.     if /@ebar/i =~ @name
  1598.       return (@display_enemy_bar = !DefaultDisplayEnemyBar)
  1599.     else
  1600.       return (@display_enemy_bar = DefaultDisplayEnemyBar)
  1601.     end
  1602.   end
  1603.   attr_writer :display_enemy_bar
  1604. end
  1605. #==============================================================================
  1606. # ■ Game_Troop
  1607. #==============================================================================
  1608. class Game_Troop < Game_Unit
  1609.   attr_accessor :display_enemy_bar      # 是否显示敌人HP条、MP条、TP条
  1610.   #--------------------------------------------------------------------------
  1611.   # ● 设置
  1612.   #--------------------------------------------------------------------------
  1613.   alias hzhj_old_setup_for_display_enemy_bar_game_troop setup
  1614.   def setup(troop_id)
  1615.     hzhj_old_setup_for_display_enemy_bar_game_troop(troop_id)
  1616.     @display_enemy_bar = troop.display_enemy_bar
  1617.   end
  1618. end
  1619. #==============================================================================
  1620. # ■ Window_BattleEnemy
  1621. #==============================================================================
  1622. class Window_BattleEnemy < Window_Selectable
  1623.   #--------------------------------------------------------------------------
  1624.   # ● 取得列数
  1625.   #--------------------------------------------------------------------------
  1626.   def col_max
  1627.     if $game_troop.display_enemy_bar
  1628.       return 1
  1629.     else
  1630.       return 2
  1631.     end
  1632.   end
  1633.   #--------------------------------------------------------------------------
  1634.   # ● 刷新
  1635.   #--------------------------------------------------------------------------
  1636.   def refresh
  1637.     create_contents
  1638.     super
  1639.   end
  1640.   #--------------------------------------------------------------------------
  1641.   # ● 描画项目
  1642.   #--------------------------------------------------------------------------
  1643.   def draw_item(index)
  1644.     if $game_troop.display_enemy_bar
  1645.       enemy = $game_troop.alive_members[index]
  1646.       draw_basic_area(basic_area_rect(index), enemy)
  1647.       draw_gauge_area(gauge_area_rect(index), enemy)
  1648.     else
  1649.       change_color(normal_color)
  1650.       name = $game_troop.alive_members[index].name
  1651.       draw_text(item_rect_for_text(index), name)
  1652.     end
  1653.   end
  1654.   #--------------------------------------------------------------------------
  1655.   # ● 取得基本区域的矩形
  1656.   #--------------------------------------------------------------------------
  1657.   def basic_area_rect(index)
  1658.     rect = item_rect_for_text(index)
  1659.     rect.width -= gauge_area_width + 10
  1660.     rect
  1661.   end
  1662.   #--------------------------------------------------------------------------
  1663.   # ● 取得值槽区域的矩形
  1664.   #--------------------------------------------------------------------------
  1665.   def gauge_area_rect(index)
  1666.     rect = item_rect_for_text(index)
  1667.     rect.x += rect.width - gauge_area_width
  1668.     rect.width = gauge_area_width
  1669.     rect
  1670.   end
  1671.   #--------------------------------------------------------------------------
  1672.   # ● 取得值槽区域的宽度
  1673.   #--------------------------------------------------------------------------
  1674.   def gauge_area_width
  1675.     return 220
  1676.   end
  1677.   #--------------------------------------------------------------------------
  1678.   # ● 描画基本区域
  1679.   #--------------------------------------------------------------------------
  1680.   def draw_basic_area(rect, actor)
  1681.     draw_actor_name(actor, rect.x + 0, rect.y, 100)
  1682.     draw_actor_icons(actor, rect.x + 104, rect.y, rect.width - 104)
  1683.   end
  1684.   #--------------------------------------------------------------------------
  1685.   # ● 描画值槽区域
  1686.   #--------------------------------------------------------------------------
  1687.   def draw_gauge_area(rect, actor)
  1688.     if $data_system.opt_display_tp
  1689.       draw_gauge_area_with_tp(rect, actor)
  1690.     else
  1691.       draw_gauge_area_without_tp(rect, actor)
  1692.     end
  1693.   end
  1694.   #--------------------------------------------------------------------------
  1695.   # ● 描画值槽区域(包括 TP 值)
  1696.   #--------------------------------------------------------------------------
  1697.   def draw_gauge_area_with_tp(rect, actor)
  1698.     draw_actor_hp(actor, rect.x + 0, rect.y, 72)
  1699.     draw_actor_mp(actor, rect.x + 82, rect.y, 64)
  1700.     draw_actor_tp(actor, rect.x + 156, rect.y, 64)
  1701.   end
  1702.   #--------------------------------------------------------------------------
  1703.   # ● 描画值槽区域(不包括 TP 值)
  1704.   #--------------------------------------------------------------------------
  1705.   def draw_gauge_area_without_tp(rect, actor)
  1706.     draw_actor_hp(actor, rect.x + 0, rect.y, 134)
  1707.     draw_actor_mp(actor, rect.x + 144,  rect.y, 76)
  1708.   end
  1709. end
  1710.  
  1711. #==============================================================================
  1712. # ■ Sprite_Battler
  1713. #==============================================================================
  1714. class Sprite_Battler < Sprite_Base
  1715.   include Hzhj::HorizontalBattleSystem
  1716.   #--------------------------------------------------------------------------
  1717.   # ● 初始化(追加定义)
  1718.   #--------------------------------------------------------------------------
  1719.   alias hzhj_old_init_for_dynamic_spr_battler initialize
  1720.   def initialize(viewport, battler = nil)
  1721.     hzhj_old_init_for_dynamic_spr_battler(viewport, battler)
  1722.     @dynamic_duration = 0
  1723.     @dynamic_duration_max = DynamicPatternMax * OnePatternDuration
  1724.   end
  1725.   #--------------------------------------------------------------------------
  1726.   # ● 源位图(Source Bitmap)的更新(重定义)
  1727.   #--------------------------------------------------------------------------
  1728.   def update_bitmap
  1729.     new_bitmap = Cache.battler(@battler.battler_name, @battler.battler_hue)
  1730.     if bitmap != new_bitmap
  1731.       self.bitmap = new_bitmap
  1732.       init_visibility
  1733.       @dynamic_duration = 0
  1734.       @sx = 0
  1735.       @sw = bitmap.width / DynamicPatternMax
  1736.       @sh = bitmap.height
  1737.       self.ox = @sw / 2
  1738.       self.oy = @sh
  1739.       src_rect.set(@sx, 0, @sw, @sh)
  1740.     end
  1741.   end
  1742.   #--------------------------------------------------------------------------
  1743.   # ● 原点的更新(重定义)
  1744.   #--------------------------------------------------------------------------
  1745.   def update_origin
  1746.     if bitmap
  1747.       @dynamic_duration += 1
  1748.       @dynamic_duration %= @dynamic_duration_max
  1749.       @sx = @dynamic_duration / OnePatternDuration * @sw
  1750.       src_rect.set(@sx, 0, @sw, @sh)
  1751.     end
  1752.   end
  1753.   #--------------------------------------------------------------------------
  1754.   # ● 返回普通设定(追加定义)
  1755.   #--------------------------------------------------------------------------
  1756.   alias hzhj_old_revert_to_normal_for_dynamic_spr_battler revert_to_normal
  1757.   def revert_to_normal
  1758.     hzhj_old_revert_to_normal_for_dynamic_spr_battler
  1759.     self.ox = @sw / 2 if bitmap
  1760.   end
  1761.   #--------------------------------------------------------------------------
  1762.   # ● BOSS 战败(崩坏)效果的更新(追加定义)
  1763.   #--------------------------------------------------------------------------
  1764.   alias hzhj_old_update_boss_col_for_dynamic_spr_battler update_boss_collapse
  1765.   def update_boss_collapse
  1766.     hzhj_old_update_boss_col_for_dynamic_spr_battler
  1767.     self.ox = @sw / 2 + @effect_duration % 2 * 4 - 2
  1768.   end
  1769. end
  1770.  
  1771. #==============================================================================
  1772. # ■ Game_Battler
  1773. #==============================================================================
  1774. class Game_Battler < Game_BattlerBase
  1775.   def set_normal_battler_name
  1776.     @battler_name = @battler_name.split(/★/)[0]
  1777.   end
  1778.   def set_beaten_battler_name
  1779.     if guard?
  1780.       if (UseActorGuardGraphic && actor?) or
  1781.          (UseEnemyGuardGraphic && enemy?)
  1782.         set_guard_battler_name
  1783.         return
  1784.       end
  1785.     end
  1786.     @battler_name = @battler_name.split(/★/)[0] + "★1"
  1787.     if UseActorWBSE && actor?
  1788.       Audio.se_play("Audio/SE/AWBSE_#{id}", 100, 100)
  1789.     elsif UseEnemyWBSE && enemy?
  1790.       Audio.se_play("Audio/SE/EWBSE_#{enemy_id}", 100, 100)
  1791.     end
  1792.   end
  1793.   def set_dead_battler_name
  1794.     @battler_name = @battler_name.split(/★/)[0] + "★2"
  1795.   end
  1796.   def set_guard_battler_name
  1797.     @battler_name = @battler_name.split(/★/)[0] + "★3"
  1798.     if UseActorGDSE && actor?
  1799.       Audio.se_play("Audio/SE/AGDSE_#{id}", 100, 100)
  1800.     elsif UseEnemyGDSE && enemy?
  1801.       Audio.se_play("Audio/SE/EGDSE_#{enemy_id}", 100, 100)
  1802.     end
  1803.   end
  1804. end
  1805. #==============================================================================
  1806. # ■ Sprite_Battler
  1807. #==============================================================================
  1808. class Sprite_Battler < Sprite_Base
  1809.   #--------------------------------------------------------------------------
  1810.   # ● 初始化(追加定义)
  1811.   #--------------------------------------------------------------------------
  1812.   alias hzhj_old_init_for_dead_spr_battler initialize
  1813.   def initialize(viewport, battler = nil)
  1814.     hzhj_old_init_for_dead_spr_battler(viewport, battler)
  1815.     @dead_graphic_used = false
  1816.     if @battler
  1817.       @battler.set_normal_battler_name
  1818.       if @battler.dead?
  1819.         if (UseActorDeadGraphic && @battler.actor?) or
  1820.            (UseEnemyDeadGraphic && @battler.enemy?)
  1821.           @battler.set_dead_battler_name
  1822.           @dead_graphic_used = true
  1823.         end
  1824.       end
  1825.     end
  1826.     @beaten_duration = -1
  1827.   end
  1828.   #--------------------------------------------------------------------------
  1829.   # ● 设置战斗者(追加定义)
  1830.   #--------------------------------------------------------------------------
  1831.   alias hzhj_old_set_battler_for_dead_spr_battler battler=
  1832.   def battler=(value)
  1833.     if @battler != value
  1834.       @dead_graphic_used = false
  1835.       if value
  1836.         value.set_normal_battler_name
  1837.         if value.dead?
  1838.           if (UseActorDeadGraphic && value.actor?) or
  1839.              (UseEnemyDeadGraphic && value.enemy?)
  1840.             value.set_dead_battler_name
  1841.             @dead_graphic_used = true
  1842.           end
  1843.         end
  1844.       end
  1845.       @beaten_duration = -1
  1846.     end
  1847.     hzhj_old_set_battler_for_dead_spr_battler(value)
  1848.   end
  1849.   #--------------------------------------------------------------------------
  1850.   # ● 源位图(Source Bitmap)的更新(重定义)
  1851.   #--------------------------------------------------------------------------
  1852.   alias hzhj_old_update_bitmap_for_was_beaten_spr_battler update_bitmap
  1853.   def update_bitmap
  1854.     if @beaten_duration > 0
  1855.       @beaten_duration -= 1
  1856.     elsif @beaten_duration == 0
  1857.       @beaten_duration = -1
  1858.       set_bitmap(:normal)
  1859.     end
  1860.     hzhj_old_update_bitmap_for_was_beaten_spr_battler
  1861.   end
  1862.   #--------------------------------------------------------------------------
  1863.   # ● 初始化可视状态(追加定义)
  1864.   #--------------------------------------------------------------------------
  1865.   alias hzhj_old_visibility_for_dead_spr_battler init_visibility
  1866.   def init_visibility
  1867.     hzhj_old_visibility_for_dead_spr_battler
  1868.     if @battler.dead?
  1869.       if (UseActorDeadGraphic && @battler.actor?) or
  1870.          (UseEnemyDeadGraphic && @battler.enemy?)
  1871.         self.opacity = 255
  1872.       end
  1873.     end
  1874.   end
  1875.   #--------------------------------------------------------------------------
  1876.   # ● 效果开始(追加定义)
  1877.   #--------------------------------------------------------------------------
  1878.   alias hzhj_old_start_effect_for_dead_spr_battler start_effect
  1879.   def start_effect(effect_type)
  1880.     if effect_type == :appear
  1881.       if @dead_graphic_used
  1882.         set_bitmap(:normal)
  1883.         @effect_type = nil
  1884.         @effect_duration = 0
  1885.         @dead_graphic_used = false
  1886.         @battler_visible = true
  1887.         return
  1888.       end
  1889.     elsif effect_type == :collapse or
  1890.           effect_type == :boss_collapse or
  1891.           effect_type == :instant_collapse
  1892.       if @beaten_duration >= 0
  1893.         @beaten_duration = -1
  1894.         set_bitmap(:normal)
  1895.       end
  1896.       if (UseActorDeadGraphic && @battler.actor?) or
  1897.          (UseEnemyDeadGraphic && @battler.enemy?)
  1898.         set_bitmap(:dead)
  1899.         @effect_type = nil
  1900.         @effect_duration = 0
  1901.         @dead_graphic_used = true
  1902.         @battler_visible = false
  1903.         return
  1904.       end
  1905.     end
  1906.     hzhj_old_start_effect_for_dead_spr_battler(effect_type)
  1907.   end
  1908.   #--------------------------------------------------------------------------
  1909.   # ● 设置新的位图(新增定义)
  1910.   #--------------------------------------------------------------------------
  1911.   def set_bitmap(sym)
  1912.     case sym
  1913.     when :normal
  1914.       @battler.set_normal_battler_name
  1915.     when :was_beaten
  1916.       @battler.set_beaten_battler_name
  1917.     when :dead
  1918.       @battler.set_dead_battler_name
  1919.     else
  1920.       return
  1921.     end
  1922.     new_bitmap = Cache.battler(@battler.battler_name, @battler.battler_hue)
  1923.     if bitmap != new_bitmap
  1924.       self.bitmap = new_bitmap
  1925.       @dynamic_duration = 0
  1926.       @sx = 0
  1927.       @sw = bitmap.width / DynamicPatternMax
  1928.       @sh = bitmap.height
  1929.       self.ox = @sw / 2
  1930.       self.oy = @sh
  1931.       src_rect.set(@sx, 0, @sw, @sh)
  1932.     end
  1933.     update_origin
  1934.     update_position
  1935.   end
  1936. end
  1937.  
  1938. #==============================================================================
  1939. # ■ Scene_Battle
  1940. #==============================================================================
  1941. class Scene_Battle < Scene_Base
  1942.   #--------------------------------------------------------------------------
  1943.   # ● 发动技能/物品(新增定义)
  1944.   #--------------------------------------------------------------------------
  1945.   def hzhj_invoke_item(target, item, damage_target)
  1946.     refresh_status
  1947.     @log_window.display_action_results(damage_target, item)
  1948.     @subject.damage_section_displayed = false
  1949.     @subject.last_target_index = target.index
  1950.     return if target.dead?
  1951.     if rand < target.item_cnt(@subject, item)
  1952.       hzhj_invoke_counter_attack(target, item)
  1953.     elsif rand < target.item_mrf(@subject, item)
  1954.       hzhj_invoke_magic_reflection(target, item)
  1955.     end
  1956.   end
  1957.   #--------------------------------------------------------------------------
  1958.   # ● 发动物理反击(新增定义)
  1959.   #--------------------------------------------------------------------------
  1960.   def hzhj_invoke_counter_attack(target, item)
  1961.     @log_window.display_counter(target, item)
  1962.     attack_skill = $data_skills[target.attack_skill_id]
  1963.     @subject.item_apply(target, attack_skill)
  1964.     need_move = false
  1965.     animation1 = $data_animations[target.animation1_id]
  1966.     need_move = animation1.need_move if animation1
  1967.     ary = [@subject]
  1968.     if need_move
  1969.       target.setup_move_info(@subject, RealMoveDuration, animation1.move_se)
  1970.       wait_for_move
  1971.     end
  1972.     @subject.damage_section_displayed = false
  1973.     @subject.not_damage_section = false
  1974.     show_subject_animation(target.animation1_id, target)
  1975.     show_normal_animation(ary, target.atk_animation_id1, false)
  1976.     show_normal_animation(ary, target.atk_animation_id2, true)
  1977.     @log_window.wait
  1978.     wait_for_animation
  1979.     if need_move && target.alive?
  1980.       target.come_back_self_position(RealMoveDuration)
  1981.       wait_for_move
  1982.     end
  1983.     refresh_status
  1984.     @log_window.display_action_results(@subject, attack_skill)
  1985.   end
  1986.   #--------------------------------------------------------------------------
  1987.   # ● 发动魔法反射(新增定义)
  1988.   #--------------------------------------------------------------------------
  1989.   def hzhj_invoke_magic_reflection(target, item)
  1990.     @subject.damage_section_displayed = false
  1991.     @subject.not_damage_section = false
  1992.     @log_window.display_reflection(target, item)
  1993.     @subject.item_apply(@subject, item)
  1994.     refresh_status
  1995.     @log_window.display_action_results(@subject, item)
  1996.   end
  1997. end
  1998.  
  1999. #==============================================================================
  2000. # ■ Game_Battler
  2001. #==============================================================================
  2002. class Game_Battler < Game_BattlerBase
  2003.   attr_accessor :damage_section_displayed
  2004.   attr_accessor :not_damage_section
  2005. end
  2006. #==============================================================================
  2007. # ■ Game_Actor
  2008. #==============================================================================
  2009. class Game_Actor < Game_Battler
  2010.   #--------------------------------------------------------------------------
  2011.   # ● 执行伤害效果
  2012.   #--------------------------------------------------------------------------
  2013.   alias hzhj_old_per_damage_for_damage_section_game_actor perform_damage_effect
  2014.   def perform_damage_effect
  2015.     unless damage_section_displayed
  2016.       hzhj_old_per_damage_for_damage_section_game_actor
  2017.     end
  2018.   end
  2019. end
  2020. #==============================================================================
  2021. # ■ Game_Enemy
  2022. #==============================================================================
  2023. class Game_Enemy < Game_Battler
  2024.   #--------------------------------------------------------------------------
  2025.   # ● 执行伤害效果
  2026.   #--------------------------------------------------------------------------
  2027.   alias hzhj_old_per_damage_for_damage_section_game_enemy perform_damage_effect
  2028.   def perform_damage_effect
  2029.     unless damage_section_displayed
  2030.       hzhj_old_per_damage_for_damage_section_game_enemy
  2031.     end
  2032.   end
  2033. end
  2034. #==============================================================================
  2035. # ■ Sprite_Battler
  2036. #==============================================================================
  2037. class Sprite_Battler < Sprite_Base
  2038.   #--------------------------------------------------------------------------
  2039.   # ● SE 和闪烁时机的处理
  2040.   #--------------------------------------------------------------------------
  2041.   def animation_process_timing(timing)
  2042.     if timing.se.name == DamageSectionDisplaySEName
  2043.       hp_value = @battler.result.hp_damage
  2044.       mp_value = @battler.result.mp_damage
  2045.       tp_value = @battler.result.tp_damage
  2046.       value = args = nil
  2047.       was_beaten = false
  2048.       if hp_value != 0 && !@battler.not_damage_section
  2049.         was_beaten = true if hp_value > 0
  2050.         value = hp_value * timing.flash_color.red.to_i / 100
  2051.         critical = @battler.result.critical
  2052.         args = [:hp, value, critical]
  2053.       elsif mp_value != 0 && !@battler.not_damage_section
  2054.         was_beaten = true if mp_value > 0
  2055.         value = mp_value * timing.flash_color.red.to_i / 100
  2056.         critical = @battler.result.critical
  2057.         args = [:mp, value, critical]
  2058.       elsif tp_value != 0 && !@battler.not_damage_section
  2059.         was_beaten = true if tp_value > 0
  2060.         value = tp_value * timing.flash_color.red.to_i / 100
  2061.         critical = @battler.result.critical
  2062.         args = [:tp, value, critical]
  2063.       end
  2064.       if value && args
  2065.         args[3] = @battler.actor? ? :actor : (@battler.enemy? ? :enemy : nil)
  2066.         @battler.damage_section_displayed = true
  2067.         start_damage(args)
  2068.         if UseBeatenGraphic && was_beaten
  2069.           set_bitmap(:was_beaten)
  2070.           @beaten_duration = BeatenGraphicDuration
  2071.         end
  2072.       end
  2073.       return
  2074.     end
  2075.     super(timing)
  2076.   end
  2077. end
  2078. #==============================================================================
  2079. # ■ Scene_Battle
  2080. #==============================================================================
  2081. class Scene_Battle < Scene_Base
  2082.   #--------------------------------------------------------------------------
  2083.   # ● 应用技能/物品效果(新增定义)
  2084.   #--------------------------------------------------------------------------
  2085.   def hzhj_apply_item_effects(target, item)
  2086.     target.damage_section_displayed = false
  2087.     target.not_damage_section = false
  2088.     target = apply_substitute(target, item)
  2089.     target.damage_section_displayed = false
  2090.     target.not_damage_section = false
  2091.     target.item_apply(@subject, item)
  2092.     return target
  2093.   end
  2094. end
  2095. #==============================================================================
  2096. # ■ 此脚本来自 [url]www.66rpg.com[/url]
  2097. #==============================================================================


69888.png (124.14 KB, 下载次数: 46)

69888.png

Lv4.逐梦者

梦石
0
星屑
14941
在线时间
5814 小时
注册时间
2011-7-18
帖子
158

开拓者

2
发表于 2020-10-28 17:40:29 | 只看该作者

点评

fjm
非常感谢,解决这个问题了  发表于 2020-10-28 19:43

评分

参与人数 1+1 收起 理由
fjm + 1 认可答案

查看全部评分

这里岚风·雷,任饭、PM理性粉、UT/DR原作粉、(Trans)Furry自萌,半吊子技术一枚_(:з」∠)_    游戏制作交流工(liao)作(tian)室欢迎来玩!
【无偿/有偿】RGSS3(VA)脚本定制 + 合作招募/同好交友    修正Firefox/火狐浏览器的代码框复制问题(油猴脚本)
Click→←Click
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-20 07:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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