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

Project1

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

[已经过期] 请问为什么这两个战斗脚本以前用不会出错,现在会?

[复制链接]

Lv2.观梦者

梦石
0
星屑
293
在线时间
398 小时
注册时间
2011-5-20
帖子
128
跳转到指定楼层
1
发表于 2013-7-18 10:26:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 893299399 于 2013-7-19 10:47 编辑

横版战斗和MOG_Adv_Battle_Hud这两个脚本以前可以一起用,为什么现在一用就出错?
http://pan.baidu.com/share/link? ... 98&uk=923321122   这是工程下载地址,太大传不进附件,下面是那两个脚本

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] = [450, 220]
  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 = false
  77.     # 挨打图形维持帧数
  78.     BeatenGraphicDuration = 30
  79.  
  80.     # 是否使用角色防御图 只有同时使用了挨打图.此项才有效.
  81.     UseActorGuardGraphic = true
  82.     # 是否使用敌人防御图 只有同时使用了挨打图.此项才有效.
  83.     UseEnemyGuardGraphic = false
  84.  
  85.     # 角色是否使用挨打SE
  86.     UseActorWBSE = false
  87.     # 敌人是否使用挨打SE
  88.     UseEnemyWBSE = false
  89.     # 角色是否使用防御SE
  90.     UseActorGDSE = false
  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. #==============================================================================


RUBY 代码复制
  1. #==============================================================================
  2. # +++ MOG - ADVANCED BATTLE HUD  (v1.6) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]http://www.atelier-rgss.com/[/url]
  6. #==============================================================================
  7. # Sistema de hud avançado de batalha.
  8. #==============================================================================
  9.  
  10. #==============================================================================
  11. # ● Histórico (Version History)
  12. #==============================================================================
  13. # v 1.6 - Corrigido o erro quando o MP ou TP maximo é iguál a zero.
  14. # v 1.5 - Corrigido a animação da face quando uma skill tem a função charge.
  15. # v 1.4 - Corrigido o erro de crash randômico. (relativo a dispose de imagem.)
  16. # v 1.3 - Script 100% independente do sistema de AT System.
  17. #       - Correção da posição inicial da janela de Fuga.
  18. #       - Correção da posição do cursor nos aliados quando a face está
  19. #         desabilitada.
  20. # v 1.2 - Corrigido a prioridade das condições.
  21. # v 1.1 - Corrigido o glitch inicial da prioridade da face.
  22. # v 1.0 - Primeiro lançamento.
  23. #==============================================================================
  24.  
  25. #==============================================================================
  26. # ■ - FACE ANIMADAS DOS PERSONAGENS - (Opcional)
  27. #==============================================================================
  28. # 1 - Grave as imagens das faces dos personagens na pasta.
  29. #
  30. # GRAPHICS/BATTLERS/
  31. #
  32. # 2 - Nomeie a imagem com o mesmo nome do personagem. (EG - Hertor.png)
  33. # 3 - A largura da imagem deverá ser dividido por 5. (A escolha do tamanho
  34. #     da face é livre desde que a lagura dividido pela altura seja igual a 5 )
  35. #
  36. #==============================================================================
  37.  
  38. #==============================================================================
  39. # ■ BATTLE HUD SETTING
  40. #==============================================================================
  41. module MOG_BATTLE_HUD
  42.   # Ativar Battlers dos personagens em faces, deixe desativado em caso de haver
  43.   # outros scripts que usam battlers dos personagens em seu projeto.
  44.   BATTLER_FACE_ENABLE = true
  45.   #Definição geral da posição da HUD.
  46.   HUD_POSITION = [5,315]
  47.   #Definição da posição da face
  48.   FACE_POSITION = [60,30]
  49.   #Definição da posição do numero de HP.
  50.   HP_NUMBER_POSITION = [85,28]
  51.   #Definição da posição do medidor de HP.
  52.   HP_METER_POSITION = [27,37]
  53.   #Definição da posição do numero de MP.
  54.   MP_NUMBER_POSITION = [101,46]
  55.   #Definição da posição do medidor de MP.
  56.   MP_METER_POSITION = [43,55]  
  57.   #Definição da posição do numero de TP.
  58.   TP_NUMBER_POSITION = [85,64]
  59.   #Definição da posição do medidor de TP.
  60.   TP_METER_POSITION = [27,73]   
  61.   #Definição da posição das condições
  62.   STATES_POSITION = [5,1]
  63.   #Definição da posição do comando de batalha.
  64.   COMMAND_POSITION = [0,-145]  
  65.   #Definição da posição do espaço da HUD entre os membros do grupo.
  66.   MEMBERS_SPACE = [136,0]
  67.   #Definição da prioridade da HUD.
  68.   BATTLE_HUD_Z = 50
  69.   #Definição da velocidade de animação dos medidores.
  70.   METER_FLOW_SPEED = 2
  71.   #Ativa o layout mais limpo nas janelas de item e skill.
  72.   ITEM_SKILL_WINDOWS_CLEAN_STYLE = true
  73.   #Definição da opacidade das janelas.
  74.   ITEM_SKILL_WINDOW_OPACITY = 0
  75. end
  76.  
  77. #==============================================================================
  78. # ■ CURSOR SETTING
  79. #==============================================================================
  80. module MOG_BATTLE_CURSOR
  81.   #Definição da posição do cursor em relação ao alvo.
  82.   CURSOR_POSITION = [-45, -16]
  83.   #Definição da posição do nome do alvo.
  84.   CURSOR_NAME_POSITION = [-10, 35]
  85.   #Ativar efeito deslizar.
  86.   CURSOR_SLIDE_EFFECT = true
  87.   #Ativar animação de levitação.
  88.   CURSOR_FLOAT_EFFECT = true  
  89. end  
  90.  
  91.  
  92. if MOG_BATTLE_HUD::BATTLER_FACE_ENABLE #BATTLER_FACE SYSTEM START
  93. #==============================================================================
  94. # ■ Game_Actor
  95. #==============================================================================
  96. class Game_Actor < Game_Battler
  97.  
  98.   attr_accessor :battler_face
  99.   attr_accessor :screen_x
  100.   attr_accessor :screen_y   
  101.  
  102.   #--------------------------------------------------------------------------
  103.   # ● Initialize
  104.   #--------------------------------------------------------------------------
  105.   alias mog_battle_hud_initialize setup
  106.   def setup(actor_id)
  107.       mog_battle_hud_initialize(actor_id)
  108.       battler_sprite_setup   
  109.   end  
  110.  
  111.   #--------------------------------------------------------------------------
  112.   # ● Battler Sprite Setup
  113.   #--------------------------------------------------------------------------  
  114.   def battler_sprite_setup
  115.       @battler_face = [0,0,0]
  116.       @battler_name = @name
  117.       @screen_x = 0
  118.       @screen_y = 0
  119.   end
  120.  
  121.   #--------------------------------------------------------------------------
  122.   # ● Use Sprite?
  123.   #--------------------------------------------------------------------------
  124.   def use_sprite?
  125.       return true
  126.   end
  127.  
  128.   #--------------------------------------------------------------------------
  129.   # ● Screen Z
  130.   #--------------------------------------------------------------------------
  131.   def screen_z
  132.       return MOG_BATTLE_HUD::BATTLE_HUD_Z + 4
  133.   end  
  134.  
  135.   #------------------------------------------------------------------------
  136.   # ● Screen X
  137.   #------------------------------------------------------------------------        
  138.   def screen_x
  139.       return FACE_POSITION[0] + HUD_POSITION[0] + (MEMBERS_SPACE[0] * index)
  140.   end  
  141.  
  142.   #------------------------------------------------------------------------
  143.   # ● Screen Y
  144.   #------------------------------------------------------------------------      
  145.   def screen_y
  146.       return FACE_POSITION[1] + HUD_POSITION[1] + (MEMBERS_SPACE[1] * index)
  147.   end     
  148.  
  149. end
  150.  
  151. #==============================================================================
  152. # ■ Sprite_Battler
  153. #==============================================================================
  154. class Sprite_Battler < Sprite_Base
  155.   include MOG_BATTLE_HUD
  156.  
  157.   #--------------------------------------------------------------------------
  158.   # ● Initialize
  159.   #--------------------------------------------------------------------------  
  160.    alias mog_battle_hud_initialize initialize
  161.    def initialize(viewport, battler = nil)
  162.        battle_hud_setup
  163.        mog_battle_hud_initialize(viewport, battler)
  164.    end
  165.  
  166.   #--------------------------------------------------------------------------
  167.   # ● Battle Hud Setup
  168.   #--------------------------------------------------------------------------     
  169.    def battle_hud_setup
  170.        @old_face_index = 0
  171.    end
  172.  
  173.   #--------------------------------------------------------------------------
  174.   # ● Dispose
  175.   #--------------------------------------------------------------------------        
  176.    alias mog_battle_hud_dispose dispose
  177.    def dispose
  178.        mog_battle_hud_dispose
  179.        if @f_im != nil
  180.           @f_im.dispose
  181.        end
  182.    end
  183.  
  184.   #--------------------------------------------------------------------------
  185.   # ● Update Bitmap
  186.   #--------------------------------------------------------------------------        
  187.    alias mog_battle_hud_update_bitmap update_bitmap
  188.    def update_bitmap
  189.        if @battler.is_a?(Game_Actor)
  190.           create_actor_battler
  191.           update_actor_battler
  192.           return
  193.        end
  194.        mog_battle_hud_update_bitmap
  195.    end  
  196.  
  197.   #--------------------------------------------------------------------------
  198.   # ● Create Actor Battler
  199.   #--------------------------------------------------------------------------               
  200.    def create_actor_battler  
  201.        return if self.bitmap != nil
  202.        @f_im = Cache.battler(@battler.battler_name, 0)
  203.        @f_cw = @f_im.width / 5
  204.        @f_ch = @f_im.height
  205.        self.bitmap = Bitmap.new(@f_cw,@f_ch)
  206.        x = FACE_POSITION[0] + HUD_POSITION[0] + (MEMBERS_SPACE[0] * @battler.index)
  207.        y = FACE_POSITION[1] + HUD_POSITION[1] + (MEMBERS_SPACE[1] * @battler.index)
  208.        @org_pos = [x,y]
  209.        @battler.battler_face = [0,0,0]
  210.        @battler_visible = true
  211.        @low_hp = @battler.mhp * 30 / 100
  212.        self.z = @battler.screen_z + 100
  213.        make_face(true)
  214.    end
  215.  
  216.   #--------------------------------------------------------------------------
  217.   # ● Face Base Setting
  218.   #--------------------------------------------------------------------------                 
  219.   def face_base_setting
  220.       self.x = @org_pos[0]
  221.       self.y = @org_pos[1]
  222.       self.z = @battler.screen_z
  223.       self.zoom_x = 1
  224.       self.zoom_y = 1
  225.       self.mirror = false   
  226.   end
  227.  
  228.   #--------------------------------------------------------------------------
  229.   # ● Check Base Face
  230.   #--------------------------------------------------------------------------              
  231.    def check_base_face(reset)
  232.        face_base_setting
  233.        return if @battler.battler_face[2] > 0
  234.        @battler.battler_face = [0,0,0] if reset and @battler.battler_face[1] != 2  
  235.        @battler.battler_face[0] = 3 if @battler.hp < @low_hp
  236.        @battler.battler_face[0] = 4 if @battler.hp == 0
  237.    end  
  238.  
  239.   #--------------------------------------------------------------------------
  240.   # ● Make Face
  241.   #--------------------------------------------------------------------------              
  242.    def make_face(reset = false)
  243.        self.bitmap.clear
  244.        check_base_face(reset)
  245.        src_rect_back = Rect.new(@f_cw * @battler.battler_face[0], 0, @f_cw, @f_ch)
  246.        self.bitmap.blt(0,0, @f_im, src_rect_back)
  247.        @old_face_index = @battler.battler_face[0]   
  248.    end  
  249.  
  250.   #--------------------------------------------------------------------------
  251.   # ● Update Actor Battler
  252.   #--------------------------------------------------------------------------           
  253.    def update_actor_battler
  254.        return if self.bitmap == nil
  255.        update_face_effect
  256.        update_face_reset_time
  257.        update_face_z
  258.        make_face if @old_face_index != @battler.battler_face[0]              
  259.    end
  260.  
  261.   #--------------------------------------------------------------------------
  262.   # ● Update Face Z
  263.   #--------------------------------------------------------------------------              
  264.   def update_face_z
  265.       self.z = @battler.screen_z + BATTLE_HUD_Z rescue 100
  266.   end  
  267.  
  268.   #--------------------------------------------------------------------------
  269.   # ● Update Face Reset Time
  270.   #--------------------------------------------------------------------------              
  271.    def update_face_reset_time
  272.        return if @battler.battler_face[2] == 0
  273.        @battler.battler_face[2] -= 1
  274.        if @battler.battler_face[2] == 0 or
  275.          (@battler.hp < @low_hp and @battler.battler_face[0] == 0)
  276.           make_face(true)
  277.        end   
  278.    end  
  279.  
  280.   #--------------------------------------------------------------------------
  281.   # ● Update Face Effect
  282.   #--------------------------------------------------------------------------                 
  283.    def update_face_effect
  284.        return if @battler.battler_face[2] == 0
  285.        case @battler.battler_face[1]
  286.           when 0
  287.              face_damage
  288.           when 1..2
  289.              face_heal
  290.           when 3
  291.              face_action
  292.        end
  293.    end  
  294.  
  295.   #--------------------------------------------------------------------------
  296.   # ● Face Damage
  297.   #--------------------------------------------------------------------------                    
  298.    def face_damage
  299.        self.x = (@org_pos[0] - (@battler.battler_face[2] /2)) + rand(@battler.battler_face[2])
  300.    end  
  301.  
  302.   #--------------------------------------------------------------------------
  303.   # ● Face Heal
  304.   #--------------------------------------------------------------------------                    
  305.    def face_heal
  306.        case  @battler.battler_face[2]
  307.          when 20..40
  308.              self.zoom_x += 0.01
  309.              self.zoom_y = self.zoom_x
  310.          when 0..20
  311.              self.zoom_x -= 0.01
  312.              self.zoom_y = self.zoom_x      
  313.        end
  314.    end     
  315.  
  316.   #--------------------------------------------------------------------------
  317.   # ● Face Action
  318.   #--------------------------------------------------------------------------                    
  319.    def face_action
  320.        case  @battler.battler_face[2]
  321.          when 25..50
  322.              self.zoom_x += 0.01
  323.              self.zoom_y = self.zoom_x
  324.              self.mirror = true
  325.          when 0..25
  326.              self.zoom_x -= 0.01
  327.              self.zoom_y = self.zoom_x
  328.              self.mirror = false
  329.        end
  330.        self.zoom_x = self.zoom_x > 1.5 ? self.zoom_x = 1.5 : self.zoom_x < 1 ? 1 : self.zoom_x
  331.        self.zoom_y = self.zoom_y > 1.5 ? self.zoom_y = 1.5 : self.zoom_y < 1 ? 1 : self.zoom_y
  332.    end
  333.  
  334.   #--------------------------------------------------------------------------
  335.   # ● Update Position
  336.   #--------------------------------------------------------------------------                       
  337.    alias mog_battle_hud_update_position update_position
  338.    def update_position
  339.        return if @battle.is_a?(Game_Actor)
  340.        mog_battle_hud_update_position
  341.    end   
  342.  
  343.   #--------------------------------------------------------------------------
  344.   # ● Update Collapse
  345.   #--------------------------------------------------------------------------                          
  346.    alias mog_battle_hud_update_collapse update_collapse
  347.    def update_collapse
  348.        return if @battler.is_a?(Game_Actor)
  349.        mog_battle_hud_update_collapse
  350.    end  
  351.  
  352.   #--------------------------------------------------------------------------
  353.   # ● Update Instant Collapse
  354.   #--------------------------------------------------------------------------                             
  355.    alias mog_battle_hud_update_instant_collapse update_instant_collapse
  356.    def update_instant_collapse
  357.        return if @battler.is_a?(Game_Actor)
  358.        mog_battle_hud_update_instant_collapse
  359.    end  
  360.  
  361. end
  362.  
  363. #==============================================================================
  364. # ■ Battle Manager
  365. #==============================================================================
  366. class << BattleManager
  367.  
  368.   #--------------------------------------------------------------------------
  369.   # ● Battle End
  370.   #--------------------------------------------------------------------------                    
  371.   alias mog_battle_hud_battle_process_victory process_victory
  372.   def process_victory
  373.       execute_face_effect   
  374.       mog_battle_hud_battle_process_victory
  375.   end
  376.  
  377.   #--------------------------------------------------------------------------
  378.   # ● Prepare
  379.   #--------------------------------------------------------------------------                  
  380.   def execute_face_effect
  381.       for i in $game_party.members
  382.           if i.hp > 0
  383.              i.battler_face = [1,2,40]         
  384.           end  
  385.       end  
  386.   end
  387.  
  388. end
  389.  
  390. #==============================================================================
  391. # ■ Game Action
  392. #==============================================================================
  393. class Scene_Battle < Scene_Base
  394.  
  395.   #--------------------------------------------------------------------------
  396.   # ● Show Animations
  397.   #--------------------------------------------------------------------------     
  398.   alias mog_battle_hud_show_animation show_animation
  399.   def show_animation(targets, animation_id)
  400.      # execute_battle_cry(2, @subject.current_action.item.id, @subject)
  401.       make_face_action_battle
  402.       mog_battle_hud_show_animation(targets, animation_id)
  403.   end
  404.  
  405.   #--------------------------------------------------------------------------
  406.   # ● Make Face Action
  407.   #--------------------------------------------------------------------------                  
  408.   def make_face_action_battle
  409.       return if !@subject.is_a?(Game_Actor)
  410.       @subject.battler_face = [2,3,50]
  411.   end   
  412.  
  413. end  
  414.  
  415. #==============================================================================
  416. # ■ Game Battler
  417. #==============================================================================
  418. class Game_Battler < Game_BattlerBase
  419.  
  420.   #--------------------------------------------------------------------------
  421.   # ● Item Apply
  422.   #--------------------------------------------------------------------------               
  423.   alias mog_battle_hud_item_apply item_apply
  424.   def item_apply(user, item)
  425.       old_hp = self.hp
  426.       old_mp = self.mp
  427.       mog_battle_hud_item_apply(user, item)
  428.       check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
  429.   end
  430.  
  431.   #--------------------------------------------------------------------------
  432.   # ● Check Face Effect
  433.   #--------------------------------------------------------------------------  
  434.   def check_face_effect(old_hp,old_mp)
  435.       if self.hp > old_hp or self.mp > old_mp
  436.          self.battler_face = [1,1,40]
  437.       elsif self.hp < old_hp
  438.          self.battler_face = [3,0,40]
  439.       end  
  440.   end  
  441.  
  442.   #--------------------------------------------------------------------------
  443.   # ● Added New State
  444.   #--------------------------------------------------------------------------  
  445.   alias mog_battle_hud_add_new_state add_new_state
  446.   def add_new_state(state_id)
  447.       mog_battle_hud_add_new_state(state_id)
  448.       if self.is_a?(Game_Actor)
  449.          self.battler_face = [1,1,40] if $data_states[state_id].note =~ /<Good State>/
  450.          self.battler_face = [3,0,40] if $data_states[state_id].note =~ /<Bad State>/
  451.       end   
  452.   end   
  453.  
  454.   #--------------------------------------------------------------------------
  455.   # ● Regenerate HP
  456.   #--------------------------------------------------------------------------
  457.   alias mog_battle_hud_regenerate_hp regenerate_hp
  458.   def regenerate_hp
  459.       old_hp = self.hp
  460.       old_mp = self.mp   
  461.       mog_battle_hud_regenerate_hp
  462.       check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
  463.   end
  464.  
  465.   #--------------------------------------------------------------------------
  466.   # ● Regenerate MP
  467.   #--------------------------------------------------------------------------
  468.   alias mog_battle_hud_regenerate_mp regenerate_mp
  469.   def regenerate_mp
  470.       old_hp = self.hp
  471.       old_mp = self.mp   
  472.       mog_battle_hud_regenerate_mp
  473.       check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
  474.   end  
  475.  
  476.   #--------------------------------------------------------------------------
  477.   # ● Can Check Face Effect
  478.   #--------------------------------------------------------------------------                  
  479.   def can_check_face_effect?(old_hp,old_mp)
  480.       return false if self.is_a?(Game_Enemy)
  481.       return true if old_hp != self.hp
  482.       return true if old_mp != self.mp
  483.       return false
  484.   end   
  485.  
  486. end
  487.  
  488. #==============================================================================
  489. # ■ Scene_Battle
  490. #==============================================================================
  491. class Scene_Battle < Scene_Base
  492.  
  493.   #--------------------------------------------------------------------------
  494.   # ● Invoke Counter Attack
  495.   #--------------------------------------------------------------------------        
  496.   alias mog_battle_hud_invoke_counter_attack invoke_counter_attack
  497.   def invoke_counter_attack(target, item)
  498.       mog_battle_hud_invoke_counter_attack(target, item)
  499.       if target.is_a?(Game_Actor) and target.battler_face[0] != 2        
  500.          target.battler_face = [2,3,50]
  501.       end  
  502.   end  
  503.  
  504.   #--------------------------------------------------------------------------
  505.   # ● Invoke Magic Reflection
  506.   #--------------------------------------------------------------------------        
  507.   alias mog_battle_hud_invoke_magic_reflection invoke_magic_reflection
  508.   def invoke_magic_reflection(target, item)
  509.       mog_battle_hud_invoke_magic_reflection(target, item)
  510.       if target.is_a?(Game_Actor) and target.battler_face[0] != 2        
  511.          target.battler_face = [2,3,50]
  512.       end  
  513.   end   
  514.  
  515. end
  516.  
  517. end #BATTLER FACE SYSTEM END --------------------------------------------------
  518.  
  519. #==============================================================================
  520. # ■ Battle_Hud
  521. #==============================================================================
  522. class Battle_Hud
  523.   include MOG_BATTLE_HUD
  524.  
  525.   #--------------------------------------------------------------------------
  526.   # ● Initialize
  527.   #--------------------------------------------------------------------------   
  528.   def initialize(actor)
  529.       dispose
  530.       @actor = actor
  531.       @x = HUD_POSITION[0] + (MEMBERS_SPACE[0] * @actor.index)
  532.       @y = HUD_POSITION[1] + (MEMBERS_SPACE[1] * @actor.index)
  533.       pre_cache
  534.       create_layout
  535.       create_hp_number
  536.       create_hp_meter
  537.       create_mp_number
  538.       create_mp_meter
  539.       create_tp_number
  540.       create_tp_meter
  541.       create_states
  542.   end
  543.  
  544.   #--------------------------------------------------------------------------
  545.   # ● Pre Cache
  546.   #--------------------------------------------------------------------------      
  547.   def pre_cache
  548.       @number = Cache.system("Battle_Hud_Number")
  549.       @number_cw = @number.width / 10
  550.       @number_ch = @number.height / 4
  551.       @meter = Cache.system("Battle_Hud_Meter")
  552.       @meter_cw = @meter.width / 3
  553.       @meter_ch = @meter.height / 3
  554.       @icon = Cache.system("Iconset")
  555.   end
  556.  
  557.   #--------------------------------------------------------------------------
  558.   # ● Create Layout
  559.   #--------------------------------------------------------------------------      
  560.   def create_layout
  561.       @layout = Sprite.new
  562.       @layout.bitmap = Cache.system("Battle_Hud_Layout")
  563.       @layout.z = BATTLE_HUD_Z
  564.       @layout.x = @x
  565.       @layout.y = @y
  566.   end
  567.  
  568.   #--------------------------------------------------------------------------
  569.   # ● Create HP Number
  570.   #--------------------------------------------------------------------------        
  571.   def create_hp_number
  572.       @hp = @actor.hp
  573.       @hp_old = @actor.hp
  574.       @hp_ref = @hp_old
  575.       @hp_refresh = false
  576.       @hp_number = Sprite.new
  577.       @hp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
  578.       @hp_number.z = BATTLE_HUD_Z + 2
  579.       @hp_number.x = @x + HP_NUMBER_POSITION[0]
  580.       @hp_number.y = @y + HP_NUMBER_POSITION[1]
  581.       refresh_hp_number
  582.   end
  583.  
  584.   #--------------------------------------------------------------------------
  585.   # ● Create HP Meter
  586.   #--------------------------------------------------------------------------      
  587.   def create_hp_meter
  588.       @hp_meter = Sprite.new
  589.       @hp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  590.       @hp_meter.z =  BATTLE_HUD_Z + 1
  591.       @hp_meter.x = @x + HP_METER_POSITION[0]
  592.       @hp_meter.y = @y + HP_METER_POSITION[1]
  593.       @hp_flow = rand(@meter_cw * 2)
  594.       @hp_width_old = @meter_cw * @actor.hp / @actor.mhp
  595.       hp_flow_update
  596.   end  
  597.  
  598.   #--------------------------------------------------------------------------
  599.   # ● Hp Flow Update
  600.   #--------------------------------------------------------------------------
  601.   def hp_flow_update
  602.       @hp_meter.bitmap.clear
  603.       hp_width = @meter_cw * @actor.hp / @actor.mhp
  604.       #execute_damage_flow(hp_width)
  605.       hp_src_rect = Rect.new(@hp_flow, 0,hp_width, @meter_ch)
  606.       @hp_meter.bitmap.blt(0,0, @meter, hp_src_rect)
  607.       @hp_flow += METER_FLOW_SPEED
  608.       @hp_flow = 0 if @hp_flow >=  @meter_cw * 2      
  609.   end
  610.  
  611.   #--------------------------------------------------------------------------
  612.   # ● Execute Damage Flow
  613.   #--------------------------------------------------------------------------
  614.   def execute_damage_flow(hp_width)
  615.      n = (@hp_width_old - hp_width).abs * 3 / 100
  616.      damage_flow = [[n, 2].min,0.5].max
  617.      @hp_width_old -= damage_flow         
  618.      @hp_width_old = hp_width if @hp_width_old < hp_width
  619.      src_rect_old = Rect.new(@hp_flow, @meter_ch * 3,@hp_width_old, @meter_ch)
  620.      @hp_meter.bitmap.blt(0,0, @meter, src_rect_old)      
  621.   end  
  622.  
  623.   #--------------------------------------------------------------------------
  624.   # ● Update HP Number
  625.   #--------------------------------------------------------------------------      
  626.   def update_hp_number
  627.       @hp_refresh = true
  628.       n =  2 * (@actor.hp - @hp_old).abs / 100
  629.       hp_ref = [[n, 100].min,1].max
  630.       if @hp_old < @actor.hp
  631.           @hp += hp_ref     
  632.           if @hp >= @actor.hp
  633.              @hp_old = @actor.hp
  634.              @hp = @actor.hp   
  635.              @hp_ref = 0
  636.           end              
  637.         elsif @hp_old > @actor.hp   
  638.            @hp -= hp_ref               
  639.            if @hp <= @actor.hp
  640.               @hp_old = @actor.hp
  641.               @hp = @actor.hp   
  642.               @hp_ref = 0
  643.            end            
  644.         end      
  645.  
  646.   end  
  647.  
  648.   #--------------------------------------------------------------------------
  649.   # ● Refresh HP Number
  650.   #--------------------------------------------------------------------------      
  651.   def refresh_hp_number
  652.       @hp_number.bitmap.clear
  653.       number_value = @hp.abs.to_s.split(//)
  654.       hp_color = @hp < @actor.mhp * 30 / 100 ? @number_ch : 0
  655.       center_x = 0
  656.       for r in 0..number_value.size - 1         
  657.          number_value_abs = number_value[r].to_i
  658.          src_rect = Rect.new(@number_cw * number_value_abs, hp_color, @number_cw, @number_ch)
  659.          @hp_number.bitmap.blt((@number_cw + 1) *  r, 0, @number, src_rect)
  660.          center_x += 1
  661.       end
  662.       @hp_number.x = @x + HP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
  663.       @hp_refresh = false if @hp == @actor.hp      
  664.   end  
  665.  
  666.   #--------------------------------------------------------------------------
  667.   # ● Create MP Number
  668.   #--------------------------------------------------------------------------        
  669.   def create_mp_number
  670.       @mp = @actor.mp
  671.       @mp_old = @actor.mp
  672.       @mp_ref = @mp_old
  673.       @mp_refresh = false
  674.       @mp_number = Sprite.new
  675.       @mp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
  676.       @mp_number.z = BATTLE_HUD_Z + 2
  677.       @mp_number.x = @x + MP_NUMBER_POSITION[0]
  678.       @mp_number.y = @y + MP_NUMBER_POSITION[1]
  679.       refresh_mp_number
  680.   end
  681.  
  682.   #--------------------------------------------------------------------------
  683.   # ● Create MP Meter
  684.   #--------------------------------------------------------------------------      
  685.   def create_mp_meter
  686.       @mp_meter = Sprite.new
  687.       @mp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  688.       @mp_meter.z =  BATTLE_HUD_Z + 1
  689.       @mp_meter.x = @x + MP_METER_POSITION[0]
  690.       @mp_meter.y = @y + MP_METER_POSITION[1]
  691.       @mp_flow = rand(@meter_cw * 2)
  692.       @mp_width_old = @meter_cw * @actor.mp / @actor.mmp rescue 0
  693.       mp_flow_update
  694.   end  
  695.  
  696.   #--------------------------------------------------------------------------
  697.   # ● Mp Flow Update
  698.   #--------------------------------------------------------------------------
  699.   def mp_flow_update
  700.       return if @actor.mmp == 0
  701.       @mp_meter.bitmap.clear
  702.       mp_width = @meter_cw * @actor.mp / @actor.mmp rescue 0
  703.       src_rect = Rect.new(@mp_flow, @meter_ch,mp_width, @meter_ch)
  704.       @mp_meter.bitmap.blt(0,0, @meter, src_rect)
  705.       @mp_flow += METER_FLOW_SPEED
  706.       @mp_flow = 0 if @mp_flow >=  @meter_cw * 2      
  707.     end
  708.  
  709.   #--------------------------------------------------------------------------
  710.   # ● Update MP Number
  711.   #--------------------------------------------------------------------------      
  712.   def update_mp_number
  713.       @mp_refresh = true
  714.       n =  2 * (@actor.mp - @mp_old).abs / 100
  715.       mp_ref = [[n, 100].min,1].max
  716.       if @mp_old < @actor.mp
  717.           @mp += mp_ref     
  718.           if @mp >= @actor.mp
  719.              @mp_old = @actor.mp
  720.              @mp = @actor.mp   
  721.              @mp_ref = 0
  722.           end              
  723.         elsif @mp_old > @actor.mp   
  724.            @mp -= mp_ref               
  725.            if @mp <= @actor.mp
  726.               @mp_old = @actor.mp
  727.               @mp = @actor.mp   
  728.               @mp_ref = 0
  729.            end            
  730.         end         
  731.   end  
  732.  
  733.   #--------------------------------------------------------------------------
  734.   # ● Refresh MP Number
  735.   #--------------------------------------------------------------------------      
  736.   def refresh_mp_number
  737.       @mp_number.bitmap.clear
  738.       number_value = @mp.abs.to_s.split(//)
  739.       center_x = 0
  740.       for r in 0..number_value.size - 1         
  741.          number_value_abs = number_value[r].to_i
  742.          src_rect = Rect.new(@number_cw * number_value_abs, @number_ch * 2, @number_cw, @number_ch)
  743.          @mp_number.bitmap.blt((@number_cw + 1) *  r, 0, @number, src_rect)
  744.          center_x += 1
  745.       end
  746.       @mp_number.x = @x + MP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
  747.       @mp_refresh = false if @mp == @actor.mp      
  748.   end  
  749.  
  750.   #--------------------------------------------------------------------------
  751.   # ● Create TP Number
  752.   #--------------------------------------------------------------------------        
  753.   def create_tp_number
  754.       @tp = @actor.tp
  755.       @tp_old = @actor.tp
  756.       @tp_ref = @tp_old
  757.       @tp_refresh = false
  758.       @tp_number = Sprite.new
  759.       @tp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
  760.       @tp_number.z = BATTLE_HUD_Z + 2
  761.       @tp_number.x = @x + TP_NUMBER_POSITION[0]
  762.       @tp_number.y = @y + TP_NUMBER_POSITION[1]
  763.       refresh_tp_number
  764.   end
  765.  
  766.   #--------------------------------------------------------------------------
  767.   # ● Create TP Meter
  768.   #--------------------------------------------------------------------------      
  769.   def create_tp_meter
  770.       @tp_meter = Sprite.new
  771.       @tp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  772.       @tp_meter.z =  BATTLE_HUD_Z + 1
  773.       @tp_meter.x = @x + TP_METER_POSITION[0]
  774.       @tp_meter.y = @y + TP_METER_POSITION[1]
  775.       @tp_flow = rand(@meter_cw * 2)
  776.       @tp_width_old = @meter_cw * @actor.tp / @actor.max_tp rescue 0
  777.       tp_flow_update
  778.   end  
  779.  
  780.   #--------------------------------------------------------------------------
  781.   # ● TP Flow Update
  782.   #--------------------------------------------------------------------------
  783.   def tp_flow_update
  784.       return if @actor.max_tp == 0
  785.       @tp_meter.bitmap.clear
  786.       tp_width = @meter_cw * @actor.tp / @actor.max_tp rescue 0
  787.       src_rect = Rect.new(@tp_flow, @meter_ch * 2,tp_width, @meter_ch)
  788.       @tp_meter.bitmap.blt(0,0, @meter, src_rect)
  789.       @tp_flow += METER_FLOW_SPEED
  790.       @tp_flow = 0 if @tp_flow >=  @meter_cw * 2      
  791.   end
  792.  
  793.   #--------------------------------------------------------------------------
  794.   # ● Update TP Number
  795.   #--------------------------------------------------------------------------      
  796.   def update_tp_number
  797.       @tp_refresh = true
  798.       n =  2 * (@actor.tp - @tp_old).abs / 100
  799.       tp_ref = [[n, 100].min,1].max
  800.       if @tp_old < @actor.tp
  801.           @tp += tp_ref     
  802.           if @tp >= @actor.tp
  803.              @tp_old = @actor.tp
  804.              @tp = @actor.tp   
  805.              @tp_ref = 0
  806.           end              
  807.         elsif @tp_old > @actor.tp   
  808.            @tp -= tp_ref               
  809.            if @tp <= @actor.tp
  810.               @tp_old = @actor.tp
  811.               @tp = @actor.tp   
  812.               @tp_ref = 0
  813.            end           
  814.          end            
  815.   end      
  816.  
  817.   #--------------------------------------------------------------------------
  818.   # ● Refresh TP Number
  819.   #--------------------------------------------------------------------------      
  820.   def refresh_tp_number
  821.       @tp_number.bitmap.clear
  822.       number_value = @tp.truncate.to_s.split(//)
  823.       center_x = 0
  824.       for r in 0..number_value.size - 1        
  825.          number_value_abs = number_value[r].to_i
  826.          src_rect = Rect.new(@number_cw * number_value_abs, @number_ch * 3, @number_cw, @number_ch)
  827.          @tp_number.bitmap.blt((@number_cw + 1) *  r, 0, @number, src_rect)
  828.          center_x += 1
  829.       end
  830.       @tp_number.x = @x + TP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
  831.       @tp_refresh = false if @tp == @actor.tp
  832.   end   
  833.  
  834.   #--------------------------------------------------------------------------
  835.   # ● Create_States
  836.   #--------------------------------------------------------------------------      
  837.   def create_states
  838.       refresh_states
  839.       @status = Sprite.new
  840.       @status.bitmap = Bitmap.new(24,24)
  841.       @status.x = @x + STATES_POSITION[0]
  842.       @status.y = @y + STATES_POSITION[1]      
  843.       @status_flow = -24
  844.       @states_speed = 50
  845.       @status.z = BATTLE_HUD_Z + 2
  846.       @old_states = @actor.states
  847.       flow_states
  848.   end  
  849.  
  850.   #--------------------------------------------------------------------------
  851.   # ● Flow_Status
  852.   #--------------------------------------------------------------------------         
  853.   def flow_states
  854.       return if @actor.states.size == 0 and !@status.visible
  855.       @states_speed = 0
  856.       @status.bitmap.clear
  857.       src_rect = Rect.new(@status_flow,0, 24,24)
  858.       @status.bitmap.blt(0,0, @actor_status, src_rect)
  859.       @status.visible = @actor.states.size == 0 ? false : true
  860.       @status_flow += 1
  861.       @status_flow = -24 if @status_flow >= @states_size - 24
  862.   end   
  863.  
  864.   #--------------------------------------------------------------------------
  865.   # ● Refresh States
  866.   #--------------------------------------------------------------------------        
  867.   def refresh_states
  868.       refresh_icon if @icon == nil or @icon.disposed?
  869.       @old_states = @actor.states
  870.       if @actor_status != nil
  871.          @actor_status.dispose
  872.          @actor_status = nil
  873.       end
  874.       @states_size = @actor.states.size > 0 ? (48 * @actor.states.size) : 24
  875.       @actor_status = Bitmap.new(@states_size,24)
  876.       index = 0
  877.       for i in  @actor.states
  878.          rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
  879.          @actor_status.blt(48 * index , 0, @icon, rect)
  880.          index += 1
  881.       end
  882.   end  
  883.  
  884.   #--------------------------------------------------------------------------
  885.   # ● Refresh Icon
  886.   #--------------------------------------------------------------------------      
  887.   def refresh_icon      
  888.       if @icon != nil
  889.          if !@icon.disposed?
  890.              @icon.dispose
  891.          end
  892.          @icon = nil
  893.       end  
  894.       @icon = Cache.system("Iconset")
  895.   end
  896.  
  897.   #--------------------------------------------------------------------------
  898.   # ● Dispose
  899.   #--------------------------------------------------------------------------   
  900.   def dispose
  901.       return if @meter == nil
  902.       @meter.dispose
  903.       @meter = nil
  904.       @number.dispose
  905.       if @icon != nil
  906.          if !@icon.disposed?
  907.              @icon.dispose
  908.          end
  909.          @icon = nil
  910.       end     
  911.       @layout.bitmap.dispose
  912.       @layout.dispose
  913.       @hp_number.bitmap.dispose
  914.       @hp_number.dispose
  915.       @hp_meter.bitmap.dispose
  916.       @hp_meter.dispose
  917.       @mp_number.bitmap.dispose
  918.       @mp_number.dispose
  919.       @mp_meter.bitmap.dispose
  920.       @mp_meter.dispose      
  921.       @tp_number.bitmap.dispose
  922.       @tp_number.dispose
  923.       @tp_meter.bitmap.dispose
  924.       @tp_meter.dispose
  925.       @status.bitmap.dispose
  926.       @status.dispose
  927.       if @actor_status != nil
  928.          @actor_status.dispose
  929.          @actor_status = nil
  930.       end        
  931.   end
  932.  
  933.   #--------------------------------------------------------------------------
  934.   # ● Update
  935.   #--------------------------------------------------------------------------   
  936.   def update
  937.       return if @meter == nil
  938.       update_hp_number if @hp_old != @actor.hp
  939.       refresh_hp_number if @hp_refresh
  940.       update_mp_number if @mp_old != @actor.mp
  941.       refresh_mp_number if @mp_refresh
  942.       update_tp_number if @tp_old != @actor.tp
  943.       refresh_tp_number if @tp_refresh
  944.       refresh_states if @old_states != @actor.states
  945.       hp_flow_update
  946.       tp_flow_update
  947.       mp_flow_update
  948.       flow_states
  949.   end
  950.  
  951. end
  952.  
  953. #==============================================================================
  954. # ■ Spriteset Battle
  955. #==============================================================================
  956. class Spriteset_Battle
  957.  
  958.   #--------------------------------------------------------------------------
  959.   # ● Initialize
  960.   #--------------------------------------------------------------------------  
  961.   alias mog_battle_hud_initialize initialize
  962.   def initialize
  963.       mog_battle_hud_initialize
  964.       create_battle_hud      
  965.   end
  966.  
  967.   #--------------------------------------------------------------------------
  968.   # ● Create Battle Hud
  969.   #--------------------------------------------------------------------------   
  970.   def create_battle_hud
  971.       dispose_battle_hud
  972.       @battle_hud = []      
  973.       for i in $game_party.members
  974.           @battle_hud.push(Battle_Hud.new(i))
  975.       end
  976.   end
  977.  
  978.   #--------------------------------------------------------------------------
  979.   # ● Dispose
  980.   #--------------------------------------------------------------------------      
  981.   alias mog_battle_hud_dispose dispose
  982.   def dispose
  983.       mog_battle_hud_dispose
  984.       dispose_battle_hud
  985.   end  
  986.  
  987.   #--------------------------------------------------------------------------
  988.   # ● Dispose Battle Hud
  989.   #--------------------------------------------------------------------------        
  990.   def dispose_battle_hud
  991.       return if @battle_hud == nil
  992.       @battle_hud.each {|sprite| sprite.dispose }
  993.       @battle_hud.clear
  994.       @battle_hud = nil
  995.   end
  996.  
  997.   #--------------------------------------------------------------------------
  998.   # ● Update
  999.   #--------------------------------------------------------------------------        
  1000.   alias mog_battle_hud_update update
  1001.   def update
  1002.       mog_battle_hud_update
  1003.       update_battle_hud
  1004.   end
  1005.  
  1006.   #--------------------------------------------------------------------------
  1007.   # ● Update Battle Hud
  1008.   #--------------------------------------------------------------------------         
  1009.   def update_battle_hud
  1010.       return if @battle_hud == nil
  1011.       @battle_hud.each {|sprite| sprite.update }
  1012.   end
  1013.  
  1014. end
  1015.  
  1016. #==============================================================================
  1017. # ■ Game_Actor
  1018. #==============================================================================
  1019. class Game_Actor < Game_Battler
  1020.   include MOG_BATTLE_HUD
  1021.  
  1022.    attr_accessor :hud_x
  1023.    attr_accessor :hud_y
  1024.  
  1025.   #--------------------------------------------------------------------------
  1026.   # ● HUD X
  1027.   #--------------------------------------------------------------------------     
  1028.   def hud_x
  1029.       return HUD_POSITION[0] + (MEMBERS_SPACE[0] * index)
  1030.   end
  1031.  
  1032.   #--------------------------------------------------------------------------
  1033.   # ● HUD Y
  1034.   #--------------------------------------------------------------------------   
  1035.   def hud_y
  1036.       return HUD_POSITION[1] + (MEMBERS_SPACE[1] * index)
  1037.   end  
  1038.  
  1039. end  
  1040.  
  1041. #==============================================================================
  1042. # ■ Scene Battle
  1043. #==============================================================================
  1044. class Scene_Battle < Scene_Base
  1045.  
  1046.   #--------------------------------------------------------------------------
  1047.   # ● Create Party Command Window
  1048.   #--------------------------------------------------------------------------   
  1049.   alias mog_battle_hud_create_party_command_window create_party_command_window
  1050.   def create_party_command_window
  1051.       mog_battle_hud_create_party_command_window
  1052.       set_party_window_position
  1053.   end  
  1054.  
  1055.   #--------------------------------------------------------------------------
  1056.   # ● Set Party Window Position
  1057.   #--------------------------------------------------------------------------      
  1058.   def set_party_window_position
  1059.       @party_command_window.viewport = nil  
  1060.       return if $mog_rgss3_at_system != nil
  1061.       a_index = []
  1062.       for actor in $game_party.alive_members
  1063.           a_index = [actor.hud_x, actor.hud_y]
  1064.           break
  1065.       end
  1066.       return if a_index.empty?
  1067.       @party_command_window.x = MOG_BATTLE_HUD::COMMAND_POSITION[0] + a_index[0]
  1068.       @party_command_window.y = MOG_BATTLE_HUD::COMMAND_POSITION[1] + a_index[1]      
  1069.   end  
  1070.  
  1071.   #--------------------------------------------------------------------------
  1072.   # ● Set Party Window Position
  1073.   #--------------------------------------------------------------------------        
  1074.   alias mog_battle_hud_start_party_command_selection start_party_command_selection
  1075.   def start_party_command_selection
  1076.       set_party_window_position
  1077.       mog_battle_hud_start_party_command_selection
  1078.   end  
  1079.  
  1080.   #--------------------------------------------------------------------------
  1081.   # ● Update
  1082.   #--------------------------------------------------------------------------  
  1083.   alias mog_battle_hud_update_basic update_basic
  1084.   def update_basic
  1085.       mog_battle_hud_update_basic
  1086.       update_command_window_visible
  1087.   end  
  1088.  
  1089.   #--------------------------------------------------------------------------
  1090.   # ● Update Command Window Visible
  1091.   #--------------------------------------------------------------------------   
  1092.   def update_command_window_visible
  1093.       @status_window.visible = @status_window.active ? true : false
  1094.       @actor_command_window.visible = @actor_command_window.active ? true : false
  1095.       @skill_window.visible = @skill_window.active ? true : false
  1096.       @item_window.visible = @item_window.active ? true : false      
  1097.   end
  1098.  
  1099.   #--------------------------------------------------------------------------
  1100.   # ● Start Actor Command Selection
  1101.   #--------------------------------------------------------------------------   
  1102.   alias mog_battle_hud_start_actor_command_selection start_actor_command_selection
  1103.   def start_actor_command_selection
  1104.       mog_battle_hud_start_actor_command_selection
  1105.       @actor_command_window.viewport = nil
  1106.       @actor_command_window.x = MOG_BATTLE_HUD::COMMAND_POSITION[0] + $game_party.members[BattleManager.actor.index].hud_x
  1107.       @actor_command_window.y = MOG_BATTLE_HUD::COMMAND_POSITION[1] + $game_party.members[BattleManager.actor.index].hud_y
  1108.       @party_command_window.x = @actor_command_window.x
  1109.       @party_command_window.y = @actor_command_window.y  
  1110.   end  
  1111.  
  1112. end
  1113.  
  1114.  
  1115. #==============================================================================
  1116. # ■ Game Temp
  1117. #==============================================================================
  1118. class Game_Temp
  1119.  
  1120.   attr_accessor :battle_cursor
  1121.  
  1122.   #--------------------------------------------------------------------------
  1123.   # ● Initialize
  1124.   #--------------------------------------------------------------------------  
  1125.   alias mog_battle_cursor_initialize initialize
  1126.   def initialize
  1127.       @battle_cursor = [0,0,true,""]
  1128.       mog_battle_cursor_initialize
  1129.   end  
  1130.  
  1131. end
  1132.  
  1133. #==============================================================================
  1134. # ■ Spriteset Battle
  1135. #==============================================================================
  1136. class Spriteset_Battle
  1137.  
  1138.   include MOG_BATTLE_CURSOR
  1139.  
  1140.   #--------------------------------------------------------------------------
  1141.   # ● Initialize
  1142.   #--------------------------------------------------------------------------      
  1143.   alias mog_battle_cursor_initialize initialize
  1144.   def initialize
  1145.       mog_battle_cursor_initialize
  1146.       create_cursor
  1147.   end
  1148.  
  1149.   #--------------------------------------------------------------------------
  1150.   # ● Create_Cursor
  1151.   #--------------------------------------------------------------------------        
  1152.   def create_cursor
  1153.       @cursor = Sprite.new
  1154.       @cursor.bitmap = Cache.system("Battle_Cursor")
  1155.       @cursor.z = 999
  1156.       @cursor.visible = false
  1157.       @cursor_new_x = -64
  1158.       @cursor_new_y = -64
  1159.       @cursor_float_y = 0
  1160.       @cursor_float_duration = 0
  1161.       @c_real_y = 0
  1162.       @cursor_name = Sprite.new
  1163.       @cursor_name.bitmap = Bitmap.new(120,32)
  1164.       @cursor_name.z = @cursor.z + 1
  1165.       @cursor_name.bitmap.font.size = 16
  1166.       refresh_cursor_name
  1167.       update_cursor_name
  1168.       $game_temp.battle_cursor = [@cursor_new_x,@cursor_new_y,false]
  1169.   end  
  1170.  
  1171.   #--------------------------------------------------------------------------
  1172.   # ● Refresh Cursor Name
  1173.   #--------------------------------------------------------------------------              
  1174.   def refresh_cursor_name
  1175.       return if  !(@cursor.x == $game_temp.battle_cursor[0] and
  1176.                    @cursor.y == @c_real_y)
  1177.       @cursor_name_enemy = $game_temp.battle_cursor[3]
  1178.       @cursor_name.bitmap.clear      
  1179.       @cursor_name.bitmap.draw_text(0,0,120,32,@cursor_name_enemy.to_s,1)      
  1180.   end
  1181.  
  1182.   #--------------------------------------------------------------------------
  1183.   # ● Dispose
  1184.   #--------------------------------------------------------------------------      
  1185.   alias mog_battle_cursor_dispose dispose
  1186.   def dispose
  1187.       mog_battle_cursor_dispose
  1188.       dispose_cursor
  1189.   end  
  1190.  
  1191.   #--------------------------------------------------------------------------
  1192.   # ● Dispose Cursor
  1193.   #--------------------------------------------------------------------------        
  1194.   def dispose_cursor   
  1195.       @cursor.bitmap.dispose
  1196.       @cursor.dispose
  1197.       @cursor_name.bitmap.dispose
  1198.       @cursor_name.dispose
  1199.   end
  1200.  
  1201.   #--------------------------------------------------------------------------
  1202.   # ● Update
  1203.   #--------------------------------------------------------------------------         
  1204.   alias mog_battle_cursor_update update
  1205.   def update
  1206.       mog_battle_cursor_update
  1207.       update_battle_cursor
  1208.   end  
  1209.  
  1210.   #--------------------------------------------------------------------------
  1211.   # ● Update Battle Cursor
  1212.   #--------------------------------------------------------------------------            
  1213.   def update_battle_cursor
  1214.       return if @cursor == nil
  1215.       @cursor.visible = $game_temp.battle_cursor[2]
  1216.       update_cursor_name
  1217.       if !@cursor.visible
  1218.          @cursor.x = -64
  1219.          @cursor.y = -64
  1220.          @cursor.opacity = 0
  1221.          update_cursor_name
  1222.          return
  1223.       end        
  1224.       @cursor.opacity += 15
  1225.       update_cursor_float_effect
  1226.       if CURSOR_SLIDE_EFFECT
  1227.          update_cursor_slide_effect
  1228.       else
  1229.          @cursor.x = $game_temp.battle_cursor[0]
  1230.          @cursor.y = $game_temp.battle_cursor[1]
  1231.       end
  1232.   end
  1233.  
  1234.   #--------------------------------------------------------------------------
  1235.   # ● Update Cursor Name
  1236.   #--------------------------------------------------------------------------              
  1237.   def update_cursor_name
  1238.       refresh_cursor_name if @cursor_name_enemy != $game_temp.battle_cursor[3]
  1239.       @cursor_name.x = @cursor.x + CURSOR_NAME_POSITION[0]
  1240.       @cursor_name.y = @cursor.y + CURSOR_NAME_POSITION[1]
  1241.       @cursor_name.opacity = @cursor.opacity
  1242.       @cursor_name.visible = @cursor.visible   
  1243.   end  
  1244.  
  1245.   #--------------------------------------------------------------------------
  1246.   # ● Update Cursor Slide Effect
  1247.   #--------------------------------------------------------------------------               
  1248.   def update_cursor_slide_effect
  1249.       @cursor_new_x = $game_temp.battle_cursor[0]
  1250.       @cursor_new_y = $game_temp.battle_cursor[1]      
  1251.       @cs_x = 5 + ((@cursor.x - @cursor_new_x).abs / 5)
  1252.       @cs_y = 5 + ((@cursor.y - @cursor_new_y).abs / 5)
  1253.       if @cursor.x > @cursor_new_x
  1254.          @cursor.x -= @cs_x
  1255.          @cursor.x = @cursor_new_x if @cursor.x < @cursor_new_x
  1256.       elsif  @cursor.x < @cursor_new_x
  1257.          @cursor.x += @cs_x
  1258.          @cursor.x = @cursor_new_x if @cursor.x > @cursor_new_x
  1259.       end     
  1260.       @c_real_y = @cursor_new_y + @cursor_float_y
  1261.       if @cursor.y > @cursor_new_y
  1262.          @cursor.y -= @cs_y
  1263.          @cursor.y = @c_real_y if @cursor.y < @c_real_y
  1264.       elsif  @cursor.y < @c_real_y
  1265.          @cursor.y += @cs_y
  1266.          @cursor.y = @c_real_y if @cursor.y > @c_real_y
  1267.       end  
  1268.   end
  1269.  
  1270.   #--------------------------------------------------------------------------
  1271.   # ● Update Cursor Float Effect
  1272.   #--------------------------------------------------------------------------              
  1273.   def update_cursor_float_effect
  1274.       return if !CURSOR_FLOAT_EFFECT
  1275.       @cursor_float_duration += 1
  1276.       case @cursor_float_duration
  1277.         when 0..20
  1278.           @cursor_float_y += 1
  1279.         when 21..40
  1280.           @cursor_float_y  -= 1
  1281.         else
  1282.           @cursor_float_y = 0
  1283.           @cursor_float_duration = 0
  1284.       end        
  1285.   end
  1286.  
  1287. end
  1288.  
  1289. #==============================================================================
  1290. # ■ Window BattleStatus
  1291. #==============================================================================
  1292. class Window_BattleStatus < Window_Selectable
  1293.  
  1294.   #--------------------------------------------------------------------------
  1295.   # ● Initialize
  1296.   #--------------------------------------------------------------------------
  1297.   alias mog_battle_hud_initialize initialize
  1298.   def initialize
  1299.       mog_battle_hud_initialize
  1300.       self.visible = false      
  1301.   end
  1302.  
  1303.   #--------------------------------------------------------------------------
  1304.   # ● Refresh
  1305.   #--------------------------------------------------------------------------         
  1306.   alias mog_battle_hud_refresh refresh
  1307.   def refresh
  1308.       return
  1309.       mog_battle_hud_refresh      
  1310.   end  
  1311.  
  1312. end
  1313.  
  1314. #==============================================================================
  1315. # ■ Scene Battle
  1316. #==============================================================================
  1317. class Scene_Battle < Scene_Base
  1318.  
  1319.   #--------------------------------------------------------------------------
  1320.   # ● Create Enemy Window
  1321.   #--------------------------------------------------------------------------              
  1322.   def create_enemy_window
  1323.       @enemy_window = Window_BattleEnemy_Cursor.new
  1324.       @enemy_window.set_handler(:ok,     method(:on_enemy_ok))
  1325.       @enemy_window.set_handler(:cancel, method(:on_enemy_cancel))
  1326.   end
  1327.  
  1328.   #--------------------------------------------------------------------------
  1329.   # ● Create Actor Window
  1330.   #--------------------------------------------------------------------------               
  1331.   def create_actor_window
  1332.       @actor_window = Window_BattleActor_Cursor.new
  1333.       @actor_window.set_handler(:ok,     method(:on_actor_ok))
  1334.       @actor_window.set_handler(:cancel, method(:on_actor_cancel))
  1335.   end  
  1336.  
  1337. end
  1338.  
  1339. #==============================================================================
  1340. # ■ Window Selectable Battle_Cursor
  1341. #==============================================================================
  1342. class Window_Selectable_Battle_Cursor < Window_Base
  1343.  
  1344.   attr_reader   :index
  1345.  
  1346.   #--------------------------------------------------------------------------
  1347.   # ● Initialize
  1348.   #-------------------------------------------------------------------------
  1349.   def initialize(x, y, width, height)
  1350.       super
  1351.       @index = -1
  1352.       @handler = {}
  1353.       deactivate
  1354.   end
  1355.  
  1356.   #--------------------------------------------------------------------------
  1357.   # ● Item Max
  1358.   #--------------------------------------------------------------------------
  1359.   def item_max
  1360.     return 0
  1361.   end
  1362.  
  1363.   #--------------------------------------------------------------------------
  1364.   # ● Active
  1365.   #--------------------------------------------------------------------------
  1366.   def active=(active)
  1367.       super
  1368.   end
  1369.  
  1370.   #--------------------------------------------------------------------------
  1371.   # ● Index
  1372.   #--------------------------------------------------------------------------
  1373.   def index=(index)
  1374.       @index = index
  1375.   end
  1376.  
  1377.   #--------------------------------------------------------------------------
  1378.   # ● Set Handler
  1379.   #--------------------------------------------------------------------------
  1380.   def set_handler(symbol, method)
  1381.       @handler[symbol] = method
  1382.   end
  1383.  
  1384.   #--------------------------------------------------------------------------
  1385.   # ● Handle?
  1386.   #--------------------------------------------------------------------------
  1387.   def handle?(symbol)
  1388.       @handler.include?(symbol)
  1389.   end
  1390.  
  1391.   #--------------------------------------------------------------------------
  1392.   # ● Call Handler
  1393.   #--------------------------------------------------------------------------
  1394.   def call_handler(symbol)
  1395.       @handler[symbol].call if handle?(symbol)
  1396.   end
  1397.  
  1398.   #--------------------------------------------------------------------------
  1399.   # ● Cursor Movable
  1400.   #--------------------------------------------------------------------------
  1401.   def cursor_movable?
  1402.       active && open? && !@cursor_fix && !@cursor_all && item_max > 0
  1403.   end  
  1404.  
  1405.   #--------------------------------------------------------------------------
  1406.   # ● Cursor Down
  1407.   #--------------------------------------------------------------------------  
  1408.   def cursor_down(wrap = false)
  1409.       self.index += 1
  1410.       check_index_limit
  1411.   end
  1412.  
  1413.   #--------------------------------------------------------------------------
  1414.   # ● Cursor Right
  1415.   #--------------------------------------------------------------------------
  1416.   def cursor_right(wrap = false)
  1417.       self.index += 1
  1418.       check_index_limit
  1419.   end  
  1420.  
  1421.   #--------------------------------------------------------------------------
  1422.   # ● Cursor UP
  1423.   #--------------------------------------------------------------------------
  1424.   def cursor_up(wrap = false)
  1425.       self.index -= 1
  1426.       check_index_limit
  1427.   end  
  1428.  
  1429.   #--------------------------------------------------------------------------
  1430.   # ● Cursor Left
  1431.   #--------------------------------------------------------------------------
  1432.   def cursor_left(wrap = false)
  1433.       self.index -= 1
  1434.       check_index_limit(self.index)
  1435.   end
  1436.  
  1437.   #--------------------------------------------------------------------------
  1438.   # ● Update
  1439.   #--------------------------------------------------------------------------
  1440.   def update
  1441.       super
  1442.       process_cursor_move
  1443.       process_handling
  1444.   end
  1445.  
  1446.   #--------------------------------------------------------------------------
  1447.   # ● Process Cursor Move
  1448.   #--------------------------------------------------------------------------
  1449.   def process_cursor_move
  1450.       return unless cursor_movable?
  1451.       last_index = @index
  1452.       cursor_down (Input.trigger?(:DOWN))  if Input.repeat?(:DOWN)
  1453.       cursor_up   (Input.trigger?(:UP))    if Input.repeat?(:UP)
  1454.       cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
  1455.       cursor_left (Input.trigger?(:LEFT))  if Input.repeat?(:LEFT)
  1456.       if @index != last_index
  1457.          Sound.play_cursor
  1458.          set_cursor_position(@index)
  1459.       end   
  1460.   end
  1461.  
  1462.   #--------------------------------------------------------------------------
  1463.   # ● Process Handling
  1464.   #--------------------------------------------------------------------------
  1465.   def process_handling
  1466.       return unless open? && active
  1467.       return process_ok       if ok_enabled?        && Input.trigger?(:C)
  1468.       return process_cancel   if cancel_enabled?    && Input.trigger?(:B)
  1469.   end
  1470.  
  1471.   #--------------------------------------------------------------------------
  1472.   # ● OK Enabled
  1473.   #--------------------------------------------------------------------------
  1474.   def ok_enabled?
  1475.       handle?(:ok)
  1476.   end
  1477.  
  1478.   #--------------------------------------------------------------------------
  1479.   # ● Cancel Enabled
  1480.   #--------------------------------------------------------------------------
  1481.   def cancel_enabled?
  1482.       handle?(:cancel)
  1483.   end
  1484.  
  1485.   #--------------------------------------------------------------------------
  1486.   # ● Process OK
  1487.   #--------------------------------------------------------------------------
  1488.   def process_ok
  1489.       if current_item_enabled?
  1490.          Sound.play_ok
  1491.          Input.update
  1492.          deactivate
  1493.          call_ok_handler
  1494.       else
  1495.          Sound.play_buzzer
  1496.       end
  1497.   end
  1498.  
  1499.   #--------------------------------------------------------------------------
  1500.   # ● Call OK Handler
  1501.   #--------------------------------------------------------------------------
  1502.   def call_ok_handler
  1503.       call_handler(:ok)
  1504.   end
  1505.  
  1506.   #--------------------------------------------------------------------------
  1507.   # ● Process Cancel
  1508.   #--------------------------------------------------------------------------
  1509.   def process_cancel
  1510.       Sound.play_cancel
  1511.       Input.update
  1512.       deactivate
  1513.       call_cancel_handler
  1514.   end
  1515.  
  1516.   #--------------------------------------------------------------------------
  1517.   # ● Call Cancel Handler
  1518.   #--------------------------------------------------------------------------
  1519.   def call_cancel_handler
  1520.       call_handler(:cancel)
  1521.   end
  1522.  
  1523.   #--------------------------------------------------------------------------
  1524.   # ● Set Cursor Position
  1525.   #--------------------------------------------------------------------------   
  1526.   def set_cursor_position(index)   
  1527.   end  
  1528.  
  1529.   #--------------------------------------------------------------------------
  1530.   # ● Current Item Enabled?
  1531.   #--------------------------------------------------------------------------
  1532.   def current_item_enabled?
  1533.       return true
  1534.   end
  1535.  
  1536.   #--------------------------------------------------------------------------
  1537.   # ● Refresh
  1538.   #--------------------------------------------------------------------------
  1539.   def refresh
  1540.       contents.clear
  1541.   end
  1542.  
  1543.   #--------------------------------------------------------------------------
  1544.   # ● Show
  1545.   #--------------------------------------------------------------------------
  1546.   def show
  1547.       set_cursor_position(self.index)
  1548.       $game_temp.battle_cursor[2] = true
  1549.       super
  1550.   end
  1551.  
  1552.   #--------------------------------------------------------------------------
  1553.   # ● Hide
  1554.   #--------------------------------------------------------------------------
  1555.   def hide
  1556.       $game_temp.battle_cursor[2] = false
  1557.       super
  1558.   end  
  1559.  
  1560.   #--------------------------------------------------------------------------
  1561.   # ● Check Index Limit
  1562.   #--------------------------------------------------------------------------      
  1563.   def check_index_limit(index = self.index)
  1564.       self.index = index
  1565.       self.index = 0 if self.index >= item_max
  1566.       self.index = (item_max - 1) if self.index < 0
  1567.   end      
  1568.  
  1569. end
  1570.  
  1571. #==============================================================================
  1572. # ■ Window_BattleEnemy
  1573. #==============================================================================
  1574. class Window_BattleEnemy_Cursor < Window_Selectable_Battle_Cursor
  1575.  
  1576.   include MOG_BATTLE_CURSOR
  1577.  
  1578.   #--------------------------------------------------------------------------
  1579.   # ● Initialize
  1580.   #--------------------------------------------------------------------------
  1581.   def initialize
  1582.       super(-32, -32, 32, 32)
  1583.       self.index = 0
  1584.       self.visible = false
  1585.       set_cursor_position(self.index)
  1586.   end  
  1587.  
  1588.   #--------------------------------------------------------------------------
  1589.   # ● Item Max
  1590.   #--------------------------------------------------------------------------
  1591.   def item_max
  1592.       $game_troop.alive_members.size
  1593.   end
  1594.  
  1595.   #--------------------------------------------------------------------------
  1596.   # ● Enemy
  1597.   #--------------------------------------------------------------------------  
  1598.   def enemy
  1599.       $game_troop.alive_members[self.index]
  1600.   end  
  1601.  
  1602.   #--------------------------------------------------------------------------
  1603.   # ● Set Cursor Position
  1604.   #--------------------------------------------------------------------------   
  1605.   def set_cursor_position(index)
  1606.       check_index_limit(index)
  1607.       return if $game_troop.alive_members[self.index] == nil
  1608.       $game_temp.battle_cursor[0] = $game_troop.alive_members[self.index].screen_x + CURSOR_POSITION[0]
  1609.       $game_temp.battle_cursor[1] = $game_troop.alive_members[self.index].screen_y + CURSOR_POSITION[1]
  1610.       $game_temp.battle_cursor[3] = $game_troop.alive_members[self.index].name
  1611.   end
  1612.  
  1613. end
  1614.  
  1615. #==============================================================================
  1616. # ■ Window_BattleActor Cursor
  1617. #==============================================================================
  1618. class Window_BattleActor_Cursor < Window_Selectable_Battle_Cursor
  1619.  
  1620.   include MOG_BATTLE_CURSOR
  1621.   include MOG_BATTLE_HUD
  1622.   #--------------------------------------------------------------------------
  1623.   # ● Initialize
  1624.   #--------------------------------------------------------------------------
  1625.   def initialize
  1626.       super(-32, -32, 32, 32)
  1627.       self.index = 0
  1628.       self.visible = true
  1629.       set_cursor_position(self.index)
  1630.   end  
  1631.  
  1632.   #--------------------------------------------------------------------------
  1633.   # ● Item Max
  1634.   #--------------------------------------------------------------------------
  1635.   def item_max
  1636.       $game_party.members.size
  1637.   end
  1638.  
  1639.   #--------------------------------------------------------------------------
  1640.   # ● Set Cursor Position
  1641.   #--------------------------------------------------------------------------   
  1642.   def set_cursor_position(index)
  1643.       check_index_limit(index)
  1644.       return if $game_party.members[self.index] == nil
  1645.       screen_x = $game_party.members[self.index].screen_x rescue nil
  1646.       screen_y = $game_party.members[self.index].screen_y rescue nil
  1647.       if screen_x == nil or screen_y == nil
  1648.          screen_x = $game_party.members[self.index].hud_x + (HP_NUMBER_POSITION[0] / 3) + 32
  1649.          screen_y = $game_party.members[self.index].hud_y + (HP_NUMBER_POSITION[1] / 2) + 32
  1650.       end  
  1651.       $game_temp.battle_cursor[0] = screen_x + CURSOR_POSITION[0]
  1652.       $game_temp.battle_cursor[1] = screen_y + CURSOR_POSITION[1]
  1653.       $game_temp.battle_cursor[3] = $game_party.members[self.index].name
  1654.   end
  1655.  
  1656. end
  1657.  
  1658. $mog_rgss3_battle_hud = true

Scripts.zip

216.39 KB, 下载次数: 43

脚本数据

Lv1.梦旅人

梦石
0
星屑
50
在线时间
82 小时
注册时间
2013-3-17
帖子
63
2
发表于 2013-7-18 13:45:57 | 只看该作者
把两个脚本的顺序换一下

点评

不行,Spriteset_Battle的212行出错  发表于 2013-7-18 14:04
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
293
在线时间
398 小时
注册时间
2011-5-20
帖子
128
3
 楼主| 发表于 2013-7-19 10:48:51 | 只看该作者
脚本补上了,知道怎么回事的来看下
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-18 08:14

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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