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

Project1

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

[已经过期] 【脚本】横板战斗脚本如何添加至6个人

[复制链接]

Lv1.梦旅人

梦石
0
星屑
945
在线时间
3 小时
注册时间
2015-11-27
帖子
2
跳转到指定楼层
1
发表于 2015-11-29 16:27:12 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  1. #==============================================================================
  2. # ■ 此脚本来自 www.66rpg.com
  3. #------------------------------------------------------------------------------
  4. #   名称:横版战斗模板
  5. #   作者:后知后觉([email protected])
  6. #   版本:v1.7  2012-02-09
  7. #   使用协议:在保留此脚本相关信息的情况下
  8. #             可任意使用、修改及修改后发布.
  9. #             如是修改后发布.请在作者标注那里加上 某某某改 等信息
  10. #             感谢你来这里谈谈你对这个工程的看法或报告BUG.
  11. #               http://rpg.blue/thread-216673-1-1.html
  12. #   使用说明:
  13. #       请来发布帖查看:
  14. #           http://rpg.blue/thread-216673-1-1.html
  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] = [478, 218]
  30.     ActorsBattlePosition[2] = [522, 282]
  31.     ActorsBattlePosition[3] = [556, 228]
  32.     ActorsBattlePosition[4] = [560, 282]
  33.    
  34.     # 设置伤害值图形的色相 取值范围 0~360
  35.     DamageBitmapHue = 0
  36.     # 伤害值分段显示的标志SE文件名
  37.     DamageSectionDisplaySEName = "(A)"
  38.    
  39.     # 动画 Z 坐标值默认变化量
  40.     DefaultAniAddZ = 768
  41.    
  42.     # 状态动画 Z 坐标值默认变化量
  43.     DefaultLoopAniAddZ = 20
  44.    
  45.     # 战斗中角色的面向
  46.     ActorDirection = 4
  47.    
  48.     # 真位移的帧数
  49.     RealMoveDuration = 15
  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 = 1
  66.     # 一张战斗图中的一个样式持续多少帧
  67.     OnePatternDuration = 15
  68.    
  69.     # 角色使用战斗死亡图形
  70.     UseActorDeadGraphic = true
  71.     # 敌人使用战斗死亡图形
  72.     UseEnemyDeadGraphic = false
  73.    
  74.     # 使用挨打图形
  75.     UseBeatenGraphic = true
  76.     # 挨打图形维持帧数
  77.     BeatenGraphicDuration = 30
  78.    
  79.     # 是否使用角色防御图 只有同时使用了挨打图.此项才有效.
  80.     UseActorGuardGraphic = true
  81.     # 是否使用敌人防御图 只有同时使用了挨打图.此项才有效.
  82.     UseEnemyGuardGraphic = false
  83.    
  84.     # 角色是否使用挨打SE
  85.     UseActorWBSE = true
  86.     # 敌人是否使用挨打SE
  87.     UseEnemyWBSE = true
  88.     # 角色是否使用防御SE
  89.     UseActorGDSE = true
  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 [email protected]_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 [email protected]_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 [email protected]_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 [email protected]?
  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/ME/W挨打SE_#{id}", 80, 100)  #我放挨打
  1779.     elsif UseEnemyWBSE && enemy?
  1780.       Audio.se_play("Audio/ME/D挨打SE_#{enemy_id}", 80, 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/ME/防御SE_#{id}", 80, 100)  #防御SE
  1790.     elsif UseEnemyGDSE && enemy?
  1791.       Audio.se_play("Audio/ME/EGDSE_#{enemy_id}", 80, 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 && [email protected]_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 && [email protected]_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 && [email protected]_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. # ■ 此脚本来自 www.66rpg.com
  2085. #==============================================================================
复制代码
已经将maxbattlemember设置 成6但是没有效果

QQ截图20151129162524.png (429.62 KB, 下载次数: 22)

QQ截图20151129162524.png

Lv1.梦旅人

梦石
0
星屑
61
在线时间
251 小时
注册时间
2015-5-14
帖子
453
2
发表于 2015-11-30 13:02:10 | 只看该作者
RUBY 代码复制
  1. # 取得参战角色的最大数.如果要改大.需要在下面的坐标设置里增加对应的条目
  2.     MaxBattleMembers = 4
  3.  
  4.     ActorsBattlePosition = {}
  5.     # 设置角色战斗图形的坐标
  6.     # 等号左边的[]号里面的1 2 3 4 表示角色在队伍里的位置
  7.     # 等号右边的[]号里面的两个数字分别表示 X坐标 Y坐标
  8.     # 每次进入战斗的时候都会以这里设置的信息作为初始化位置.
  9.     # 如果你把上面的 MaxBattleMembers 改大了.比如改成了 5.
  10.     # 那么你需要在下面新增一行代码设置队伍中第5位置的坐标.
  11.     # 就像这样 ActorsBattlePosition[5] = [X坐标, Y坐标]
  12.     ActorsBattlePosition[1] = [478, 218]
  13.     ActorsBattlePosition[2] = [522, 282]
  14.     ActorsBattlePosition[3] = [556, 228]
  15.     ActorsBattlePosition[4] = [560, 282]

改成
RUBY 代码复制
  1. # 取得参战角色的最大数.如果要改大.需要在下面的坐标设置里增加对应的条目
  2.     MaxBattleMembers = 6
  3.  
  4.     ActorsBattlePosition = {}
  5.     # 设置角色战斗图形的坐标
  6.     # 等号左边的[]号里面的1 2 3 4 表示角色在队伍里的位置
  7.     # 等号右边的[]号里面的两个数字分别表示 X坐标 Y坐标
  8.     # 每次进入战斗的时候都会以这里设置的信息作为初始化位置.
  9.     # 如果你把上面的 MaxBattleMembers 改大了.比如改成了 5.
  10.     # 那么你需要在下面新增一行代码设置队伍中第5位置的坐标.
  11.     # 就像这样 ActorsBattlePosition[5] = [X坐标, Y坐标]
  12.     ActorsBattlePosition[1] = [478, 218]
  13.     ActorsBattlePosition[2] = [522, 282]
  14.     ActorsBattlePosition[3] = [556, 228]
  15.     ActorsBattlePosition[4] = [560, 282]
  16.     ActorsBattlePosition[5] = [590, 282]
  17.     ActorsBattlePosition[6] = [560, 250]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
945
在线时间
3 小时
注册时间
2015-11-27
帖子
2
3
 楼主| 发表于 2016-2-5 18:31:50 | 只看该作者
wangyanzhe6 发表于 2015-11-30 13:02
把 # 取得参战角色的最大数.如果要改大.需要在下面的坐标设置里增加对应的条目
    MaxBattleMembers = 4
  ...

这个我改过了 但是没有作用
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
75
在线时间
105 小时
注册时间
2015-8-8
帖子
51
4
发表于 2016-2-9 20:28:26 | 只看该作者
ruyu222 发表于 2016-2-5 18:31
这个我改过了 但是没有作用


原来不止我一个人用va来做神奇宝贝有兴趣一起研究研究吗?
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
8629
在线时间
1465 小时
注册时间
2012-6-6
帖子
349
5
发表于 2016-2-11 19:52:52 | 只看该作者
ruyu222 发表于 2016-2-5 18:31
这个我改过了 但是没有作用

全局搜索 @actor_sprites = Array.new(4) { Sprite_Battler.new(@viewport1) }  把4改成6试试吧
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-17 07:30

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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