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

Project1

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

[已经过期] 关于这个ATB脚本报错

[复制链接]

Lv1.梦旅人

梦石
0
星屑
105
在线时间
243 小时
注册时间
2014-9-14
帖子
38
跳转到指定楼层
1
发表于 2016-4-5 15:43:35 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  1. #==============================================================================
  2. # ** Victor Engine - Active Time Battle
  3. #------------------------------------------------------------------------------
  4. # Author : Victor Sant
  5. #
  6. # Version History:
  7. #  v 1.00 - 2012.12.16 > First release
  8. #  v 1.01 - 2012.12.24 > Fixed issue with changing party during battle
  9. #                      > Fixed ATB value during Surprise and Pre Emptive
  10. #                      > Fixed Command Window position to not cover the ATB
  11. #                      > Fixed issue with freezes after events
  12. #                      > Fixed issue with state timings
  13. #                      > Fixed issue with cast time at battle start
  14. #                      > Fixed issue with escape at battle start
  15. #                      > Added notetags <timed trigger: x> <cast protection: x>
  16. #                        and <delay protection>
  17. #                      > Fixed issue with command window not closing when
  18. #                        the actor is becomes unable to select action
  19. #  v 1.02 - 2012.12.30 > Compatibility with Leap Attack
  20. #                      > Fixed issue with Guard command and ATB Reverse
  21. #  v 1.03 - 2013.01.07 > Fixed issue with selection when all enemies are dead
  22. #  v 1.04 - 2013.01.24 > Fixed issue with skill, item and target windows not
  23. #                        closing when the actor is becomes unable to act
  24. #  v 1.05 - 2013.02.13 > Added notetag <atb speed: x%>
  25. #                      > Added setup for play a SE when the ATB is full
  26. #------------------------------------------------------------------------------
  27. #  This scripts changes the turn management of battles. The default turn based
  28. # system is replaced by an active time system, where the order of actions
  29. # are decided by individual time bars
  30. #------------------------------------------------------------------------------
  31. # Compatibility
  32. #   Requires the script 'Victor Engine - Basic Module' v 1.32 or higher
  33. #   If used with 'Victor Engine - Animated Battle' place this bellow it.
  34. #   If used with 'Victor Engine - Skip Battle Log' place this bellow it.
  35. #
  36. # * Overwrite methods
  37. #   class << BattleManager
  38. #     def next_command
  39. #     def prior_command
  40. #     def turn_start
  41. #     def turn_end
  42. #     def make_action_orders
  43. #
  44. #   class Game_Enemy < Game_Battler
  45. #     def conditions_met_turns?(param1, param2)
  46. #
  47. #   class Window_BattleStatus < Window_Selectable
  48. #     def window_width
  49. #     def draw_basic_area(rect, actor)
  50. #     def draw_gauge_area_with_tp(rect, actor)
  51. #     def draw_gauge_area_without_tp(rect, actor)
  52. #     def update
  53. #
  54. # * Alias methods
  55. #   class << BattleManager
  56. #     def init_members
  57. #     def battle_start
  58. #     def process_escape
  59. #
  60. #   class Game_System
  61. #     def initialize
  62. #
  63. #   class Game_Action
  64. #     def prepare
  65. #
  66. #   class Game_BattlerBase
  67. #     def inputable?
  68. #
  69. #   class Game_Battler < Game_BattlerBase
  70. #     def item_user_effect(user, item)
  71. #
  72. #   class Game_Enemy < Game_Battler
  73. #     def initialize(index, enemy_id)
  74. #
  75. #   class Spriteset_Battle
  76. #     def update_actors
  77. #
  78. #   class Window_BattleLog < Window_Selectable
  79. #     def last_text
  80. #
  81. #   class Window_ActorCommand < Window_Command
  82. #     def make_command_list
  83. #
  84. #------------------------------------------------------------------------------
  85. # Instructions:
  86. #  To instal the script, open you script editor and paste this script on
  87. #  a new section bellow the Materials section. This script must also
  88. #  be bellow the script 'Victor Engine - Basic'
  89. #
  90. #------------------------------------------------------------------------------
  91. # Actors, Classes, Enemies, Weapons, Armors, States, Skills and Items note tags:
  92. #   Tags to be used on Actors, Classes, Enemies, Weapons, Armors, States,
  93. #   Skills and Items note boxes.
  94. #
  95. #  <cast cancel: x%>
  96. #   Actions will have a chance of canceling spell casting of the targets.
  97. #     x : success rate
  98. #
  99. #  <atb delay: x%, y%>
  100. #   Actions will have a chance of delaying the ATB of the targets.
  101. #     x : success rate
  102. #     y : delay rate
  103. #
  104. #------------------------------------------------------------------------------
  105. # Actors, Classes, Enemies, Weapons, Armors and States note tags:
  106. #   Tags to be used on Actors, Classes, Enemies, Weapons, Armors and States
  107. #   note boxes.
  108. #
  109. #  <cast protection: x%>
  110. #   Reduce the success rate of a cast cancel action.
  111. #     x : reduction
  112. #
  113. #  <delay protection: x%>
  114. #   Reduce the success rate of a atb delay action.
  115. #     x : reduction
  116. #
  117. #  <atb speed: x%>
  118. #   Changes the rate of a atb fill speed. if the value is higher then 100%
  119. #   the bar fills faster, if it's lower than 100% the bar fills slower.
  120. #     x : speed rate
  121. #
  122. #------------------------------------------------------------------------------
  123. # Skills note tags:
  124. #   Tags to be used on Skills note boxes.
  125. #
  126. #  <cast time: x>
  127. #  <cast time: x, y>
  128. #   Actions with this will have a cast time before executing, you can add
  129. #   opitionally wich stat will be used to define the speed.
  130. #     x : cast speed (100 = default speed)
  131. #     y : stat (any valid battler stat)
  132. #
  133. #  <atb cost: x%>
  134. #   Changes the total ATB spent after executing an action. By default all
  135. #   actions cost 100% of the ATB. Can't be lower than 1%
  136. #     x : ATB cost rate
  137. #
  138. #------------------------------------------------------------------------------
  139. # States note tags:
  140. #   Tags to be used on States note boxes.
  141. #
  142. #  <timed trigger: x>
  143. #   There is two options for state auto-removal on the database: Action End
  144. #   and Turn End. This tag creates a third option, to make the state end
  145. #   and trigger after a set time.
  146. #     x : time for the trigger.
  147. #
  148. #------------------------------------------------------------------------------
  149. # Additional instructions:
  150. #
  151. #  The <cast cancel: x%> and <atb delay: x%, y%> will have effect only on
  152. #  physical actions when added to any object beside Skills and Items.
  153. #
  154. #  The <cast protection: x%> and <delay protection: x%> are multiplied by
  155. #  the cast cancel/atb delay rate. So if an action have 30% cast cancel, and
  156. #  the target have 50% cast protection, the cast cancel will be reduced to 15%
  157. #  Multiple cast cancel effects are added separately. So an action with 40%
  158. #  cast cancel and a target with 50%, 50% and 30% cast protection from different
  159. #  sourcers (let's say 3 different equips) will have the chance reduced to 7%
  160. #  (40 - 50% = 20%, 20% - 50% = 10%, 10% - 30% = 7%)
  161. #
  162. #  The <atb speed: x%> can be used to change the rate of a battler ATB speed
  163. #  without the need of changing the AGI of the battler. Can be used to create
  164. #  effect such as "Haste" and "Slow".
  165. #
  166. #  You can use script calls to change the wait mode and the atb speed
  167. #  $game_system.wait_mode = X
  168. #     :full_wait : time stop to select commands and actions
  169. #     :semi_wait : time stop to select actions
  170. #     :active    : time don't stop
  171. #
  172. #  $game_system.atb_speed = X
  173. #    1.0 = default speed
  174. #
  175. #==============================================================================

  176. #==============================================================================
  177. # ** Victor Engine
  178. #------------------------------------------------------------------------------
  179. #   Setting module for the Victor Engine
  180. #==============================================================================

  181. module Victor_Engine
  182.   #--------------------------------------------------------------------------
  183.   # * Wait mode
  184.   #   :full_wait : time stop to select commands and actions
  185.   #   :semi_wait : time stop to select actions
  186.   #   :active    : time don't stop
  187.   #--------------------------------------------------------------------------
  188.   VE_ATB_WAIT_MODE = :full_wait
  189.   #--------------------------------------------------------------------------
  190.   # * Action wait
  191.   #   if true, time will stop while executing actions
  192.   #--------------------------------------------------------------------------
  193.   VE_ATB_WAIT_ACTION = true
  194.   #--------------------------------------------------------------------------
  195.   # * Reverse ATB
  196.   #   This setting revert how the ATB works, instead waiting the bar to fill
  197.   #   up to select actions, you first select the action, the the bar start
  198.   #   to fill and the action is executed once it's full.
  199.   #--------------------------------------------------------------------------
  200.   VE_ATB_REVERSE = false
  201.   #--------------------------------------------------------------------------
  202.   # * Move status window
  203.   #   Setup this true to move the status window when the actor command
  204.   #   window or part command window shows up. If false, both windows will
  205.   #   be displayed above the status window.
  206.   #--------------------------------------------------------------------------
  207.   VE_MOVE_STATUS_WINDOW = true
  208.   #--------------------------------------------------------------------------
  209.   # * ATB Full Sound
  210.   #   Play a sound when the actor command window open. Leave nil for no sound
  211.   #   RPG::SE.new(filename, volume, pitch)
  212.   #--------------------------------------------------------------------------
  213.   VE_ATB_SOUND = RPG::SE.new("Decision2", 100, 100)
  214.   #--------------------------------------------------------------------------
  215.   # * Escape type
  216.   #   :party   : open party menu by pressing the cancel key
  217.   #   :command : add the "Escape" option to actors command list
  218.   #   :key     : press the set keys for a while to escape
  219.   #--------------------------------------------------------------------------
  220.   VE_ATB_ESCAPE_TYPE = :command
  221.   #--------------------------------------------------------------------------
  222.   # * Setup the key that must be pressed for escaping
  223.   #    :A >> keyboard Shift  :B >> keyboard X      :C >> keyboard Z
  224.   #    :X >> keyboard A      :Y >> keyboard S      :Z >> keyboard D
  225.   #    :L >> keyboard Q      :R >> keyboard W
  226.   #   adding more than one key makes need to press all of them at same time
  227.   #--------------------------------------------------------------------------
  228.   VE_ATB_ESCAPE_KEYS = [:R, :L]
  229.   #--------------------------------------------------------------------------
  230.   # * Escape time
  231.   #  Average escape time in frames to escape if VE_ATB_ESCAPE_TYPE = :key
  232.   #  This value vary based on the battlers stats and the ATB speed
  233.   #--------------------------------------------------------------------------
  234.   VE_ATB_ESCAPE_TIME = 200
  235.   #--------------------------------------------------------------------------
  236.   # * Escape text
  237.   #   Display escape text when trying to escape if VE_ATB_ESCAPE_TYPE = :key
  238.   #--------------------------------------------------------------------------
  239.   VE_ATB_ESCAPE_TEXT = true
  240.   #--------------------------------------------------------------------------
  241.   # * Turn count control
  242.   #  This is used to control how the turn count will increase, the turn count
  243.   #  control the battle event conditions
  244.   #   :time     : control by time (in frames)
  245.   #   :battlers : control by the number of alive battlers
  246.   #   :actions  : control by the number of actions executed
  247.   #--------------------------------------------------------------------------
  248.   VE_ATB_TURN_COUNT = :time
  249.   #--------------------------------------------------------------------------
  250.   # * Time count
  251.   #   Valid only if VE_ATB_TURN_COUNT = :time, setup the number of frames
  252.   #   needed to increase the turn count. Is influenced by the ATB speed
  253.   #--------------------------------------------------------------------------
  254.   VE_ATB_TIME_COUNT = 200
  255.   #--------------------------------------------------------------------------
  256.   # * Action count
  257.   #   Valid only if VE_ATB_TURN_COUNT = :actions, setup the number of actions
  258.   #   needed to increase the turn count
  259.   #--------------------------------------------------------------------------
  260.   VE_ATB_ACTION_COUNT = 10
  261.   #--------------------------------------------------------------------------
  262.   # * ATB speed
  263.   #   Multiplier that controls the speed of the ATB bars
  264.   #--------------------------------------------------------------------------
  265.   VE_ATB_SPEED = 1.0
  266.   #--------------------------------------------------------------------------
  267.   # * Speed modifier
  268.   #   Value used to control the influence of the stats on the ATB speed
  269.   #   Higher values reduce the influence of the stats on the speed.
  270.   #--------------------------------------------------------------------------
  271.   VE_speed_modifier = 50
  272.   #--------------------------------------------------------------------------
  273.   # * Start rate
  274.   #   Initial ATB value on battle start, a random value between 0 and X%
  275.   #--------------------------------------------------------------------------
  276.   VE_ATB_START_RATE = 10
  277.   #--------------------------------------------------------------------------
  278.   # * Reverse ATB Guard Time
  279.   #   With VE_ATB_REVERSE = true the guard time is set by this value, not
  280.   #   by the value set on the database
  281.   #--------------------------------------------------------------------------
  282.   VE_ATB_REVERSE_GUARD_TIME = 150
  283.   #--------------------------------------------------------------------------
  284.   # * Default magic cast
  285.   #   Setup a default cast speed for all magic skills.
  286.   #   Leave nil for no cast time.
  287.   #     100 = default speed (same as the default wait time for actions)
  288.   #--------------------------------------------------------------------------
  289.   VE_ATB_DEFAULT_CAST = nil
  290.   #--------------------------------------------------------------------------
  291.   # * Damage wait
  292.   #   Stop battler wait time during hurt animation. Available only for
  293.   #   Animated Battle
  294.   #--------------------------------------------------------------------------
  295.   VE_ATB_DAMAGE_WAIT = true
  296.   #--------------------------------------------------------------------------
  297.   # * Escaping animation
  298.   #   Add a steping animation while holding the escape key. Available only for
  299.   #   Animated Battle and if VE_ATB_ESCAPE_TYPE = :key
  300.   #--------------------------------------------------------------------------
  301.   VE_ATB_ESCAPING_ANIM = true
  302.   #--------------------------------------------------------------------------
  303.   # * Regenerarion Trigger
  304.   #  All regen effects triggers at same time no matter of the source, here
  305.   #  you can set when the regen trigger
  306.   #    :turn   : at the turn end
  307.   #    :action : at the action end
  308.   #    :timing : at fixed intervals
  309.   #   It's highly recomended to setup all regen and poison states with the
  310.   #   same auto-removal condition to ensure the duration match the trigger
  311.   #--------------------------------------------------------------------------
  312.   VE_ATB_REGEN_TRIGGER = :action
  313.   #--------------------------------------------------------------------------
  314.   # * Regenerarion Timing
  315.   #  Time for regen effects to apply if VE_ATB_REGEN_TRIGGER = :timing
  316.   #  Is influenced by the ATB speed
  317.   #--------------------------------------------------------------------------
  318.   VE_ATB_REGEN_TIMING = 300
  319.   #--------------------------------------------------------------------------
  320.   # * required
  321.   #   This method checks for the existance of the basic module and other
  322.   #   VE scripts required for this script to work, don't edit this
  323.   #--------------------------------------------------------------------------
  324.   def required(name, req, version, type = nil)
  325.     if !$imported[:ve_basic_module]
  326.       msg = "The script '%s' requires the script\n"
  327.       msg += "'VE - Basic Module' v%s or higher above it to work properly\n"
  328.       msg += "Go to [url]http://victorscripts.wordpress.com/[/url] to download this script."
  329.       msgbox(sprintf(msg, self.script_name(name), version))
  330.       exit
  331.     else
  332.       self.required_script(name, req, version, type)
  333.     end
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # * script_name
  337.   #   Get the script name base on the imported value
  338.   #--------------------------------------------------------------------------
  339.   def script_name(name, ext = "VE")
  340.     name = name.to_s.gsub("_", " ").upcase.split
  341.     name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
  342.     name.join(" ")
  343.   end
  344. end

  345. $imported ||= {}
  346. $imported[:ve_active_time_battle] = 1.05
  347. Victor_Engine.required(:ve_active_time_battle, :ve_basic_module, 1.32, :above)
  348. Victor_Engine.required(:ve_active_time_battle, :ve_state_auto_apply, 1.00, :bellow)
  349. Victor_Engine.required(:ve_active_time_battle, :ve_damage_pop, 1.00, :bellow)
  350. Victor_Engine.required(:ve_active_time_battle, :ve_leap_attack, 1.00, :bellow)
  351. Victor_Engine.required(:ve_active_time_battle, :ve_cooperation_skill, 1.00, :bellow)

  352. #==============================================================================
  353. # ** Vocab
  354. #------------------------------------------------------------------------------
  355. #  This module defines terms and messages. It defines some data as constant
  356. # variables. Terms in the database are obtained from $data_system.
  357. #==============================================================================

  358. module Vocab

  359.   # ATB stat name show above atb bar
  360.   VE_ATB_Name = "ATB"

  361.   # Message displayed when trying to escape using VE_ATB_ESCAPE_TYPE = :key
  362.   VE_Escaping = "逃跑..."

  363.   # Message displayed when can't escape using VE_ATB_ESCAPE_TYPE = :key
  364.   VE_CantEscape = "逃跑失败!"

  365. end

  366. #==============================================================================
  367. # ** class RPG::BaseItem
  368. #------------------------------------------------------------------------------
  369. #  Superclass of actor, class, skill, item, weapon, armor, enemy, and state.
  370. #==============================================================================

  371. class RPG::BaseItem
  372.   #--------------------------------------------------------------------------
  373.   # * New method: atb_speed
  374.   #--------------------------------------------------------------------------
  375.   def atb_speed
  376.     return @atb_speed if @atb_speed
  377.     @atb_speed = note =~ /<ATB SPEED: *(\d+)%?>/i ? [$1.to_f, 1].max / 100 : 1
  378.     @atb_speed
  379.   end
  380. end

  381. #==============================================================================
  382. # ** RPG::UsableItem
  383. #------------------------------------------------------------------------------
  384. #  This is the superclass for skills and items.
  385. #==============================================================================

  386. class RPG::UsableItem < RPG::BaseItem
  387.   #--------------------------------------------------------------------------
  388.   # * New method: castable?
  389.   #--------------------------------------------------------------------------
  390.   def castable?
  391.     (cast_speed && not_cooperation?) ? true : false
  392.   end
  393.   #--------------------------------------------------------------------------
  394.   # * New method: not_cooperation?
  395.   #--------------------------------------------------------------------------
  396.   def not_cooperation?
  397.     !$imported[:ve_cooperation_skill] || !cooperation?
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # * New method: cast_speed
  401.   #--------------------------------------------------------------------------
  402.   def cast_speed
  403.     regexp = /<CAST TIME: (\d+)(?:, *(\w+))?>/i
  404.     note   =~ regexp ? {spd: $1.to_i, stat: ($2 ? $2 : "agi")} : default_cast
  405.   end
  406.   #--------------------------------------------------------------------------
  407.   # * New method: default_cast
  408.   #--------------------------------------------------------------------------
  409.   def default_cast
  410.     speed = VE_ATB_DEFAULT_CAST
  411.     ((magical? && speed) || VE_ATB_REVERSE) ? {spd: speed, stat: "agi"} : nil
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # * New method: atb_cost
  415.   #--------------------------------------------------------------------------
  416.   def atb_cost
  417.     regexp = /<ATB COST: (\d+)%?>/i
  418.     note  =~ regexp ? [1.0 - ($1.to_f / 100), 0].max : 0
  419.   end
  420.   #--------------------------------------------------------------------------
  421.   # * New method: cast_cancel
  422.   #--------------------------------------------------------------------------
  423.   def cast_cancel
  424.     regexp = /<CAST CANCEL: (\d+)%?>/i
  425.     note  =~ regexp ? $1.to_f / 100 : 0
  426.   end
  427.   #--------------------------------------------------------------------------
  428.   # * New method: atb_delay
  429.   #--------------------------------------------------------------------------
  430.   def guard_skill?
  431.     effects.any? {|effect| effect.code == 21 && effect.data_id == 9 }
  432.   end
  433.   #--------------------------------------------------------------------------
  434.   # * New method: atb_delay
  435.   #--------------------------------------------------------------------------
  436.   def atb_delay
  437.     regexp = /<ATB DELAY: (\d+)%?, *([+-]?\d+)%?>/i
  438.     note   =~ regexp ? {rate: $1.to_f / 100, delay: $2.to_f / 100} :
  439.                        {rate: 0, delay: 0}
  440.   end
  441. end

  442. #==============================================================================
  443. # ** RPG::State
  444. #------------------------------------------------------------------------------
  445. #  This is the data class for states
  446. #==============================================================================

  447. class RPG::State < RPG::BaseItem
  448.   #--------------------------------------------------------------------------
  449.   # * Alias method: auto_removal_timing
  450.   #--------------------------------------------------------------------------
  451.   alias :auto_removal_timing_ve_active_time_battle :auto_removal_timing
  452.   def auto_removal_timing
  453.     timed_trigger ? 3 : auto_removal_timing_ve_active_time_battle
  454.   end
  455.   #--------------------------------------------------------------------------
  456.   # * New method: timed_trigger
  457.   #--------------------------------------------------------------------------
  458.   def timed_trigger
  459.     return @timed_trigger if @timed_trigger
  460.     return VE_ATB_REVERSE_GUARD_TIME if guard_state?
  461.     @timed_trigger = note =~ /<TIMED TRIGGER: (\d+)>/i ? $1.to_i : nil
  462.   end
  463.   #--------------------------------------------------------------------------
  464.   # * New method: guard_state?
  465.   #--------------------------------------------------------------------------
  466.   def guard_state?
  467.     features.any? {|ft| ft.code == 62 && ft.data_id == 1 }
  468.   end
  469. end

  470. #==============================================================================
  471. # ** BattleManager
  472. #------------------------------------------------------------------------------
  473. #  This module handles the battle processing
  474. #==============================================================================

  475. class << BattleManager
  476.   #--------------------------------------------------------------------------
  477.   # * Public Instance Variables
  478.   #--------------------------------------------------------------------------
  479.   attr_reader   :input_battlers
  480.   #--------------------------------------------------------------------------
  481.   # * Overwrite method: next_command
  482.   #--------------------------------------------------------------------------
  483.   def next_command
  484.     begin
  485.       return false if !actor || !actor.next_command
  486.     end until actor.inputable?
  487.     return true
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # * Overwrite method: prior_command
  491.   #--------------------------------------------------------------------------
  492.   def prior_command
  493.     begin
  494.       if !actor || !actor.prior_command
  495.         old_actor = actor
  496.         @actor_index -= 1
  497.         @actor_index %= $game_party.members.size
  498.         return false if old_actor == actor
  499.       end
  500.     end until actor.inputable?
  501.     return true
  502.   end
  503.   #--------------------------------------------------------------------------
  504.   # * Overwrite method: turn_start
  505.   #--------------------------------------------------------------------------
  506.   def turn_start
  507.     @phase = :turn
  508.     make_action_orders
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # * Overwrite method: turn_end
  512.   #--------------------------------------------------------------------------
  513.   def turn_end
  514.     @phase = :turn_end
  515.     $game_troop.increase_turn
  516.     @atb_turn_count = 0
  517.     @abt_turn_speed = setup_atb_turn_speed
  518.     all_battle_members.each do |battler|
  519.       battler.on_turn_end
  520.       next if scene_changing?
  521.       SceneManager.scene.refresh_status
  522.       SceneManager.scene.log_window.display_auto_affected_status(battler)
  523.       SceneManager.scene.log_window.wait_and_clear
  524.     end
  525.   end
  526.   #--------------------------------------------------------------------------
  527.   # * Overwrite method: make_action_orders
  528.   #--------------------------------------------------------------------------
  529.   def make_action_orders
  530.     @action_battlers += @active_members
  531.     @active_members.clear
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # * Alias method: init_members
  535.   #--------------------------------------------------------------------------
  536.   alias :init_members_ve_active_time_battle :init_members
  537.   def init_members
  538.     init_members_ve_active_time_battle   
  539.     @abt_turn_speed   = setup_atb_turn_speed
  540.     @escape_time      = 0
  541.     @atb_turn_count   = 0
  542.     @key_escape_count = 0
  543.     @input_battlers   = []
  544.     @active_members   = []
  545.     @action_battlers  = []
  546.   end
  547.   #--------------------------------------------------------------------------
  548.   # * Alias method: battle_start
  549.   #--------------------------------------------------------------------------
  550.   alias :battle_start_ve_active_time_battle :battle_start
  551.   def battle_start
  552.     battle_start_ve_active_time_battle
  553.     setup_initial_atb
  554.     @phase = :turn
  555.   end
  556.   #--------------------------------------------------------------------------
  557.   # * Alias method: process_escape
  558.   #--------------------------------------------------------------------------
  559.   alias :process_escape_ve_active_time_battle :process_escape
  560.   def process_escape
  561.     @preemptive = true if @escape_success
  562.     @escape_success = false
  563.     process_escape_ve_active_time_battle
  564.   end
  565.   #--------------------------------------------------------------------------
  566.   # * New method: update_atb
  567.   #--------------------------------------------------------------------------
  568.   def update_atb
  569.     clear_dead_atb
  570.     return if scene_changing?
  571.     return if $game_troop.interpreter.running?
  572.     return if SceneManager.scene.party_window?
  573.     return if $imported[:ve_animated_battle] && @escaping
  574.     update_timing
  575.     update_turn
  576.     update_all_atb
  577.     update_input
  578.     update_escaping
  579.   end
  580.   #--------------------------------------------------------------------------
  581.   # * New method: setup_initial_atb
  582.   #--------------------------------------------------------------------------
  583.   def setup_initial_atb
  584.     @escape_success = false
  585.     @key_escaping   = false
  586.     @escap_pose     = false
  587.     @party_escaping = false
  588.     all_battle_members.each {|battler| battler.cast_action = nil }
  589.     if @preemptive
  590.       $game_party.members.each {|battler| battler.atb = battler.max_atb }
  591.       $game_troop.members.each {|battler| battler.atb = 0 }
  592.     elsif @surprise
  593.       $game_party.members.each {|battler| battler.atb = 0 }
  594.       $game_troop.members.each {|battler| battler.atb = battler.max_atb }
  595.     else
  596.       all_battle_members.each {|battler| battler.preset_atb }
  597.     end
  598.   end
  599.   #--------------------------------------------------------------------------
  600.   # * New method: scene_changing?
  601.   #--------------------------------------------------------------------------
  602.   def scene_changing?
  603.     !SceneManager.scene_is?(Scene_Battle)
  604.   end
  605.   #--------------------------------------------------------------------------
  606.   # * New method: update_all_atb
  607.   #--------------------------------------------------------------------------
  608.   def update_all_atb
  609.     return if wating?
  610.     all_battle_members.each {|member| member.atb_update }
  611.   end
  612.   #--------------------------------------------------------------------------
  613.   # * New method: wating?
  614.   #--------------------------------------------------------------------------
  615.   def wating?
  616.     return true if scene_changing?
  617.     return true if $game_troop.interpreter.running?
  618.     return true if SceneManager.scene.full_wait?
  619.     return true if SceneManager.scene.semi_wait?
  620.     return true if wait_action?
  621.     return false
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # * New method: update_escaping
  625.   #--------------------------------------------------------------------------
  626.   def update_escaping
  627.     open_party_command   if VE_ATB_ESCAPE_TYPE == :party
  628.     process_party_escape if VE_ATB_ESCAPE_TYPE == :party && party_escape?
  629.     key_press_escape     if VE_ATB_ESCAPE_TYPE == :key
  630.     process_escape       if VE_ATB_ESCAPE_TYPE == :key   && key_escape?
  631.   end
  632.   #--------------------------------------------------------------------------
  633.   # * New method: open_party_command
  634.   #--------------------------------------------------------------------------
  635.   def open_party_command
  636.     return if scene_changing?
  637.     return if SceneManager.scene.windows_active?
  638.     SceneManager.scene.open_party_command_selection if Input.trigger?(:B)
  639.   end
  640.   #--------------------------------------------------------------------------
  641.   # * New method: party_escape?
  642.   #--------------------------------------------------------------------------
  643.   def party_escape?
  644.     $game_party.alive_members.all? {|actor| actor.atb_full? } &&
  645.     all_battle_members.all? {|battler| !active_battler?(battler) }
  646.   end
  647.   #--------------------------------------------------------------------------
  648.   # * New method: process_party_escape
  649.   #--------------------------------------------------------------------------
  650.   def process_party_escape
  651.     $game_party.members.each do |battler|
  652.       battler.atb = 0
  653.       battler.cast_action = nil
  654.       battler.clear_actions
  655.     end
  656.     @party_escaping = false
  657.     return if process_escape
  658.     turn_start
  659.     SceneManager.scene.battle_start_open_window unless scene_changing?
  660.   end
  661.   #--------------------------------------------------------------------------
  662.   # * New method: key_press_escape
  663.   #--------------------------------------------------------------------------
  664.   def key_press_escape
  665.     @key_escaping = VE_ATB_ESCAPE_KEYS.all? {|key| Input.press?(key)}
  666.     update_escape_time
  667.   end
  668.   #--------------------------------------------------------------------------
  669.   # * New method: key_escape?
  670.   #--------------------------------------------------------------------------
  671.   def key_escape?
  672.     all_battle_members.all? {|battler| !active?(battler) } && @escape_success
  673.   end
  674.   #--------------------------------------------------------------------------
  675.   # * New method: update_escape_time
  676.   #--------------------------------------------------------------------------
  677.   def update_escape_time
  678.     return if @escape_success
  679.     escaping? ? increase_escape_time : decrease_escape_time
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   # * New method: increase_escape_time
  683.   #--------------------------------------------------------------------------
  684.   def increase_escape_time
  685.     reset_escape_pose if !reset_escape_pose?
  686.     @escap_pose = true
  687.     if BattleManager.can_escape?
  688.       @escape_time   = [@escape_time + 5 + rand, max_escape_time].min
  689.       @escape_success = @escape_time == max_escape_time
  690.     end
  691.   end
  692.   #--------------------------------------------------------------------------
  693.   # * New method: decrease_escape_time
  694.   #--------------------------------------------------------------------------
  695.   def decrease_escape_time
  696.     reset_escape_pose if reset_escape_pose?
  697.     @escap_pose  = false
  698.     @escape_time = [@escape_time - 1, 0].max
  699.   end
  700.   #--------------------------------------------------------------------------
  701.   # * New method: reset_escape_pose
  702.   #--------------------------------------------------------------------------
  703.   def reset_escape_pose
  704.     $game_party.alive_members.each {|actor| actor.reset_pose if !actor.active? }
  705.   end
  706.   #--------------------------------------------------------------------------
  707.   # * New method: reset_escape_pose?
  708.   #--------------------------------------------------------------------------
  709.   def reset_escape_pose?
  710.     $imported[:ve_animated_battle] && @escap_pose && VE_ATB_ESCAPING_ANIM
  711.   end
  712.   #--------------------------------------------------------------------------
  713.   # * New method: max_escape_time
  714.   #--------------------------------------------------------------------------
  715.   def max_escape_time
  716.     10.0 * VE_ATB_ESCAPE_TIME * @escape_ratio * $game_system.atb_speed
  717.   end
  718.   #--------------------------------------------------------------------------
  719.   # * New method: wait_action?
  720.   #--------------------------------------------------------------------------
  721.   def wait_action?
  722.     $imported[:ve_animated_battle]  && !scene_changing? &&
  723.     SceneManager.scene.wait_action? && SceneManager.scene.active?
  724.   end
  725.   #--------------------------------------------------------------------------
  726.   # * New method: update_turn
  727.   #--------------------------------------------------------------------------
  728.   def update_turn
  729.     return if wating?
  730.     increase_atb_turn_count(:time)
  731.     SceneManager.scene.turn_ending if @atb_turn_count >= @abt_turn_speed
  732.   end
  733.   #--------------------------------------------------------------------------
  734.   # * New method: update_timing
  735.   #--------------------------------------------------------------------------
  736.   def update_timing
  737.     return if wating?
  738.     all_battle_members.each {|battler| battler.on_timing }
  739.   end
  740.   #--------------------------------------------------------------------------
  741.   # * New method: update_input
  742.   #--------------------------------------------------------------------------
  743.   def update_input
  744.     all_battle_members.reverse.each do |battler|
  745.       next if (@party_escaping && battler.actor?) || !battler.ready?
  746.       @input_battlers.push(battler)
  747.       battler.on_action_start
  748.       skill_window.refresh if skill_window.active
  749.       item_window.refresh  if item_window.active
  750.     end
  751.     shift_input unless @input_battlers.empty?
  752.   end
  753.   #--------------------------------------------------------------------------
  754.   # * New method: skill_window
  755.   #--------------------------------------------------------------------------
  756.   def skill_window
  757.     SceneManager.scene.skill_window
  758.   end
  759.   #--------------------------------------------------------------------------
  760.   # * New method: item_window
  761.   #--------------------------------------------------------------------------
  762.   def item_window
  763.     SceneManager.scene.item_window
  764.   end
  765.   #--------------------------------------------------------------------------
  766.   # * New method: shift_input
  767.   #--------------------------------------------------------------------------
  768.   def shift_input
  769.     battler = @input_battlers.last
  770.     battler.actor? ? setup_action(battler) : setup_no_selection(battler)
  771.   end
  772.   #--------------------------------------------------------------------------
  773.   # * New method: setup_action
  774.   #--------------------------------------------------------------------------
  775.   def setup_action(battler)
  776.     return if scene_changing?
  777.     return if SceneManager.scene.windows_active? && battler.inputable?
  778.     return if battler.guard? && VE_ATB_REVERSE
  779.     battler.inputable? ? setup_selection(battler) : setup_no_selection(battler)
  780.   end
  781.   #--------------------------------------------------------------------------
  782.   # * New method: setup_selection
  783.   #--------------------------------------------------------------------------
  784.   def setup_selection(battler)
  785.     @actor_index = battler.index
  786.     battler.make_actions
  787.     SceneManager.scene.start_actor_command_selection
  788.     VE_ATB_SOUND.play if VE_ATB_SOUND
  789.   end
  790.   #--------------------------------------------------------------------------
  791.   # * New method: setup_no_selection
  792.   #--------------------------------------------------------------------------
  793.   def setup_no_selection(battler)
  794.     battler.turn_count += 1 if !battler.actor? && !battler.cast_action?
  795.     battler.make_actions
  796.     battler.setup_cast_action if battler.cast_action?
  797.     @input_battlers.delete(battler)
  798.     @active_members.push(battler)
  799.     turn_start
  800.   end
  801.   #--------------------------------------------------------------------------
  802.   # * New method: add_actor
  803.   #--------------------------------------------------------------------------
  804.   def add_actor(battler)
  805.     return unless input_battlers?(battler)
  806.     @input_battlers.delete(battler)
  807.     @active_members.push(battler)
  808.   end
  809.   #--------------------------------------------------------------------------
  810.   # * New method: active_battler?
  811.   #--------------------------------------------------------------------------
  812.   def active_battler?(battler)
  813.     @active_members.include?(battler) || @action_battlers.include?(battler) ||
  814.     @input_battlers.include?(battler) || battler.current_actor? ||
  815.     active?(battler)
  816.   end
  817.   #--------------------------------------------------------------------------
  818.   # * New method: input_battlers?
  819.   #--------------------------------------------------------------------------
  820.   def input_battlers?(battler)
  821.     @input_battlers.include?(battler)
  822.   end
  823.   #--------------------------------------------------------------------------
  824.   # * New method: all_battle_members
  825.   #--------------------------------------------------------------------------
  826.   def all_battle_members
  827.     $game_party.members + $game_troop.members
  828.   end
  829.   #--------------------------------------------------------------------------
  830.   # * New method: all_dead_members
  831.   #--------------------------------------------------------------------------
  832.   def all_dead_members
  833.     $game_party.dead_members + $game_troop.dead_members
  834.   end
  835.   #--------------------------------------------------------------------------
  836.   # * New method: delete_input
  837.   #--------------------------------------------------------------------------
  838.   def delete_input(battler)
  839.     @input_battlers.delete(battler)
  840.   end
  841.   #--------------------------------------------------------------------------
  842.   # * New method: clear_battler
  843.   #--------------------------------------------------------------------------
  844.   def clear_battler(battler)
  845.     @input_battlers.delete(battler)
  846.     @active_members.delete(battler)
  847.   end
  848.   #--------------------------------------------------------------------------
  849.   # * New method: escaping?
  850.   #--------------------------------------------------------------------------
  851.   def escaping?
  852.     @key_escaping
  853.   end
  854.   #--------------------------------------------------------------------------
  855.   # * New method: party_escaping?
  856.   #--------------------------------------------------------------------------
  857.   def party_escaping?
  858.     @party_escaping
  859.   end
  860.   #--------------------------------------------------------------------------
  861.   # * New method: active?
  862.   #--------------------------------------------------------------------------
  863.   def active?(battler)
  864.     $imported[:ve_animated_battle] && battler.poses.active?
  865.   end
  866.   #--------------------------------------------------------------------------
  867.   # * New method: setup_atb_turn_speed
  868.   #--------------------------------------------------------------------------
  869.   def setup_atb_turn_speed
  870.     case VE_ATB_TURN_COUNT
  871.     when :battlers then all_dead_members.size
  872.     when :actions  then VE_ATB_ACTION_COUNT
  873.     when :time     then VE_ATB_TIME_COUNT
  874.     end
  875.   end
  876.   #--------------------------------------------------------------------------
  877.   # * New method: clear_dead_atb
  878.   #--------------------------------------------------------------------------
  879.   def clear_dead_atb
  880.     all_dead_members.each do |battler|
  881.       next unless active_battler?(battler)
  882.       battler.atb = 0
  883.       @active_members.delete(battler)
  884.       @input_battlers.delete(battler)
  885.       @action_battlers.delete(battler)
  886.     end
  887.   end
  888.   #--------------------------------------------------------------------------
  889.   # * New method: increase_atb_turn_count
  890.   #--------------------------------------------------------------------------
  891.   def increase_atb_turn_count(type)
  892.     @atb_turn_count += $game_system.atb_speed if VE_ATB_TURN_COUNT == type
  893.   end
  894.   #--------------------------------------------------------------------------
  895.   # * New method: setup_escape
  896.   #--------------------------------------------------------------------------
  897.   def setup_escape
  898.     $game_party.members.each {|battler| delete_input(battler) }
  899.     @party_escaping = true
  900.   end
  901.   #--------------------------------------------------------------------------
  902.   # * New method: undo_escape
  903.   #--------------------------------------------------------------------------
  904.   def undo_escape
  905.     @party_escaping = false
  906.   end
  907.   #--------------------------------------------------------------------------
  908.   # * New method: turn_phase
  909.   #--------------------------------------------------------------------------
  910.   def turn_phase
  911.     @phase = :turn
  912.   end
  913. end

  914. #==============================================================================
  915. # ** Game_System
  916. #------------------------------------------------------------------------------
  917. #  This class handles system-related data. Also manages vehicles and BGM, etc.
  918. # The instance of this class is referenced by $game_system.
  919. #==============================================================================

  920. class Game_System
  921.   #--------------------------------------------------------------------------
  922.   # * Public Instance Variables
  923.   #--------------------------------------------------------------------------
  924.   attr_accessor :wait_mode
  925.   attr_accessor :atb_speed
  926.   #--------------------------------------------------------------------------
  927.   # * Alias method: initialize
  928.   #--------------------------------------------------------------------------
  929.   alias :initialize_ve_active_time_battle :initialize
  930.   def initialize
  931.     initialize_ve_active_time_battle
  932.     @wait_mode = VE_ATB_WAIT_MODE
  933.     @atb_speed = VE_ATB_SPEED
  934.   end
  935. end

  936. #==============================================================================
  937. # ** Game_Action
  938. #------------------------------------------------------------------------------
  939. #  This class handles battle actions. This class is used within the
  940. # Game_Battler class.
  941. #==============================================================================

  942. class Game_Action
  943.   #--------------------------------------------------------------------------
  944.   # * Alias method: prepare
  945.   #--------------------------------------------------------------------------
  946.   alias :prepare_ve_active_time_battle :prepare
  947.   def prepare
  948.     subject.atb = item ? subject.atb * item.atb_cost : 0
  949.     if item && item.castable? && !subject.cast_action? &&
  950.        !subject.confusion? && !forcing
  951.       subject.cast_action = self.clone
  952.       subject.skip_actions
  953.       subject.reset_pose if $imported[:ve_animated_battle]
  954.     else
  955.       subject.cast_action = nil if !forcing
  956.       prepare_ve_active_time_battle
  957.     end
  958.   end
  959. end

  960. #==============================================================================
  961. # ** Game_BattlerBase
  962. #------------------------------------------------------------------------------
  963. #  This class handles battlers. It's used as a superclass of the Game_Battler
  964. # classes.
  965. #==============================================================================

  966. class Game_BattlerBase
  967.   #--------------------------------------------------------------------------
  968.   # * Alias method: inputable?
  969.   #--------------------------------------------------------------------------
  970.   alias :inputable_ve_active_time_battle? :inputable?
  971.   def inputable?
  972.     inputable_ve_active_time_battle? && atb_full? && input? && !cast_action?
  973.   end
  974.   #--------------------------------------------------------------------------
  975.   # * Alias method: clear_states
  976.   #--------------------------------------------------------------------------  
  977.   alias :clear_states_ve_active_time_battle :clear_states
  978.   def clear_states
  979.     clear_states_ve_active_time_battle
  980.     @state_timing = {}
  981.   end
  982.   #--------------------------------------------------------------------------
  983.   # * Alias method: erase_state
  984.   #--------------------------------------------------------------------------
  985.   alias :erase_state_ve_active_time_battle :erase_state
  986.   def erase_state(state_id)
  987.     erase_state_ve_active_time_battle(state_id)
  988.     @state_timing.delete(state_id)
  989.   end
  990. end

  991. #==============================================================================
  992. # ** Game_Battler
  993. #------------------------------------------------------------------------------
  994. #  This class deals with battlers. It's used as a superclass of the Game_Actor
  995. # and Game_Enemy classes.
  996. #==============================================================================

  997. class Game_Battler < Game_BattlerBase
  998.   #--------------------------------------------------------------------------
  999.   # * Public Instance Variables
  1000.   #--------------------------------------------------------------------------
  1001.   attr_accessor :cast_action
  1002.   #--------------------------------------------------------------------------
  1003.   # * Overwite method: on_action_end
  1004.   #--------------------------------------------------------------------------
  1005.   def on_action_end
  1006.     @result.clear
  1007.     regenerate_all if VE_ATB_REGEN_TRIGGER == :action
  1008.     @result.clear  if VE_ATB_REGEN_TRIGGER == :action
  1009.     remove_states_auto(1)
  1010.     update_buff_turns
  1011.     remove_buffs_auto
  1012.   end
  1013.   #--------------------------------------------------------------------------
  1014.   # * Overwite method: on_turn_end
  1015.   #--------------------------------------------------------------------------
  1016.   def on_turn_end
  1017.     @result.clear
  1018.     remove_states_auto(2)
  1019.   end
  1020.   #--------------------------------------------------------------------------
  1021.   # * Alias method: remove_states_auto
  1022.   #--------------------------------------------------------------------------
  1023.   alias :remove_states_auto_ve_active_time_battle :remove_states_auto
  1024.   def remove_states_auto(timing)
  1025.     update_state_auto(timing)
  1026.     remove_states_auto_ve_active_time_battle(timing)
  1027.   end
  1028.   #--------------------------------------------------------------------------
  1029.   # * Alias method: item_user_effect
  1030.   #--------------------------------------------------------------------------
  1031.   alias :item_user_effect_ve_active_time_battle :item_user_effect
  1032.   def item_user_effect(user, item)
  1033.     item_user_effect_ve_active_time_battle(user, item)
  1034.     setup_cast_cancel(user, item)
  1035.     setup_atb_delay(user, item)
  1036.   end
  1037.   #--------------------------------------------------------------------------
  1038.   # * Alias method: reset_state_counts
  1039.   #--------------------------------------------------------------------------
  1040.   alias :reset_state_counts_ve_active_time_battle :reset_state_counts
  1041.   def reset_state_counts(state_id)
  1042.     reset_state_counts_ve_active_time_battle(state_id)
  1043.     state = $data_states[state_id]
  1044.     @state_timing[state_id] = state.timed_trigger if state.timed_trigger
  1045.   end
  1046.   #--------------------------------------------------------------------------
  1047.   # * New method: max_atb
  1048.   #--------------------------------------------------------------------------
  1049.   def max_atb
  1050.     @max_atb ||= 1000
  1051.   end
  1052.   #--------------------------------------------------------------------------
  1053.   # * New method: atb
  1054.   #--------------------------------------------------------------------------
  1055.   def atb
  1056.     @atb ||= 0
  1057.   end
  1058.   #--------------------------------------------------------------------------
  1059.   # * New method: atb=
  1060.   #--------------------------------------------------------------------------
  1061.   def atb=(n)
  1062.     @atb = [[n, 0].max, max_atb].min
  1063.   end
  1064.   #--------------------------------------------------------------------------
  1065.   # * New method: atb_freeze
  1066.   #--------------------------------------------------------------------------
  1067.   def atb_freeze
  1068.     @atb_freeze
  1069.   end
  1070.   #--------------------------------------------------------------------------
  1071.   # * New method: regen_timing
  1072.   #--------------------------------------------------------------------------
  1073.   def regen_timing
  1074.     @regen_timing ||= 0
  1075.   end
  1076.   #--------------------------------------------------------------------------
  1077.   # * New method: regen_timing=
  1078.   #--------------------------------------------------------------------------
  1079.   def regen_timing=(n)
  1080.     @regen_timing = [[n, 0].max, VE_ATB_REGEN_TIMING].min
  1081.   end
  1082.   #--------------------------------------------------------------------------
  1083.   # * New method: regen_timing_full?
  1084.   #--------------------------------------------------------------------------
  1085.   def regen_timing_full?
  1086.     regen_timing == VE_ATB_REGEN_TIMING
  1087.   end
  1088.   #--------------------------------------------------------------------------
  1089.   # * New method: atb_freeze=
  1090.   #--------------------------------------------------------------------------
  1091.   def atb_freeze=(n)
  1092.     @atb_freeze = n
  1093.   end
  1094.   #--------------------------------------------------------------------------
  1095.   # * New method: atb_full?
  1096.   #--------------------------------------------------------------------------
  1097.   def atb_full?
  1098.     @atb == max_atb
  1099.   end
  1100.   #--------------------------------------------------------------------------
  1101.   # * New method: atb_rate
  1102.   #--------------------------------------------------------------------------
  1103.   def atb_rate
  1104.     atb.to_f / max_atb
  1105.   end
  1106.   #--------------------------------------------------------------------------
  1107.   # * New method: ready?
  1108.   #--------------------------------------------------------------------------
  1109.   def ready?
  1110.     movable? && atb_full? && !active_battler?
  1111.   end
  1112.   #--------------------------------------------------------------------------
  1113.   # * New method: cast_action?
  1114.   #--------------------------------------------------------------------------
  1115.   def cast_action?
  1116.     cast_action ? true : false
  1117.   end
  1118.   #--------------------------------------------------------------------------
  1119.   # * New method: preset_atb
  1120.   #--------------------------------------------------------------------------
  1121.   def preset_atb
  1122.     self.atb = max_atb * VE_ATB_START_RATE * rand / 100
  1123.   end
  1124.   #--------------------------------------------------------------------------
  1125.   # * New method: total_agi
  1126.   #--------------------------------------------------------------------------
  1127.   def total_agi
  1128.     SceneManager.scene.all_battle_members.inject(0.0) {|r, obj| r += obj.agi }
  1129.   end
  1130.   #--------------------------------------------------------------------------
  1131.   # * New method: atb_update
  1132.   #--------------------------------------------------------------------------
  1133.   def atb_update
  1134.     update_atb_freeze if atb_freeze?
  1135.     return if atb_wait?
  1136.     self.atb_freeze = nil
  1137.     self.atb += update_atb
  1138.     self.atb  = max_atb if VE_ATB_REVERSE && !cast_action?
  1139.   end
  1140.   #--------------------------------------------------------------------------
  1141.   # * New method: atb_freeze?
  1142.   #--------------------------------------------------------------------------
  1143.   def atb_freeze?
  1144.     !movable?
  1145.   end
  1146.   #--------------------------------------------------------------------------
  1147.   # * New method: update_atb
  1148.   #--------------------------------------------------------------------------
  1149.   def update_atb
  1150.     speed = cast_action? ? cast_speed : agi
  1151.     20.0 * $game_system.atb_speed * atb_speed_mod(speed) * speed_modifier
  1152.   end
  1153.   #--------------------------------------------------------------------------
  1154.   # * New method: atb_wait?
  1155.   #--------------------------------------------------------------------------
  1156.   def atb_wait?
  1157.     atb_full? || atb_freeze? || pause_damage? || current_actor? ||
  1158.     (actor? && BattleManager.escaping?)
  1159.   end
  1160.   #--------------------------------------------------------------------------
  1161.   # * New method: update_atb_freeze
  1162.   #--------------------------------------------------------------------------
  1163.   def update_atb_freeze
  1164.     self.cast_action = nil
  1165.     self.atb_freeze ||= self.atb
  1166.     self.atb_freeze  += update_atb
  1167.     atb_freeze_result unless @atb_freeze < max_atb
  1168.   end
  1169.   #--------------------------------------------------------------------------
  1170.   # * New method: atb_freeze_result
  1171.   #--------------------------------------------------------------------------
  1172.   def atb_freeze_result
  1173.     @result.clear
  1174.     remove_states_auto(1)
  1175.     regenerate_all if VE_ATB_REGEN_TRIGGER == :action
  1176.     self.atb_freeze = 0
  1177.   end
  1178.   #--------------------------------------------------------------------------
  1179.   # * New method: pause_damage?
  1180.   #--------------------------------------------------------------------------
  1181.   def pause_damage?
  1182.     VE_ATB_DAMAGE_WAIT && $imported[:ve_animated_battle] && poses.damage_pose?
  1183.   end
  1184.   #--------------------------------------------------------------------------
  1185.   # * New method: cast_speed
  1186.   #--------------------------------------------------------------------------
  1187.   def cast_speed
  1188.     return agi if !cast_action
  1189.     speed = cast_action.item.cast_speed
  1190.     speed[:spd] * send(make_symbol(speed[:stat])) / 100.0
  1191.   end
  1192.   #--------------------------------------------------------------------------
  1193.   # * New method: atb_speed_mod
  1194.   #--------------------------------------------------------------------------
  1195.   def atb_speed_mod(speed)
  1196.     (speed + [VE_speed_modifier, 0].max) / total_agi
  1197.   end
  1198.   #--------------------------------------------------------------------------
  1199.   # * New method: setup_cast_action
  1200.   #--------------------------------------------------------------------------
  1201.   def setup_cast_action
  1202.     @actions = [cast_action]
  1203.   end
  1204.   #--------------------------------------------------------------------------
  1205.   # * New method: setup_cast_cancel
  1206.   #--------------------------------------------------------------------------
  1207.   def setup_cast_cancel(user, item)
  1208.     rate  = item.cast_cancel
  1209.     rate += user.cast_cancel if item.physical?
  1210.     rate *= cast_protection
  1211.     execute_cast_cancel      if rand < rate && cast_action?
  1212.   end
  1213.   #--------------------------------------------------------------------------
  1214.   # * New method: setup_atb_delay
  1215.   #--------------------------------------------------------------------------
  1216.   def setup_atb_delay(user, item)
  1217.     rate  = item.atb_delay[:rate]
  1218.     rate += user.atb_delay[:rate] if item.physical?
  1219.     rate *= delay_protection
  1220.     execute_atb_delay(user, item) if rand < rate
  1221.   end
  1222.   #--------------------------------------------------------------------------
  1223.   # * New method: execute_cast_cancel
  1224.   #--------------------------------------------------------------------------
  1225.   def execute_cast_cancel
  1226.     skip_actions
  1227.     self.atb = 0
  1228.     self.cast_action = nil
  1229.   end
  1230.   #--------------------------------------------------------------------------
  1231.   # * New method: execute_atb_delay
  1232.   #--------------------------------------------------------------------------
  1233.   def execute_atb_delay(user, item)
  1234.     rate  = item.atb_delay[:delay]
  1235.     rate += user.atb_delay[:delay] if item.physical?
  1236.     self.atb -= max_atb * rate
  1237.   end
  1238.   #--------------------------------------------------------------------------
  1239.   # * New method: cast_cancel
  1240.   #--------------------------------------------------------------------------
  1241.   def cast_cancel
  1242.     regexp = /<CAST CANCEL: (\d+)%?>/i
  1243.     get_all_notes.scan(regexp).inject(0.0) {|r| r += ($1.to_f / 100) }
  1244.   end
  1245.   #--------------------------------------------------------------------------
  1246.   # * New method: atb_delay
  1247.   #--------------------------------------------------------------------------
  1248.   def atb_delay
  1249.     result = {}
  1250.     notes  = get_all_notes.dup
  1251.     regexp = /<ATB DELAY: (\d+)%?, *(\d+)%?>/i
  1252.     result[:rate]  = notes.scan(regexp).inject(0.0) {|r| r += ($1.to_f / 100) }
  1253.     result[:delay] = notes.scan(regexp).inject(0.0) {|r| r += ($1.to_f / 100) }
  1254.     result
  1255.   end
  1256.   #--------------------------------------------------------------------------
  1257.   # * New method: cast_protection
  1258.   #--------------------------------------------------------------------------
  1259.   def cast_protection
  1260.     regexp = /<CAST PROTECTION: (\d+)%?>/i
  1261.     get_all_notes.scan(regexp).inject(1.0) {|r| r *= 1 - ($1.to_f / 100) }
  1262.   end
  1263.   #--------------------------------------------------------------------------
  1264.   # * New method: delay_protection
  1265.   #--------------------------------------------------------------------------
  1266.   def delay_protection
  1267.     regexp = /<DELAY PROTECTION: (\d+)%?>/i
  1268.     get_all_notes.scan(regexp).inject(1.0) {|r| r *= 1 - ($1.to_f / 100) }
  1269.   end
  1270.   #--------------------------------------------------------------------------
  1271.   # * New method: update_state_auto
  1272.   #--------------------------------------------------------------------------
  1273.   def update_state_auto(timing)
  1274.     states.each do |state|
  1275.       if @state_turns[state.id] > 0 && state.auto_removal_timing == timing
  1276.         @state_turns[state.id] -= 1
  1277.       end
  1278.     end
  1279.   end
  1280.   #--------------------------------------------------------------------------
  1281.   # * New method: on_timing
  1282.   #--------------------------------------------------------------------------
  1283.   def on_timing
  1284.     timing_regen
  1285.     remove_timing_states
  1286.   end
  1287.   #--------------------------------------------------------------------------
  1288.   # * New method: timing_regen
  1289.   #--------------------------------------------------------------------------
  1290.   def timing_regen
  1291.     return unless VE_ATB_REGEN_TRIGGER == :timing
  1292.     self.regen_timing += $game_system.atb_speed if regen?
  1293.     @result.clear     if regen_timing_full?
  1294.     regenerate_all    if regen_timing_full?
  1295.     @regen_timing = 0 if regen_timing_full? || !regen?
  1296.   end
  1297.   #--------------------------------------------------------------------------
  1298.   # * New method: remove_timing_states
  1299.   #--------------------------------------------------------------------------
  1300.   def remove_timing_states
  1301.     states.each do |state|
  1302.       next if state.auto_removal_timing != 3
  1303.       next if state.guard_state? && !VE_ATB_REVERSE
  1304.       @state_timing[state.id] -= $game_system.atb_speed
  1305.       if @state_turns[state.id] > 0 && @state_timing[state.id] <= 0
  1306.         @state_turns[state.id] -= 1
  1307.         @state_timing[state.id] = state.timed_trigger
  1308.       end
  1309.       remove_state(state.id) if @state_turns[state.id] == 0
  1310.     end
  1311.   end
  1312.   #--------------------------------------------------------------------------
  1313.   # * New method: regen?
  1314.   #--------------------------------------------------------------------------
  1315.   def regen?
  1316.     hrg != 0 || mrg != 0 || trg != 0
  1317.   end
  1318.   #--------------------------------------------------------------------------
  1319.   # * Overwite method: on_action_end
  1320.   #--------------------------------------------------------------------------
  1321.   def on_action_start
  1322.     make_actions
  1323.     remove_guard_state
  1324.   end
  1325.   #--------------------------------------------------------------------------
  1326.   # * Overwite method: remove_guard_state
  1327.   #--------------------------------------------------------------------------
  1328.   def remove_guard_state
  1329.     return if VE_ATB_REVERSE
  1330.     states.each do |state|
  1331.       next unless state.guard_state?
  1332.       remove_state(state.id)
  1333.       @damaged = true
  1334.     end
  1335.   end
  1336.   #--------------------------------------------------------------------------
  1337.   # * New method: skip_actions
  1338.   #--------------------------------------------------------------------------
  1339.   def skip_actions
  1340.     clear_actions
  1341.     @actions = [Game_Action.new(self)]
  1342.   end
  1343.   #--------------------------------------------------------------------------
  1344.   # * New method: active_battler?
  1345.   #--------------------------------------------------------------------------
  1346.   def active_battler?
  1347.     BattleManager.active_battler?(self)
  1348.   end
  1349.   #--------------------------------------------------------------------------
  1350.   # * New method: input?
  1351.   #--------------------------------------------------------------------------
  1352.   def input?
  1353.     BattleManager.input_battlers?(self)
  1354.   end
  1355.   #--------------------------------------------------------------------------
  1356.   # * New method: current_actor?
  1357.   #--------------------------------------------------------------------------
  1358.   def current_actor?
  1359.     SceneManager.scene_is?(Scene_Battle) && SceneManager.scene.subject == self
  1360.   end
  1361. end

  1362. #==============================================================================
  1363. # ** Game_Actor
  1364. #------------------------------------------------------------------------------
  1365. #  This class handles actors. It's used within the Game_Actors class
  1366. # ($game_actors) and referenced by the Game_Party class ($game_party).
  1367. #==============================================================================

  1368. class Game_Actor < Game_Battler
  1369.   #--------------------------------------------------------------------------
  1370.   # * New method: speed_modifier
  1371.   #--------------------------------------------------------------------------
  1372.   def speed_modifier
  1373.     list = [self.actor] + [self.class] + states + equips
  1374.     list.compact.inject(1.0) {|r, obj| r *= obj.atb_speed }
  1375.   end
  1376. end

  1377. #==============================================================================
  1378. # ** Game_Enemy
  1379. #------------------------------------------------------------------------------
  1380. #  This class handles enemy characters. It's used within the Game_Troop class
  1381. # ($game_troop).
  1382. #==============================================================================

  1383. class Game_Enemy < Game_Battler
  1384.   #--------------------------------------------------------------------------
  1385.   # * Public Instance Variables
  1386.   #--------------------------------------------------------------------------
  1387.   attr_accessor :turn_count
  1388.   #--------------------------------------------------------------------------
  1389.   # * Overwrite method: conditions_met_turns?
  1390.   #--------------------------------------------------------------------------
  1391.   def conditions_met_turns?(param1, param2)
  1392.     n = @turn_count
  1393.     if param2 == 0
  1394.       n == param1
  1395.     else
  1396.       n > 0 && n >= param1 && n % param2 == param1 % param2
  1397.     end
  1398.   end
  1399.   #--------------------------------------------------------------------------
  1400.   # * Alias method: initialize
  1401.   #--------------------------------------------------------------------------
  1402.   alias :initialize_ve_active_time_battle :initialize
  1403.   def initialize(index, enemy_id)
  1404.     initialize_ve_active_time_battle(index, enemy_id)
  1405.     @turn_count = 0
  1406.   end
  1407.   #--------------------------------------------------------------------------
  1408.   # * New method: speed_modifier
  1409.   #--------------------------------------------------------------------------
  1410.   def speed_modifier
  1411.     enemy.atb_speed * states.inject(1.0) {|r, state| r *= state.atb_speed }
  1412.   end
  1413. end

  1414. #==============================================================================
  1415. # ** Spriteset_Battle
  1416. #------------------------------------------------------------------------------
  1417. #  This class brings together battle screen sprites. It's used within the
  1418. # Scene_Battle class.
  1419. #==============================================================================

  1420. class Spriteset_Battle
  1421.   #--------------------------------------------------------------------------
  1422.   # * Alias method: update_actors
  1423.   #--------------------------------------------------------------------------
  1424.   alias :update_actors_ve_active_time_battle :update_actors
  1425.   def update_actors
  1426.     uptate_actors_atb
  1427.     update_actors_ve_active_time_battle
  1428.   end
  1429.   #--------------------------------------------------------------------------
  1430.   # * New method: uptate_actors_atb
  1431.   #--------------------------------------------------------------------------
  1432.   def uptate_actors_atb
  1433.     return if @atb_actors == $game_party.members
  1434.     $game_party.members.each do |actor|
  1435.       actor.preset_atb if @atb_actors && !@atb_actors.include?(actor)
  1436.     end
  1437.     @atb_actors = $game_party.members.dup
  1438.   end
  1439. end

  1440. #==============================================================================
  1441. # ** Window_Base
  1442. #------------------------------------------------------------------------------
  1443. #  This is a superclass of all windows in the game.
  1444. #==============================================================================

  1445. class Window_Base < Window
  1446.   #--------------------------------------------------------------------------
  1447.   # * Public Instance Variables
  1448.   #--------------------------------------------------------------------------
  1449.   attr_accessor :hidden
  1450. end

  1451. #==============================================================================
  1452. # ** Window_BattleLog
  1453. #------------------------------------------------------------------------------
  1454. #  This window shows the battle progress. Do not show the window frame.
  1455. #==============================================================================

  1456. class Window_BattleLog < Window_Selectable
  1457.   #--------------------------------------------------------------------------
  1458.   # * Alias method: last_text
  1459.   #--------------------------------------------------------------------------
  1460.   alias :last_text_ve_active_time_battle :last_text
  1461.   def last_text
  1462.     last_text_ve_active_time_battle ? last_text_ve_active_time_battle : ""
  1463.   end
  1464. end

  1465. #==============================================================================
  1466. # ** Window_ActorCommand
  1467. #------------------------------------------------------------------------------
  1468. #  This window is used to select actor commands, such as "Attack" or "Skill".
  1469. #==============================================================================

  1470. class Window_ActorCommand < Window_Command
  1471.   #--------------------------------------------------------------------------
  1472.   # * Alias method: make_command_list
  1473.   #--------------------------------------------------------------------------
  1474.   alias :make_command_list_ve_active_time_battle :make_command_list
  1475.   def make_command_list
  1476.     make_command_list_ve_active_time_battle
  1477.     add_escape_command if VE_ATB_ESCAPE_TYPE == :command
  1478.   end
  1479.   #--------------------------------------------------------------------------
  1480.   # * New method: add_escape_command
  1481.   #--------------------------------------------------------------------------
  1482.   def add_escape_command
  1483.     add_command(Vocab::escape, :escape, BattleManager.can_escape?)
  1484.   end
  1485. end

  1486. #==============================================================================
  1487. # ** Window_BattleStatus
  1488. #------------------------------------------------------------------------------
  1489. #  Esta janela exibe as condições de todos membros do grupo na tela de batalha.
  1490. #==============================================================================

  1491. class Window_BattleStatus < Window_Selectable
  1492.   #--------------------------------------------------------------------------
  1493.   # * Overwrite method: window_width
  1494.   #--------------------------------------------------------------------------
  1495.   def window_width
  1496.     Graphics.width - ($data_system.opt_display_tp ? 0 : 128)
  1497.   end
  1498.   #--------------------------------------------------------------------------
  1499.   # * Overwrite method: draw_basic_area
  1500.   #--------------------------------------------------------------------------
  1501.   def draw_basic_area(rect, actor)
  1502.     width = $data_system.opt_display_tp ? 180 : 104
  1503.     draw_actor_name(actor, rect.x + 0, rect.y, 100)
  1504.     draw_actor_icons(actor, rect.x + 104, rect.y, [rect.width - width, 24].max)
  1505.   end
  1506.   #--------------------------------------------------------------------------
  1507.   # * Overwrite method: draw_gauge_area_with_tp
  1508.   #--------------------------------------------------------------------------
  1509.   def draw_gauge_area_with_tp(rect, actor)
  1510.     draw_actor_hp(actor, rect.x - 82, rect.y, 72)
  1511.     draw_actor_mp(actor, rect.x + 0, rect.y, 64)
  1512.     draw_actor_tp(actor, rect.x + 74, rect.y, 64)
  1513.     update_atb
  1514.   end
  1515.   #--------------------------------------------------------------------------
  1516.   # * Overwrite method: draw_gauge_area_without_tp
  1517.   #--------------------------------------------------------------------------
  1518.   def draw_gauge_area_without_tp(rect, actor)
  1519.     draw_actor_hp(actor, rect.x + 0, rect.y, 72)
  1520.     draw_actor_mp(actor, rect.x + 82, rect.y, 64)
  1521.     update_atb
  1522.   end
  1523.   #--------------------------------------------------------------------------
  1524.   # * Overwrite method: update
  1525.   #--------------------------------------------------------------------------
  1526.   def update
  1527.     super
  1528.     update_atb
  1529.   end
  1530.   #--------------------------------------------------------------------------
  1531.   # * New method: update_atb
  1532.   #--------------------------------------------------------------------------
  1533.   def update_atb
  1534.     @count ||= 0
  1535.     @count  += 1
  1536.     return if @count % 2 != 0
  1537.     update_atb_bars
  1538.   end
  1539.   #--------------------------------------------------------------------------
  1540.   # * New method: update_atb_bars
  1541.   #--------------------------------------------------------------------------
  1542.   def update_atb_bars
  1543.     tp_adjust = $data_system.opt_display_tp ? 148 : 156
  1544.     item_max.times do |i|
  1545.       actor = $game_party.battle_members[i]
  1546.       rect  = gauge_area_rect(i)
  1547.       rect.x += tp_adjust
  1548.       contents.clear_rect(rect)
  1549.       draw_actor_atb(actor, rect.x, rect.y, 64)
  1550.     end
  1551.   end
  1552.   #--------------------------------------------------------------------------
  1553.   # * New method: draw_actor_atb
  1554.   #--------------------------------------------------------------------------
  1555.   def draw_actor_atb(actor, x, y, width = 124)
  1556.     color1 = setup_atb_color1(actor)
  1557.     color2 = setup_atb_color2(actor)
  1558.     draw_gauge(x, y, width, actor.atb_rate, color1, color2)
  1559.     change_color(system_color)
  1560.     draw_text(x, y, 30, line_height, Vocab::VE_ATB_Name)
  1561.   end
  1562.   #--------------------------------------------------------------------------
  1563.   # * New method: setup_atb_color1
  1564.   #--------------------------------------------------------------------------
  1565.   def setup_atb_color1(actor)
  1566.     return text_color(2) if actor.cast_action?
  1567.     return text_color(6) if BattleManager.party_escaping?
  1568.     return text_color(5)
  1569.   end
  1570.   #--------------------------------------------------------------------------
  1571.   # * New method: setup_atb_color2
  1572.   #--------------------------------------------------------------------------
  1573.   def setup_atb_color2(actor)
  1574.     return text_color(10) if actor.cast_action?
  1575.     return text_color(14) if BattleManager.party_escaping?
  1576.     return text_color(13)
  1577.   end
  1578. end

  1579. #==============================================================================
  1580. # ** Scene_Battle
  1581. #------------------------------------------------------------------------------
  1582. #  This class performs battle screen processing.
  1583. #==============================================================================

  1584. class Scene_Battle < Scene_Base
  1585.   #--------------------------------------------------------------------------
  1586.   # * Public Instance Variables
  1587.   #--------------------------------------------------------------------------
  1588.   attr_reader   :log_window
  1589.   attr_reader   :item_window
  1590.   attr_reader   :skill_window
  1591.   #--------------------------------------------------------------------------
  1592.   # * Overwrite method: update_info_viewport
  1593.   #--------------------------------------------------------------------------
  1594.   def update_all_windows
  1595.     update_active_windows
  1596.     super
  1597.   end
  1598.   #--------------------------------------------------------------------------
  1599.   # * Overwrite method: update_info_viewport
  1600.   #--------------------------------------------------------------------------
  1601.   def update_info_viewport
  1602.     if VE_MOVE_STATUS_WINDOW
  1603.       @move_info_wait  = 4 if @moved_info != windows_active?
  1604.       @move_info_wait -= 1
  1605.       move_info_viewport(0) if @party_command_window.active
  1606.       move_info_viewport(right_status_window)  if right_info_viewport
  1607.       move_info_viewport(center_status_window) if center_info_viewport
  1608.       @moved_info = windows_active?
  1609.     else
  1610.       move_info_viewport(128)
  1611.     end
  1612.     update_close_command_window
  1613.   end
  1614.   #--------------------------------------------------------------------------
  1615.   # * Overwrite method: turn_start
  1616.   #--------------------------------------------------------------------------
  1617.   def turn_start
  1618.     BattleManager.add_actor(BattleManager.actor)
  1619.     @close_command_wait   = 2
  1620.     @close_command_window = true
  1621.     @status_window.unselect
  1622.     BattleManager.turn_start
  1623.   end
  1624.   #--------------------------------------------------------------------------
  1625.   # * Overwrite method: start_party_command_selection
  1626.   #--------------------------------------------------------------------------
  1627.   def start_party_command_selection
  1628.   end
  1629.   #--------------------------------------------------------------------------
  1630.   # * Overwrite method: turn_end
  1631.   #--------------------------------------------------------------------------
  1632.   def turn_end
  1633.   end
  1634.   #--------------------------------------------------------------------------
  1635.   # * Alias method: battle_start
  1636.   #--------------------------------------------------------------------------
  1637.   alias :battle_start_ve_active_time_battle :battle_start
  1638.   def battle_start
  1639.     battle_start_ve_active_time_battle
  1640.     battle_start_open_window
  1641.   end
  1642.   #--------------------------------------------------------------------------
  1643.   # * Alias method: create_all_windows
  1644.   #--------------------------------------------------------------------------
  1645.   alias :create_all_windows_ve_active_time_battle :create_all_windows
  1646.   def create_all_windows
  1647.     create_all_windows_ve_active_time_battle
  1648.     create_escape_window
  1649.     @close_command_wait = 0
  1650.     @move_info_wait     = 4
  1651.   end
  1652.   #--------------------------------------------------------------------------
  1653.   # * Alias method: reate_party_command_window
  1654.   #--------------------------------------------------------------------------
  1655.   alias :create_party_command_window_ve_active_time_battle :create_party_command_window
  1656.   def create_party_command_window
  1657.     create_party_command_window_ve_active_time_battle
  1658.     unless VE_MOVE_STATUS_WINDOW
  1659.       @party_command_window.x = @party_command_window.width
  1660.     end
  1661.     @info_viewport.ox = center_status_window
  1662.   end
  1663.   #--------------------------------------------------------------------------
  1664.   # * Alias method: create_actor_command_window
  1665.   #--------------------------------------------------------------------------
  1666.   alias :create_command_window_ve_active_time_battle :create_actor_command_window
  1667.   def create_actor_command_window
  1668.     create_command_window_ve_active_time_battle
  1669.     @actor_command_window.set_handler(:escape,  method(:command_escape))
  1670.     if !VE_MOVE_STATUS_WINDOW
  1671.       @actor_command_window.x = @actor_command_window.width
  1672.     elsif $data_system.opt_display_tp
  1673.       @actor_command_window.x = Graphics.width + 128
  1674.     end
  1675.   end
  1676.   #--------------------------------------------------------------------------
  1677.   # * Alias method: update
  1678.   #--------------------------------------------------------------------------
  1679.   alias :update_ve_active_time_battle :update
  1680.   def update
  1681.     result = update_ve_active_time_battle
  1682.     BattleManager.update_atb unless result
  1683.     result
  1684.   end
  1685.   #--------------------------------------------------------------------------
  1686.   # * Alias method: update_basic
  1687.   #--------------------------------------------------------------------------
  1688.   alias :update_basic_ve_active_time_battle :update_basic
  1689.   def update_basic
  1690.     update_basic_ve_active_time_battle
  1691.     update_escape_window if VE_ATB_ESCAPE_TYPE == :key
  1692.   end
  1693.   #--------------------------------------------------------------------------
  1694.   # * Alias method: update_for_wait
  1695.   #--------------------------------------------------------------------------
  1696.   alias :update_for_wait_ve_active_time_battle :update_for_wait
  1697.   def update_for_wait
  1698.     update_for_wait_ve_active_time_battle
  1699.     BattleManager.update_atb if BattleManager.in_turn? && !wait_action?
  1700.   end
  1701.   #--------------------------------------------------------------------------
  1702.   # * Alias method: wait_for_message
  1703.   #--------------------------------------------------------------------------
  1704.   alias :wait_for_message_ve_active_time_battle :wait_for_message
  1705.   def wait_for_message
  1706.     wait_for_message_ve_active_time_battle
  1707.     open_windows
  1708.   end
  1709.   #--------------------------------------------------------------------------
  1710.   # * Atualização da mensagem aberta
  1711.   #--------------------------------------------------------------------------
  1712.   alias :update_message_open_ve_active_time_battle :update_message_open
  1713.   def update_message_open
  1714.     close_windows
  1715.     update_message_open_ve_active_time_battle
  1716.   end
  1717.   #--------------------------------------------------------------------------
  1718.   # * Alias method: start_actor_command_selection
  1719.   #--------------------------------------------------------------------------
  1720.   alias :start_actor_command_selection_ve_active_time_battle :start_actor_command_selection
  1721.   def start_actor_command_selection
  1722.     start_actor_command_selection_ve_active_time_battle
  1723.     @close_command_window = false
  1724.   end
  1725.   #--------------------------------------------------------------------------
  1726.   # * Alias method: process_action_end
  1727.   #--------------------------------------------------------------------------
  1728.   alias :process_action_end_ve_active_time_battle :process_action_end
  1729.   def process_action_end
  1730.     return if $imported[:ve_animated_battle] && @subject.poses.active?
  1731.     BattleManager.increase_atb_turn_count(:battlers)
  1732.     BattleManager.increase_atb_turn_count(:actions)
  1733.     process_action_end_ve_active_time_battle
  1734.   end
  1735.   #--------------------------------------------------------------------------
  1736.   # * Alias method: command_fight
  1737.   #--------------------------------------------------------------------------
  1738.   alias :command_fight_end_ve_active_time_battle :command_fight
  1739.   def command_fight
  1740.     command_fight_end_ve_active_time_battle
  1741.     @party_command_window.close
  1742.     BattleManager.undo_escape
  1743.   end
  1744.   #--------------------------------------------------------------------------
  1745.   # * Alias method: command_escape
  1746.   #--------------------------------------------------------------------------
  1747.   alias :command_escape_end_ve_active_time_battle :command_escape
  1748.   def command_escape
  1749.     if VE_ATB_ESCAPE_TYPE == :command
  1750.       BattleManager.actor.atb = 0
  1751.       command_escape_end_ve_active_time_battle
  1752.       battle_start_open_window
  1753.     else
  1754.       @party_command_window.close
  1755.       BattleManager.setup_escape
  1756.     end
  1757.   end
  1758.   #--------------------------------------------------------------------------
  1759.   # * Alias method: prior_command
  1760.   #--------------------------------------------------------------------------
  1761.   alias :prior_command_ve_active_time_battle :prior_command
  1762.   def prior_command
  1763.     prior_command_ve_active_time_battle
  1764.     open_party_command_selection if !BattleManager.actor.prior_command
  1765.   end
  1766.   #--------------------------------------------------------------------------
  1767.   # * Alias method: on_enemy_ok
  1768.   #--------------------------------------------------------------------------
  1769.   alias :on_enemy_ok_ve_active_time_battle :on_enemy_ok
  1770.   def on_enemy_ok
  1771.     return if !@enemy_window.enemy
  1772.     on_enemy_ok_ve_active_time_battle
  1773.   end
  1774.   #--------------------------------------------------------------------------
  1775.   # * Alias method: refresh_status
  1776.   #--------------------------------------------------------------------------
  1777.   alias :refresh_status_ve_active_time_battle :refresh_status
  1778.   def refresh_status
  1779.     refresh_status_ve_active_time_battle
  1780.     @skill_window.refresh if @skill_window.active
  1781.     @item_window.refresh  if @item_window.active
  1782.   end
  1783.   #--------------------------------------------------------------------------
  1784.   # * New method: update_close_command_window
  1785.   #--------------------------------------------------------------------------
  1786.   def update_close_command_window
  1787.     @close_command_wait -= 1
  1788.     if @close_command_wait == 0 && @close_command_window
  1789.       @actor_command_window.close
  1790.       @close_command_window = false
  1791.     end
  1792.   end
  1793.   #--------------------------------------------------------------------------
  1794.   # * New method: update_active_windows
  1795.   #--------------------------------------------------------------------------
  1796.   def update_active_windows
  1797.     @enemy_window.hide if @enemy_window.active && @enemy_window.item_max == 0
  1798.     @actor_window.hide if @actor_window.active && @actor_window.item_max == 0
  1799.     close_command_windows
  1800.   end
  1801.   #--------------------------------------------------------------------------
  1802.   # * New method: close_command_windows
  1803.   #--------------------------------------------------------------------------
  1804.   def close_command_windows
  1805.     return if !BattleManager.actor || BattleManager.actor.inputable?
  1806.     on_enemy_cancel if @enemy_window.active
  1807.     on_actor_cancel if @actor_window.active
  1808.     on_skill_cancel if @skill_window.active
  1809.     on_item_cancel  if @item_window.active
  1810.     @actor_command_window.close.deactivate
  1811.     @skill_window.deactivate
  1812.     @item_window.deactivate
  1813.     @actor_window.deactivate
  1814.     @enemy_window.deactivate
  1815.     BattleManager.clear_actor
  1816.     next_command
  1817.   end
  1818.   #--------------------------------------------------------------------------
  1819.   # * New method: create_escape_window
  1820.   #--------------------------------------------------------------------------
  1821.   def create_escape_window
  1822.     @escape_window = Window_Help.new(1)
  1823.     @escape_window.openness = 0
  1824.   end
  1825.   #--------------------------------------------------------------------------
  1826.   # * New method: update_escape_window
  1827.   #--------------------------------------------------------------------------
  1828.   def update_escape_window
  1829.     escaping = BattleManager.escaping?
  1830.     open_escape_window   if  escaping && @escape_window.openness == 0
  1831.     @escape_window.close if !escaping && @escape_window.openness != 0
  1832.   end
  1833.   #--------------------------------------------------------------------------
  1834.   # * New method: open_escape_window
  1835.   #--------------------------------------------------------------------------
  1836.   def open_escape_window
  1837.     return if BattleManager.can_escape? && !VE_ATB_ESCAPE_TEXT
  1838.     txt = BattleManager.can_escape? ? Vocab::VE_Escaping : Vocab::VE_CantEscape
  1839.     @escape_window.set_text(txt)
  1840.     @escape_window.open
  1841.   end
  1842.   #--------------------------------------------------------------------------
  1843.   # * New method: on_turn_end
  1844.   #--------------------------------------------------------------------------
  1845.   def on_turn_end
  1846.   end
  1847.   #--------------------------------------------------------------------------
  1848.   # * New method: close_windows
  1849.   #--------------------------------------------------------------------------
  1850.   def close_windows
  1851.     if $game_message.busy? && !@status_window.close?
  1852.       command_windows.each {|window| window.hidden ||= window.open?  }
  1853.       @help_window.close
  1854.       @item_window.close
  1855.       @skill_window.close
  1856.       @actor_window.close
  1857.       @enemy_window.close
  1858.     end
  1859.   end
  1860.   #--------------------------------------------------------------------------
  1861.   # * New method: open_windows
  1862.   #--------------------------------------------------------------------------
  1863.   def open_windows
  1864.     command_windows.each do |window|
  1865.       window.open if window.hidden
  1866.       window.hidden = false
  1867.     end
  1868.   end
  1869.   #--------------------------------------------------------------------------
  1870.   # * New method: command_windows
  1871.   #--------------------------------------------------------------------------
  1872.   def command_windows
  1873.     [@party_command_window, @actor_command_window, @help_window, @skill_window,
  1874.      @item_window, @actor_window, @enemy_window, @status_window]
  1875.   end
  1876.   #--------------------------------------------------------------------------
  1877.   # * New method: battle_start_open_window
  1878.   #--------------------------------------------------------------------------
  1879.   def battle_start_open_window
  1880.     unless scene_changing?
  1881.       refresh_status
  1882.       @status_window.unselect
  1883.       @status_window.open
  1884.     end
  1885.   end
  1886.   #--------------------------------------------------------------------------
  1887.   # * New method: open_party_command_selection
  1888.   #--------------------------------------------------------------------------
  1889.   def open_party_command_selection
  1890.     return if scene_changing? || VE_ATB_ESCAPE_TYPE != :party
  1891.     BattleManager.delete_input(BattleManager.actor)
  1892.     refresh_status
  1893.     @status_window.unselect
  1894.     @status_window.open
  1895.     @actor_command_window.close.deactivate
  1896.     @party_command_window.setup
  1897.   end
  1898.   #--------------------------------------------------------------------------
  1899.   # * New method: wait_action?
  1900.   #--------------------------------------------------------------------------
  1901.   def wait_action?
  1902.     VE_ATB_WAIT_ACTION
  1903.   end
  1904.   #--------------------------------------------------------------------------
  1905.   # * New method: full_wait?
  1906.   #--------------------------------------------------------------------------
  1907.   def full_wait?
  1908.     $game_system.wait_mode == :full_wait && windows_active?(true)
  1909.   end
  1910.   #--------------------------------------------------------------------------
  1911.   # * New method: semi_wait?
  1912.   #--------------------------------------------------------------------------
  1913.   def semi_wait?
  1914.     $game_system.wait_mode == :semi_wait && windows_active?(false)
  1915.   end
  1916.   #--------------------------------------------------------------------------
  1917.   # * New method: party_window?
  1918.   #--------------------------------------------------------------------------
  1919.   def party_window?
  1920.     @party_command_window.active
  1921.   end
  1922.   #--------------------------------------------------------------------------
  1923.   # * New method: windows_active?
  1924.   #--------------------------------------------------------------------------
  1925.   def windows_active?(command = true)
  1926.     (command && @actor_command_window.active)   || @skill_window.active ||
  1927.     @item_window.active || @actor_window.active || @enemy_window.active
  1928.   end
  1929.   #--------------------------------------------------------------------------
  1930.   # * New method: turn_ending
  1931.   #--------------------------------------------------------------------------
  1932.   def turn_ending
  1933.     BattleManager.turn_end
  1934.     process_event
  1935.     BattleManager.turn_phase
  1936.   end
  1937.   #--------------------------------------------------------------------------
  1938.   # * New method: right_status_window
  1939.   #--------------------------------------------------------------------------
  1940.   def right_status_window
  1941.     256 - (Graphics.width - @status_window.width)
  1942.   end
  1943.   #--------------------------------------------------------------------------
  1944.   # * New method: center_status_window
  1945.   #--------------------------------------------------------------------------
  1946.   def center_status_window
  1947.     128 - (Graphics.width - @status_window.width) / 2
  1948.   end
  1949.   #--------------------------------------------------------------------------
  1950.   # * New method: right_info_viewport
  1951.   #--------------------------------------------------------------------------
  1952.   def right_info_viewport
  1953.     !@party_command_window.active && windows_active? && @move_info_wait < 0
  1954.   end
  1955.   #--------------------------------------------------------------------------
  1956.   # * New method: center_info_viewport
  1957.   #--------------------------------------------------------------------------
  1958.   def center_info_viewport
  1959.     !@party_command_window.active && !windows_active? && @move_info_wait < 0
  1960.   end
  1961. end
复制代码

QQ图片20160405153914.png (3.83 KB, 下载次数: 9)

QQ图片20160405153914.png

Lv3.寻梦者

梦石
0
星屑
1297
在线时间
995 小时
注册时间
2014-12-14
帖子
3016

开拓者

2
发表于 2016-4-18 00:14:30 | 只看该作者
可否给出进一步的信息,如:
1.脚本来源、使用说明
2.脚本发布时是否有范例
3.报错工程中是否有其它插件
其中1、2主要是找一个“可用的参考”,作为对照组;并找出可能的冲突或者设置上的失误


PS:
脚本可以使用“脚本框”框起来。这样可以使它在一定程度上被折叠,并且方便复制。不过会有一些bug,例如“@”后面通常会被论坛错误理解,导致自动增加一些字段,进而使脚本失效(或者其他未知bug),此类信息可参考论坛使用说明。因此使用一个可以“保存格式”的txt文本编辑软件是十分重要的,推荐notepad++与UltraEdit,或者GeminiRelease。对于脚本的入门,推荐使用这个教程:https://rpg.blue/thread-315743-1-1.html


点评

晕死...在下竟然还不造!~~  发表于 2016-4-29 12:45
@那个bug我早修了  发表于 2016-4-29 06:58
【RMVA教程】
---------------------
欲买桂花同载酒,终不似,少年游.
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-4-30 05:34

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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