查看: 3644|回复: 2

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

[复制链接]
梦石
0
星屑
2245
在线时间
1015 小时
注册时间
2015-10-17
回帖
1077
发表于 2020-10-28 13:03:00 | 显示全部楼层 |阅读模式

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

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

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

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

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

  1. #==============================================================================
  2. # ■ 此脚本来自 [url]www.66rpg.com[/url]
  3. #------------------------------------------------------------------------------
  4. #   名称:横版战斗模板
  5. #   作者:后知后觉(hzhj.tnt@163.com)
  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. module Hzhj
  17.   module HorizontalBattleSystem
  18.     # 取得参战角色的最大数.如果要改大.需要在下面的坐标设置里增加对应的条目
  19.     MaxBattleMembers = 5
  20.    
  21.     ActorsBattlePosition = {}
  22.     # 设置角色战斗图形的坐标
  23.     # 等号左边的[]号里面的1 2 3 4 表示角色在队伍里的位置
  24.     # 等号右边的[]号里面的两个数字分别表示 X坐标 Y坐标
  25.     # 每次进入战斗的时候都会以这里设置的信息作为初始化位置.
  26.     # 如果你把上面的 MaxBattleMembers 改大了.比如改成了 5.
  27.     # 那么你需要在下面新增一行代码设置队伍中第5位置的坐标.
  28.     # 就像这样 ActorsBattlePosition[5] = [X坐标, Y坐标]
  29.     ActorsBattlePosition[1] = [378, 228]
  30.     ActorsBattlePosition[2] = [422, 272]
  31.     ActorsBattlePosition[3] = [466, 228]
  32.     ActorsBattlePosition[4] = [510, 272]
  33.     ActorsBattlePosition[5] = [300, 272]
  34.    
  35.     # 设置伤害值图形的色相 取值范围 0~360
  36.     DamageBitmapHue = 0
  37.     # 伤害值分段显示的标志SE文件名
  38.     DamageSectionDisplaySEName = "DamageSection"
  39.    
  40.     # 动画 Z 坐标值默认变化量
  41.     DefaultAniAddZ = 768
  42.    
  43.     # 状态动画 Z 坐标值默认变化量
  44.     DefaultLoopAniAddZ = 20
  45.    
  46.     # 战斗中角色的面向
  47.     ActorDirection = 4
  48.    
  49.     # 真位移的帧数
  50.     RealMoveDuration = 20
  51.     # 真位移移动前会计算目标点.会获取攻防双方战斗图大小来进行计算.
  52.     # 下面2个是对战斗图 width height 进行修正.
  53.     # 为正则扩大 为负则缩小.单位 像素.
  54.     # 一般来说不必修改.只有像梦幻群侠传那种战斗图四边有很多透明区域时才修正.
  55.     RealMoveBmpAddW = 0
  56.     RealMoveBmpAddH = 0
  57.    
  58.     # 使用技能、物品的过程默认使用RMVA模式
  59.     # 在该模式下.本脚本提供的很多功能受限无法使用.
  60.     DefaultUseRmvaMode = false
  61.    
  62.     # 默认显示敌人的HP条、MP条、TP条
  63.     DefaultDisplayEnemyBar = true
  64.    
  65.     # 一张战斗图中有几个样式(帧、格)
  66.     DynamicPatternMax = 4
  67.     # 一张战斗图中的一个样式持续多少帧
  68.     OnePatternDuration = 15
  69.    
  70.     # 角色使用战斗死亡图形
  71.     UseActorDeadGraphic = false
  72.     # 敌人使用战斗死亡图形
  73.     UseEnemyDeadGraphic = false
  74.    
  75.     # 使用挨打图形
  76.     UseBeatenGraphic = true
  77.     # 挨打图形维持帧数
  78.     BeatenGraphicDuration = 30
  79.    
  80.     # 是否使用角色防御图 只有同时使用了挨打图.此项才有效.
  81.     UseActorGuardGraphic = true
  82.     # 是否使用敌人防御图 只有同时使用了挨打图.此项才有效.
  83.     UseEnemyGuardGraphic = false
  84.    
  85.     # 角色是否使用挨打SE
  86.     UseActorWBSE = true
  87.     # 敌人是否使用挨打SE
  88.     UseEnemyWBSE = true
  89.     # 角色是否使用防御SE
  90.     UseActorGDSE = true
  91.     # 敌人是否使用防御SE
  92.     UseEnemyGDSE = false
  93.   end
  94. end

  95. class RPG::Actor < RPG::BaseItem
  96.   def battler_name
  97.     return @battler_name unless @battler_name.nil?
  98.     if /@btname\[(.+?)\]/ =~ @note
  99.       return (@battler_name = $1.clone)
  100.     else
  101.       return (@battler_name = "#{@name}_#{@nickname}")
  102.     end
  103.   end
  104.   def battler_hue
  105.     return @battler_hue unless @battler_hue.nil?
  106.     if /@bthue\[([0-9]+?)\]/ =~ @note
  107.       return (@battler_hue = $1.to_i.abs)
  108.     else
  109.       return (@battler_hue = 0)
  110.     end
  111.   end
  112.   attr_writer :battler_name
  113.   attr_writer :battler_hue
  114. end
  115. #==============================================================================
  116. # ■ Game_Actor
  117. #==============================================================================
  118. class Game_Actor < Game_Battler
  119.   #--------------------------------------------------------------------------
  120.   # ● 属性(新增定义)
  121.   #--------------------------------------------------------------------------
  122.   attr_writer   :battler_name             # 战斗图形文件名
  123.   attr_writer   :battler_hue              # 战斗图形色相
  124.   #--------------------------------------------------------------------------
  125.   # ● 设置(追加定义)
  126.   #--------------------------------------------------------------------------
  127.   alias hzhj_old_setup_for_add_actor_battle_graphic setup
  128.   def setup(actor_id)
  129.     hzhj_old_setup_for_add_actor_battle_graphic(actor_id)
  130.     @battler_name = actor.battler_name
  131.     @battler_hue = actor.battler_hue
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● 是否使用活动块(重定义)
  135.   #--------------------------------------------------------------------------
  136.   def use_sprite?
  137.     return true
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● 取得战斗画面 X 坐标(新增定义)
  141.   #--------------------------------------------------------------------------
  142.   def screen_x
  143.     return ActorsBattlePosition[index + 1][0]
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 取得战斗画面 Y 坐标(新增定义)
  147.   #--------------------------------------------------------------------------
  148.   def screen_y
  149.     return ActorsBattlePosition[index + 1][1]
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 取得战斗画面 Z 坐标(新增定义)
  153.   #--------------------------------------------------------------------------
  154.   def screen_z
  155.     return real_screen_y + 100
  156.   end
  157. end
  158. #==============================================================================
  159. # ■ Game_Enemy
  160. #==============================================================================
  161. class Game_Enemy < Game_Battler
  162.   #--------------------------------------------------------------------------
  163.   # ● 属性(新增定义)
  164.   #--------------------------------------------------------------------------
  165.   attr_writer   :battler_name             # 战斗图形文件名
  166.   attr_writer   :battler_hue              # 战斗图形色相
  167.   #--------------------------------------------------------------------------
  168.   # ● 取得战斗画面 Z 坐标(重定义)
  169.   #--------------------------------------------------------------------------
  170.   def screen_z
  171.     return real_screen_y + 100
  172.   end
  173. end
  174. #==============================================================================
  175. # ■ Game_Party
  176. #==============================================================================
  177. class Game_Party < Game_Unit
  178.   include Hzhj::HorizontalBattleSystem
  179.   #--------------------------------------------------------------------------
  180.   # ● 取得参战角色的最大数(重定义)
  181.   #--------------------------------------------------------------------------
  182.   def max_battle_members
  183.     return MaxBattleMembers
  184.   end
  185. end

  186. class RPG::Animation
  187.   def wait_subject_duration
  188.     return @wait_subject_duration unless @wait_subject_duration.nil?
  189.     if /@w\[(\-??\d+?)\]/ =~ @name
  190.       @wait_subject_duration = $1.to_i
  191.     else
  192.       @wait_subject_duration = 0
  193.     end
  194.     return @wait_subject_duration
  195.   end
  196.   attr_writer :wait_subject_duration
  197. end
  198. class RPG::UsableItem < RPG::BaseItem
  199.   include Hzhj::HorizontalBattleSystem
  200.   def animation1_id
  201.     return @animation1_id unless @animation1_id.nil?
  202.     if /@a1id\[(\d+?)\]/i =~ @note
  203.       return (@animation1_id = $1.to_i)
  204.     else
  205.       return (@animation1_id = 0)
  206.     end
  207.   end
  208.   def wljn
  209.     return @wljn unless @wljn.nil?
  210.     if /@wljn/i =~ @note
  211.       return (@wljn = true)
  212.     else
  213.       return (@wljn = false)
  214.     end
  215.   end
  216.   def rmva_mode
  217.     return @rmva_mode unless @rmva_mode.nil?
  218.     if /@rmva/i =~ @note
  219.       return (@rmva_mode = !DefaultUseRmvaMode)
  220.     else
  221.       return (@rmva_mode = DefaultUseRmvaMode)
  222.     end
  223.   end
  224.   attr_writer :animation1_id
  225.   attr_writer :wljn
  226.   attr_writer :rmva_mode
  227. end
  228. class RPG::Weapon < RPG::EquipItem
  229.   def animation1_id
  230.     return @animation1_id unless @animation1_id.nil?
  231.     if /@a1id\[(\d+?)\]/ =~ @note
  232.       return (@animation1_id = $1.to_i)
  233.     else
  234.       return (@animation1_id = 0)
  235.     end
  236.   end
  237.   attr_writer :animation1_id
  238. end
  239. class RPG::Enemy < RPG::BaseItem
  240.   def animation1_id
  241.     return @animation1_id unless @animation1_id.nil?
  242.     if /@a1id\[(\d+?)\]/ =~ @note
  243.       return (@animation1_id = $1.to_i)
  244.     else
  245.       return (@animation1_id = 0)
  246.     end
  247.   end
  248.   def animation2_id
  249.     return @animation2_id unless @animation2_id.nil?
  250.     if /@a2id\[(\d+?)\]/ =~ @note
  251.       return (@animation2_id = $1.to_i)
  252.     else
  253.       return (@animation2_id = 0)
  254.     end
  255.   end
  256.   def animation3_id
  257.     return @animation3_id unless @animation3_id.nil?
  258.     if /@a3id\[(\d+?)\]/ =~ @note
  259.       return (@animation3_id = $1.to_i)
  260.     else
  261.       return (@animation3_id = 0)
  262.     end
  263.   end
  264.   attr_writer :animation1_id
  265.   attr_writer :animation2_id
  266.   attr_writer :animation3_id
  267. end
  268. #==============================================================================
  269. # ■ Game_Actor
  270. #==============================================================================
  271. class Game_Actor < Game_Battler
  272.   #--------------------------------------------------------------------------
  273.   # ● 取得普通攻击的行动方动画 ID (新增定义)
  274.   #--------------------------------------------------------------------------
  275.   def animation1_id
  276.     if dual_wield?
  277.       return weapons[0].animation1_id if weapons[0]
  278.       return weapons[1] ? weapons[1].animation1_id : 0
  279.     else
  280.       return weapons[0] ? weapons[0].animation1_id : 0
  281.     end
  282.   end
  283. end
  284. #==============================================================================
  285. # ■ Game_Enemy
  286. #==============================================================================
  287. class Game_Enemy < Game_Battler
  288.   #--------------------------------------------------------------------------
  289.   # ● 取得普通攻击的行动方动画 ID (新增定义)
  290.   #--------------------------------------------------------------------------
  291.   def animation1_id
  292.     return enemy.animation1_id
  293.   end
  294.   #--------------------------------------------------------------------------
  295.   # ● 取得普通攻击的动画 ID (新增定义)
  296.   #--------------------------------------------------------------------------
  297.   def atk_animation_id1
  298.     return enemy.animation2_id
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ● 取得普通攻击的动画 ID (二刀流:武器2)(新增定义)
  302.   #--------------------------------------------------------------------------
  303.   def atk_animation_id2
  304.     return enemy.animation3_id
  305.   end
  306. end
  307. #==============================================================================
  308. # ■ Scene_Battle
  309. #==============================================================================
  310. class Scene_Battle < Scene_Base
  311.   include Hzhj::HorizontalBattleSystem
  312.   #--------------------------------------------------------------------------
  313.   # ● 使用技能/物品(重定义)
  314.   #--------------------------------------------------------------------------
  315.   def use_item
  316.     item = @subject.current_action.item
  317.     @log_window.display_use_item(@subject, item)
  318.     @subject.use_item(item)
  319.     refresh_status
  320.     targets = @subject.current_action.make_targets.compact
  321.     show_animation(targets, item.animation_id)
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # ● 显示动画(重定义)
  325.   #--------------------------------------------------------------------------
  326.   def show_animation(targets, animation_id)
  327.     item = @subject.current_action.item
  328.     if item.rmva_mode
  329.       show_rmva_animation(targets, animation_id, item)
  330.     else
  331.       show_hzhj_animation(targets, animation_id, item)
  332.     end
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   # ● RMVA模式显示动画(新增定义)
  336.   #--------------------------------------------------------------------------
  337.   def show_rmva_animation(targets, animation_id, item)
  338.     @subject.damage_section_displayed = false
  339.     @subject.not_damage_section = true
  340.     targets.each do |target|
  341.       target.damage_section_displayed = false
  342.       target.not_damage_section = true
  343.     end
  344.     if animation_id < 0
  345.       show_attack_animation(targets)
  346.     else
  347.       show_rmva_usable_animation(targets, animation_id, item)
  348.     end
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ● HZHJ模式显示动画(新增定义)
  352.   #--------------------------------------------------------------------------
  353.   def show_hzhj_animation(targets, animation_id, item)
  354.     if animation_id < 0
  355.       show_hzhj_attack_animation(targets, item)
  356.     else
  357.       if item.wljn
  358.         show_wljn_skill_animation(targets, animation_id, item)
  359.       else
  360.         show_magic_skill_animation(targets, animation_id, item)
  361.       end
  362.     end
  363.   end
  364.   #--------------------------------------------------------------------------
  365.   # ● HZHJ模式显示攻击动画(重定义)
  366.   #--------------------------------------------------------------------------
  367.   def show_hzhj_attack_animation(targets, item)
  368.     ary = []
  369.     need_move = false
  370.     animation1 = $data_animations[@subject.animation1_id]
  371.     need_move = animation1.need_move if animation1
  372.     come_back = true
  373.     targets.each_with_index do |target, i|
  374.       ary[0] = target
  375.       item.repeats.times do
  376.         next if target.dead? && item.damage.type == 1
  377.         next if @subject.dead?
  378.         next if !@subject.current_action
  379.         if need_move && come_back
  380.           come_back = false
  381.           @subject.setup_move_info(target, RealMoveDuration, animation1.move_se)
  382.           wait_for_move
  383.         end
  384.         damage_target = hzhj_apply_item_effects(target, item)
  385.         show_subject_animation(@subject.animation1_id)
  386.         show_normal_animation(ary, @subject.atk_animation_id1, false)
  387.         show_normal_animation(ary, @subject.atk_animation_id2, true)
  388.         @log_window.wait
  389.         wait_for_animation
  390.         hzhj_invoke_item(target, item, damage_target)
  391.       end
  392.       if need_move
  393.         if target != targets[i+1] or target.dead?
  394.           come_back = true
  395.           @subject.come_back_self_position(RealMoveDuration)
  396.           wait_for_move
  397.         else
  398.           come_back = false
  399.         end
  400.       end
  401.     end
  402.   end
  403.   #--------------------------------------------------------------------------
  404.   # ● HZHJ模式显示物理技能类动画(新增定义)
  405.   #--------------------------------------------------------------------------
  406.   def show_wljn_skill_animation(targets, animation_id, item)
  407.     ary = []
  408.     need_move = false
  409.     animation1 = $data_animations[item.animation1_id]
  410.     need_move = animation1.need_move if animation1
  411.     come_back = true
  412.     targets.each_with_index do |target, i|
  413.       ary[0] = target
  414.       item.repeats.times do
  415.         next if target.dead? && item.damage.type == 1
  416.         next if @subject.dead?
  417.         next if !@subject.current_action
  418.         if need_move && come_back
  419.           come_back = false
  420.           @subject.setup_move_info(target, RealMoveDuration, animation1.move_se)
  421.           wait_for_move
  422.         end
  423.         damage_target = hzhj_apply_item_effects(target, item)
  424.         show_subject_animation(item.animation1_id)
  425.         show_normal_animation(ary, animation_id, false)
  426.         @log_window.wait
  427.         wait_for_animation
  428.         hzhj_invoke_item(target, item, damage_target)
  429.       end
  430.       if need_move
  431.         if target != targets[i+1] or target.dead?
  432.           come_back = true
  433.           @subject.come_back_self_position(RealMoveDuration)
  434.           wait_for_move
  435.         else
  436.           come_back = false
  437.         end
  438.       end
  439.     end
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # ● HZHJ模式显示魔法技能类动画(新增定义)
  443.   #--------------------------------------------------------------------------
  444.   def show_magic_skill_animation(targets, animation_id, item)
  445.     ary = []
  446.     damage_targets = {}
  447.     item.repeats.times do
  448.       next if @subject.dead?
  449.       next if !@subject.current_action
  450.       ary.clear
  451.       damage_targets.clear
  452.       targets.each do |target|
  453.         next if target.dead? && item.damage.type == 1
  454.         ary << target
  455.         damage_targets[target] = hzhj_apply_item_effects(target, item)
  456.       end
  457.       next if ary.empty?
  458.       show_subject_animation(item.animation1_id)
  459.       show_normal_animation(ary, animation_id)
  460.       @log_window.wait
  461.       wait_for_animation
  462.       ary.each do |target|
  463.         hzhj_invoke_item(target, item, damage_targets[target])
  464.       end
  465.       if [9, 10].include?(item.scope)
  466.         ary.each do |target|
  467.           if target.alive?
  468.             target.come_back_self_position(RealMoveDuration)
  469.           end
  470.         end
  471.         wait_for_move
  472.       end
  473.     end
  474.   end
  475.   #--------------------------------------------------------------------------
  476.   # ● RMVA模式显示攻击动画(重定义)
  477.   #--------------------------------------------------------------------------
  478.   def show_attack_animation(targets)
  479.     item = @subject.current_action.item
  480.     show_subject_animation(@subject.animation1_id)
  481.     show_normal_animation(targets, @subject.atk_animation_id1, false)
  482.     show_normal_animation(targets, @subject.atk_animation_id2, true)
  483.     @log_window.wait
  484.     wait_for_animation
  485.     targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  486.   end
  487.   #--------------------------------------------------------------------------
  488.   # ● RMVA模式显示技能、物品动画 (新增定义)
  489.   #--------------------------------------------------------------------------
  490.   def show_rmva_usable_animation(targets, animation_id, item)
  491.     show_subject_animation(item.animation1_id)
  492.     show_normal_animation(targets, animation_id)
  493.     @log_window.wait
  494.     wait_for_animation
  495.     targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  496.     if [9, 10].include?(item.scope)
  497.       targets.each do |target|
  498.         if target.alive?
  499.           target.come_back_self_position(RealMoveDuration)
  500.         end
  501.       end
  502.       wait_for_move
  503.     end
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # ● 显示行动方动画(新增定义)
  507.   #--------------------------------------------------------------------------
  508.   def show_subject_animation(animation_id, subject = @subject, mirror = false)
  509.     animation = $data_animations[animation_id]
  510.     if animation
  511.       subject.animation_id = animation_id
  512.       subject.animation_mirror = mirror
  513.       if animation.wait_subject_duration < 0
  514.         wait_for_animation
  515.       elsif animation.wait_subject_duration > 0
  516.         animation.wait_subject_duration.times{update_for_wait}
  517.       end
  518.     end
  519.   end
  520. end

  521. class RPG::Animation
  522.   include Hzhj::HorizontalBattleSystem
  523.   def ani_z_correction
  524.     return @ani_z_correction unless @ani_z_correction.nil?
  525.     if /@az\[(\-??\d+?)\]/ =~ @name
  526.       return (@ani_z_correction = $1.to_i)
  527.     else
  528.       return (@ani_z_correction = DefaultAniAddZ)
  529.     end
  530.   end
  531.   def loop_z_correction
  532.     return @loop_z_correction unless @loop_z_correction.nil?
  533.     if /@lz\[(\-??\d+?)\]/ =~ @name
  534.       return (@loop_z_correction = $1.to_i)
  535.     else
  536.       return (@loop_z_correction = DefaultLoopAniAddZ)
  537.     end
  538.   end
  539.   attr_writer :ani_z_correction
  540.   attr_writer :loop_z_correction
  541. end
  542. class RPG::State < RPG::BaseItem
  543.   def animation_id
  544.     return @animation_id unless @animation_id.nil?
  545.     if /@aid\[(\d+?)\]/ =~ @note
  546.       return (@animation_id = $1.to_i)
  547.     else
  548.       return (@animation_id = 0)
  549.     end
  550.   end
  551.   attr_writer :animation_id
  552. end
  553. #==============================================================================
  554. # ■ Game_BattlerBase
  555. #==============================================================================
  556. class Game_BattlerBase
  557.   #--------------------------------------------------------------------------
  558.   # ● 实例变量(新增定义)
  559.   #--------------------------------------------------------------------------
  560.   attr_reader   :hzhj_add_state_id
  561.   attr_reader   :hzhj_remove_state_id
  562.   attr_accessor :need_update_state_animation
  563.   #--------------------------------------------------------------------------
  564.   # ● 初始化(追加定义)
  565.   #--------------------------------------------------------------------------
  566.   alias hzhj_old_init_for_state_ani_game_battler_base initialize
  567.   def initialize
  568.     @hzhj_add_state_id = []
  569.     @hzhj_remove_state_id = []
  570.     @need_update_state_animation = false
  571.     @states = []
  572.     @state_turns = {}
  573.     @state_steps = {}
  574.     hzhj_old_init_for_state_ani_game_battler_base
  575.   end
  576.   #--------------------------------------------------------------------------
  577.   # ● 清除状态信息(追加定义)
  578.   #--------------------------------------------------------------------------
  579.   alias hzhj_old_clear_states_for_state_ani_game_battler_base clear_states
  580.   def clear_states
  581.     old_states = @states.clone
  582.     hzhj_old_clear_states_for_state_ani_game_battler_base
  583.     bingji = old_states | @states
  584.     return if bingji.empty?
  585.     set_add_state_id(bingji & @states)
  586.     set_remove_state_id(bingji & old_states)
  587.   end
  588.   #--------------------------------------------------------------------------
  589.   # ● 消除状态(追加定义)
  590.   #--------------------------------------------------------------------------
  591.   alias hzhj_old_erase_state_for_state_ani_game_battler_base erase_state
  592.   def erase_state(state_id)
  593.     old_states = @states.clone
  594.     hzhj_old_erase_state_for_state_ani_game_battler_base(state_id)
  595.     bingji = old_states | @states
  596.     return if bingji.empty?
  597.     set_add_state_id(bingji & @states)
  598.     set_remove_state_id(bingji & old_states)
  599.   end
  600.   #--------------------------------------------------------------------------
  601.   # ● 设置增加的状态(新增定义)
  602.   #--------------------------------------------------------------------------
  603.   def set_add_state_id(zjdzt)
  604.     for i in zjdzt
  605.       if $data_states[i].animation_id > 0
  606.         if not @hzhj_add_state_id.include?(i)
  607.           @hzhj_add_state_id.push(i)
  608.         end
  609.       end
  610.     end
  611.   end
  612.   #--------------------------------------------------------------------------
  613.   # ● 设置解除的状态(新增定义)
  614.   #--------------------------------------------------------------------------
  615.   def set_remove_state_id(jsdzt)
  616.     for i in jsdzt
  617.       if $data_states[i].animation_id > 0
  618.         if not @hzhj_remove_state_id.include?(i)
  619.           ani_id = $data_states[i].animation_id
  620.           not_end_loop_animation = false
  621.           for state in self.states
  622.             if state.animation_id == ani_id
  623.               not_end_loop_animation = true
  624.               break
  625.             end
  626.           end
  627.           unless not_end_loop_animation
  628.             @hzhj_remove_state_id.push(i)
  629.           end
  630.         end
  631.       end
  632.     end
  633.   end
  634. end
  635. #==============================================================================
  636. # ■ Game_Battler
  637. #==============================================================================
  638. class Game_Battler < Game_BattlerBase
  639.   #--------------------------------------------------------------------------
  640.   # ● 附加新的状态(追加定义)
  641.   #--------------------------------------------------------------------------
  642.   alias hzhj_old_add_new_state_for_state_ani_game_battler add_new_state
  643.   def add_new_state(state_id)
  644.     old_states = @states.clone
  645.     hzhj_old_add_new_state_for_state_ani_game_battler(state_id)
  646.     bingji = old_states | @states
  647.     return if bingji.empty?
  648.     set_add_state_id(bingji & @states)
  649.     set_remove_state_id(bingji & old_states)
  650.   end
  651. end
  652. #==============================================================================
  653. # ■ Sprite_Base
  654. #==============================================================================
  655. class Sprite_Base < Sprite
  656.   #--------------------------------------------------------------------------
  657.   # ● 初始化(追加定义)
  658.   #--------------------------------------------------------------------------
  659.   alias hzhj_old_init_for_state_ani_spr_base initialize
  660.   def initialize(*args)
  661.     hzhj_old_init_for_state_ani_spr_base(*args)
  662.     @hzhj_loop_animations = []
  663.     @hzhj_loop_durations = {}
  664.     @hzhj_loop_sprites = {}
  665.     @hzhj_loop_bitmap1s = {}
  666.     @hzhj_loop_bitmap2s = {}
  667.     @hzhj_loop_ani_oxs = {}
  668.     @hzhj_loop_ani_oys = {}
  669.     @flash_nil_duration = 0
  670.   end
  671.   #--------------------------------------------------------------------------
  672.   # ● 释放(追加定义)
  673.   #--------------------------------------------------------------------------
  674.   alias hzhj_old_dispose_for_state_ani_spr_base dispose
  675.   def dispose
  676.     dispose_loop_animation
  677.     hzhj_old_dispose_for_state_ani_spr_base
  678.   end
  679.   #--------------------------------------------------------------------------
  680.   # ● 设定动画的活动块(追加定义)
  681.   #--------------------------------------------------------------------------
  682.   alias hzhj_old_ani_set_spr_for_state_ani_spr_base animation_set_sprites
  683.   def animation_set_sprites(*args)
  684.     hzhj_old_ani_set_spr_for_state_ani_spr_base(*args)
  685.     @ani_sprites.each{|sprite|sprite.z += @animation.ani_z_correction}
  686.   end
  687.   #--------------------------------------------------------------------------
  688.   # ● 判断是否有循环动画(新增定义)
  689.   #--------------------------------------------------------------------------
  690.   def loop_animation?
  691.     return (not @hzhj_loop_animations.empty?)
  692.   end
  693.   #--------------------------------------------------------------------------
  694.   # ● 开始播放循环动画(新增定义)
  695.   #--------------------------------------------------------------------------
  696.   def start_loop_animation(animation)
  697.     return if @hzhj_loop_animations.include?(animation)
  698.     if animation.nil?
  699.       dispose_loop_animation
  700.       return
  701.     end
  702.     set_animation_rate
  703.     @hzhj_loop_animations.push(animation)
  704.     init_loop_animation_duration(animation)
  705.     load_loop_animation_bitmap(animation)
  706.     make_loop_animation_sprites(animation)
  707.     set_loop_animation_origin(animation)
  708.   end
  709.   #--------------------------------------------------------------------------
  710.   # ● 初始化循环动画播放位置(新增定义)
  711.   #--------------------------------------------------------------------------
  712.   def init_loop_animation_duration(animation)
  713.     @hzhj_loop_durations[animation] = animation.frame_max * @ani_rate + 1
  714.   end
  715.   #--------------------------------------------------------------------------
  716.   # ● 读取循环动画图像(新增定义)
  717.   #--------------------------------------------------------------------------
  718.   def load_loop_animation_bitmap(animation)
  719.     animation1_name = animation.animation1_name
  720.     animation1_hue = animation.animation1_hue
  721.     animation2_name = animation.animation2_name
  722.     animation2_hue = animation.animation2_hue
  723.     bitmap1 = Cache.animation(animation1_name, animation1_hue)
  724.     bitmap2 = Cache.animation(animation2_name, animation2_hue)
  725.     if @@_reference_count.include?(bitmap1)
  726.       @@_reference_count[bitmap1] += 1
  727.     else
  728.       @@_reference_count[bitmap1] = 1
  729.     end
  730.     if @@_reference_count.include?(bitmap2)
  731.       @@_reference_count[bitmap2] += 1
  732.     else
  733.       @@_reference_count[bitmap2] = 1
  734.     end
  735.     @hzhj_loop_bitmap1s[animation] = bitmap1
  736.     @hzhj_loop_bitmap2s[animation] = bitmap2
  737.     Graphics.frame_reset
  738.   end
  739.   #--------------------------------------------------------------------------
  740.   # ● 生成循环动画活动块(新增定义)
  741.   #--------------------------------------------------------------------------
  742.   def make_loop_animation_sprites(animation)
  743.     sprites = []
  744.     if @use_sprite
  745.       16.times do
  746.         sprite = ::Sprite.new(viewport)
  747.         sprite.visible = false
  748.         sprites.push(sprite)
  749.       end
  750.     end
  751.     @hzhj_loop_sprites[animation] = sprites
  752.   end
  753.   #--------------------------------------------------------------------------
  754.   # ● 设定循环动画的原点(新增定义)
  755.   #--------------------------------------------------------------------------
  756.   def set_loop_animation_origin(animation)
  757.     if animation.position == 3
  758.       if viewport == nil
  759.         ani_ox = Graphics.width / 2
  760.         ani_oy = Graphics.height / 2
  761.       else
  762.         ani_ox = viewport.rect.width / 2
  763.         ani_oy = viewport.rect.height / 2
  764.       end
  765.     else
  766.       ani_ox = x - ox + width / 2
  767.       ani_oy = y - oy + height / 2
  768.       if animation.position == 0
  769.         ani_oy -= height / 2
  770.       elsif animation.position == 2
  771.         ani_oy += height / 2
  772.       end
  773.     end
  774.     @hzhj_loop_ani_oxs[animation] = ani_ox
  775.     @hzhj_loop_ani_oys[animation] = ani_oy
  776.   end
  777.   #--------------------------------------------------------------------------
  778.   # ● 释放所有循环动画(新增定义)
  779.   #--------------------------------------------------------------------------
  780.   def dispose_loop_animation
  781.     return unless loop_animation?
  782.     for animation in @hzhj_loop_animations.clone
  783.       end_loop_animation(animation)
  784.     end
  785.     @hzhj_loop_durations.clear
  786.     @hzhj_loop_sprites.clear
  787.     @hzhj_loop_bitmap1s.clear
  788.     @hzhj_loop_bitmap2s.clear
  789.     @hzhj_loop_ani_oxs.clear
  790.     @hzhj_loop_ani_oys.clear
  791.     @hzhj_loop_animations.clear
  792.   end
  793.   #--------------------------------------------------------------------------
  794.   # ● 结束某个循环动画(新增定义)
  795.   #--------------------------------------------------------------------------
  796.   def end_loop_animation(animation)
  797.     return if not @hzhj_loop_animations.include?(animation)
  798.     bitmap1 = @hzhj_loop_bitmap1s[animation]
  799.     @@_reference_count[bitmap1] -= 1
  800.     if @@_reference_count[bitmap1] == 0
  801.       @@_reference_count.delete(bitmap1)
  802.       bitmap1.dispose
  803.     end
  804.     bitmap2 = @hzhj_loop_bitmap2s[animation]
  805.     @@_reference_count[bitmap2] -= 1
  806.     if @@_reference_count[bitmap2] == 0
  807.       @@_reference_count.delete(bitmap2)
  808.       bitmap2.dispose
  809.     end
  810.     sprites = @hzhj_loop_sprites[animation]
  811.     for sprite in sprites
  812.       sprite.dispose
  813.     end
  814.     @hzhj_loop_durations.delete(animation)
  815.     @hzhj_loop_sprites.delete(animation)
  816.     @hzhj_loop_bitmap1s.delete(animation)
  817.     @hzhj_loop_bitmap2s.delete(animation)
  818.     @hzhj_loop_ani_oxs.delete(animation)
  819.     @hzhj_loop_ani_oys.delete(animation)
  820.     @hzhj_loop_animations.delete(animation)
  821.   end
  822.   #--------------------------------------------------------------------------
  823.   # ● 刷新(追加定义)
  824.   #--------------------------------------------------------------------------
  825.   alias hzhj_old_update_for_state_ani_spr_base update
  826.   def update
  827.     hzhj_old_update_for_state_ani_spr_base
  828.     update_loop_animation
  829.   end
  830.   #--------------------------------------------------------------------------
  831.   # ● 刷新循环动画(新增定义)
  832.   #--------------------------------------------------------------------------
  833.   def update_loop_animation
  834.     @flash_nil_duration -= 1 if @flash_nil_duration > 0
  835.     return unless loop_animation?
  836.     for animation in @hzhj_loop_animations
  837.       @hzhj_loop_durations[animation] -= 1
  838.       duration = @hzhj_loop_durations[animation]
  839.       if duration % @ani_rate == 0
  840.         if duration > 0
  841.           set_loop_animation_origin(animation)
  842.           frame_index = animation.frame_max
  843.           frame_index -= (duration + @ani_rate - 1) / @ani_rate
  844.           args = []
  845.           args[0] = @hzhj_loop_sprites[animation]
  846.           args[1] = @hzhj_loop_bitmap1s[animation]
  847.           args[2] = @hzhj_loop_bitmap2s[animation]
  848.           args[3] = @hzhj_loop_ani_oxs[animation]
  849.           args[4] = @hzhj_loop_ani_oys[animation]
  850.           args[5] = animation.loop_z_correction
  851.           args[6] = ((not flash_nil? or animation.to_screen?) and visible)
  852.           loop_animation_set_sprites(animation.frames[frame_index], args)
  853.           animation.timings.each do |timing|
  854.             loop_animation_process_timing(timing) if timing.frame == frame_index
  855.           end
  856.         else
  857.           init_loop_animation_duration(animation)
  858.           redo
  859.         end
  860.       end
  861.     end
  862.   end
  863.   #--------------------------------------------------------------------------
  864.   # ● 设定循环动画的活动块(新增定义)
  865.   #--------------------------------------------------------------------------
  866.   def loop_animation_set_sprites(frame, args)
  867.     sprites = args[0]
  868.     bitmap1 = args[1]
  869.     bitmap2 = args[2]
  870.     ani_ox = args[3]
  871.     ani_oy = args[4]
  872.     loop_z_correction = args[5]
  873.     state_visible = args[6]
  874.     cell_data = frame.cell_data
  875.     sprites.each_with_index do |sprite, i|
  876.       next unless sprite
  877.       pattern = cell_data[i, 0]
  878.       if !pattern || pattern < 0
  879.         sprite.visible = false
  880.         next
  881.       end
  882.       sprite.bitmap = pattern < 100 ? bitmap1 : bitmap2
  883.       sprite.visible = state_visible
  884.       sprite.src_rect.set(pattern % 5 * 192,
  885.         pattern % 100 / 5 * 192, 192, 192)
  886.       sprite.x = ani_ox + cell_data[i, 1]
  887.       sprite.y = ani_oy + cell_data[i, 2]
  888.       sprite.angle = cell_data[i, 4]
  889.       sprite.mirror = (cell_data[i, 5] == 1)
  890.       if loop_z_correction > 9999
  891.         sprite.z = loop_z_correction % 10000 + i
  892.       elsif loop_z_correction < -9999
  893.         sprite.z = loop_z_correction % -10000 + i
  894.       else
  895.         sprite.z = self.z + loop_z_correction + i
  896.       end
  897.       sprite.ox = 96
  898.       sprite.oy = 96
  899.       sprite.zoom_x = cell_data[i, 3] / 100.0
  900.       sprite.zoom_y = cell_data[i, 3] / 100.0
  901.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  902.       sprite.blend_type = cell_data[i, 7]
  903.     end
  904.   end
  905.   #--------------------------------------------------------------------------
  906.   # ● 循环动画SE 和闪烁时机的处理(新增定义)
  907.   #--------------------------------------------------------------------------
  908.   def loop_animation_process_timing(timing)
  909.     timing.se.play
  910.     case timing.flash_scope
  911.     when 1
  912.       self.flash(timing.flash_color, timing.flash_duration * @ani_rate)
  913.     when 2
  914.       if viewport
  915.         viewport.flash(timing.flash_color, timing.flash_duration * @ani_rate)
  916.       end
  917.     when 3
  918.       self.flash(nil, timing.flash_duration * @ani_rate)
  919.     end
  920.   end
  921.   #--------------------------------------------------------------------------
  922.   # ● 设置闪烁(追加定义)
  923.   #--------------------------------------------------------------------------
  924.   alias hzhj_old_flash_for_state_ani_spr_base flash
  925.   def flash(*args)
  926.     if args[0].nil?
  927.       @flash_nil_duration = args[1]
  928.     else
  929.       @flash_nil_duration = 0
  930.     end
  931.     hzhj_old_flash_for_state_ani_spr_base(*args)
  932.   end
  933.   #--------------------------------------------------------------------------
  934.   # ● 判断是否正处于【隐藏目标】(新增定义)
  935.   #--------------------------------------------------------------------------
  936.   def flash_nil?
  937.     return (@flash_nil_duration > 0)
  938.   end
  939. end
  940. #==============================================================================
  941. # ■ Sprite_Battler
  942. #==============================================================================
  943. class Sprite_Battler < Sprite_Base
  944.   #--------------------------------------------------------------------------
  945.   # ● 初始化(追加定义)
  946.   #--------------------------------------------------------------------------
  947.   alias hzhj_old_init_for_state_ani_spr_battler initialize
  948.   def initialize(*args)
  949.     hzhj_old_init_for_state_ani_spr_battler(*args)
  950.     init_battler_add_state_id
  951.   end
  952.   #--------------------------------------------------------------------------
  953.   # ● 初始化战斗者要播放状态动画的状态(新增定义)
  954.   #--------------------------------------------------------------------------
  955.   def init_battler_add_state_id
  956.     if @battler.nil?
  957.       dispose_loop_animation
  958.     else
  959.       @battler.hzhj_add_state_id.clear
  960.       @battler.hzhj_remove_state_id.clear
  961.       @battler.need_update_state_animation = true
  962.       for state in @battler.states
  963.         next if state.nil?
  964.         next if $data_animations[state.animation_id].nil?
  965.         @battler.hzhj_add_state_id.push(state.id)
  966.       end
  967.     end
  968.   end
  969.   #--------------------------------------------------------------------------
  970.   # ● 设置战斗者(追加定义)
  971.   #--------------------------------------------------------------------------
  972.   alias hzhj_old_battlerdy_for_state_ani_spr_battler battler=
  973.   def battler=(value)
  974.     old_battler = @battler
  975.     hzhj_old_battlerdy_for_state_ani_spr_battler(value)
  976.     if old_battler != @battler
  977.       init_battler_add_state_id
  978.     end
  979.   end
  980.   #--------------------------------------------------------------------------
  981.   # ● 刷新(追加定义)
  982.   #--------------------------------------------------------------------------
  983.   alias hzhj_old_update_for_state_ani_spr_battler update
  984.   def update
  985.     hzhj_old_update_for_state_ani_spr_battler
  986.     if @battler
  987.       if @battler.need_update_state_animation
  988.         @battler.need_update_state_animation = false
  989.         if not @battler.hzhj_add_state_id.empty?
  990.           for i in @battler.hzhj_add_state_id
  991.             if @battler.state?(i)
  992.               ani_id = $data_states[i].animation_id
  993.               animation = $data_animations[ani_id]
  994.               start_loop_animation(animation) if not animation.nil?
  995.             end
  996.           end
  997.           @battler.hzhj_add_state_id.clear
  998.         end
  999.         if not @battler.hzhj_remove_state_id.empty?
  1000.           for i in @battler.hzhj_remove_state_id
  1001.             if not @battler.state?(i)
  1002.               ani_id = $data_states[i].animation_id
  1003.               animation = $data_animations[ani_id]
  1004.               end_loop_animation(animation) if not animation.nil?
  1005.             end
  1006.           end
  1007.           @battler.hzhj_remove_state_id.clear
  1008.         end
  1009.       end
  1010.     end
  1011.   end
  1012. end
  1013. #==============================================================================
  1014. # ■ Window_BattleLog
  1015. #==============================================================================
  1016. class Window_BattleLog < Window_Selectable
  1017.   #--------------------------------------------------------------------------
  1018.   # ● 显示状态附加/解除(追加定义)
  1019.   #--------------------------------------------------------------------------
  1020.   alias hzhj_old_display_status_for_state_ani_wnd_btlog display_changed_states
  1021.   def display_changed_states(target)
  1022.     target.need_update_state_animation = true
  1023.     hzhj_old_display_status_for_state_ani_wnd_btlog(target)
  1024.   end
  1025. end

  1026. #==============================================================================
  1027. # ■ Sprite_Damage (新增类)
  1028. #==============================================================================
  1029. class Sprite_Damage < Sprite
  1030.   include Hzhj::HorizontalBattleSystem
  1031.   #--------------------------------------------------------------------------
  1032.   # ● 获取/生成伤害值源图
  1033.   #--------------------------------------------------------------------------
  1034.   @@obmp = nil
  1035.   def self.obmp
  1036.     if @@obmp.nil? or @@obmp.disposed?
  1037.       @@obmp = Bitmap.new(180, 256)
  1038.       @@obmp.font.bold = true
  1039.       @@obmp.font.shadow = false
  1040.       @@obmp.font.outline = true
  1041.       @@obmp.font.out_color = Color.new(255, 255, 255, 255)
  1042.       @@obmp.font.size = 32
  1043.       colors = []
  1044.       colors.push(Color.new(255,   0,   0, 255))
  1045.       colors.push(Color.new(255, 128, 128, 255))
  1046.       colors.push(Color.new(  0,   0, 255, 255))
  1047.       colors.push(Color.new(128, 128, 255, 255))
  1048.       colors.push(Color.new(  0, 255,   0, 255))
  1049.       colors.push(Color.new(128, 255, 128, 255))
  1050.       colors.each_with_index do |color, hi|
  1051.         @@obmp.font.color = color
  1052.         for wi in 0..9
  1053.           @@obmp.draw_text(wi * 18, hi * 32, 18, 32, "#{wi}", 1)
  1054.         end
  1055.       end
  1056.       @@obmp.font.size = 20
  1057.       @@obmp.font.italic = true
  1058.       @@obmp.font.out_color = Color.new(0, 0, 0, 255)
  1059.       @@obmp.font.color = Color.new(255, 255, 255, 255)
  1060.       @@obmp.draw_text( 0, 192, 90, 32, "Critical", 1)
  1061.       @@obmp.draw_text(90, 192, 90, 32, "Miss", 1)
  1062.       @@obmp.draw_text( 0, 224, 90, 32, "Evasion", 1)
  1063.       @@obmp.hue_change(DamageBitmapHue)
  1064.     end
  1065.     return @@obmp
  1066.   end
  1067.   #--------------------------------------------------------------------------
  1068.   # ● 初始化
  1069.   #--------------------------------------------------------------------------
  1070.   def initialize(viewport, args)
  1071.     super(viewport)
  1072.     @type = args[0]
  1073.     @value = args[1]
  1074.     @critical = args[2]
  1075.     self.x = args[4]
  1076.     self.y = args[5]
  1077.     self.z = args[6] + Graphics.height * 5
  1078.     make_move(args[3])
  1079.     refresh
  1080.   end
  1081.   #--------------------------------------------------------------------------
  1082.   # ● 生成移动数据
  1083.   #--------------------------------------------------------------------------
  1084.   def make_move(battler_obj_class)
  1085.     @move = []
  1086.     case battler_obj_class
  1087.     when :actor
  1088.       make_move_actor
  1089.     when :enemy
  1090.       make_move_enemy
  1091.     else
  1092.       make_move_default
  1093.     end
  1094.   end
  1095.   #--------------------------------------------------------------------------
  1096.   # ● 生成移动数据 默认
  1097.   #--------------------------------------------------------------------------
  1098.   def make_move_default
  1099.     45.times do |n|
  1100.       if n % 3 == 0
  1101.         ady = n < 21 ? -6 : -1
  1102.         opa = n < 21 ? 255 : 255-(n-21)*6
  1103.         @move.push([0, ady, opa])
  1104.       else
  1105.         @move.push([0, 0, -1])
  1106.       end
  1107.     end
  1108.   end
  1109.   #--------------------------------------------------------------------------
  1110.   # ● 生成移动数据 角色
  1111.   #--------------------------------------------------------------------------
  1112.   def make_move_actor
  1113.     make_move_default
  1114.   end
  1115.   #--------------------------------------------------------------------------
  1116.   # ● 生成移动数据 敌人
  1117.   #--------------------------------------------------------------------------
  1118.   def make_move_enemy
  1119.     make_move_default
  1120.   end
  1121.   #--------------------------------------------------------------------------
  1122.   # ● 描绘
  1123.   #--------------------------------------------------------------------------
  1124.   def refresh
  1125.     if not self.bitmap.nil?
  1126.       self.bitmap.dispose
  1127.       self.bitmap = nil
  1128.     end
  1129.     begin
  1130.       @obmp = Cache.animation("damage", DamageBitmapHue)
  1131.     rescue Errno::ENOENT
  1132.       @obmp = Sprite_Damage.obmp
  1133.     end
  1134.     @numw = @obmp.width / 10
  1135.     @numh = @obmp.height / 8
  1136.     @strw = @obmp.width / 2
  1137.     case @value
  1138.     when Numeric
  1139.       blt_obmp_numeric
  1140.     when Symbol
  1141.       blt_obmp_text
  1142.     end
  1143.   end
  1144.   #--------------------------------------------------------------------------
  1145.   # ● 通过源图描绘数字
  1146.   #--------------------------------------------------------------------------
  1147.   def blt_obmp_numeric
  1148.     nums = @value.to_i.abs.to_s.split("")
  1149.     nbmpw = nums.size * @numw
  1150.     bmph = @numh
  1151.     cbmpw = 0
  1152.     crect = nil
  1153.     dy = 0
  1154.     if @critical
  1155.       cbmpw = @strw
  1156.       bmph *= 2
  1157.       crect = Rect.new(0, @numh * 6, @strw, @numh)
  1158.       dy = @numh
  1159.     end
  1160.     self.bitmap = Bitmap.new([nbmpw, cbmpw, 32].max, [bmph, 32].max)
  1161.     self.ox = bitmap.width / 2
  1162.     self.oy = bmph /2
  1163.     bitmap.blt((bitmap.width - cbmpw) / 2, 0, @obmp, crect) if crect
  1164.     dx = (bitmap.width - nbmpw) / 2
  1165.     ry = 0
  1166.     case @type
  1167.     when :hp
  1168.       ry = @value >= 0 ? 0 : @numh
  1169.     when :mp
  1170.       ry = @value >= 0 ? @numh * 2 : @numh * 3
  1171.     when :tp
  1172.       ry = @value >= 0 ? @numh * 4 : @numh * 5
  1173.     else
  1174.       return
  1175.     end
  1176.     rect = Rect.new(0, ry, @numw, @numh)
  1177.     nums.each_with_index do |str, i|
  1178.       rect.x = str.to_i * @numw
  1179.       bitmap.blt(dx, dy, @obmp, rect)
  1180.       dx += @numw
  1181.     end
  1182.   end
  1183.   #--------------------------------------------------------------------------
  1184.   # ● 通过源图描绘文字
  1185.   #--------------------------------------------------------------------------
  1186.   def blt_obmp_text
  1187.     self.bitmap = Bitmap.new([@strw, 32].max, [@numh, 32].max)
  1188.     self.ox = @strw / 2
  1189.     self.oy = @numh / 2
  1190.     rx = ry = 0
  1191.     case @type
  1192.     when :miss
  1193.       rx = @strw
  1194.       ry = @numh * 6
  1195.     when :eva
  1196.       ry = @numh * 7
  1197.     else
  1198.       return
  1199.     end
  1200.     rect = Rect.new(rx, ry, @strw, @numh)
  1201.     bitmap.blt(0, 0, @obmp, rect)
  1202.   end
  1203.   #--------------------------------------------------------------------------
  1204.   # ● 释放
  1205.   #--------------------------------------------------------------------------
  1206.   def dispose
  1207.     bitmap.dispose if bitmap
  1208.     super
  1209.   end
  1210.   #--------------------------------------------------------------------------
  1211.   # ● 移动中判定
  1212.   #--------------------------------------------------------------------------
  1213.   def moving?
  1214.     return (not @move.empty?)
  1215.   end
  1216.   #--------------------------------------------------------------------------
  1217.   # ● 刷新
  1218.   #--------------------------------------------------------------------------
  1219.   def update
  1220.     super
  1221.     if moving?
  1222.       ary = @move.shift
  1223.       self.x += ary[0]
  1224.       self.y += ary[1]
  1225.       self.opacity = ary[2] if ary[2] >= 0
  1226.     end
  1227.   end
  1228. end
  1229. #==============================================================================
  1230. # ■ Game_BattlerBase
  1231. #==============================================================================
  1232. class Game_BattlerBase
  1233.   #--------------------------------------------------------------------------
  1234.   # ● 实例变量(新增定义)
  1235.   #--------------------------------------------------------------------------
  1236.   attr_accessor :hzhj_damage
  1237.   #--------------------------------------------------------------------------
  1238.   # ● 初始化(追加定义)
  1239.   #--------------------------------------------------------------------------
  1240.   alias hzhj_old_init_for_display_damage_game_battler_base initialize
  1241.   def initialize
  1242.     @hzhj_damage = []
  1243.     hzhj_old_init_for_display_damage_game_battler_base
  1244.   end
  1245. end
  1246. #==============================================================================
  1247. # ■ Sprite_Base
  1248. #==============================================================================
  1249. class Sprite_Base < Sprite
  1250.   #--------------------------------------------------------------------------
  1251.   # ● 初始化(追加定义)
  1252.   #--------------------------------------------------------------------------
  1253.   alias hzhj_old_init_for_display_damage_spr_base initialize
  1254.   def initialize(*args)
  1255.     hzhj_old_init_for_display_damage_spr_base(*args)
  1256.     @hzhj_damage_sprites = []
  1257.   end
  1258.   #--------------------------------------------------------------------------
  1259.   # ● 释放(追加定义)
  1260.   #--------------------------------------------------------------------------
  1261.   alias hzhj_old_dispose_for_display_damage_spr_base dispose
  1262.   def dispose
  1263.     hzhj_old_dispose_for_display_damage_spr_base
  1264.     dispose_damage
  1265.   end
  1266.   #--------------------------------------------------------------------------
  1267.   # ● 判断是否有伤害在显示(新增定义)
  1268.   #--------------------------------------------------------------------------
  1269.   def damage?
  1270.     return (not @hzhj_damage_sprites.empty?)
  1271.   end
  1272.   #--------------------------------------------------------------------------
  1273.   # ● 开始显示伤害(新增定义)
  1274.   #--------------------------------------------------------------------------
  1275.   def start_damage(args)
  1276.     args[4] = x - ox + width / 2
  1277.     args[5] = y - oy + height / 2
  1278.     args[6] = z
  1279.     @hzhj_damage_sprites.push(Sprite_Damage.new(viewport, args))
  1280.   end
  1281.   #--------------------------------------------------------------------------
  1282.   # ● 释放所有伤害显示(新增定义)
  1283.   #--------------------------------------------------------------------------
  1284.   def dispose_damage
  1285.     return unless damage?
  1286.     @hzhj_damage_sprites.each{|sprite|sprite.dispose}
  1287.     @hzhj_damage_sprites.clear
  1288.   end
  1289.   #--------------------------------------------------------------------------
  1290.   # ● 刷新(追加定义)
  1291.   #--------------------------------------------------------------------------
  1292.   alias hzhj_old_update_for_display_damage_spr_base update
  1293.   def update
  1294.     hzhj_old_update_for_display_damage_spr_base
  1295.     update_damage
  1296.   end
  1297.   #--------------------------------------------------------------------------
  1298.   # ● 刷新显示伤害(新增定义)
  1299.   #--------------------------------------------------------------------------
  1300.   def update_damage
  1301.     return unless damage?
  1302.     @hzhj_damage_sprites.each_with_index do |sprite, i|
  1303.       if sprite.moving?
  1304.         sprite.update
  1305.       else
  1306.         sprite.dispose
  1307.         @hzhj_damage_sprites[i] = nil
  1308.       end
  1309.     end
  1310.     @hzhj_damage_sprites.delete(nil)
  1311.   end
  1312. end
  1313. #==============================================================================
  1314. # ■ Sprite_Battler
  1315. #==============================================================================
  1316. class Sprite_Battler < Sprite_Base
  1317.   #--------------------------------------------------------------------------
  1318.   # ● 刷新(追加定义)
  1319.   #--------------------------------------------------------------------------
  1320.   alias hzhj_old_update_for_display_damage_spr_battler update
  1321.   def update
  1322.     hzhj_old_update_for_display_damage_spr_battler
  1323.     if @battler
  1324.       if not @battler.hzhj_damage.empty?
  1325.         unless @battler.damage_section_displayed
  1326.           args = @battler.hzhj_damage.clone
  1327.           args[3] = @battler.actor? ? :actor : (@battler.enemy? ? :enemy : nil)
  1328.           start_damage(args)
  1329.         end
  1330.         @battler.hzhj_damage.clear
  1331.       end
  1332.     end
  1333.   end
  1334. end
  1335. #==============================================================================
  1336. # ■ Window_BattleLog
  1337. #==============================================================================
  1338. class Window_BattleLog < Window_Selectable
  1339.   #--------------------------------------------------------------------------
  1340.   # ● 显示 MISS (追加定义)
  1341.   #--------------------------------------------------------------------------
  1342.   alias hzhj_old_display_miss_for_display_damage_wnd_btlog display_miss
  1343.   def display_miss(target, item)
  1344.     target.hzhj_damage = [:miss, :miss, false]
  1345.     hzhj_old_display_miss_for_display_damage_wnd_btlog(target, item)
  1346.   end
  1347.   #--------------------------------------------------------------------------
  1348.   # ● 显示回避 (追加定义)
  1349.   #--------------------------------------------------------------------------
  1350.   alias hzhj_old_display_evasion_for_display_damage_wnd_btlog display_evasion
  1351.   def display_evasion(target, item)
  1352.     target.hzhj_damage = [:eva, :evasion, false]
  1353.     hzhj_old_display_evasion_for_display_damage_wnd_btlog(target, item)
  1354.   end
  1355.   #--------------------------------------------------------------------------
  1356.   # ● 显示 HP 伤害 (追加定义)
  1357.   #--------------------------------------------------------------------------
  1358.   alias hzhj_old_display_hp_damage_for_display_damage_wnd_btlog display_hp_damage
  1359.   def display_hp_damage(target, item)
  1360.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  1361.     value = target.result.hp_damage
  1362.     critical = target.result.critical
  1363.     target.hzhj_damage = [:hp, value, critical]
  1364.     hzhj_old_display_hp_damage_for_display_damage_wnd_btlog(target, item)
  1365.   end
  1366.   #--------------------------------------------------------------------------
  1367.   # ● 显示 MP 伤害 (追加定义)
  1368.   #--------------------------------------------------------------------------
  1369.   alias hzhj_old_display_mp_damage_for_display_damage_wnd_btlog display_mp_damage
  1370.   def display_mp_damage(target, item)
  1371.     return if target.dead? || target.result.mp_damage == 0
  1372.     value = target.result.mp_damage
  1373.     critical = target.result.critical
  1374.     target.hzhj_damage = [:mp, value, critical]
  1375.     hzhj_old_display_mp_damage_for_display_damage_wnd_btlog(target, item)
  1376.   end
  1377.   #--------------------------------------------------------------------------
  1378.   # ● 显示 TP 伤害 (追加定义)
  1379.   #--------------------------------------------------------------------------
  1380.   alias hzhj_old_display_tp_damage_for_display_damage_wnd_btlog display_tp_damage
  1381.   def display_tp_damage(target, item)
  1382.     return if target.dead? || target.result.tp_damage == 0
  1383.     value = target.result.tp_damage
  1384.     critical = target.result.critical
  1385.     target.hzhj_damage = [:tp, value, critical]
  1386.     hzhj_old_display_tp_damage_for_display_damage_wnd_btlog(target, item)
  1387.   end
  1388. end

  1389. class RPG::Animation
  1390.   def need_move
  1391.     return @need_move unless @need_move.nil?
  1392.     if /@[Rr][Mm]/ =~ @name
  1393.       return (@need_move = true)
  1394.     else
  1395.       return (@need_move = false)
  1396.     end
  1397.   end
  1398.   def move_se
  1399.     return @move_se unless @move_se.nil?
  1400.     @move_se = RPG::SE.new
  1401.     if /@[Ss][Ee]\[(.+?)\]/ =~ @name
  1402.       @move_se.name = $1.clone
  1403.     end
  1404.     return @move_se
  1405.   end
  1406.   attr_writer :need_move
  1407.   attr_writer :move_se
  1408. end
  1409. #==============================================================================
  1410. # ■ Game_Battler
  1411. #==============================================================================
  1412. class Game_Battler < Game_BattlerBase
  1413.   include Hzhj::HorizontalBattleSystem
  1414.   #--------------------------------------------------------------------------
  1415.   # ● 属性
  1416.   #--------------------------------------------------------------------------
  1417.   attr_accessor :add_x                    # X 坐标变化量
  1418.   attr_accessor :add_y                    # Y 坐标变化量
  1419.   attr_accessor :move_speed_x             # 战斗图 X 移动速度
  1420.   attr_accessor :move_speed_y             # 战斗图 Y 移动速度
  1421.   #--------------------------------------------------------------------------
  1422.   # ● 初始化(追加定义)
  1423.   #--------------------------------------------------------------------------
  1424.   alias hzhj_old_init_for_real_move_game_battler initialize
  1425.   def initialize
  1426.     @add_x = 0
  1427.     @add_y = 0
  1428.     @move_speed_x = 0
  1429.     @move_speed_y = 0
  1430.     hzhj_old_init_for_real_move_game_battler
  1431.   end
  1432.   #--------------------------------------------------------------------------
  1433.   # ● 真实 X 坐标(新增定义)
  1434.   #--------------------------------------------------------------------------
  1435.   def real_screen_x
  1436.     return screen_x + add_x
  1437.   end
  1438.   #--------------------------------------------------------------------------
  1439.   # ● 真实 Y 坐标(新增定义)
  1440.   #--------------------------------------------------------------------------
  1441.   def real_screen_y
  1442.     return screen_y + add_y
  1443.   end
  1444.   #--------------------------------------------------------------------------
  1445.   # ● 返回自己的战斗位置(新增定义)
  1446.   #--------------------------------------------------------------------------
  1447.   def come_back_self_position(duration)
  1448.     return if dead?
  1449.     tx = screen_x
  1450.     ty = screen_y
  1451.     addx = tx - real_screen_x
  1452.     addy = ty - real_screen_y
  1453.     return if addx == 0 && addy == 0
  1454.     @add_x = 0
  1455.     @add_y = 0
  1456.     @move_speed_x = [(addx.abs / duration.to_f).ceil, 1].max
  1457.     @move_speed_y = [(addy.abs / duration.to_f).ceil, 1].max
  1458.   end
  1459.   #--------------------------------------------------------------------------
  1460.   # ● 设置移动信息(新增定义)
  1461.   #--------------------------------------------------------------------------
  1462.   def setup_move_info(target_battler, duration, move_se)
  1463.     return if dead?
  1464.     tbmp = Cache.battler(target_battler.battler_name, target_battler.battler_hue)
  1465.     sbmp = Cache.battler(@battler_name, @battler_hue)
  1466.     tbw = tbmp.width / DynamicPatternMax + RealMoveBmpAddW
  1467.     sbw = sbmp.width / DynamicPatternMax + RealMoveBmpAddW
  1468.     tbh = tbmp.height + RealMoveBmpAddH
  1469.     sbh = sbmp.height + RealMoveBmpAddH
  1470.     d = actor? ? ActorDirection : 10 - ActorDirection
  1471.     tx = target_battler.real_screen_x
  1472.     ty = target_battler.real_screen_y
  1473.     case d
  1474.     when 1
  1475.       tx = tx + tbw / 2 + sbw / 2
  1476.       ty = ty - sbh / 2
  1477.     when 2
  1478.       ty = ty - sbh / 2
  1479.     when 3
  1480.       tx = tx - tbw / 2 - sbw / 2
  1481.       ty = ty - sbh / 2
  1482.     when 4
  1483.       tx = tx + tbw / 2 + sbw / 2
  1484.     when 6
  1485.       tx = tx - tbw / 2 - sbw / 2
  1486.     when 7
  1487.       tx = tx + tbw / 2 + sbw / 2
  1488.       ty = ty + sbh / 2
  1489.     when 8
  1490.       ty = ty + sbh / 2
  1491.     when 9
  1492.       tx = tx - tbw / 2 - sbw / 2
  1493.       ty = ty + sbh / 2
  1494.     end
  1495.     addx = tx - real_screen_x
  1496.     addy = ty - real_screen_y
  1497.     return if addx == 0 && addy == 0
  1498.     @add_x = tx - screen_x if addx != 0
  1499.     @add_y = ty - screen_y if addy != 0
  1500.     @move_speed_x = [(addx.abs / duration.to_f).ceil, 1].max
  1501.     @move_speed_y = [(addy.abs / duration.to_f).ceil, 1].max
  1502.     move_se.play
  1503.   end
  1504. end
  1505. #==============================================================================
  1506. # ■ Sprite_Battler
  1507. #==============================================================================
  1508. class Sprite_Battler < Sprite_Base
  1509.   #--------------------------------------------------------------------------
  1510.   # ● 初始化(追加定义)
  1511.   #--------------------------------------------------------------------------
  1512.   alias hzhj_old_init_for_real_move_spr_battler initialize
  1513.   def initialize(viewport, battler = nil)
  1514.     hzhj_old_init_for_real_move_spr_battler(viewport, battler)
  1515.     init_position(@battler) if @battler
  1516.   end
  1517.   #--------------------------------------------------------------------------
  1518.   # ● 设置战斗者(追加定义)
  1519.   #--------------------------------------------------------------------------
  1520.   alias hzhj_old_set_battler_for_real_move_spr_battler battler=
  1521.   def battler=(value)
  1522.     if @battler != value && value
  1523.       init_position(value)
  1524.     end
  1525.     hzhj_old_set_battler_for_real_move_spr_battler(value)
  1526.   end
  1527.   #--------------------------------------------------------------------------
  1528.   # ● 初始化位置(新增定义)
  1529.   #--------------------------------------------------------------------------
  1530.   def init_position(battler)
  1531.     battler.add_x = 0
  1532.     battler.add_y = 0
  1533.     self.x = battler.real_screen_x
  1534.     self.y = battler.real_screen_y
  1535.     self.z = battler.screen_z
  1536.   end
  1537.   #--------------------------------------------------------------------------
  1538.   # ● 移动中判定(新增定义)
  1539.   #--------------------------------------------------------------------------
  1540.   def moving?
  1541.     return false unless @battler
  1542.     (x != @battler.real_screen_x or y != @battler.real_screen_y) && @battler
  1543.   end
  1544.   #--------------------------------------------------------------------------
  1545.   # ● 位置的更新(重定义)
  1546.   #--------------------------------------------------------------------------
  1547.   def update_position
  1548.     if !@battler.dead?
  1549.       if x < @battler.real_screen_x
  1550.         self.x = [x + @battler.move_speed_x, @battler.real_screen_x].min
  1551.       elsif x > @battler.real_screen_x
  1552.         self.x = [x - @battler.move_speed_x, @battler.real_screen_x].max
  1553.       end
  1554.       if y < @battler.real_screen_y
  1555.         self.y = [y + @battler.move_speed_y, @battler.real_screen_y].min
  1556.       elsif y > @battler.real_screen_y
  1557.         self.y = [y - @battler.move_speed_y, @battler.real_screen_y].max
  1558.       end
  1559.       self.z = y + 100
  1560.     end
  1561.   end
  1562. end
  1563. #==============================================================================
  1564. # ■ Spriteset_Battle
  1565. #==============================================================================
  1566. class Spriteset_Battle
  1567.   #--------------------------------------------------------------------------
  1568.   # ● 判定是否移动中(新增定义)
  1569.   #--------------------------------------------------------------------------
  1570.   def moving?
  1571.     battler_sprites.any? {|sprite| sprite.moving? }
  1572.   end
  1573. end
  1574. #==============================================================================
  1575. # ■ Scene_Battle
  1576. #==============================================================================
  1577. class Scene_Battle < Scene_Base
  1578.   #--------------------------------------------------------------------------
  1579.   # ● 等待战斗图移动的结束(新增定义)
  1580.   #--------------------------------------------------------------------------
  1581.   def wait_for_move
  1582.     update_for_wait
  1583.     update_for_wait while @spriteset.moving?
  1584.   end
  1585. end

  1586. class RPG::Troop
  1587.   include Hzhj::HorizontalBattleSystem
  1588.   def display_enemy_bar
  1589.     return @display_enemy_bar unless @display_enemy_bar.nil?
  1590.     if /@ebar/i =~ @name
  1591.       return (@display_enemy_bar = !DefaultDisplayEnemyBar)
  1592.     else
  1593.       return (@display_enemy_bar = DefaultDisplayEnemyBar)
  1594.     end
  1595.   end
  1596.   attr_writer :display_enemy_bar
  1597. end
  1598. #==============================================================================
  1599. # ■ Game_Troop
  1600. #==============================================================================
  1601. class Game_Troop < Game_Unit
  1602.   attr_accessor :display_enemy_bar      # 是否显示敌人HP条、MP条、TP条
  1603.   #--------------------------------------------------------------------------
  1604.   # ● 设置
  1605.   #--------------------------------------------------------------------------
  1606.   alias hzhj_old_setup_for_display_enemy_bar_game_troop setup
  1607.   def setup(troop_id)
  1608.     hzhj_old_setup_for_display_enemy_bar_game_troop(troop_id)
  1609.     @display_enemy_bar = troop.display_enemy_bar
  1610.   end
  1611. end
  1612. #==============================================================================
  1613. # ■ Window_BattleEnemy
  1614. #==============================================================================
  1615. class Window_BattleEnemy < Window_Selectable
  1616.   #--------------------------------------------------------------------------
  1617.   # ● 取得列数
  1618.   #--------------------------------------------------------------------------
  1619.   def col_max
  1620.     if $game_troop.display_enemy_bar
  1621.       return 1
  1622.     else
  1623.       return 2
  1624.     end
  1625.   end
  1626.   #--------------------------------------------------------------------------
  1627.   # ● 刷新
  1628.   #--------------------------------------------------------------------------
  1629.   def refresh
  1630.     create_contents
  1631.     super
  1632.   end
  1633.   #--------------------------------------------------------------------------
  1634.   # ● 描画项目
  1635.   #--------------------------------------------------------------------------
  1636.   def draw_item(index)
  1637.     if $game_troop.display_enemy_bar
  1638.       enemy = $game_troop.alive_members[index]
  1639.       draw_basic_area(basic_area_rect(index), enemy)
  1640.       draw_gauge_area(gauge_area_rect(index), enemy)
  1641.     else
  1642.       change_color(normal_color)
  1643.       name = $game_troop.alive_members[index].name
  1644.       draw_text(item_rect_for_text(index), name)
  1645.     end
  1646.   end
  1647.   #--------------------------------------------------------------------------
  1648.   # ● 取得基本区域的矩形
  1649.   #--------------------------------------------------------------------------
  1650.   def basic_area_rect(index)
  1651.     rect = item_rect_for_text(index)
  1652.     rect.width -= gauge_area_width + 10
  1653.     rect
  1654.   end
  1655.   #--------------------------------------------------------------------------
  1656.   # ● 取得值槽区域的矩形
  1657.   #--------------------------------------------------------------------------
  1658.   def gauge_area_rect(index)
  1659.     rect = item_rect_for_text(index)
  1660.     rect.x += rect.width - gauge_area_width
  1661.     rect.width = gauge_area_width
  1662.     rect
  1663.   end
  1664.   #--------------------------------------------------------------------------
  1665.   # ● 取得值槽区域的宽度
  1666.   #--------------------------------------------------------------------------
  1667.   def gauge_area_width
  1668.     return 220
  1669.   end
  1670.   #--------------------------------------------------------------------------
  1671.   # ● 描画基本区域
  1672.   #--------------------------------------------------------------------------
  1673.   def draw_basic_area(rect, actor)
  1674.     draw_actor_name(actor, rect.x + 0, rect.y, 100)
  1675.     draw_actor_icons(actor, rect.x + 104, rect.y, rect.width - 104)
  1676.   end
  1677.   #--------------------------------------------------------------------------
  1678.   # ● 描画值槽区域
  1679.   #--------------------------------------------------------------------------
  1680.   def draw_gauge_area(rect, actor)
  1681.     if $data_system.opt_display_tp
  1682.       draw_gauge_area_with_tp(rect, actor)
  1683.     else
  1684.       draw_gauge_area_without_tp(rect, actor)
  1685.     end
  1686.   end
  1687.   #--------------------------------------------------------------------------
  1688.   # ● 描画值槽区域(包括 TP 值)
  1689.   #--------------------------------------------------------------------------
  1690.   def draw_gauge_area_with_tp(rect, actor)
  1691.     draw_actor_hp(actor, rect.x + 0, rect.y, 72)
  1692.     draw_actor_mp(actor, rect.x + 82, rect.y, 64)
  1693.     draw_actor_tp(actor, rect.x + 156, rect.y, 64)
  1694.   end
  1695.   #--------------------------------------------------------------------------
  1696.   # ● 描画值槽区域(不包括 TP 值)
  1697.   #--------------------------------------------------------------------------
  1698.   def draw_gauge_area_without_tp(rect, actor)
  1699.     draw_actor_hp(actor, rect.x + 0, rect.y, 134)
  1700.     draw_actor_mp(actor, rect.x + 144,  rect.y, 76)
  1701.   end
  1702. end

  1703. #==============================================================================
  1704. # ■ Sprite_Battler
  1705. #==============================================================================
  1706. class Sprite_Battler < Sprite_Base
  1707.   include Hzhj::HorizontalBattleSystem
  1708.   #--------------------------------------------------------------------------
  1709.   # ● 初始化(追加定义)
  1710.   #--------------------------------------------------------------------------
  1711.   alias hzhj_old_init_for_dynamic_spr_battler initialize
  1712.   def initialize(viewport, battler = nil)
  1713.     hzhj_old_init_for_dynamic_spr_battler(viewport, battler)
  1714.     @dynamic_duration = 0
  1715.     @dynamic_duration_max = DynamicPatternMax * OnePatternDuration
  1716.   end
  1717.   #--------------------------------------------------------------------------
  1718.   # ● 源位图(Source Bitmap)的更新(重定义)
  1719.   #--------------------------------------------------------------------------
  1720.   def update_bitmap
  1721.     new_bitmap = Cache.battler(@battler.battler_name, @battler.battler_hue)
  1722.     if bitmap != new_bitmap
  1723.       self.bitmap = new_bitmap
  1724.       init_visibility
  1725.       @dynamic_duration = 0
  1726.       @sx = 0
  1727.       @sw = bitmap.width / DynamicPatternMax
  1728.       @sh = bitmap.height
  1729.       self.ox = @sw / 2
  1730.       self.oy = @sh
  1731.       src_rect.set(@sx, 0, @sw, @sh)
  1732.     end
  1733.   end
  1734.   #--------------------------------------------------------------------------
  1735.   # ● 原点的更新(重定义)
  1736.   #--------------------------------------------------------------------------
  1737.   def update_origin
  1738.     if bitmap
  1739.       @dynamic_duration += 1
  1740.       @dynamic_duration %= @dynamic_duration_max
  1741.       @sx = @dynamic_duration / OnePatternDuration * @sw
  1742.       src_rect.set(@sx, 0, @sw, @sh)
  1743.     end
  1744.   end
  1745.   #--------------------------------------------------------------------------
  1746.   # ● 返回普通设定(追加定义)
  1747.   #--------------------------------------------------------------------------
  1748.   alias hzhj_old_revert_to_normal_for_dynamic_spr_battler revert_to_normal
  1749.   def revert_to_normal
  1750.     hzhj_old_revert_to_normal_for_dynamic_spr_battler
  1751.     self.ox = @sw / 2 if bitmap
  1752.   end
  1753.   #--------------------------------------------------------------------------
  1754.   # ● BOSS 战败(崩坏)效果的更新(追加定义)
  1755.   #--------------------------------------------------------------------------
  1756.   alias hzhj_old_update_boss_col_for_dynamic_spr_battler update_boss_collapse
  1757.   def update_boss_collapse
  1758.     hzhj_old_update_boss_col_for_dynamic_spr_battler
  1759.     self.ox = @sw / 2 + @effect_duration % 2 * 4 - 2
  1760.   end
  1761. end

  1762. #==============================================================================
  1763. # ■ Game_Battler
  1764. #==============================================================================
  1765. class Game_Battler < Game_BattlerBase
  1766.   def set_normal_battler_name
  1767.     @battler_name = @battler_name.split(/★/)[0]
  1768.   end
  1769.   def set_beaten_battler_name
  1770.     if guard?
  1771.       if (UseActorGuardGraphic && actor?) or
  1772.          (UseEnemyGuardGraphic && enemy?)
  1773.         set_guard_battler_name
  1774.         return
  1775.       end
  1776.     end
  1777.     @battler_name = @battler_name.split(/★/)[0] + "★1"
  1778.     if UseActorWBSE && actor?
  1779.       Audio.se_play("Audio/SE/AWBSE_#{id}", 100, 100)
  1780.     elsif UseEnemyWBSE && enemy?
  1781.       Audio.se_play("Audio/SE/EWBSE_#{enemy_id}", 100, 100)
  1782.     end
  1783.   end
  1784.   def set_dead_battler_name
  1785.     @battler_name = @battler_name.split(/★/)[0] + "★2"
  1786.   end
  1787.   def set_guard_battler_name
  1788.     @battler_name = @battler_name.split(/★/)[0] + "★3"
  1789.     if UseActorGDSE && actor?
  1790.       Audio.se_play("Audio/SE/AGDSE_#{id}", 100, 100)
  1791.     elsif UseEnemyGDSE && enemy?
  1792.       Audio.se_play("Audio/SE/EGDSE_#{enemy_id}", 100, 100)
  1793.     end
  1794.   end
  1795. end
  1796. #==============================================================================
  1797. # ■ Sprite_Battler
  1798. #==============================================================================
  1799. class Sprite_Battler < Sprite_Base
  1800.   #--------------------------------------------------------------------------
  1801.   # ● 初始化(追加定义)
  1802.   #--------------------------------------------------------------------------
  1803.   alias hzhj_old_init_for_dead_spr_battler initialize
  1804.   def initialize(viewport, battler = nil)
  1805.     hzhj_old_init_for_dead_spr_battler(viewport, battler)
  1806.     @dead_graphic_used = false
  1807.     if @battler
  1808.       @battler.set_normal_battler_name
  1809.       if @battler.dead?
  1810.         if (UseActorDeadGraphic && @battler.actor?) or
  1811.            (UseEnemyDeadGraphic && @battler.enemy?)
  1812.           @battler.set_dead_battler_name
  1813.           @dead_graphic_used = true
  1814.         end
  1815.       end
  1816.     end
  1817.     @beaten_duration = -1
  1818.   end
  1819.   #--------------------------------------------------------------------------
  1820.   # ● 设置战斗者(追加定义)
  1821.   #--------------------------------------------------------------------------
  1822.   alias hzhj_old_set_battler_for_dead_spr_battler battler=
  1823.   def battler=(value)
  1824.     if @battler != value
  1825.       @dead_graphic_used = false
  1826.       if value
  1827.         value.set_normal_battler_name
  1828.         if value.dead?
  1829.           if (UseActorDeadGraphic && value.actor?) or
  1830.              (UseEnemyDeadGraphic && value.enemy?)
  1831.             value.set_dead_battler_name
  1832.             @dead_graphic_used = true
  1833.           end
  1834.         end
  1835.       end
  1836.       @beaten_duration = -1
  1837.     end
  1838.     hzhj_old_set_battler_for_dead_spr_battler(value)
  1839.   end
  1840.   #--------------------------------------------------------------------------
  1841.   # ● 源位图(Source Bitmap)的更新(重定义)
  1842.   #--------------------------------------------------------------------------
  1843.   alias hzhj_old_update_bitmap_for_was_beaten_spr_battler update_bitmap
  1844.   def update_bitmap
  1845.     if @beaten_duration > 0
  1846.       @beaten_duration -= 1
  1847.     elsif @beaten_duration == 0
  1848.       @beaten_duration = -1
  1849.       set_bitmap(:normal)
  1850.     end
  1851.     hzhj_old_update_bitmap_for_was_beaten_spr_battler
  1852.   end
  1853.   #--------------------------------------------------------------------------
  1854.   # ● 初始化可视状态(追加定义)
  1855.   #--------------------------------------------------------------------------
  1856.   alias hzhj_old_visibility_for_dead_spr_battler init_visibility
  1857.   def init_visibility
  1858.     hzhj_old_visibility_for_dead_spr_battler
  1859.     if @battler.dead?
  1860.       if (UseActorDeadGraphic && @battler.actor?) or
  1861.          (UseEnemyDeadGraphic && @battler.enemy?)
  1862.         self.opacity = 255
  1863.       end
  1864.     end
  1865.   end
  1866.   #--------------------------------------------------------------------------
  1867.   # ● 效果开始(追加定义)
  1868.   #--------------------------------------------------------------------------
  1869.   alias hzhj_old_start_effect_for_dead_spr_battler start_effect
  1870.   def start_effect(effect_type)
  1871.     if effect_type == :appear
  1872.       if @dead_graphic_used
  1873.         set_bitmap(:normal)
  1874.         @effect_type = nil
  1875.         @effect_duration = 0
  1876.         @dead_graphic_used = false
  1877.         @battler_visible = true
  1878.         return
  1879.       end
  1880.     elsif effect_type == :collapse or
  1881.           effect_type == :boss_collapse or
  1882.           effect_type == :instant_collapse
  1883.       if @beaten_duration >= 0
  1884.         @beaten_duration = -1
  1885.         set_bitmap(:normal)
  1886.       end
  1887.       if (UseActorDeadGraphic && @battler.actor?) or
  1888.          (UseEnemyDeadGraphic && @battler.enemy?)
  1889.         set_bitmap(:dead)
  1890.         @effect_type = nil
  1891.         @effect_duration = 0
  1892.         @dead_graphic_used = true
  1893.         @battler_visible = false
  1894.         return
  1895.       end
  1896.     end
  1897.     hzhj_old_start_effect_for_dead_spr_battler(effect_type)
  1898.   end
  1899.   #--------------------------------------------------------------------------
  1900.   # ● 设置新的位图(新增定义)
  1901.   #--------------------------------------------------------------------------
  1902.   def set_bitmap(sym)
  1903.     case sym
  1904.     when :normal
  1905.       @battler.set_normal_battler_name
  1906.     when :was_beaten
  1907.       @battler.set_beaten_battler_name
  1908.     when :dead
  1909.       @battler.set_dead_battler_name
  1910.     else
  1911.       return
  1912.     end
  1913.     new_bitmap = Cache.battler(@battler.battler_name, @battler.battler_hue)
  1914.     if bitmap != new_bitmap
  1915.       self.bitmap = new_bitmap
  1916.       @dynamic_duration = 0
  1917.       @sx = 0
  1918.       @sw = bitmap.width / DynamicPatternMax
  1919.       @sh = bitmap.height
  1920.       self.ox = @sw / 2
  1921.       self.oy = @sh
  1922.       src_rect.set(@sx, 0, @sw, @sh)
  1923.     end
  1924.     update_origin
  1925.     update_position
  1926.   end
  1927. end

  1928. #==============================================================================
  1929. # ■ Scene_Battle
  1930. #==============================================================================
  1931. class Scene_Battle < Scene_Base
  1932.   #--------------------------------------------------------------------------
  1933.   # ● 发动技能/物品(新增定义)
  1934.   #--------------------------------------------------------------------------
  1935.   def hzhj_invoke_item(target, item, damage_target)
  1936.     refresh_status
  1937.     @log_window.display_action_results(damage_target, item)
  1938.     @subject.damage_section_displayed = false
  1939.     @subject.last_target_index = target.index
  1940.     return if target.dead?
  1941.     if rand < target.item_cnt(@subject, item)
  1942.       hzhj_invoke_counter_attack(target, item)
  1943.     elsif rand < target.item_mrf(@subject, item)
  1944.       hzhj_invoke_magic_reflection(target, item)
  1945.     end
  1946.   end
  1947.   #--------------------------------------------------------------------------
  1948.   # ● 发动物理反击(新增定义)
  1949.   #--------------------------------------------------------------------------
  1950.   def hzhj_invoke_counter_attack(target, item)
  1951.     @log_window.display_counter(target, item)
  1952.     attack_skill = $data_skills[target.attack_skill_id]
  1953.     @subject.item_apply(target, attack_skill)
  1954.     need_move = false
  1955.     animation1 = $data_animations[target.animation1_id]
  1956.     need_move = animation1.need_move if animation1
  1957.     ary = [@subject]
  1958.     if need_move
  1959.       target.setup_move_info(@subject, RealMoveDuration, animation1.move_se)
  1960.       wait_for_move
  1961.     end
  1962.     @subject.damage_section_displayed = false
  1963.     @subject.not_damage_section = false
  1964.     show_subject_animation(target.animation1_id, target)
  1965.     show_normal_animation(ary, target.atk_animation_id1, false)
  1966.     show_normal_animation(ary, target.atk_animation_id2, true)
  1967.     @log_window.wait
  1968.     wait_for_animation
  1969.     if need_move && target.alive?
  1970.       target.come_back_self_position(RealMoveDuration)
  1971.       wait_for_move
  1972.     end
  1973.     refresh_status
  1974.     @log_window.display_action_results(@subject, attack_skill)
  1975.   end
  1976.   #--------------------------------------------------------------------------
  1977.   # ● 发动魔法反射(新增定义)
  1978.   #--------------------------------------------------------------------------
  1979.   def hzhj_invoke_magic_reflection(target, item)
  1980.     @subject.damage_section_displayed = false
  1981.     @subject.not_damage_section = false
  1982.     @log_window.display_reflection(target, item)
  1983.     @subject.item_apply(@subject, item)
  1984.     refresh_status
  1985.     @log_window.display_action_results(@subject, item)
  1986.   end
  1987. end

  1988. #==============================================================================
  1989. # ■ Game_Battler
  1990. #==============================================================================
  1991. class Game_Battler < Game_BattlerBase
  1992.   attr_accessor :damage_section_displayed
  1993.   attr_accessor :not_damage_section
  1994. end
  1995. #==============================================================================
  1996. # ■ Game_Actor
  1997. #==============================================================================
  1998. class Game_Actor < Game_Battler
  1999.   #--------------------------------------------------------------------------
  2000.   # ● 执行伤害效果
  2001.   #--------------------------------------------------------------------------
  2002.   alias hzhj_old_per_damage_for_damage_section_game_actor perform_damage_effect
  2003.   def perform_damage_effect
  2004.     unless damage_section_displayed
  2005.       hzhj_old_per_damage_for_damage_section_game_actor
  2006.     end
  2007.   end
  2008. end
  2009. #==============================================================================
  2010. # ■ Game_Enemy
  2011. #==============================================================================
  2012. class Game_Enemy < Game_Battler
  2013.   #--------------------------------------------------------------------------
  2014.   # ● 执行伤害效果
  2015.   #--------------------------------------------------------------------------
  2016.   alias hzhj_old_per_damage_for_damage_section_game_enemy perform_damage_effect
  2017.   def perform_damage_effect
  2018.     unless damage_section_displayed
  2019.       hzhj_old_per_damage_for_damage_section_game_enemy
  2020.     end
  2021.   end
  2022. end
  2023. #==============================================================================
  2024. # ■ Sprite_Battler
  2025. #==============================================================================
  2026. class Sprite_Battler < Sprite_Base
  2027.   #--------------------------------------------------------------------------
  2028.   # ● SE 和闪烁时机的处理
  2029.   #--------------------------------------------------------------------------
  2030.   def animation_process_timing(timing)
  2031.     if timing.se.name == DamageSectionDisplaySEName
  2032.       hp_value = @battler.result.hp_damage
  2033.       mp_value = @battler.result.mp_damage
  2034.       tp_value = @battler.result.tp_damage
  2035.       value = args = nil
  2036.       was_beaten = false
  2037.       if hp_value != 0 && !@battler.not_damage_section
  2038.         was_beaten = true if hp_value > 0
  2039.         value = hp_value * timing.flash_color.red.to_i / 100
  2040.         critical = @battler.result.critical
  2041.         args = [:hp, value, critical]
  2042.       elsif mp_value != 0 && !@battler.not_damage_section
  2043.         was_beaten = true if mp_value > 0
  2044.         value = mp_value * timing.flash_color.red.to_i / 100
  2045.         critical = @battler.result.critical
  2046.         args = [:mp, value, critical]
  2047.       elsif tp_value != 0 && !@battler.not_damage_section
  2048.         was_beaten = true if tp_value > 0
  2049.         value = tp_value * timing.flash_color.red.to_i / 100
  2050.         critical = @battler.result.critical
  2051.         args = [:tp, value, critical]
  2052.       end
  2053.       if value && args
  2054.         args[3] = @battler.actor? ? :actor : (@battler.enemy? ? :enemy : nil)
  2055.         @battler.damage_section_displayed = true
  2056.         start_damage(args)
  2057.         if UseBeatenGraphic && was_beaten
  2058.           set_bitmap(:was_beaten)
  2059.           @beaten_duration = BeatenGraphicDuration
  2060.         end
  2061.       end
  2062.       return
  2063.     end
  2064.     super(timing)
  2065.   end
  2066. end
  2067. #==============================================================================
  2068. # ■ Scene_Battle
  2069. #==============================================================================
  2070. class Scene_Battle < Scene_Base
  2071.   #--------------------------------------------------------------------------
  2072.   # ● 应用技能/物品效果(新增定义)
  2073.   #--------------------------------------------------------------------------
  2074.   def hzhj_apply_item_effects(target, item)
  2075.     target.damage_section_displayed = false
  2076.     target.not_damage_section = false
  2077.     target = apply_substitute(target, item)
  2078.     target.damage_section_displayed = false
  2079.     target.not_damage_section = false
  2080.     target.item_apply(@subject, item)
  2081.     return target
  2082.   end
  2083. end
  2084. #==============================================================================
  2085. # ■ 此脚本来自 [url]www.66rpg.com[/url]
  2086. #==============================================================================
复制代码


69888.png
梦石
0
星屑
17289
在线时间
6068 小时
注册时间
2011-7-18
回帖
153

开拓者

发表于 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
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部