查看: 964|回复: 2

[已经解决] 求救,我用了TAB脚本结果技能信息不见了

[复制链接]
梦石
0
星屑
109
在线时间
8 小时
注册时间
2018-9-5
回帖
2
发表于 2018-10-13 17:53:04 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 VIPArcher 于 2018-10-14 01:31 编辑

以前,发动技能会显示,某某某正在使用什么发动了什么攻击造成了伤害,等字样信息,
但自从我用了TAB战斗系统脚本后,技能的使用信息没有了,被屏蔽了应该,请问如何把技能信息改出来?


  1. #==============================================================================
  2. # +++ MOG - ATB战斗系统  (v 6.1) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]https://atelierrgss.wordpress.com/[/url]
  6. #==============================================================================
  7. # 即时战斗系统.为全部角色和敌人添加AT值,AT值决定其行动顺序
  8. #==============================================================================

  9. #==============================================================================
  10. # 注意 1
  11. #==============================================================================
  12. # 本脚本不包含ATB行动条功能,要显示行动条还需要脚本以下脚本:
  13. #
  14. # 战斗 Hud EX
  15. # Ayesha ATB Gauge
  16. # ATB 行动条
  17. #
  18. #==============================================================================
  19. # 注意 2
  20. #==============================================================================
  21. # 本脚本隐藏了画面上方的战斗日志,所以最好额外使用一些伤害显示的脚本。
  22. #==============================================================================

  23. #==============================================================================
  24. # ● ATB 系统
  25. #==============================================================================
  26. # 角色的AT速度(行动速度)由其敏捷值决定。一般情况下,战斗开始时角色和敌人的AT
  27. # 值都为40%;队伍先发制人的情况下角色的AT值为80%,而敌人的为0;队伍被偷袭的情
  28. # 况下角色的AT值为0,而敌人的为80%。
  29. #==============================================================================
  30. # ● 施放时间
  31. #==============================================================================
  32. # 如果要对技能/物品设定施放等待时间的效果,设定其"速度修正"不为0就行。
  33. #
  34. # 注意 - 在同一轮中不能同时使用2个或多个带有"速度修正"的技能/物品。
  35. # (如果你还用了有多行动回合功能的脚本的话)
  36. #==============================================================================

  37. #==============================================================================
  38. # 脚本
  39. #==============================================================================
  40. #
  41. # atb_type(类型)                - 改变 ATB 的类型(下面有介绍).
  42. # atb_max(X)                    - 设定 ATB 总时间.
  43. # atb_stop                      - 暂停 ATB 的流动.
  44. # atb_turn_speed(X)             - 设置多长时间算一个回合.
  45. # atb_turn_stop                 - 停止回合计数.
  46. # atb_turn_reset                - 回合数清零.
  47. # atb_sprite_turn(false)        - 显示或隐藏回合数精灵.
  48. #
  49. #==============================================================================

  50. #==============================================================================
  51. # Histórico
  52. #==============================================================================
  53. # v6.1 - Correção do crash na seleção de skills vazias.
  54. # v6.0 - Melhorias no sistema do evento comum.
  55. #==============================================================================

  56. $imported = {} if $imported.nil?
  57. $imported[:mog_atb_system] = true

  58. #==============================================================================
  59. # 组合技
  60. #==============================================================================
  61. module MOG_COOPERATION_SKILLS
  62.   COOPERATION_SKILLS = []  # ☢注意!!☢ 勿动.^_^
  63.   #--------------------------------------------------------------------------
  64.   # 设定组合技
  65.   #
  66.   # COOPERATION_SKILLS[技能ID] = [角色ID, 角色ID, 角色ID……]
  67.   #--------------------------------------------------------------------------

  68.   # COOPERATION_SKILLS[51] = [2,4]     # 火
  69.   # COOPERATION_SKILLS[66] = [2,4,3]   # 地震
  70.   COOPERATION_SKILLS[104] = [1,5]      # Ouka Mugen jin
  71.   COOPERATION_SKILLS[143] = [3,4]      # 闪烁
  72.   COOPERATION_SKILLS[151] = [1,2,3,4]  # 终结  
  73.   COOPERATION_SKILLS[153] = [2,4]      # W 终结 结束
  74.   
  75.   
  76.   #--------------------------------------------------------------------------
  77.   # 释放组合技时显示的动画.
  78.   #--------------------------------------------------------------------------
  79.   COOPERATION_SKILL_ANIMATION = 49  
  80. end

  81. #==============================================================================
  82. # 通用设定
  83. #==============================================================================
  84. module MOG_ATB_SYSTEM
  85.   #--------------------------------------------------------------------------
  86.   # 设定 ATB 类型
  87.   #
  88.   # 0 - 玩家操控时等待
  89.   # 1 - 半即时
  90.   # 2 - 全即时
  91.   #
  92.   # 改变ATB类型的脚本:
  93.   #
  94.   # atb_type(类型)
  95.   #
  96.   #--------------------------------------------------------------------------
  97.   ATB_TYPE = 0
  98.   #--------------------------------------------------------------------------
  99.   # 轮到某一角色时播放的音效
  100.   #--------------------------------------------------------------------------
  101.   SE_ACTIVE = "Decision2"
  102.   #--------------------------------------------------------------------------
  103.   # 设定最大 ATB 值
  104.   # 改变最大 ATB 值的脚本:
  105.   #
  106.   # atb_max(X)
  107.   #
  108.   #--------------------------------------------------------------------------
  109.   ATB_MAX = 5000
  110.   #--------------------------------------------------------------------------
  111.   # 定义"回合"的方式,多少时间过去算是一个回合?
  112.   #
  113.   # 0 - 一个回合的时间是个固定值.
  114.   # 1 - 一个回合的时间为全部参战者数量的乘积
  115.   # 2 - 一个回合的时间为全部参战者敏捷值的平均值
  116.   #
  117.   #--------------------------------------------------------------------------
  118.   TURN_DURATION_TYPE = 0
  119.   #--------------------------------------------------------------------------
  120.   # 当上一项设定为"0"时的数值
  121.   #--------------------------------------------------------------------------
  122.   TURN_DURATION = 500
  123.   #--------------------------------------------------------------------------
  124.   # 施放动画
  125.   #--------------------------------------------------------------------------
  126.   CAST_ANIMATION = 49
  127.   #--------------------------------------------------------------------------
  128.   # 是否在战斗开始时显示敌人出现的窗口
  129.   #--------------------------------------------------------------------------
  130.   MESSAGE_ENEMY_APPEAR = false
  131.   #--------------------------------------------------------------------------
  132.   # 是否启用切换角色按钮
  133.   #--------------------------------------------------------------------------
  134.   ENABLE_BUTTON_NEXT_ACTOR = false
  135.   #--------------------------------------------------------------------------
  136.   # 设定切换角色的按钮(当多个角色都可以行动时可以在其间相互切换)
  137.   #--------------------------------------------------------------------------
  138.   BUTTON_NEXT_ACTOR_RIGHT = :R
  139.   BUTTON_NEXT_ACTOR_LEFT = :L
  140.   #--------------------------------------------------------------------------
  141.   # 是否显示回合数.
  142.   # 开启或关闭回合数的脚本:
  143.   #
  144.   # atb_sprite_turn(false)
  145.   #
  146.   #--------------------------------------------------------------------------
  147.   DISPLAY_TURN_NUMBER = false
  148.   #--------------------------------------------------------------------------
  149.   # 回合数的文本.
  150.   #--------------------------------------------------------------------------
  151.   TURN_WORD = "回合数 "
  152.   #--------------------------------------------------------------------------
  153.   # 回合数文字大小
  154.   #--------------------------------------------------------------------------
  155.   TURN_NUMBER_FONT_SIZE = 24
  156.   #--------------------------------------------------------------------------
  157.   # 回合数文字是否加粗.
  158.   #--------------------------------------------------------------------------
  159.   TURN_NUMBER_FONT_BOLD = true
  160.   #--------------------------------------------------------------------------
  161.   # 回合数文字 Z 坐标.
  162.   #--------------------------------------------------------------------------
  163.   TURN_NUMBER_Z = 100
  164.   #--------------------------------------------------------------------------
  165.   # 回合数文字位置.
  166.   #--------------------------------------------------------------------------
  167.   TURN_NUMBER_POS = [5,0]   
  168. end

  169. #==============================================================================
  170. # ■ Game Temp
  171. #==============================================================================
  172. class Game_Temp
  173.   
  174.   attr_accessor :atb_in_turn
  175.   attr_accessor :atb_wait
  176.   attr_accessor :atb_user
  177.   attr_accessor :atb_stop
  178.   attr_accessor :atb_actor_order
  179.   attr_accessor :atb_break_duration
  180.   attr_accessor :battle_end
  181.   attr_accessor :battle_end2
  182.   attr_accessor :turn_duration_clear
  183.   attr_accessor :refresh_battle_atb
  184.   attr_accessor :end_phase_duration
  185.   attr_accessor :atb_frame_skip
  186.   attr_accessor :refresh_actor_command  
  187.   attr_accessor :refresh_target_windows
  188.   attr_accessor :refresh_item_window
  189.   attr_accessor :actor_command_index
  190.   attr_accessor :actor_process_event
  191.   attr_accessor :break_command
  192.   attr_accessor :hwindow_atb
  193.   
  194.   #--------------------------------------------------------------------------
  195.   # ● Initialize
  196.   #--------------------------------------------------------------------------         
  197.   alias mog_atb_temp_initialize initialize
  198.   def initialize
  199.       @atb_in_turn = false
  200.       @atb_wait = false
  201.       @atb_break_duration = 0
  202.       @atb_stop = [false,false]
  203.       @atb_actor_order = []
  204.       @turn_duration_clear = false
  205.       @battle_end = true
  206.       @battle_end2 = true
  207.       @refresh_battle_atb = false
  208.       @end_phase_duration = [false,0]
  209.       @atb_frame_skip = 0
  210.       @refresh_actor_command = false
  211.       @refresh_target_windows = [false,false]
  212.       @actor_command_index = 0
  213.       @refresh_item_window = false
  214.       @break_command = false
  215.       @actor_process_event = nil
  216.       @hwindow_atb = false
  217.       mog_atb_temp_initialize
  218.   end
  219.   
  220.   #--------------------------------------------------------------------------
  221.   # ● Sprite Visible
  222.   #--------------------------------------------------------------------------   
  223.   def sprite_visible
  224.       return false if $game_message.visible
  225.       return false if $game_temp.battle_end
  226.       return true
  227.   end   
  228.   
  229.   #--------------------------------------------------------------------------
  230.   # ● add Order
  231.   #--------------------------------------------------------------------------   
  232.   def add_order(battler)
  233.       return if battler == nil
  234.       return if battler.is_a?(Game_Enemy)
  235.       $game_temp.atb_actor_order.push(battler)
  236.   end  
  237.    
  238.   #--------------------------------------------------------------------------
  239.   # ● Remove Order
  240.   #--------------------------------------------------------------------------   
  241.   def remove_order(battler)
  242.       return if battler == nil
  243.       return if battler.is_a?(Game_Enemy)
  244.       $game_temp.atb_actor_order.delete(battler) rescue nil
  245.   end  
  246.   
  247. end

  248. #==============================================================================
  249. # ■ Game_System
  250. #==============================================================================
  251. class Game_System
  252.   
  253.   attr_accessor :atb_max
  254.   attr_accessor :atb_type
  255.   attr_accessor :atb_turn_duration
  256.   attr_accessor :atb_sprite_turn
  257.   
  258.   #--------------------------------------------------------------------------
  259.   # ● Initialize
  260.   #--------------------------------------------------------------------------         
  261.   alias mog_at_system_initialize initialize
  262.   def initialize
  263.       @atb_max = [[MOG_ATB_SYSTEM::ATB_MAX, 999999].min, 1500].max
  264.       @atb_type = MOG_ATB_SYSTEM::ATB_TYPE ; @atb_sprite_turn = true
  265.       @atb_turn_duration = [0,
  266.       [[MOG_ATB_SYSTEM::TURN_DURATION, 999999].min, 50].max]
  267.       mog_at_system_initialize
  268.   end
  269.   
  270. end

  271. #==============================================================================
  272. # ■ Game Interpreter
  273. #==============================================================================
  274. class Game_Interpreter
  275.   
  276.   #--------------------------------------------------------------------------
  277.   # ● ATB Type
  278.   #--------------------------------------------------------------------------         
  279.   def atb_type(type)
  280.       $game_system.atb_type = type
  281.   end
  282.   
  283.   #--------------------------------------------------------------------------
  284.   # ● ATB Max
  285.   #--------------------------------------------------------------------------         
  286.   def atb_max(value)
  287.       $game_system.atb_max = [[value, 999999].min, 1500].max
  288.   end
  289.   
  290.   #--------------------------------------------------------------------------
  291.   # ● ATB Sprite Turn
  292.   #--------------------------------------------------------------------------         
  293.   def atb_sprite_turn(value = true)
  294.       $game_system.atb_sprite_turn = value
  295.   end  
  296.   
  297.   #--------------------------------------------------------------------------
  298.   # ● ATB Turn Speed
  299.   #--------------------------------------------------------------------------         
  300.   def atb_turn_speed(value = 400)
  301.       $game_system.atb_turn_duration[1] = [[value, 999999].min, 50].max
  302.   end
  303.   
  304.   #--------------------------------------------------------------------------
  305.   # ● ATB force Turn
  306.   #--------------------------------------------------------------------------         
  307.   def atb_force_turn(value)
  308.       $game_troop.turn_count = value
  309.   end
  310.   
  311.   #--------------------------------------------------------------------------
  312.   # ● ATB Turn Reset
  313.   #--------------------------------------------------------------------------         
  314.   def atb_turn_reset
  315.       $game_system.atb_turn_duration[0] = 0
  316.   end
  317.   
  318.   #--------------------------------------------------------------------------
  319.   # ● Command 339
  320.   #--------------------------------------------------------------------------         
  321.   def command_339
  322.       iterate_battler(@params[0], @params[1]) do |battler|
  323.       next if battler.death_state?
  324.       battler.turn_clear
  325.       if BattleManager.actor!= nil and battler == BattleManager.actor
  326.          BattleManager.actor.turn_clear
  327.          $game_temp.break_command = true
  328.          BattleManager.command_selection_clear
  329.       end
  330.       battler.force_action(@params[2], @params[3])
  331.       BattleManager.force_action(battler)
  332.       Fiber.yield while BattleManager.action_forced?
  333.       end  
  334.   end
  335.    
  336. end

  337. #==============================================================================
  338. # ■ Game Troop
  339. #==============================================================================
  340. class Game_Troop < Game_Unit

  341.   #--------------------------------------------------------------------------
  342.   # ● Can Interpreter Running?
  343.   #--------------------------------------------------------------------------         
  344.   def can_interpreter_running?(tend = false)      
  345.       BattleManager.turn_end if tend
  346.       return true if $game_temp.common_event_reserved?
  347.       return false if @interpreter.running?      
  348.       return false if @interpreter.setup_reserved_common_event
  349.       troop.pages.each do |page|
  350.          next unless conditions_met?(page)
  351.          @current_page = page
  352.          return true
  353.       end   
  354.       return false
  355.    end   
  356.       
  357.   #--------------------------------------------------------------------------
  358.   # ● Can Interpreter Hide Window?
  359.   #--------------------------------------------------------------------------   
  360.   def can_interpreter_hide_window?      
  361.       return false if @current_page == nil
  362.       @current_page.list.each do |l|
  363.       if l.code.between?(101,105) ; @current_page = nil ; return true ; end
  364.       end
  365.       @current_page = nil
  366.       return false
  367.    end   
  368.       
  369.   #--------------------------------------------------------------------------
  370.   # ● Can Interpreter Hide Window 2?
  371.   #--------------------------------------------------------------------------   
  372.   def can_interpreter_hide_window_2?
  373.       return false if $game_temp.common_event_id == 0
  374.       common_event = $data_common_events[$game_temp.common_event_id] rescue nil
  375.       return false if common_event.nil?
  376.       common_event.list.each do |l|
  377.       return true if l.code.between?(101,105)
  378.       end
  379.       return false
  380.   end
  381.   
  382.   #--------------------------------------------------------------------------
  383.   # ● Set Turn
  384.   #--------------------------------------------------------------------------         
  385.   def set_turn(turn_value)
  386.       @turn_count = turn_value
  387.   end
  388.       
  389. end

  390. #==============================================================================
  391. # ■ Window Base
  392. #==============================================================================
  393. class Window_Base < Window
  394.   
  395.   #--------------------------------------------------------------------------
  396.   # ● Initialize
  397.   #--------------------------------------------------------------------------         
  398.   alias mog_atb_wbase_initialize initialize
  399.   def initialize(x, y, width, height)
  400.       mog_atb_wbase_initialize(x, y, width, height)
  401.       @pre_data = [0,self.visible,self.active,self.opacity]
  402.   end
  403.   
  404.   #--------------------------------------------------------------------------
  405.   # ● Hide All
  406.   #--------------------------------------------------------------------------         
  407.   def hide_all
  408.       @index = 0 if @index ; self.visible = false ; self.active = false
  409.       update
  410.   end
  411.   
  412.   #--------------------------------------------------------------------------
  413.   # ● Record Data
  414.   #--------------------------------------------------------------------------         
  415.   def record_data
  416.       @pre_data = [@index ,self.visible ,self.active ,self.opacity]
  417.       update
  418.   end
  419.   
  420.   #--------------------------------------------------------------------------
  421.   # ● Restore Data
  422.   #--------------------------------------------------------------------------         
  423.   def restore_data
  424.       @index = @pre_data[0] if @index ; self.visible = @pre_data[1]
  425.       self.active = @pre_data[2] ; self.opacity = @pre_data[3]
  426.       update
  427.   end
  428.   
  429. end

  430. #==============================================================================
  431. # ■ Window Selectable
  432. #==============================================================================
  433. class Window_Selectable < Window_Base
  434.   
  435.   attr_accessor :pre_data
  436.   
  437.   #--------------------------------------------------------------------------
  438.   # ● Row Max
  439.   #--------------------------------------------------------------------------
  440.   def row_max
  441.       cm = col_max > 0 ? col_max : 1
  442.       [(item_max + cm - 1) / cm, 1].max
  443.   end  
  444.   
  445.   #--------------------------------------------------------------------------
  446.   # ● Row
  447.   #--------------------------------------------------------------------------
  448.   def row
  449.       cm = col_max > 0 ? col_max : 1
  450.       index / cm
  451.   end  
  452.   
  453.   #--------------------------------------------------------------------------
  454.   # ● Item Width
  455.   #--------------------------------------------------------------------------
  456.   def item_width
  457.       cm = col_max > 0 ? col_max : 1
  458.       (width - standard_padding * 2 + spacing) / cm - spacing
  459.   end  
  460.   
  461.   #--------------------------------------------------------------------------
  462.   # ● Item Rect
  463.   #--------------------------------------------------------------------------
  464.   def item_rect(index)
  465.       cm = col_max > 0 ? col_max : 1
  466.       rect = Rect.new
  467.       rect.width = item_width
  468.       rect.height = item_height
  469.       rect.x = index % cm * (item_width + spacing)
  470.       rect.y = index / cm * item_height
  471.       rect
  472.   end  
  473.   
  474.   #--------------------------------------------------------------------------
  475.   # ● Initialize
  476.   #-------------------------------------------------------------------------
  477.   alias mog_atb_sel_initialize initialize
  478.   def initialize(x, y, width, height)
  479.       mog_atb_sel_initialize(x, y, width, height)
  480.       @pre_data = [@index,self.visible,self.active,self.opacity]
  481.   end  
  482.   
  483.   #--------------------------------------------------------------------------
  484.   # ● Process Cursor Move
  485.   #--------------------------------------------------------------------------
  486.   alias mog_atb_wactor_process_cursor_move process_cursor_move
  487.   def process_cursor_move
  488.       return if  SceneManager.scene_is?(Scene_Battle) and skip_command?
  489.       mog_atb_wactor_process_cursor_move
  490.   end

  491.   #--------------------------------------------------------------------------
  492.   # ● Process Handling
  493.   #--------------------------------------------------------------------------
  494.   alias mog_atb_wactor_process_handling process_handling
  495.   def process_handling  
  496.       return if SceneManager.scene_is?(Scene_Battle) and skip_command?
  497.       mog_atb_wactor_process_handling
  498.   end   
  499.    
  500.   #--------------------------------------------------------------------------
  501.   # ● Process Handling
  502.   #--------------------------------------------------------------------------
  503.   def skip_command?
  504.       return false if self.is_a?(Window_VictorySpoils) if $imported["YEA-VictoryAftermath"]
  505.       return true if !$game_temp.sprite_visible
  506.       return true if $game_temp.battle_end
  507.       return true if $game_temp.end_phase_duration[1] > 0
  508.       return true if BattleManager.actor == nil
  509.       return false  
  510.   end  
  511.   
  512. end

  513. #==============================================================================
  514. # ■ Window_ActorCommand
  515. #==============================================================================
  516. class Window_ActorCommand < Window_Command
  517.   
  518.   attr_accessor :actor
  519.   
  520.   #--------------------------------------------------------------------------
  521.   # ● Update
  522.   #--------------------------------------------------------------------------
  523.   alias mog_atb_ac_update update
  524.   def update
  525.       mog_atb_ac_update
  526.       $game_temp.actor_command_index = self.index if self.active
  527.   end
  528.   
  529.   if MOG_ATB_SYSTEM::ENABLE_BUTTON_NEXT_ACTOR
  530.   #--------------------------------------------------------------------------
  531.   # ● Process_Cursor Move
  532.   #--------------------------------------------------------------------------
  533.   def process_cursor_move
  534.       return unless cursor_movable?
  535.       last_index = @index
  536.       cursor_down (Input.trigger?(:DOWN))  if Input.repeat?(:DOWN)
  537.       cursor_up   (Input.trigger?(:UP))    if Input.repeat?(:UP)
  538.       cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
  539.       cursor_left (Input.trigger?(:LEFT))  if Input.repeat?(:LEFT)
  540.       Sound.play_cursor if @index != last_index
  541.   end
  542.   end
  543.   
  544.   if $imported["YEA-BattleEngine"]
  545.   #--------------------------------------------------------------------------
  546.   # ● Process_dir4
  547.   #--------------------------------------------------------------------------
  548.   def process_dir4
  549.   end
  550.   
  551.   #--------------------------------------------------------------------------
  552.   # ● Process_dir6
  553.   #--------------------------------------------------------------------------
  554.   def process_dir6
  555.   end  
  556.   end  
  557.   
  558.   #--------------------------------------------------------------------------
  559.   # ● Process Cursor Move
  560.   #--------------------------------------------------------------------------  
  561.   alias mog_atb_bm_process_cursor_move process_cursor_move
  562.   def process_cursor_move
  563.       return if SceneManager.scene_is?(Scene_Battle) and BattleManager.actor == nil
  564.       mog_atb_bm_process_cursor_move
  565.   end
  566.   
  567.   #--------------------------------------------------------------------------
  568.   # ● Process Handling
  569.   #--------------------------------------------------------------------------   
  570.   alias mog_atb_bm_process_handling process_handling
  571.   def process_handling
  572.       return if SceneManager.scene_is?(Scene_Battle) and BattleManager.actor == nil
  573.       mog_atb_bm_process_handling
  574.   end  
  575.   
  576. end

  577. #==============================================================================
  578. # ■ Window_BattleEnemy
  579. #==============================================================================
  580. class Window_BattleEnemy < Window_Selectable

  581.   #--------------------------------------------------------------------------
  582.   # ● Refresh
  583.   #--------------------------------------------------------------------------  
  584.   alias mog_atb_battle_enemy_update update
  585.   def update
  586.       return if enemy == nil      
  587.       mog_atb_battle_enemy_update
  588.   end
  589.   
  590. end

  591. #==============================================================================
  592. # ■ Window BattleLog
  593. #==============================================================================
  594. class Window_BattleLog < Window_Selectable
  595.   
  596.   #--------------------------------------------------------------------------
  597.   # ● Display Added States
  598.   #--------------------------------------------------------------------------   
  599.   def display_added_states(target)
  600.       return if target.turn_collapse
  601.       target.result.added_state_objects.each do |state|
  602.          state_msg = target.actor? ? state.message1 : state.message2
  603.          if state.id == target.death_state_id
  604.             target.perform_collapse_effect if target.hp == 0
  605.          end
  606.          next if state_msg.empty?
  607.          replace_text(target.name + state_msg)
  608.          target.turn_collapse = true if state.id == target.death_state_id
  609.          wait
  610.          wait_for_effect
  611.       end
  612.   end  
  613.   
  614.   #--------------------------------------------------------------------------
  615.   # ● Refresh
  616.   #--------------------------------------------------------------------------   
  617.   def refresh
  618.   end  

  619.   #--------------------------------------------------------------------------
  620.   # ● Message Speed
  621.   #--------------------------------------------------------------------------   
  622.   def message_speed
  623.       return 10 if $imported["YEA-BattleEngine"]
  624.       return 5
  625.   end

  626.   #--------------------------------------------------------------------------
  627.   # * Wait for Effect
  628.   #--------------------------------------------------------------------------
  629.   def wait_for_effect
  630.       return false
  631.   end  

  632. end

  633. #==============================================================================
  634. # ■ Sprite Battler
  635. #==============================================================================
  636. class Sprite_Battler < Sprite_Base
  637.   
  638.   #--------------------------------------------------------------------------
  639.   # ● Update
  640.   #--------------------------------------------------------------------------      
  641.   alias mog_atb_sprite_update update
  642.   def update      
  643.       mog_atb_sprite_update
  644.       clear_atb_battler_dead if clear_atb_battler_dead?
  645.   end
  646.   
  647.   #--------------------------------------------------------------------------
  648.   # ● Init Visibility
  649.   #--------------------------------------------------------------------------      
  650.   alias mog_atb_init_visibility init_visibility
  651.   def init_visibility
  652.       self.visible = true
  653.       self.opacity = 255 if @battler.alive?
  654.       mog_atb_init_visibility
  655.   end
  656.   
  657.   #--------------------------------------------------------------------------
  658.   # ● Clear ATB Battler
  659.   #--------------------------------------------------------------------------      
  660.   def clear_atb_battler_dead?
  661.       return false if !self.visible
  662.       return false if @battler.nil?
  663.       return false if !@battler.dead?
  664.       return false if @battler.is_a?(Game_Actor)
  665.       return false if !@effect_type.nil?
  666.       return false if $imported[:mog_battler_motion] and !@collapse_done
  667.       return true
  668.   end
  669.   
  670.   #--------------------------------------------------------------------------
  671.   # ● Clear ATB Battler Dead
  672.   #--------------------------------------------------------------------------      
  673.   def clear_atb_battler_dead
  674.       self.opacity = 0
  675.       self.visible = false
  676.       @battler.atb_initial
  677.   end
  678.   
  679. end

  680. #==============================================================================
  681. # ■ Game Battler Base
  682. #==============================================================================
  683. class Game_BattlerBase  
  684.   
  685.   attr_accessor :hidden
  686.   
  687.   #--------------------------------------------------------------------------
  688.   # ● Inputable?
  689.   #--------------------------------------------------------------------------            
  690.   def inputable?
  691.       normal? && !auto_battle? && self.atb_max?
  692.   end
  693.   
  694. end

  695. #==============================================================================
  696. # ■ Game_Battler
  697. #==============================================================================
  698. class Game_Battler < Game_BattlerBase
  699.   
  700.    attr_accessor :atb
  701.    attr_accessor :atb_max
  702.    attr_accessor :atb_cast
  703.    attr_accessor :atb_action
  704.    attr_accessor :atb_turn_duration
  705.    attr_accessor :atb_escape
  706.    attr_accessor :next_turn
  707.    attr_accessor :turn_collapse
  708.    attr_accessor :actions
  709.    
  710.   #--------------------------------------------------------------------------
  711.   # ● Initialize
  712.   #--------------------------------------------------------------------------      
  713.    alias mog_at_system_initialize initialize
  714.    def initialize
  715.        mog_at_system_initialize
  716.        atb_init_setup
  717.    end
  718.    
  719.   #--------------------------------------------------------------------------
  720.   # ● Atb Init Setup
  721.   #--------------------------------------------------------------------------      
  722.    def atb_init_setup
  723.        @atb = 0
  724.        @atb_max = $game_system.atb_max
  725.        @atb_cast = []
  726.        @atb_turn_duration = 0
  727.        @next_turn = false
  728.        @atb_escape = false
  729.        @turn_collapse = false
  730.        @wait_motion = $imported[:mog_battler_motion] != nil ? true : false
  731.    end     
  732.    
  733.   #--------------------------------------------------------------------------
  734.   # ● Atb
  735.   #--------------------------------------------------------------------------         
  736.    def atb
  737.        return 0 if self.hp == 0
  738.        return [[@atb, atb_max].min, 0].max
  739.    end  
  740.    
  741.   #--------------------------------------------------------------------------
  742.   # ● Max ATB
  743.   #--------------------------------------------------------------------------         
  744.    def atb_max
  745.        return [$game_system.atb_max,100].max
  746.    end   
  747.    
  748.   #--------------------------------------------------------------------------
  749.   # ● Max AT?
  750.   #--------------------------------------------------------------------------         
  751.    def atb_max?
  752.        self.atb >= atb_max
  753.    end
  754.    
  755.   #--------------------------------------------------------------------------
  756.   # ● Atb Speed
  757.   #--------------------------------------------------------------------------         
  758.    def atb_speed
  759.        return self.agi
  760.    end
  761.   
  762.   #--------------------------------------------------------------------------
  763.   # ● ATB Update
  764.   #--------------------------------------------------------------------------   
  765.   def atb_update?
  766.       return false if restriction >= 4
  767.       return false if self.hp == 0
  768.       return false if self.hidden
  769.       return false if @wait_motion && $game_temp.battler_in_motion
  770.       return true
  771.   end

  772.   #--------------------------------------------------------------------------
  773.   # ● ATB Update
  774.   #--------------------------------------------------------------------------   
  775.   def atb_update
  776.       return if !atb_update?
  777.       if self.atb_cast.empty?
  778.          if !atb_max?
  779.             self.atb += self.atb_speed
  780.             execute_atb_max_effect if atb_max?
  781.          end   
  782.       else   
  783.          self.atb_cast[1] -= 1
  784.          execute_cast_action if self.atb_cast[1] <= 0
  785.       end
  786.   end
  787.   
  788.   #--------------------------------------------------------------------------
  789.   # ● Execute Atb Max Effect
  790.   #--------------------------------------------------------------------------   
  791.   def execute_atb_max_effect
  792.       $game_temp.refresh_item_window = true if need_refresh_item_window?
  793.       $game_temp.add_order(self)
  794.   end
  795.   
  796.   #--------------------------------------------------------------------------
  797.   # ● Need Refresh Item Window?
  798.   #--------------------------------------------------------------------------   
  799.   def need_refresh_item_window?
  800.       return false
  801.   end
  802.   
  803.   #--------------------------------------------------------------------------
  804.   # ● Execute Cast Action
  805.   #--------------------------------------------------------------------------   
  806.   def execute_cast_action
  807.       self.next_turn = true ; self.atb = self.atb_max ; self.atb_cast.clear
  808.   end
  809.   
  810.   #--------------------------------------------------------------------------
  811.   # ● Atb Clear
  812.   #--------------------------------------------------------------------------   
  813.   def atb_clear
  814.       self.atb = 0 ; self.atb_cast.clear ; self.turn_collapse = false
  815.   end
  816.    
  817.   #--------------------------------------------------------------------------
  818.   # ● Atb Initial
  819.   #--------------------------------------------------------------------------   
  820.   def atb_initial
  821.       @atb = 0 ; @atb_cast = [] ; @atb_turn_duration = 0
  822.       @atb_escape = false ; @next_turn = false ; clear_actions
  823.   end     
  824.       
  825.   #--------------------------------------------------------------------------
  826.   # ● Movable ATB
  827.   #--------------------------------------------------------------------------   
  828.   def movable_atb?
  829.       return false if !atb_max?
  830.       return false if self.dead?
  831.       return false if self.restriction != 0
  832.       return false if self.next_turn
  833.       return false if !self.atb_cast.empty?
  834.       return true
  835.   end
  836.   
  837.   #--------------------------------------------------------------------------
  838.   # ● Item Apply
  839.   #--------------------------------------------------------------------------  
  840.   alias mog_atb_item_apply item_apply
  841.   def item_apply(user, item)      
  842.       pre_item = self.current_action.item rescue nil
  843.       mog_atb_item_apply(user, item)      
  844.       if SceneManager.scene_is?(Scene_Battle)
  845.          effect_for_dead if self.dead?
  846.          atb_after_damage(pre_item)
  847.       end   
  848.   end  

  849.   #--------------------------------------------------------------------------
  850.   # ● ATB After Damage
  851.   #--------------------------------------------------------------------------  
  852.   def atb_after_damage(pre_item = nil)
  853.       $game_temp.break_command = true if can_damage_break_command?
  854.       turn_clear if self.restriction == 4 or self.dead?
  855.       $game_temp.remove_order(self) if self.restriction > 0 or self.dead?
  856.       $game_temp.battle_end2 = true if $game_troop.all_dead? or $game_party.all_dead?
  857.   end

  858.   #--------------------------------------------------------------------------
  859.   # ● Can Damage Break Command
  860.   #--------------------------------------------------------------------------  
  861.   def can_damage_break_command?
  862.       return false if BattleManager.actor == nil
  863.       return false if BattleManager.actor != self
  864.       return true if BattleManager.actor.restriction > 0
  865.       return true if BattleManager.actor.dead?
  866.       return true if BattleManager.actor.hp == 0
  867.       return false
  868.   end
  869.   
  870.   #--------------------------------------------------------------------------
  871.   # ● Turn Clear
  872.   #--------------------------------------------------------------------------  
  873.   def turn_clear
  874.       self.atb_clear
  875.       self.atb_escape = false
  876.       self.clear_actions
  877.       self.next_turn = false
  878.       $game_temp.remove_order(self)
  879.   end  
  880.   
  881.   #--------------------------------------------------------------------------
  882.   # ● Effect for Dead
  883.   #--------------------------------------------------------------------------  
  884.   def effect_for_dead      
  885.       atb_initial
  886.       $game_temp.refresh_target_windows[0] = true if self.is_a?(Game_Actor)
  887.       $game_temp.refresh_target_windows[1] = true if self.is_a?(Game_Enemy)
  888.       if $imported[:mog_battle_cursor]
  889.          $game_temp.battle_cursor_need_refresh[0] = true if self.is_a?(Game_Actor)
  890.          $game_temp.battle_cursor_need_refresh[1] = true if self.is_a?(Game_Enemy)
  891.       end         
  892.   end
  893.   
  894.   #--------------------------------------------------------------------------
  895.   # ● Remove State Auto
  896.   #--------------------------------------------------------------------------  
  897.   alias mog_atb_remove_states_auto remove_states_auto
  898.   def remove_states_auto(timing)
  899.       if SceneManager.scene_is?(Scene_Battle)
  900.          remove_states_auto_atb(timing) ; return
  901.       end
  902.       mog_atb_remove_states_auto(timing)
  903.   end  

  904.   #--------------------------------------------------------------------------
  905.   # ● Remove State Auto ATB
  906.   #--------------------------------------------------------------------------  
  907.   def remove_states_auto_atb(timing)
  908.       states.each do |state|
  909.       if @state_turns[state.id] == 0
  910.          if restriction == 4 ; remove_state(state.id) ; return ; end
  911.             unless state.auto_removal_timing == 2 and state.max_turns <= 1
  912.             remove_state(state.id)
  913.             end
  914.          end
  915.       end
  916.   end  

  917.   #--------------------------------------------------------------------------
  918.   # ● Remove State Turn End
  919.   #--------------------------------------------------------------------------  
  920.   def remove_state_turn_end
  921.       states.each do |state|
  922.          next if state.auto_removal_timing != 2
  923.          next if state.max_turns > 1
  924.          remove_state(state.id)
  925.       end
  926.   end  
  927.   
  928.   #--------------------------------------------------------------------------
  929.   # ● Die
  930.   #--------------------------------------------------------------------------  
  931.   alias mog_atb_die die
  932.   def die
  933.       mog_atb_die
  934.       self.turn_clear ; self.atb_turn_duration = 0
  935.   end
  936.   
  937.   #--------------------------------------------------------------------------
  938.   # ● Revive
  939.   #--------------------------------------------------------------------------  
  940.   alias mog_atb_revive revive
  941.   def revive
  942.       mog_atb_revive
  943.       self.turn_clear ; per = 25 * self.atb_max / 100 ; self.atb = rand(per)
  944.       self.atb_turn_duration = 0
  945.   end  
  946.   
  947.   #--------------------------------------------------------------------------
  948.   # ● Create Battle Action
  949.   #--------------------------------------------------------------------------
  950.   alias mog_atb_make_actions make_actions
  951.   def make_actions
  952.       return if !self.atb_cast.empty?
  953.       item = self.current_action.item rescue nil
  954.       return if item != nil
  955.       mog_atb_make_actions
  956.   end  
  957.   
  958. end

  959. #==============================================================================
  960. # ■ Game Enemy
  961. #==============================================================================
  962. class Game_Enemy < Game_Battler
  963.   
  964.   #--------------------------------------------------------------------------
  965.   # ● Tranform
  966.   #--------------------------------------------------------------------------  
  967.    alias mog_at_system_transform transform
  968.    def transform(enemy_id)
  969.        mog_at_system_transform(enemy_id)
  970.        self.atb_clear
  971.    end
  972.      
  973. end

  974. #==============================================================================
  975. # ■ BattleManager
  976. #==============================================================================
  977. module BattleManager
  978.   
  979.   #--------------------------------------------------------------------------
  980.   # ● Start Command Input
  981.   #--------------------------------------------------------------------------
  982.   def self.input_start
  983.       @phase = :input if @phase != :input
  984.       return !@surprise && $game_party.inputable?
  985.   end
  986.   
  987.   #--------------------------------------------------------------------------
  988.   # ● Battle Start
  989.   #--------------------------------------------------------------------------  
  990.   def self.battle_start
  991.       $game_system.battle_count += 1
  992.       $game_party.on_battle_start
  993.       $game_troop.on_battle_start
  994.       atb_initial_setup ; @turn_duration = set_turn_duration
  995.       if MOG_ATB_SYSTEM::MESSAGE_ENEMY_APPEAR
  996.          $game_troop.enemy_names.each do |name|
  997.          $game_message.add(sprintf(Vocab::Emerge, name))
  998.          end
  999.       end
  1000.       if @preemptive
  1001.          $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
  1002.       elsif @surprise
  1003.          $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
  1004.       end
  1005.       wait_for_message ; @preemptive = false ; @surprise = false
  1006.   end
  1007.   
  1008.   #--------------------------------------------------------------------------
  1009.   # ● ATB Initial Setup
  1010.   #--------------------------------------------------------------------------  
  1011.   def self.atb_initial_setup
  1012.       battlers.each do |battler|
  1013.       battler.atb_initial ; initial_atb_parameter(battler)
  1014.       end
  1015.   end
  1016.   
  1017.   #--------------------------------------------------------------------------
  1018.   # ● Initial ATB Parameter
  1019.   #--------------------------------------------------------------------------  
  1020.   def self.initial_atb_parameter(battler)
  1021.       @at_phase = 0
  1022.       nt = battler.atb_max * 30 / 100
  1023.       st = battler.atb_max * 20 / 100      
  1024.       pt = battler.atb_max * 65 / 100
  1025.       n_at = rand(nt) ; p_at = pt + rand(nt) ; s_at = rand(st)        
  1026.       if BattleManager.preemptive_attack
  1027.          battler.atb = p_at if battler.is_a?(Game_Actor)
  1028.          battler.atb = s_at if battler.is_a?(Game_Enemy)
  1029.       elsif BattleManager.surprise_attack   
  1030.          battler.atb = p_at if battler.is_a?(Game_Enemy)
  1031.          battler.atb = s_at if battler.is_a?(Game_Actor)
  1032.       else   
  1033.          battler.atb = n_at
  1034.       end
  1035.       battler.atb = battler.atb_max - 1  if battler.atb >= battler.atb_max
  1036.       battler.turn_clear if battler.dead? or battler.restriction == 4
  1037.   end
  1038.   
  1039.   #--------------------------------------------------------------------------
  1040.   # ● Set Turn Duration
  1041.   #--------------------------------------------------------------------------  
  1042.   def self.set_turn_duration
  1043.       max_battlers = battlers.size > 0 ? battlers.size : 1      
  1044.       case MOG_ATB_SYSTEM::TURN_DURATION_TYPE
  1045.         when 1 ; n  = $game_system.atb_turn_duration[1] * max_battlers         
  1046.         when 2
  1047.            turn_sp = 0
  1048.            battlers.each do |battler| turn_sp += battler.agi ; end  
  1049.            n = $game_system.atb_turn_duration[1] + (turn_sp / max_battlers)
  1050.         else ; n = $game_system.atb_turn_duration[1]
  1051.       end
  1052.       n2 = [[n, 9999].min, 120].max     
  1053.       battlers.each do |battler|
  1054.           perc = 30 * n2 / 100
  1055.           battler.atb_turn_duration = rand(perc)      
  1056.       end  
  1057.       return n2
  1058.   end
  1059.   
  1060.   #--------------------------------------------------------------------------
  1061.   # ● Force Clear Battler ATB
  1062.   #--------------------------------------------------------------------------  
  1063.   def self.force_clear_battler_atb
  1064.       battlers.each do |battler|
  1065.       battler.turn_clear if battler.dead? or battler.restriction == 4
  1066.       end
  1067.   end
  1068.   
  1069.   #--------------------------------------------------------------------------
  1070.   # ● Turn Start
  1071.   #--------------------------------------------------------------------------
  1072.   def self.turn_start   
  1073.       @phase = :turn ; clear_actor
  1074.   end  
  1075.   
  1076.   #--------------------------------------------------------------------------
  1077.   # ● Preemtive Attack
  1078.   #--------------------------------------------------------------------------  
  1079.   def self.preemptive_attack
  1080.       @preemptive
  1081.   end  
  1082.   
  1083.   #--------------------------------------------------------------------------
  1084.   # ● Suprise Attack
  1085.   #--------------------------------------------------------------------------   
  1086.   def self.surprise_attack
  1087.       @surprise
  1088.   end

  1089.   #--------------------------------------------------------------------------
  1090.   # ● Battlers
  1091.   #--------------------------------------------------------------------------   
  1092.   def self.battlers
  1093.       return $game_troop.members + $game_party.battle_members
  1094.   end  
  1095.   
  1096.   #--------------------------------------------------------------------------
  1097.   # ● Update ATB
  1098.   #--------------------------------------------------------------------------   
  1099.   def update_atb?
  1100.       return false if @atb_in_turn
  1101.       return true
  1102.   end
  1103.   
  1104.   #--------------------------------------------------------------------------
  1105.   # ● Update ATB
  1106.   #--------------------------------------------------------------------------   
  1107.   def self.update_atb
  1108.       return if $game_temp.atb_wait
  1109.       return if $game_temp.end_phase_duration[1] > 0
  1110.       return if $game_temp.battle_end      
  1111.       return if $game_temp.atb_frame_skip > 0
  1112.       return @current_battler if @current_battler
  1113.       for battler in battlers
  1114.           next if !battler_update?(battler)
  1115.           battler.atb_update
  1116.           update_battler_turn(battler)
  1117.           @current_battler = set_current_battler(battler)
  1118.           break if $game_temp.atb_frame_skip > 0
  1119.       end
  1120.       return nil
  1121.   end
  1122.   
  1123.   #--------------------------------------------------------------------------
  1124.   # ● Battler Update?
  1125.   #--------------------------------------------------------------------------   
  1126.   def self.battler_update?(battler)
  1127.       return false if battler.dead? or battler.hp == 0
  1128.       return true
  1129.   end

  1130.   #--------------------------------------------------------------------------
  1131.   # ● Update Battler Turn
  1132.   #--------------------------------------------------------------------------   
  1133.   def self.update_battler_turn(battler)
  1134.       return if @turn_duration == nil
  1135.       battler.atb_turn_duration += 1
  1136.       return if battler.atb_turn_duration < @turn_duration
  1137.       battler.atb_turn_duration = 0
  1138.       old_battler = battler
  1139.       battler.on_turn_end
  1140.       @refresh_status = true
  1141.   end
  1142.   
  1143.   #--------------------------------------------------------------------------
  1144.   # ● Set Current Battler
  1145.   #--------------------------------------------------------------------------   
  1146.   def self.set_current_battler(battler)
  1147.       return @current_battler if @current_battler
  1148.       return nil if !battler.atb_max?
  1149.       if battler.next_turn
  1150.          battler.remove_state_turn_end            
  1151.          $game_temp.remove_order(battler)
  1152.          return battler
  1153.       end
  1154.       if battler.is_a?(Game_Actor)
  1155.         if BattleManager.actor == nil         
  1156.             if $game_temp.actor_process_event != nil
  1157.                enable_actor_command?($game_temp.actor_process_event)
  1158.                prepare_actor_command($game_temp.actor_process_event)      
  1159.                $game_temp.actor_process_event = nil
  1160.             elsif $game_temp.atb_actor_order[0] != nil and
  1161.                 enable_actor_command?($game_temp.atb_actor_order[0])
  1162.                 prepare_actor_command($game_temp.atb_actor_order[0])
  1163.             else
  1164.                 prepare_actor_command(battler) if enable_actor_command?(battler)
  1165.                 if battler_confusion?(battler)                  
  1166.                    battler.make_actions
  1167.                    battler.next_turn = true if !can_execute_cast_action?(battler)
  1168.                 end      
  1169.              end
  1170.          else      
  1171.              if battler_confusion?(battler)                  
  1172.                 battler.make_actions
  1173.                 battler.next_turn = true if !can_execute_cast_action?(battler)
  1174.              end
  1175.          end
  1176.      else
  1177.          battler.make_actions
  1178.          battler.next_turn = true if !can_execute_cast_action?(battler)
  1179.       end   
  1180.       return nil
  1181.   end
  1182.   
  1183.   #--------------------------------------------------------------------------
  1184.   # ●  Enable Actor Command
  1185.   #--------------------------------------------------------------------------   
  1186.   def self.battler_confusion?(battler)
  1187.       return false if battler.hp == 0 or battler.dead?
  1188.       return true if battler.confusion?
  1189.       return false
  1190.   end
  1191.   
  1192.   #--------------------------------------------------------------------------
  1193.   # ●  Enable Actor Command
  1194.   #--------------------------------------------------------------------------   
  1195.   def self.enable_actor_command?(battler)
  1196.       return false if @command_actor != nil
  1197.       return false if battler.dead?
  1198.       return false if battler.restriction != 0
  1199.       return true
  1200.   end  
  1201.       
  1202.   #--------------------------------------------------------------------------
  1203.   # ● Prepare Actor Command
  1204.   #--------------------------------------------------------------------------   
  1205.   def self.prepare_actor_command(battler)
  1206.       battler.remove_state_turn_end      
  1207.       @command_actor = battler ; @command_selection = true
  1208.       $game_temp.remove_order(battler)      
  1209.   end
  1210.   
  1211.   #--------------------------------------------------------------------------
  1212.   # ● Can Execute Cast Action?
  1213.   #--------------------------------------------------------------------------   
  1214.   def self.can_execute_cast_action?(battler)
  1215.       item = battler.current_action.item rescue nil  
  1216.       return false if item == nil
  1217.       if item.speed != 0 and battler.atb_cast.empty?
  1218.          battler.atb_cast = [item,item.speed.abs,0]
  1219.          battler.animation_id = MOG_ATB_SYSTEM::CAST_ANIMATION
  1220.          battler.atb = 0
  1221.          return true
  1222.       end   
  1223.       return false
  1224.   end
  1225.   
  1226.   #--------------------------------------------------------------------------
  1227.   # ● Actor in turn
  1228.   #--------------------------------------------------------------------------   
  1229.   def self.actor_command?
  1230.       return false if !@command_selection
  1231.       return false if @command_actor == nil
  1232.       if @command_actor.restriction != 0
  1233.          @command_selection = false
  1234.          return false
  1235.       end   
  1236.       @command_selection = false      
  1237.       return true
  1238.   end
  1239.   
  1240.   #--------------------------------------------------------------------------
  1241.   # ● Current Battler Clear
  1242.   #--------------------------------------------------------------------------   
  1243.   def self.current_battler_clear(subject)
  1244.       return if subject == nil
  1245.       return if @current_battler == nil
  1246.       return if @current_battler != subject
  1247.       @current_battler.atb_clear
  1248.       @current_battler.atb_escape = false
  1249.       @current_battler.clear_actions
  1250.       @current_battler.next_turn = false
  1251.       @current_battler = nil
  1252.   end  
  1253.   
  1254.   #--------------------------------------------------------------------------
  1255.   # ● Command Selection Clear
  1256.   #--------------------------------------------------------------------------   
  1257.   def self.command_selection_clear
  1258.       $game_temp.remove_order(@command_actor)
  1259.       @command_selection = false ; @command_actor = nil
  1260.       $game_temp.actor_command_index = 0
  1261.   end
  1262.   
  1263.   #--------------------------------------------------------------------------
  1264.   # ● Command Selection
  1265.   #--------------------------------------------------------------------------   
  1266.   def self.command_selection?
  1267.       @command_selection
  1268.   end
  1269.   
  1270.   #--------------------------------------------------------------------------
  1271.   # ● Command Selection need clear?
  1272.   #--------------------------------------------------------------------------   
  1273.   def self.command_need_clear?
  1274.       return true if @command_actor == nil and @command_selection
  1275.       return false
  1276.   end
  1277.    
  1278.   #--------------------------------------------------------------------------
  1279.   # ● Next Command
  1280.   #--------------------------------------------------------------------------   
  1281.   def self.next_command
  1282.       if @command_actor ; @command_actor.make_actions ; return true ;end
  1283.       return false
  1284.   end  
  1285.   
  1286.   #--------------------------------------------------------------------------
  1287.   # ● Command End
  1288.   #--------------------------------------------------------------------------   
  1289.   def self.command_end
  1290.       $game_temp.remove_order(@command_actor)
  1291.       @command_selection = false
  1292.       $game_temp.actor_command_index = 0
  1293.       command_end_actor if @command_actor
  1294.       @command_actor = nil
  1295.   end

  1296.   #--------------------------------------------------------------------------
  1297.   # ● Command End Actor
  1298.   #--------------------------------------------------------------------------   
  1299.   def self.command_end_actor
  1300.       item = @command_actor.current_action.item rescue nil  
  1301.       set_cast_action(item) if set_cast_action?(item)
  1302.       @command_actor.next_turn = true if @command_actor != nil
  1303.       @current_battler = @command_actor if @current_battler == nil
  1304.       $game_temp.actor_process_event = nil
  1305.   end
  1306.       
  1307.   #--------------------------------------------------------------------------
  1308.   # ● Set Cast Action?
  1309.   #--------------------------------------------------------------------------   
  1310.   def self.set_cast_action?(item)
  1311.       if item.is_a?(RPG::Skill)
  1312.          return false if @command_actor.guard_skill_id == item.id
  1313.       end
  1314.       return false if item.nil?
  1315.       return false if item.speed == 0
  1316.       return false if !@command_actor.atb_cast.empty?
  1317.       return true
  1318.   end
  1319.   
  1320.   #--------------------------------------------------------------------------
  1321.   # ● Set Cast Action
  1322.   #--------------------------------------------------------------------------   
  1323.   def self.set_cast_action(item)
  1324.       if item.speed.abs > 10
  1325.          @command_actor.atb_cast = [item,item.speed.abs,0]
  1326.       else   
  1327.          @command_actor.atb_cast = [item,10,10]
  1328.       end  
  1329.       @command_actor.animation_id = MOG_ATB_SYSTEM::CAST_ANIMATION
  1330.       @command_actor.atb = 0 ; @command_actor.next_turn = false
  1331.       @command_actor = nil
  1332.   end      
  1333.    
  1334.   #--------------------------------------------------------------------------
  1335.   # ● End Turn
  1336.   #--------------------------------------------------------------------------
  1337.   def self.in_turn?
  1338.       return $game_temp.atb_in_turn
  1339.   end  

  1340.   #--------------------------------------------------------------------------
  1341.   # ● Set Refresh Status
  1342.   #--------------------------------------------------------------------------
  1343.   def self.set_refresh_status(value)
  1344.       @refresh_status = value
  1345.   end
  1346.   
  1347.   #--------------------------------------------------------------------------
  1348.   # ● Refresh Status
  1349.   #--------------------------------------------------------------------------
  1350.   def self.refresh_status?
  1351.       @refresh_status
  1352.   end
  1353.   
  1354.   #--------------------------------------------------------------------------
  1355.   # ● Actor
  1356.   #--------------------------------------------------------------------------
  1357.   def self.actor
  1358.       @command_actor
  1359.   end

  1360.   #--------------------------------------------------------------------------
  1361.   # ● Cancel Actor Command
  1362.   #--------------------------------------------------------------------------
  1363.   def self.cancel_actor_command(minus = false)
  1364.       @command_selection = false
  1365.       return if @command_actor == nil
  1366.       @command_actor.atb = (@command_actor.atb * 80 / 100).truncate if minus
  1367.       @command_actor = nil
  1368.       $game_temp.actor_command_index = 0
  1369.   end
  1370.   
  1371.   #--------------------------------------------------------------------------
  1372.   # ● Battler
  1373.   #--------------------------------------------------------------------------
  1374.   def self.set_battler_in_turn(battler)
  1375.       @battler_in_turn = battler
  1376.   end
  1377.   
  1378.   #--------------------------------------------------------------------------
  1379.   # ● Battler in turn?
  1380.   #--------------------------------------------------------------------------
  1381.   def self.battler_in_turn?(battler)
  1382.       return true if @battler_in_turn == battler
  1383.       return false
  1384.   end
  1385.   
  1386.   #--------------------------------------------------------------------------
  1387.   # ● Turn Start ABS
  1388.   #--------------------------------------------------------------------------
  1389.   def self.turn_start_abs
  1390.       @phase = :turn        
  1391.   end
  1392.    
  1393.   #--------------------------------------------------------------------------
  1394.   # ● Set Subject
  1395.   #--------------------------------------------------------------------------
  1396.   def self.set_subject(subject)
  1397.       @subject = subject
  1398.   end

  1399.   #--------------------------------------------------------------------------
  1400.   # ● Subject
  1401.   #--------------------------------------------------------------------------
  1402.   def self.subject
  1403.       @subject
  1404.   end  
  1405.   
  1406. end  

  1407. #==============================================================================
  1408. # ■ BattleManager
  1409. #==============================================================================
  1410. class << BattleManager
  1411.   
  1412.   #--------------------------------------------------------------------------
  1413.   # ● Init Members
  1414.   #--------------------------------------------------------------------------
  1415.   alias mog_atb_init_members init_members
  1416.   def init_members
  1417.       mog_atb_init_members
  1418.       set_init_atb_data
  1419.   end
  1420.   
  1421.   #--------------------------------------------------------------------------
  1422.   # ● Set Init ATB Data
  1423.   #--------------------------------------------------------------------------
  1424.   def set_init_atb_data
  1425.       @current_battler = nil ; @actor_in_turn = nil ; @command_selection = nil
  1426.       @atb_target_index = nil ; @command_actor = nil ; $game_temp.atb_user = nil
  1427.       $game_temp.turn_duration_clear = false ; $game_temp.battle_end = false
  1428.       $game_temp.atb_in_turn = true ; $game_temp.atb_wait = false
  1429.       @turn_duration = set_turn_duration ; @refresh_status = false
  1430.       $game_temp.atb_frame_skip = 30 ; @battler_in_turn = nil
  1431.       $game_temp.refresh_target_windows = [false,false]
  1432.       $game_temp.refresh_actor_command = false ; @subject = nil
  1433.       $game_temp.refresh_battle_atb = false ; $game_temp.atb_break_duration = 0
  1434.       $game_temp.end_phase_duration = [false,0] ; $game_temp.battle_end2 = false     
  1435.       $game_temp.actor_command_index = 0 ; $game_temp.refresh_item_window = false
  1436.       $game_system.atb_turn_duration[0] = 0 ; $game_temp.atb_stop = [false,false]
  1437.       $game_temp.atb_actor_order = [] ; $game_temp.break_command = false
  1438.       $game_temp.actor_process_event = nil ; $game_temp.hwindow_atb = false
  1439.   end
  1440.   
  1441.   #--------------------------------------------------------------------------
  1442.   # ● Determine Win/Loss Results
  1443.   #--------------------------------------------------------------------------
  1444.   alias mog_atb_judge_win_loss judge_win_loss
  1445.   def judge_win_loss
  1446.       return if $game_temp.end_phase_duration[0]
  1447.       return if $game_troop.interpreter.running?
  1448.       mog_atb_judge_win_loss
  1449.   end
  1450.   
  1451.   #--------------------------------------------------------------------------
  1452.   # ● Clear Base Parameter
  1453.   #--------------------------------------------------------------------------   
  1454.   def clear_base_parameter
  1455.       battlers.each do |battler| battler.atb_initial end
  1456.   end
  1457.   
  1458.   #--------------------------------------------------------------------------
  1459.   # ● Process Abort
  1460.   #--------------------------------------------------------------------------   
  1461.   alias mog_atb_process_abort process_abort  
  1462.   def process_abort  
  1463.       $game_temp.atb_wait = true ; $game_temp.battle_end = true
  1464.       clear_base_parameter
  1465.       mog_atb_process_abort      
  1466.   end
  1467.   
  1468.   #--------------------------------------------------------------------------
  1469.   # ● Process Defeat
  1470.   #--------------------------------------------------------------------------   
  1471.   alias mog_atb_process_defeat process_defeat
  1472.   def process_defeat
  1473.       clear_base_parameter
  1474.       $game_temp.atb_wait = true ; $game_temp.battle_end = true   
  1475.       mog_atb_process_defeat
  1476.   end  

  1477.   #--------------------------------------------------------------------------
  1478.   # ● Process Victory
  1479.   #--------------------------------------------------------------------------   
  1480.   alias mog_atb_process_victory process_victory
  1481.   def process_victory
  1482.       $game_temp.atb_wait = true ; $game_temp.battle_end = true
  1483.       mog_atb_process_victory
  1484.   end

  1485.   #--------------------------------------------------------------------------
  1486.   # ● Prior Command
  1487.   #--------------------------------------------------------------------------   
  1488.   alias mog_atb_prior_command prior_command
  1489.   def prior_command
  1490.       if $sv_camera != nil
  1491.          actor = $game_party.battle_members[@actor_index] rescue nil
  1492.          return if actor == nil
  1493.       end
  1494.       mog_atb_prior_command
  1495.   end   
  1496.   
  1497. end

  1498. #==============================================================================
  1499. # ■ Scene Battle
  1500. #==============================================================================
  1501. class Scene_Battle < Scene_Base
  1502.   include MOG_ATB_SYSTEM
  1503.   
  1504.   #--------------------------------------------------------------------------
  1505.   # ● Battle Start
  1506.   #--------------------------------------------------------------------------
  1507.   def battle_start
  1508.       BattleManager.battle_start
  1509.       process_event
  1510.       set_turn_duration
  1511.   end   
  1512.   
  1513.   #--------------------------------------------------------------------------
  1514.   # ● Set Turn Duration
  1515.   #--------------------------------------------------------------------------
  1516.   def set_turn_duration
  1517.       $game_system.atb_turn_duration = [0,BattleManager.set_turn_duration]
  1518.       @status_window.open if @status_window != nil
  1519.       BattleManager.turn_start_abs
  1520.   end     
  1521.   
  1522.   #--------------------------------------------------------------------------
  1523.   # ● Next Command
  1524.   #--------------------------------------------------------------------------  
  1525.   alias mog_atb_next_command next_command
  1526.   def next_command
  1527.       BattleManager.command_selection_clear if BattleManager.command_selection_clear?
  1528.       mog_atb_next_command
  1529.   end   
  1530.   
  1531.   #--------------------------------------------------------------------------
  1532.   # ● Process Action
  1533.   #--------------------------------------------------------------------------  
  1534.   def process_action
  1535.       process_atb_type
  1536.       return if !process_action_atb?
  1537.       update_turn if update_turn?
  1538.       @subject = BattleManager.update_atb
  1539.       process_actor_command if BattleManager.actor_command?
  1540.       force_refresh_status if BattleManager.refresh_status?
  1541.       process_action_atb if @subject
  1542.   end  

  1543.   #--------------------------------------------------------------------------
  1544.   # ● Update Break Phase
  1545.   #--------------------------------------------------------------------------  
  1546.   def update_break_phase
  1547.       $game_temp.atb_break_duration += 1
  1548.       return if $game_temp.atb_break_duration < 30
  1549.       $game_temp.atb_break_duration = 0
  1550.       process_atb_break if proccess_atb_break?
  1551.   end
  1552.   
  1553.   #--------------------------------------------------------------------------
  1554.   # ● Process ATB Break
  1555.   #--------------------------------------------------------------------------  
  1556.   def process_atb_break      
  1557.       if BattleManager.actor != nil
  1558.          BattleManager.actor.atb -= 1
  1559.          if BattleManager.actor.restriction == 4 or BattleManager.actor.hp == 0 or
  1560.             BattleManager.actor.dead?
  1561.             BattleManager.actor.turn_clear
  1562.          end
  1563.       end
  1564.       hide_base_window
  1565.       BattleManager.command_selection_clear
  1566.   end
  1567.   
  1568.   #--------------------------------------------------------------------------
  1569.   # ● Process Action
  1570.   #--------------------------------------------------------------------------  
  1571.   def proccess_atb_break?
  1572.       return false if $game_troop.interpreter.running?
  1573.       members_atb_max = true
  1574.       members_next_turn = true
  1575.       for battler in $game_party.battle_members
  1576.           members_atb_max = false if !battler.atb_max?
  1577.           members_next_turn = false if !battler.next_turn         
  1578.       end
  1579.       if BattleManager.actor != nil
  1580.          return true if can_break_actor_command?
  1581.        else
  1582.          return true if members_atb_max and !members_next_turn
  1583.       end
  1584.       return false
  1585.   end

  1586.   #--------------------------------------------------------------------------
  1587.   # ● Can Break Actor Command
  1588.   #--------------------------------------------------------------------------  
  1589.   def can_break_actor_command?
  1590.       return true if BattleManager.actor.next_turn
  1591.       return true if BattleManager.actor.restriction > 0
  1592.       return true if BattleManager.actor.dead? or BattleManager.actor.hp == 0
  1593.       return true if !base_window_active?
  1594.       return false
  1595.   end
  1596.   
  1597.   #--------------------------------------------------------------------------
  1598.   # ● Base Window Active
  1599.   #--------------------------------------------------------------------------  
  1600.   def base_window_active?
  1601.       return true if @actor_window.active
  1602.       return true if @enemy_window.active
  1603.       return true if @item_window.active
  1604.       return true if @skill_window.active
  1605.       return true if @party_command_window.active
  1606.       return true if @actor_command_window.active
  1607.       return false
  1608.   end
  1609.   
  1610.   #--------------------------------------------------------------------------
  1611.   # ● Process Action
  1612.   #--------------------------------------------------------------------------  
  1613.   def process_action_atb
  1614.       $game_temp.remove_order(@subject)
  1615.       loop do
  1616.           if @subject == nil
  1617.              turn_end_subject_nil
  1618.              break
  1619.           end   
  1620.           BattleManager.set_battler_in_turn(@subject)
  1621.           BattleManager.set_subject(@subject)
  1622.           @log_window.clear
  1623.           if @subject.atb_escape
  1624.              process_escape
  1625.              break
  1626.           end
  1627.           process_before_execute_action
  1628.           process_execute_action if @subject.current_action
  1629.           process_after_execute_action
  1630.           hide_windows_for_dead
  1631.           if break_process_action_atb?
  1632.              process_action_end
  1633.              turn_end
  1634.              break
  1635.           end  
  1636.       end
  1637.   end

  1638.   #--------------------------------------------------------------------------
  1639.   # ● Break Process Action Atb
  1640.   #--------------------------------------------------------------------------   
  1641.   def break_process_action_atb?
  1642.       return true if !@subject.current_action
  1643.       return true if @subject.restriction == 4
  1644.       return true if @subject.dead? or @subject.hp == 0
  1645.       return false
  1646.   end
  1647.   
  1648.   #--------------------------------------------------------------------------
  1649.   # ● Can Break Process Action?
  1650.   #--------------------------------------------------------------------------  
  1651.   def can_break_process_action?
  1652.       return true if @subject == nil
  1653.       return false
  1654.   end
  1655.   
  1656.   #--------------------------------------------------------------------------
  1657.   # ● Can Break Command?
  1658.   #--------------------------------------------------------------------------   
  1659.   def can_break_command?
  1660.       return false if BattleManager.actor == nil
  1661.       return true if BattleManager.actor.hp == 0
  1662.       return true if BattleManager.actor.dead?
  1663.       return true if BattleManager.actor.restriction != 0
  1664.       return false
  1665.   end

  1666.   #--------------------------------------------------------------------------
  1667.   # ● Can Break Command2
  1668.   #--------------------------------------------------------------------------   
  1669.   def can_break_command2?
  1670.       return false if BattleManager.actor != nil
  1671.       return true if BattleManager.command_selection?
  1672.       return false
  1673.   end  
  1674.   
  1675.   #--------------------------------------------------------------------------
  1676.   # ● Break Command
  1677.   #--------------------------------------------------------------------------   
  1678.   def break_command
  1679.       $game_temp.break_command = false
  1680.       BattleManager.actor.turn_clear if BattleManager.actor != nil
  1681.       hide_base_window
  1682.       BattleManager.command_selection_clear
  1683.   end      

  1684.   #--------------------------------------------------------------------------
  1685.   # ● Turn End Subject Nil
  1686.   #--------------------------------------------------------------------------   
  1687.   def turn_end_subject_nil
  1688.       refresh_status
  1689.       BattleManager.judge_win_loss
  1690.       @subject =  nil
  1691.       BattleManager.set_subject(@subject)
  1692.       @log_window.wait
  1693.       @log_window.clear
  1694.       $game_temp.atb_break_duration = 100
  1695.       execute_event_phase if execute_event_phase_turn?
  1696.   end   
  1697.   
  1698.   #--------------------------------------------------------------------------
  1699.   # ● Process Escape
  1700.   #--------------------------------------------------------------------------  
  1701.   def process_escape
  1702.       if BattleManager.process_escape     
  1703.          process_execute_escape
  1704.       else   
  1705.          start_actor_command_selection if BattleManager.actor
  1706.          @status_window.open
  1707.       end  
  1708.       turn_end   
  1709.   end
  1710.       
  1711.   #--------------------------------------------------------------------------
  1712.   # ● Process Actor Command
  1713.   #--------------------------------------------------------------------------  
  1714.   def process_actor_command
  1715.       start_actor_command_selection
  1716.   end
  1717.   
  1718.   #--------------------------------------------------------------------------
  1719.   # ● Process Before Execute Action
  1720.   #--------------------------------------------------------------------------  
  1721.   def process_before_execute_action   
  1722.   end  
  1723.   
  1724.   #--------------------------------------------------------------------------
  1725.   # ● Process After Execute Action
  1726.   #--------------------------------------------------------------------------  
  1727.   def process_after_execute_action   
  1728.   end   
  1729.   
  1730.   #--------------------------------------------------------------------------
  1731.   # ● Refresh Actor Command
  1732.   #--------------------------------------------------------------------------  
  1733.   def refresh_actor_command?
  1734.       return false if !$game_temp.refresh_actor_command
  1735.       return false if !@actor_command_window.active
  1736.       return false if !BattleManager.actor
  1737.       return true
  1738.   end  

  1739.   #--------------------------------------------------------------------------
  1740.   # ● Update Actor Command
  1741.   #--------------------------------------------------------------------------  
  1742.   def update_actor_command
  1743.       return if !@actor_command_window.active
  1744.       return if !BattleManager.actor
  1745.       if ENABLE_BUTTON_NEXT_ACTOR
  1746.          if Input.trigger?(BUTTON_NEXT_ACTOR_LEFT) ; turn_to_next_actor(-1) rescue nil
  1747.          elsif Input.trigger?(BUTTON_NEXT_ACTOR_RIGHT) ; turn_to_next_actor(1) rescue nil
  1748.          end  
  1749.       end   
  1750.   end  

  1751.   #--------------------------------------------------------------------------
  1752.   # ● Turn To Next Actor
  1753.   #--------------------------------------------------------------------------  
  1754.   def turn_to_next_actor(value)
  1755.       return if BattleManager.actor == nil
  1756.       next_index = BattleManager.actor.index + value
  1757.       next_index = 0 if next_index >= $game_party.battle_members.size
  1758.       battler = $game_party.battle_members[next_index]
  1759.       next_act = false
  1760.       if battler.movable_atb?
  1761.          cancel_actor_command_scene(false) ; BattleManager.prepare_actor_command(battler)
  1762.          process_actor_command if BattleManager.actor_command?
  1763.          next_act = true
  1764.       else           
  1765.         @tnext_index = value   
  1766.          for battler in $game_party.battle_members
  1767.              next_index += @tnext_index
  1768.              if next_index >= $game_party.battle_members.size
  1769.                 next_index = 0 ; @tnext_index = 1
  1770.                 if next_actor_command?(next_index) ; next_act = true ; break ; end
  1771.              elsif next_index < 0
  1772.                 next_index = $game_party.battle_members.size ;  @tnext_index = -1
  1773.                 if next_actor_command?(next_index) ; next_act = true ; break ; end
  1774.              end
  1775.              if next_actor_command?(next_index) ; next_act = true ; break ; end
  1776.          end  
  1777.       end
  1778.      Sound.play_cancel if !next_act
  1779.   end
  1780.          
  1781.   #--------------------------------------------------------------------------
  1782.   # ● Next Actor Command?
  1783.   #--------------------------------------------------------------------------  
  1784.   def next_actor_command?(next_index)
  1785.       for battler in $game_party.battle_members
  1786.           next if next_index == BattleManager.actor.index
  1787.           if next_index == battler.index and battler.movable_atb?
  1788.              cancel_actor_command_scene(false)
  1789.              BattleManager.prepare_actor_command(battler)
  1790.              process_actor_command if BattleManager.actor_command?
  1791.              return true
  1792.           end            
  1793.       end
  1794.       return false
  1795.   end  
  1796.          
  1797.   #--------------------------------------------------------------------------
  1798.   # ● Cancel Actor Command scene
  1799.   #--------------------------------------------------------------------------  
  1800.   def cancel_actor_command_scene(atb_cost = false)
  1801.       @actor_command_window.close ; @actor_command_window.hide_all
  1802.       BattleManager.cancel_actor_command(atb_cost)
  1803.   end
  1804.   
  1805.   #--------------------------------------------------------------------------
  1806.   # ● Update Party Command
  1807.   #--------------------------------------------------------------------------      
  1808.   def update_party_command
  1809.       return if !@party_command_window.active
  1810.       return if !BattleManager.actor
  1811.       if Input.trigger?(:B)
  1812.          Sound.play_cancel
  1813.          @party_command_window.deactivate ; start_actor_command_selection
  1814.       end  
  1815.   end
  1816.   
  1817.   #--------------------------------------------------------------------------
  1818.   # ● Create All Windows
  1819.   #--------------------------------------------------------------------------      
  1820.   alias mog_atb_create_all_windows create_all_windows
  1821.   def create_all_windows
  1822.       mog_atb_create_all_windows
  1823.       @pre_viewport_visible = true
  1824.       @info_xy = [0,(Graphics.width - @status_window.width) / 2, Graphics.width - @status_window.width ]
  1825.   end  
  1826.   
  1827.   #--------------------------------------------------------------------------
  1828.   # ● Update Info Viewport
  1829.   #--------------------------------------------------------------------------      
  1830.   def update_info_viewport
  1831.       if center_viewport?
  1832.          move_info_viewport(@info_xy[1]) ; return
  1833.       end
  1834.       if @party_command_window.active ; move_info_viewport(@info_xy[0])   
  1835.       elsif BattleManager.actor ; move_info_viewport(@info_xy[2])
  1836.       else ; move_info_viewport(@info_xy[1])
  1837.       end  
  1838.   end  

  1839.   #--------------------------------------------------------------------------
  1840.   # ● Update Info Viewport
  1841.   #--------------------------------------------------------------------------      
  1842.   def center_viewport?
  1843.       return true if $game_message.visible
  1844.       return true if BattleManager.actor == nil
  1845.       return true if $game_temp.battle_end
  1846.       return false
  1847.   end
  1848.   
  1849.   #--------------------------------------------------------------------------
  1850.   # ● Process Action ATB
  1851.   #--------------------------------------------------------------------------  
  1852.   def process_action_atb?  
  1853.       return false if $game_troop.interpreter.running?
  1854.       return false if $game_temp.end_phase_duration[1] > 0  
  1855.       return false if $game_temp.atb_wait
  1856.       return false if $game_temp.battle_end
  1857.       return false if $game_temp.battle_end2
  1858.       return false if scene_changing?
  1859.       return false if !$game_temp.sprite_visible
  1860.       return false if $game_temp.atb_stop[1]
  1861.       return false if @combatlog_window.visible if @combatlog_window != nil
  1862.       return true
  1863.   end
  1864.   
  1865.   #--------------------------------------------------------------------------
  1866.   # ● Process ATB Type
  1867.   #--------------------------------------------------------------------------  
  1868.   def process_atb_type
  1869.       $game_temp.atb_frame_skip -= 1 if $game_temp.atb_frame_skip > 0
  1870.       return if $game_temp.battle_end
  1871.       return if $game_temp.end_phase_duration[1] > 0
  1872.       case $game_system.atb_type
  1873.            when 0 ; $game_temp.atb_wait = set_atb_type_wait
  1874.            when 1 ; $game_temp.atb_wait = set_atb_type_semi_wait
  1875.            else ; $game_temp.atb_wait = false
  1876.       end
  1877.   end
  1878.       
  1879.   #--------------------------------------------------------------------------
  1880.   # ● Set Atb Type Wait
  1881.   #--------------------------------------------------------------------------  
  1882.   def set_atb_type_wait
  1883.       return true if @actor_window.active
  1884.       return true if @enemy_window.active
  1885.       return true if @item_window.active
  1886.       return true if @skill_window.active
  1887.       return true if @party_command_window.active
  1888.       return true if @actor_command_window.active
  1889.       return false
  1890.   end
  1891.   
  1892.   #--------------------------------------------------------------------------
  1893.   # ● Set Atb Type Semi Wait
  1894.   #--------------------------------------------------------------------------  
  1895.   def set_atb_type_semi_wait
  1896.       return true if @item_window.active
  1897.       return true if @skill_window.active
  1898.       return false   
  1899.   end
  1900.   
  1901.   #--------------------------------------------------------------------------
  1902.   # ● Process Execute Escape
  1903.   #--------------------------------------------------------------------------  
  1904.   def process_execute_escape
  1905.       $game_temp.battle_end = true
  1906.       hide_base_window
  1907.       $game_temp.atb_user = nil
  1908.       $game_temp.battle_cursor[2] = false if $imported[:mog_battle_cursor]
  1909.       BattleManager.command_selection_clear
  1910.   end
  1911.   
  1912.   #--------------------------------------------------------------------------
  1913.   # ● Battle End?
  1914.   #--------------------------------------------------------------------------  
  1915.   def battle_end?
  1916.       return true if $game_party.members.empty?
  1917.       return true if $game_party.all_dead?
  1918.       return true if $game_troop.all_dead?
  1919.       return true if $game_temp.battle_end
  1920.       return false
  1921.   end
  1922.    
  1923.   #--------------------------------------------------------------------------
  1924.   # ● Command Escape
  1925.   #--------------------------------------------------------------------------  
  1926.   def command_escape
  1927.       BattleManager.actor.atb_escape = true if BattleManager.actor
  1928.       BattleManager.command_end
  1929.       @party_command_window.close
  1930.       hide_base_window
  1931.   end  
  1932.   
  1933.   #--------------------------------------------------------------------------
  1934.   # ● Command Escape2
  1935.   #--------------------------------------------------------------------------  
  1936.   def command_escape2
  1937.      turn_start unless BattleManager.process_escape
  1938.   end
  1939.    
  1940.   #--------------------------------------------------------------------------
  1941.   # ● Execute Action
  1942.   #--------------------------------------------------------------------------  
  1943.   alias mog_atb_execute_action execute_action
  1944.   def execute_action
  1945.       @cp_members = []
  1946.       return if battle_end? or @subject == nil
  1947.       @cp_members = current_cp_members if can_execute_cooperation_skill?            
  1948.       mog_atb_execute_action
  1949.   end
  1950.   
  1951.   #--------------------------------------------------------------------------
  1952.   # ● Use Item
  1953.   #--------------------------------------------------------------------------  
  1954.   alias mog_atb_use_item use_item
  1955.   def use_item
  1956.       return if battle_end? or @subject == nil
  1957.       mog_atb_use_item
  1958.   end
  1959.   
  1960.   #--------------------------------------------------------------------------
  1961.   # ● Show Animation
  1962.   #--------------------------------------------------------------------------  
  1963.   alias mog_atb_event_show_animation show_animation
  1964.   def show_animation(targets, animation_id)
  1965.       execute_event_phase if execute_event_phase_turn?
  1966.       mog_atb_event_show_animation(targets, animation_id)   
  1967.   end
  1968.   
  1969.   #--------------------------------------------------------------------------
  1970.   # ● Force Refresh Status
  1971.   #--------------------------------------------------------------------------  
  1972.   def force_refresh_status
  1973.       BattleManager.set_refresh_status(false)
  1974.       refresh_status
  1975.   end

  1976.   #--------------------------------------------------------------------------
  1977.   # ● Refresh Battle ATB
  1978.   #--------------------------------------------------------------------------  
  1979.   def refresh_battle_atb
  1980.       $game_temp.refresh_battle_atb = false
  1981.       hide_base_window
  1982.       battle_start      
  1983.   end

  1984.   #--------------------------------------------------------------------------
  1985.   # ● Hide Base Window
  1986.   #--------------------------------------------------------------------------  
  1987.   def hide_base_window(target_window = true,actor_window = false)
  1988.       @actor_window.hide
  1989.       @actor_window.active = false
  1990.       @enemy_window.hide
  1991.       @enemy_window.active = false
  1992.       @help_window.hide
  1993.       @party_command_window.deactivate
  1994.       @party_command_window.close
  1995.       @status_window.unselect
  1996.       instance_variables.each do |varname|
  1997.          ivar = instance_variable_get(varname)
  1998.          if ivar.is_a?(Window)
  1999.             next if !need_hide_window?(ivar,actor_window)            
  2000.             ivar.hide_all
  2001.          end   
  2002.       end
  2003.       @pre_viewport_visible = @info_viewport.visible
  2004.       @info_viewport.visible = true ; @status_window.show
  2005.       @status_aid_window.hide_all if @status_aid_window != nil
  2006.   end

  2007.   #--------------------------------------------------------------------------
  2008.   # ● Need Hide Window?
  2009.   #--------------------------------------------------------------------------  
  2010.   def need_hide_window?(ivar,actor_window)
  2011.       return false if ivar.is_a?(Window_Message)
  2012.       return false if ivar.is_a?(Window_BattleActor)
  2013.       return false if ivar.is_a?(Window_BattleEnemy)
  2014.       return false if ivar.is_a?(Window_BattleStatus)
  2015.       return false if ivar.is_a?(Window_PartyCommand)
  2016.       return false if ivar.is_a?(Window_ActorCommand) and actor_window
  2017.       if $imported["YEA-VictoryAftermath"]
  2018.          return false if ivar.is_a?(Window_VictoryTitle)
  2019.          return false if ivar.is_a?(Window_VictoryEXP_Back)
  2020.          return false if ivar.is_a?(Window_VictoryEXP_Front)
  2021.          return false if ivar.is_a?(Window_VictoryLevelUp)
  2022.          return false if ivar.is_a?(Window_VictorySkills)
  2023.          return false if ivar.is_a?(Window_VictorySpoils)
  2024.       end      
  2025.       return true
  2026.   end     
  2027.   
  2028.   #--------------------------------------------------------------------------
  2029.   # ● Record Window Data
  2030.   #--------------------------------------------------------------------------  
  2031.   def record_window_data(target_window = true)
  2032.       return if $game_temp.hwindow_atb
  2033.       $game_temp.hwindow_atb = true
  2034.       @pre_battler = BattleManager.actor
  2035.       @battler_in_turn_temp = @actor_command_window.active
  2036.       instance_variables.each do |varname|
  2037.          ivar = instance_variable_get(varname)
  2038.          ivar.record_data if ivar.is_a?(Window)
  2039.       end      
  2040.       if $imported[:mog_battle_cursor]
  2041.          @battle_cursor_visible = $game_temp.battle_cursor[2]
  2042.          $game_temp.battle_cursor[2] = false
  2043.       end         
  2044.       hide_base_window(target_window)   
  2045.   end
  2046.    
  2047.   #--------------------------------------------------------------------------
  2048.   # ● Fade Base Window
  2049.   #--------------------------------------------------------------------------  
  2050.   def fade_base_window(fade_value)
  2051.       instance_variables.each do |varname|
  2052.          ivar = instance_variable_get(varname)
  2053.          if ivar.is_a?(Window)
  2054.             next if !need_fade_after_battle?(ivar)
  2055.             ivar.opacity -= fade_value
  2056.             ivar.contents_opacity -= fade_value
  2057.          end
  2058.       end
  2059.   end  
  2060.   
  2061.   #--------------------------------------------------------------------------
  2062.   # ● Need Fade After Battle?
  2063.   #--------------------------------------------------------------------------  
  2064.   def need_fade_after_battle?(ivar)
  2065.       return false if ivar.is_a?(Window_Message)
  2066.       if $imported["YEA-VictoryAftermath"]
  2067.          return false if ivar.is_a?(Window_VictoryTitle)
  2068.          return false if ivar.is_a?(Window_VictoryEXP_Back)
  2069.          return false if ivar.is_a?(Window_VictoryEXP_Front)
  2070.          return false if ivar.is_a?(Window_VictoryLevelUp)
  2071.          return false if ivar.is_a?(Window_VictorySkills)
  2072.          return false if ivar.is_a?(Window_VictorySpoils)
  2073.       end
  2074.       return true
  2075.   end   

  2076.   #--------------------------------------------------------------------------
  2077.   # ● Record Window Data
  2078.   #--------------------------------------------------------------------------  
  2079.   def restore_window_data
  2080.       return if battle_end?
  2081.        if @pre_battler and @pre_battler.dead?
  2082.           hide_windows_for_dead
  2083.        else
  2084.           instance_variables.each do |varname|
  2085.              ivar = instance_variable_get(varname)
  2086.              ivar.restore_data if ivar.is_a?(Window)
  2087.           end   
  2088.           @info_viewport.visible = @pre_viewport_visible
  2089.           @actor_command_window.open if @actor_command_window.visible
  2090.           @status_window.open if @status_window.visible
  2091.           @actor_window.show if @actor_window.active
  2092.           @actor_window.restore_data if @actor_window.active
  2093.           @enemy_window.show if @enemy_window.active
  2094.           @enemy_window.restore_data if @enemy_window.active
  2095.           start_actor_command_selection(false) if @actor_command_window.active
  2096.           start_party_command_selection if @party_command_window.active
  2097.           if $imported[:mog_battle_cursor]
  2098.              $game_temp.battle_cursor[2] = @battle_cursor_visible
  2099.           end
  2100.       end
  2101.       $game_temp.hwindow_atb = false
  2102.   end
  2103.    
  2104.   #--------------------------------------------------------------------------
  2105.   # ● Hide Windows for dead
  2106.   #--------------------------------------------------------------------------  
  2107.   def hide_windows_for_dead
  2108.       return if BattleManager.actor == nil
  2109.       return if !BattleManager.actor.dead?
  2110.       hide_base_window
  2111.       $game_temp.atb_user = nil
  2112.       $game_temp.battle_cursor[2] = false if $imported[:mog_battle_cursor]
  2113.       BattleManager.command_selection_clear
  2114.   end

  2115.   #--------------------------------------------------------------------------
  2116.   # ● Update Target Windows
  2117.   #--------------------------------------------------------------------------  
  2118.   def update_target_windows
  2119.       if @actor_window.active and $game_temp.refresh_target_windows[0]
  2120.          @actor_window.refresh
  2121.          @actor_window.update
  2122.          $game_temp.refresh_target_windows[0] = false
  2123.       end  
  2124.       if @enemy_window.active and $game_temp.refresh_target_windows[1]
  2125.          @enemy_window.refresh
  2126.          @enemy_window.cursor_left if @enemy_window.enemy == nil
  2127.          @enemy_window.update
  2128.          $game_temp.refresh_target_windows[1] = false
  2129.       end
  2130.   end  
  2131.   
  2132.   #--------------------------------------------------------------------------
  2133.   # ● Process Execute Action
  2134.   #--------------------------------------------------------------------------  
  2135.   def process_execute_action
  2136.       @subject.current_action.prepare
  2137.       if @subject.current_action.valid?      
  2138.          @status_window.open ; execute_action
  2139.       end
  2140.       process_before_remove_action
  2141.       @subject.remove_current_action
  2142.   end

  2143.   #--------------------------------------------------------------------------
  2144.   # ● Process Before Remove Action
  2145.   #--------------------------------------------------------------------------  
  2146.   def process_before_remove_action   
  2147.   end
  2148.   
  2149.   #--------------------------------------------------------------------------
  2150.   # * End Turn
  2151.   #--------------------------------------------------------------------------
  2152.   def turn_end
  2153.       BattleManager.set_battler_in_turn(nil)   
  2154.       all_battle_members.each do |battler|
  2155.           refresh_status
  2156.           @log_window.wait_and_clear
  2157.       end
  2158.       turn_reset
  2159.   end  
  2160.   
  2161.   #--------------------------------------------------------------------------
  2162.   # ● Turn Reset
  2163.   #--------------------------------------------------------------------------
  2164.   def turn_reset
  2165.       $game_temp.remove_order(@subject)      
  2166.       BattleManager.current_battler_clear(@subject)
  2167.       BattleManager.command_selection_clear if BattleManager.command_need_clear?
  2168.       @subject =  nil
  2169.       BattleManager.set_subject(@subject)
  2170.       @log_window.wait
  2171.       @log_window.clear      
  2172.       $game_temp.atb_break_duration = 100
  2173.   end
  2174.      
  2175.   #--------------------------------------------------------------------------
  2176.   # ● Execute Event Phase Turn?
  2177.   #--------------------------------------------------------------------------
  2178.   def execute_event_phase_turn?
  2179.       return false if !$game_troop.can_interpreter_running?(false)
  2180.       return false if $game_party.members.empty?
  2181.       return false if $game_party.all_dead?
  2182.       return false if $game_troop.all_dead?
  2183.       return true
  2184.   end  
  2185.       
  2186.   #--------------------------------------------------------------------------
  2187.   # ● Update
  2188.   #--------------------------------------------------------------------------            
  2189.   def update
  2190.       update_basic   
  2191.       refresh_battle_atb if $game_temp.refresh_battle_atb
  2192.       process_action if BattleManager.in_turn?
  2193.       update_end_phase if $game_temp.end_phase_duration[1] > 0
  2194.   end  
  2195.   
  2196.   #--------------------------------------------------------------------------
  2197.   # ● Update Basic
  2198.   #--------------------------------------------------------------------------            
  2199.   alias mog_atb_update_basic update_basic
  2200.   def update_basic
  2201.       update_break_phase
  2202.       break_command if force_break_command?
  2203.       update_atb_basic if !$game_troop.interpreter.running?
  2204.       mog_atb_update_basic
  2205.   end
  2206.      
  2207.   #--------------------------------------------------------------------------
  2208.   # ● Force Break Command
  2209.   #--------------------------------------------------------------------------            
  2210.   def force_break_command?
  2211.       return true if $game_temp.break_command
  2212.       return true if can_break_command?
  2213.       return true if can_break_command2?
  2214.       return false
  2215.   end
  2216.   
  2217.   #--------------------------------------------------------------------------
  2218.   # ● Update Atb Basic
  2219.   #--------------------------------------------------------------------------            
  2220.   def update_atb_basic
  2221.       if @actor_command_window.active
  2222.          update_actor_command
  2223.       else   
  2224.          update_party_command
  2225.       end   
  2226.       update_target_windows      
  2227.       refresh_item_skill_window if need_refresh_item_skill_window?
  2228.       start_actor_command_selection if refresh_actor_command?
  2229.       fade_base_window(15) if $game_temp.battle_end
  2230.   end  
  2231.   
  2232.   #--------------------------------------------------------------------------
  2233.   # ● Need Refresh Item Skill Window?
  2234.   #--------------------------------------------------------------------------            
  2235.   def need_refresh_item_skill_window?
  2236.       return true if $game_temp.refresh_item_window
  2237.       return false
  2238.   end
  2239.    
  2240.   #--------------------------------------------------------------------------
  2241.   # ● Refresh Item Skill Window
  2242.   #--------------------------------------------------------------------------            
  2243.   def refresh_item_skill_window
  2244.       $game_temp.refresh_item_window = false
  2245.       @item_window.refresh if @item_window.visible
  2246.       @skill_window.refresh if @skill_window.visible
  2247.   end
  2248.   
  2249.   #--------------------------------------------------------------------------
  2250.   # ● Update End Phase
  2251.   #--------------------------------------------------------------------------            
  2252.   def update_end_phase
  2253.       $game_temp.end_phase_duration[1] -= 1
  2254.       return if $game_temp.end_phase_duration[1] > 0
  2255.       $game_temp.end_phase_duration[0] = false
  2256.       BattleManager.judge_win_loss
  2257.   end
  2258.   
  2259.   #--------------------------------------------------------------------------
  2260.   # ● Process Event
  2261.   #--------------------------------------------------------------------------            
  2262.   alias mog_atb_process_event process_event
  2263.   def process_event
  2264.       if battle_end? ; hide_base_window ; $game_temp.end_phase_duration = [true,30] ; end
  2265.       $game_temp.actor_process_event = BattleManager.actor
  2266.       mog_atb_process_event
  2267.       process_break_atb_event
  2268.   end
  2269.   
  2270.   #--------------------------------------------------------------------------
  2271.   # ● Process Break ATB Event
  2272.   #--------------------------------------------------------------------------            
  2273.   def process_break_atb_event
  2274.       if break_actor_command?
  2275.          BattleManager.actor.turn_clear
  2276.          BattleManager.command_selection_clear
  2277.       end
  2278.       BattleManager.force_clear_battler_atb
  2279.   end
  2280.   
  2281.   #--------------------------------------------------------------------------
  2282.   # ● Break Actor Command
  2283.   #--------------------------------------------------------------------------            
  2284.   def break_actor_command?
  2285.       return false if BattleManager.actor == nil
  2286.       return true if BattleManager.actor.dead?
  2287.       return true if BattleManager.actor.restriction != 0
  2288.       return false
  2289.   end
  2290.   
  2291.   #--------------------------------------------------------------------------
  2292.   # * Processing at End of Action
  2293.   #--------------------------------------------------------------------------
  2294.   alias mog_atb_process_action_end process_action_end
  2295.   def process_action_end
  2296.       if battle_end? ; hide_base_window ; $game_temp.end_phase_duration = [true,30] ; end
  2297.       mog_atb_process_action_end
  2298.   end  
  2299.   
  2300.   #--------------------------------------------------------------------------
  2301.   # ● Update Turn
  2302.   #--------------------------------------------------------------------------            
  2303.   def update_turn
  2304.       force_reset_turn_duration if $game_temp.turn_duration_clear
  2305.       $game_system.atb_turn_duration[0] += 1 unless $game_troop.interpreter.running?
  2306.       if $game_system.atb_turn_duration[0] >= $game_system.atb_turn_duration[1]
  2307.          $game_system.atb_turn_duration[0] = 0
  2308.          $game_troop.increase_turn
  2309.          execute_event_phase if $game_troop.can_interpreter_running?(true)
  2310.       end  
  2311.   end  
  2312.   
  2313.   #--------------------------------------------------------------------------
  2314.   # ● Update Turn
  2315.   #--------------------------------------------------------------------------            
  2316.   def update_turn?
  2317.       return false if $game_system.atb_turn_duration == nil or $game_system.atb_turn_duration[0] == nil
  2318.       return false if $game_temp.end_phase_duration[1] > 0
  2319.       return false if $game_temp.battle_end
  2320.       return false if $game_temp.atb_stop[1]   
  2321.       return true
  2322.   end   
  2323.   
  2324.   #--------------------------------------------------------------------------
  2325.   # ● Execute Event Phase
  2326.   #--------------------------------------------------------------------------            
  2327.   def execute_event_phase
  2328.       if $game_troop.can_interpreter_hide_window? or $game_troop.can_interpreter_hide_window_2?
  2329.       (record_window_data ; rw = true)
  2330.       end
  2331.       process_event
  2332.       refresh_status
  2333.       restore_window_data if rw != nil
  2334.       BattleManager.turn_start_abs      
  2335.   end   
  2336.   
  2337.   #--------------------------------------------------------------------------
  2338.   # ● Force Reset Turn Duration
  2339.   #--------------------------------------------------------------------------            
  2340.   def force_reset_turn_duration
  2341.       $game_temp.turn_duration_clear = false
  2342.       $game_system.atb_turn_duration[0] = 0
  2343.       $game_troop.set_turn(0)
  2344.   end  
  2345.   
  2346.   #--------------------------------------------------------------------------
  2347.   # ● ON Enemy OK
  2348.   #--------------------------------------------------------------------------
  2349.   alias mog_atb_on_enemy_ok on_enemy_ok
  2350.   def on_enemy_ok
  2351.       return if BattleManager.actor == nil
  2352.       return if battle_end?
  2353.       mog_atb_on_enemy_ok           
  2354.       BattleManager.command_end
  2355.       hide_base_window
  2356.   end
  2357.   
  2358.   #--------------------------------------------------------------------------
  2359.   # ● On Enemy Cancel
  2360.   #--------------------------------------------------------------------------
  2361.   alias mog_atb_on_enemy_cancel on_enemy_cancel
  2362.   def on_enemy_cancel
  2363.       return if BattleManager.actor == nil
  2364.       mog_atb_on_enemy_cancel
  2365.       start_actor_command_selection if @actor_command_window.active
  2366.       @skill_window.visible = true if @skill_window.active
  2367.       @item_window.visible = true if @item_window.active
  2368.   end     
  2369.   
  2370.   #--------------------------------------------------------------------------
  2371.   # ● On Actor OK
  2372.   #--------------------------------------------------------------------------
  2373.   alias mog_atb_on_actor_ok on_actor_ok
  2374.   def on_actor_ok
  2375.       return if BattleManager.actor == nil
  2376.       return if battle_end?
  2377.       mog_atb_on_actor_ok
  2378.       BattleManager.command_end
  2379.       hide_base_window
  2380.   end
  2381.   
  2382.   #--------------------------------------------------------------------------
  2383.   # ● On Actor Cancel
  2384.   #--------------------------------------------------------------------------
  2385.   alias mog_atb_on_actor_cancel on_actor_cancel
  2386.   def on_actor_cancel
  2387.       return if BattleManager.actor == nil
  2388.       mog_atb_on_actor_cancel
  2389.       start_actor_command_selection if @actor_command_window.active
  2390.       @skill_window.visible = true if @skill_window.active
  2391.       @item_window.visible = true if @item_window.active      
  2392.   end
  2393.   
  2394.   #--------------------------------------------------------------------------
  2395.   # ● On Skill Cancel
  2396.   #--------------------------------------------------------------------------
  2397.   alias mog_atb_on_skill_cancel on_skill_cancel
  2398.   def on_skill_cancel
  2399.       return if BattleManager.actor == nil
  2400.       mog_atb_on_skill_cancel
  2401.       start_actor_command_selection if @actor_command_window.active
  2402.   end  
  2403.   
  2404.   #--------------------------------------------------------------------------
  2405.   # ● On Item Cancel
  2406.   #--------------------------------------------------------------------------
  2407.   alias mog_atb_on_item_cancel on_item_cancel
  2408.   def on_item_cancel
  2409.       return if BattleManager.actor == nil
  2410.       mog_atb_on_item_cancel
  2411.       start_actor_command_selection if @actor_command_window.active
  2412.   end  
  2413.   
  2414.   #--------------------------------------------------------------------------
  2415.   # ● On Skill OK
  2416.   #--------------------------------------------------------------------------
  2417.   alias mog_atb_on_skill_ok on_skill_ok
  2418.   def on_skill_ok
  2419.       return if BattleManager.actor == nil
  2420.       @skill_window.visible = false unless !@status_window.visible
  2421.       mog_atb_on_skill_ok      
  2422.       if !@skill.need_selection?
  2423.          BattleManager.command_end
  2424.          hide_base_window
  2425.       end   
  2426.   end
  2427.    
  2428.   #--------------------------------------------------------------------------
  2429.   # ● On Item OK
  2430.   #--------------------------------------------------------------------------
  2431.   alias mog_atb_on_item_ok on_item_ok
  2432.   def on_item_ok
  2433.       return if BattleManager.actor == nil
  2434.       @item_window.visible = false unless !@status_window.visible
  2435.       mog_atb_on_item_ok
  2436.       if !@item.need_selection?
  2437.          BattleManager.command_end
  2438.          hide_base_window
  2439.       end
  2440.   end  
  2441.   
  2442.   #--------------------------------------------------------------------------
  2443.   # ● Start Actor Command Selection
  2444.   #--------------------------------------------------------------------------
  2445.   def start_actor_command_selection(se = true)
  2446.       $game_temp.atb_user = BattleManager.actor
  2447.       $game_temp.refresh_actor_command = false
  2448.       $game_temp.actor_process_event = nil
  2449.       if BattleManager.next_command and BattleManager.actor and BattleManager.actor.movable_atb?
  2450.          execute_start_actor_command(se)
  2451.       else   
  2452.          BattleManager.command_selection_clear
  2453.       end   
  2454.   end     

  2455.   #--------------------------------------------------------------------------
  2456.   # ● Execute Start Actor Command
  2457.   #--------------------------------------------------------------------------
  2458.   def execute_start_actor_command(se)
  2459.       $game_temp.remove_order(BattleManager.actor)      
  2460.       Audio.se_play("Audio/SE/" + SE_ACTIVE,100,100) if se
  2461.       hide_base_window(false,true) if se
  2462.       @status_window.select(BattleManager.actor.index)
  2463.       @status_window.open
  2464.       @status_window.select(BattleManager.actor.index)
  2465.       @party_command_window.close
  2466.       @actor_command_window.setup(BattleManager.actor)
  2467.       @actor_command_window.activate
  2468.       @actor_command_window.show
  2469.       @actor_command_window.index = $game_temp.actor_command_index      
  2470.   end
  2471.       
  2472.   #--------------------------------------------------------------------------
  2473.   # ● Next Command
  2474.   #--------------------------------------------------------------------------
  2475.   def next_command
  2476.   end
  2477.   
  2478.   #--------------------------------------------------------------------------
  2479.   # ● Close Base
  2480.   #--------------------------------------------------------------------------
  2481.   def close_base_window
  2482.       @party_command_window.close
  2483.       @actor_command_window.close
  2484.       @status_window.unselect
  2485.   end
  2486.    
  2487.   #--------------------------------------------------------------------------
  2488.   # ● Command Fight
  2489.   #--------------------------------------------------------------------------
  2490.   alias mog_atb_command_fight command_fight
  2491.   def command_fight
  2492.       mog_atb_command_fight
  2493.       start_actor_command_selection
  2494.   end  
  2495.   
  2496.   #--------------------------------------------------------------------------
  2497.   # ● Refresh Status
  2498.   #--------------------------------------------------------------------------
  2499.   alias mog_atb_refresh_status refresh_status
  2500.   def refresh_status
  2501.       mog_atb_refresh_status
  2502.       hide_windows_for_dead
  2503.   end

  2504.   #--------------------------------------------------------------------------
  2505.   # ● Forced Action Processing
  2506.   #--------------------------------------------------------------------------
  2507.   def process_forced_action   
  2508.       if BattleManager.action_forced?
  2509.          last_subject = @subject
  2510.          @subject = BattleManager.action_forced_battler         
  2511.          BattleManager.clear_action_force              
  2512.          execute_force_action         
  2513.          @subject = last_subject
  2514.       end
  2515.   end
  2516.   
  2517.   #--------------------------------------------------------------------------
  2518.   # ● Execute Force Action
  2519.   #--------------------------------------------------------------------------
  2520.   def execute_force_action
  2521.       return if scene_changing?
  2522.       if !@subject || !@subject.current_action
  2523.          @subject = BattleManager.next_subject
  2524.       end
  2525.       return turn_end unless @subject      
  2526.       if @subject.current_action        
  2527.          @subject.current_action.prepare
  2528.          if @subject.current_action.valid?
  2529.             @status_window.open
  2530.             execute_action
  2531.          end
  2532.          @subject.remove_current_action
  2533.        end
  2534.        process_action_end unless @subject.current_action
  2535.   end  
  2536.   
  2537.   #--------------------------------------------------------------------------
  2538.   # ● Subject Action
  2539.   #--------------------------------------------------------------------------  
  2540.   def subject_action
  2541.       return @subject.current_action.item rescue nil
  2542.   end  
  2543.   
  2544.   #--------------------------------------------------------------------------
  2545.   # ● Wait for Effect
  2546.   #--------------------------------------------------------------------------  
  2547.   alias mog_atb_cm_wait_for_effect wait_for_effect
  2548.   def wait_for_effect
  2549.       return if $game_troop.interpreter.running?
  2550.       mog_atb_cm_wait_for_effect
  2551.   end
  2552.   
  2553. end

  2554. #===============================================================================
  2555. # ■ Window Battle Skill
  2556. #===============================================================================
  2557. class Window_BattleSkill < Window_SkillList
  2558.   
  2559.   #--------------------------------------------------------------------------
  2560.   # ● Select Last
  2561.   #--------------------------------------------------------------------------
  2562.   alias mog_atb_f_select_last_skill select_last
  2563.   def select_last
  2564.       act = @actor.last_skill.object rescue nil
  2565.       act_data = @data.index(@actor.last_skill.object) rescue nil
  2566.       if act == nil or act_data == nil ; select(0) ; return ; end
  2567.       mog_atb_f_select_last_skill
  2568.   end

  2569. end

  2570. #===============================================================================
  2571. # ■ Window Battle Item
  2572. #===============================================================================
  2573. class Window_BattleItem < Window_ItemList
  2574.   
  2575.   #--------------------------------------------------------------------------
  2576.   # ● Select Last
  2577.   #--------------------------------------------------------------------------
  2578.   alias mog_atb_f_select_last_item select_last
  2579.   def select_last
  2580.       act = $game_party.last_item.object rescue nil
  2581.       act_data = @data.index($game_party.last_item.object) rescue nil
  2582.       if act == nil or act_data == nil ; select(0) ; return ; end
  2583.       mog_atb_f_select_last_item
  2584.   end
  2585.   
  2586. end

  2587. #===============================================================================
  2588. # ■ Scene Battle
  2589. #===============================================================================
  2590. class Scene_Battle < Scene_Base
  2591.   
  2592.   #--------------------------------------------------------------------------
  2593.   # ● Skip Command?
  2594.   #--------------------------------------------------------------------------
  2595.   def skip_command?
  2596.       return true if BattleManager.actor == nil
  2597.       return true if BattleManager.actor.dead?
  2598.       return true if BattleManager.actor.restriction != 0
  2599.       return false
  2600.   end
  2601.   
  2602.   #--------------------------------------------------------------------------
  2603.   # ● Command Attack
  2604.   #--------------------------------------------------------------------------
  2605.   alias mog_atb_f_command_attack command_attack
  2606.   def command_attack
  2607.       if skip_command? ; break_command ; return ; end
  2608.       mog_atb_f_command_attack
  2609.   end

  2610.   #--------------------------------------------------------------------------
  2611.   # ● Command Skill
  2612.   #--------------------------------------------------------------------------
  2613.   alias mog_atb_f_command_skill command_skill
  2614.   def command_skill
  2615.       if skip_command? ; break_command ; return ; end
  2616.       mog_atb_f_command_skill
  2617.   end

  2618.   #--------------------------------------------------------------------------
  2619.   # ● Command Guard
  2620.   #--------------------------------------------------------------------------
  2621.   alias mog_atb_f_command_guard command_guard
  2622.   def command_guard
  2623.       if skip_command? ; break_command ; return ; end
  2624.       mog_atb_f_command_guard
  2625.       BattleManager.command_end
  2626.       hide_base_window      
  2627.   end
  2628.   
  2629.   #--------------------------------------------------------------------------
  2630.   # ● Command Item
  2631.   #--------------------------------------------------------------------------
  2632.   alias mog_atb_f_command_item command_item
  2633.   def command_item
  2634.       if skip_command? ; break_command ; return ; end
  2635.       mog_atb_f_command_item
  2636.   end  
  2637.   
  2638. end

  2639. #==============================================================================
  2640. # ■ SpritesetBattle
  2641. #==============================================================================
  2642. class Spriteset_Battle
  2643.   
  2644.   include MOG_ATB_SYSTEM
  2645.   
  2646.   #--------------------------------------------------------------------------
  2647.   # ● Initialize
  2648.   #--------------------------------------------------------------------------   
  2649.   alias mog_atb_display_turn_initialize initialize
  2650.   def initialize
  2651.       create_turn_number
  2652.       mog_atb_display_turn_initialize
  2653.   end
  2654.   
  2655.   #--------------------------------------------------------------------------
  2656.   # ● Dispose
  2657.   #--------------------------------------------------------------------------  
  2658.   alias mog_atb_display_turn_dispose dispose
  2659.   def dispose
  2660.       mog_atb_display_turn_dispose
  2661.       dispose_turn_number
  2662.   end
  2663.   
  2664.   #--------------------------------------------------------------------------
  2665.   # ● Update
  2666.   #--------------------------------------------------------------------------   
  2667.   alias mog_atb_display_turn_update update
  2668.   def update
  2669.       mog_atb_display_turn_update
  2670.       update_turn_number
  2671.   end

  2672.   #--------------------------------------------------------------------------
  2673.   # ● Create Turn Number
  2674.   #--------------------------------------------------------------------------   
  2675.   def create_turn_number
  2676.       return if !DISPLAY_TURN_NUMBER
  2677.       @turn_count_old = $game_troop.turn_count
  2678.       @turn_sprite = Sprite.new
  2679.       @turn_sprite.bitmap = Bitmap.new(120,32)
  2680.       @turn_sprite.bitmap.font.size = TURN_NUMBER_FONT_SIZE
  2681.       @turn_sprite.bitmap.font.bold = TURN_NUMBER_FONT_BOLD
  2682.       @turn_sprite.z = TURN_NUMBER_Z
  2683.       @turn_sprite.x = TURN_NUMBER_POS[0] ; @turn_sprite.y = TURN_NUMBER_POS[1]
  2684.       refresh_turn_sprite
  2685.   end  
  2686.   
  2687.   #--------------------------------------------------------------------------
  2688.   # ● Refresh Turn Sprite
  2689.   #--------------------------------------------------------------------------   
  2690.   def refresh_turn_sprite
  2691.       @turn_count_old = $game_troop.turn_count
  2692.       @turn_sprite.bitmap.clear ; @turn_sprite.opacity = 255
  2693.       turn_text = TURN_WORD + $game_troop.turn_count.to_s
  2694.       @turn_sprite.bitmap.draw_text(0,0,120,32,turn_text,0)
  2695.   end
  2696.   
  2697.   #--------------------------------------------------------------------------
  2698.   # ● Dispose Turn Number
  2699.   #--------------------------------------------------------------------------   
  2700.   def dispose_turn_number
  2701.       return if @turn_sprite == nil
  2702.       @turn_sprite.bitmap.dispose ; @turn_sprite.dispose
  2703.   end
  2704.   
  2705.   #--------------------------------------------------------------------------
  2706.   # ● Update Turn Number
  2707.   #--------------------------------------------------------------------------   
  2708.   def update_turn_number
  2709.       return if @turn_sprite == nil
  2710.       refresh_turn_sprite if @turn_count_old != $game_troop.turn_count
  2711.       @turn_sprite.visible = turn_visible?
  2712.   end
  2713.   
  2714.   #--------------------------------------------------------------------------
  2715.   # ● Turn Visible?
  2716.   #--------------------------------------------------------------------------   
  2717.   def turn_visible?
  2718.       return false if !$game_temp.sprite_visible
  2719.       return false if !$game_system.atb_sprite_turn
  2720.       return true
  2721.   end
  2722.   
  2723. end

  2724. #==============================================================================
  2725. # ■ Window BattleLog
  2726. #==============================================================================
  2727. class Window_BattleLog < Window_Selectable   
  2728.   include MOG_COOPERATION_SKILLS
  2729.   
  2730.   #--------------------------------------------------------------------------
  2731.   # ● Display Skill/Item Use
  2732.   #--------------------------------------------------------------------------
  2733.   alias mog_cskill_display_use_item display_use_item
  2734.   def display_use_item(subject, item)
  2735.       return if cooperation_skill_users?(subject, item)
  2736.       mog_cskill_display_use_item(subject, item)
  2737.   end
  2738.   
  2739.   #--------------------------------------------------------------------------
  2740.   # ● Cooperation Skill_users?
  2741.   #--------------------------------------------------------------------------
  2742.   def cooperation_skill_users?(subject, item)
  2743.       return false if subject.is_a?(Game_Enemy)
  2744.       return false if !item.is_a?(RPG::Skill)
  2745.       return false if !BattleManager.is_cskill?(item.id)
  2746.       return false if !BattleManager.actor_included_in_cskill?(subject.id,item.id)
  2747.       members = BattleManager.cskill_members(item.id) ; subject_name = ""
  2748.       if members.size <=0  
  2749.          members.each_with_index do |b,index|     
  2750.          if index == members.size - 1 ; subject_name += b.name
  2751.          else ; subject_name += b.name + " " + "and" + " "
  2752.          end
  2753.          end
  2754.       else
  2755.          subject_name += $game_party.name
  2756.       end
  2757.       add_text(subject_name + item.message1)
  2758.       unless item.message2.empty? ; wait ; add_text(item.message2) ; end
  2759.   end
  2760.   
  2761. end

  2762. #==============================================================================
  2763. # ■ Game_Battler
  2764. #==============================================================================
  2765. class Game_BattlerBase  

  2766.   #--------------------------------------------------------------------------
  2767.   # ● Pay Skill Cost
  2768.   #--------------------------------------------------------------------------   
  2769.   alias mog_cskill_pay_skill_cost pay_skill_cost
  2770.   def pay_skill_cost(skill)
  2771.       if self.is_a?(Game_Actor) and BattleManager.cskill_usable?(skill.id,self.id)
  2772.            BattleManager.pay_cskill_cost(skill)
  2773.          return
  2774.       end
  2775.       mog_cskill_pay_skill_cost(skill)
  2776.   end

  2777. end

  2778. #==============================================================================
  2779. # ■ BattleManager
  2780. #==============================================================================
  2781. module BattleManager
  2782.   include MOG_COOPERATION_SKILLS
  2783.   
  2784.   #--------------------------------------------------------------------------
  2785.   # ● Cooperation Skill Enable?
  2786.   #--------------------------------------------------------------------------
  2787.   def self.cskill_enable?(skill_id)
  2788.       return false if actor == nil
  2789.       return false if !actor_included_in_cskill?(actor.id,skill_id)
  2790.       return false if !ckill_members_usable?(skill_id)
  2791.       return false if !cskill_all_members_available?(skill_id)
  2792.       return true
  2793.   end
  2794.   
  2795.   #--------------------------------------------------------------------------
  2796.   # ● Cskill Usable?
  2797.   #--------------------------------------------------------------------------
  2798.   def self.cskill_usable?(skill_id,actor_id)
  2799.       return false if !is_cskill?(skill_id)
  2800.       return false if !actor_included_in_cskill?(actor_id,skill_id)
  2801.       return false if !cskill_members_alive?(skill_id)
  2802.       return true
  2803.   end  
  2804.   
  2805.   #--------------------------------------------------------------------------
  2806.   # ● Pay Cskill Cost
  2807.   #--------------------------------------------------------------------------
  2808.   def self.pay_cskill_cost(skill)
  2809.       cskill_members(skill.id).each do |battler|
  2810.          battler.face_animation = [60 ,2,0] if $imported[:mog_battle_hud_ex]
  2811.          $game_temp.remove_order(battler)
  2812.          battler.mp -= battler.skill_mp_cost(skill)
  2813.          battler.tp -= battler.skill_tp_cost(skill)
  2814.       end
  2815.   end   
  2816.    
  2817.   #--------------------------------------------------------------------------
  2818.   # ● Cskill Members Usable?
  2819.   #--------------------------------------------------------------------------
  2820.   def self.ckill_members_usable?(skill_id)
  2821.       skill = $data_skills[skill_id] rescue nil
  2822.       return false if skill == nil   
  2823.       cskill_members(skill_id).each do |battler|
  2824.            return false if !battler.atb_max?
  2825.            return false if battler == subject
  2826.            return false if battler.restriction != 0
  2827.            return false if !battler.skill_cost_payable?(skill)
  2828.            return false if !battler.usable?(skill)
  2829.       end
  2830.       return true
  2831.   end
  2832.   
  2833.   #--------------------------------------------------------------------------
  2834.   # ● Cskill Actor?
  2835.   #--------------------------------------------------------------------------
  2836.   def self.ckill_actor?(self_actor)
  2837.       item = self_actor.current_action.item rescue nil
  2838.       return false if item == nil
  2839.       include = false
  2840.       cskill_members(item.id).each do |battler|
  2841.       include = true if self_actor == battler
  2842.       end  
  2843.       return true if include
  2844.       return false
  2845.   end  
  2846.   
  2847.   #--------------------------------------------------------------------------
  2848.   # ● Cskill All Members Available?
  2849.   #--------------------------------------------------------------------------
  2850.   def self.cskill_all_members_available?(skill_id)
  2851.       return false if COOPERATION_SKILLS[skill_id].size != cskill_members(skill_id).size
  2852.       return true
  2853.   end  
  2854.    
  2855.   #--------------------------------------------------------------------------
  2856.   # ● Cooperation Members
  2857.   #--------------------------------------------------------------------------
  2858.   def self.cskill_members(skill_id)
  2859.       return [] if COOPERATION_SKILLS[skill_id].nil?
  2860.       members = []
  2861.       $game_party.battle_members.each do |battler|
  2862.       members.push(battler) if COOPERATION_SKILLS[skill_id].include?(battler.id)
  2863.       end
  2864.       return members
  2865.   end
  2866.   
  2867.   #--------------------------------------------------------------------------
  2868.   # ● Cskill Members Skill Cost?
  2869.   #--------------------------------------------------------------------------
  2870.   def self.cskill_members_skill_cost?(skill_id)
  2871.       skill = $data_skills[skill_id] rescue nil
  2872.       return false if skill == nil
  2873.       cskill_members(skill_id).each do |battler|
  2874.       return false if !battler.skill_conditions_met?(skill)
  2875.       end
  2876.       return true
  2877.   end  
  2878.    
  2879.   #--------------------------------------------------------------------------
  2880.   # ● Cskill Members Usable?
  2881.   #--------------------------------------------------------------------------
  2882.   def self.cskill_members_alive?(skill_id)
  2883.       skill = $data_skills[skill_id] rescue nil
  2884.       return false if skill == nil   
  2885.       alive = true
  2886.       cskill_members(skill_id).each do |battler|
  2887.           alive = false if battler.dead?
  2888.           alive = false if battler.restriction != 0
  2889.           alive = false if !battler.skill_cost_payable?(skill)
  2890.       end
  2891.       if !alive
  2892.          force_clear_cskill(skill_id)
  2893.          return false
  2894.       end
  2895.       return true
  2896.   end
  2897.   
  2898.   #--------------------------------------------------------------------------
  2899.   # ● Force Clear Cskill
  2900.   #--------------------------------------------------------------------------
  2901.   def self.force_clear_cskill(skill_id)
  2902.       cskill_members(skill_id).each do |battler| battler.turn_clear
  2903.       battler.atb_cast.clear
  2904.       battler.bact_sprite_need_refresh = true if $imported[:mog_sprite_actor]
  2905.       end
  2906.   end
  2907.   
  2908.   #--------------------------------------------------------------------------
  2909.   # ● Execute Cast Action Members
  2910.   #--------------------------------------------------------------------------
  2911.   def self.execute_cast_action_members(skill_id)
  2912.       cskill_members(skill_id).each do |battler|
  2913.          battler.next_turn = true
  2914.          battler.atb = battler.atb_max
  2915.          battler.atb_cast.clear
  2916.       end
  2917.   end
  2918.   
  2919.   #--------------------------------------------------------------------------
  2920.   # ● Set Members CP Skills
  2921.   #--------------------------------------------------------------------------
  2922.   def self.set_members_cp_skill(skill_id)
  2923.       skill = $data_skills[skill_id] rescue nil
  2924.       return false if skill == nil   
  2925.       cskill_members(skill_id).each do |battler|
  2926.            battler.atb = 0
  2927.            battler.actions = @command_actor.actions if @command_actor.actions != nil
  2928.            $game_temp.remove_order(battler)
  2929.            if skill.speed.abs == 0
  2930.               battler.atb_cast = [skill,50,50]
  2931.            else
  2932.               battler.atb_cast = [skill,skill.speed.abs,0]
  2933.            end
  2934.            battler.animation_id = MOG_COOPERATION_SKILLS::COOPERATION_SKILL_ANIMATION
  2935.       end
  2936.   end
  2937.   
  2938.   #--------------------------------------------------------------------------
  2939.   # ● Clear Members Cp Skill
  2940.   #--------------------------------------------------------------------------
  2941.   def self.clear_members_ckill(subject)
  2942.       return if subject.is_a?(Game_Enemy)
  2943.       return if subject == nil
  2944.       skill = subject.current_action.item rescue nil
  2945.       return if skill == nil
  2946.       return if !is_cskill?(skill.id)
  2947.       return if !actor_included_in_cskill?(subject.id,skill.id)
  2948.       cskill_members(skill.id).each do |battler| battler.turn_clear ; end
  2949.   end
  2950.   
  2951.   #--------------------------------------------------------------------------
  2952.   # ● Actor Included in Cooperation Skill?
  2953.   #--------------------------------------------------------------------------
  2954.   def self.actor_included_in_cskill?(actor_id,skill_id)
  2955.       return false if !SceneManager.scene_is?(Scene_Battle)
  2956.       return false if !is_cskill?(skill_id)
  2957.       return false if !COOPERATION_SKILLS[skill_id].include?(actor_id)
  2958.       return true
  2959.   end
  2960.   
  2961.   #--------------------------------------------------------------------------
  2962.   # ● Is Cooperation Skill?
  2963.   #--------------------------------------------------------------------------
  2964.   def self.is_cskill?(skill_id)
  2965.       return false if !SceneManager.scene_is?(Scene_Battle)
  2966.       return false if COOPERATION_SKILLS[skill_id].nil?
  2967.       return true
  2968.   end
  2969.   
  2970. end

  2971. #==============================================================================
  2972. # ■ BattleManager
  2973. #==============================================================================
  2974. class << BattleManager
  2975.   
  2976.   #--------------------------------------------------------------------------
  2977.   # ● Set Cast Action
  2978.   #--------------------------------------------------------------------------
  2979.   alias mog_cskill_command_end_actor command_end_actor
  2980.   def command_end_actor
  2981.       prepare_ckill_members
  2982.       mog_cskill_command_end_actor      
  2983.   end
  2984.   
  2985.   #--------------------------------------------------------------------------
  2986.   # ● Prepare Cskill Members
  2987.   #--------------------------------------------------------------------------
  2988.   def prepare_ckill_members
  2989.       item = @command_actor.current_action.item rescue nil  
  2990.       return if item == nil
  2991.       if is_cskill?(item.id) and ckill_members_usable?(item.id)
  2992.           set_members_cp_skill(item.id)
  2993.           @command_actor = nil
  2994.       end  
  2995.   end
  2996.    
  2997.   #--------------------------------------------------------------------------
  2998.   # ● Clear Cskills Members
  2999.   #--------------------------------------------------------------------------
  3000.   def clear_cskill_members(subject)
  3001.       item = subject.current_action.item rescue nil  
  3002.       return if item == nil
  3003.       clear_members_ckill(item.id) if is_cskill?(item.id)
  3004.   end
  3005.   
  3006. end

  3007. #==============================================================================
  3008. # ■ Window SkillList
  3009. #==============================================================================
  3010. class Window_SkillList < Window_Selectable
  3011.   
  3012.   #--------------------------------------------------------------------------
  3013.   # ● Display Skill in Active State?
  3014.   #--------------------------------------------------------------------------
  3015.   alias mog_atb_skill_list_enable? enable?
  3016.   def enable?(item)
  3017.       if SceneManager.scene_is?(Scene_Battle) and !item.nil?
  3018.          return false if BattleManager.is_cskill?(item.id) and !BattleManager.cskill_enable?(item.id)
  3019.       end
  3020.       mog_atb_skill_list_enable?(item)
  3021.   end   

  3022. end

  3023. #==============================================================================
  3024. # ■ Game Battler
  3025. #==============================================================================
  3026. class Game_Battler < Game_BattlerBase
  3027.   
  3028.   #--------------------------------------------------------------------------
  3029.   # ● Calculate Damage
  3030.   #--------------------------------------------------------------------------
  3031.   alias mog_atb_make_make_damage_value make_damage_value
  3032.   def make_damage_value(user, item)
  3033.       mog_atb_make_make_damage_value(user, item)
  3034.       coop_make_damage_value(user, item) if coop_make_damage_value?(user, item)
  3035.   end
  3036.   
  3037.   #--------------------------------------------------------------------------
  3038.   # ● Calculate Damage
  3039.   #--------------------------------------------------------------------------
  3040.   def coop_make_damage_value?(user, item)
  3041.       return false if item == nil
  3042.       return false if user.is_a?(Game_Enemy)
  3043.       return false if item.is_a?(RPG::Item)
  3044.       return false if !BattleManager.is_cskill?(item.id)
  3045.       return false if BattleManager.cskill_members(item.id).size < 1
  3046.       return true
  3047.   end
  3048.   
  3049.   #--------------------------------------------------------------------------
  3050.   # ● Coop Make Damage Value
  3051.   #--------------------------------------------------------------------------
  3052.   def coop_make_damage_value(user, item)
  3053.       for actor in BattleManager.cskill_members(item.id)
  3054.           next if actor == user
  3055.           value = item.damage.eval(actor, self, $game_variables)
  3056.           value *= item_element_rate(actor, item)
  3057.           value *= pdr if item.physical?
  3058.           value *= mdr if item.magical?
  3059.           value *= rec if item.damage.recover?
  3060.           value = apply_critical(value) if @result.critical
  3061.           value = apply_variance(value, item.damage.variance)
  3062.           value = apply_guard(value)
  3063.           @result.make_damage_coop(value.to_i, item)
  3064.       end
  3065.       @result.make_damage_coop_after(item)
  3066.   end
  3067.   
  3068. end

  3069. #==============================================================================
  3070. # ■ Game ActionResult
  3071. #==============================================================================
  3072. class Game_ActionResult
  3073.   
  3074.   #--------------------------------------------------------------------------
  3075.   # ● Create Damage
  3076.   #--------------------------------------------------------------------------
  3077.   def make_damage_coop(value, item)
  3078.       @hp_damage += value if item.damage.to_hp?
  3079.       @mp_damage += value if item.damage.to_mp?
  3080.   end   
  3081.      
  3082.   #--------------------------------------------------------------------------
  3083.   # ● Make Damage Coop After
  3084.   #--------------------------------------------------------------------------
  3085.   def make_damage_coop_after(item)
  3086.       @hp_damage /= BattleManager.cskill_members(item.id).size if item.damage.to_hp?
  3087.       @mp_damage /= BattleManager.cskill_members(item.id).size if item.damage.to_mp?   
  3088.       @critical = false if @hp_damage == 0
  3089.       @mp_damage = [@battler.mp, @mp_damage].min
  3090.       @hp_drain = @hp_damage if item.damage.drain?
  3091.       @mp_drain = @mp_damage if item.damage.drain?
  3092.       @hp_drain = [@battler.hp, @hp_drain].min
  3093.       @success = true if item.damage.to_hp? || @mp_damage != 0
  3094.   end
  3095.   
  3096. end

  3097. #==============================================================================
  3098. # ■ Game_Battler
  3099. #==============================================================================
  3100. class Game_Battler < Game_BattlerBase
  3101.   
  3102.   #--------------------------------------------------------------------------
  3103.   # ● Execute Cast Action
  3104.   #--------------------------------------------------------------------------   
  3105.   alias mog_cskill_execute_cast_action execute_cast_action
  3106.   def execute_cast_action
  3107.       mog_cskill_execute_cast_action
  3108.       prepare_cast_action_members
  3109.   end
  3110.   
  3111.   #--------------------------------------------------------------------------
  3112.   # ● Prepare Cast Acton Members
  3113.   #--------------------------------------------------------------------------   
  3114.   def prepare_cast_action_members
  3115.       return if self.is_a?(Game_Enemy)
  3116.       item = self.current_action.item rescue nil  
  3117.       return if item == nil   
  3118.       BattleManager.execute_cast_action_members(item.id) if BattleManager.cskill_usable?(item.id,self.id)
  3119.   end
  3120.   
  3121.   #--------------------------------------------------------------------------
  3122.   # ● ATB After Damage
  3123.   #--------------------------------------------------------------------------  
  3124.   alias mog_cpskill_atb_after_damage atb_after_damage
  3125.   def atb_after_damage(pre_item = nil)
  3126.       mog_cpskill_atb_after_damage(pre_item)
  3127.       force_clear_cpkill(pre_item) if pre_item != nil and self.is_a?(Game_Actor)
  3128.   end  
  3129.   
  3130.   #--------------------------------------------------------------------------
  3131.   # ● Force Clear CP skill
  3132.   #--------------------------------------------------------------------------   
  3133.   def force_clear_cpkill(pre_item = nil)
  3134.       $game_temp.refresh_item_window = true if @result.mp_damage != 0
  3135.       BattleManager.cskill_usable?(pre_item.id,self.id) if pre_item != nil      
  3136.   end

  3137.   #--------------------------------------------------------------------------
  3138.   # ● Need Refresh Item Window?
  3139.   #--------------------------------------------------------------------------   
  3140.   alias mog_cskills_need_refresh_item_window? need_refresh_item_window?
  3141.   def need_refresh_item_window?
  3142.       return true
  3143.       mog_cskills_need_refresh_item_window?
  3144.   end
  3145.   
  3146.   #--------------------------------------------------------------------------
  3147.   # ● Execute Damage
  3148.   #--------------------------------------------------------------------------   
  3149.   alias mog_atb_coop_execute_damage execute_damage
  3150.   def execute_damage(user)
  3151.       mog_atb_coop_execute_damage(user)
  3152.       item = user.current_action.item rescue nil
  3153.       execute_damage_coop(user,item) if user.coop_make_damage_value?(user, item)
  3154.   end
  3155.   
  3156.   #--------------------------------------------------------------------------
  3157.   # ● Execute Damage Coop
  3158.   #--------------------------------------------------------------------------   
  3159.   def execute_damage_coop(user,item)
  3160.       for actor in BattleManager.cskill_members(item.id)
  3161.           next if actor == user
  3162.           actor.hp += @result.hp_drain
  3163.           actor.mp += @result.mp_drain
  3164.           if $imported[:mog_damage_popup]
  3165.              actor.damage.push([-@result.hp_drain,"HP",@result.critical]) if @result.hp_drain != 0
  3166.              actor.damage.push([-@result.mp_drain,"MP",@result.critical]) if @result.mp_drain != 0
  3167.           end   
  3168.       end   
  3169.   end
  3170.   
  3171. end

  3172. #==============================================================================
  3173. # ■ Scene Battle
  3174. #==============================================================================
  3175. class Scene_Battle < Scene_Base

  3176.   #--------------------------------------------------------------------------
  3177.   # ● Process Before Execute Action
  3178.   #--------------------------------------------------------------------------  
  3179.   alias mog_cskill_process_before_execute_action  process_before_execute_action
  3180.   def process_before_execute_action
  3181.       mog_cskill_process_before_execute_action
  3182.       before_execute_cooperation_skill if can_execute_cooperation_skill?
  3183.   end

  3184.   #--------------------------------------------------------------------------
  3185.   # ● Process Before Remove Action
  3186.   #--------------------------------------------------------------------------  
  3187.   alias mog_cskill_process_before_remove_action process_before_remove_action
  3188.   def process_before_remove_action
  3189.       mog_cskill_process_before_remove_action
  3190.       BattleManager.clear_members_ckill(@subject)
  3191.   end

  3192.   #--------------------------------------------------------------------------
  3193.   # ● Can Execute Cooperation Skill?
  3194.   #--------------------------------------------------------------------------  
  3195.   def can_execute_cooperation_skill?
  3196.       return false if !@subject.is_a?(Game_Actor)
  3197.       item = @subject.current_action.item rescue nil
  3198.       return false if item == nil
  3199.       return false if !BattleManager.cskill_usable?(item.id,@subject.id)
  3200.       return true
  3201.   end

  3202.   #--------------------------------------------------------------------------
  3203.   # ● Current CP Members
  3204.   #--------------------------------------------------------------------------
  3205.   def current_cp_members
  3206.       return [] if subject_action == nil
  3207.       return BattleManager.cskill_members(subject_action.id)
  3208.   end   
  3209.   
  3210.   #--------------------------------------------------------------------------
  3211.   # ● Before Execute Coomperation Skill. (add-ons)
  3212.   #--------------------------------------------------------------------------  
  3213.   def before_execute_cooperation_skill
  3214.   end

  3215. end
复制代码

老鹰

梦石
40
星屑
38044
在线时间
7127 小时
注册时间
2012-5-26
回帖
3306

极短24评委极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

发表于 2018-10-13 20:50:52 | 显示全部楼层
这个可以确定是 MOG 的 ATB 战斗系统中的一个bug了,因为它忘了战斗日志窗口的重新显示
并且在原脚本中直接删去了战斗日志的刷新,很迷的绕过bug方法

在脚本中搜索Window_BattleLog,然后会有两个地方,选择第一个地方跳转,在这个类里面找到
  1.   #--------------------------------------------------------------------------
  2.   # ● Refresh
  3.   #--------------------------------------------------------------------------   
  4.   def refresh
  5.   end  
复制代码

选中这几行后按下ctrl+Q注释掉,
变成这样
  1. #~   #--------------------------------------------------------------------------
  2. #~   # ● Refresh
  3. #~   #--------------------------------------------------------------------------   
  4. #~   def refresh
  5. #~   end  
复制代码


之后在这几行的下面插入
  1.   #--------------------------------------------------------------------------
  2.   # ● 等待
  3.   #--------------------------------------------------------------------------
  4.   alias eagle_mog_atb_battlelog_wait wait
  5.   def wait
  6.     self.cursor_rect.empty
  7.     self.visible = true
  8.     self.contents_opacity = 255
  9.     eagle_mog_atb_battlelog_wait
  10.   end
复制代码


多说一句,这个战斗日志显示时会有一个全局的等待帧数,并不是卡顿,而这个每一条显示后的等待帧数由这个方法决定
  1.   #--------------------------------------------------------------------------
  2.   # ● Message Speed
  3.   #--------------------------------------------------------------------------   
  4.   def message_speed
  5.       return 10 if $imported["YEA-BattleEngine"]
  6.       return 5
  7.   end
复制代码

10 代表如果插入了YEA-BattleEngine脚本,则每显示一条日志后等待10帧
5 代表默认每一条日志显示后等待5帧
在最后一条日志等待结束后,战斗日志窗口会被ATB系统内随着其他窗口一并关闭……

所以还是推荐弄个带有POP伤害数字的系统,靠战斗日志太有卡顿感觉了(比如YEA-BattleEngine)

评分

参与人数 1星屑 +150 收起 理由
VIPArcher + 150 醋瞎

查看全部评分

回复

使用道具 举报

梦石
0
星屑
109
在线时间
8 小时
注册时间
2018-9-5
回帖
2
 楼主| 发表于 2018-10-13 21:42:17 | 显示全部楼层
大神啊 太感谢了
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部