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

Project1

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

[已经解决] 关于横版作战脚本的问题 提取

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
49 小时
注册时间
2012-8-20
帖子
65
跳转到指定楼层
1
发表于 2012-8-23 21:44:35 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
RT
从这里提取出横版作战的脚本,谢谢了
整合系统

点评

脚本拿去了  发表于 2012-8-25 08:29

评分

参与人数 1星屑 +100 收起 理由
Luciffer + 100 这就乖了嘛~

查看全部评分

Lv3.寻梦者

虚空人形

梦石
0
星屑
4604
在线时间
2037 小时
注册时间
2011-8-11
帖子
3398

贵宾

2
发表于 2012-8-24 09:24:14 | 只看该作者
这不是很明显的部分吗?

未命名.png (36.29 KB, 下载次数: 26)

未命名.png

评分

参与人数 1星屑 +2 收起 理由
怪蜀黍 + 2 我很赞同

查看全部评分

回复

使用道具 举报

Lv1.梦旅人

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

本脚本由超级横版提取出..感谢作者后知后觉.

评分

参与人数 1星屑 +160 收起 理由
Luciffer + 160 认可答案

查看全部评分

回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
320 小时
注册时间
2012-7-15
帖子
53
4
发表于 2012-8-26 12:46:57 | 只看该作者
搜一个汉化的好了,好像记得约束翻译过一个
话说这个还要根据个人爱好来设置,

评分

参与人数 1星屑 +40 收起 理由
Luciffer + 40 我很赞同

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-12-24 01:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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