查看: 1236|回复: 2

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

[复制链接]
梦石
0
星屑
293
在线时间
398 小时
注册时间
2011-5-20
回帖
94
发表于 2013-7-18 10:26:52 | 显示全部楼层 |阅读模式

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  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. # ● Histórico (Version History)
  11. #==============================================================================
  12. # v 1.6 - Corrigido o erro quando o MP ou TP maximo é iguál a zero.
  13. # v 1.5 - Corrigido a animação da face quando uma skill tem a função charge.
  14. # v 1.4 - Corrigido o erro de crash randômico. (relativo a dispose de imagem.)
  15. # v 1.3 - Script 100% independente do sistema de AT System.
  16. #       - Correção da posição inicial da janela de Fuga.
  17. #       - Correção da posição do cursor nos aliados quando a face está
  18. #         desabilitada.
  19. # v 1.2 - Corrigido a prioridade das condições.
  20. # v 1.1 - Corrigido o glitch inicial da prioridade da face.
  21. # v 1.0 - Primeiro lançamento.
  22. #==============================================================================

  23. #==============================================================================
  24. # ■ - FACE ANIMADAS DOS PERSONAGENS - (Opcional)
  25. #==============================================================================
  26. # 1 - Grave as imagens das faces dos personagens na pasta.
  27. #
  28. # GRAPHICS/BATTLERS/
  29. #
  30. # 2 - Nomeie a imagem com o mesmo nome do personagem. (EG - Hertor.png)
  31. # 3 - A largura da imagem deverá ser dividido por 5. (A escolha do tamanho
  32. #     da face é livre desde que a lagura dividido pela altura seja igual a 5 )
  33. #
  34. #==============================================================================

  35. #==============================================================================
  36. # ■ BATTLE HUD SETTING
  37. #==============================================================================
  38. module MOG_BATTLE_HUD
  39.   # Ativar Battlers dos personagens em faces, deixe desativado em caso de haver
  40.   # outros scripts que usam battlers dos personagens em seu projeto.
  41.   BATTLER_FACE_ENABLE = true
  42.   #Definição geral da posição da HUD.
  43.   HUD_POSITION = [5,315]
  44.   #Definição da posição da face
  45.   FACE_POSITION = [60,30]
  46.   #Definição da posição do numero de HP.
  47.   HP_NUMBER_POSITION = [85,28]
  48.   #Definição da posição do medidor de HP.
  49.   HP_METER_POSITION = [27,37]
  50.   #Definição da posição do numero de MP.
  51.   MP_NUMBER_POSITION = [101,46]
  52.   #Definição da posição do medidor de MP.
  53.   MP_METER_POSITION = [43,55]  
  54.   #Definição da posição do numero de TP.
  55.   TP_NUMBER_POSITION = [85,64]
  56.   #Definição da posição do medidor de TP.
  57.   TP_METER_POSITION = [27,73]   
  58.   #Definição da posição das condições
  59.   STATES_POSITION = [5,1]
  60.   #Definição da posição do comando de batalha.
  61.   COMMAND_POSITION = [0,-145]  
  62.   #Definição da posição do espaço da HUD entre os membros do grupo.
  63.   MEMBERS_SPACE = [136,0]
  64.   #Definição da prioridade da HUD.
  65.   BATTLE_HUD_Z = 50
  66.   #Definição da velocidade de animação dos medidores.
  67.   METER_FLOW_SPEED = 2
  68.   #Ativa o layout mais limpo nas janelas de item e skill.
  69.   ITEM_SKILL_WINDOWS_CLEAN_STYLE = true
  70.   #Definição da opacidade das janelas.
  71.   ITEM_SKILL_WINDOW_OPACITY = 0
  72. end

  73. #==============================================================================
  74. # ■ CURSOR SETTING
  75. #==============================================================================
  76. module MOG_BATTLE_CURSOR
  77.   #Definição da posição do cursor em relação ao alvo.
  78.   CURSOR_POSITION = [-45, -16]
  79.   #Definição da posição do nome do alvo.
  80.   CURSOR_NAME_POSITION = [-10, 35]
  81.   #Ativar efeito deslizar.
  82.   CURSOR_SLIDE_EFFECT = true
  83.   #Ativar animação de levitação.
  84.   CURSOR_FLOAT_EFFECT = true  
  85. end  


  86. if MOG_BATTLE_HUD::BATTLER_FACE_ENABLE #BATTLER_FACE SYSTEM START
  87. #==============================================================================
  88. # ■ Game_Actor
  89. #==============================================================================
  90. class Game_Actor < Game_Battler
  91.   
  92.   attr_accessor :battler_face
  93.   attr_accessor :screen_x
  94.   attr_accessor :screen_y   
  95.   
  96.   #--------------------------------------------------------------------------
  97.   # ● Initialize
  98.   #--------------------------------------------------------------------------
  99.   alias mog_battle_hud_initialize setup
  100.   def setup(actor_id)
  101.       mog_battle_hud_initialize(actor_id)
  102.       battler_sprite_setup   
  103.   end  
  104.   
  105.   #--------------------------------------------------------------------------
  106.   # ● Battler Sprite Setup
  107.   #--------------------------------------------------------------------------  
  108.   def battler_sprite_setup
  109.       @battler_face = [0,0,0]
  110.       @battler_name = @name
  111.       @screen_x = 0
  112.       @screen_y = 0
  113.   end
  114.   
  115.   #--------------------------------------------------------------------------
  116.   # ● Use Sprite?
  117.   #--------------------------------------------------------------------------
  118.   def use_sprite?
  119.       return true
  120.   end
  121.   
  122.   #--------------------------------------------------------------------------
  123.   # ● Screen Z
  124.   #--------------------------------------------------------------------------
  125.   def screen_z
  126.       return MOG_BATTLE_HUD::BATTLE_HUD_Z + 4
  127.   end  

  128.   #------------------------------------------------------------------------
  129.   # ● Screen X
  130.   #------------------------------------------------------------------------        
  131.   def screen_x
  132.       return FACE_POSITION[0] + HUD_POSITION[0] + (MEMBERS_SPACE[0] * index)
  133.   end  
  134.       
  135.   #------------------------------------------------------------------------
  136.   # ● Screen Y
  137.   #------------------------------------------------------------------------      
  138.   def screen_y
  139.       return FACE_POSITION[1] + HUD_POSITION[1] + (MEMBERS_SPACE[1] * index)
  140.   end     
  141.   
  142. end

  143. #==============================================================================
  144. # ■ Sprite_Battler
  145. #==============================================================================
  146. class Sprite_Battler < Sprite_Base
  147.   include MOG_BATTLE_HUD
  148.   
  149.   #--------------------------------------------------------------------------
  150.   # ● Initialize
  151.   #--------------------------------------------------------------------------  
  152.    alias mog_battle_hud_initialize initialize
  153.    def initialize(viewport, battler = nil)
  154.        battle_hud_setup
  155.        mog_battle_hud_initialize(viewport, battler)
  156.    end

  157.   #--------------------------------------------------------------------------
  158.   # ● Battle Hud Setup
  159.   #--------------------------------------------------------------------------     
  160.    def battle_hud_setup
  161.        @old_face_index = 0
  162.    end

  163.   #--------------------------------------------------------------------------
  164.   # ● Dispose
  165.   #--------------------------------------------------------------------------        
  166.    alias mog_battle_hud_dispose dispose
  167.    def dispose
  168.        mog_battle_hud_dispose
  169.        if @f_im != nil
  170.           @f_im.dispose
  171.        end
  172.    end
  173.    
  174.   #--------------------------------------------------------------------------
  175.   # ● Update Bitmap
  176.   #--------------------------------------------------------------------------        
  177.    alias mog_battle_hud_update_bitmap update_bitmap
  178.    def update_bitmap
  179.        if @battler.is_a?(Game_Actor)
  180.           create_actor_battler
  181.           update_actor_battler
  182.           return
  183.        end
  184.        mog_battle_hud_update_bitmap
  185.    end  
  186.    
  187.   #--------------------------------------------------------------------------
  188.   # ● Create Actor Battler
  189.   #--------------------------------------------------------------------------               
  190.    def create_actor_battler  
  191.        return if self.bitmap != nil
  192.        @f_im = Cache.battler(@battler.battler_name, 0)
  193.        @f_cw = @f_im.width / 5
  194.        @f_ch = @f_im.height
  195.        self.bitmap = Bitmap.new(@f_cw,@f_ch)
  196.        x = FACE_POSITION[0] + HUD_POSITION[0] + (MEMBERS_SPACE[0] * @battler.index)
  197.        y = FACE_POSITION[1] + HUD_POSITION[1] + (MEMBERS_SPACE[1] * @battler.index)
  198.        @org_pos = [x,y]
  199.        @battler.battler_face = [0,0,0]
  200.        @battler_visible = true
  201.        @low_hp = @battler.mhp * 30 / 100
  202.        self.z = @battler.screen_z + 100
  203.        make_face(true)
  204.    end
  205.    
  206.   #--------------------------------------------------------------------------
  207.   # ● Face Base Setting
  208.   #--------------------------------------------------------------------------                 
  209.   def face_base_setting
  210.       self.x = @org_pos[0]
  211.       self.y = @org_pos[1]
  212.       self.z = @battler.screen_z
  213.       self.zoom_x = 1
  214.       self.zoom_y = 1
  215.       self.mirror = false   
  216.   end
  217.   
  218.   #--------------------------------------------------------------------------
  219.   # ● Check Base Face
  220.   #--------------------------------------------------------------------------              
  221.    def check_base_face(reset)
  222.        face_base_setting
  223.        return if @battler.battler_face[2] > 0
  224.        @battler.battler_face = [0,0,0] if reset and @battler.battler_face[1] != 2  
  225.        @battler.battler_face[0] = 3 if @battler.hp < @low_hp
  226.        @battler.battler_face[0] = 4 if @battler.hp == 0
  227.    end  
  228.    
  229.   #--------------------------------------------------------------------------
  230.   # ● Make Face
  231.   #--------------------------------------------------------------------------              
  232.    def make_face(reset = false)
  233.        self.bitmap.clear
  234.        check_base_face(reset)
  235.        src_rect_back = Rect.new(@f_cw * @battler.battler_face[0], 0, @f_cw, @f_ch)
  236.        self.bitmap.blt(0,0, @f_im, src_rect_back)
  237.        @old_face_index = @battler.battler_face[0]   
  238.    end  

  239.   #--------------------------------------------------------------------------
  240.   # ● Update Actor Battler
  241.   #--------------------------------------------------------------------------           
  242.    def update_actor_battler
  243.        return if self.bitmap == nil
  244.        update_face_effect
  245.        update_face_reset_time
  246.        update_face_z
  247.        make_face if @old_face_index != @battler.battler_face[0]              
  248.    end
  249.      
  250.   #--------------------------------------------------------------------------
  251.   # ● Update Face Z
  252.   #--------------------------------------------------------------------------              
  253.   def update_face_z
  254.       self.z = @battler.screen_z + BATTLE_HUD_Z rescue 100
  255.   end  
  256.   
  257.   #--------------------------------------------------------------------------
  258.   # ● Update Face Reset Time
  259.   #--------------------------------------------------------------------------              
  260.    def update_face_reset_time
  261.        return if @battler.battler_face[2] == 0
  262.        @battler.battler_face[2] -= 1
  263.        if @battler.battler_face[2] == 0 or
  264.          (@battler.hp < @low_hp and @battler.battler_face[0] == 0)
  265.           make_face(true)
  266.        end   
  267.    end  
  268.    
  269.   #--------------------------------------------------------------------------
  270.   # ● Update Face Effect
  271.   #--------------------------------------------------------------------------                 
  272.    def update_face_effect
  273.        return if @battler.battler_face[2] == 0
  274.        case @battler.battler_face[1]
  275.           when 0
  276.              face_damage
  277.           when 1..2
  278.              face_heal
  279.           when 3
  280.              face_action
  281.        end
  282.    end  
  283.    
  284.   #--------------------------------------------------------------------------
  285.   # ● Face Damage
  286.   #--------------------------------------------------------------------------                    
  287.    def face_damage
  288.        self.x = (@org_pos[0] - (@battler.battler_face[2] /2)) + rand(@battler.battler_face[2])
  289.    end  
  290.    
  291.   #--------------------------------------------------------------------------
  292.   # ● Face Heal
  293.   #--------------------------------------------------------------------------                    
  294.    def face_heal
  295.        case  @battler.battler_face[2]
  296.          when 20..40
  297.              self.zoom_x += 0.01
  298.              self.zoom_y = self.zoom_x
  299.          when 0..20
  300.              self.zoom_x -= 0.01
  301.              self.zoom_y = self.zoom_x      
  302.        end
  303.    end     
  304.    
  305.   #--------------------------------------------------------------------------
  306.   # ● Face Action
  307.   #--------------------------------------------------------------------------                    
  308.    def face_action
  309.        case  @battler.battler_face[2]
  310.          when 25..50
  311.              self.zoom_x += 0.01
  312.              self.zoom_y = self.zoom_x
  313.              self.mirror = true
  314.          when 0..25
  315.              self.zoom_x -= 0.01
  316.              self.zoom_y = self.zoom_x
  317.              self.mirror = false
  318.        end
  319.        self.zoom_x = self.zoom_x > 1.5 ? self.zoom_x = 1.5 : self.zoom_x < 1 ? 1 : self.zoom_x
  320.        self.zoom_y = self.zoom_y > 1.5 ? self.zoom_y = 1.5 : self.zoom_y < 1 ? 1 : self.zoom_y
  321.    end
  322.    
  323.   #--------------------------------------------------------------------------
  324.   # ● Update Position
  325.   #--------------------------------------------------------------------------                       
  326.    alias mog_battle_hud_update_position update_position
  327.    def update_position
  328.        return if @battle.is_a?(Game_Actor)
  329.        mog_battle_hud_update_position
  330.    end   
  331.    
  332.   #--------------------------------------------------------------------------
  333.   # ● Update Collapse
  334.   #--------------------------------------------------------------------------                          
  335.    alias mog_battle_hud_update_collapse update_collapse
  336.    def update_collapse
  337.        return if @battler.is_a?(Game_Actor)
  338.        mog_battle_hud_update_collapse
  339.    end  
  340.    
  341.   #--------------------------------------------------------------------------
  342.   # ● Update Instant Collapse
  343.   #--------------------------------------------------------------------------                             
  344.    alias mog_battle_hud_update_instant_collapse update_instant_collapse
  345.    def update_instant_collapse
  346.        return if @battler.is_a?(Game_Actor)
  347.        mog_battle_hud_update_instant_collapse
  348.    end  
  349.    
  350. end

  351. #==============================================================================
  352. # ■ Battle Manager
  353. #==============================================================================
  354. class << BattleManager
  355.   
  356.   #--------------------------------------------------------------------------
  357.   # ● Battle End
  358.   #--------------------------------------------------------------------------                    
  359.   alias mog_battle_hud_battle_process_victory process_victory
  360.   def process_victory
  361.       execute_face_effect   
  362.       mog_battle_hud_battle_process_victory
  363.   end
  364.   
  365.   #--------------------------------------------------------------------------
  366.   # ● Prepare
  367.   #--------------------------------------------------------------------------                  
  368.   def execute_face_effect
  369.       for i in $game_party.members
  370.           if i.hp > 0
  371.              i.battler_face = [1,2,40]         
  372.           end  
  373.       end  
  374.   end
  375.   
  376. end

  377. #==============================================================================
  378. # ■ Game Action
  379. #==============================================================================
  380. class Scene_Battle < Scene_Base
  381.   
  382.   #--------------------------------------------------------------------------
  383.   # ● Show Animations
  384.   #--------------------------------------------------------------------------     
  385.   alias mog_battle_hud_show_animation show_animation
  386.   def show_animation(targets, animation_id)
  387.      # execute_battle_cry(2, @subject.current_action.item.id, @subject)
  388.       make_face_action_battle
  389.       mog_battle_hud_show_animation(targets, animation_id)
  390.   end
  391.   
  392.   #--------------------------------------------------------------------------
  393.   # ● Make Face Action
  394.   #--------------------------------------------------------------------------                  
  395.   def make_face_action_battle
  396.       return if !@subject.is_a?(Game_Actor)
  397.       @subject.battler_face = [2,3,50]
  398.   end   
  399.   
  400. end  

  401. #==============================================================================
  402. # ■ Game Battler
  403. #==============================================================================
  404. class Game_Battler < Game_BattlerBase
  405.   
  406.   #--------------------------------------------------------------------------
  407.   # ● Item Apply
  408.   #--------------------------------------------------------------------------               
  409.   alias mog_battle_hud_item_apply item_apply
  410.   def item_apply(user, item)
  411.       old_hp = self.hp
  412.       old_mp = self.mp
  413.       mog_battle_hud_item_apply(user, item)
  414.       check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
  415.   end
  416.   
  417.   #--------------------------------------------------------------------------
  418.   # ● Check Face Effect
  419.   #--------------------------------------------------------------------------  
  420.   def check_face_effect(old_hp,old_mp)
  421.       if self.hp > old_hp or self.mp > old_mp
  422.          self.battler_face = [1,1,40]
  423.       elsif self.hp < old_hp
  424.          self.battler_face = [3,0,40]
  425.       end  
  426.   end  
  427.   
  428.   #--------------------------------------------------------------------------
  429.   # ● Added New State
  430.   #--------------------------------------------------------------------------  
  431.   alias mog_battle_hud_add_new_state add_new_state
  432.   def add_new_state(state_id)
  433.       mog_battle_hud_add_new_state(state_id)
  434.       if self.is_a?(Game_Actor)
  435.          self.battler_face = [1,1,40] if $data_states[state_id].note =~ /<Good State>/
  436.          self.battler_face = [3,0,40] if $data_states[state_id].note =~ /<Bad State>/
  437.       end   
  438.   end   
  439.   
  440.   #--------------------------------------------------------------------------
  441.   # ● Regenerate HP
  442.   #--------------------------------------------------------------------------
  443.   alias mog_battle_hud_regenerate_hp regenerate_hp
  444.   def regenerate_hp
  445.       old_hp = self.hp
  446.       old_mp = self.mp   
  447.       mog_battle_hud_regenerate_hp
  448.       check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
  449.   end

  450.   #--------------------------------------------------------------------------
  451.   # ● Regenerate MP
  452.   #--------------------------------------------------------------------------
  453.   alias mog_battle_hud_regenerate_mp regenerate_mp
  454.   def regenerate_mp
  455.       old_hp = self.hp
  456.       old_mp = self.mp   
  457.       mog_battle_hud_regenerate_mp
  458.       check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
  459.   end  

  460.   #--------------------------------------------------------------------------
  461.   # ● Can Check Face Effect
  462.   #--------------------------------------------------------------------------                  
  463.   def can_check_face_effect?(old_hp,old_mp)
  464.       return false if self.is_a?(Game_Enemy)
  465.       return true if old_hp != self.hp
  466.       return true if old_mp != self.mp
  467.       return false
  468.   end   
  469.   
  470. end

  471. #==============================================================================
  472. # ■ Scene_Battle
  473. #==============================================================================
  474. class Scene_Battle < Scene_Base
  475.   
  476.   #--------------------------------------------------------------------------
  477.   # ● Invoke Counter Attack
  478.   #--------------------------------------------------------------------------        
  479.   alias mog_battle_hud_invoke_counter_attack invoke_counter_attack
  480.   def invoke_counter_attack(target, item)
  481.       mog_battle_hud_invoke_counter_attack(target, item)
  482.       if target.is_a?(Game_Actor) and target.battler_face[0] != 2        
  483.          target.battler_face = [2,3,50]
  484.       end  
  485.   end  
  486.   
  487.   #--------------------------------------------------------------------------
  488.   # ● Invoke Magic Reflection
  489.   #--------------------------------------------------------------------------        
  490.   alias mog_battle_hud_invoke_magic_reflection invoke_magic_reflection
  491.   def invoke_magic_reflection(target, item)
  492.       mog_battle_hud_invoke_magic_reflection(target, item)
  493.       if target.is_a?(Game_Actor) and target.battler_face[0] != 2        
  494.          target.battler_face = [2,3,50]
  495.       end  
  496.   end   
  497.   
  498. end

  499. end #BATTLER FACE SYSTEM END --------------------------------------------------

  500. #==============================================================================
  501. # ■ Battle_Hud
  502. #==============================================================================
  503. class Battle_Hud
  504.   include MOG_BATTLE_HUD
  505.   
  506.   #--------------------------------------------------------------------------
  507.   # ● Initialize
  508.   #--------------------------------------------------------------------------   
  509.   def initialize(actor)
  510.       dispose
  511.       @actor = actor
  512.       @x = HUD_POSITION[0] + (MEMBERS_SPACE[0] * @actor.index)
  513.       @y = HUD_POSITION[1] + (MEMBERS_SPACE[1] * @actor.index)
  514.       pre_cache
  515.       create_layout
  516.       create_hp_number
  517.       create_hp_meter
  518.       create_mp_number
  519.       create_mp_meter
  520.       create_tp_number
  521.       create_tp_meter
  522.       create_states
  523.   end
  524.   
  525.   #--------------------------------------------------------------------------
  526.   # ● Pre Cache
  527.   #--------------------------------------------------------------------------      
  528.   def pre_cache
  529.       @number = Cache.system("Battle_Hud_Number")
  530.       @number_cw = @number.width / 10
  531.       @number_ch = @number.height / 4
  532.       @meter = Cache.system("Battle_Hud_Meter")
  533.       @meter_cw = @meter.width / 3
  534.       @meter_ch = @meter.height / 3
  535.       @icon = Cache.system("Iconset")
  536.   end
  537.   
  538.   #--------------------------------------------------------------------------
  539.   # ● Create Layout
  540.   #--------------------------------------------------------------------------      
  541.   def create_layout
  542.       @layout = Sprite.new
  543.       @layout.bitmap = Cache.system("Battle_Hud_Layout")
  544.       @layout.z = BATTLE_HUD_Z
  545.       @layout.x = @x
  546.       @layout.y = @y
  547.   end
  548.   
  549.   #--------------------------------------------------------------------------
  550.   # ● Create HP Number
  551.   #--------------------------------------------------------------------------        
  552.   def create_hp_number
  553.       @hp = @actor.hp
  554.       @hp_old = @actor.hp
  555.       @hp_ref = @hp_old
  556.       @hp_refresh = false
  557.       @hp_number = Sprite.new
  558.       @hp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
  559.       @hp_number.z = BATTLE_HUD_Z + 2
  560.       @hp_number.x = @x + HP_NUMBER_POSITION[0]
  561.       @hp_number.y = @y + HP_NUMBER_POSITION[1]
  562.       refresh_hp_number
  563.   end
  564.   
  565.   #--------------------------------------------------------------------------
  566.   # ● Create HP Meter
  567.   #--------------------------------------------------------------------------      
  568.   def create_hp_meter
  569.       @hp_meter = Sprite.new
  570.       @hp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  571.       @hp_meter.z =  BATTLE_HUD_Z + 1
  572.       @hp_meter.x = @x + HP_METER_POSITION[0]
  573.       @hp_meter.y = @y + HP_METER_POSITION[1]
  574.       @hp_flow = rand(@meter_cw * 2)
  575.       @hp_width_old = @meter_cw * @actor.hp / @actor.mhp
  576.       hp_flow_update
  577.   end  
  578.   
  579.   #--------------------------------------------------------------------------
  580.   # ● Hp Flow Update
  581.   #--------------------------------------------------------------------------
  582.   def hp_flow_update
  583.       @hp_meter.bitmap.clear
  584.       hp_width = @meter_cw * @actor.hp / @actor.mhp
  585.       #execute_damage_flow(hp_width)
  586.       hp_src_rect = Rect.new(@hp_flow, 0,hp_width, @meter_ch)
  587.       @hp_meter.bitmap.blt(0,0, @meter, hp_src_rect)
  588.       @hp_flow += METER_FLOW_SPEED
  589.       @hp_flow = 0 if @hp_flow >=  @meter_cw * 2      
  590.   end
  591.    
  592.   #--------------------------------------------------------------------------
  593.   # ● Execute Damage Flow
  594.   #--------------------------------------------------------------------------
  595.   def execute_damage_flow(hp_width)
  596.      n = (@hp_width_old - hp_width).abs * 3 / 100
  597.      damage_flow = [[n, 2].min,0.5].max
  598.      @hp_width_old -= damage_flow         
  599.      @hp_width_old = hp_width if @hp_width_old < hp_width
  600.      src_rect_old = Rect.new(@hp_flow, @meter_ch * 3,@hp_width_old, @meter_ch)
  601.      @hp_meter.bitmap.blt(0,0, @meter, src_rect_old)      
  602.   end  

  603.   #--------------------------------------------------------------------------
  604.   # ● Update HP Number
  605.   #--------------------------------------------------------------------------      
  606.   def update_hp_number
  607.       @hp_refresh = true
  608.       n =  2 * (@actor.hp - @hp_old).abs / 100
  609.       hp_ref = [[n, 100].min,1].max
  610.       if @hp_old < @actor.hp
  611.           @hp += hp_ref     
  612.           if @hp >= @actor.hp
  613.              @hp_old = @actor.hp
  614.              @hp = @actor.hp   
  615.              @hp_ref = 0
  616.           end              
  617.         elsif @hp_old > @actor.hp   
  618.            @hp -= hp_ref               
  619.            if @hp <= @actor.hp
  620.               @hp_old = @actor.hp
  621.               @hp = @actor.hp   
  622.               @hp_ref = 0
  623.            end            
  624.         end      
  625.    
  626.   end  
  627.   
  628.   #--------------------------------------------------------------------------
  629.   # ● Refresh HP Number
  630.   #--------------------------------------------------------------------------      
  631.   def refresh_hp_number
  632.       @hp_number.bitmap.clear
  633.       number_value = @hp.abs.to_s.split(//)
  634.       hp_color = @hp < @actor.mhp * 30 / 100 ? @number_ch : 0
  635.       center_x = 0
  636.       for r in 0..number_value.size - 1         
  637.          number_value_abs = number_value[r].to_i
  638.          src_rect = Rect.new(@number_cw * number_value_abs, hp_color, @number_cw, @number_ch)
  639.          @hp_number.bitmap.blt((@number_cw + 1) *  r, 0, @number, src_rect)
  640.          center_x += 1
  641.       end
  642.       @hp_number.x = @x + HP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
  643.       @hp_refresh = false if @hp == @actor.hp      
  644.   end  
  645.   
  646.   #--------------------------------------------------------------------------
  647.   # ● Create MP Number
  648.   #--------------------------------------------------------------------------        
  649.   def create_mp_number
  650.       @mp = @actor.mp
  651.       @mp_old = @actor.mp
  652.       @mp_ref = @mp_old
  653.       @mp_refresh = false
  654.       @mp_number = Sprite.new
  655.       @mp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
  656.       @mp_number.z = BATTLE_HUD_Z + 2
  657.       @mp_number.x = @x + MP_NUMBER_POSITION[0]
  658.       @mp_number.y = @y + MP_NUMBER_POSITION[1]
  659.       refresh_mp_number
  660.   end
  661.   
  662.   #--------------------------------------------------------------------------
  663.   # ● Create MP Meter
  664.   #--------------------------------------------------------------------------      
  665.   def create_mp_meter
  666.       @mp_meter = Sprite.new
  667.       @mp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  668.       @mp_meter.z =  BATTLE_HUD_Z + 1
  669.       @mp_meter.x = @x + MP_METER_POSITION[0]
  670.       @mp_meter.y = @y + MP_METER_POSITION[1]
  671.       @mp_flow = rand(@meter_cw * 2)
  672.       @mp_width_old = @meter_cw * @actor.mp / @actor.mmp rescue 0
  673.       mp_flow_update
  674.   end  
  675.   
  676.   #--------------------------------------------------------------------------
  677.   # ● Mp Flow Update
  678.   #--------------------------------------------------------------------------
  679.   def mp_flow_update
  680.       return if @actor.mmp == 0
  681.       @mp_meter.bitmap.clear
  682.       mp_width = @meter_cw * @actor.mp / @actor.mmp rescue 0
  683.       src_rect = Rect.new(@mp_flow, @meter_ch,mp_width, @meter_ch)
  684.       @mp_meter.bitmap.blt(0,0, @meter, src_rect)
  685.       @mp_flow += METER_FLOW_SPEED
  686.       @mp_flow = 0 if @mp_flow >=  @meter_cw * 2      
  687.     end
  688.    
  689.   #--------------------------------------------------------------------------
  690.   # ● Update MP Number
  691.   #--------------------------------------------------------------------------      
  692.   def update_mp_number
  693.       @mp_refresh = true
  694.       n =  2 * (@actor.mp - @mp_old).abs / 100
  695.       mp_ref = [[n, 100].min,1].max
  696.       if @mp_old < @actor.mp
  697.           @mp += mp_ref     
  698.           if @mp >= @actor.mp
  699.              @mp_old = @actor.mp
  700.              @mp = @actor.mp   
  701.              @mp_ref = 0
  702.           end              
  703.         elsif @mp_old > @actor.mp   
  704.            @mp -= mp_ref               
  705.            if @mp <= @actor.mp
  706.               @mp_old = @actor.mp
  707.               @mp = @actor.mp   
  708.               @mp_ref = 0
  709.            end            
  710.         end         
  711.   end  
  712.   
  713.   #--------------------------------------------------------------------------
  714.   # ● Refresh MP Number
  715.   #--------------------------------------------------------------------------      
  716.   def refresh_mp_number
  717.       @mp_number.bitmap.clear
  718.       number_value = @mp.abs.to_s.split(//)
  719.       center_x = 0
  720.       for r in 0..number_value.size - 1         
  721.          number_value_abs = number_value[r].to_i
  722.          src_rect = Rect.new(@number_cw * number_value_abs, @number_ch * 2, @number_cw, @number_ch)
  723.          @mp_number.bitmap.blt((@number_cw + 1) *  r, 0, @number, src_rect)
  724.          center_x += 1
  725.       end
  726.       @mp_number.x = @x + MP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
  727.       @mp_refresh = false if @mp == @actor.mp      
  728.   end  
  729.   
  730.   #--------------------------------------------------------------------------
  731.   # ● Create TP Number
  732.   #--------------------------------------------------------------------------        
  733.   def create_tp_number
  734.       @tp = @actor.tp
  735.       @tp_old = @actor.tp
  736.       @tp_ref = @tp_old
  737.       @tp_refresh = false
  738.       @tp_number = Sprite.new
  739.       @tp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
  740.       @tp_number.z = BATTLE_HUD_Z + 2
  741.       @tp_number.x = @x + TP_NUMBER_POSITION[0]
  742.       @tp_number.y = @y + TP_NUMBER_POSITION[1]
  743.       refresh_tp_number
  744.   end
  745.   
  746.   #--------------------------------------------------------------------------
  747.   # ● Create TP Meter
  748.   #--------------------------------------------------------------------------      
  749.   def create_tp_meter
  750.       @tp_meter = Sprite.new
  751.       @tp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  752.       @tp_meter.z =  BATTLE_HUD_Z + 1
  753.       @tp_meter.x = @x + TP_METER_POSITION[0]
  754.       @tp_meter.y = @y + TP_METER_POSITION[1]
  755.       @tp_flow = rand(@meter_cw * 2)
  756.       @tp_width_old = @meter_cw * @actor.tp / @actor.max_tp rescue 0
  757.       tp_flow_update
  758.   end  
  759.   
  760.   #--------------------------------------------------------------------------
  761.   # ● TP Flow Update
  762.   #--------------------------------------------------------------------------
  763.   def tp_flow_update
  764.       return if @actor.max_tp == 0
  765.       @tp_meter.bitmap.clear
  766.       tp_width = @meter_cw * @actor.tp / @actor.max_tp rescue 0
  767.       src_rect = Rect.new(@tp_flow, @meter_ch * 2,tp_width, @meter_ch)
  768.       @tp_meter.bitmap.blt(0,0, @meter, src_rect)
  769.       @tp_flow += METER_FLOW_SPEED
  770.       @tp_flow = 0 if @tp_flow >=  @meter_cw * 2      
  771.   end
  772.    
  773.   #--------------------------------------------------------------------------
  774.   # ● Update TP Number
  775.   #--------------------------------------------------------------------------      
  776.   def update_tp_number
  777.       @tp_refresh = true
  778.       n =  2 * (@actor.tp - @tp_old).abs / 100
  779.       tp_ref = [[n, 100].min,1].max
  780.       if @tp_old < @actor.tp
  781.           @tp += tp_ref     
  782.           if @tp >= @actor.tp
  783.              @tp_old = @actor.tp
  784.              @tp = @actor.tp   
  785.              @tp_ref = 0
  786.           end              
  787.         elsif @tp_old > @actor.tp   
  788.            @tp -= tp_ref               
  789.            if @tp <= @actor.tp
  790.               @tp_old = @actor.tp
  791.               @tp = @actor.tp   
  792.               @tp_ref = 0
  793.            end           
  794.          end            
  795.   end      
  796.    
  797.   #--------------------------------------------------------------------------
  798.   # ● Refresh TP Number
  799.   #--------------------------------------------------------------------------      
  800.   def refresh_tp_number
  801.       @tp_number.bitmap.clear
  802.       number_value = @tp.truncate.to_s.split(//)
  803.       center_x = 0
  804.       for r in 0..number_value.size - 1        
  805.          number_value_abs = number_value[r].to_i
  806.          src_rect = Rect.new(@number_cw * number_value_abs, @number_ch * 3, @number_cw, @number_ch)
  807.          @tp_number.bitmap.blt((@number_cw + 1) *  r, 0, @number, src_rect)
  808.          center_x += 1
  809.       end
  810.       @tp_number.x = @x + TP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
  811.       @tp_refresh = false if @tp == @actor.tp
  812.   end   
  813.   
  814.   #--------------------------------------------------------------------------
  815.   # ● Create_States
  816.   #--------------------------------------------------------------------------      
  817.   def create_states
  818.       refresh_states
  819.       @status = Sprite.new
  820.       @status.bitmap = Bitmap.new(24,24)
  821.       @status.x = @x + STATES_POSITION[0]
  822.       @status.y = @y + STATES_POSITION[1]      
  823.       @status_flow = -24
  824.       @states_speed = 50
  825.       @status.z = BATTLE_HUD_Z + 2
  826.       @old_states = @actor.states
  827.       flow_states
  828.   end  
  829.   
  830.   #--------------------------------------------------------------------------
  831.   # ● Flow_Status
  832.   #--------------------------------------------------------------------------         
  833.   def flow_states
  834.       return if @actor.states.size == 0 and !@status.visible
  835.       @states_speed = 0
  836.       @status.bitmap.clear
  837.       src_rect = Rect.new(@status_flow,0, 24,24)
  838.       @status.bitmap.blt(0,0, @actor_status, src_rect)
  839.       @status.visible = @actor.states.size == 0 ? false : true
  840.       @status_flow += 1
  841.       @status_flow = -24 if @status_flow >= @states_size - 24
  842.   end   
  843.   
  844.   #--------------------------------------------------------------------------
  845.   # ● Refresh States
  846.   #--------------------------------------------------------------------------        
  847.   def refresh_states
  848.       refresh_icon if @icon == nil or @icon.disposed?
  849.       @old_states = @actor.states
  850.       if @actor_status != nil
  851.          @actor_status.dispose
  852.          @actor_status = nil
  853.       end
  854.       @states_size = @actor.states.size > 0 ? (48 * @actor.states.size) : 24
  855.       @actor_status = Bitmap.new(@states_size,24)
  856.       index = 0
  857.       for i in  @actor.states
  858.          rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
  859.          @actor_status.blt(48 * index , 0, @icon, rect)
  860.          index += 1
  861.       end
  862.   end  
  863.   
  864.   #--------------------------------------------------------------------------
  865.   # ● Refresh Icon
  866.   #--------------------------------------------------------------------------      
  867.   def refresh_icon      
  868.       if @icon != nil
  869.          if !@icon.disposed?
  870.              @icon.dispose
  871.          end
  872.          @icon = nil
  873.       end  
  874.       @icon = Cache.system("Iconset")
  875.   end
  876.   
  877.   #--------------------------------------------------------------------------
  878.   # ● Dispose
  879.   #--------------------------------------------------------------------------   
  880.   def dispose
  881.       return if @meter == nil
  882.       @meter.dispose
  883.       @meter = nil
  884.       @number.dispose
  885.       if @icon != nil
  886.          if !@icon.disposed?
  887.              @icon.dispose
  888.          end
  889.          @icon = nil
  890.       end     
  891.       @layout.bitmap.dispose
  892.       @layout.dispose
  893.       @hp_number.bitmap.dispose
  894.       @hp_number.dispose
  895.       @hp_meter.bitmap.dispose
  896.       @hp_meter.dispose
  897.       @mp_number.bitmap.dispose
  898.       @mp_number.dispose
  899.       @mp_meter.bitmap.dispose
  900.       @mp_meter.dispose      
  901.       @tp_number.bitmap.dispose
  902.       @tp_number.dispose
  903.       @tp_meter.bitmap.dispose
  904.       @tp_meter.dispose
  905.       @status.bitmap.dispose
  906.       @status.dispose
  907.       if @actor_status != nil
  908.          @actor_status.dispose
  909.          @actor_status = nil
  910.       end        
  911.   end
  912.   
  913.   #--------------------------------------------------------------------------
  914.   # ● Update
  915.   #--------------------------------------------------------------------------   
  916.   def update
  917.       return if @meter == nil
  918.       update_hp_number if @hp_old != @actor.hp
  919.       refresh_hp_number if @hp_refresh
  920.       update_mp_number if @mp_old != @actor.mp
  921.       refresh_mp_number if @mp_refresh
  922.       update_tp_number if @tp_old != @actor.tp
  923.       refresh_tp_number if @tp_refresh
  924.       refresh_states if @old_states != @actor.states
  925.       hp_flow_update
  926.       tp_flow_update
  927.       mp_flow_update
  928.       flow_states
  929.   end
  930.   
  931. end

  932. #==============================================================================
  933. # ■ Spriteset Battle
  934. #==============================================================================
  935. class Spriteset_Battle
  936.   
  937.   #--------------------------------------------------------------------------
  938.   # ● Initialize
  939.   #--------------------------------------------------------------------------  
  940.   alias mog_battle_hud_initialize initialize
  941.   def initialize
  942.       mog_battle_hud_initialize
  943.       create_battle_hud      
  944.   end
  945.   
  946.   #--------------------------------------------------------------------------
  947.   # ● Create Battle Hud
  948.   #--------------------------------------------------------------------------   
  949.   def create_battle_hud
  950.       dispose_battle_hud
  951.       @battle_hud = []      
  952.       for i in $game_party.members
  953.           @battle_hud.push(Battle_Hud.new(i))
  954.       end
  955.   end
  956.   
  957.   #--------------------------------------------------------------------------
  958.   # ● Dispose
  959.   #--------------------------------------------------------------------------      
  960.   alias mog_battle_hud_dispose dispose
  961.   def dispose
  962.       mog_battle_hud_dispose
  963.       dispose_battle_hud
  964.   end  
  965.   
  966.   #--------------------------------------------------------------------------
  967.   # ● Dispose Battle Hud
  968.   #--------------------------------------------------------------------------        
  969.   def dispose_battle_hud
  970.       return if @battle_hud == nil
  971.       @battle_hud.each {|sprite| sprite.dispose }
  972.       @battle_hud.clear
  973.       @battle_hud = nil
  974.   end
  975.   
  976.   #--------------------------------------------------------------------------
  977.   # ● Update
  978.   #--------------------------------------------------------------------------        
  979.   alias mog_battle_hud_update update
  980.   def update
  981.       mog_battle_hud_update
  982.       update_battle_hud
  983.   end
  984.   
  985.   #--------------------------------------------------------------------------
  986.   # ● Update Battle Hud
  987.   #--------------------------------------------------------------------------         
  988.   def update_battle_hud
  989.       return if @battle_hud == nil
  990.       @battle_hud.each {|sprite| sprite.update }
  991.   end
  992.    
  993. end

  994. #==============================================================================
  995. # ■ Game_Actor
  996. #==============================================================================
  997. class Game_Actor < Game_Battler
  998.   include MOG_BATTLE_HUD
  999.    
  1000.    attr_accessor :hud_x
  1001.    attr_accessor :hud_y

  1002.   #--------------------------------------------------------------------------
  1003.   # ● HUD X
  1004.   #--------------------------------------------------------------------------     
  1005.   def hud_x
  1006.       return HUD_POSITION[0] + (MEMBERS_SPACE[0] * index)
  1007.   end
  1008.   
  1009.   #--------------------------------------------------------------------------
  1010.   # ● HUD Y
  1011.   #--------------------------------------------------------------------------   
  1012.   def hud_y
  1013.       return HUD_POSITION[1] + (MEMBERS_SPACE[1] * index)
  1014.   end  
  1015.   
  1016. end  

  1017. #==============================================================================
  1018. # ■ Scene Battle
  1019. #==============================================================================
  1020. class Scene_Battle < Scene_Base
  1021.   
  1022.   #--------------------------------------------------------------------------
  1023.   # ● Create Party Command Window
  1024.   #--------------------------------------------------------------------------   
  1025.   alias mog_battle_hud_create_party_command_window create_party_command_window
  1026.   def create_party_command_window
  1027.       mog_battle_hud_create_party_command_window
  1028.       set_party_window_position
  1029.   end  
  1030.   
  1031.   #--------------------------------------------------------------------------
  1032.   # ● Set Party Window Position
  1033.   #--------------------------------------------------------------------------      
  1034.   def set_party_window_position
  1035.       @party_command_window.viewport = nil  
  1036.       return if $mog_rgss3_at_system != nil
  1037.       a_index = []
  1038.       for actor in $game_party.alive_members
  1039.           a_index = [actor.hud_x, actor.hud_y]
  1040.           break
  1041.       end
  1042.       return if a_index.empty?
  1043.       @party_command_window.x = MOG_BATTLE_HUD::COMMAND_POSITION[0] + a_index[0]
  1044.       @party_command_window.y = MOG_BATTLE_HUD::COMMAND_POSITION[1] + a_index[1]      
  1045.   end  
  1046.   
  1047.   #--------------------------------------------------------------------------
  1048.   # ● Set Party Window Position
  1049.   #--------------------------------------------------------------------------        
  1050.   alias mog_battle_hud_start_party_command_selection start_party_command_selection
  1051.   def start_party_command_selection
  1052.       set_party_window_position
  1053.       mog_battle_hud_start_party_command_selection
  1054.   end  
  1055.   
  1056.   #--------------------------------------------------------------------------
  1057.   # ● Update
  1058.   #--------------------------------------------------------------------------  
  1059.   alias mog_battle_hud_update_basic update_basic
  1060.   def update_basic
  1061.       mog_battle_hud_update_basic
  1062.       update_command_window_visible
  1063.   end  
  1064.   
  1065.   #--------------------------------------------------------------------------
  1066.   # ● Update Command Window Visible
  1067.   #--------------------------------------------------------------------------   
  1068.   def update_command_window_visible
  1069.       @status_window.visible = @status_window.active ? true : false
  1070.       @actor_command_window.visible = @actor_command_window.active ? true : false
  1071.       @skill_window.visible = @skill_window.active ? true : false
  1072.       @item_window.visible = @item_window.active ? true : false      
  1073.   end
  1074.   
  1075.   #--------------------------------------------------------------------------
  1076.   # ● Start Actor Command Selection
  1077.   #--------------------------------------------------------------------------   
  1078.   alias mog_battle_hud_start_actor_command_selection start_actor_command_selection
  1079.   def start_actor_command_selection
  1080.       mog_battle_hud_start_actor_command_selection
  1081.       @actor_command_window.viewport = nil
  1082.       @actor_command_window.x = MOG_BATTLE_HUD::COMMAND_POSITION[0] + $game_party.members[BattleManager.actor.index].hud_x
  1083.       @actor_command_window.y = MOG_BATTLE_HUD::COMMAND_POSITION[1] + $game_party.members[BattleManager.actor.index].hud_y
  1084.       @party_command_window.x = @actor_command_window.x
  1085.       @party_command_window.y = @actor_command_window.y  
  1086.   end  

  1087. end


  1088. #==============================================================================
  1089. # ■ Game Temp
  1090. #==============================================================================
  1091. class Game_Temp
  1092.   
  1093.   attr_accessor :battle_cursor
  1094.   
  1095.   #--------------------------------------------------------------------------
  1096.   # ● Initialize
  1097.   #--------------------------------------------------------------------------  
  1098.   alias mog_battle_cursor_initialize initialize
  1099.   def initialize
  1100.       @battle_cursor = [0,0,true,""]
  1101.       mog_battle_cursor_initialize
  1102.   end  
  1103.   
  1104. end

  1105. #==============================================================================
  1106. # ■ Spriteset Battle
  1107. #==============================================================================
  1108. class Spriteset_Battle
  1109.   
  1110.   include MOG_BATTLE_CURSOR
  1111.   
  1112.   #--------------------------------------------------------------------------
  1113.   # ● Initialize
  1114.   #--------------------------------------------------------------------------      
  1115.   alias mog_battle_cursor_initialize initialize
  1116.   def initialize
  1117.       mog_battle_cursor_initialize
  1118.       create_cursor
  1119.   end
  1120.   
  1121.   #--------------------------------------------------------------------------
  1122.   # ● Create_Cursor
  1123.   #--------------------------------------------------------------------------        
  1124.   def create_cursor
  1125.       @cursor = Sprite.new
  1126.       @cursor.bitmap = Cache.system("Battle_Cursor")
  1127.       @cursor.z = 999
  1128.       @cursor.visible = false
  1129.       @cursor_new_x = -64
  1130.       @cursor_new_y = -64
  1131.       @cursor_float_y = 0
  1132.       @cursor_float_duration = 0
  1133.       @c_real_y = 0
  1134.       @cursor_name = Sprite.new
  1135.       @cursor_name.bitmap = Bitmap.new(120,32)
  1136.       @cursor_name.z = @cursor.z + 1
  1137.       @cursor_name.bitmap.font.size = 16
  1138.       refresh_cursor_name
  1139.       update_cursor_name
  1140.       $game_temp.battle_cursor = [@cursor_new_x,@cursor_new_y,false]
  1141.   end  
  1142.   
  1143.   #--------------------------------------------------------------------------
  1144.   # ● Refresh Cursor Name
  1145.   #--------------------------------------------------------------------------              
  1146.   def refresh_cursor_name
  1147.       return if  !(@cursor.x == $game_temp.battle_cursor[0] and
  1148.                    @cursor.y == @c_real_y)
  1149.       @cursor_name_enemy = $game_temp.battle_cursor[3]
  1150.       @cursor_name.bitmap.clear      
  1151.       @cursor_name.bitmap.draw_text(0,0,120,32,@cursor_name_enemy.to_s,1)      
  1152.   end
  1153.    
  1154.   #--------------------------------------------------------------------------
  1155.   # ● Dispose
  1156.   #--------------------------------------------------------------------------      
  1157.   alias mog_battle_cursor_dispose dispose
  1158.   def dispose
  1159.       mog_battle_cursor_dispose
  1160.       dispose_cursor
  1161.   end  
  1162.   
  1163.   #--------------------------------------------------------------------------
  1164.   # ● Dispose Cursor
  1165.   #--------------------------------------------------------------------------        
  1166.   def dispose_cursor   
  1167.       @cursor.bitmap.dispose
  1168.       @cursor.dispose
  1169.       @cursor_name.bitmap.dispose
  1170.       @cursor_name.dispose
  1171.   end
  1172.   
  1173.   #--------------------------------------------------------------------------
  1174.   # ● Update
  1175.   #--------------------------------------------------------------------------         
  1176.   alias mog_battle_cursor_update update
  1177.   def update
  1178.       mog_battle_cursor_update
  1179.       update_battle_cursor
  1180.   end  
  1181.   
  1182.   #--------------------------------------------------------------------------
  1183.   # ● Update Battle Cursor
  1184.   #--------------------------------------------------------------------------            
  1185.   def update_battle_cursor
  1186.       return if @cursor == nil
  1187.       @cursor.visible = $game_temp.battle_cursor[2]
  1188.       update_cursor_name
  1189.       if !@cursor.visible
  1190.          @cursor.x = -64
  1191.          @cursor.y = -64
  1192.          @cursor.opacity = 0
  1193.          update_cursor_name
  1194.          return
  1195.       end        
  1196.       @cursor.opacity += 15
  1197.       update_cursor_float_effect
  1198.       if CURSOR_SLIDE_EFFECT
  1199.          update_cursor_slide_effect
  1200.       else
  1201.          @cursor.x = $game_temp.battle_cursor[0]
  1202.          @cursor.y = $game_temp.battle_cursor[1]
  1203.       end
  1204.   end
  1205.   
  1206.   #--------------------------------------------------------------------------
  1207.   # ● Update Cursor Name
  1208.   #--------------------------------------------------------------------------              
  1209.   def update_cursor_name
  1210.       refresh_cursor_name if @cursor_name_enemy != $game_temp.battle_cursor[3]
  1211.       @cursor_name.x = @cursor.x + CURSOR_NAME_POSITION[0]
  1212.       @cursor_name.y = @cursor.y + CURSOR_NAME_POSITION[1]
  1213.       @cursor_name.opacity = @cursor.opacity
  1214.       @cursor_name.visible = @cursor.visible   
  1215.   end  
  1216.    
  1217.   #--------------------------------------------------------------------------
  1218.   # ● Update Cursor Slide Effect
  1219.   #--------------------------------------------------------------------------               
  1220.   def update_cursor_slide_effect
  1221.       @cursor_new_x = $game_temp.battle_cursor[0]
  1222.       @cursor_new_y = $game_temp.battle_cursor[1]      
  1223.       @cs_x = 5 + ((@cursor.x - @cursor_new_x).abs / 5)
  1224.       @cs_y = 5 + ((@cursor.y - @cursor_new_y).abs / 5)
  1225.       if @cursor.x > @cursor_new_x
  1226.          @cursor.x -= @cs_x
  1227.          @cursor.x = @cursor_new_x if @cursor.x < @cursor_new_x
  1228.       elsif  @cursor.x < @cursor_new_x
  1229.          @cursor.x += @cs_x
  1230.          @cursor.x = @cursor_new_x if @cursor.x > @cursor_new_x
  1231.       end     
  1232.       @c_real_y = @cursor_new_y + @cursor_float_y
  1233.       if @cursor.y > @cursor_new_y
  1234.          @cursor.y -= @cs_y
  1235.          @cursor.y = @c_real_y if @cursor.y < @c_real_y
  1236.       elsif  @cursor.y < @c_real_y
  1237.          @cursor.y += @cs_y
  1238.          @cursor.y = @c_real_y if @cursor.y > @c_real_y
  1239.       end  
  1240.   end
  1241.   
  1242.   #--------------------------------------------------------------------------
  1243.   # ● Update Cursor Float Effect
  1244.   #--------------------------------------------------------------------------              
  1245.   def update_cursor_float_effect
  1246.       return if !CURSOR_FLOAT_EFFECT
  1247.       @cursor_float_duration += 1
  1248.       case @cursor_float_duration
  1249.         when 0..20
  1250.           @cursor_float_y += 1
  1251.         when 21..40
  1252.           @cursor_float_y  -= 1
  1253.         else
  1254.           @cursor_float_y = 0
  1255.           @cursor_float_duration = 0
  1256.       end        
  1257.   end
  1258.    
  1259. end

  1260. #==============================================================================
  1261. # ■ Window BattleStatus
  1262. #==============================================================================
  1263. class Window_BattleStatus < Window_Selectable

  1264.   #--------------------------------------------------------------------------
  1265.   # ● Initialize
  1266.   #--------------------------------------------------------------------------
  1267.   alias mog_battle_hud_initialize initialize
  1268.   def initialize
  1269.       mog_battle_hud_initialize
  1270.       self.visible = false      
  1271.   end
  1272.    
  1273.   #--------------------------------------------------------------------------
  1274.   # ● Refresh
  1275.   #--------------------------------------------------------------------------         
  1276.   alias mog_battle_hud_refresh refresh
  1277.   def refresh
  1278.       return
  1279.       mog_battle_hud_refresh      
  1280.   end  
  1281.   
  1282. end

  1283. #==============================================================================
  1284. # ■ Scene Battle
  1285. #==============================================================================
  1286. class Scene_Battle < Scene_Base
  1287.   
  1288.   #--------------------------------------------------------------------------
  1289.   # ● Create Enemy Window
  1290.   #--------------------------------------------------------------------------              
  1291.   def create_enemy_window
  1292.       @enemy_window = Window_BattleEnemy_Cursor.new
  1293.       @enemy_window.set_handler(:ok,     method(:on_enemy_ok))
  1294.       @enemy_window.set_handler(:cancel, method(:on_enemy_cancel))
  1295.   end
  1296.   
  1297.   #--------------------------------------------------------------------------
  1298.   # ● Create Actor Window
  1299.   #--------------------------------------------------------------------------               
  1300.   def create_actor_window
  1301.       @actor_window = Window_BattleActor_Cursor.new
  1302.       @actor_window.set_handler(:ok,     method(:on_actor_ok))
  1303.       @actor_window.set_handler(:cancel, method(:on_actor_cancel))
  1304.   end  

  1305. end

  1306. #==============================================================================
  1307. # ■ Window Selectable Battle_Cursor
  1308. #==============================================================================
  1309. class Window_Selectable_Battle_Cursor < Window_Base
  1310.   
  1311.   attr_reader   :index
  1312.   
  1313.   #--------------------------------------------------------------------------
  1314.   # ● Initialize
  1315.   #-------------------------------------------------------------------------
  1316.   def initialize(x, y, width, height)
  1317.       super
  1318.       @index = -1
  1319.       @handler = {}
  1320.       deactivate
  1321.   end

  1322.   #--------------------------------------------------------------------------
  1323.   # ● Item Max
  1324.   #--------------------------------------------------------------------------
  1325.   def item_max
  1326.     return 0
  1327.   end
  1328.   
  1329.   #--------------------------------------------------------------------------
  1330.   # ● Active
  1331.   #--------------------------------------------------------------------------
  1332.   def active=(active)
  1333.       super
  1334.   end
  1335.   
  1336.   #--------------------------------------------------------------------------
  1337.   # ● Index
  1338.   #--------------------------------------------------------------------------
  1339.   def index=(index)
  1340.       @index = index
  1341.   end

  1342.   #--------------------------------------------------------------------------
  1343.   # ● Set Handler
  1344.   #--------------------------------------------------------------------------
  1345.   def set_handler(symbol, method)
  1346.       @handler[symbol] = method
  1347.   end
  1348.   
  1349.   #--------------------------------------------------------------------------
  1350.   # ● Handle?
  1351.   #--------------------------------------------------------------------------
  1352.   def handle?(symbol)
  1353.       @handler.include?(symbol)
  1354.   end
  1355.   
  1356.   #--------------------------------------------------------------------------
  1357.   # ● Call Handler
  1358.   #--------------------------------------------------------------------------
  1359.   def call_handler(symbol)
  1360.       @handler[symbol].call if handle?(symbol)
  1361.   end

  1362.   #--------------------------------------------------------------------------
  1363.   # ● Cursor Movable
  1364.   #--------------------------------------------------------------------------
  1365.   def cursor_movable?
  1366.       active && open? && !@cursor_fix && !@cursor_all && item_max > 0
  1367.   end  
  1368.   
  1369.   #--------------------------------------------------------------------------
  1370.   # ● Cursor Down
  1371.   #--------------------------------------------------------------------------  
  1372.   def cursor_down(wrap = false)
  1373.       self.index += 1
  1374.       check_index_limit
  1375.   end
  1376.   
  1377.   #--------------------------------------------------------------------------
  1378.   # ● Cursor Right
  1379.   #--------------------------------------------------------------------------
  1380.   def cursor_right(wrap = false)
  1381.       self.index += 1
  1382.       check_index_limit
  1383.   end  
  1384.   
  1385.   #--------------------------------------------------------------------------
  1386.   # ● Cursor UP
  1387.   #--------------------------------------------------------------------------
  1388.   def cursor_up(wrap = false)
  1389.       self.index -= 1
  1390.       check_index_limit
  1391.   end  
  1392.   
  1393.   #--------------------------------------------------------------------------
  1394.   # ● Cursor Left
  1395.   #--------------------------------------------------------------------------
  1396.   def cursor_left(wrap = false)
  1397.       self.index -= 1
  1398.       check_index_limit(self.index)
  1399.   end
  1400.   
  1401.   #--------------------------------------------------------------------------
  1402.   # ● Update
  1403.   #--------------------------------------------------------------------------
  1404.   def update
  1405.       super
  1406.       process_cursor_move
  1407.       process_handling
  1408.   end
  1409.   
  1410.   #--------------------------------------------------------------------------
  1411.   # ● Process Cursor Move
  1412.   #--------------------------------------------------------------------------
  1413.   def process_cursor_move
  1414.       return unless cursor_movable?
  1415.       last_index = @index
  1416.       cursor_down (Input.trigger?(:DOWN))  if Input.repeat?(:DOWN)
  1417.       cursor_up   (Input.trigger?(:UP))    if Input.repeat?(:UP)
  1418.       cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
  1419.       cursor_left (Input.trigger?(:LEFT))  if Input.repeat?(:LEFT)
  1420.       if @index != last_index
  1421.          Sound.play_cursor
  1422.          set_cursor_position(@index)
  1423.       end   
  1424.   end
  1425.   
  1426.   #--------------------------------------------------------------------------
  1427.   # ● Process Handling
  1428.   #--------------------------------------------------------------------------
  1429.   def process_handling
  1430.       return unless open? && active
  1431.       return process_ok       if ok_enabled?        && Input.trigger?(:C)
  1432.       return process_cancel   if cancel_enabled?    && Input.trigger?(:B)
  1433.   end
  1434.   
  1435.   #--------------------------------------------------------------------------
  1436.   # ● OK Enabled
  1437.   #--------------------------------------------------------------------------
  1438.   def ok_enabled?
  1439.       handle?(:ok)
  1440.   end
  1441.   
  1442.   #--------------------------------------------------------------------------
  1443.   # ● Cancel Enabled
  1444.   #--------------------------------------------------------------------------
  1445.   def cancel_enabled?
  1446.       handle?(:cancel)
  1447.   end

  1448.   #--------------------------------------------------------------------------
  1449.   # ● Process OK
  1450.   #--------------------------------------------------------------------------
  1451.   def process_ok
  1452.       if current_item_enabled?
  1453.          Sound.play_ok
  1454.          Input.update
  1455.          deactivate
  1456.          call_ok_handler
  1457.       else
  1458.          Sound.play_buzzer
  1459.       end
  1460.   end
  1461.   
  1462.   #--------------------------------------------------------------------------
  1463.   # ● Call OK Handler
  1464.   #--------------------------------------------------------------------------
  1465.   def call_ok_handler
  1466.       call_handler(:ok)
  1467.   end
  1468.   
  1469.   #--------------------------------------------------------------------------
  1470.   # ● Process Cancel
  1471.   #--------------------------------------------------------------------------
  1472.   def process_cancel
  1473.       Sound.play_cancel
  1474.       Input.update
  1475.       deactivate
  1476.       call_cancel_handler
  1477.   end

  1478.   #--------------------------------------------------------------------------
  1479.   # ● Call Cancel Handler
  1480.   #--------------------------------------------------------------------------
  1481.   def call_cancel_handler
  1482.       call_handler(:cancel)
  1483.   end

  1484.   #--------------------------------------------------------------------------
  1485.   # ● Set Cursor Position
  1486.   #--------------------------------------------------------------------------   
  1487.   def set_cursor_position(index)   
  1488.   end  
  1489.   
  1490.   #--------------------------------------------------------------------------
  1491.   # ● Current Item Enabled?
  1492.   #--------------------------------------------------------------------------
  1493.   def current_item_enabled?
  1494.       return true
  1495.   end

  1496.   #--------------------------------------------------------------------------
  1497.   # ● Refresh
  1498.   #--------------------------------------------------------------------------
  1499.   def refresh
  1500.       contents.clear
  1501.   end
  1502.   
  1503.   #--------------------------------------------------------------------------
  1504.   # ● Show
  1505.   #--------------------------------------------------------------------------
  1506.   def show
  1507.       set_cursor_position(self.index)
  1508.       $game_temp.battle_cursor[2] = true
  1509.       super
  1510.   end
  1511.   
  1512.   #--------------------------------------------------------------------------
  1513.   # ● Hide
  1514.   #--------------------------------------------------------------------------
  1515.   def hide
  1516.       $game_temp.battle_cursor[2] = false
  1517.       super
  1518.   end  
  1519.   
  1520.   #--------------------------------------------------------------------------
  1521.   # ● Check Index Limit
  1522.   #--------------------------------------------------------------------------      
  1523.   def check_index_limit(index = self.index)
  1524.       self.index = index
  1525.       self.index = 0 if self.index >= item_max
  1526.       self.index = (item_max - 1) if self.index < 0
  1527.   end      
  1528.   
  1529. end

  1530. #==============================================================================
  1531. # ■ Window_BattleEnemy
  1532. #==============================================================================
  1533. class Window_BattleEnemy_Cursor < Window_Selectable_Battle_Cursor
  1534.   
  1535.   include MOG_BATTLE_CURSOR
  1536.   
  1537.   #--------------------------------------------------------------------------
  1538.   # ● Initialize
  1539.   #--------------------------------------------------------------------------
  1540.   def initialize
  1541.       super(-32, -32, 32, 32)
  1542.       self.index = 0
  1543.       self.visible = false
  1544.       set_cursor_position(self.index)
  1545.   end  
  1546.   
  1547.   #--------------------------------------------------------------------------
  1548.   # ● Item Max
  1549.   #--------------------------------------------------------------------------
  1550.   def item_max
  1551.       $game_troop.alive_members.size
  1552.   end
  1553.    
  1554.   #--------------------------------------------------------------------------
  1555.   # ● Enemy
  1556.   #--------------------------------------------------------------------------  
  1557.   def enemy
  1558.       $game_troop.alive_members[self.index]
  1559.   end  
  1560.   
  1561.   #--------------------------------------------------------------------------
  1562.   # ● Set Cursor Position
  1563.   #--------------------------------------------------------------------------   
  1564.   def set_cursor_position(index)
  1565.       check_index_limit(index)
  1566.       return if $game_troop.alive_members[self.index] == nil
  1567.       $game_temp.battle_cursor[0] = $game_troop.alive_members[self.index].screen_x + CURSOR_POSITION[0]
  1568.       $game_temp.battle_cursor[1] = $game_troop.alive_members[self.index].screen_y + CURSOR_POSITION[1]
  1569.       $game_temp.battle_cursor[3] = $game_troop.alive_members[self.index].name
  1570.   end

  1571. end

  1572. #==============================================================================
  1573. # ■ Window_BattleActor Cursor
  1574. #==============================================================================
  1575. class Window_BattleActor_Cursor < Window_Selectable_Battle_Cursor
  1576.   
  1577.   include MOG_BATTLE_CURSOR
  1578.   include MOG_BATTLE_HUD
  1579.   #--------------------------------------------------------------------------
  1580.   # ● Initialize
  1581.   #--------------------------------------------------------------------------
  1582.   def initialize
  1583.       super(-32, -32, 32, 32)
  1584.       self.index = 0
  1585.       self.visible = true
  1586.       set_cursor_position(self.index)
  1587.   end  
  1588.   
  1589.   #--------------------------------------------------------------------------
  1590.   # ● Item Max
  1591.   #--------------------------------------------------------------------------
  1592.   def item_max
  1593.       $game_party.members.size
  1594.   end
  1595.   
  1596.   #--------------------------------------------------------------------------
  1597.   # ● Set Cursor Position
  1598.   #--------------------------------------------------------------------------   
  1599.   def set_cursor_position(index)
  1600.       check_index_limit(index)
  1601.       return if $game_party.members[self.index] == nil
  1602.       screen_x = $game_party.members[self.index].screen_x rescue nil
  1603.       screen_y = $game_party.members[self.index].screen_y rescue nil
  1604.       if screen_x == nil or screen_y == nil
  1605.          screen_x = $game_party.members[self.index].hud_x + (HP_NUMBER_POSITION[0] / 3) + 32
  1606.          screen_y = $game_party.members[self.index].hud_y + (HP_NUMBER_POSITION[1] / 2) + 32
  1607.       end  
  1608.       $game_temp.battle_cursor[0] = screen_x + CURSOR_POSITION[0]
  1609.       $game_temp.battle_cursor[1] = screen_y + CURSOR_POSITION[1]
  1610.       $game_temp.battle_cursor[3] = $game_party.members[self.index].name
  1611.   end

  1612. end

  1613. $mog_rgss3_battle_hud = true
复制代码

Scripts.zip

216.39 KB, 下载次数: 43

脚本数据

梦石
0
星屑
50
在线时间
82 小时
注册时间
2013-3-17
回帖
49
发表于 2013-7-18 13:45:57 | 显示全部楼层
把两个脚本的顺序换一下

点评

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

使用道具 举报

梦石
0
星屑
293
在线时间
398 小时
注册时间
2011-5-20
回帖
94
 楼主| 发表于 2013-7-19 10:48:51 | 显示全部楼层
脚本补上了,知道怎么回事的来看下
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部