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

Project1

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

[已经过期] MOG_Adv_Battle_Hud + Yanfly Combat Log 两个冲突问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
189 小时
注册时间
2013-1-26
帖子
72
跳转到指定楼层
1
发表于 2013-9-13 18:51:22 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 ninesound 于 2013-9-13 19:07 编辑






如上面图片
装了战斗纪录器之后

按下去选项的字不会消失
该如何解决……?


失礼了
已经附上脚本
这是战斗纪录器的
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Combat Log Display v1.02
  4. # -- Last Updated: 2012.01.24
  5. # -- Level: Easy
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-CombatLogDisplay"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.24 - Bug Fixed: Confirm window crash with Battle Command List.
  15. # 2012.01.16 - Prevented subsequent line inserts.
  16. # 2011.12.10 - Started Script and Finished.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # Sometimes text appears way too fast in the battle system or sometimes players
  22. # may miss what kind of information was delivered on-screen. For times like
  23. # that, being able to access the combat log would be important. The combat log
  24. # records all of the text that appears in the battle log window at the top.
  25. # The player can access the combat log display any time during action selection
  26. # phase. Sometimes, players can even review over the combat log to try and
  27. # figure out any kinds of patterns enemies may even have.
  28. #
  29. #==============================================================================
  30. # ▼ Instructions
  31. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  32. # To install this script, open up your script editor and copy/paste this script
  33. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  34. #
  35. #==============================================================================
  36. # ▼ Compatibility
  37. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  38. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  39. # it will run with RPG Maker VX without adjusting.
  40. #
  41. #==============================================================================

  42. module YEA
  43.   module COMBAT_LOG
  44.    
  45.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  46.     # - Combat Log Settings -
  47.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  48.     # Adjust the settings here to modify how the combat log works for your
  49.     # game. You can change the command name and extra text that gets fitted
  50.     # into the combat log over time. If you don't want specific text to appear,
  51.     # just set the text to "" and nothing will show.
  52.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  53.     COMMAND_NAME      = "Log"          # Command list name.
  54.     LINE_COLOUR       = 0              # Line colour for separators.
  55.     LINE_COLOUR_ALPHA = 48             # Opacity of the line colour.
  56.     TEXT_BATTLE_START = "\\c[4]Battle Start!"           # Battle start text.
  57.     TEXT_TURN_NUMBER  = "\\c[4]Turn Number: \\c[6]%d"   # Turn number text.
  58.    
  59.   end # COMBAT_LOG
  60. end # YEA

  61. #==============================================================================
  62. # ▼ Editting anything past this point may potentially result in causing
  63. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  64. # halitosis so edit at your own risk.
  65. #==============================================================================

  66. #==============================================================================
  67. # ■ Window_BattleLog
  68. #==============================================================================

  69. class Window_BattleLog < Window_Selectable
  70.   
  71.   #--------------------------------------------------------------------------
  72.   # new method: combatlog_window=
  73.   #--------------------------------------------------------------------------
  74.   def combatlog_window=(window)
  75.     @combatlog_window = window
  76.   end
  77.   
  78.   #--------------------------------------------------------------------------
  79.   # new method: combatlog
  80.   #--------------------------------------------------------------------------
  81.   def combatlog(text)
  82.     return if @combatlog_window.nil?
  83.     return if text == ""
  84.     @combatlog_window.add_line(text)
  85.   end
  86.   
  87.   #--------------------------------------------------------------------------
  88.   # alias method: add_text
  89.   #--------------------------------------------------------------------------
  90.   alias window_battlelog_add_text_cld add_text
  91.   def add_text(text)
  92.     combatlog(text)
  93.     window_battlelog_add_text_cld(text)
  94.   end
  95.   
  96.   #--------------------------------------------------------------------------
  97.   # alias method: replace_text
  98.   #--------------------------------------------------------------------------
  99.   alias window_battlelog_replace_text_cld replace_text
  100.   def replace_text(text)
  101.     combatlog(text)
  102.     window_battlelog_replace_text_cld(text)
  103.   end
  104.   
  105.   #--------------------------------------------------------------------------
  106.   # Start Ace Battle Engine Compatibility
  107.   #--------------------------------------------------------------------------
  108.   if $imported["YEA-BattleEngine"]
  109.   
  110.   #--------------------------------------------------------------------------
  111.   # alias method: display_current_state
  112.   #--------------------------------------------------------------------------
  113.   alias window_battlelog_display_current_state_cld display_current_state
  114.   def display_current_state(subject)
  115.     window_battlelog_display_current_state_cld(subject)
  116.     return if YEA::BATTLE::MSG_CURRENT_STATE
  117.     return if subject.most_important_state_text.empty?
  118.     combatlog(subject.name + subject.most_important_state_text)
  119.   end
  120.   
  121.   #--------------------------------------------------------------------------
  122.   # alias method: display_use_item
  123.   #--------------------------------------------------------------------------
  124.   alias window_battlelog_display_use_item_cld display_use_item
  125.   def display_use_item(subject, item)
  126.     window_battlelog_display_use_item_cld(subject, item)
  127.     return if YEA::BATTLE::MSG_CURRENT_ACTION
  128.     if item.is_a?(RPG::Skill)
  129.       combatlog(subject.name + item.message1)
  130.       unless item.message2.empty?
  131.         combatlog(item.message2)
  132.       end
  133.     else
  134.       combatlog(sprintf(Vocab::UseItem, subject.name, item.name))
  135.     end
  136.   end
  137.   
  138.   #--------------------------------------------------------------------------
  139.   # alias method: display_counter
  140.   #--------------------------------------------------------------------------
  141.   alias window_battlelog_display_counter_cld display_counter
  142.   def display_counter(target, item)
  143.     window_battlelog_display_counter_cld(target, item)
  144.     return if YEA::BATTLE::MSG_COUNTERATTACK
  145.     combatlog(sprintf(Vocab::CounterAttack, target.name))
  146.   end
  147.   
  148.   #--------------------------------------------------------------------------
  149.   # alias method: display_reflection
  150.   #--------------------------------------------------------------------------
  151.   alias window_battlelog_display_reflection_cld display_reflection
  152.   def display_reflection(target, item)
  153.     window_battlelog_display_reflection_cld(target, item)
  154.     return if YEA::BATTLE::MSG_REFLECT_MAGIC
  155.     combatlog(sprintf(Vocab::MagicReflection, target.name))
  156.   end
  157.   
  158.   #--------------------------------------------------------------------------
  159.   # alias method: display_substitute
  160.   #--------------------------------------------------------------------------
  161.   alias window_battlelog_display_substitute_cld display_substitute
  162.   def display_substitute(substitute, target)
  163.     window_battlelog_display_substitute_cld(substitute, target)
  164.     return if YEA::BATTLE::MSG_SUBSTITUTE_HIT
  165.     combatlog(sprintf(Vocab::Substitute, substitute.name, target.name))
  166.   end
  167.   
  168.   #--------------------------------------------------------------------------
  169.   # alias method: display_failure
  170.   #--------------------------------------------------------------------------
  171.   alias window_battlelog_display_failure_cld display_failure
  172.   def display_failure(target, item)
  173.     window_battlelog_display_failure_cld(target, item)
  174.     return if YEA::BATTLE::MSG_FAILURE_HIT
  175.     if target.result.hit? && !target.result.success
  176.       combatlog(sprintf(Vocab::ActionFailure, target.name))
  177.     end
  178.   end
  179.   
  180.   #--------------------------------------------------------------------------
  181.   # alias method: display_critical
  182.   #--------------------------------------------------------------------------
  183.   alias window_battlelog_display_critical_cld display_critical
  184.   def display_critical(target, item)
  185.     window_battlelog_display_critical_cld(target, item)
  186.     return if YEA::BATTLE::MSG_CRITICAL_HIT
  187.     if target.result.critical
  188.       text = target.actor? ? Vocab::CriticalToActor : Vocab::CriticalToEnemy
  189.       combatlog(text)
  190.     end
  191.   end
  192.   
  193.   #--------------------------------------------------------------------------
  194.   # alias method: display_miss
  195.   #--------------------------------------------------------------------------
  196.   alias window_battlelog_display_miss_cld display_miss
  197.   def display_miss(target, item)
  198.     window_battlelog_display_miss_cld(target, item)
  199.     return if YEA::BATTLE::MSG_HIT_MISSED
  200.     if !item || item.physical?
  201.       fmt = target.actor? ? Vocab::ActorNoHit : Vocab::EnemyNoHit
  202.     else
  203.       fmt = Vocab::ActionFailure
  204.     end
  205.     combatlog(sprintf(fmt, target.name))
  206.   end
  207.   
  208.   #--------------------------------------------------------------------------
  209.   # alias method: display_evasion
  210.   #--------------------------------------------------------------------------
  211.   alias window_battlelog_display_evasion_cld display_evasion
  212.   def display_evasion(target, item)
  213.     window_battlelog_display_evasion_cld(target, item)
  214.     return if YEA::BATTLE::MSG_EVASION
  215.     if !item || item.physical?
  216.       fmt = Vocab::Evasion
  217.     else
  218.       fmt = Vocab::MagicEvasion
  219.     end
  220.     combatlog(sprintf(fmt, target.name))
  221.   end
  222.   
  223.   #--------------------------------------------------------------------------
  224.   # alias method: display_hp_damage
  225.   #--------------------------------------------------------------------------
  226.   alias window_battlelog_display_hp_damage_cld display_hp_damage
  227.   def display_hp_damage(target, item)
  228.     window_battlelog_display_hp_damage_cld(target, item)
  229.     return if YEA::BATTLE::MSG_HP_DAMAGE
  230.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  231.     combatlog(target.result.hp_damage_text)
  232.   end
  233.   
  234.   #--------------------------------------------------------------------------
  235.   # alias method: display_mp_damage
  236.   #--------------------------------------------------------------------------
  237.   alias window_battlelog_display_mp_damage_cld display_mp_damage
  238.   def display_mp_damage(target, item)
  239.     window_battlelog_display_mp_damage_cld(target, item)
  240.     return if YEA::BATTLE::MSG_MP_DAMAGE
  241.     combatlog(target.result.mp_damage_text)
  242.   end
  243.   
  244.   #--------------------------------------------------------------------------
  245.   # alias method: display_tp_damage
  246.   #--------------------------------------------------------------------------
  247.   alias window_battlelog_display_tp_damage_cld display_tp_damage
  248.   def display_tp_damage(target, item)
  249.     window_battlelog_display_tp_damage_cld(target, item)
  250.     return if YEA::BATTLE::MSG_TP_DAMAGE
  251.     combatlog(target.result.tp_damage_text)
  252.   end
  253.   
  254.   #--------------------------------------------------------------------------
  255.   # alias method: display_added_states
  256.   #--------------------------------------------------------------------------
  257.   alias window_battlelog_display_added_states_cld display_added_states
  258.   def display_added_states(target)
  259.     window_battlelog_display_added_states_cld(target)
  260.     return if YEA::BATTLE::MSG_ADDED_STATES
  261.     target.result.added_state_objects.each do |state|
  262.       state_msg = target.actor? ? state.message1 : state.message2
  263.       next if state_msg.empty?
  264.       combatlog(target.name + state_msg)
  265.     end
  266.   end
  267.   
  268.   #--------------------------------------------------------------------------
  269.   # alias method: display_removed_states
  270.   #--------------------------------------------------------------------------
  271.   alias window_battlelog_display_removed_states_cld display_removed_states
  272.   def display_removed_states(target)
  273.     window_battlelog_display_removed_states_cld(target)
  274.     return if YEA::BATTLE::MSG_REMOVED_STATES
  275.     target.result.removed_state_objects.each do |state|
  276.       next if state.message4.empty?
  277.       combatlog(target.name + state.message4)
  278.     end
  279.   end
  280.   
  281.   #--------------------------------------------------------------------------
  282.   # alias method: display_buffs
  283.   #--------------------------------------------------------------------------
  284.   alias window_battlelog_display_buffs_cld display_buffs
  285.   def display_buffs(target, buffs, fmt)
  286.     window_battlelog_display_buffs_cld(target, buffs, fmt)
  287.     return if YEA::BATTLE::MSG_CHANGED_BUFFS
  288.     buffs.each do |param_id|
  289.       combatlog(sprintf(fmt, target.name, Vocab::param(param_id)))
  290.     end
  291.   end
  292.   
  293.   #--------------------------------------------------------------------------
  294.   # End Ace Battle Engine Compatibility
  295.   #--------------------------------------------------------------------------
  296.   end # $imported["YEA-BattleEngine"]
  297.   
  298. end # Window_BattleLog

  299. #==============================================================================
  300. # ■ Window_CombatLog
  301. #==============================================================================

  302. class Window_CombatLog < Window_Selectable
  303.   
  304.   #--------------------------------------------------------------------------
  305.   # initialize
  306.   #--------------------------------------------------------------------------
  307.   def initialize
  308.     @data = []
  309.     super(0, 0, Graphics.width, Graphics.height-120)
  310.     deactivate
  311.     hide
  312.   end
  313.   
  314.   #--------------------------------------------------------------------------
  315.   # add_line
  316.   #--------------------------------------------------------------------------
  317.   def add_line(text)
  318.     return if text == "-" && @data[@data.size - 1] == "-"
  319.     @data.push(text)
  320.     @data.delete_at(0) while @data.size > 50 #
  321.   end
  322.   
  323.   #--------------------------------------------------------------------------
  324.   # refresh
  325.   #--------------------------------------------------------------------------
  326.   def refresh
  327.     create_contents
  328.     draw_all_items
  329.   end
  330.   
  331.   #--------------------------------------------------------------------------
  332.   # item_max
  333.   #--------------------------------------------------------------------------
  334.   def item_max; return @data.size; end
  335.   
  336.   #--------------------------------------------------------------------------
  337.   # draw_item
  338.   #--------------------------------------------------------------------------
  339.   def draw_item(index)
  340.     text = @data[index]
  341.     return if text.nil?
  342.     rect = item_rect_for_text(index)
  343.     if text == "-"
  344.       draw_horz_line(rect.y)
  345.     else
  346.       draw_text_ex(rect.x, rect.y, text)
  347.     end
  348.   end
  349.   
  350.   #--------------------------------------------------------------------------
  351.   # draw_horz_line
  352.   #--------------------------------------------------------------------------
  353.   def draw_horz_line(y)
  354.     line_y = y + line_height / 2 - 1
  355.     contents.fill_rect(4, line_y, contents_width-8, 2, line_colour)
  356.   end
  357.   
  358.   #--------------------------------------------------------------------------
  359.   # line_colour
  360.   #--------------------------------------------------------------------------
  361.   def line_colour
  362.     colour = text_color(YEA::COMBAT_LOG::LINE_COLOUR)
  363.     colour.alpha = YEA::COMBAT_LOG::LINE_COLOUR_ALPHA
  364.     return colour
  365.   end
  366.   
  367.   #--------------------------------------------------------------------------
  368.   # show
  369.   #--------------------------------------------------------------------------
  370.   def show
  371.     super
  372.     refresh
  373.     activate
  374.     select([item_max-1, 0].max)
  375.   end
  376.   
  377.   #--------------------------------------------------------------------------
  378.   # hide
  379.   #--------------------------------------------------------------------------
  380.   def hide
  381.     deactivate
  382.     super
  383.   end
  384.   
  385. end # Window_CombatLog

  386. #==============================================================================
  387. # ■ Window_PartyCommand
  388. #==============================================================================

  389. class Window_PartyCommand < Window_Command
  390.   
  391.   #--------------------------------------------------------------------------
  392.   # alias method: make_command_list
  393.   #--------------------------------------------------------------------------
  394.   alias window_partycommand_make_command_list_cld make_command_list
  395.   def make_command_list
  396.     window_partycommand_make_command_list_cld
  397.     return if $imported["YEA-BattleCommandList"]
  398.     add_command(YEA::COMBAT_LOG::COMMAND_NAME, :combatlog)
  399.   end
  400.   
  401. end # Window_PartyCommand

  402. #==============================================================================
  403. # ■ Scene_Battle
  404. #==============================================================================

  405. class Scene_Battle < Scene_Base
  406.   
  407.   #--------------------------------------------------------------------------
  408.   # alias method: create_log_window
  409.   #--------------------------------------------------------------------------
  410.   alias scene_battle_create_log_window_cld create_log_window
  411.   def create_log_window
  412.     scene_battle_create_log_window_cld
  413.     create_combatlog_window
  414.   end
  415.   
  416.   #--------------------------------------------------------------------------
  417.   # new method: create_combatlog_window
  418.   #--------------------------------------------------------------------------
  419.   def create_combatlog_window
  420.     @combatlog_window = Window_CombatLog.new
  421.     @log_window.combatlog_window = @combatlog_window
  422.     @combatlog_window.set_handler(:cancel, method(:close_combatlog))
  423.     @combatlog_window.add_line("-")
  424.     @combatlog_window.add_line(YEA::COMBAT_LOG::TEXT_BATTLE_START)
  425.     @combatlog_window.add_line("-")
  426.   end
  427.   
  428.   #--------------------------------------------------------------------------
  429.   # new method: open_combatlog
  430.   #--------------------------------------------------------------------------
  431.   def open_combatlog
  432.     @combatlog_window.show
  433.   end
  434.   
  435.   #--------------------------------------------------------------------------
  436.   # new method: close_combatlog
  437.   #--------------------------------------------------------------------------
  438.   def close_combatlog
  439.     @combatlog_window.hide
  440.     if $imported["YEA-BattleCommandList"]
  441.       if !@confirm_command_window.nil? && @confirm_command_window.visible
  442.         @confirm_command_window.activate
  443.       else
  444.         @party_command_window.activate
  445.       end
  446.     else
  447.       @party_command_window.activate
  448.     end
  449.   end
  450.   
  451.   #--------------------------------------------------------------------------
  452.   # alias method: create_party_command_window
  453.   #--------------------------------------------------------------------------
  454.   alias create_party_command_window_cld create_party_command_window
  455.   def create_party_command_window
  456.     create_party_command_window_cld
  457.     @party_command_window.set_handler(:combatlog, method(:open_combatlog))
  458.   end
  459.   
  460.   #--------------------------------------------------------------------------
  461.   # alias method: turn_start
  462.   #--------------------------------------------------------------------------
  463.   alias scene_battle_turn_start_cld turn_start
  464.   def turn_start
  465.     scene_battle_turn_start_cld
  466.     @combatlog_window.add_line("-")
  467.     text = sprintf(YEA::COMBAT_LOG::TEXT_TURN_NUMBER, $game_troop.turn_count)
  468.     @combatlog_window.add_line(text)
  469.     @combatlog_window.add_line("-")
  470.   end
  471.   
  472.   #--------------------------------------------------------------------------
  473.   # alias method: execute_action
  474.   #--------------------------------------------------------------------------
  475.   alias scene_battle_execute_action_cld execute_action
  476.   def execute_action
  477.     @combatlog_window.add_line("-")
  478.     scene_battle_execute_action_cld
  479.     @combatlog_window.add_line("-")
  480.   end
  481.   
  482.   #--------------------------------------------------------------------------
  483.   # alias method: turn_end
  484.   #--------------------------------------------------------------------------
  485.   alias scene_battle_turn_end_cld turn_end
  486.   def turn_end
  487.     scene_battle_turn_end_cld
  488.     @combatlog_window.add_line("-")
  489.   end
  490.   
  491. end # Scene_Battle

  492. #==============================================================================
  493. #
  494. # ▼ End of File
  495. #
  496. #==============================================================================
复制代码
这是MOG的
  1. #==============================================================================
  2. # ■ BATTLE HUD SETTING
  3. #==============================================================================
  4. module MOG_BATTLE_HUD
  5.   # Ativar Battlers dos personagens em faces, deixe desativado em caso de haver
  6.   # outros scripts que usam battlers dos personagens em seu projeto.
  7.   BATTLER_FACE_ENABLE = true
  8.   #Definição geral da posição da HUD.
  9.   HUD_POSITION = [5,315]
  10.   #Definição da posição da face
  11.   FACE_POSITION = [60,30]
  12.   #Definição da posição do numero de HP.
  13.   HP_NUMBER_POSITION = [85,28]
  14.   #Definição da posição do medidor de HP.
  15.   HP_METER_POSITION = [27,37]
  16.   #Definição da posição do numero de MP.
  17.   MP_NUMBER_POSITION = [101,46]
  18.   #Definição da posição do medidor de MP.
  19.   MP_METER_POSITION = [43,55]  
  20.   #Definição da posição do numero de TP.
  21.   TP_NUMBER_POSITION = [85,64]
  22.   #Definição da posição do medidor de TP.
  23.   TP_METER_POSITION = [27,73]   
  24.   #Definição da posição das condições
  25.   STATES_POSITION = [5,1]
  26.   #Definição da posição do comando de batalha.
  27.   COMMAND_POSITION = [0,-145]  
  28.   #Definição da posição do espaço da HUD entre os membros do grupo.
  29.   MEMBERS_SPACE = [136,0]
  30.   #Definição da prioridade da HUD.
  31.   BATTLE_HUD_Z = 0
  32.   #Definição da velocidade de animação dos medidores.
  33.   METER_FLOW_SPEED = 2
  34.   #Ativa o layout mais limpo nas janelas de item e skill.
  35.   ITEM_SKILL_WINDOWS_CLEAN_STYLE = true
  36.   #Definição da opacidade das janelas.
  37.   ITEM_SKILL_WINDOW_OPACITY = 0
  38.   
  39. end

  40. #==============================================================================
  41. # ■ Game Temp
  42. #==============================================================================
  43. class Game_Temp
  44.   
  45.   attr_accessor :cache_battle_hud
  46.   
  47.   #--------------------------------------------------------------------------
  48.   # ● Initialize
  49.   #--------------------------------------------------------------------------   
  50.   alias mog_battle_hud_initialize initialize
  51.   def initialize
  52.       mog_battle_hud_initialize
  53.       pre_cache_battle_hud
  54.   end
  55.   
  56.   #--------------------------------------------------------------------------
  57.   # ● Pre Cache Battle Hud
  58.   #--------------------------------------------------------------------------  
  59.   def pre_cache_battle_hud
  60.       @cache_battle_hud = []
  61.       @cache_battle_hud.push(Cache.system("Battle_Hud_Number"))
  62.       @cache_battle_hud.push(Cache.system("Battle_Hud_Meter"))
  63.       @cache_battle_hud.push(Cache.system("Iconset"))
  64.       @cache_battle_hud.push(Cache.system("Battle_Hud_Layout"))
  65.   end
  66.   
  67. end

  68. #==============================================================================
  69. # ■ Battle_Hud
  70. #==============================================================================
  71. class Battle_Hud
  72.   include MOG_BATTLE_HUD
  73.   
  74.   #--------------------------------------------------------------------------
  75.   # ● Initialize
  76.   #--------------------------------------------------------------------------   
  77.   def initialize(actor)      
  78.       [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  79.       @x = HUD_POSITION[0] + (MEMBERS_SPACE[0] * @actor.index)
  80.       @y = HUD_POSITION[1] + (MEMBERS_SPACE[1] * @actor.index)
  81.       @flow_speed = 0
  82.       pre_cache
  83.       create_layout
  84.       create_hp_number
  85.       create_hp_meter
  86.       create_mp_number
  87.       create_mp_meter
  88.       create_tp_number
  89.       create_tp_meter
  90.       create_states
  91.   end
  92.   
  93.   #--------------------------------------------------------------------------
  94.   # ● Pre Cache
  95.   #--------------------------------------------------------------------------      
  96.   def pre_cache
  97.       $game_temp.pre_cache_battle_hud
  98.       [url=home.php?mod=space&uid=27178]@Number[/url] = $game_temp.cache_battle_hud[0]
  99.       @number_cw = @number.width / 10
  100.       @number_ch = @number.height / 4
  101.       @meter = $game_temp.cache_battle_hud[1]
  102.       @meter_cw = @meter.width / 3
  103.       @meter_ch = @meter.height / 3
  104.       @icon = $game_temp.cache_battle_hud[2]
  105.   end
  106.   
  107.   #--------------------------------------------------------------------------
  108.   # ● Create Layout
  109.   #--------------------------------------------------------------------------      
  110.   def create_layout
  111.       @layout = Sprite.new
  112.       @layout.bitmap = $game_temp.cache_battle_hud[3]
  113.       @layout.z = BATTLE_HUD_Z
  114.       @layout.x = @x
  115.       @layout.y = @y
  116.   end
  117.   
  118.   #--------------------------------------------------------------------------
  119.   # ● Create HP Number
  120.   #--------------------------------------------------------------------------        
  121.   def create_hp_number
  122.       @hp = @actor.hp
  123.       @hp_old = @actor.hp
  124.       @hp_ref = @hp_old
  125.       @hp_refresh = false
  126.       @hp_number = Sprite.new
  127.       @hp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
  128.       @hp_number.z = BATTLE_HUD_Z + 2
  129.       @hp_number.x = @x + HP_NUMBER_POSITION[0]
  130.       @hp_number.y = @y + HP_NUMBER_POSITION[1]
  131.       refresh_hp_number
  132.   end
  133.   
  134.   #--------------------------------------------------------------------------
  135.   # ● Create HP Meter
  136.   #--------------------------------------------------------------------------      
  137.   def create_hp_meter
  138.       @hp_meter = Sprite.new
  139.       @hp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  140.       @hp_meter.z =  BATTLE_HUD_Z + 1
  141.       @hp_meter.x = @x + HP_METER_POSITION[0]
  142.       @hp_meter.y = @y + HP_METER_POSITION[1]
  143.       @hp_flow = rand(@meter_cw * 2)
  144.       @hp_width_old = @meter_cw * @actor.hp / @actor.mhp
  145.       hp_flow_update
  146.   end  
  147.   
  148.   #--------------------------------------------------------------------------
  149.   # ● Hp Flow Update
  150.   #--------------------------------------------------------------------------
  151.   def hp_flow_update
  152.       @hp_meter.bitmap.clear
  153.       hp_width = @meter_cw * @actor.hp / @actor.mhp
  154.       hp_src_rect = Rect.new(@hp_flow, 0,hp_width, @meter_ch)
  155.       @hp_meter.bitmap.blt(0,0, @meter, hp_src_rect)
  156.       @hp_flow += METER_FLOW_SPEED
  157.       @hp_flow = 0 if @hp_flow >=  @meter_cw * 2      
  158.   end
  159.    
  160.   #--------------------------------------------------------------------------
  161.   # ● Execute Damage Flow
  162.   #--------------------------------------------------------------------------
  163.   def execute_damage_flow(hp_width)
  164.      n = (@hp_width_old - hp_width).abs * 3 / 100
  165.      damage_flow = [[n, 2].min,0.5].max
  166.      @hp_width_old -= damage_flow         
  167.      @hp_width_old = hp_width if @hp_width_old < hp_width
  168.      src_rect_old = Rect.new(@hp_flow, @meter_ch * 3,@hp_width_old, @meter_ch)
  169.      @hp_meter.bitmap.blt(0,0, @meter, src_rect_old)      
  170.   end  

  171.   #--------------------------------------------------------------------------
  172.   # ● Update HP Number
  173.   #--------------------------------------------------------------------------      
  174.   def update_hp_number
  175.       @hp_refresh = true
  176.       n =  2 * (@actor.hp - @hp_old).abs / 100
  177.       hp_ref = [[n, 100].min,1].max
  178.       if @hp_old < @actor.hp
  179.           @hp += hp_ref     
  180.           if @hp >= @actor.hp
  181.              @hp_old = @actor.hp
  182.              @hp = @actor.hp   
  183.              @hp_ref = 0
  184.           end              
  185.         elsif @hp_old > @actor.hp   
  186.            @hp -= hp_ref               
  187.            if @hp <= @actor.hp
  188.               @hp_old = @actor.hp
  189.               @hp = @actor.hp   
  190.               @hp_ref = 0
  191.            end            
  192.         end         
  193.   end  
  194.   
  195.   #--------------------------------------------------------------------------
  196.   # ● Refresh HP Number
  197.   #--------------------------------------------------------------------------      
  198.   def refresh_hp_number
  199.       @flow_speed = METER_FLOW_SPEED
  200.       @hp_number.bitmap.clear
  201.       number_value = @hp.abs.to_s.split(//)
  202.       hp_color = @hp < @actor.mhp * 30 / 100 ? @number_ch : 0
  203.       center_x = 0
  204.       for r in 0..number_value.size - 1         
  205.          number_value_abs = number_value[r].to_i
  206.          src_rect = Rect.new(@number_cw * number_value_abs, hp_color, @number_cw, @number_ch)
  207.          @hp_number.bitmap.blt((@number_cw + 1) *  r, 0, @number, src_rect)
  208.          center_x += 1
  209.       end
  210.       @hp_number.x = @x + HP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
  211.       @hp_refresh = false if @hp == @actor.hp      
  212.   end  
  213.   
  214.   #--------------------------------------------------------------------------
  215.   # ● Create MP Number
  216.   #--------------------------------------------------------------------------        
  217.   def create_mp_number
  218.       @mp = @actor.mp
  219.       @mp_old = @actor.mp
  220.       @mp_ref = @mp_old
  221.       @mp_refresh = false
  222.       @mp_number = Sprite.new
  223.       @mp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
  224.       @mp_number.z = BATTLE_HUD_Z + 2
  225.       @mp_number.x = @x + MP_NUMBER_POSITION[0]
  226.       @mp_number.y = @y + MP_NUMBER_POSITION[1]
  227.       refresh_mp_number
  228.   end
  229.   
  230.   #--------------------------------------------------------------------------
  231.   # ● Create MP Meter
  232.   #--------------------------------------------------------------------------      
  233.   def create_mp_meter
  234.       @mp_meter = Sprite.new
  235.       @mp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  236.       @mp_meter.z =  BATTLE_HUD_Z + 1
  237.       @mp_meter.x = @x + MP_METER_POSITION[0]
  238.       @mp_meter.y = @y + MP_METER_POSITION[1]
  239.       @mp_flow = rand(@meter_cw * 2)
  240.       @mp_width_old = @meter_cw * @actor.mp / @actor.mmp rescue 0
  241.       mp_flow_update
  242.   end  
  243.   
  244.   #--------------------------------------------------------------------------
  245.   # ● Mp Flow Update
  246.   #--------------------------------------------------------------------------
  247.   def mp_flow_update
  248.       return if @actor.mmp == 0
  249.       @mp_meter.bitmap.clear
  250.       mp_width = @meter_cw * @actor.mp / @actor.mmp rescue 0
  251.       src_rect = Rect.new(@mp_flow, @meter_ch,mp_width, @meter_ch)
  252.       @mp_meter.bitmap.blt(0,0, @meter, src_rect)
  253.       @mp_flow += METER_FLOW_SPEED
  254.       @mp_flow = 0 if @mp_flow >=  @meter_cw * 2      
  255.     end
  256.    
  257.   #--------------------------------------------------------------------------
  258.   # ● Update MP Number
  259.   #--------------------------------------------------------------------------      
  260.   def update_mp_number
  261.       @mp_refresh = true
  262.       n =  2 * (@actor.mp - @mp_old).abs / 100
  263.       mp_ref = [[n, 100].min,1].max
  264.       if @mp_old < @actor.mp
  265.           @mp += mp_ref     
  266.           if @mp >= @actor.mp
  267.              @mp_old = @actor.mp
  268.              @mp = @actor.mp   
  269.              @mp_ref = 0
  270.           end              
  271.         elsif @mp_old > @actor.mp   
  272.            @mp -= mp_ref               
  273.            if @mp <= @actor.mp
  274.               @mp_old = @actor.mp
  275.               @mp = @actor.mp   
  276.               @mp_ref = 0
  277.            end            
  278.         end         
  279.   end  
  280.   
  281.   #--------------------------------------------------------------------------
  282.   # ● Refresh MP Number
  283.   #--------------------------------------------------------------------------      
  284.   def refresh_mp_number
  285.       @flow_speed = METER_FLOW_SPEED
  286.       @mp_number.bitmap.clear
  287.       number_value = @mp.abs.to_s.split(//)
  288.       center_x = 0
  289.       for r in 0..number_value.size - 1         
  290.          number_value_abs = number_value[r].to_i
  291.          src_rect = Rect.new(@number_cw * number_value_abs, @number_ch * 2, @number_cw, @number_ch)
  292.          @mp_number.bitmap.blt((@number_cw + 1) *  r, 0, @number, src_rect)
  293.          center_x += 1
  294.       end
  295.       @mp_number.x = @x + MP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
  296.       @mp_refresh = false if @mp == @actor.mp      
  297.   end  
  298.   
  299.   #--------------------------------------------------------------------------
  300.   # ● Create TP Number
  301.   #--------------------------------------------------------------------------        
  302.   def create_tp_number
  303.       @tp = @actor.tp
  304.       @tp_old = @actor.tp
  305.       @tp_ref = @tp_old
  306.       @tp_refresh = false
  307.       @tp_number = Sprite.new
  308.       @tp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
  309.       @tp_number.z = BATTLE_HUD_Z + 2
  310.       @tp_number.x = @x + TP_NUMBER_POSITION[0]
  311.       @tp_number.y = @y + TP_NUMBER_POSITION[1]
  312.       refresh_tp_number
  313.   end
  314.   
  315.   #--------------------------------------------------------------------------
  316.   # ● Create TP Meter
  317.   #--------------------------------------------------------------------------      
  318.   def create_tp_meter
  319.       @tp_meter = Sprite.new
  320.       @tp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  321.       @tp_meter.z =  BATTLE_HUD_Z + 1
  322.       @tp_meter.x = @x + TP_METER_POSITION[0]
  323.       @tp_meter.y = @y + TP_METER_POSITION[1]
  324.       @tp_flow = rand(@meter_cw * 2)
  325.       @tp_width_old = @meter_cw * @actor.tp / @actor.max_tp rescue 0
  326.       tp_flow_update
  327.   end  
  328.   
  329.   #--------------------------------------------------------------------------
  330.   # ● TP Flow Update
  331.   #--------------------------------------------------------------------------
  332.   def tp_flow_update
  333.       return if @actor.max_tp == 0
  334.       @tp_meter.bitmap.clear
  335.       tp_width = @meter_cw * @actor.tp / @actor.max_tp rescue 0
  336.       src_rect = Rect.new(@tp_flow, @meter_ch * 2,tp_width, @meter_ch)
  337.       @tp_meter.bitmap.blt(0,0, @meter, src_rect)
  338.       @tp_flow += METER_FLOW_SPEED
  339.       @tp_flow = 0 if @tp_flow >=  @meter_cw * 2      
  340.   end
  341.    
  342.   #--------------------------------------------------------------------------
  343.   # ● Update TP Number
  344.   #--------------------------------------------------------------------------      
  345.   def update_tp_number
  346.       @tp_refresh = true
  347.       n =  2 * (@actor.tp - @tp_old).abs / 100
  348.       tp_ref = [[n, 100].min,1].max
  349.       if @tp_old < @actor.tp
  350.           @tp += tp_ref     
  351.           if @tp >= @actor.tp
  352.              @tp_old = @actor.tp
  353.              @tp = @actor.tp   
  354.              @tp_ref = 0
  355.           end              
  356.         elsif @tp_old > @actor.tp   
  357.            @tp -= tp_ref               
  358.            if @tp <= @actor.tp
  359.               @tp_old = @actor.tp
  360.               @tp = @actor.tp   
  361.               @tp_ref = 0
  362.            end           
  363.          end            
  364.   end      
  365.    
  366.   #--------------------------------------------------------------------------
  367.   # ● Refresh TP Number
  368.   #--------------------------------------------------------------------------      
  369.   def refresh_tp_number
  370.       @flow_speed = METER_FLOW_SPEED
  371.       @tp_number.bitmap.clear
  372.       number_value = @tp.truncate.to_s.split(//)
  373.       center_x = 0
  374.       for r in 0..number_value.size - 1        
  375.          number_value_abs = number_value[r].to_i
  376.          src_rect = Rect.new(@number_cw * number_value_abs, @number_ch * 3, @number_cw, @number_ch)
  377.          @tp_number.bitmap.blt((@number_cw + 1) *  r, 0, @number, src_rect)
  378.          center_x += 1
  379.       end
  380.       @tp_number.x = @x + TP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
  381.       @tp_refresh = false if @tp == @actor.tp
  382.   end   
  383.   
  384.   #--------------------------------------------------------------------------
  385.   # ● Create_States
  386.   #--------------------------------------------------------------------------      
  387.   def create_states
  388.       refresh_states
  389.       @status = Sprite.new
  390.       @status.bitmap = Bitmap.new(24,24)
  391.       @status.x = @x + STATES_POSITION[0]
  392.       @status.y = @y + STATES_POSITION[1]      
  393.       @status_flow = -24
  394.       @states_speed = 50
  395.       @status.z = BATTLE_HUD_Z + 2
  396.       @old_states = @actor.states
  397.       flow_states
  398.   end  
  399.   
  400.   #--------------------------------------------------------------------------
  401.   # ● Flow_Status
  402.   #--------------------------------------------------------------------------         
  403.   def flow_states
  404.       return if @actor.states.size == 0 and [email protected]
  405.       @states_speed = 0
  406.       @status.bitmap.clear
  407.       src_rect = Rect.new(@status_flow,0, 24,24)
  408.       @status.bitmap.blt(0,0, @actor_status, src_rect)
  409.       @status.visible = @actor.states.size == 0 ? false : true
  410.       @status_flow += 1
  411.       @status_flow = -24 if @status_flow >= @states_size - 24
  412.   end   
  413.   
  414.   #--------------------------------------------------------------------------
  415.   # ● Refresh States
  416.   #--------------------------------------------------------------------------        
  417.   def refresh_states
  418.       @old_states = @actor.states
  419.       @actor_status.dispose if @actor_status != nil
  420.       @states_size = @actor.states.size > 0 ? (48 * @actor.states.size) : 24
  421.       @actor_status = Bitmap.new(@states_size,24)
  422.       index = 0
  423.       for i in  @actor.states
  424.          rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
  425.          @actor_status.blt(48 * index , 0, @icon, rect)
  426.          index += 1
  427.       end
  428.   end  
  429.   
  430.   #--------------------------------------------------------------------------
  431.   # ● Dispose
  432.   #--------------------------------------------------------------------------   
  433.   def dispose
  434.       return if @layout == nil
  435.       @layout.dispose
  436.       @hp_number.bitmap.dispose
  437.       @hp_number.dispose
  438.       @hp_meter.bitmap.dispose
  439.       @hp_meter.dispose
  440.       @mp_number.bitmap.dispose
  441.       @mp_number.dispose
  442.       @mp_meter.bitmap.dispose
  443.       @mp_meter.dispose      
  444.       @tp_number.bitmap.dispose
  445.       @tp_number.dispose
  446.       @tp_meter.bitmap.dispose
  447.       @tp_meter.dispose
  448.       @status.bitmap.dispose
  449.       @status.dispose
  450.       @actor_status.dispose if @actor_status != nil
  451.       @layout = nil
  452.   end
  453.   
  454.   #--------------------------------------------------------------------------
  455.   # ● Update
  456.   #--------------------------------------------------------------------------   
  457.   def update
  458.       return if @meter == nil
  459.       update_hp_number if @hp_old != @actor.hp
  460.       refresh_hp_number if @hp_refresh
  461.       update_mp_number if @mp_old != @actor.mp
  462.       refresh_mp_number if @mp_refresh
  463.       update_tp_number if @tp_old != @actor.tp
  464.       refresh_tp_number if @tp_refresh
  465.       refresh_states if @old_states != @actor.states
  466.       @flow_speed += 1
  467.       if @flow_speed >= METER_FLOW_SPEED
  468.          @flow_speed = 0
  469.          hp_flow_update
  470.          tp_flow_update
  471.          mp_flow_update
  472.       end
  473.       flow_states
  474.   end
  475.   
  476. end

  477. #==============================================================================
  478. # ■ Game_System
  479. #==============================================================================
  480. class Game_System
  481.   
  482.   attr_accessor :battler_hud
  483.   
  484.   #--------------------------------------------------------------------------
  485.   # ● Initialize
  486.   #--------------------------------------------------------------------------   
  487.   alias mog_adv_battle_hud_initialize initialize
  488.   def initialize      
  489.       @battler_hud = false
  490.       mog_adv_battle_hud_initialize
  491.   end  
  492.   
  493. end

  494. #==============================================================================
  495. # ■ Spriteset Battle
  496. #==============================================================================
  497. class Spriteset_Battle
  498.   
  499.   #--------------------------------------------------------------------------
  500.   # ● Initialize
  501.   #--------------------------------------------------------------------------  
  502.   alias mog_battle_hud_initialize initialize
  503.   def initialize
  504.       mog_battle_hud_initialize
  505.       create_battle_hud      
  506.   end
  507.   
  508.   #--------------------------------------------------------------------------
  509.   # ● Create Battle Hud
  510.   #--------------------------------------------------------------------------   
  511.   def create_battle_hud
  512.       @battle_hud = []
  513.       for i in $game_party.battle_members
  514.           @battle_hud.push(Battle_Hud.new(i))
  515.       end
  516.   end
  517.   
  518.   #--------------------------------------------------------------------------
  519.   # ● Dispose
  520.   #--------------------------------------------------------------------------      
  521.   alias mog_battle_hud_dispose dispose
  522.   def dispose
  523.       mog_battle_hud_dispose
  524.       dispose_battle_hud
  525.   end  
  526.   
  527.   #--------------------------------------------------------------------------
  528.   # ● Dispose Battle Hud
  529.   #--------------------------------------------------------------------------        
  530.   def dispose_battle_hud
  531.       return if @battle_hud == nil
  532.       @battle_hud.each {|sprite| sprite.dispose }
  533.       @battle_hud = nil
  534.   end
  535.   
  536.   #--------------------------------------------------------------------------
  537.   # ● Update
  538.   #--------------------------------------------------------------------------        
  539.   alias mog_battle_hud_update update
  540.   def update
  541.       mog_battle_hud_update
  542.       update_battle_hud
  543.   end
  544.   
  545.   #--------------------------------------------------------------------------
  546.   # ● Update Battle Hud
  547.   #--------------------------------------------------------------------------         
  548.   def update_battle_hud
  549.       return if @battle_hud == nil
  550.       @battle_hud.each {|sprite| sprite.update }
  551.   end
  552.    
  553. end

  554. #==============================================================================
  555. # ■ Game_Actor
  556. #==============================================================================
  557. class Game_Actor < Game_Battler
  558.   include MOG_BATTLE_HUD
  559.    
  560.    attr_accessor :hud_x
  561.    attr_accessor :hud_y

  562.   #--------------------------------------------------------------------------
  563.   # ● HUD X
  564.   #--------------------------------------------------------------------------     
  565.   def hud_x
  566.       return HUD_POSITION[0] + (MEMBERS_SPACE[0] * index)
  567.   end
  568.   
  569.   #--------------------------------------------------------------------------
  570.   # ● HUD Y
  571.   #--------------------------------------------------------------------------   
  572.   def hud_y
  573.       return HUD_POSITION[1] + (MEMBERS_SPACE[1] * index)
  574.   end
  575.    
  576. end  

  577. #==============================================================================
  578. # ■ Scene Battle
  579. #==============================================================================
  580. class Scene_Battle < Scene_Base
  581.   
  582.   #--------------------------------------------------------------------------
  583.   # ● Create Party Command Window
  584.   #--------------------------------------------------------------------------   
  585.   alias mog_battle_hud_create_party_command_window create_party_command_window
  586.   def create_party_command_window
  587.       mog_battle_hud_create_party_command_window
  588.       set_party_window_position
  589.   end  
  590.   
  591.   #--------------------------------------------------------------------------
  592.   # ● Set Party Window Position
  593.   #--------------------------------------------------------------------------      
  594.   def set_party_window_position
  595.       @party_command_window.viewport = nil  
  596.       return if $mog_rgss3_at_system != nil
  597.       a_index = []
  598.       for actor in $game_party.alive_members
  599.           a_index = [actor.hud_x, actor.hud_y]
  600.           break
  601.       end
  602.       return if a_index.empty?
  603.       @party_command_window.x = MOG_BATTLE_HUD::COMMAND_POSITION[0] + a_index[0]
  604.       @party_command_window.y = MOG_BATTLE_HUD::COMMAND_POSITION[1] + a_index[1]      
  605.   end  
  606.   
  607.   #--------------------------------------------------------------------------
  608.   # ● Set Party Window Position
  609.   #--------------------------------------------------------------------------        
  610.   alias mog_battle_hud_start_party_command_selection start_party_command_selection
  611.   def start_party_command_selection
  612.       set_party_window_position
  613.       mog_battle_hud_start_party_command_selection
  614.   end  
  615.   
  616.   #--------------------------------------------------------------------------
  617.   # ● Update
  618.   #--------------------------------------------------------------------------  
  619.   alias mog_battle_hud_update_basic update_basic
  620.   def update_basic
  621.       mog_battle_hud_update_basic
  622.       update_command_window_visible
  623.   end  
  624.   
  625.   #--------------------------------------------------------------------------
  626.   # ● Update Command Window Visible
  627.   #--------------------------------------------------------------------------   
  628.   def update_command_window_visible
  629.       @status_window.visible = @status_window.active ? true : false
  630.       @actor_command_window.visible = @actor_command_window.active ? true : false
  631.       @skill_window.visible = @skill_window.active ? true : false
  632.       @item_window.visible = @item_window.active ? true : false      
  633.   end
  634.   
  635.   #--------------------------------------------------------------------------
  636.   # ● Start Actor Command Selection
  637.   #--------------------------------------------------------------------------   
  638.   alias mog_battle_hud_start_actor_command_selection start_actor_command_selection
  639.   def start_actor_command_selection
  640.       mog_battle_hud_start_actor_command_selection
  641.       @actor_command_window.viewport = nil
  642.       @actor_command_window.x = MOG_BATTLE_HUD::COMMAND_POSITION[0] + $game_party.members[BattleManager.actor.index].hud_x
  643.       @actor_command_window.y = MOG_BATTLE_HUD::COMMAND_POSITION[1] + $game_party.members[BattleManager.actor.index].hud_y
  644.       @party_command_window.x = @actor_command_window.x
  645.       @party_command_window.y = @actor_command_window.y  
  646.   end  

  647. end

  648. #==============================================================================
  649. # ■ Game_Actor
  650. #==============================================================================
  651. class Game_Actor < Game_Battler
  652.   include MOG_BATTLE_HUD
  653.   
  654.   attr_accessor :battler_face
  655.   attr_accessor :battler_face_name
  656.   attr_accessor :screen_x
  657.   attr_accessor :screen_y
  658.   attr_accessor :screen_z
  659.   
  660.   #--------------------------------------------------------------------------
  661.   # ● Initialize
  662.   #--------------------------------------------------------------------------
  663.   alias mog_battle_hud_initialize setup
  664.   def setup(actor_id)
  665.       mog_battle_hud_initialize(actor_id)
  666.       battler_sprite_setup
  667.   end  
  668.    
  669.   #--------------------------------------------------------------------------
  670.   # ● Battler Sprite Setup
  671.   #--------------------------------------------------------------------------  
  672.   def battler_sprite_setup
  673.       @battler_face = [0,0,0]
  674.       @battler_face_name = @name + "_Face"
  675.   end

  676.   if BATTLER_FACE_ENABLE
  677.   #--------------------------------------------------------------------------
  678.   # ● Use Sprite?
  679.   #--------------------------------------------------------------------------
  680.   def use_sprite?
  681.       return true
  682.   end
  683.   end
  684.   
  685. end

  686. #==============================================================================
  687. # ■ Sprite_Battler
  688. #==============================================================================
  689. class Sprite_Battler < Sprite_Base
  690.   include MOG_BATTLE_HUD
  691.   
  692.   #--------------------------------------------------------------------------
  693.   # ● Dispose
  694.   #--------------------------------------------------------------------------   
  695.   alias mog_battler_face_dispose dispose
  696.   def dispose
  697.       mog_battler_face_dispose
  698.       dispose_battler_face
  699.   end  
  700.   
  701.   #--------------------------------------------------------------------------
  702.   # ● Update
  703.   #--------------------------------------------------------------------------   
  704.   alias mog_battler_face_update update
  705.   def update
  706.       refresh_face_battler
  707.       mog_battler_face_update
  708.       update_battler_face
  709.   end
  710.    
  711.   #--------------------------------------------------------------------------
  712.   # ● Refresh Face Battler
  713.   #--------------------------------------------------------------------------     
  714.   def refresh_face_battler
  715.       return if @face_sprite != nil
  716.       return if @battler == nil
  717.       return if @battler.is_a?(Game_Enemy)
  718.       setup_battler_screen if @battler.screen_x == nil or $game_system.battler_hud
  719.       @face_sprite = Battler_Face_Sprite.new(self.viewport, @battler)
  720.   end  
  721.   
  722.   #--------------------------------------------------------------------------
  723.   # ● Setup Battler Screen
  724.   #--------------------------------------------------------------------------      
  725.   def setup_battler_screen
  726.       $game_system.battler_hud = true
  727.       @battler.screen_x = FACE_POSITION[0] + HUD_POSITION[0] + (MEMBERS_SPACE[0] * @battler.index)
  728.       @battler.screen_y = FACE_POSITION[1] + HUD_POSITION[1] + (MEMBERS_SPACE[1] * @battler.index)
  729.       @battler.screen_z = 103 if @battler.screen_z == nil
  730.   end  
  731.   
  732.   #--------------------------------------------------------------------------
  733.   # ● Dispose Battler Face
  734.   #--------------------------------------------------------------------------      
  735.   def dispose_battler_face
  736.       return if @face_sprite == nil
  737.       @face_sprite.dispose  
  738.   end
  739.   
  740.   #--------------------------------------------------------------------------
  741.   # ● Update Battler Face
  742.   #--------------------------------------------------------------------------      
  743.   def update_battler_face
  744.       return if @face_sprite == nil
  745.       @face_sprite.update_actor_battler
  746.   end  
  747.   
  748.   #--------------------------------------------------------------------------
  749.   # ● Update Posiion
  750.   #--------------------------------------------------------------------------         
  751.   alias mog_battler_face_update_position update_position
  752.   def update_position
  753.       mog_battler_face_update_position
  754.       update_face_z
  755.   end  
  756.   
  757.   #--------------------------------------------------------------------------
  758.   # ● Update Face Z
  759.   #--------------------------------------------------------------------------         
  760.   def update_face_z
  761.       return if @face_sprite == nil
  762.       @face_sprite.update_face_z(self.z)
  763.   end

  764.   #--------------------------------------------------------------------------
  765.   # ● Update Collapse
  766.   #--------------------------------------------------------------------------                          
  767.    alias mog_battle_hud_update_collapse update_collapse
  768.    def update_collapse
  769.        if face_can_cancel_method?
  770.          self.opacity = 255
  771.          self.visible = true
  772.          return
  773.       end
  774.        mog_battle_hud_update_collapse
  775.    end  
  776.    
  777.   #--------------------------------------------------------------------------
  778.   # ● Update Instant Collapse
  779.   #--------------------------------------------------------------------------                             
  780.    alias mog_battle_hud_update_instant_collapse update_instant_collapse
  781.    def update_instant_collapse
  782.       if face_can_cancel_method?
  783.          self.opacity = 255
  784.          self.visible = true
  785.          return
  786.       end
  787.        mog_battle_hud_update_instant_collapse
  788.    end  
  789.   
  790.   #--------------------------------------------------------------------------
  791.   # ● Init Visibility
  792.   #--------------------------------------------------------------------------                                
  793.   alias mog_battle_face_init_visibility init_visibility
  794.   def init_visibility
  795.       if face_can_cancel_method?
  796.          self.opacity = 255
  797.          self.visible = true
  798.          return
  799.       end
  800.       mog_battle_face_init_visibility
  801.   end
  802.    
  803.   #--------------------------------------------------------------------------
  804.   # ● Face Can Cancel Method
  805.   #--------------------------------------------------------------------------                                 
  806.   def face_can_cancel_method?
  807.       return false if !BATTLER_FACE_ENABLE
  808.       return false if @battler.is_a?(Game_Enemy)
  809.       return false if !$game_system.battler_hud
  810.       return true
  811.   end  
  812.   
  813. end

  814. #==============================================================================
  815. # ■ Battler Face Sprite
  816. #==============================================================================
  817. class Battler_Face_Sprite < Sprite
  818.   include MOG_BATTLE_HUD
  819.   
  820.   #--------------------------------------------------------------------------
  821.   # ● Initialize
  822.   #--------------------------------------------------------------------------               
  823.    def initialize(viewport = nil,battler)
  824.        super(viewport)
  825.        @battler = battler
  826.        @f_im = Cache.battler(@battler.battler_face_name, 0)
  827.        @f_cw = @f_im.width / 5
  828.        @f_ch = @f_im.height
  829.        self.bitmap = Bitmap.new(@f_cw,@f_ch)
  830.        x = -(@f_cw / 2) + FACE_POSITION[0] + HUD_POSITION[0] + (MEMBERS_SPACE[0] * @battler.index)
  831.        y = -@f_ch + FACE_POSITION[1] + HUD_POSITION[1] + (MEMBERS_SPACE[1] * @battler.index)
  832.        @org_pos = [x,y]
  833.        @battler.battler_face = [0,0,0]
  834.        @battler_visible = true
  835.        @low_hp = @battler.mhp * 30 / 100
  836.        @old_face_index = 0
  837.        self.z = @battler.screen_z
  838.        make_face(true)
  839.    end
  840.    
  841.   #--------------------------------------------------------------------------
  842.   # ● Dispose
  843.   #--------------------------------------------------------------------------                       
  844.   def dispose
  845.       super
  846.       dispose_battler_face_sprite
  847.   end   

  848.   #--------------------------------------------------------------------------
  849.   # ● Dispose Battler Face Sprite
  850.   #--------------------------------------------------------------------------                    
  851.   def dispose_battler_face_sprite
  852.        self.bitmap.dispose
  853.        @f_im.dispose
  854.   end  
  855.    
  856.   #--------------------------------------------------------------------------
  857.   # ● Update
  858.   #--------------------------------------------------------------------------  
  859.   def update_face_sprite(battler)
  860.       @battler = battler
  861.       update_face_reset_time
  862.       update_face_effect
  863.   end
  864.    
  865.   #--------------------------------------------------------------------------
  866.   # ● Face Base Setting
  867.   #--------------------------------------------------------------------------                 
  868.   def face_base_setting
  869.       self.x = @org_pos[0]
  870.       self.y = @org_pos[1]
  871.       self.zoom_x = 1
  872.       self.zoom_y = 1
  873.       self.mirror = false   
  874.   end
  875.   
  876.   #--------------------------------------------------------------------------
  877.   # ● Check Base Face
  878.   #--------------------------------------------------------------------------              
  879.    def check_base_face(reset)
  880.        face_base_setting
  881.        return if @battler.battler_face[2] > 0
  882.        @battler.battler_face = [0,0,0] if reset and @battler.battler_face[1] != 2  
  883.        @battler.battler_face[0] = 3 if @battler.hp < @low_hp
  884.        @battler.battler_face[0] = 4 if @battler.hp == 0
  885.    end  
  886.    
  887.   #--------------------------------------------------------------------------
  888.   # ● Make Face
  889.   #--------------------------------------------------------------------------              
  890.    def make_face(reset = false)
  891.        self.bitmap.clear
  892.        check_base_face(reset)
  893.        src_rect_back = Rect.new(@f_cw * @battler.battler_face[0], 0, @f_cw, @f_ch)
  894.        self.bitmap.blt(0,0, @f_im, src_rect_back)
  895.        @old_face_index = @battler.battler_face[0]
  896.    end  

  897.   #--------------------------------------------------------------------------
  898.   # ● Update Actor Battler
  899.   #--------------------------------------------------------------------------           
  900.    def update_actor_battler
  901.        return if self.bitmap == nil
  902.        update_face_effect
  903.        update_face_reset_time
  904.        make_face if @old_face_index != @battler.battler_face[0]              
  905.    end
  906.    
  907.   #--------------------------------------------------------------------------
  908.   # ● Update Face Z
  909.   #--------------------------------------------------------------------------                 
  910.   def update_face_z(value)
  911.       self.z = value + 2
  912.   end  
  913.    
  914.   #--------------------------------------------------------------------------
  915.   # ● Update Face Reset Time
  916.   #--------------------------------------------------------------------------              
  917.    def update_face_reset_time
  918.        return if @battler.battler_face[2] == 0
  919.        @battler.battler_face[2] -= 1
  920.        if @battler.battler_face[2] == 0 or
  921.          (@battler.hp < @low_hp and @battler.battler_face[0] == 0)
  922.           make_face(true)
  923.        end   
  924.    end

  925.   #--------------------------------------------------------------------------
  926.   # ● Update Face Effect
  927.   #--------------------------------------------------------------------------                 
  928.    def update_face_effect
  929.        return if @battler.battler_face[2] == 0
  930.        case @battler.battler_face[1]
  931.           when 0
  932.              face_damage
  933.           when 1..2
  934.              face_heal
  935.           when 3
  936.              face_action
  937.        end
  938.    end  
  939.    
  940.   #--------------------------------------------------------------------------
  941.   # ● Face Damage
  942.   #--------------------------------------------------------------------------                    
  943.    def face_damage
  944.        self.x = (@org_pos[0] - (@battler.battler_face[2] /2)) + rand(@battler.battler_face[2])
  945.    end  
  946.    
  947.   #--------------------------------------------------------------------------
  948.   # ● Face Heal
  949.   #--------------------------------------------------------------------------                    
  950.    def face_heal
  951.        case  @battler.battler_face[2]
  952.          when 20..40
  953.              self.zoom_x += 0.01
  954.              self.zoom_y = self.zoom_x
  955.          when 0..20
  956.              self.zoom_x -= 0.01
  957.              self.zoom_y = self.zoom_x      
  958.        end
  959.    end     
  960.    
  961.   #--------------------------------------------------------------------------
  962.   # ● Face Action
  963.   #--------------------------------------------------------------------------                    
  964.    def face_action
  965.        case  @battler.battler_face[2]
  966.          when 25..50
  967.              self.zoom_x += 0.01
  968.              self.zoom_y = self.zoom_x
  969.              self.mirror = true
  970.          when 0..25
  971.              self.zoom_x -= 0.01
  972.              self.zoom_y = self.zoom_x
  973.              self.mirror = false
  974.        end
  975.        self.zoom_x = self.zoom_x > 1.5 ? self.zoom_x = 1.5 : self.zoom_x < 1 ? 1 : self.zoom_x
  976.        self.zoom_y = self.zoom_y > 1.5 ? self.zoom_y = 1.5 : self.zoom_y < 1 ? 1 : self.zoom_y
  977.    end
  978.       
  979. end

  980.   #==============================================================================
  981. # ■ Battle Manager
  982. #==============================================================================
  983. class << BattleManager
  984.   
  985.   #--------------------------------------------------------------------------
  986.   # ● Battle End
  987.   #--------------------------------------------------------------------------                    
  988.   alias mog_battle_hud_battle_process_victory process_victory
  989.   def process_victory
  990.       execute_face_effect   
  991.       mog_battle_hud_battle_process_victory
  992.   end
  993.   
  994.   #--------------------------------------------------------------------------
  995.   # ● Prepare
  996.   #--------------------------------------------------------------------------                  
  997.   def execute_face_effect
  998.       for i in $game_party.members
  999.           i.battler_face = [1,2,40] if i.hp > 0   
  1000.       end  
  1001.   end
  1002.   
  1003. end

  1004. #==============================================================================
  1005. # ■ Game Action
  1006. #==============================================================================
  1007. class Scene_Battle < Scene_Base
  1008.   
  1009.   #--------------------------------------------------------------------------
  1010.   # ● Show Animations
  1011.   #--------------------------------------------------------------------------     
  1012.   alias mog_battle_hud_show_animation show_animation
  1013.   def show_animation(targets, animation_id)
  1014.       make_face_action_battle
  1015.       mog_battle_hud_show_animation(targets, animation_id)
  1016.   end
  1017.   
  1018.   #--------------------------------------------------------------------------
  1019.   # ● Make Face Action
  1020.   #--------------------------------------------------------------------------                  
  1021.   def make_face_action_battle
  1022.       return if [email protected]_a?(Game_Actor)
  1023.       @subject.battler_face = [2,3,50]
  1024.   end   
  1025.   
  1026. end  

  1027. #==============================================================================
  1028. # ■ Game Battler
  1029. #==============================================================================
  1030. class Game_Battler < Game_BattlerBase
  1031.   
  1032.   #--------------------------------------------------------------------------
  1033.   # ● Item Apply
  1034.   #--------------------------------------------------------------------------               
  1035.   alias mog_battle_hud_item_apply item_apply
  1036.   def item_apply(user, item)
  1037.       old_hp = self.hp
  1038.       old_mp = self.mp
  1039.       mog_battle_hud_item_apply(user, item)
  1040.       check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
  1041.   end
  1042.   
  1043.   #--------------------------------------------------------------------------
  1044.   # ● Check Face Effect
  1045.   #--------------------------------------------------------------------------  
  1046.   def check_face_effect(old_hp,old_mp)
  1047.       if self.hp > old_hp or self.mp > old_mp
  1048.          self.battler_face = [1,1,40]
  1049.       elsif self.hp < old_hp
  1050.          self.battler_face = [3,0,40]
  1051.       end  
  1052.   end  
  1053.   
  1054.   #--------------------------------------------------------------------------
  1055.   # ● Added New State
  1056.   #--------------------------------------------------------------------------  
  1057.   alias mog_battle_hud_add_new_state add_new_state
  1058.   def add_new_state(state_id)
  1059.       mog_battle_hud_add_new_state(state_id)
  1060.       if self.is_a?(Game_Actor)
  1061.          self.battler_face = [1,1,40] if $data_states[state_id].note =~ /<Good State>/
  1062.          self.battler_face = [3,0,40] if $data_states[state_id].note =~ /<Bad State>/
  1063.       end   
  1064.   end   
  1065.   
  1066.   #--------------------------------------------------------------------------
  1067.   # ● Regenerate HP
  1068.   #--------------------------------------------------------------------------
  1069.   alias mog_battle_hud_regenerate_hp regenerate_hp
  1070.   def regenerate_hp
  1071.       old_hp = self.hp
  1072.       old_mp = self.mp   
  1073.       mog_battle_hud_regenerate_hp
  1074.       check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
  1075.   end

  1076.   #--------------------------------------------------------------------------
  1077.   # ● Regenerate MP
  1078.   #--------------------------------------------------------------------------
  1079.   alias mog_battle_hud_regenerate_mp regenerate_mp
  1080.   def regenerate_mp
  1081.       old_hp = self.hp
  1082.       old_mp = self.mp   
  1083.       mog_battle_hud_regenerate_mp
  1084.       check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
  1085.   end  

  1086.   #--------------------------------------------------------------------------
  1087.   # ● Can Check Face Effect
  1088.   #--------------------------------------------------------------------------                  
  1089.   def can_check_face_effect?(old_hp,old_mp)
  1090.       return false if self.is_a?(Game_Enemy)
  1091.       return true if old_hp != self.hp
  1092.       return true if old_mp != self.mp
  1093.       return false
  1094.   end
  1095.   
  1096. end

  1097. #==============================================================================
  1098. # ■ Scene_Battle
  1099. #==============================================================================
  1100. class Scene_Battle < Scene_Base
  1101.   
  1102.   #--------------------------------------------------------------------------
  1103.   # ● Invoke Counter Attack
  1104.   #--------------------------------------------------------------------------        
  1105.   alias mog_battle_hud_invoke_counter_attack invoke_counter_attack
  1106.   def invoke_counter_attack(target, item)
  1107.       mog_battle_hud_invoke_counter_attack(target, item)
  1108.       if target.is_a?(Game_Actor) and target.battler_face[0] != 2        
  1109.          target.battler_face = [2,3,50]
  1110.       end  
  1111.   end  
  1112.   
  1113.   #--------------------------------------------------------------------------
  1114.   # ● Invoke Magic Reflection
  1115.   #--------------------------------------------------------------------------        
  1116.   alias mog_battle_hud_invoke_magic_reflection invoke_magic_reflection
  1117.   def invoke_magic_reflection(target, item)
  1118.       mog_battle_hud_invoke_magic_reflection(target, item)
  1119.       if target.is_a?(Game_Actor) and target.battler_face[0] != 2        
  1120.          target.battler_face = [2,3,50]
  1121.       end  
  1122.   end   
  1123.   
  1124. end

  1125. #==============================================================================
  1126. # ■ Scene Battle
  1127. #==============================================================================  
  1128. class Scene_Battle < Scene_Base
  1129.   
  1130.   #--------------------------------------------------------------------------
  1131.   # ● select_enemy_selection
  1132.   #--------------------------------------------------------------------------
  1133.   alias mog_battle_cursor_select_enemy_selection select_enemy_selection
  1134.   def select_enemy_selection
  1135.       mog_battle_cursor_select_enemy_selection
  1136.       if $mog_rgss3_battle_cursor != nil
  1137.          @enemy_window.visible = false
  1138.          @info_viewport.rect.width = 0
  1139.       end   
  1140.   end
  1141.   
  1142.   #--------------------------------------------------------------------------
  1143.   # ● select_enemy_selection
  1144.   #--------------------------------------------------------------------------
  1145.   alias mog_battle_cursor_select_actor_selection select_actor_selection
  1146.   def select_actor_selection
  1147.       mog_battle_cursor_select_actor_selection
  1148.       if $mog_rgss3_battle_cursor != nil
  1149.          @actor_window.visible = false
  1150.          @info_viewport.rect.width = 0
  1151.       end   
  1152.   end
  1153.   
  1154. end  

  1155. $mog_rgss3_battle_hud = true
复制代码

点评

脚本冲突类的问题,最好附上脚本或工程!  发表于 2013-9-13 18:56

Lv1.梦旅人

梦石
0
星屑
50
在线时间
189 小时
注册时间
2013-1-26
帖子
72
2
 楼主| 发表于 2013-9-13 19:21:35 | 只看该作者
不好意思
已补上脚本
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-10-9 17:22

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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