Project1

标题: 【转载】[ace]国外战斗系统一只【见21楼】 [打印本页]

作者: 阿尔西斯的马甲    时间: 2012-1-25 10:35
标题: 【转载】[ace]国外战斗系统一只【见21楼】
本帖最后由 逍遥仙君 于 2012-2-4 20:59 编辑

来源:http://yamiworld.wordpress.com/
BUG!!:MP无法显示。
经过研究,没BUG。是因为主角没有消耗MP的技能,有MP没处用,所以不显示。
转载转载,听说要扣50分的,但是为了百姓,50分就50分吧
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Ace Battle Engine v1.18
  4. # -- Last Updated: 2012.01.24
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

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

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.24 - Compatibility Update: Enemy Levels
  15. # 2012.01.18 - Bug Fixed: Help Window clears text upon selecting nil items.
  16. # 2012.01.11 - Added <one animation> tag for multi-hit skills to play an
  17. #              animation only once.
  18. #            - Reduced lag from battle system constantly recreating bitmaps.
  19. # 2012.01.10 - Compatibility Update: Battle System FTB
  20. # 2012.01.09 - Anticrash methods implemented.
  21. #            - Damage Popups are now separate for damage formulas and recovery.
  22. # 2012.01.05 - Bug fixed: Game no longer crashes with escape skills/items.
  23. # 2012.01.02 - Compatibility Update: Target Manager
  24. #            - Added Option: AUTO_FAST
  25. #            - Random hits now show animations individually.
  26. # 2011.12.30 - Compatibility Update: Enemy Levels
  27. #            - Added Option to center the actors in the HUD.
  28. # 2011.12.27 - Bug fixed: TP Damage skills and items no longer crash game.
  29. #            - Default battle system bug fixes are now included from YEA's Ace
  30. #              Core Engine.
  31. #            - Groundwork is also made to support future battle system types.
  32. #            - Multi-hit actions no longer linger when a target dies during the
  33. #              middle of one of the hits.
  34. #            - Compatibility Update: Lunatic Objects v1.02
  35. # 2011.12.26 - Bug fixed: Multi-hit popups occured even after an enemy's dead.
  36. # 2011.12.22 - Bug fixed: Elemental Resistance popup didn't show.
  37. # 2011.12.20 - Bug fixed: Death state popups against immortal states.
  38. #            - Bug fixed: During State popup fix.
  39. #            - Added HIDE_POPUP_SWITCH.
  40. # 2011.12.17 - Compatibiilty Update: Cast Animations
  41. # 2011.12.15 - Compatibility Update: Battle Command List
  42. # 2011.12.14 - Compatibility Update: Lunatic Objects
  43. # 2011.12.13 - Compatibility Update: Command Party
  44. # 2011.12.12 - Bug fixed: Turn stalling if no inputable members.
  45. # 2011.12.10 - Compatibility update for Automatic Party HUD.
  46. #            - Popup graphical bug fixed.
  47. #            - Bug fixed: Didn't wait for boss dead animations.
  48. #            - Bug fixed: Surprise attacks that froze the game.
  49. #            - Bug fixed: Popups didn't show for straight recovery effects.
  50. # 2011.12.08 - Finished Script.
  51. # 2011.12.04 - Started Script.
  52. #
  53. #==============================================================================
  54. # ▼ Introduction
  55. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  56. # Ace Battle Engine works as a foundation for future battle engine add-ons. It
  57. # allows for easier management of the battle engine without adding too many
  58. # features, allowing users to customize what they want as they see fit. While
  59. # the Ace Battle Engine isn't an entirely new engine, it gives users control
  60. # that RPG Maker VX Ace didn't originally give them.
  61. #
  62. # Furthermore, this script provides some new features. They are as follows:
  63. #
  64. # -----------------------------------------------------------------------------
  65. # Animation Fixes
  66. # -----------------------------------------------------------------------------
  67. # Though the Yanfly Engine Ace - Ace Core Engine script contains these fixes,
  68. # these fixes are included in this script as well to ensure it's working for
  69. # the battle script in the event someone chooses not to work with the Ace Core
  70. # Engine script. The animation fixes prevent excessive animation overlaying
  71. # (and making the screen look really ugly) and prevents animation clashing
  72. # between two dual wielding normal attack animations.
  73. #
  74. # -----------------------------------------------------------------------------
  75. # Enemy Animations
  76. # -----------------------------------------------------------------------------
  77. # Enemies now show battle animations when they deliver attacks and skills
  78. # against the player's party. Before in RPG Maker VX Ace, it was nothing more
  79. # than just sound effects and the screen shaking. Now, animations play where
  80. # the status window is and relative to the position of each party member.
  81. #
  82. # -----------------------------------------------------------------------------
  83. # Left/Right Command Selection
  84. # -----------------------------------------------------------------------------
  85. # While choosing actions, the player can press Left or Right to move freely
  86. # between (alive) actors to change their skills. Players no longer have to
  87. # cancel all the way back to change one person's skill and reselect everything.
  88. # On that note, there is now the option that when a battle starts or at the
  89. # end of a turn, players will start immediately at command selection rather
  90. # than needing to select "Fight" in the Party Command Window.
  91. #
  92. # -----------------------------------------------------------------------------
  93. # Popups
  94. # -----------------------------------------------------------------------------
  95. # Dealing damage, inflicting states, adding buffs, landing critical hits,
  96. # striking weaknesses, missing attacks, you name it, there's probably a popup
  97. # for it. Popups deliver information to the player in a quick or orderly
  98. # fashion without requiring the player to read lines of text.
  99. #
  100. # -----------------------------------------------------------------------------
  101. # Targeting Window
  102. # -----------------------------------------------------------------------------
  103. # When targeting enemies, the window is no longer displayed. Instead, the
  104. # targeted enemies are highlighted and their names are shown at the top of the
  105. # screen in a help window. Another thing that's changed is when skills that
  106. # target multiple targets are selected, there is a confirmation step that the
  107. # player must take before continuing. In this confirmation step, all of the
  108. # multiple targets are selected and in the help window would display the scope
  109. # of the skill (such as "All Foes" or "Random Foes"). RPG Maker VX Ace skipped
  110. # this step by default.
  111. #
  112. # -----------------------------------------------------------------------------
  113. # Toggling On and Off Special Effects and Text
  114. # -----------------------------------------------------------------------------
  115. # Not everybody likes having the screen shake or the enemies blink when they
  116. # take damage. These effects can now be toggled on and off. Certain text can
  117. # also be toggled on and off from appearing. A lot of the displayed text has
  118. # been rendered redundant through the use of popups.
  119. #
  120. # -----------------------------------------------------------------------------
  121. # Visual Battle Status Window
  122. # -----------------------------------------------------------------------------
  123. # Rather than just having rows of names with HP and MP bars next to them, the
  124. # Battle Status Window now displays actors' faces and their gauges aligned at
  125. # the bottom. More status effects can be shown in addition to showing more
  126. # members on screen at once. The Battle Status Window is also optimized to
  127. # refresh less (thus, removing potential lag from the system).
  128. #
  129. # -----------------------------------------------------------------------------
  130. # Window Position Changes
  131. # -----------------------------------------------------------------------------
  132. # Windows such as the Skill Window and Item Window have been rearranged to
  133. # always provide the player a clear view of the battlefield rather than opening
  134. # up and covering everything. As such, the window positions are placed at the
  135. # bottom of the screen and are repositioned.
  136. #
  137. #==============================================================================
  138. # ▼ Instructions
  139. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  140. # To install this script, open up your script editor and copy/paste this script
  141. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  142. #
  143. # -----------------------------------------------------------------------------
  144. # Skill Notetags - These notetags go in the skills notebox in the database.
  145. # -----------------------------------------------------------------------------
  146. # <one animation>
  147. # Causes the action to display the action animation only once, even if it's a
  148. # multi-hit action. This is used primarily for non-all scope targeting.
  149. #
  150. # -----------------------------------------------------------------------------
  151. # Item Notetags - These notetags go in the items notebox in the database.
  152. # -----------------------------------------------------------------------------
  153. # <one animation>
  154. # Causes the action to display the action animation only once, even if it's a
  155. # multi-hit action. This is used primarily for non-all scope targeting.
  156. #
  157. # -----------------------------------------------------------------------------
  158. # Enemy Notetags - These notetags go in the enemy notebox in the database.
  159. # -----------------------------------------------------------------------------
  160. # <atk ani 1: x>
  161. # <atk ani 2: x>
  162. # Changes the normal attack animation of the particular enemy to animation x.
  163. # Attack animation 1 is the first one that plays. If there's a second animation
  164. # then the second one will play after in mirrored form.
  165. #
  166. # -----------------------------------------------------------------------------
  167. # State Notetags - These notetags go in the state notebox in the database.
  168. # -----------------------------------------------------------------------------
  169. # <popup add: string>
  170. # <popup rem: string>
  171. # <popup dur: string>
  172. # Status effects now create popups whenever they're inflicted. However, if you
  173. # don't like that a certain status effect uses a particular colour setting,
  174. # change "string" to one of the rulesets below to cause that popup to use a
  175. # different ruleset.
  176. #
  177. # <popup hide add>
  178. # <popup hide rem>
  179. # <popup hide dur>
  180. # Not everybody wants status effects to show popups when inflicted. When this
  181. # is the case, insert the respective tag to hide popups from appearing when the
  182. # state is added, removed, or during the stand-by phases.
  183. #
  184. # -----------------------------------------------------------------------------
  185. # Debug Tools - These tools only work during Test Play.
  186. # -----------------------------------------------------------------------------
  187. # - F5 Key -
  188. # Recovers all actors. Restores their HP and MP to max. Does not affect TP.
  189. # All states and buffs are removed whether they are positive or negative.
  190. #
  191. # - F6 Key -
  192. # Sets all actors to have 1 HP, 0 MP, and 0 TP. States are unaffected.
  193. #
  194. # - F7 Key -
  195. # Sets all actors to have max TP. Everything else is unaffected.
  196. #
  197. # - F8 Key -
  198. # Kills all enemies in battle. Ends the battle quickly.
  199. #
  200. #==============================================================================
  201. # ▼ Compatibility
  202. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  203. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  204. # it will run with RPG Maker VX without adjusting.
  205. #
  206. #==============================================================================

  207. module YEA
  208.   module BATTLE
  209.    
  210.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  211.     # - General Battle Settings -
  212.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  213.     # These settings are adjusted for the overall battle system. These are
  214.     # various miscellaneous options to adjust. Each of the settings below will
  215.     # explain what they do. Change default enemy battle animations here, too.
  216.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  217.     BLINK_EFFECTS      = false  # Blink sprite when damaged?
  218.     FLASH_WHITE_EFFECT = true   # Flash enemy white when it starts an attack.
  219.     SCREEN_SHAKE       = false  # Shake screen in battle?
  220.     SKIP_PARTY_COMMAND = true   # Skips the Fight/Escape menu.
  221.     AUTO_FAST          = true   # Causes message windows to not wait.
  222.     ENEMY_ATK_ANI      = 36     # Sets default attack animation for enemies.
  223.    
  224.     # If this switch is ON, popups will be hidden. If OFF, the popups will be
  225.     # shown. If you do not wish to use this switch, set it to 0.
  226.     HIDE_POPUP_SWITCH  = 0
  227.    
  228.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  229.     # - Battle Status Window -
  230.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  231.     # This sets the default battle system your game will use. If your game
  232.     # doesn't have any other battle systems installed, it will use :dtb.
  233.     #
  234.     # Battle System        Requirement
  235.     #   :dtb               - Default Turn Battle. Default system.
  236.     #   :ftb               - YEA Battle System Add-On: Free Turn Battle
  237.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  238.     DEFAULT_BATTLE_SYSTEM = :dtb     # Default battle system set.
  239.    
  240.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  241.     # - Battle Status Window -
  242.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  243.     # Here, you can adjust the settings for the battle status window. The
  244.     # battle status window, by default, will show the actor's face, HP, MP, TP
  245.     # (if viable), and any inflicted status effects.
  246.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  247.     BATTLESTATUS_NAME_FONT_SIZE = 20    # Font size used for name.
  248.     BATTLESTATUS_TEXT_FONT_SIZE = 16    # Font size used for HP, MP, TP.
  249.     BATTLESTATUS_NO_ACTION_ICON = 185   # No action icon.
  250.     BATTLESTATUS_HPGAUGE_Y_PLUS = 11    # Y Location buffer used for HP gauge.
  251.     BATTLESTATUS_CENTER_FACES   = false # Center faces for the Battle Status.
  252.    
  253.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  254.     # - Help Window Text -
  255.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  256.     # When selecting a target to attack, this is the text that will be shown
  257.     # in place of a target's name for special cases. These special cases are
  258.     # for selections that were originally non-targetable battle scopes.
  259.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  260.     HELP_TEXT_ALL_FOES        = "All Foes"
  261.     HELP_TEXT_ONE_RANDOM_FOE  = "One Random Foe"
  262.     HELP_TEXT_MANY_RANDOM_FOE = "%d Random Foes"
  263.     HELP_TEXT_ALL_ALLIES      = "All Allies"
  264.     HELP_TEXT_ALL_DEAD_ALLIES = "All Dead Allies"
  265.     HELP_TEXT_ONE_RANDOM_ALLY = "One Random Ally"
  266.     HELP_TEXT_RANDOM_ALLIES   = "%d Random Allies"
  267.    
  268.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  269.     # - Popup Settings -
  270.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  271.     # These settings will adjust the popups that appear in battle. Popups
  272.     # deliver information to your player as battlers deal damage, inflict
  273.     # status effects, and more.
  274.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  275.     ENABLE_POPUPS  = true     # Set this to false if you wish to disable them.
  276.     FLASH_CRITICAL = true     # Sets critical hits to flash.
  277.    
  278.     # This hash adjusts the popup settings that will govern how popups appear.
  279.     # Adjust them accordingly.
  280.     POPUP_SETTINGS ={
  281.       :offset     => -24,         # Height offset of a popup.
  282.       :fade       => 12,          # Fade rate for each popup.
  283.       :full       => 60,          # Frames before a popup fades.
  284.       :hp_dmg     => "-%s ",      # SprintF for HP damage.
  285.       :hp_heal    => "+%s ",      # SprintF for HP healing.
  286.       :mp_dmg     => "-%s MP",    # SprintF for MP damage.
  287.       :mp_heal    => "+%s MP",    # SprintF for MP healing.
  288.       :tp_dmg     => "-%s TP",    # SprintF for MP damage.
  289.       :tp_heal    => "+%s TP",    # SprintF for MP healing.
  290.       :drained    => "DRAIN",     # Text display for draining HP/MP.
  291.       :critical   => "CRITICAL!", # Text display for critical hit.
  292.       :missed     => "MISS",      # Text display for missed attack.
  293.       :evaded     => "EVADE!",    # Text display for evaded attack.
  294.       :nulled     => "NULL",      # Text display for nulled attack.
  295.       :failed     => "FAILED",    # Text display for a failed attack.
  296.       :add_state  => "+%s",      # SprintF for added states.
  297.       :rem_state  => "-%s",      # SprintF for removed states.
  298.       :dur_state  => "%s",        # SprintF for during states.
  299.       :ele_rates  => true,        # This will display elemental affinities.
  300.       :ele_wait   => 20,          # This is how many frames will wait.
  301.       :weakpoint  => "WEAKPOINT", # Appears if foe is weak to element.
  302.       :resistant  => "RESIST",    # Appears if foe is resistant to element.
  303.       :immune     => "IMMUNE",    # Appears if foe is immune to element.
  304.       :absorbed   => "ABSORB",    # Appears if foe can absorb the element.
  305.       :add_buff   => "%s+",      # Appears when a positive buff is applied.
  306.       :add_debuff => "%s-",      # Appears when a negative buff is applied.
  307.     } # Do not remove this.
  308.    
  309.     # This is the default font used for the popups. Adjust them accordingly
  310.     # or even add new ones.
  311.     DEFAULT = ["VL Gothic", "Verdana", "Arial", "Courier"]
  312.    
  313.     # The following are the various rules that govern the individual popup
  314.     # types that will appear. Adjust them accordingly. Here is a list of what
  315.     # each category does.
  316.     #   Zoom1    The zoom the popup starts at. Values over 2.0 may cause lag.
  317.     #   Zoom2    The zoom the popup goes to. Values over 2.0 may cause lag.
  318.     #   Sz       The font size used for the popup text.
  319.     #   Bold     Applying bold for the popup text.
  320.     #   Italic   Applying italic for the popup text.
  321.     #   Red      The red value of the popup text.
  322.     #   Grn      The green value of the popup text.
  323.     #   Blu      The blue value of the popup text.
  324.     #   Font     The font used for the popup text.
  325.     POPUP_RULES ={
  326.       # Type     => [ Zoom1, Zoom2, Sz, Bold, Italic, Red, Grn, Blu, Font]
  327.       "DEFAULT"  => [   2.0,   1.0, 24, true,  false, 255, 255, 255, DEFAULT],
  328.       "CRITICAL" => [   2.0,   1.0, 24, true,  false, 255,  80,  80, DEFAULT],
  329.       "HP_DMG"   => [   2.0,   1.0, 36, true,  false, 255, 255, 255, DEFAULT],
  330.       "HP_HEAL"  => [   2.0,   1.0, 36, true,  false, 130, 250, 130, DEFAULT],
  331.       "MP_DMG"   => [   2.0,   1.0, 36, true,  false, 220, 180, 255, DEFAULT],
  332.       "MP_HEAL"  => [   2.0,   1.0, 36, true,  false, 160, 230, 255, DEFAULT],
  333.       "TP_DMG"   => [   2.0,   1.0, 36, true,  false, 242, 108,  78, DEFAULT],
  334.       "TP_HEAL"  => [   2.0,   1.0, 36, true,  false, 251, 175,  92, DEFAULT],
  335.       "ADDSTATE" => [   2.0,   1.0, 24, true,  false, 240, 100, 100, DEFAULT],
  336.       "REMSTATE" => [   2.0,   1.0, 24, true,  false, 125, 170, 225, DEFAULT],
  337.       "DURSTATE" => [   2.0,   1.0, 24, true,  false, 255, 240, 150, DEFAULT],
  338.       "DRAIN"    => [   2.0,   1.0, 36, true,  false, 250, 190, 255, DEFAULT],
  339.       "POSITIVE" => [   2.0,   1.0, 24, true,  false, 110, 210, 245, DEFAULT],
  340.       "NEGATIVE" => [   2.0,   1.0, 24, true,  false, 245, 155, 195, DEFAULT],
  341.       "WEAK_ELE" => [   0.5,   1.0, 24, true,  false, 240, 110,  80, DEFAULT],
  342.       "IMMU_ELE" => [   0.5,   1.0, 24, true,  false, 185, 235, 255, DEFAULT],
  343.       "REST_ELE" => [   0.5,   1.0, 24, true,  false, 145, 230, 180, DEFAULT],
  344.       "ABSB_ELE" => [   0.5,   1.0, 24, true,  false, 250, 190, 255, DEFAULT],
  345.       "BUFF"     => [   2.0,   1.0, 24, true,  false, 255, 240, 100, DEFAULT],
  346.       "DEBUFF"   => [   2.0,   1.0, 24, true,  false, 160, 130, 200, DEFAULT],
  347.     } # Do not remove this.
  348.    
  349.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  350.     # - Streamlined Messages -
  351.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  352.     # Want to remove some of those annoying messages that appear all the time?
  353.     # Now you can! Select which messages you want to enable or disable. Some of
  354.     # these messages will be rendered useless due to popups.
  355.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  356.     MSG_ENEMY_APPEARS  = false  # Message when enemy appears start of battle.
  357.     MSG_CURRENT_STATE  = false  # Show which states has affected battler.
  358.     MSG_CURRENT_ACTION = true   # Show the current action of the battler.
  359.     MSG_COUNTERATTACK  = true   # Show the message for a counterattack.
  360.     MSG_REFLECT_MAGIC  = true   # Show message for reflecting magic attacks.
  361.     MSG_SUBSTITUTE_HIT = true   # Show message for ally taking another's hit.
  362.     MSG_FAILURE_HIT    = false  # Show effect failed against target.
  363.     MSG_CRITICAL_HIT   = false  # Show attack was a critical hit.
  364.     MSG_HIT_MISSED     = false  # Show attack missed the target.
  365.     MSG_EVASION        = false  # Show attack was evaded by the target.
  366.     MSG_HP_DAMAGE      = false  # Show HP damage to target.
  367.     MSG_MP_DAMAGE      = false  # Show MP damage to target.
  368.     MSG_TP_DAMAGE      = false  # Show TP damage to target.
  369.     MSG_ADDED_STATES   = false  # Show target's added states.
  370.     MSG_REMOVED_STATES = false  # Show target's removed states.
  371.     MSG_CHANGED_BUFFS  = false  # Show target's changed buffs.
  372.    
  373.   end # BATTLE
  374. end # YEA

  375. #==============================================================================
  376. # ▼ Editting anything past this point may potentially result in causing
  377. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  378. # halitosis so edit at your own risk.
  379. #==============================================================================

  380. module YEA
  381.   module REGEXP
  382.   module ENEMY
  383.    
  384.     ATK_ANI1 = /<(?:ATK_ANI_1|atk ani 1):[ ]*(\d+)>/i
  385.     ATK_ANI2 = /<(?:ATK_ANI_2|atk ani 2):[ ]*(\d+)>/i
  386.    
  387.   end # ENEMY
  388.   module USABLEITEM
  389.    
  390.     ONE_ANIMATION = /<(?:ONE_ANIMATION|one animation)>/i
  391.    
  392.   end # USABLEITEM
  393.   module STATE
  394.    
  395.     POPUP_ADD = /<(?:POPUP_ADD_RULE|popup add rule|popup add):[ ](.*)>/i
  396.     POPUP_REM = /<(?:POPUP_REM_RULE|popup rem rule|popup rem):[ ](.*)>/i
  397.     POPUP_DUR = /<(?:POPUP_DUR_RULE|popup dur rule|popup dur):[ ](.*)>/i
  398.    
  399.     HIDE_ADD  = /<(?:POPUP_HIDE_ADD|popup hide add|hide add)>/i
  400.     HIDE_REM  = /<(?:POPUP_HIDE_REM|popup hide rem|hide rem)>/i
  401.     HIDE_DUR  = /<(?:POPUP_HIDE_DUR|popup hide dur|hide dur)>/i
  402.    
  403.   end # STATE
  404.   end # REGEXP
  405. end # YEA

  406. #==============================================================================
  407. # ■ Switch
  408. #==============================================================================

  409. module Switch
  410.   
  411.   #--------------------------------------------------------------------------
  412.   # self.hide_popups
  413.   #--------------------------------------------------------------------------
  414.   def self.hide_popups
  415.     return false if YEA::BATTLE::HIDE_POPUP_SWITCH <= 0
  416.     return $game_switches[YEA::BATTLE::HIDE_POPUP_SWITCH]
  417.   end
  418.   
  419. end # Switch

  420. #==============================================================================
  421. # ■ Colour
  422. #==============================================================================

  423. module Colour
  424.   
  425.   #--------------------------------------------------------------------------
  426.   # self.text_colour
  427.   #--------------------------------------------------------------------------
  428.   def self.text_colour(index)
  429.     windowskin = Cache.system("Window")
  430.     x = 64 + (index % 8) * 8
  431.     y = 96 + (index / 8) * 8
  432.     return windowskin.get_pixel(x, y)
  433.   end
  434.   
  435. end # Colour

  436. #==============================================================================
  437. # ■ Icon
  438. #==============================================================================

  439. module Icon
  440.   
  441.   #--------------------------------------------------------------------------
  442.   # self.no_action
  443.   #--------------------------------------------------------------------------
  444.   def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
  445.    
  446. end # Icon

  447. #==============================================================================
  448. # ■ Numeric
  449. #==============================================================================

  450. class Numeric
  451.   
  452.   #--------------------------------------------------------------------------
  453.   # new method: group_digits
  454.   #--------------------------------------------------------------------------
  455.   unless $imported["YEA-CoreEngine"]
  456.   def group; return self.to_s; end
  457.   end # $imported["YEA-CoreEngine"]
  458.    
  459. end # Numeric

  460. #==============================================================================
  461. # ■ DataManager
  462. #==============================================================================

  463. module DataManager
  464.   
  465.   #--------------------------------------------------------------------------
  466.   # alias method: load_database
  467.   #--------------------------------------------------------------------------
  468.   class <<self; alias load_database_abe load_database; end
  469.   def self.load_database
  470.     load_database_abe
  471.     load_notetags_abe
  472.   end
  473.   
  474.   #--------------------------------------------------------------------------
  475.   # new method: load_notetags_abe
  476.   #--------------------------------------------------------------------------
  477.   def self.load_notetags_abe
  478.     groups = [$data_enemies, $data_states, $data_skills, $data_items]
  479.     for group in groups
  480.       for obj in group
  481.         next if obj.nil?
  482.         obj.load_notetags_abe
  483.       end
  484.     end
  485.   end
  486.   
  487. end # DataManager

  488. #==============================================================================
  489. # ■ RPG::UsableItem
  490. #==============================================================================

  491. class RPG::UsableItem < RPG::BaseItem
  492.   
  493.   #--------------------------------------------------------------------------
  494.   # public instance variables
  495.   #--------------------------------------------------------------------------
  496.   attr_accessor :one_animation
  497.   
  498.   #--------------------------------------------------------------------------
  499.   # common cache: load_notetags_abe
  500.   #--------------------------------------------------------------------------
  501.   def load_notetags_abe
  502.     @one_animation = false
  503.     #---
  504.     self.note.split(/[\r\n]+/).each { |line|
  505.       case line
  506.       #---
  507.       when YEA::REGEXP::USABLEITEM::ONE_ANIMATION
  508.         @one_animation = true
  509.       end
  510.     } # self.note.split
  511.     #---
  512.   end
  513.   
  514. end # RPG::UsableItem

  515. #==============================================================================
  516. # ■ RPG::Enemy
  517. #==============================================================================

  518. class RPG::Enemy < RPG::BaseItem
  519.   
  520.   #--------------------------------------------------------------------------
  521.   # public instance variables
  522.   #--------------------------------------------------------------------------
  523.   attr_accessor :atk_animation_id1
  524.   attr_accessor :atk_animation_id2
  525.   
  526.   #--------------------------------------------------------------------------
  527.   # common cache: load_notetags_abe
  528.   #--------------------------------------------------------------------------
  529.   def load_notetags_abe
  530.     @atk_animation_id1 = YEA::BATTLE::ENEMY_ATK_ANI
  531.     @atk_animation_id2 = 0
  532.     #---
  533.     self.note.split(/[\r\n]+/).each { |line|
  534.       case line
  535.       #---
  536.       when YEA::REGEXP::ENEMY::ATK_ANI1
  537.         @atk_animation_id1 = $1.to_i
  538.       when YEA::REGEXP::ENEMY::ATK_ANI2
  539.         @atk_animation_id2 = $1.to_i
  540.       end
  541.     } # self.note.split
  542.     #---
  543.   end
  544.   
  545. end # RPG::Enemy

  546. #==============================================================================
  547. # ■ RPG::Enemy
  548. #==============================================================================

  549. class RPG::State < RPG::BaseItem
  550.   
  551.   #--------------------------------------------------------------------------
  552.   # public instance variables
  553.   #--------------------------------------------------------------------------
  554.   attr_accessor :popup_rules
  555.   
  556.   #--------------------------------------------------------------------------
  557.   # common cache: load_notetags_abe
  558.   #--------------------------------------------------------------------------
  559.   def load_notetags_abe
  560.     @popup_rules = {
  561.       :add_state => "ADDSTATE",
  562.       :rem_state => "REMSTATE",
  563.       :dur_state => nil
  564.     } # Do not remove this.
  565.     #---
  566.     self.note.split(/[\r\n]+/).each { |line|
  567.       case line
  568.       #---
  569.       when YEA::REGEXP::STATE::POPUP_ADD
  570.         @popup_rules[:add_state] = $1.upcase.to_s
  571.       when YEA::REGEXP::STATE::POPUP_REM
  572.         @popup_rules[:rem_state] = $1.upcase.to_s
  573.       when YEA::REGEXP::STATE::POPUP_DUR
  574.         @popup_rules[:dur_state] = $1.upcase.to_s
  575.       when YEA::REGEXP::STATE::HIDE_ADD
  576.         @popup_rules[:add_state] = nil
  577.       when YEA::REGEXP::STATE::HIDE_REM
  578.         @popup_rules[:rem_state] = nil
  579.       when YEA::REGEXP::STATE::HIDE_DUR
  580.         @popup_rules[:dur_state] = nil
  581.       end
  582.     } # self.note.split
  583.     #---
  584.   end
  585.   
  586. end # RPG::State

  587. #==============================================================================
  588. # ■ BattleManager
  589. #==============================================================================

  590. module BattleManager
  591.   
  592.   #--------------------------------------------------------------------------
  593.   # overwrite method: self.battle_start
  594.   #--------------------------------------------------------------------------
  595.   def self.battle_start
  596.     $game_system.battle_count += 1
  597.     $game_party.on_battle_start
  598.     $game_troop.on_battle_start
  599.     return unless YEA::BATTLE::MSG_ENEMY_APPEARS
  600.     $game_troop.enemy_names.each do |name|
  601.       $game_message.add(sprintf(Vocab::Emerge, name))
  602.     end
  603.     if @preemptive
  604.       $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
  605.     elsif @surprise
  606.       $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
  607.     end
  608.     wait_for_message
  609.   end
  610.   
  611.   #--------------------------------------------------------------------------
  612.   # overwrite method: make_action_orders
  613.   #--------------------------------------------------------------------------
  614.   def self.make_action_orders
  615.     make_dtb_action_orders if btype?(:dtb)
  616.   end
  617.   
  618.   #--------------------------------------------------------------------------
  619.   # new method: make_dtb_action_orders
  620.   #--------------------------------------------------------------------------
  621.   def self.make_dtb_action_orders
  622.     @action_battlers = []
  623.     @action_battlers += $game_party.members unless @surprise
  624.     @action_battlers += $game_troop.members unless @preemptive
  625.     @action_battlers.each {|battler| battler.make_speed }
  626.     @action_battlers.sort! {|a,b| b.speed - a.speed }
  627.   end
  628.   
  629.   #--------------------------------------------------------------------------
  630.   # overwrite method: turn_start
  631.   #--------------------------------------------------------------------------
  632.   def self.turn_start
  633.     @phase = :turn
  634.     clear_actor
  635.     $game_troop.increase_turn
  636.     @performed_battlers = []
  637.     make_action_orders
  638.   end
  639.   
  640.   #--------------------------------------------------------------------------
  641.   # overwrite method: next_subject
  642.   #--------------------------------------------------------------------------
  643.   def self.next_subject
  644.     @performed_battlers = [] if @performed_battlers.nil?
  645.     loop do
  646.       @action_battlers -= @performed_battlers
  647.       battler = @action_battlers.shift
  648.       return nil unless battler
  649.       next unless battler.index && battler.alive?
  650.       @performed_battlers.push(battler)
  651.       return battler
  652.     end
  653.   end
  654.   
  655.   #--------------------------------------------------------------------------
  656.   # overwrite method: force_action
  657.   #--------------------------------------------------------------------------
  658.   def self.force_action(battler)
  659.     @action_forced = [] if @action_forced == nil
  660.     @action_forced.push(battler)
  661.     return unless Switch.forced_action_remove
  662.     @action_battlers.delete(battler)
  663.   end
  664.   
  665.   #--------------------------------------------------------------------------
  666.   # overwrite method: action_forced?
  667.   #--------------------------------------------------------------------------
  668.   def self.action_forced?
  669.     @action_forced != nil
  670.   end
  671.   
  672.   #--------------------------------------------------------------------------
  673.   # overwrite method: action_forced_battler
  674.   #--------------------------------------------------------------------------
  675.   def self.action_forced_battler
  676.     @action_forced.shift
  677.   end
  678.   
  679.   #--------------------------------------------------------------------------
  680.   # overwrite method: clear_action_force
  681.   #--------------------------------------------------------------------------
  682.   def self.clear_action_force
  683.     @action_forced = nil if @action_forced.empty?
  684.   end
  685.   
  686.   #--------------------------------------------------------------------------
  687.   # new method: self.init_battle_type
  688.   #--------------------------------------------------------------------------
  689.   def self.init_battle_type
  690.     set_btype($game_system.battle_system)
  691.   end
  692.   
  693.   #--------------------------------------------------------------------------
  694.   # new method: self.set_btype
  695.   #--------------------------------------------------------------------------
  696.   def self.set_btype(btype = :dtb)
  697.     @battle_type = btype
  698.   end
  699.   
  700.   #--------------------------------------------------------------------------
  701.   # new method: self.btype?
  702.   #--------------------------------------------------------------------------
  703.   def self.btype?(btype)
  704.     return @battle_type == btype
  705.   end
  706.   
  707. end # BattleManager

  708. #==============================================================================
  709. # ■ Game_System
  710. #==============================================================================

  711. class Game_System
  712.   
  713.   #--------------------------------------------------------------------------
  714.   # new method: battle_system
  715.   #--------------------------------------------------------------------------
  716.   def battle_system
  717.     if @battle_system.nil?
  718.       return battle_system_corrected(YEA::BATTLE::DEFAULT_BATTLE_SYSTEM)
  719.     else
  720.       return battle_system_corrected(@battle_system)
  721.     end
  722.   end
  723.   
  724.   #--------------------------------------------------------------------------
  725.   # new method: set_battle_system
  726.   #--------------------------------------------------------------------------
  727.   def set_battle_system(type)
  728.     case type
  729.     when :dtb; @battle_system = :dtb
  730.     when :ftb; @battle_system = $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  731.     else;      @battle_system = :dtb
  732.     end
  733.   end
  734.   
  735.   #--------------------------------------------------------------------------
  736.   # new method: battle_system_corrected
  737.   #--------------------------------------------------------------------------
  738.   def battle_system_corrected(type)
  739.     case type
  740.     when :dtb; return :dtb
  741.     when :ftb; return $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  742.     else;      return :dtb
  743.     end
  744.   end
  745.   
  746. end # Game_System

  747. #==============================================================================
  748. # ■ Sprite_Base
  749. #==============================================================================

  750. class Sprite_Base < Sprite
  751.   
  752.   #--------------------------------------------------------------------------
  753.   # new method: start_pseudo_animation
  754.   #--------------------------------------------------------------------------
  755.   unless $imported["YEA-CoreEngine"]
  756.   def start_pseudo_animation(animation, mirror = false)
  757.     dispose_animation
  758.     @animation = animation
  759.     return if @animation.nil?
  760.     @ani_mirror = mirror
  761.     set_animation_rate
  762.     @ani_duration = @animation.frame_max * @ani_rate + 1
  763.     @ani_sprites = []
  764.   end
  765.   end # $imported["YEA-CoreEngine"]
  766.   
  767. end # Sprite_Base

  768. #==============================================================================
  769. # ■ Sprite_Battler
  770. #==============================================================================

  771. class Sprite_Battler < Sprite_Base
  772.   
  773.   #--------------------------------------------------------------------------
  774.   # public instance variables
  775.   #--------------------------------------------------------------------------
  776.   attr_accessor :effect_type
  777.   attr_accessor :battler_visible
  778.   attr_accessor :popups
  779.   
  780.   #--------------------------------------------------------------------------
  781.   # alias method: initialize
  782.   #--------------------------------------------------------------------------
  783.   alias sprite_battler_initialize_abe initialize
  784.   def initialize(viewport, battler = nil)
  785.     sprite_battler_initialize_abe(viewport, battler)
  786.     @popups = []
  787.     @popup_flags = []
  788.   end
  789.   
  790.   #--------------------------------------------------------------------------
  791.   # alias method: update_bitmap
  792.   #--------------------------------------------------------------------------
  793.   alias sprite_battler_update_bitmap_abe update_bitmap
  794.   def update_bitmap
  795.     return if @battler.actor? && @battler.battler_name == ""
  796.     sprite_battler_update_bitmap_abe
  797.   end
  798.   
  799.   #--------------------------------------------------------------------------
  800.   # alias method: setup_new_animation
  801.   #--------------------------------------------------------------------------
  802.   unless $imported["YEA-CoreEngine"]
  803.   alias sprite_battler_setup_new_animation_abe setup_new_animation
  804.   def setup_new_animation
  805.     sprite_battler_setup_new_animation_abe
  806.     return if @battler.pseudo_ani_id <= 0
  807.     animation = $data_animations[@battler.pseudo_ani_id]
  808.     mirror = @battler.animation_mirror
  809.     start_pseudo_animation(animation, mirror)
  810.     @battler.pseudo_ani_id = 0
  811.   end
  812.   end # $imported["YEA-CoreEngine"]
  813.   
  814.   #--------------------------------------------------------------------------
  815.   # alias method: setup_new_effect
  816.   #--------------------------------------------------------------------------
  817.   alias sprite_battler_setup_new_effect_abe setup_new_effect
  818.   def setup_new_effect
  819.     sprite_battler_setup_new_effect_abe
  820.     setup_popups
  821.   end
  822.   
  823.   #--------------------------------------------------------------------------
  824.   # new method: setup_popups
  825.   #--------------------------------------------------------------------------
  826.   def setup_popups
  827.     return unless @battler.use_sprite?
  828.     @battler.popups = [] if @battler.popups.nil?
  829.     return if @battler.popups == []
  830.     array = @battler.popups.shift
  831.     create_new_popup(array[0], array[1], array[2])
  832.   end
  833.   
  834.   #--------------------------------------------------------------------------
  835.   # new method: create_new_popup
  836.   #--------------------------------------------------------------------------
  837.   def create_new_popup(value, rules, flags)
  838.     return if @battler == nil
  839.     return if flags & @popup_flags != []
  840.     array = YEA::BATTLE::POPUP_RULES[rules]
  841.     for popup in @popups
  842.       popup.y -= 24
  843.     end
  844.     return unless SceneManager.scene.is_a?(Scene_Battle)
  845.     return if SceneManager.scene.spriteset.nil?
  846.     view = SceneManager.scene.spriteset.viewportPopups
  847.     new_popup = Sprite_Popup.new(view, @battler, value, rules, flags)
  848.     @popups.push(new_popup)
  849.     @popup_flags.push("weakness") if flags.include?("weakness")
  850.     @popup_flags.push("resistant") if flags.include?("resistant")
  851.     @popup_flags.push("immune") if flags.include?("immune")
  852.     @popup_flags.push("absorbed") if flags.include?("absorbed")
  853.   end
  854.   
  855.   #--------------------------------------------------------------------------
  856.   # alias method: update_effect
  857.   #--------------------------------------------------------------------------
  858.   alias sprite_battler_update_effect_abe update_effect
  859.   def update_effect
  860.     sprite_battler_update_effect_abe
  861.     update_popups
  862.   end
  863.   
  864.   #--------------------------------------------------------------------------
  865.   # new method: update_popups
  866.   #--------------------------------------------------------------------------
  867.   def update_popups
  868.     for popup in @popups
  869.       popup.update
  870.       next unless popup.opacity <= 0
  871.       popup.bitmap.dispose
  872.       popup.dispose
  873.       @popups.delete(popup)
  874.       popup = nil
  875.     end
  876.     @popup_flags = [] if @popups == [] && @popup_flags != []
  877.     return unless SceneManager.scene_is?(Scene_Battle)
  878.     if @current_active_battler != SceneManager.scene.subject
  879.       @current_active_battler = SceneManager.scene.subject
  880.       @popup_flags = []
  881.     end
  882.   end
  883.   
  884. end # Sprite_Battler

  885. #==============================================================================
  886. # ■ Sprite_Popup
  887. #==============================================================================

  888. class Sprite_Popup < Sprite_Base
  889.   
  890.   #--------------------------------------------------------------------------
  891.   # public instance variables
  892.   #--------------------------------------------------------------------------
  893.   attr_accessor :flags
  894.   
  895.   #--------------------------------------------------------------------------
  896.   # initialize
  897.   #--------------------------------------------------------------------------
  898.   def initialize(viewport, battler, value, rules, flags)
  899.     super(viewport)
  900.     @value = value
  901.     @rules = rules
  902.     @rules = "DEFAULT" unless YEA::BATTLE::POPUP_RULES.include?(@rules)
  903.     @fade = YEA::BATTLE::POPUP_SETTINGS[:fade]
  904.     @full = YEA::BATTLE::POPUP_SETTINGS[:full]
  905.     @flags = flags
  906.     @battler = battler
  907.     create_popup_bitmap
  908.   end
  909.   
  910.   #--------------------------------------------------------------------------
  911.   # create_popup_bitmap
  912.   #--------------------------------------------------------------------------
  913.   def create_popup_bitmap
  914.     rules_array = YEA::BATTLE::POPUP_RULES[@rules]
  915.     bw = Graphics.width
  916.     bw += 48 if @flags.include?("state")
  917.     bh = Font.default_size * 3
  918.     bitmap = Bitmap.new(bw, bh)
  919.     bitmap.font.name = rules_array[8]
  920.     size = @flags.include?("critical") ? rules_array[2] * 1.2 : rules_array[2]
  921.     bitmap.font.size = size
  922.     bitmap.font.bold = rules_array[3]
  923.     bitmap.font.italic = rules_array[4]
  924.     if flags.include?("critical")
  925.       crit = YEA::BATTLE::POPUP_RULES["CRITICAL"]
  926.       bitmap.font.out_color.set(crit[5], crit[6], crit[7], 255)
  927.     else
  928.       bitmap.font.out_color.set(0, 0, 0, 255)
  929.     end
  930.     dx = 0; dy = 0; dw = 0
  931.     dx += 24 if @flags.include?("state")
  932.     dw += 24 if @flags.include?("state")
  933.     if @flags.include?("state") || @flags.include?("buff")
  934.       c_width = bitmap.text_size(@value).width
  935.       icon_bitmap = $game_temp.iconset
  936.       icon_index = flag_state_icon
  937.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  938.       bitmap.blt(dx+(bw-c_width)/2-36, (bh - 24)/2, icon_bitmap, rect, 255)
  939.     end
  940.     bitmap.font.color.set(rules_array[5], rules_array[6], rules_array[7])
  941.     bitmap.draw_text(dx, dy, bw-dw, bh, @value, 1)
  942.     self.bitmap = bitmap
  943.     self.x = @battler.screen_x
  944.     self.x += rand(4) - rand(4) if @battler.sprite.popups.size >= 1
  945.     self.x -= SceneManager.scene.spriteset.viewport1.ox
  946.     self.y = @battler.screen_y - @battler.sprite.oy/2
  947.     self.y -= @battler.sprite.oy/2 if @battler.actor?
  948.     self.y -= SceneManager.scene.spriteset.viewport1.oy
  949.     self.ox = bw/2; self.oy = bh/2
  950.     self.zoom_x = self.zoom_y = rules_array[0]
  951.     if @flags.include?("no zoom")
  952.       self.zoom_x = self.zoom_y = rules_array[1]
  953.     end
  954.     @target_zoom = rules_array[1]
  955.     @zoom_direction = (self.zoom_x > @target_zoom) ? "down" : "up"
  956.     self.z = 500
  957.   end
  958.   
  959.   #--------------------------------------------------------------------------
  960.   # update
  961.   #--------------------------------------------------------------------------
  962.   def update
  963.     super
  964.     #---
  965.     if @flags.include?("critical") && YEA::BATTLE::FLASH_CRITICAL
  966.       @hue_duration = 2 if @hue_duration == nil || @hue_duration == 0
  967.       @hue_duration -= 1
  968.       self.bitmap.hue_change(15) if @hue_duration <= 0
  969.     end
  970.     #---
  971.     if @zoom_direction == "up"
  972.       self.zoom_x = [self.zoom_x + 0.075, @target_zoom].min
  973.       self.zoom_y = [self.zoom_y + 0.075, @target_zoom].min
  974.     else
  975.       self.zoom_x = [self.zoom_x - 0.075, @target_zoom].max
  976.       self.zoom_y = [self.zoom_y - 0.075, @target_zoom].max
  977.     end
  978.     #---
  979.     @full -= 1
  980.     return if @full > 0
  981.     self.y -= 1
  982.     self.opacity -= @fade
  983.   end
  984.   
  985.   #--------------------------------------------------------------------------
  986.   # flag_state_icon
  987.   #--------------------------------------------------------------------------
  988.   def flag_state_icon
  989.     for item in @flags; return item if item.is_a?(Integer); end
  990.     return 0
  991.   end
  992.   
  993. end # Sprite_Popup

  994. #==============================================================================
  995. # ■ Spriteset_Battle
  996. #==============================================================================

  997. class Spriteset_Battle
  998.   
  999.   #--------------------------------------------------------------------------
  1000.   # public instance variables
  1001.   #--------------------------------------------------------------------------
  1002.   attr_accessor :actor_sprites
  1003.   attr_accessor :enemy_sprites
  1004.   attr_accessor :viewport1
  1005.   attr_accessor :viewportPopups
  1006.   
  1007.   #--------------------------------------------------------------------------
  1008.   # alias method: create_viewports
  1009.   #--------------------------------------------------------------------------
  1010.   alias spriteset_battle_create_viewports_abe create_viewports
  1011.   def create_viewports
  1012.     spriteset_battle_create_viewports_abe
  1013.     @viewportPopups = Viewport.new
  1014.     @viewportPopups.z = 200
  1015.   end
  1016.   
  1017.   #--------------------------------------------------------------------------
  1018.   # alias method: dispose_viewports
  1019.   #--------------------------------------------------------------------------
  1020.   alias spriteset_battle_dispose_viewports_abe dispose_viewports
  1021.   def dispose_viewports
  1022.     spriteset_battle_dispose_viewports_abe
  1023.     @viewportPopups.dispose
  1024.   end
  1025.   
  1026.   #--------------------------------------------------------------------------
  1027.   # alias method: update_viewports
  1028.   #--------------------------------------------------------------------------
  1029.   alias spriteset_battle_update_viewports_abe update_viewports
  1030.   def update_viewports
  1031.     spriteset_battle_update_viewports_abe
  1032.     @viewportPopups.update
  1033.   end
  1034.   
  1035. end # Spriteset_Battle

  1036. #==============================================================================
  1037. # ■ Game_Temp
  1038. #==============================================================================

  1039. class Game_Temp
  1040.   
  1041.   #--------------------------------------------------------------------------
  1042.   # public instance variables
  1043.   #--------------------------------------------------------------------------
  1044.   attr_accessor :battle_aid
  1045.   attr_accessor :evaluating
  1046.   attr_accessor :iconset
  1047.   
  1048.   #--------------------------------------------------------------------------
  1049.   # alias method: initialize
  1050.   #--------------------------------------------------------------------------
  1051.   alias game_temp_initialize_abe initialize
  1052.   def initialize
  1053.     game_temp_initialize_abe
  1054.     @iconset = Cache.system("Iconset")
  1055.   end
  1056.   
  1057. end # Game_Temp

  1058. #==============================================================================
  1059. # ■ Game_Action
  1060. #==============================================================================

  1061. class Game_Action
  1062.   
  1063.   #--------------------------------------------------------------------------
  1064.   # overwrite method: speed
  1065.   #--------------------------------------------------------------------------
  1066.   def speed
  1067.     speed = subject.agi
  1068.     speed += item.speed if item
  1069.     speed += subject.atk_speed if attack?
  1070.     return speed
  1071.   end
  1072.   
  1073.   #--------------------------------------------------------------------------
  1074.   # alias method: evaluate_item_with_target
  1075.   #--------------------------------------------------------------------------
  1076.   alias evaluate_item_with_target_abe evaluate_item_with_target
  1077.   def evaluate_item_with_target(target)
  1078.     $game_temp.evaluating = true
  1079.     result = evaluate_item_with_target_abe(target)
  1080.     $game_temp.evaluating = false
  1081.     return result
  1082.   end
  1083.   
  1084. end # Game_Action

  1085. #==============================================================================
  1086. # ■ Game_ActionResult
  1087. #==============================================================================

  1088. class Game_ActionResult
  1089.   
  1090.   #--------------------------------------------------------------------------
  1091.   # alias method: clear
  1092.   #--------------------------------------------------------------------------
  1093.   alias game_actionresult_clear_abe clear
  1094.   def clear
  1095.     game_actionresult_clear_abe
  1096.     clear_stored_damage
  1097.   end
  1098.   
  1099.   #--------------------------------------------------------------------------
  1100.   # new method: clear_stored_damage
  1101.   #--------------------------------------------------------------------------
  1102.   def clear_stored_damage
  1103.     @stored_hp_damage = 0
  1104.     @stored_mp_damage = 0
  1105.     @stored_tp_damage = 0
  1106.     @stored_hp_drain = 0
  1107.     @stored_mp_drain = 0
  1108.   end
  1109.   
  1110.   #--------------------------------------------------------------------------
  1111.   # new method: store_damage
  1112.   #--------------------------------------------------------------------------
  1113.   def store_damage
  1114.     @stored_hp_damage += @hp_damage
  1115.     @stored_mp_damage += @mp_damage
  1116.     @stored_tp_damage += @tp_damage
  1117.     @stored_hp_drain += @hp_drain
  1118.     @stored_mp_drain += @mp_drain
  1119.   end
  1120.   
  1121.   #--------------------------------------------------------------------------
  1122.   # new method: restore_damage
  1123.   #--------------------------------------------------------------------------
  1124.   def restore_damage
  1125.     @hp_damage = @stored_hp_damage
  1126.     @mp_damage = @stored_mp_damage
  1127.     @tp_damage = @stored_tp_damage
  1128.     @hp_drain = @stored_hp_drain
  1129.     @mp_drain = @stored_mp_drain
  1130.   end
  1131.   
  1132. end # Game_ActionResult

  1133. #==============================================================================
  1134. # ■ Game_BattlerBase
  1135. #==============================================================================

  1136. class Game_BattlerBase
  1137.   
  1138.   #--------------------------------------------------------------------------
  1139.   # public instance variables
  1140.   #--------------------------------------------------------------------------
  1141.   attr_accessor :popups
  1142.   
  1143.   #--------------------------------------------------------------------------
  1144.   # new method: create_popup
  1145.   #--------------------------------------------------------------------------
  1146.   def create_popup(value, rules = "DEFAULT", flags = [])
  1147.     return unless SceneManager.scene_is?(Scene_Battle)
  1148.     return unless YEA::BATTLE::ENABLE_POPUPS
  1149.     return if Switch.hide_popups
  1150.     @popups = [] if @popups.nil?
  1151.     @popups.push([value, rules, flags])
  1152.   end
  1153.   
  1154.   #--------------------------------------------------------------------------
  1155.   # new method: make_damage_popups
  1156.   #--------------------------------------------------------------------------
  1157.   def make_damage_popups(user)
  1158.     if @result.hp_drain != 0
  1159.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  1160.       rules = "DRAIN"
  1161.       user.create_popup(text, rules)
  1162.       setting = :hp_dmg  if @result.hp_drain < 0
  1163.       setting = :hp_heal if @result.hp_drain > 0
  1164.       rules = "HP_DMG"   if @result.hp_drain < 0
  1165.       rules = "HP_HEAL"  if @result.hp_drain > 0
  1166.       value = @result.hp_drain.abs
  1167.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1168.       user.create_popup(text, rules)
  1169.     end
  1170.     if @result.mp_drain != 0
  1171.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  1172.       rules = "DRAIN"
  1173.       user.create_popup(text, rules)
  1174.       setting = :mp_dmg  if @result.mp_drain < 0
  1175.       setting = :mp_heal if @result.mp_drain > 0
  1176.       rules = "HP_DMG"   if @result.mp_drain < 0
  1177.       rules = "HP_HEAL"  if @result.mp_drain > 0
  1178.       value = @result.mp_drain.abs
  1179.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1180.       user.create_popup(text, rules)
  1181.     end
  1182.     #---
  1183.     flags = []
  1184.     flags.push("critical") if @result.critical
  1185.     if @result.hp_damage != 0
  1186.       setting = :hp_dmg  if @result.hp_damage > 0
  1187.       setting = :hp_heal if @result.hp_damage < 0
  1188.       rules = "HP_DMG"   if @result.hp_damage > 0
  1189.       rules = "HP_HEAL"  if @result.hp_damage < 0
  1190.       value = @result.hp_damage.abs
  1191.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1192.       create_popup(text, rules, flags)
  1193.     end
  1194.     if @result.mp_damage != 0
  1195.       setting = :mp_dmg  if @result.mp_damage > 0
  1196.       setting = :mp_heal if @result.mp_damage < 0
  1197.       rules = "MP_DMG"   if @result.mp_damage > 0
  1198.       rules = "MP_HEAL"  if @result.mp_damage < 0
  1199.       value = @result.mp_damage.abs
  1200.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1201.       create_popup(text, rules, flags)
  1202.     end
  1203.     if @result.tp_damage != 0
  1204.       setting = :tp_dmg  if @result.tp_damage > 0
  1205.       setting = :tp_heal if @result.tp_damage < 0
  1206.       rules = "TP_DMG"   if @result.tp_damage > 0
  1207.       rules = "TP_HEAL"  if @result.tp_damage < 0
  1208.       value = @result.tp_damage.abs
  1209.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1210.       create_popup(text, rules)
  1211.     end
  1212.     @result.store_damage
  1213.     @result.clear_damage_values
  1214.   end
  1215.   
  1216.   #--------------------------------------------------------------------------
  1217.   # alias method: erase_state
  1218.   #--------------------------------------------------------------------------
  1219.   alias game_battlerbase_erase_state_abe erase_state
  1220.   def erase_state(state_id)
  1221.     make_state_popup(state_id, :rem_state) if @states.include?(state_id)
  1222.     game_battlerbase_erase_state_abe(state_id)
  1223.   end
  1224.   
  1225.   #--------------------------------------------------------------------------
  1226.   # new method: make_during_state_popup
  1227.   #--------------------------------------------------------------------------
  1228.   def make_during_state_popup
  1229.     state_id = most_important_state_id
  1230.     return if state_id == 0
  1231.     make_state_popup(state_id, :dur_state)
  1232.   end
  1233.   
  1234.   #--------------------------------------------------------------------------
  1235.   # new method: most_important_state_id
  1236.   #--------------------------------------------------------------------------
  1237.   def most_important_state_id
  1238.     states.each {|state| return state.id unless state.message3.empty? }
  1239.     return 0
  1240.   end
  1241.   
  1242.   #--------------------------------------------------------------------------
  1243.   # new method: make_state_popup
  1244.   #--------------------------------------------------------------------------
  1245.   def make_state_popup(state_id, type)
  1246.     state = $data_states[state_id]
  1247.     return if state.icon_index == 0
  1248.     rules = state.popup_rules[type]
  1249.     return if rules.nil?
  1250.     text = sprintf(YEA::BATTLE::POPUP_SETTINGS[type], state.name)
  1251.     flags = ["state", state.icon_index]
  1252.     create_popup(text, rules, flags)
  1253.   end
  1254.   
  1255.   #--------------------------------------------------------------------------
  1256.   # new method: make_miss_popups
  1257.   #--------------------------------------------------------------------------
  1258.   def make_miss_popups(user, item)
  1259.     return if dead?
  1260.     if @result.missed
  1261.       text = YEA::BATTLE::POPUP_SETTINGS[:missed]
  1262.       rules = "DEFAULT"
  1263.       create_popup(text, rules)
  1264.     end
  1265.     if @result.evaded
  1266.       text = YEA::BATTLE::POPUP_SETTINGS[:evaded]
  1267.       rules = "DEFAULT"
  1268.       create_popup(text, rules)
  1269.     end
  1270.     if @result.hit? && [email protected]
  1271.       text = YEA::BATTLE::POPUP_SETTINGS[:failed]
  1272.       rules = "DEFAULT"
  1273.       create_popup(text, rules)
  1274.     end
  1275.     if @result.hit? && item.damage.to_hp?
  1276.       if @result.hp_damage == 0 && @result.hp_damage == 0
  1277.         text = YEA::BATTLE::POPUP_SETTINGS[:nulled]
  1278.         rules = "DEFAULT"
  1279.         create_popup(text, rules)
  1280.       end
  1281.     end
  1282.   end
  1283.   
  1284.   #--------------------------------------------------------------------------
  1285.   # new method: make_rate_popup
  1286.   #--------------------------------------------------------------------------
  1287.   def make_rate_popup(rate)
  1288.     return if rate == 1.0
  1289.     flags = []
  1290.     if rate > 1.0
  1291.       text = YEA::BATTLE::POPUP_SETTINGS[:weakpoint]
  1292.       rules = "WEAK_ELE"
  1293.       flags.push("weakness")
  1294.     elsif rate == 0.0
  1295.       text = YEA::BATTLE::POPUP_SETTINGS[:immune]
  1296.       rules = "IMMU_ELE"
  1297.       flags.push("immune")
  1298.     elsif rate < 0.0
  1299.       text = YEA::BATTLE::POPUP_SETTINGS[:absorbed]
  1300.       rules = "ABSB_ELE"
  1301.       flags.push("absorbed")
  1302.     else
  1303.       text = YEA::BATTLE::POPUP_SETTINGS[:resistant]
  1304.       rules = "REST_ELE"
  1305.       flags.push("resistant")
  1306.     end
  1307.     create_popup(text, rules, flags)
  1308.   end
  1309.   
  1310.   #--------------------------------------------------------------------------
  1311.   # new method: make_buff_popup
  1312.   #--------------------------------------------------------------------------
  1313.   def make_buff_popup(param_id, positive = true)
  1314.     return unless alive?
  1315.     name = Vocab::param(param_id)
  1316.     if positive
  1317.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_buff], name)
  1318.       rules = "BUFF"
  1319.       buff_level = 1
  1320.     else
  1321.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_debuff], name)
  1322.       rules = "DEBUFF"
  1323.       buff_level = -1
  1324.     end
  1325.     icon = buff_icon_index(buff_level, param_id)
  1326.     flags = ["buff", icon]
  1327.     create_popup(text, rules, flags)
  1328.   end
  1329.   
  1330. end # Game_BattlerBase

  1331. #==============================================================================
  1332. # ■ Game_Battler
  1333. #==============================================================================

  1334. class Game_Battler < Game_BattlerBase
  1335.   
  1336.   #--------------------------------------------------------------------------
  1337.   # public instance variables
  1338.   #--------------------------------------------------------------------------
  1339.   attr_accessor :pseudo_ani_id
  1340.   
  1341.   #--------------------------------------------------------------------------
  1342.   # alias method: on_battle_end
  1343.   #--------------------------------------------------------------------------
  1344.   alias game_battler_on_battle_end_abe on_battle_end
  1345.   def on_battle_end
  1346.     game_battler_on_battle_end_abe
  1347.     @popups = []
  1348.   end
  1349.   
  1350.   #--------------------------------------------------------------------------
  1351.   # alias method: clear_sprite_effects
  1352.   #--------------------------------------------------------------------------
  1353.   alias game_battler_clear_sprite_effects_abe clear_sprite_effects
  1354.   def clear_sprite_effects
  1355.     game_battler_clear_sprite_effects_abe
  1356.     @pseudo_ani_id = 0
  1357.   end
  1358.   
  1359.   #--------------------------------------------------------------------------
  1360.   # alias method: item_apply
  1361.   #--------------------------------------------------------------------------
  1362.   alias game_battler_item_apply_abe item_apply
  1363.   def item_apply(user, item)
  1364.     game_battler_item_apply_abe(user, item)
  1365.     make_miss_popups(user, item)
  1366.   end
  1367.   
  1368.   #--------------------------------------------------------------------------
  1369.   # alias method: make_damage_value
  1370.   #--------------------------------------------------------------------------
  1371.   alias game_battler_make_damage_value_abe make_damage_value
  1372.   def make_damage_value(user, item)
  1373.     game_battler_make_damage_value_abe(user, item)
  1374.     rate = item_element_rate(user, item)
  1375.     make_rate_popup(rate) unless $game_temp.evaluating
  1376.   end
  1377.   
  1378.   #--------------------------------------------------------------------------
  1379.   # alias method: execute_damage
  1380.   #--------------------------------------------------------------------------
  1381.   alias game_battler_execute_damage_abe execute_damage
  1382.   def execute_damage(user)
  1383.     game_battler_execute_damage_abe(user)
  1384.     make_damage_popups(user)
  1385.   end
  1386.   
  1387.   #--------------------------------------------------------------------------
  1388.   # alias method: item_effect_recover_hp
  1389.   #--------------------------------------------------------------------------
  1390.   alias game_battler_item_effect_recover_hp_abe item_effect_recover_hp
  1391.   def item_effect_recover_hp(user, item, effect)
  1392.     game_battler_item_effect_recover_hp_abe(user, item, effect)
  1393.     make_damage_popups(user)
  1394.   end
  1395.   
  1396.   #--------------------------------------------------------------------------
  1397.   # alias method: item_effect_recover_mp
  1398.   #--------------------------------------------------------------------------
  1399.   alias game_battler_item_effect_recover_mp_abe item_effect_recover_mp
  1400.   def item_effect_recover_mp(user, item, effect)
  1401.     game_battler_item_effect_recover_mp_abe(user, item, effect)
  1402.     make_damage_popups(user)
  1403.   end
  1404.   
  1405.   #--------------------------------------------------------------------------
  1406.   # alias method: item_effect_gain_tp
  1407.   #--------------------------------------------------------------------------
  1408.   alias game_battler_item_effect_gain_tp_abe item_effect_gain_tp
  1409.   def item_effect_gain_tp(user, item, effect)
  1410.     game_battler_item_effect_gain_tp_abe(user, item, effect)
  1411.     make_damage_popups(user)
  1412.   end
  1413.   
  1414.   #--------------------------------------------------------------------------
  1415.   # alias method: item_user_effect
  1416.   #--------------------------------------------------------------------------
  1417.   alias game_battler_item_user_effect_abe item_user_effect
  1418.   def item_user_effect(user, item)
  1419.     game_battler_item_user_effect_abe(user, item)
  1420.     @result.restore_damage
  1421.   end
  1422.   
  1423.   #--------------------------------------------------------------------------
  1424.   # alias method: add_new_state
  1425.   #--------------------------------------------------------------------------
  1426.   alias game_battler_add_new_state_abe add_new_state
  1427.   def add_new_state(state_id)
  1428.     game_battler_add_new_state_abe(state_id)
  1429.     make_state_popup(state_id, :add_state) if @states.include?(state_id)
  1430.   end
  1431.   
  1432.   #--------------------------------------------------------------------------
  1433.   # alias method: add_buff
  1434.   #--------------------------------------------------------------------------
  1435.   alias game_battler_add_buff_abe add_buff
  1436.   def add_buff(param_id, turns)
  1437.     make_buff_popup(param_id, true)
  1438.     game_battler_add_buff_abe(param_id, turns)
  1439.   end
  1440.   
  1441.   #--------------------------------------------------------------------------
  1442.   # alias method: add_debuff
  1443.   #--------------------------------------------------------------------------
  1444.   alias game_battler_add_debuff_abe add_debuff
  1445.   def add_debuff(param_id, turns)
  1446.     make_buff_popup(param_id, false)
  1447.     game_battler_add_debuff_abe(param_id, turns)
  1448.   end
  1449.   
  1450.   #--------------------------------------------------------------------------
  1451.   # alias method: regenerate_all
  1452.   #--------------------------------------------------------------------------
  1453.   alias game_battler_regenerate_all_abe regenerate_all
  1454.   def regenerate_all
  1455.     game_battler_regenerate_all_abe
  1456.     return unless alive?
  1457.     make_damage_popups(self)
  1458.   end
  1459.   
  1460.   #--------------------------------------------------------------------------
  1461.   # new method: can_collapse?
  1462.   #--------------------------------------------------------------------------
  1463.   def can_collapse?
  1464.     return false unless dead?
  1465.     unless actor?
  1466.       return false unless sprite.battler_visible
  1467.       array = [:collapse, :boss_collapse, :instant_collapse]
  1468.       return false if array.include?(sprite.effect_type)
  1469.     end
  1470.     return true
  1471.   end
  1472.   
  1473.   #--------------------------------------------------------------------------
  1474.   # new method: draw_mp?
  1475.   #--------------------------------------------------------------------------
  1476.   def draw_mp?; return true; end
  1477.   
  1478.   #--------------------------------------------------------------------------
  1479.   # new method: draw_tp?
  1480.   #--------------------------------------------------------------------------
  1481.   def draw_tp?
  1482.     return $data_system.opt_display_tp
  1483.   end
  1484.   
  1485. end # Game_Battler

  1486. #==============================================================================
  1487. # ■ Game_Actor
  1488. #==============================================================================

  1489. class Game_Actor < Game_Battler
  1490.   
  1491.   #def battler_name
  1492.     #return "Slime"
  1493.   #end
  1494.   
  1495.   #def battler_hue
  1496.     #return 0
  1497.   #end
  1498.   
  1499.   #--------------------------------------------------------------------------
  1500.   # overwrite method: perform_damage_effect
  1501.   #--------------------------------------------------------------------------
  1502.   def perform_damage_effect
  1503.     $game_troop.screen.start_shake(5, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
  1504.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1505.     Sound.play_actor_damage
  1506.   end
  1507.   
  1508.   #--------------------------------------------------------------------------
  1509.   # overwrite method: use_sprite?
  1510.   #--------------------------------------------------------------------------
  1511.   def use_sprite?; return true; end
  1512.    
  1513.   #--------------------------------------------------------------------------
  1514.   # new method: screen_x
  1515.   #--------------------------------------------------------------------------
  1516.   def screen_x
  1517.     return 0 unless SceneManager.scene_is?(Scene_Battle)
  1518.     status_window = SceneManager.scene.status_window
  1519.     return 0 if status_window.nil?
  1520.     item_rect_width = (status_window.width-24) / $game_party.max_battle_members
  1521.     ext = SceneManager.scene.info_viewport.ox
  1522.     rect = SceneManager.scene.status_window.item_rect(self.index)
  1523.     constant = 128 + 12
  1524.     return constant + rect.x + item_rect_width / 2 - ext
  1525.   end
  1526.   
  1527.   #--------------------------------------------------------------------------
  1528.   # new method: screen_y
  1529.   #--------------------------------------------------------------------------
  1530.   def screen_y
  1531.     return Graphics.height - 120 unless SceneManager.scene_is?(Scene_Battle)
  1532.     return Graphics.height - 120 if SceneManager.scene.status_window.nil?
  1533.     return Graphics.height - (SceneManager.scene.status_window.height * 7/8)
  1534.   end
  1535.   
  1536.   #--------------------------------------------------------------------------
  1537.   # new method: screen_z
  1538.   #--------------------------------------------------------------------------
  1539.   def screen_z; return 100; end
  1540.   
  1541.   #--------------------------------------------------------------------------
  1542.   # new method: sprite
  1543.   #--------------------------------------------------------------------------
  1544.   def sprite
  1545.     index = $game_party.battle_members.index(self)
  1546.     return SceneManager.scene.spriteset.actor_sprites[index]
  1547.   end
  1548.   
  1549.   #--------------------------------------------------------------------------
  1550.   # new method: draw_mp?
  1551.   #--------------------------------------------------------------------------
  1552.   def draw_mp?
  1553.     return true unless draw_tp?
  1554.     for skill in skills
  1555.       next unless added_skill_types.include?(skill.stype_id)
  1556.       return true if skill.mp_cost > 0
  1557.     end
  1558.     return false
  1559.   end
  1560.   
  1561.   #--------------------------------------------------------------------------
  1562.   # new method: draw_tp?
  1563.   #--------------------------------------------------------------------------
  1564.   def draw_tp?
  1565.     return false unless $data_system.opt_display_tp
  1566.     for skill in skills
  1567.       next unless added_skill_types.include?(skill.stype_id)
  1568.       return true if skill.tp_cost > 0
  1569.     end
  1570.     return false
  1571.   end
  1572.   
  1573. end # Game_Actor

  1574. #==============================================================================
  1575. # ■ Game_Enemy
  1576. #==============================================================================

  1577. class Game_Enemy < Game_Battler
  1578.   
  1579.   #--------------------------------------------------------------------------
  1580.   # overwrite method: perform_damage_effect
  1581.   #--------------------------------------------------------------------------
  1582.   def perform_damage_effect
  1583.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1584.     Sound.play_enemy_damage
  1585.   end
  1586.   
  1587.   #--------------------------------------------------------------------------
  1588.   # new methods: attack_animation_id
  1589.   #--------------------------------------------------------------------------
  1590.   def atk_animation_id1; return enemy.atk_animation_id1; end
  1591.   def atk_animation_id2; return enemy.atk_animation_id2; end
  1592.   
  1593.   #--------------------------------------------------------------------------
  1594.   # new method: sprite
  1595.   #--------------------------------------------------------------------------
  1596.   def sprite
  1597.     return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
  1598.   end
  1599.   
  1600. end # Game_Enemy

  1601. #==============================================================================
  1602. # ■ Game_Unit
  1603. #==============================================================================

  1604. class Game_Unit
  1605.   
  1606.   #--------------------------------------------------------------------------
  1607.   # alias method: make_actions
  1608.   #--------------------------------------------------------------------------
  1609.   alias game_unit_make_actions_abe make_actions
  1610.   def make_actions
  1611.     game_unit_make_actions_abe
  1612.     refresh_autobattler_status_window
  1613.   end
  1614.   
  1615.   #--------------------------------------------------------------------------
  1616.   # new method: refresh_autobattler_status_window
  1617.   #--------------------------------------------------------------------------
  1618.   def refresh_autobattler_status_window
  1619.     return unless SceneManager.scene_is?(Scene_Battle)
  1620.     return unless self.is_a?(Game_Party)
  1621.     SceneManager.scene.refresh_autobattler_status_window
  1622.   end
  1623.   
  1624. end # Game_Unit

  1625. #==============================================================================
  1626. # ■ Window_PartyCommand
  1627. #==============================================================================

  1628. class Window_PartyCommand < Window_Command
  1629.   
  1630.   #--------------------------------------------------------------------------
  1631.   # overwrite method: process_handling
  1632.   #--------------------------------------------------------------------------
  1633.   def process_handling
  1634.     return unless open? && active
  1635.     return process_dir6 if Input.repeat?(:RIGHT)
  1636.     return super
  1637.   end
  1638.   
  1639.   #--------------------------------------------------------------------------
  1640.   # new method: process_dir6
  1641.   #--------------------------------------------------------------------------
  1642.   def process_dir6
  1643.     Sound.play_cursor
  1644.     Input.update
  1645.     deactivate
  1646.     call_handler(:dir6)
  1647.   end
  1648.   
  1649. end # Window_PartyCommand

  1650. #==============================================================================
  1651. # ■ Window_ActorCommand
  1652. #==============================================================================

  1653. class Window_ActorCommand < Window_Command
  1654.   
  1655.   #--------------------------------------------------------------------------
  1656.   # overwrite method: process_handling
  1657.   #--------------------------------------------------------------------------
  1658.   def process_handling
  1659.     return unless open? && active
  1660.     return process_dir4 if Input.repeat?(:LEFT)
  1661.     return process_dir6 if Input.repeat?(:RIGHT)
  1662.     return super
  1663.   end
  1664.   
  1665.   #--------------------------------------------------------------------------
  1666.   # new method: process_dir4
  1667.   #--------------------------------------------------------------------------
  1668.   def process_dir4
  1669.     Sound.play_cursor
  1670.     Input.update
  1671.     deactivate
  1672.     call_handler(:cancel)
  1673.   end
  1674.   
  1675.   #--------------------------------------------------------------------------
  1676.   # new method: process_dir6
  1677.   #--------------------------------------------------------------------------
  1678.   def process_dir6
  1679.     Sound.play_cursor
  1680.     Input.update
  1681.     deactivate
  1682.     call_handler(:dir6)
  1683.   end
  1684.   
  1685. end # Window_ActorCommand

  1686. #==============================================================================
  1687. # ■ Window_BattleStatus
  1688. #==============================================================================

  1689. class Window_BattleStatus < Window_Selectable
  1690.   
  1691.   #--------------------------------------------------------------------------
  1692.   # overwrite method: initialize
  1693.   #--------------------------------------------------------------------------
  1694.   def initialize
  1695.     super(0, 0, window_width, window_height)
  1696.     self.openness = 0
  1697.     @party = $game_party.battle_members.clone
  1698.   end
  1699.   
  1700.   #--------------------------------------------------------------------------
  1701.   # overwrite method: col_max
  1702.   #--------------------------------------------------------------------------
  1703.   def col_max; return $game_party.max_battle_members; end
  1704.   
  1705.   #--------------------------------------------------------------------------
  1706.   # new method: battle_members
  1707.   #--------------------------------------------------------------------------
  1708.   def battle_members; return $game_party.battle_members; end
  1709.   
  1710.   #--------------------------------------------------------------------------
  1711.   # new method: actor
  1712.   #--------------------------------------------------------------------------
  1713.   def actor; return battle_members[@index]; end
  1714.   
  1715.   #--------------------------------------------------------------------------
  1716.   # overwrite method: update
  1717.   #--------------------------------------------------------------------------
  1718.   def update
  1719.     super
  1720.     return if @party == $game_party.battle_members
  1721.     @party = $game_party.battle_members.clone
  1722.     refresh
  1723.   end
  1724.   
  1725.   #--------------------------------------------------------------------------
  1726.   # overwrite method: draw_item
  1727.   #--------------------------------------------------------------------------
  1728.   def draw_item(index)
  1729.     return if index.nil?
  1730.     clear_item(index)
  1731.     actor = battle_members[index]
  1732.     rect = item_rect(index)
  1733.     return if actor.nil?
  1734.     draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
  1735.     draw_actor_name(actor, rect.x, rect.y, rect.width-8)
  1736.     draw_actor_action(actor, rect.x, rect.y)
  1737.     draw_actor_icons(actor, rect.x, line_height*1, rect.width)
  1738.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
  1739.     contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
  1740.     draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
  1741.     if draw_tp?(actor) && draw_mp?(actor)
  1742.       dw = rect.width/2-2
  1743.       dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
  1744.       draw_actor_tp(actor, rect.x+2, line_height*3, dw)
  1745.       dw = rect.width - rect.width/2 - 2
  1746.       draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
  1747.     elsif draw_tp?(actor) && !draw_mp?(actor)
  1748.       draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
  1749.     else
  1750.       draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
  1751.     end
  1752.   end
  1753.   
  1754.   #--------------------------------------------------------------------------
  1755.   # overwrite method: item_rect
  1756.   #--------------------------------------------------------------------------
  1757.   def item_rect(index)
  1758.     rect = Rect.new
  1759.     rect.width = contents.width / $game_party.max_battle_members
  1760.     rect.height = contents.height
  1761.     rect.x = index * rect.width
  1762.     if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
  1763.       rect.x += (contents.width - $game_party.members.size * rect.width) / 2
  1764.     end
  1765.     rect.y = 0
  1766.     return rect
  1767.   end
  1768.   
  1769.   #--------------------------------------------------------------------------
  1770.   # overwrite method: draw_face
  1771.   #--------------------------------------------------------------------------
  1772.   def draw_face(face_name, face_index, dx, dy, enabled = true)
  1773.     bitmap = Cache.face(face_name)
  1774.     fx = [(96 - item_rect(0).width + 1) / 2, 0].max
  1775.     fy = face_index / 4 * 96 + 2
  1776.     fw = [item_rect(0).width - 4, 92].min
  1777.     rect = Rect.new(fx, fy, fw, 92)
  1778.     rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
  1779.     contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
  1780.     bitmap.dispose
  1781.   end
  1782.   
  1783.   #--------------------------------------------------------------------------
  1784.   # overwrite method: draw_actor_name
  1785.   #--------------------------------------------------------------------------
  1786.   def draw_actor_name(actor, dx, dy, dw = 112)
  1787.     reset_font_settings
  1788.     contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
  1789.     change_color(hp_color(actor))
  1790.     draw_text(dx+24, dy, dw-24, line_height, actor.name)
  1791.   end
  1792.   
  1793.   #--------------------------------------------------------------------------
  1794.   # new method: draw_actor_action
  1795.   #--------------------------------------------------------------------------
  1796.   def draw_actor_action(actor, dx, dy)
  1797.     draw_icon(action_icon(actor), dx, dy)
  1798.   end
  1799.   
  1800.   #--------------------------------------------------------------------------
  1801.   # new method: action_icon
  1802.   #--------------------------------------------------------------------------
  1803.   def action_icon(actor)
  1804.     return Icon.no_action if actor.current_action.nil?
  1805.     return Icon.no_action if actor.current_action.item.nil?
  1806.     return actor.current_action.item.icon_index
  1807.   end
  1808.   
  1809.   #--------------------------------------------------------------------------
  1810.   # new method: draw_tp?
  1811.   #--------------------------------------------------------------------------
  1812.   def draw_tp?(actor)
  1813.     return actor.draw_tp?
  1814.   end
  1815.   
  1816.   #--------------------------------------------------------------------------
  1817.   # new method: draw_mp?
  1818.   #--------------------------------------------------------------------------
  1819.   def draw_mp?(actor)
  1820.     return actor.draw_mp?
  1821.   end
  1822.   
  1823.   #--------------------------------------------------------------------------
  1824.   # overwrite method: draw_current_and_max_values
  1825.   #--------------------------------------------------------------------------
  1826.   def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
  1827.     change_color(color1)
  1828.     draw_text(dx, dy, dw, line_height, current.group, 2)
  1829.   end
  1830.   
  1831.   #--------------------------------------------------------------------------
  1832.   # overwrite method: draw_actor_hp
  1833.   #--------------------------------------------------------------------------
  1834.   def draw_actor_hp(actor, dx, dy, width = 124)
  1835.     draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  1836.     change_color(system_color)
  1837.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1838.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
  1839.     draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
  1840.       hp_color(actor), normal_color)
  1841.     end
  1842.    
  1843.   #--------------------------------------------------------------------------
  1844.   # overwrite method: draw_actor_mp
  1845.   #--------------------------------------------------------------------------
  1846.   def draw_actor_mp(actor, dx, dy, width = 124)
  1847.     draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  1848.     change_color(system_color)
  1849.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1850.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
  1851.     draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
  1852.       mp_color(actor), normal_color)
  1853.     end
  1854.    
  1855.   #--------------------------------------------------------------------------
  1856.   # overwrite method: draw_actor_tp
  1857.   #--------------------------------------------------------------------------
  1858.   def draw_actor_tp(actor, dx, dy, width = 124)
  1859.     draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  1860.     change_color(system_color)
  1861.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1862.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
  1863.     change_color(tp_color(actor))
  1864.     draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
  1865.   end
  1866.   
  1867. end # Window_BattleStatus

  1868. #==============================================================================
  1869. # ■ Window_BattleActor
  1870. #==============================================================================

  1871. class Window_BattleActor < Window_BattleStatus
  1872.   
  1873.   #--------------------------------------------------------------------------
  1874.   # overwrite method: show
  1875.   #--------------------------------------------------------------------------
  1876.   def show
  1877.     create_flags
  1878.     super
  1879.   end
  1880.   
  1881.   #--------------------------------------------------------------------------
  1882.   # new method: create_flags
  1883.   #--------------------------------------------------------------------------
  1884.   def create_flags
  1885.     set_select_flag(:any)
  1886.     select(0)
  1887.     return if $game_temp.battle_aid.nil?
  1888.     if $game_temp.battle_aid.need_selection?
  1889.       select(0)
  1890.       set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
  1891.     elsif $game_temp.battle_aid.for_user?
  1892.       battler = BattleManager.actor
  1893.       id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
  1894.       select(id)
  1895.       set_select_flag(:user)
  1896.     elsif $game_temp.battle_aid.for_all?
  1897.       select(0)
  1898.       set_select_flag(:all)
  1899.       set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
  1900.     elsif $game_temp.battle_aid.for_random?
  1901.       select(0)
  1902.       set_select_flag(:random) if $game_temp.battle_aid.for_random?
  1903.     end
  1904.   end
  1905.   
  1906.   #--------------------------------------------------------------------------
  1907.   # new method: set_flag
  1908.   #--------------------------------------------------------------------------
  1909.   def set_select_flag(flag)
  1910.     @select_flag = flag
  1911.     case @select_flag
  1912.     when :all, :all_dead, :random
  1913.       @cursor_all = true
  1914.     else
  1915.       @cursor_all = false
  1916.     end
  1917.   end
  1918.   
  1919.   #--------------------------------------------------------------------------
  1920.   # overwrite method: update_cursor
  1921.   #--------------------------------------------------------------------------
  1922.   def update_cursor
  1923.     if @cursor_all
  1924.       cursor_rect.set(0, 0, contents.width, contents.height)
  1925.       self.top_row = 0
  1926.     elsif @index < 0
  1927.       cursor_rect.empty
  1928.     else
  1929.       ensure_cursor_visible
  1930.       cursor_rect.set(item_rect(@index))
  1931.     end
  1932.   end
  1933.   
  1934.   #--------------------------------------------------------------------------
  1935.   # overwrite method: cursor_movable?
  1936.   #--------------------------------------------------------------------------
  1937.   def cursor_movable?
  1938.     return false if @select_flag == :user
  1939.     return super
  1940.   end
  1941.   
  1942.   #--------------------------------------------------------------------------
  1943.   # overwrite method: current_item_enabled?
  1944.   #--------------------------------------------------------------------------
  1945.   def current_item_enabled?
  1946.     return true if $game_temp.battle_aid.nil?
  1947.     if $game_temp.battle_aid.need_selection?
  1948.       member = $game_party.battle_members[@index]
  1949.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  1950.     elsif $game_temp.battle_aid.for_dead_friend?
  1951.       for member in $game_party.battle_members
  1952.         return true if member.dead?
  1953.       end
  1954.       return false
  1955.     end
  1956.     return true
  1957.   end
  1958.   
  1959. end # Window_BattleActor

  1960. #==============================================================================
  1961. # ■ Window_BattleStatusAid
  1962. #==============================================================================

  1963. class Window_BattleStatusAid < Window_BattleStatus
  1964.   
  1965.   #--------------------------------------------------------------------------
  1966.   # public instance variables
  1967.   #--------------------------------------------------------------------------
  1968.   attr_accessor :status_window
  1969.   
  1970.   #--------------------------------------------------------------------------
  1971.   # overwrite method: initialize
  1972.   #--------------------------------------------------------------------------
  1973.   def initialize
  1974.     super
  1975.     self.visible = false
  1976.     self.openness = 255
  1977.   end
  1978.   
  1979.   #--------------------------------------------------------------------------
  1980.   # overwrite method: window_width
  1981.   #--------------------------------------------------------------------------
  1982.   def window_width; return 128; end
  1983.   
  1984.   #--------------------------------------------------------------------------
  1985.   # overwrite method: show
  1986.   #--------------------------------------------------------------------------
  1987.   def show
  1988.     super
  1989.     refresh
  1990.   end
  1991.   
  1992.   #--------------------------------------------------------------------------
  1993.   # overwrite method: refresh
  1994.   #--------------------------------------------------------------------------
  1995.   def refresh
  1996.     contents.clear
  1997.     return if @status_window.nil?
  1998.     draw_item(@status_window.index)
  1999.   end
  2000.   
  2001.   #--------------------------------------------------------------------------
  2002.   # overwrite method: item_rect
  2003.   #--------------------------------------------------------------------------
  2004.   def item_rect(index)
  2005.     return Rect.new(0, 0, contents.width, contents.height)
  2006.   end
  2007.   
  2008. end # Window_BattleStatusAid

  2009. #==============================================================================
  2010. # ■ Window_BattleEnemy
  2011. #==============================================================================

  2012. class Window_BattleEnemy < Window_Selectable
  2013.   
  2014.   #--------------------------------------------------------------------------
  2015.   # overwrite method: initialize
  2016.   #--------------------------------------------------------------------------
  2017.   def initialize(info_viewport)
  2018.     super(0, Graphics.height, window_width, fitting_height(1))
  2019.     refresh
  2020.     self.visible = false
  2021.     @info_viewport = info_viewport
  2022.   end
  2023.   
  2024.   #--------------------------------------------------------------------------
  2025.   # overwrite method: col_max
  2026.   #--------------------------------------------------------------------------
  2027.   def col_max; return item_max; end
  2028.   
  2029.   #--------------------------------------------------------------------------
  2030.   # overwrite method: show
  2031.   #--------------------------------------------------------------------------
  2032.   def show
  2033.     create_flags
  2034.     super
  2035.   end
  2036.   
  2037.   #--------------------------------------------------------------------------
  2038.   # new method: create_flags
  2039.   #--------------------------------------------------------------------------
  2040.   def create_flags
  2041.     set_select_flag(:any)
  2042.     select(0)
  2043.     return if $game_temp.battle_aid.nil?
  2044.     if $game_temp.battle_aid.need_selection?
  2045.       select(0)
  2046.     elsif $game_temp.battle_aid.for_all?
  2047.       select(0)
  2048.       set_select_flag(:all)
  2049.     elsif $game_temp.battle_aid.for_random?
  2050.       select(0)
  2051.       set_select_flag(:random)
  2052.     end
  2053.   end
  2054.   
  2055.   #--------------------------------------------------------------------------
  2056.   # new method: set_flag
  2057.   #--------------------------------------------------------------------------
  2058.   def set_select_flag(flag)
  2059.     @select_flag = flag
  2060.     case @select_flag
  2061.     when :all, :random
  2062.       @cursor_all = true
  2063.     else
  2064.       @cursor_all = false
  2065.     end
  2066.   end
  2067.   
  2068.   #--------------------------------------------------------------------------
  2069.   # new method: select_all?
  2070.   #--------------------------------------------------------------------------
  2071.   def select_all?
  2072.     return true if @select_flag == :all
  2073.     return true if @select_flag == :random
  2074.     return false
  2075.   end
  2076.   
  2077.   #--------------------------------------------------------------------------
  2078.   # overwrite method: update_cursor
  2079.   #--------------------------------------------------------------------------
  2080.   def update_cursor
  2081.     if @cursor_all
  2082.       cursor_rect.set(0, 0, contents.width, contents.height)
  2083.       self.top_row = 0
  2084.     elsif @index < 0
  2085.       cursor_rect.empty
  2086.     else
  2087.       ensure_cursor_visible
  2088.       cursor_rect.set(item_rect(@index))
  2089.     end
  2090.   end
  2091.   
  2092.   #--------------------------------------------------------------------------
  2093.   # overwrite method: cursor_movable?
  2094.   #--------------------------------------------------------------------------
  2095.   def cursor_movable?
  2096.     return false if @select_flag == :user
  2097.     return super
  2098.   end
  2099.   
  2100.   #--------------------------------------------------------------------------
  2101.   # overwrite method: current_item_enabled?
  2102.   #--------------------------------------------------------------------------
  2103.   def current_item_enabled?
  2104.     return true if $game_temp.battle_aid.nil?
  2105.     if $game_temp.battle_aid.need_selection?
  2106.       member = $game_party.battle_members[@index]
  2107.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  2108.     elsif $game_temp.battle_aid.for_dead_friend?
  2109.       for member in $game_party.battle_members
  2110.         return true if member.dead?
  2111.       end
  2112.       return false
  2113.     end
  2114.     return true
  2115.   end
  2116.   
  2117.   #--------------------------------------------------------------------------
  2118.   # overwrite method: enemy
  2119.   #--------------------------------------------------------------------------
  2120.   def enemy; @data[index]; end
  2121.   
  2122.   #--------------------------------------------------------------------------
  2123.   # overwrite method: refresh
  2124.   #--------------------------------------------------------------------------
  2125.   def refresh
  2126.     make_item_list
  2127.     create_contents
  2128.     draw_all_items
  2129.   end
  2130.   
  2131.   #--------------------------------------------------------------------------
  2132.   # overwrite method: make_item_list
  2133.   #--------------------------------------------------------------------------
  2134.   def make_item_list
  2135.     @data = $game_troop.alive_members
  2136.     @data.sort! { |a,b| a.screen_x <=> b.screen_x }
  2137.   end
  2138.   
  2139.   #--------------------------------------------------------------------------
  2140.   # overwrite method: draw_item
  2141.   #--------------------------------------------------------------------------
  2142.   def draw_item(index); return; end
  2143.   
  2144.   #--------------------------------------------------------------------------
  2145.   # overwrite method: update
  2146.   #--------------------------------------------------------------------------
  2147.   def update
  2148.     super
  2149.     return unless active
  2150.     enemy.sprite_effect_type = :whiten
  2151.     return unless select_all?
  2152.     for enemy in $game_troop.alive_members
  2153.       enemy.sprite_effect_type = :whiten
  2154.     end
  2155.   end
  2156.   
  2157. end # Window_BattleEnemy

  2158. #==============================================================================
  2159. # ■ Window_BattleHelp
  2160. #==============================================================================

  2161. class Window_BattleHelp < Window_Help
  2162.   
  2163.   #--------------------------------------------------------------------------
  2164.   # public instance variables
  2165.   #--------------------------------------------------------------------------
  2166.   attr_accessor :actor_window
  2167.   attr_accessor :enemy_window
  2168.   
  2169.   #--------------------------------------------------------------------------
  2170.   # update
  2171.   #--------------------------------------------------------------------------
  2172.   def update
  2173.     super
  2174.     if !self.visible and @text != ""
  2175.       @text = ""
  2176.       return refresh
  2177.     end
  2178.     update_battler_name
  2179.   end
  2180.   
  2181.   #--------------------------------------------------------------------------
  2182.   # update_battler_name
  2183.   #--------------------------------------------------------------------------
  2184.   def update_battler_name
  2185.     return unless @actor_window.active || @enemy_window.active
  2186.     if @actor_window.active
  2187.       battler = $game_party.battle_members[@actor_window.index]
  2188.     elsif @enemy_window.active
  2189.       battler = @enemy_window.enemy
  2190.     end
  2191.     if special_display?
  2192.       refresh_special_case(battler)
  2193.     else
  2194.       refresh_battler_name(battler) if battler_name(battler) != @text
  2195.     end
  2196.   end
  2197.   
  2198.   #--------------------------------------------------------------------------
  2199.   # battler_name
  2200.   #--------------------------------------------------------------------------
  2201.   def battler_name(battler)
  2202.     text = battler.name.clone
  2203.     return text
  2204.   end
  2205.   
  2206.   #--------------------------------------------------------------------------
  2207.   # refresh_battler_name
  2208.   #--------------------------------------------------------------------------
  2209.   def refresh_battler_name(battler)
  2210.     contents.clear
  2211.     reset_font_settings
  2212.     change_color(normal_color)
  2213.     @text = battler_name(battler)
  2214.     icons = battler.state_icons + battler.buff_icons
  2215.     dy = icons.size <= 0 ? line_height / 2 : 0
  2216.     draw_text(0, dy, contents.width, line_height, @text, 1)
  2217.     dx = (contents.width - (icons.size * 24)) / 2
  2218.     draw_actor_icons(battler, dx, line_height, contents.width)
  2219.   end
  2220.   
  2221.   #--------------------------------------------------------------------------
  2222.   # special_display?
  2223.   #--------------------------------------------------------------------------
  2224.   def special_display?
  2225.     return false if $game_temp.battle_aid.nil?
  2226.     return false if $game_temp.battle_aid.for_user?
  2227.     return !$game_temp.battle_aid.need_selection?
  2228.   end
  2229.   
  2230.   #--------------------------------------------------------------------------
  2231.   # refresh_special_case
  2232.   #--------------------------------------------------------------------------
  2233.   def refresh_special_case(battler)
  2234.     if $game_temp.battle_aid.for_opponent?
  2235.       if $game_temp.battle_aid.for_all?
  2236.         text = YEA::BATTLE::HELP_TEXT_ALL_FOES
  2237.       else
  2238.         case $game_temp.battle_aid.number_of_targets
  2239.         when 1
  2240.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
  2241.         else
  2242.           number = $game_temp.battle_aid.number_of_targets
  2243.           text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
  2244.         end
  2245.       end
  2246.     else # $game_temp.battle_aid.for_friend?
  2247.       if $game_temp.battle_aid.for_dead_friend?
  2248.         text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
  2249.       elsif $game_temp.battle_aid.for_random?
  2250.         case $game_temp.battle_aid.number_of_targets
  2251.         when 1
  2252.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
  2253.         else
  2254.           number = $game_temp.battle_aid.number_of_targets
  2255.           text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
  2256.         end
  2257.       else
  2258.         text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
  2259.       end
  2260.     end
  2261.     return if text == @text
  2262.     @text = text
  2263.     contents.clear
  2264.     reset_font_settings
  2265.     draw_text(0, 0, contents.width, line_height*2, @text, 1)
  2266.   end
  2267.   
  2268. end # Window_BattleHelp

  2269. #==============================================================================
  2270. # ■ Window_BattleLog
  2271. #==============================================================================

  2272. class Window_BattleLog < Window_Selectable
  2273.   
  2274.   #--------------------------------------------------------------------------
  2275.   # alias method: display_current_state
  2276.   #--------------------------------------------------------------------------
  2277.   alias window_battlelog_display_current_state_abe display_current_state
  2278.   def display_current_state(subject)
  2279.     subject.make_during_state_popup
  2280.     return unless YEA::BATTLE::MSG_CURRENT_STATE
  2281.     window_battlelog_display_current_state_abe(subject)
  2282.   end
  2283.   
  2284.   #--------------------------------------------------------------------------
  2285.   # alias method: display_use_item
  2286.   #--------------------------------------------------------------------------
  2287.   alias window_battlelog_display_use_item_abe display_use_item
  2288.   def display_use_item(subject, item)
  2289.     return unless YEA::BATTLE::MSG_CURRENT_ACTION
  2290.     window_battlelog_display_use_item_abe(subject, item)
  2291.   end
  2292.   
  2293.   #--------------------------------------------------------------------------
  2294.   # alias method: display_counter
  2295.   #--------------------------------------------------------------------------
  2296.   alias window_battlelog_display_counter_abe display_counter
  2297.   def display_counter(target, item)
  2298.     if YEA::BATTLE::MSG_COUNTERATTACK
  2299.       window_battlelog_display_counter_abe(target, item)
  2300.     else
  2301.       Sound.play_evasion
  2302.     end
  2303.   end
  2304.   
  2305.   #--------------------------------------------------------------------------
  2306.   # alias method: display_reflection
  2307.   #--------------------------------------------------------------------------
  2308.   alias window_battlelog_display_reflection_abe display_reflection
  2309.   def display_reflection(target, item)
  2310.     if YEA::BATTLE::MSG_REFLECT_MAGIC
  2311.       window_battlelog_display_reflection_abe(target, item)
  2312.     else
  2313.       Sound.play_reflection
  2314.     end
  2315.   end
  2316.   
  2317.   #--------------------------------------------------------------------------
  2318.   # alias method: display_substitute
  2319.   #--------------------------------------------------------------------------
  2320.   alias window_battlelog_display_substitute_abe display_substitute
  2321.   def display_substitute(substitute, target)
  2322.     return unless YEA::BATTLE::MSG_SUBSTITUTE_HIT
  2323.     window_battlelog_display_substitute_abe(substitute, target)
  2324.   end
  2325.   
  2326.   #--------------------------------------------------------------------------
  2327.   # alias method: display_failure
  2328.   #--------------------------------------------------------------------------
  2329.   alias window_battlelog_display_failure_abe display_failure
  2330.   def display_failure(target, item)
  2331.     return unless YEA::BATTLE::MSG_FAILURE_HIT
  2332.     window_battlelog_display_failure_abe(target, item)
  2333.   end
  2334.   
  2335.   #--------------------------------------------------------------------------
  2336.   # alias method: display_critical
  2337.   #--------------------------------------------------------------------------
  2338.   alias window_battlelog_display_critical_abe display_critical
  2339.   def display_critical(target, item)
  2340.     return unless YEA::BATTLE::MSG_CRITICAL_HIT
  2341.     window_battlelog_display_critical_abe(target, item)
  2342.   end
  2343.   
  2344.   #--------------------------------------------------------------------------
  2345.   # alias method: display_miss
  2346.   #--------------------------------------------------------------------------
  2347.   alias window_battlelog_display_miss_abe display_miss
  2348.   def display_miss(target, item)
  2349.     return unless YEA::BATTLE::MSG_HIT_MISSED
  2350.     window_battlelog_display_miss_abe(target, item)
  2351.   end
  2352.   
  2353.   #--------------------------------------------------------------------------
  2354.   # alias method: display_evasion
  2355.   #--------------------------------------------------------------------------
  2356.   alias window_battlelog_display_evasion_abe display_evasion
  2357.   def display_evasion(target, item)
  2358.     if YEA::BATTLE::MSG_EVASION
  2359.       window_battlelog_display_evasion_abe(target, item)
  2360.     else
  2361.       if !item || item.physical?
  2362.         Sound.play_evasion
  2363.       else
  2364.         Sound.play_magic_evasion
  2365.       end
  2366.     end
  2367.   end
  2368.   
  2369.   #--------------------------------------------------------------------------
  2370.   # overwrite method: display_hp_damage
  2371.   #--------------------------------------------------------------------------
  2372.   def display_hp_damage(target, item)
  2373.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  2374.     if target.result.hp_damage > 0 && target.result.hp_drain == 0
  2375.       target.perform_damage_effect
  2376.     end
  2377.     Sound.play_recovery if target.result.hp_damage < 0
  2378.     return unless YEA::BATTLE::MSG_HP_DAMAGE
  2379.     add_text(target.result.hp_damage_text)
  2380.     wait
  2381.   end
  2382.   
  2383.   #--------------------------------------------------------------------------
  2384.   # overwrite method: display_mp_damage
  2385.   #--------------------------------------------------------------------------
  2386.   def display_mp_damage(target, item)
  2387.     return if target.dead? || target.result.mp_damage == 0
  2388.     Sound.play_recovery if target.result.mp_damage < 0
  2389.     return unless YEA::BATTLE::MSG_MP_DAMAGE
  2390.     add_text(target.result.mp_damage_text)
  2391.     wait
  2392.   end
  2393.   
  2394.   #--------------------------------------------------------------------------
  2395.   # overwrite method: display_tp_damage
  2396.   #--------------------------------------------------------------------------
  2397.   def display_tp_damage(target, item)
  2398.     return if target.dead? || target.result.tp_damage == 0
  2399.     Sound.play_recovery if target.result.tp_damage < 0
  2400.     return unless YEA::BATTLE::MSG_TP_DAMAGE
  2401.     add_text(target.result.tp_damage_text)
  2402.     wait
  2403.   end
  2404.   
  2405.   #--------------------------------------------------------------------------
  2406.   # alias method: display_added_states
  2407.   #--------------------------------------------------------------------------
  2408.   alias window_battlelog_display_added_states_abe display_added_states
  2409.   def display_added_states(target)
  2410.     return unless YEA::BATTLE::MSG_ADDED_STATES
  2411.     window_battlelog_display_added_states_abe(target)
  2412.   end
  2413.   
  2414.   #--------------------------------------------------------------------------
  2415.   # alias method: display_removed_states
  2416.   #--------------------------------------------------------------------------
  2417.   alias window_battlelog_display_removed_states_abe display_removed_states
  2418.   def display_removed_states(target)
  2419.     return unless YEA::BATTLE::MSG_REMOVED_STATES
  2420.     window_battlelog_display_removed_states_abe(target)
  2421.   end
  2422.   
  2423.   #--------------------------------------------------------------------------
  2424.   # alias method: display_changed_buffs
  2425.   #--------------------------------------------------------------------------
  2426.   alias window_battlelog_display_changed_buffs_abe display_changed_buffs
  2427.   def display_changed_buffs(target)
  2428.     return unless YEA::BATTLE::MSG_CHANGED_BUFFS
  2429.     window_battlelog_display_changed_buffs_abe(target)
  2430.   end
  2431.   
  2432. end # Window_BattleLog

  2433. #==============================================================================
  2434. # ■ Window_SkillList
  2435. #==============================================================================

  2436. class Window_SkillList < Window_Selectable
  2437.   
  2438.   #--------------------------------------------------------------------------
  2439.   # overwrite method: spacing
  2440.   #--------------------------------------------------------------------------
  2441.   def spacing
  2442.     return 8 if $game_party.in_battle
  2443.     return super
  2444.   end
  2445.   
  2446. end # Window_SkillList

  2447. #==============================================================================
  2448. # ■ Window_ItemList
  2449. #==============================================================================

  2450. class Window_ItemList < Window_Selectable
  2451.   
  2452.   #--------------------------------------------------------------------------
  2453.   # overwrite method: spacing
  2454.   #--------------------------------------------------------------------------
  2455.   def spacing
  2456.     return 8 if $game_party.in_battle
  2457.     return super
  2458.   end
  2459.   
  2460. end # Window_ItemList

  2461. #==============================================================================
  2462. # ■ Scene_Battle
  2463. #==============================================================================

  2464. class Scene_Battle < Scene_Base
  2465.   
  2466.   #--------------------------------------------------------------------------
  2467.   # public instance variables
  2468.   #--------------------------------------------------------------------------
  2469.   attr_accessor :enemy_window
  2470.   attr_accessor :info_viewport
  2471.   attr_accessor :spriteset
  2472.   attr_accessor :status_window
  2473.   attr_accessor :status_aid_window
  2474.   attr_accessor :subject
  2475.   
  2476.   #--------------------------------------------------------------------------
  2477.   # alias method: create_spriteset
  2478.   #--------------------------------------------------------------------------
  2479.   alias scene_battle_create_spriteset_abe create_spriteset
  2480.   def create_spriteset
  2481.     BattleManager.init_battle_type
  2482.     scene_battle_create_spriteset_abe
  2483.   end
  2484.   
  2485.   #--------------------------------------------------------------------------
  2486.   # alias method: update_basic
  2487.   #--------------------------------------------------------------------------
  2488.   alias scene_battle_update_basic_abe update_basic
  2489.   def update_basic
  2490.     scene_battle_update_basic_abe
  2491.     update_debug
  2492.   end
  2493.   
  2494.   #--------------------------------------------------------------------------
  2495.   # new method: update_debug
  2496.   #--------------------------------------------------------------------------
  2497.   def update_debug
  2498.     return unless $TEST || $BTEST
  2499.     debug_heal_party if Input.trigger?(:F5)
  2500.     debug_damage_party if Input.trigger?(:F6)
  2501.     debug_fill_tp if Input.trigger?(:F7)
  2502.     debug_kill_all if Input.trigger?(:F8)
  2503.   end
  2504.   
  2505.   #--------------------------------------------------------------------------
  2506.   # new method: debug_heal_party
  2507.   #--------------------------------------------------------------------------
  2508.   def debug_heal_party
  2509.     Sound.play_recovery
  2510.     for member in $game_party.battle_members
  2511.       member.recover_all
  2512.     end
  2513.     @status_window.refresh
  2514.   end
  2515.   
  2516.   #--------------------------------------------------------------------------
  2517.   # new method: debug_damage_party
  2518.   #--------------------------------------------------------------------------
  2519.   def debug_damage_party
  2520.     Sound.play_actor_damage
  2521.     for member in $game_party.alive_members
  2522.       member.hp = 1
  2523.       member.mp = 0
  2524.       member.tp = 0
  2525.     end
  2526.     @status_window.refresh
  2527.   end
  2528.   
  2529.   #--------------------------------------------------------------------------
  2530.   # new method: debug_fill_tp
  2531.   #--------------------------------------------------------------------------
  2532.   def debug_fill_tp
  2533.     Sound.play_recovery
  2534.     for member in $game_party.alive_members
  2535.       member.tp = member.max_tp
  2536.     end
  2537.     @status_window.refresh
  2538.   end
  2539.   
  2540.   #--------------------------------------------------------------------------
  2541.   # new method: debug_kill_all
  2542.   #--------------------------------------------------------------------------
  2543.   def debug_kill_all
  2544.     for enemy in $game_troop.alive_members
  2545.       enemy.hp = 0
  2546.       enemy.perform_collapse_effect
  2547.     end
  2548.     BattleManager.judge_win_loss
  2549.     @log_window.wait
  2550.     @log_window.wait_for_effect
  2551.   end
  2552.   
  2553.   #--------------------------------------------------------------------------
  2554.   # alias method: create_all_windows
  2555.   #--------------------------------------------------------------------------
  2556.   alias scene_battle_create_all_windows_abe create_all_windows
  2557.   def create_all_windows
  2558.     scene_battle_create_all_windows_abe
  2559.     create_battle_status_aid_window
  2560.     set_help_window
  2561.   end
  2562.   
  2563.   #--------------------------------------------------------------------------
  2564.   # alias method: create_info_viewport
  2565.   #--------------------------------------------------------------------------
  2566.   alias scene_battle_create_info_viewport_abe create_info_viewport
  2567.   def create_info_viewport
  2568.     scene_battle_create_info_viewport_abe
  2569.     @status_window.refresh
  2570.   end
  2571.   
  2572.   #--------------------------------------------------------------------------
  2573.   # new method: create_battle_status_aid_window
  2574.   #--------------------------------------------------------------------------
  2575.   def create_battle_status_aid_window
  2576.     @status_aid_window = Window_BattleStatusAid.new
  2577.     @status_aid_window.status_window = @status_window
  2578.     @status_aid_window.x = Graphics.width - @status_aid_window.width
  2579.     @status_aid_window.y = Graphics.height - @status_aid_window.height
  2580.   end
  2581.   
  2582.   #--------------------------------------------------------------------------
  2583.   # overwrite method: create_help_window
  2584.   #--------------------------------------------------------------------------
  2585.   def create_help_window
  2586.     @help_window = Window_BattleHelp.new
  2587.     @help_window.hide
  2588.   end
  2589.   
  2590.   #--------------------------------------------------------------------------
  2591.   # new method: set_help_window
  2592.   #--------------------------------------------------------------------------
  2593.   def set_help_window
  2594.     @help_window.actor_window = @actor_window
  2595.     @help_window.enemy_window = @enemy_window
  2596.   end
  2597.   
  2598.   #--------------------------------------------------------------------------
  2599.   # alias method: create_party_command_window
  2600.   #--------------------------------------------------------------------------
  2601.   alias scene_battle_create_party_command_window_abe create_party_command_window
  2602.   def create_party_command_window
  2603.     scene_battle_create_party_command_window_abe
  2604.     @party_command_window.set_handler(:dir6, method(:command_fight))
  2605.   end
  2606.   
  2607.   #--------------------------------------------------------------------------
  2608.   # alias method: create_actor_command_window
  2609.   #--------------------------------------------------------------------------
  2610.   alias scene_battle_create_actor_command_window_abe create_actor_command_window
  2611.   def create_actor_command_window
  2612.     scene_battle_create_actor_command_window_abe
  2613.     @actor_command_window.set_handler(:dir4, method(:prior_command))
  2614.     @actor_command_window.set_handler(:dir6, method(:next_command))
  2615.   end
  2616.   
  2617.   #--------------------------------------------------------------------------
  2618.   # alias method: create_skill_window
  2619.   #--------------------------------------------------------------------------
  2620.   alias scene_battle_create_skill_window_abe create_skill_window
  2621.   def create_skill_window
  2622.     scene_battle_create_skill_window_abe
  2623.     @skill_window.height = @info_viewport.rect.height
  2624.     @skill_window.width = Graphics.width - @actor_command_window.width
  2625.     @skill_window.y = Graphics.height - @skill_window.height
  2626.   end
  2627.   
  2628.   #--------------------------------------------------------------------------
  2629.   # alias method: create_item_window
  2630.   #--------------------------------------------------------------------------
  2631.   alias scene_battle_create_item_window_abe create_item_window
  2632.   def create_item_window
  2633.     scene_battle_create_item_window_abe
  2634.     @item_window.height = @skill_window.height
  2635.     @item_window.width = @skill_window.width
  2636.     @item_window.y = Graphics.height - @item_window.height
  2637.   end
  2638.   
  2639.   #--------------------------------------------------------------------------
  2640.   # alias method: show_fast?
  2641.   #--------------------------------------------------------------------------
  2642.   alias scene_battle_show_fast_abe show_fast?
  2643.   def show_fast?
  2644.     return true if YEA::BATTLE::AUTO_FAST
  2645.     return scene_battle_show_fast_abe
  2646.   end
  2647.   
  2648.   #--------------------------------------------------------------------------
  2649.   # alias method: next_command
  2650.   #--------------------------------------------------------------------------
  2651.   alias scene_battle_next_command_abe next_command
  2652.   def next_command
  2653.     @status_window.show
  2654.     redraw_current_status
  2655.     @actor_command_window.show
  2656.     @status_aid_window.hide
  2657.     scene_battle_next_command_abe
  2658.   end
  2659.   
  2660.   #--------------------------------------------------------------------------
  2661.   # alias method: prior_command
  2662.   #--------------------------------------------------------------------------
  2663.   alias scene_battle_prior_command_abe prior_command
  2664.   def prior_command
  2665.     redraw_current_status
  2666.     scene_battle_prior_command_abe
  2667.   end
  2668.   
  2669.   #--------------------------------------------------------------------------
  2670.   # new method: redraw_current_status
  2671.   #--------------------------------------------------------------------------
  2672.   def redraw_current_status
  2673.     return if @status_window.index < 0
  2674.     @status_window.draw_item(@status_window.index)
  2675.   end
  2676.   
  2677.   #--------------------------------------------------------------------------
  2678.   # alias method: command_attack
  2679.   #--------------------------------------------------------------------------
  2680.   alias scene_battle_command_attack_abe command_attack
  2681.   def command_attack
  2682.     $game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
  2683.     scene_battle_command_attack_abe
  2684.   end
  2685.   
  2686.   #--------------------------------------------------------------------------
  2687.   # alias method: command_skill
  2688.   #--------------------------------------------------------------------------
  2689.   alias scene_battle_command_skill_abe command_skill
  2690.   def command_skill
  2691.     scene_battle_command_skill_abe
  2692.     @status_window.hide
  2693.     @actor_command_window.hide
  2694.     @status_aid_window.show
  2695.   end
  2696.   
  2697.   #--------------------------------------------------------------------------
  2698.   # alias method: command_item
  2699.   #--------------------------------------------------------------------------
  2700.   alias scene_battle_command_item_abe command_item
  2701.   def command_item
  2702.     scene_battle_command_item_abe
  2703.     @status_window.hide
  2704.     @actor_command_window.hide
  2705.     @status_aid_window.show
  2706.   end
  2707.   
  2708.   #--------------------------------------------------------------------------
  2709.   # overwrite method: on_skill_ok
  2710.   #--------------------------------------------------------------------------
  2711.   def on_skill_ok
  2712.     @skill = @skill_window.item
  2713.     $game_temp.battle_aid = @skill
  2714.     BattleManager.actor.input.set_skill(@skill.id)
  2715.     BattleManager.actor.last_skill.object = @skill
  2716.     if @skill.for_opponent?
  2717.       select_enemy_selection
  2718.     elsif @skill.for_friend?
  2719.       select_actor_selection
  2720.     else
  2721.       @skill_window.hide
  2722.       next_command
  2723.       $game_temp.battle_aid = nil
  2724.     end
  2725.   end
  2726.   
  2727.   #--------------------------------------------------------------------------
  2728.   # alias method: on_skill_cancel
  2729.   #--------------------------------------------------------------------------
  2730.   alias scene_battle_on_skill_cancel_abe on_skill_cancel
  2731.   def on_skill_cancel
  2732.     scene_battle_on_skill_cancel_abe
  2733.     @status_window.show
  2734.     @actor_command_window.show
  2735.     @status_aid_window.hide
  2736.   end
  2737.   
  2738.   #--------------------------------------------------------------------------
  2739.   # overwrite method: on_item_ok
  2740.   #--------------------------------------------------------------------------
  2741.   def on_item_ok
  2742.     @item = @item_window.item
  2743.     $game_temp.battle_aid = @item
  2744.     BattleManager.actor.input.set_item(@item.id)
  2745.     if @item.for_opponent?
  2746.       select_enemy_selection
  2747.     elsif @item.for_friend?
  2748.       select_actor_selection
  2749.     else
  2750.       @item_window.hide
  2751.       next_command
  2752.       $game_temp.battle_aid = nil
  2753.     end
  2754.     $game_party.last_item.object = @item
  2755.   end
  2756.   
  2757.   #--------------------------------------------------------------------------
  2758.   # alias method: on_item_cancel
  2759.   #--------------------------------------------------------------------------
  2760.   alias scene_battle_on_item_cancel_abe on_item_cancel
  2761.   def on_item_cancel
  2762.     scene_battle_on_item_cancel_abe
  2763.     @status_window.show
  2764.     @actor_command_window.show
  2765.     @status_aid_window.hide
  2766.   end
  2767.   
  2768.   #--------------------------------------------------------------------------
  2769.   # alias method: select_actor_selection
  2770.   #--------------------------------------------------------------------------
  2771.   alias scene_battle_select_actor_selection_abe select_actor_selection
  2772.   def select_actor_selection
  2773.     @status_aid_window.refresh
  2774.     scene_battle_select_actor_selection_abe
  2775.     @status_window.hide
  2776.     @skill_window.hide
  2777.     @item_window.hide
  2778.     @help_window.show
  2779.   end
  2780.   
  2781.   #--------------------------------------------------------------------------
  2782.   # alias method: on_actor_ok
  2783.   #--------------------------------------------------------------------------
  2784.   alias scene_battle_on_actor_ok_abe on_actor_ok
  2785.   def on_actor_ok
  2786.     $game_temp.battle_aid = nil
  2787.     scene_battle_on_actor_ok_abe
  2788.     @status_window.show
  2789.     if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
  2790.       @actor_command_window.visible = !@confirm_command_window.visible
  2791.     else
  2792.       @actor_command_window.show
  2793.     end
  2794.     @status_aid_window.hide
  2795.   end
  2796.   
  2797.   #--------------------------------------------------------------------------
  2798.   # alias method: on_actor_cancel
  2799.   #--------------------------------------------------------------------------
  2800.   alias scene_battle_on_actor_cancel_abe on_actor_cancel
  2801.   def on_actor_cancel
  2802.     BattleManager.actor.input.clear
  2803.     @status_aid_window.refresh
  2804.     $game_temp.battle_aid = nil
  2805.     scene_battle_on_actor_cancel_abe
  2806.     case @actor_command_window.current_symbol
  2807.     when :skill
  2808.       @skill_window.show
  2809.     when :item
  2810.       @item_window.show
  2811.     end
  2812.   end
  2813.   
  2814.   #--------------------------------------------------------------------------
  2815.   # alias method: select_enemy_selection
  2816.   #--------------------------------------------------------------------------
  2817.   alias scene_battle_select_enemy_selection_abe select_enemy_selection
  2818.   def select_enemy_selection
  2819.     @status_aid_window.refresh
  2820.     scene_battle_select_enemy_selection_abe
  2821.     @help_window.show
  2822.   end
  2823.   #--------------------------------------------------------------------------
  2824.   # alias method: on_enemy_ok
  2825.   #--------------------------------------------------------------------------
  2826.   alias scene_battle_on_enemy_ok_abe on_enemy_ok
  2827.   def on_enemy_ok
  2828.     $game_temp.battle_aid = nil
  2829.     scene_battle_on_enemy_ok_abe
  2830.   end
  2831.   
  2832.   #--------------------------------------------------------------------------
  2833.   # alias method: on_enemy_cancel
  2834.   #--------------------------------------------------------------------------
  2835.   alias scene_battle_on_enemy_cancel_abe on_enemy_cancel
  2836.   def on_enemy_cancel
  2837.     BattleManager.actor.input.clear
  2838.     @status_aid_window.refresh
  2839.     $game_temp.battle_aid = nil
  2840.     scene_battle_on_enemy_cancel_abe
  2841.     if @skill_window.visible || @item_window.visible
  2842.       @help_window.show
  2843.     else
  2844.       @help_window.hide
  2845.     end
  2846.   end
  2847.   
  2848.   #--------------------------------------------------------------------------
  2849.   # alias method: battle_start
  2850.   #--------------------------------------------------------------------------
  2851.   alias scene_battle_battle_start_abe battle_start
  2852.   def battle_start
  2853.     scene_battle_battle_start_abe
  2854.     return unless YEA::BATTLE::SKIP_PARTY_COMMAND
  2855.     @party_command_window.deactivate
  2856.     if BattleManager.input_start
  2857.       command_fight
  2858.     else
  2859.       turn_start
  2860.     end
  2861.   end
  2862.   
  2863.   #--------------------------------------------------------------------------
  2864.   # overwrite method: turn_end
  2865.   #--------------------------------------------------------------------------
  2866.   def turn_end
  2867.     all_battle_members.each do |battler|
  2868.       battler.on_turn_end
  2869.       status_redraw_target(battler)
  2870.       @log_window.display_auto_affected_status(battler)
  2871.       @log_window.wait_and_clear
  2872.     end
  2873.     update_party_cooldowns if $imported["YEA-CommandParty"]
  2874.     BattleManager.turn_end
  2875.     process_event
  2876.     start_party_command_selection
  2877.     return unless YEA::BATTLE::SKIP_PARTY_COMMAND
  2878.     if BattleManager.input_start
  2879.       @party_command_window.deactivate
  2880.       command_fight
  2881.     else
  2882.       @party_command_window.deactivate
  2883.       turn_start
  2884.     end
  2885.   end
  2886.   
  2887.   #--------------------------------------------------------------------------
  2888.   # overwrite method: execute_action
  2889.   #--------------------------------------------------------------------------
  2890.   def execute_action
  2891.     @subject.sprite_effect_type = :whiten if YEA::BATTLE::FLASH_WHITE_EFFECT
  2892.     use_item
  2893.     @log_window.wait_and_clear
  2894.   end
  2895.   
  2896.   #--------------------------------------------------------------------------
  2897.   # overwrite method: apply_item_effects
  2898.   #--------------------------------------------------------------------------
  2899.   def apply_item_effects(target, item)
  2900.     if $imported["YEA-LunaticObjects"]
  2901.       lunatic_object_effect(:prepare, item, @subject, target)
  2902.     end
  2903.     target.item_apply(@subject, item)
  2904.     status_redraw_target(@subject)
  2905.     status_redraw_target(target) unless target == @subject
  2906.     @log_window.display_action_results(target, item)
  2907.     if $imported["YEA-LunaticObjects"]
  2908.       lunatic_object_effect(:during, item, @subject, target)
  2909.     end
  2910.     perform_collapse_check(target)
  2911.   end
  2912.   
  2913.   #--------------------------------------------------------------------------
  2914.   # overwite method: invoke_counter_attack
  2915.   #--------------------------------------------------------------------------
  2916.   def invoke_counter_attack(target, item)
  2917.     @log_window.display_counter(target, item)
  2918.     attack_skill = $data_skills[target.attack_skill_id]
  2919.     @subject.item_apply(target, attack_skill)
  2920.     status_redraw_target(@subject)
  2921.     status_redraw_target(target) unless target == @subject
  2922.     @log_window.display_action_results(@subject, attack_skill)
  2923.     perform_collapse_check(target)
  2924.     perform_collapse_check(@subject)
  2925.   end
  2926.   
  2927.   #--------------------------------------------------------------------------
  2928.   # new method: perform_collapse_check
  2929.   #--------------------------------------------------------------------------
  2930.   def perform_collapse_check(target)
  2931.     return if YEA::BATTLE::MSG_ADDED_STATES
  2932.     target.perform_collapse_effect if target.can_collapse?
  2933.     @log_window.wait
  2934.     @log_window.wait_for_effect
  2935.   end
  2936.   
  2937.   #--------------------------------------------------------------------------
  2938.   # overwrite method: show_attack_animation
  2939.   #--------------------------------------------------------------------------
  2940.   def show_attack_animation(targets)
  2941.     show_normal_animation(targets, @subject.atk_animation_id1, false)
  2942.     wait_for_animation
  2943.     show_normal_animation(targets, @subject.atk_animation_id2, true)
  2944.   end
  2945.   
  2946.   #--------------------------------------------------------------------------
  2947.   # overwrite method: show_normal_animation
  2948.   #--------------------------------------------------------------------------
  2949.   def show_normal_animation(targets, animation_id, mirror = false)
  2950.     animation = $data_animations[animation_id]
  2951.     return if animation.nil?
  2952.     ani_check = false
  2953.     targets.each do |target|
  2954.       if ani_check && target.animation_id <= 0
  2955.         target.pseudo_ani_id = animation_id
  2956.       else
  2957.         target.animation_id = animation_id
  2958.       end
  2959.       target.animation_mirror = mirror
  2960.       ani_check = true if animation.to_screen?
  2961.     end
  2962.   end
  2963.   
  2964.   #--------------------------------------------------------------------------
  2965.   # overwrite method: process_action_end
  2966.   #--------------------------------------------------------------------------
  2967.   def process_action_end
  2968.     @subject.on_action_end
  2969.     status_redraw_target(@subject)
  2970.     @log_window.display_auto_affected_status(@subject)
  2971.     @log_window.wait_and_clear
  2972.     @log_window.display_current_state(@subject)
  2973.     @log_window.wait_and_clear
  2974.     BattleManager.judge_win_loss
  2975.   end
  2976.   
  2977.   #--------------------------------------------------------------------------
  2978.   # overwrite method: use_item
  2979.   #--------------------------------------------------------------------------
  2980.   def use_item
  2981.     item = @subject.current_action.item
  2982.     @log_window.display_use_item(@subject, item)
  2983.     @subject.use_item(item)
  2984.     status_redraw_target(@subject)
  2985.     if $imported["YEA-LunaticObjects"]
  2986.       lunatic_object_effect(:before, item, @subject, @subject)
  2987.     end
  2988.     process_casting_animation if $imported["YEA-CastAnimations"]
  2989.     targets = @subject.current_action.make_targets.compact rescue []
  2990.     show_animation(targets, item.animation_id) if show_all_animation?(item)
  2991.     targets.each {|target|
  2992.       if $imported["YEA-TargetManager"]
  2993.         target = alive_random_target(target, item) if item.for_random?
  2994.       end
  2995.       item.repeats.times { invoke_item(target, item) } }
  2996.     if $imported["YEA-LunaticObjects"]
  2997.       lunatic_object_effect(:after, item, @subject, @subject)
  2998.     end
  2999.   end
  3000.   
  3001.   #--------------------------------------------------------------------------
  3002.   # alias method: invoke_item
  3003.   #--------------------------------------------------------------------------
  3004.   alias scene_battle_invoke_item_abe invoke_item
  3005.   def invoke_item(target, item)
  3006.     show_animation([target], item.animation_id) if separate_ani?(target, item)
  3007.     if target.dead? != item.for_dead_friend?
  3008.       @subject.last_target_index = target.index
  3009.       return
  3010.     end
  3011.     scene_battle_invoke_item_abe(target, item)
  3012.   end
  3013.   
  3014.   #--------------------------------------------------------------------------
  3015.   # new method: show_all_animation?
  3016.   #--------------------------------------------------------------------------
  3017.   def show_all_animation?(item)
  3018.     return true if item.one_animation
  3019.     return false if $data_animations[item.animation_id].nil?
  3020.     return false unless $data_animations[item.animation_id].to_screen?
  3021.     return true
  3022.   end
  3023.   
  3024.   #--------------------------------------------------------------------------
  3025.   # new method: separate_ani?
  3026.   #--------------------------------------------------------------------------
  3027.   def separate_ani?(target, item)
  3028.     return false if item.one_animation
  3029.     return false if $data_animations[item.animation_id].nil?
  3030.     return false if $data_animations[item.animation_id].to_screen?
  3031.     return target.dead? == item.for_dead_friend?
  3032.   end
  3033.   
  3034.   #--------------------------------------------------------------------------
  3035.   # new method: status_redraw_target
  3036.   #--------------------------------------------------------------------------
  3037.   def status_redraw_target(target)
  3038.     return unless target.actor?
  3039.     @status_window.draw_item($game_party.battle_members.index(target))
  3040.   end
  3041.   
  3042.   #--------------------------------------------------------------------------
  3043.   # alias method: start_party_command_selection
  3044.   #--------------------------------------------------------------------------
  3045.   alias start_party_command_selection_abe start_party_command_selection
  3046.   def start_party_command_selection
  3047.     @status_window.refresh unless scene_changing?
  3048.     start_party_command_selection_abe
  3049.   end
  3050.   
  3051.   #--------------------------------------------------------------------------
  3052.   # overwrite method: refresh_status
  3053.   #--------------------------------------------------------------------------
  3054.   def refresh_status; return; end
  3055.   
  3056.   #--------------------------------------------------------------------------
  3057.   # new method: refresh_autobattler_status_window
  3058.   #--------------------------------------------------------------------------
  3059.   def refresh_autobattler_status_window
  3060.     for member in $game_party.battle_members
  3061.       next unless member.auto_battle?
  3062.       @status_window.draw_item(member.index)
  3063.     end
  3064.   end
  3065.   
  3066.   #--------------------------------------------------------------------------
  3067.   # new method: hide_extra_gauges
  3068.   #--------------------------------------------------------------------------
  3069.   def hide_extra_gauges
  3070.     # Made for compatibility
  3071.   end
  3072.   
  3073.   #--------------------------------------------------------------------------
  3074.   # new method: show_extra_gauges
  3075.   #--------------------------------------------------------------------------
  3076.   def show_extra_gauges
  3077.     # Made for compatibility
  3078.   end
  3079.   
  3080. end # Scene_Battle
  3081. #==============================================================================
  3082. #
  3083. # ▼ YSA Battle System: Classical ATB
  3084. # -- Last Updated: 2012.01.20
  3085. # -- Level: Easy, Normal
  3086. # -- Requires: YEA - Ace Battle Engine v1.15+.
  3087. #
  3088. #==============================================================================

  3089. $imported = {} if $imported.nil?
  3090. $imported["YSA-CATB"] = true

  3091. #==============================================================================
  3092. # ▼ Updates
  3093. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3094. # 2012.01.20 - Compatible with: Lunatic CATB Rate.
  3095. #            - Fix a bug with first strike.
  3096. # 2012.01.19 - Fix a small bug with Action's Icon Updating.
  3097. #            - Fix a critical bug with target selecting.
  3098. #            - Fix a bug with states updating.
  3099. #            - Fix a small bug with actor's status when choosing skill/item.
  3100. #            - Fix a critical bug with auto battle.
  3101. # 2012.01.16 - Fix ATB speed changes when a battler's agi changes.
  3102. #            - Add casting time.
  3103. # 2012.01.16 - Add a function for preemptive strike and surprised.
  3104. #            - Fix a small bug with make action.
  3105. # 2012.01.13 - Bugfix for ATB Type Wait.
  3106. #            - Upgrade a little ATB gauge.
  3107. #            - Upgrade turn count.
  3108. #            - Compatible with: Lunatic CATB Start.
  3109. # 2012.01.12 - Started Script and Finished.
  3110. #
  3111. #==============================================================================
  3112. # ▼ Introduction
  3113. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3114. # This script will add a battle type into YEA Battle Engine Ace.
  3115. # Battle Type: Classical ATB.
  3116. #
  3117. #==============================================================================
  3118. # ▼ Instructions
  3119. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3120. # To install this script, open up your script editor and copy/paste this script
  3121. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  3122. #
  3123. # First, set the default battle system for your game to be :catb by either going
  3124. # to the Ace Battle Engine script and setting DEFAULT_BATTLE_SYSTEM as :catb or
  3125. # by using the following script call:
  3126. #
  3127. # $game_system:set_battle_system(:catb)
  3128. #
  3129. # Second, you can set the default wait for your game by either setting DEFAULT_WAIT
  3130. # or using the following script call:
  3131. #
  3132. # $game_system:set_catb_wait_type(wait_type)
  3133. #
  3134. # Which there are 4 types:
  3135. #   - :full     : ATB always run, except when animation run
  3136. #   - :quarter  : ATB pause when select skill/item/target
  3137. #   - :semi     : ATB pause when select target
  3138. #   - :wait     : ATB pause when choose action for actor
  3139. #
  3140. # Third, you can set the default turn counting for your game by either setting
  3141. # DEFAULT_TURN or using the following script call:
  3142. #
  3143. # $game_system:set_catb_turn_type(turn_type)
  3144. #
  3145. # Which there are 2 types:
  3146. #   - :tick     : Count as a turn after X frame
  3147. #   - :action   : Count as a turn after X actions
  3148. #
  3149. # -----------------------------------------------------------------------------
  3150. # Skill/Item Notetags - These notetags go in the skill/item notebox in the database.
  3151. # -----------------------------------------------------------------------------
  3152. # <charge rate: x%>
  3153. # Enable casting time (skill charge) for Skill or Item. Skill/Item will be charged
  3154. # at normal ATB filled speed * x%, which means it will be charged at x% rate.
  3155. #
  3156. #==============================================================================
  3157. # ▼ Compatibility
  3158. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3159. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  3160. # it will run with RPG Maker VX without adjusting.
  3161. #
  3162. # This script requires Yanfly Engine Ace - Ace Battle Engine v1.15+ and the
  3163. # script must be placed under Ace Battle Engine in the script listing.
  3164. #
  3165. #==============================================================================

  3166. #==============================================================================
  3167. # ▼ Configuration
  3168. #==============================================================================

  3169. module YSA
  3170.   module CATB
  3171.    
  3172.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3173.     # - General Configuration -
  3174.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3175.     DEFAULT_FILL_TIME = 120 # Frames
  3176.     DEFAULT_WAIT      = :wait # :full, :semi, :quarter, :wait
  3177.     FILL_TIME_VARIABLE  = 15 # Change DEFAULT_FILL_TIME by variable.
  3178.    
  3179.     PAUSE_WHEN_ACTIVE_PARTY_COMMAND = true
  3180.    
  3181.     PREEMTIVE_ATB_ACTOR = 70
  3182.     PREEMTIVE_ATB_ENEMY = 0
  3183.     SURPRISE_ATB_ACTOR = 0
  3184.     SURPRISE_ATB_ENEMY = 70
  3185.    
  3186.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3187.     # - Turn Configuration -
  3188.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3189.     DEFAULT_TURN          = :action # :tick, :action
  3190.    
  3191.     TICK_COUNT            = 150    # Turn after TICK_COUNT
  3192.     TICK_COUNT_VARIABLE   = 16     # Change TICK_COUNT by variable.
  3193.    
  3194.     AFTER_ACTION          = 1      # Turn after AFTER_ACTION actions.
  3195.     AFTER_ACTION_VARIABLE  = 17     # Change AFTER_ACTION by variable.
  3196.    
  3197.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3198.     # - Actor ATB Gauges -
  3199.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3200.     GAUGE_COLOR1 = 32
  3201.     GAUGE_COLOR2 = 31
  3202.     CHARGE_COLOR1 = 18
  3203.     CHARGE_COLOR2 = 10
  3204.     ATB_GAUGE_Y_PLUS = 12
  3205.     ATB_PHRASE = "ATB"
  3206.    
  3207.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3208.     # - Enemy ATB Gauges -
  3209.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3210.     SHOW_ENEMY_ATB_GAUGE    = true  # Display Enemy HP Gauge?
  3211.     ENEMY_GAUGE_WIDTH      = 128    # How wide the enemy gauges are.
  3212.     ENEMY_GAUGE_HEIGHT     = 12     # How tall the enemy gauges are.
  3213.     ENEMY_ATB_GAUGE_COLOUR1 = 1     # Colour 1 for ATB.
  3214.     ENEMY_ATB_GAUGE_COLOUR2 = 4     # Colour 2 for ATB.
  3215.     ENEMY_BACKGAUGE_COLOUR = 19     # Gauge Back colour.
  3216.    
  3217.   end
  3218. end

  3219. #==============================================================================
  3220. # ▼ Editting anything past this point may potentially result in causing
  3221. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  3222. # halitosis so edit at your own risk.
  3223. #==============================================================================

  3224. module YSA
  3225.   module REGEXP
  3226.   module USABLEITEM
  3227.    
  3228.     CHARGE_RATE = /<(?:CHARGE_RATE|charge rate):[ ](\d+)?([%%])>/i
  3229.    
  3230.   end # USABLEITEM
  3231.   end # REGEXP
  3232. end # YSA

  3233. #==============================================================================
  3234. # ■ DataManager
  3235. #==============================================================================

  3236. module DataManager
  3237.   
  3238.   #--------------------------------------------------------------------------
  3239.   # alias method: load_database
  3240.   #--------------------------------------------------------------------------
  3241.   class <<self; alias load_database_catb load_database; end
  3242.   def self.load_database
  3243.     load_database_catb
  3244.     load_notetags_catb
  3245.   end
  3246.   
  3247.   #--------------------------------------------------------------------------
  3248.   # new method: load_notetags_catb
  3249.   #--------------------------------------------------------------------------
  3250.   def self.load_notetags_catb
  3251.     groups = [$data_skills, $data_items]
  3252.     for group in groups
  3253.       for obj in group
  3254.         next if obj.nil?
  3255.         obj.load_notetags_catb
  3256.       end
  3257.     end
  3258.   end
  3259.   
  3260. end # DataManager

  3261. #==============================================================================
  3262. # ■ RPG::UsableItem
  3263. #==============================================================================

  3264. class RPG::UsableItem < RPG::BaseItem

  3265.   #--------------------------------------------------------------------------
  3266.   # public instance variables
  3267.   #--------------------------------------------------------------------------
  3268.   attr_accessor :charge_rate
  3269.   attr_accessor :charge_on
  3270.   
  3271.   #--------------------------------------------------------------------------
  3272.   # common cache: load_notetags_catb
  3273.   #--------------------------------------------------------------------------
  3274.   def load_notetags_catb
  3275.     @charge_rate = 100
  3276.     @charge_on = false
  3277.     #---
  3278.     self.note.split(/[\r\n]+/).each { |line|
  3279.       case line
  3280.       #---
  3281.       when YSA::REGEXP::USABLEITEM::CHARGE_RATE
  3282.         @charge_on = true
  3283.         @charge_rate = $1.to_i
  3284.       #---
  3285.       end
  3286.     } # self.note.split
  3287.     #---
  3288.     @charge_rate = 100 if @charge_rate <= 0
  3289.   end
  3290.   
  3291. end # RPG::UsableItem

  3292. #==============================================================================
  3293. # ■ BattleManager
  3294. #==============================================================================

  3295. module BattleManager
  3296.   
  3297.   #--------------------------------------------------------------------------
  3298.   # alias method:
  3299.   #     - make_action_orders
  3300.   #     - prior_command
  3301.   #     - next_command
  3302.   #     - in_turn?
  3303.   #     - battle_start
  3304.   #--------------------------------------------------------------------------
  3305.   class <<self
  3306.     alias catb_make_action_orders make_action_orders
  3307.     alias catb_prior_command prior_command
  3308.     alias catb_next_command next_command
  3309.     alias catb_in_turn? in_turn?
  3310.     alias catb_battle_start battle_start
  3311.   end
  3312.   
  3313.   #--------------------------------------------------------------------------
  3314.   # battle_start
  3315.   #--------------------------------------------------------------------------
  3316.   def self.battle_start
  3317.     catb_battle_start
  3318.     if btype?(:catb)
  3319.       @average_agi = 0
  3320.       make_catb_action_orders
  3321.       battler_hash = $game_party.members + $game_troop.members
  3322.       battler_hash.each { |a|
  3323.         if @preemptive
  3324.           a.make_first_catb_value(1)
  3325.         elsif @surprise
  3326.           a.make_first_catb_value(2)
  3327.         else
  3328.           a.make_first_catb_value(0)
  3329.         end
  3330.         @average_agi += a.agi
  3331.       }
  3332.       @average_agi /= battler_hash.size
  3333.     end
  3334.   end
  3335.   
  3336.   #--------------------------------------------------------------------------
  3337.   # next_command
  3338.   #--------------------------------------------------------------------------
  3339.   def self.next_command
  3340.     return false if btype?(:catb)
  3341.     catb_next_command
  3342.   end
  3343.   
  3344.   #--------------------------------------------------------------------------
  3345.   # alias method: in_turn?
  3346.   #--------------------------------------------------------------------------
  3347.   def self.in_turn?
  3348.     return true if btype?(:catb)
  3349.     return catb_in_turn?
  3350.   end
  3351.   
  3352.   #--------------------------------------------------------------------------
  3353.   # new method: make_catb_action_orders
  3354.   #--------------------------------------------------------------------------
  3355.   class <<self
  3356.   def make_catb_action_orders
  3357.     @action_actors = []
  3358.     @action_enemies = []
  3359.     @action_battlers = []
  3360.   end
  3361.   end
  3362.   
  3363.   #--------------------------------------------------------------------------
  3364.   # new method: average_agi
  3365.   #--------------------------------------------------------------------------
  3366.   class <<self
  3367.   def average_agi
  3368.     return @average_agi
  3369.   end
  3370.   end
  3371.   
  3372.   #--------------------------------------------------------------------------
  3373.   # new method: set_actor
  3374.   #--------------------------------------------------------------------------
  3375.   class <<self
  3376.   def set_actor(actor_index)
  3377.     @actor_index = actor_index
  3378.   end
  3379.   end
  3380.   
  3381.   #--------------------------------------------------------------------------
  3382.   # prior_command
  3383.   #--------------------------------------------------------------------------
  3384.   def self.prior_command
  3385.     return false if btype?(:catb)
  3386.     catb_prior_command
  3387.   end
  3388.   
  3389.   #--------------------------------------------------------------------------
  3390.   # new method: make_catb_action
  3391.   #--------------------------------------------------------------------------
  3392.   class <<self
  3393.   def make_catb_action(battler)
  3394.     make_catb_action_orders if !@action_battlers || !@action_actors || !@action_enemies
  3395.     return false if @action_battlers.include?(battler)
  3396.     @action_battlers.push(battler)
  3397.     @action_actors.push(battler) if battler.actor?
  3398.     @action_enemies.push(battler) if battler.enemy?
  3399.     return true
  3400.   end
  3401.   end
  3402.   
  3403.   #--------------------------------------------------------------------------
  3404.   # new method: delete_catb_action
  3405.   #--------------------------------------------------------------------------
  3406.   class <<self
  3407.   def delete_catb_action(battler)
  3408.     return false if !battler
  3409.     @action_battlers.delete(battler)
  3410.     @action_battlers = @action_battlers.compact
  3411.     @action_actors.delete(battler) if battler.actor?
  3412.     @action_actors = @action_actors.compact
  3413.     @action_enemies.delete(battler) if battler.enemy?
  3414.     @action_enemies = @action_enemies.compact
  3415.     return true
  3416.   end
  3417.   end
  3418.   
  3419.   #--------------------------------------------------------------------------
  3420.   # new method: action_list
  3421.   #--------------------------------------------------------------------------
  3422.   class <<self
  3423.   def action_list(type = :all)
  3424.     return @action_battlers if type == :all
  3425.     return @action_actors if type == :actor
  3426.     return @action_enemies if type = :enemy
  3427.   end
  3428.   end
  3429.   
  3430. end # BattleManager

  3431. #==============================================================================
  3432. # ■ Game_System
  3433. #==============================================================================

  3434. class Game_System
  3435.   
  3436.   #--------------------------------------------------------------------------
  3437.   # alias method: set_battle_system
  3438.   #--------------------------------------------------------------------------
  3439.   alias qatb_set_battle_system set_battle_system
  3440.   def set_battle_system(type)
  3441.     case type
  3442.     when :catb; @battle_system = :catb
  3443.     else;       qatb_set_battle_system(type)
  3444.     end
  3445.   end
  3446.   
  3447.   #--------------------------------------------------------------------------
  3448.   # alias method: battle_system_corrected
  3449.   #--------------------------------------------------------------------------
  3450.   alias qatb_battle_system_corrected battle_system_corrected
  3451.   def battle_system_corrected(type)
  3452.     case type
  3453.     when :catb; return :catb
  3454.     else;       return qatb_battle_system_corrected(type)
  3455.     end
  3456.   end
  3457.   
  3458.   #--------------------------------------------------------------------------
  3459.   # new method: catb_fill_time
  3460.   #--------------------------------------------------------------------------
  3461.   def catb_fill_time
  3462.     return $game_variables[YSA::CATB::FILL_TIME_VARIABLE] > 0 ? $game_variables[YSA::CATB::FILL_TIME_VARIABLE] : YSA::CATB::DEFAULT_FILL_TIME
  3463.   end
  3464.   
  3465.   #--------------------------------------------------------------------------
  3466.   # new method: catb_tick_count
  3467.   #--------------------------------------------------------------------------
  3468.   def catb_tick_count
  3469.     return $game_variables[YSA::CATB::TICK_COUNT_VARIABLE] > 0 ? $game_variables[YSA::CATB::TICK_COUNT_VARIABLE] : YSA::CATB::TICK_COUNT
  3470.   end
  3471.   
  3472.   #--------------------------------------------------------------------------
  3473.   # new method: catb_after_action
  3474.   #--------------------------------------------------------------------------
  3475.   def catb_after_action
  3476.     return $game_variables[YSA::CATB::AFTER_ACTION_VARIABLE] > 0 ? $game_variables[YSA::CATB::AFTER_ACTION_VARIABLE] : YSA::CATB::AFTER_ACTION
  3477.   end
  3478.   
  3479.   #--------------------------------------------------------------------------
  3480.   # new method: catb_turn_type
  3481.   #--------------------------------------------------------------------------
  3482.   def catb_turn_type
  3483.     return @catb_turn_type ? @catb_turn_type : YSA::CATB::DEFAULT_TURN
  3484.   end
  3485.   
  3486.   #--------------------------------------------------------------------------
  3487.   # new method: catb_wait_type
  3488.   #--------------------------------------------------------------------------
  3489.   def catb_wait_type
  3490.     return @catb_wait_type ? @catb_wait_type : YSA::CATB::DEFAULT_WAIT
  3491.   end
  3492.   
  3493.   #--------------------------------------------------------------------------
  3494.   # new method: set_catb_wait_type
  3495.   #--------------------------------------------------------------------------
  3496.   def set_catb_wait_type(type = :full)
  3497.     @catb_wait_type = type
  3498.   end
  3499.   
  3500.   #--------------------------------------------------------------------------
  3501.   # new method: set_catb_turn_type
  3502.   #--------------------------------------------------------------------------
  3503.   def set_catb_turn_type(type = :tick)
  3504.     @catb_turn_type = type
  3505.   end
  3506.   
  3507. end # Game_System

  3508. #==============================================================================
  3509. # ■ Game_Battler
  3510. #==============================================================================

  3511. class Game_Battler < Game_BattlerBase
  3512.   
  3513.   MAX_CATB_VALUE = 100000.0
  3514.   
  3515.   #--------------------------------------------------------------------------
  3516.   # alias method: initialize
  3517.   #--------------------------------------------------------------------------
  3518.   alias catb_initialize initialize
  3519.   def initialize
  3520.     catb_initialize
  3521.     @catb_value = 0
  3522.     @ct_catb_value = 0
  3523.   end
  3524.   
  3525.   #--------------------------------------------------------------------------
  3526.   # new method: base_gain_catb
  3527.   #--------------------------------------------------------------------------
  3528.   def base_gain_catb
  3529.     return MAX_CATB_VALUE / $game_system.catb_fill_time
  3530.   end
  3531.   
  3532.   #--------------------------------------------------------------------------
  3533.   # new method: real_gain_catb
  3534.   #--------------------------------------------------------------------------
  3535.   def real_gain_catb
  3536.     value = (self.agi.to_f / BattleManager.average_agi) * base_gain_catb
  3537.     return value
  3538.   end
  3539.   
  3540.   #--------------------------------------------------------------------------
  3541.   # new method: make_catb_update
  3542.   #--------------------------------------------------------------------------
  3543.   def make_catb_update
  3544.     return if @catb_value >= MAX_CATB_VALUE
  3545.     return if not normal?
  3546.     value = $imported["YSA-LunaticCATBRate"] ? lunatic_catb_rate_formula : real_gain_catb
  3547.     @catb_value += [value, MAX_CATB_VALUE - @catb_value].min
  3548.   end
  3549.   
  3550.   #--------------------------------------------------------------------------
  3551.   # new method: make_catb_action
  3552.   #--------------------------------------------------------------------------
  3553.   def make_catb_action
  3554.     return unless @catb_value >= MAX_CATB_VALUE
  3555.     return clear_catb if not normal?
  3556.     return BattleManager.make_catb_action(self)
  3557.   end
  3558.   
  3559.   #--------------------------------------------------------------------------
  3560.   # new method: make_ct_catb_update
  3561.   #--------------------------------------------------------------------------
  3562.   def make_ct_catb_update
  3563.     return if @catb_value < MAX_CATB_VALUE
  3564.     return if @ct_catb_value >= MAX_CATB_VALUE
  3565.     return if !self.current_action
  3566.     return if !self.current_action.item
  3567.     return if self.actor? && !self.current_action.confirm
  3568.     clear_catb if not normal?
  3569.     @ct_catb_value = MAX_CATB_VALUE if !self.current_action.item.charge_on
  3570.     value = $imported["YSA-LunaticCATBRate"] ? lunatic_catb_rate_formula : real_gain_catb
  3571.     @ct_catb_value += [value * self.current_action.item.charge_rate / 100, MAX_CATB_VALUE - @ct_catb_value].min
  3572.   end
  3573.   
  3574.   #--------------------------------------------------------------------------
  3575.   # new method: charge_skill_done?
  3576.   #--------------------------------------------------------------------------
  3577.   def charge_skill_done?
  3578.     return @catb_value >= MAX_CATB_VALUE && @ct_catb_value >= MAX_CATB_VALUE
  3579.   end
  3580.   
  3581.   #--------------------------------------------------------------------------
  3582.   # new method: clear_catb
  3583.   #--------------------------------------------------------------------------
  3584.   def clear_catb
  3585.     make_actions
  3586.     @catb_value = 0
  3587.     @ct_catb_value = 0
  3588.     BattleManager.clear_actor if self.actor? && BattleManager.actor == self
  3589.     BattleManager.delete_catb_action(self)
  3590.   end
  3591.   
  3592.   #--------------------------------------------------------------------------
  3593.   # new method: make_first_catb_value
  3594.   #--------------------------------------------------------------------------
  3595.   def make_first_catb_value(pre = 0)
  3596.     make_actions
  3597.     @catb_value = 0
  3598.     @catb_value = YSA::CATB::PREEMTIVE_ATB_ACTOR if self.actor? && pre == 1
  3599.     @catb_value = YSA::CATB::PREEMTIVE_ATB_ENEMY if self.enemy? && pre == 1
  3600.     @catb_value = YSA::CATB::SURPRISE_ATB_ACTOR if self.actor? && pre == 2
  3601.     @catb_value = YSA::CATB::SURPRISE_ATB_ENEMY if self.enemy? && pre == 2
  3602.     lunatic_catb_start_formula(pre) if $imported["YSA-LunaticCATBStart"]
  3603.   end
  3604.   
  3605.   #--------------------------------------------------------------------------
  3606.   # new method: catb_filled_rate
  3607.   #--------------------------------------------------------------------------
  3608.   def catb_filled_rate
  3609.     return @catb_value / MAX_CATB_VALUE
  3610.   end
  3611.   
  3612.   #--------------------------------------------------------------------------
  3613.   # new method: catb_ct_filled_rate
  3614.   #--------------------------------------------------------------------------
  3615.   def catb_ct_filled_rate
  3616.     return @catb_value < MAX_CATB_VALUE ? 0 : @ct_catb_value / MAX_CATB_VALUE
  3617.   end
  3618.   
  3619. end # Game_Battler

  3620. #==============================================================================
  3621. # ■ Game_Action
  3622. #==============================================================================

  3623. class Game_Action
  3624.    
  3625.   #--------------------------------------------------------------------------
  3626.   # alias method: clear
  3627.   #--------------------------------------------------------------------------
  3628.   alias catb_clear clear
  3629.   def clear
  3630.     catb_clear
  3631.     @confirm = false
  3632.   end
  3633.   
  3634.   #--------------------------------------------------------------------------
  3635.   # new method: confirm=
  3636.   #--------------------------------------------------------------------------
  3637.   def confirm=(con)
  3638.     @confirm = con
  3639.   end
  3640.   
  3641.   #--------------------------------------------------------------------------
  3642.   # new method: confirm
  3643.   #--------------------------------------------------------------------------
  3644.   def confirm
  3645.     return @subject.auto_battle? ? true : @confirm
  3646.   end

  3647. end # Game_Action

  3648. #==============================================================================
  3649. # ■ Window_Base
  3650. #==============================================================================

  3651. class Window_Base < Window
  3652.   #--------------------------------------------------------------------------
  3653.   # catb_gauge_color
  3654.   #--------------------------------------------------------------------------
  3655.   def catb_color1;      text_color(YSA::CATB::GAUGE_COLOR1);      end;
  3656.   def catb_color2;      text_color(YSA::CATB::GAUGE_COLOR2);      end;
  3657.   def charge_color1;      text_color(YSA::CATB::CHARGE_COLOR1);      end;
  3658.   def charge_color2;      text_color(YSA::CATB::CHARGE_COLOR2);      end;
  3659. end # Window_Base

  3660. #==============================================================================
  3661. # ■ Window_BattleStatus
  3662. #==============================================================================

  3663. class Window_BattleStatus < Window_Selectable
  3664.   
  3665.   #--------------------------------------------------------------------------
  3666.   # alias method: draw_item
  3667.   #--------------------------------------------------------------------------
  3668.   alias catb_draw_item draw_item
  3669.   def draw_item(index)
  3670.     catb_draw_item(index)
  3671.     actor = battle_members[index]
  3672.     rect = item_rect(index)
  3673.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS + YSA::CATB::ATB_GAUGE_Y_PLUS
  3674.     return unless BattleManager.btype?(:catb)
  3675.     draw_actor_catb(actor, rect.x+2, line_height*1+gx, rect.width-4)
  3676.   end
  3677.   
  3678.   #--------------------------------------------------------------------------
  3679.   # new method: draw_actor_catb
  3680.   #--------------------------------------------------------------------------
  3681.   def draw_actor_catb(actor, dx, dy, width = 124)
  3682.     draw_gauge(dx, dy, width, actor.catb_filled_rate, catb_color1, catb_color2)
  3683.     if actor.catb_ct_filled_rate > 0
  3684.       draw_gauge(dx, dy, width, actor.catb_ct_filled_rate, charge_color1, charge_color2)
  3685.     end
  3686.     change_color(system_color)
  3687.     cy = (Font.default_size - contents.font.size) / 2 + 1
  3688.     draw_text(dx+2, dy+cy, 30, line_height, YSA::CATB::ATB_PHRASE)
  3689.   end
  3690.   
  3691.   #--------------------------------------------------------------------------
  3692.   # new method: draw_item_actor_catb
  3693.   #--------------------------------------------------------------------------
  3694.   def draw_item_actor_catb(index)
  3695.     return if index.nil?
  3696.     actor = battle_members[index]
  3697.     rect = item_rect(index)
  3698.     return if actor.nil?
  3699.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS + YSA::CATB::ATB_GAUGE_Y_PLUS
  3700.     draw_actor_catb(actor, rect.x+2, line_height*1+gx, rect.width-4)
  3701.   end
  3702.   
  3703.   #--------------------------------------------------------------------------
  3704.   # new method: refresh_catb
  3705.   #--------------------------------------------------------------------------
  3706.   def refresh_catb
  3707.     return unless BattleManager.btype?(:catb)
  3708.     item_max.times {|i| draw_item_actor_catb(i) }
  3709.   end
  3710.   
  3711. end # Window_BattleStatus

  3712. #==============================================================================
  3713. # ■ Sprite_Battler
  3714. #==============================================================================

  3715. class Sprite_Battler < Sprite_Base
  3716.   
  3717.   #--------------------------------------------------------------------------
  3718.   # alias method: initialize
  3719.   #--------------------------------------------------------------------------
  3720.   alias sprite_battler_initialize_catb initialize
  3721.   def initialize(viewport, battler = nil)
  3722.     sprite_battler_initialize_catb(viewport, battler)
  3723.     create_enemy_gauges_catb
  3724.   end
  3725.   
  3726.   #--------------------------------------------------------------------------
  3727.   # alias method: dispose
  3728.   #--------------------------------------------------------------------------
  3729.   alias sprite_battler_dispose_catb dispose
  3730.   def dispose
  3731.     sprite_battler_dispose_catb
  3732.     dispose_enemy_gauges_catb
  3733.   end
  3734.   
  3735.   #--------------------------------------------------------------------------
  3736.   # alias method: update
  3737.   #--------------------------------------------------------------------------
  3738.   alias sprite_battler_update_catb update
  3739.   def update
  3740.     sprite_battler_update_catb
  3741.     update_enemy_gauges_catb
  3742.   end

  3743.   #--------------------------------------------------------------------------
  3744.   # new method: create_enemy_gauges_catb
  3745.   #--------------------------------------------------------------------------
  3746.   def create_enemy_gauges_catb
  3747.     return if @battler.nil?
  3748.     return if @battler.actor?
  3749.     return unless BattleManager.btype?(:catb)
  3750.     @catb_back_gauge_viewport = Enemy_CATB_Gauge_Viewport.new(@battler, self, :back)
  3751.     @catb_gauge_viewport = Enemy_CATB_Gauge_Viewport.new(@battler, self, :catb)
  3752.     @catb_ct_gauge_viewport = Enemy_CATB_Gauge_Viewport.new(@battler, self, :catbct)
  3753.   end
  3754.   
  3755.   #--------------------------------------------------------------------------
  3756.   # new method: dispose_enemy_gauges_catb
  3757.   #--------------------------------------------------------------------------
  3758.   def dispose_enemy_gauges_catb
  3759.     return unless BattleManager.btype?(:catb)
  3760.     @catb_back_gauge_viewport.dispose unless @catb_back_gauge_viewport.nil?
  3761.     @catb_gauge_viewport.dispose unless @catb_gauge_viewport.nil?
  3762.     @catb_ct_gauge_viewport.dispose unless @catb_ct_gauge_viewport.nil?
  3763.   end
  3764.   
  3765.   #--------------------------------------------------------------------------
  3766.   # new method: update_enemy_gauges_catb
  3767.   #--------------------------------------------------------------------------
  3768.   def update_enemy_gauges_catb
  3769.     return unless BattleManager.btype?(:catb)
  3770.     @catb_back_gauge_viewport.update unless @catb_back_gauge_viewport.nil?
  3771.     @catb_gauge_viewport.update unless @catb_gauge_viewport.nil?
  3772.     @catb_ct_gauge_viewport.update unless @catb_ct_gauge_viewport.nil?
  3773.   end
  3774.   
  3775. end # Sprite_Battler

  3776. #==============================================================================
  3777. # ■ Enemy_CATB_Gauge_Viewport
  3778. #==============================================================================

  3779. class Enemy_CATB_Gauge_Viewport < Viewport
  3780.   
  3781.   #--------------------------------------------------------------------------
  3782.   # initialize
  3783.   #--------------------------------------------------------------------------
  3784.   def initialize(battler, sprite, type)
  3785.     @battler = battler
  3786.     @base_sprite = sprite
  3787.     @type = type
  3788.     dw = YSA::CATB::ENEMY_GAUGE_WIDTH
  3789.     dw += 2 if @type == :back
  3790.     @start_width = dw
  3791.     dh = YSA::CATB::ENEMY_GAUGE_HEIGHT
  3792.     dh += 2 if @type == :back
  3793.     rect = Rect.new(0, 0, dw, dh)
  3794.     super(rect)
  3795.     self.z = 125
  3796.     create_gauge_sprites
  3797.     self.visible = false
  3798.     update_position
  3799.   end
  3800.   
  3801.   #--------------------------------------------------------------------------
  3802.   # dispose
  3803.   #--------------------------------------------------------------------------
  3804.   def dispose
  3805.     @sprite.bitmap.dispose unless @sprite.bitmap.nil?
  3806.     @sprite.dispose
  3807.     super
  3808.   end
  3809.   
  3810.   #--------------------------------------------------------------------------
  3811.   # update
  3812.   #--------------------------------------------------------------------------
  3813.   def update
  3814.     super
  3815.     self.visible = @battler.dead? ? false : YSA::CATB::SHOW_ENEMY_ATB_GAUGE
  3816.     update_position
  3817.     update_gauge
  3818.   end
  3819.   
  3820.   #--------------------------------------------------------------------------
  3821.   # create_gauge_sprites
  3822.   #--------------------------------------------------------------------------
  3823.   def create_gauge_sprites
  3824.     @sprite = Plane.new(self)
  3825.     dw = self.rect.width * 2
  3826.     @sprite.bitmap = Bitmap.new(dw, self.rect.height)
  3827.     case @type
  3828.     when :back
  3829.       colour1 = Colour.text_colour(YSA::CATB::ENEMY_BACKGAUGE_COLOUR)
  3830.       colour2 = Colour.text_colour(YSA::CATB::ENEMY_BACKGAUGE_COLOUR)
  3831.     when :catb
  3832.       colour1 = Colour.text_colour(YSA::CATB::ENEMY_ATB_GAUGE_COLOUR1)
  3833.       colour2 = Colour.text_colour(YSA::CATB::ENEMY_ATB_GAUGE_COLOUR2)
  3834.     when :catbct
  3835.       colour1 = Colour.text_colour(YSA::CATB::CHARGE_COLOR1)
  3836.       colour2 = Colour.text_colour(YSA::CATB::CHARGE_COLOR2)
  3837.     end
  3838.     dx = 0
  3839.     dy = 0
  3840.     dw = self.rect.width
  3841.     dh = self.rect.height
  3842.     self.rect.width = target_gauge_width unless @type == :back
  3843.     @gauge_width = target_gauge_width
  3844.     @sprite.bitmap.gradient_fill_rect(dx, dy, dw, dh, colour1, colour2)
  3845.     @sprite.bitmap.gradient_fill_rect(dw, dy, dw, dh, colour2, colour1)
  3846.   end

  3847.   #--------------------------------------------------------------------------
  3848.   # update_position
  3849.   #--------------------------------------------------------------------------
  3850.   def update_position
  3851.     dx = @battler.screen_x - @start_width / 2
  3852.     self.rect.x = dx
  3853.     dh = self.rect.height + 1
  3854.     dh += 2 unless @type == :back
  3855.     dy = [@battler.screen_y, Graphics.height - dh - 120].min
  3856.     dy += 1 unless @type == :back
  3857.     dy -= YEA::BATTLE::ENEMY_GAUGE_HEIGHT if $imported["YEA-EnemyHPBars"]
  3858.     self.rect.y = dy
  3859.   end
  3860.   
  3861.   #--------------------------------------------------------------------------
  3862.   # update_gauge
  3863.   #--------------------------------------------------------------------------
  3864.   def update_gauge
  3865.     return if @gauge_width == target_gauge_width
  3866.     @gauge_width = target_gauge_width if @type == :catb
  3867.     @gauge_width = target_gauge_width_ct if @type == :catbct
  3868.     return if @type == :back
  3869.     self.rect.width = @gauge_width
  3870.   end
  3871.   
  3872.   #--------------------------------------------------------------------------
  3873.   # target_gauge_width
  3874.   #--------------------------------------------------------------------------
  3875.   def target_gauge_width
  3876.     return @battler.catb_filled_rate * @start_width
  3877.   end
  3878.   
  3879.   #--------------------------------------------------------------------------
  3880.   # target_gauge_width_ct
  3881.   #--------------------------------------------------------------------------
  3882.   def target_gauge_width_ct
  3883.     return @battler.catb_ct_filled_rate * @start_width
  3884.   end
  3885.   
  3886. end # Enemy_CATB_Gauge_Viewport
  3887.   
  3888. #==============================================================================
  3889. # ■ Window_BattleEnemy
  3890. #==============================================================================

  3891. class Window_BattleEnemy < Window_Selectable
  3892.   
  3893.   #--------------------------------------------------------------------------
  3894.   # alias method: col_max
  3895.   #--------------------------------------------------------------------------
  3896.   alias catb_col_max col_max
  3897.   def col_max; return catb_col_max == 0 ? 1 : catb_col_max; end

  3898. end # Window_BattleEnemy

  3899. #==============================================================================
  3900. # ■ Scene_Battle
  3901. #==============================================================================

  3902. class Scene_Battle < Scene_Base
  3903.   
  3904.   #--------------------------------------------------------------------------
  3905.   # alias method: process_action
  3906.   #--------------------------------------------------------------------------
  3907.   alias catb_process_action process_action
  3908.   def process_action
  3909.     process_catb
  3910.     perform_catb_action(@subject, true) if BattleManager.action_forced?
  3911.     catb_process_action unless BattleManager.btype?(:catb)
  3912.   end
  3913.   
  3914.   #--------------------------------------------------------------------------
  3915.   # new method: catb_pause?
  3916.   #--------------------------------------------------------------------------
  3917.   def catb_pause?
  3918.     return YSA::CATB::PAUSE_WHEN_ACTIVE_PARTY_COMMAND if @party_command_window.active
  3919.     return false if $game_system.catb_wait_type == :full
  3920.     return true if $game_system.catb_wait_type == :wait && (@actor_command_window.active || @skill_window.active || @item_window.active || @actor_window.active || @enemy_window.active)
  3921.     return true if $game_system.catb_wait_type == :quarter && (@skill_window.active || @item_window.active || @actor_window.active || @enemy_window.active)
  3922.     return true if $game_system.catb_wait_type == :semi && (@actor_window.active || @enemy_window.active)
  3923.   end
  3924.   
  3925.   #--------------------------------------------------------------------------
  3926.   # new method: process_catb
  3927.   #--------------------------------------------------------------------------
  3928.   def process_catb
  3929.     return unless SceneManager.scene_is?(Scene_Battle)
  3930.     return if scene_changing?
  3931.     return unless BattleManager.btype?(:catb)
  3932.     return if catb_pause?
  3933.     battler_hash = $game_party.members + $game_troop.members
  3934.     battler_hash.each { |a|
  3935.       a.make_catb_update
  3936.       a.make_catb_action
  3937.       a.make_ct_catb_update
  3938.     }
  3939.     #--- Update Tick Turn
  3940.     if $game_system.catb_turn_type == :tick
  3941.       @tick_clock = 0 if !@tick_clock
  3942.       @tick_clock += 1
  3943.       if @tick_clock >= $game_system.catb_tick_count
  3944.         @tick_clock = 0
  3945.         all_battle_members.each { |battler|
  3946.           battler.on_turn_end
  3947.         }
  3948.         @status_window.refresh
  3949.         $game_troop.increase_turn
  3950.       end
  3951.     end
  3952.     #--- Fix make action
  3953.     BattleManager.action_list(:actor).each { |battler|
  3954.       battler.make_actions if (battler.actor? && !battler.input)
  3955.     }
  3956.     #---
  3957.     @status_window.refresh_catb
  3958.     #--- Setup Actor
  3959.     @f_actor_index = 0 if !@f_actor_index || @f_actor_index < 0 || @f_actor_index + 1 > BattleManager.action_list(:actor).size
  3960.     f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  3961.     @f_actor_index += 1 if (@f_actor_index + 1) < BattleManager.action_list(:actor).size && f_actor && f_actor.input && f_actor.input.item && f_actor.input.confirm
  3962.     f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  3963.     if f_actor && f_actor.input && !f_actor.input.item && (!BattleManager.actor || @status_window.index != BattleManager.actor.index)
  3964.       BattleManager.set_actor(f_actor.index)
  3965.       @status_window.select(BattleManager.actor.index)
  3966.       @actor_command_window.setup(BattleManager.actor)
  3967.     end
  3968.     BattleManager.action_list.each { |battler|
  3969.       battler.make_actions if battler.enemy?
  3970.       perform_catb_action(battler) if !@subject
  3971.     }
  3972.   end
  3973.   
  3974.   #--------------------------------------------------------------------------
  3975.   # new method: perform_catb_action
  3976.   #--------------------------------------------------------------------------
  3977.   def perform_catb_action(subject, forced = false)
  3978.     return if subject && !subject.charge_skill_done?
  3979.     return if subject && subject.actor? && !forced && !subject.input
  3980.     return if subject && subject.actor? && !forced && !subject.input.item
  3981.     return if subject && subject.actor? && !forced && !subject.input.confirm
  3982.     @subject = subject if subject
  3983.     return if !@subject
  3984.     if @subject.current_action
  3985.       @subject.current_action.prepare
  3986.       execute_action
  3987.       process_event
  3988.       @status_aid_window.refresh if @status_aid_window.visible
  3989.       if $game_system.catb_turn_type == :action
  3990.         @tick_action = 0 if !@tick_action
  3991.         @tick_action += 1
  3992.         if @tick_action >= $game_system.catb_after_action
  3993.           @tick_action = 0
  3994.           all_battle_members.each { |battler|
  3995.             battler.on_turn_end
  3996.           }
  3997.           @status_window.refresh
  3998.           $game_troop.increase_turn
  3999.         end
  4000.       end
  4001.       @subject.on_action_end
  4002.     end
  4003.     return if BattleManager.judge_win_loss
  4004.     @subject.clear_catb
  4005.     @status_window.draw_item(@subject.index) if @subject.actor?
  4006.     @subject = nil
  4007.   end
  4008.   
  4009.   #--------------------------------------------------------------------------
  4010.   # alias method: create_actor_command_window
  4011.   #--------------------------------------------------------------------------
  4012.   alias catb_create_actor_command_window create_actor_command_window
  4013.   def create_actor_command_window
  4014.     catb_create_actor_command_window
  4015.     if BattleManager.btype?(:catb)
  4016.       @actor_command_window.set_handler(:dir4, method(:prior_f_actor))
  4017.       @actor_command_window.set_handler(:dir6, method(:next_f_actor))
  4018.     end
  4019.   end
  4020.   
  4021.   #--------------------------------------------------------------------------
  4022.   # new method: prior_f_actor
  4023.   #--------------------------------------------------------------------------
  4024.   def prior_f_actor
  4025.     if @f_actor_index && BattleManager.action_list(:actor).size > 0
  4026.       @f_actor_index -= 1
  4027.       @f_actor_index = 0 if @f_actor_index < 0
  4028.       f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  4029.       if f_actor
  4030.         BattleManager.set_actor(f_actor.index)
  4031.         @status_window.select(BattleManager.actor.index)
  4032.         @actor_command_window.setup(BattleManager.actor)
  4033.       end
  4034.     end
  4035.   end
  4036.   
  4037.   #--------------------------------------------------------------------------
  4038.   # new method: next_f_actor
  4039.   #--------------------------------------------------------------------------
  4040.   def next_f_actor
  4041.     if @f_actor_index && BattleManager.action_list(:actor).size > 0
  4042.       @f_actor_index += 1
  4043.       @f_actor_index = 0 if (@f_actor_index + 1) > BattleManager.action_list(:actor).size
  4044.       f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  4045.       if f_actor
  4046.         BattleManager.set_actor(f_actor.index)
  4047.         @status_window.select(BattleManager.actor.index)
  4048.         @actor_command_window.setup(BattleManager.actor)
  4049.       end
  4050.     end
  4051.   end
  4052.   
  4053.   #--------------------------------------------------------------------------
  4054.   # alias method: turn_start
  4055.   #--------------------------------------------------------------------------
  4056.   alias catb_turn_start turn_start
  4057.   def turn_start
  4058.     if BattleManager.btype?(:catb)
  4059.       @party_command_window.close
  4060.       @actor_command_window.close
  4061.       @status_window.unselect
  4062.       @log_window.wait
  4063.       @log_window.clear
  4064.     else
  4065.       catb_turn_start
  4066.     end
  4067.   end
  4068.   
  4069.   #--------------------------------------------------------------------------
  4070.   # alias method: command_guard
  4071.   #--------------------------------------------------------------------------
  4072.   alias catb_command_guard command_guard
  4073.   def command_guard
  4074.     BattleManager.actor.input.confirm = true
  4075.     catb_command_guard
  4076.     @status_window.draw_item(BattleManager.actor.index)
  4077.   end
  4078.   
  4079.   #--------------------------------------------------------------------------
  4080.   # alias method: command_attack
  4081.   #--------------------------------------------------------------------------
  4082.   alias catb_command_attack command_attack
  4083.   def command_attack
  4084.     catb_command_attack
  4085.     @status_window.draw_item(BattleManager.actor.index)
  4086.   end
  4087.   
  4088.   #--------------------------------------------------------------------------
  4089.   # alias method: on_enemy_ok
  4090.   #--------------------------------------------------------------------------
  4091.   alias catb_on_enemy_ok on_enemy_ok
  4092.   def on_enemy_ok
  4093.     BattleManager.actor.input.confirm = true
  4094.     catb_on_enemy_ok
  4095.   end
  4096.   
  4097.   #--------------------------------------------------------------------------
  4098.   # alias method: on_enemy_cancel
  4099.   #--------------------------------------------------------------------------
  4100.   alias catb_on_enemy_cancel on_enemy_cancel
  4101.   def on_enemy_cancel
  4102.     BattleManager.actor.input.confirm = false
  4103.     catb_on_enemy_cancel
  4104.     @status_window.draw_item(BattleManager.actor.index)
  4105.   end
  4106.   
  4107.   #--------------------------------------------------------------------------
  4108.   # alias method: on_actor_ok
  4109.   #--------------------------------------------------------------------------
  4110.   alias catb_on_actor_ok on_actor_ok
  4111.   def on_actor_ok
  4112.     BattleManager.actor.input.confirm = true
  4113.     catb_on_actor_ok
  4114.   end
  4115.   
  4116.   #--------------------------------------------------------------------------
  4117.   # alias method: on_actor_cancel
  4118.   #--------------------------------------------------------------------------
  4119.   alias catb_on_actor_cancel on_actor_cancel
  4120.   def on_actor_cancel
  4121.     BattleManager.actor.input.confirm = false
  4122.     catb_on_actor_cancel
  4123.     @status_window.draw_item(BattleManager.actor.index)
  4124.   end
  4125.   
  4126.   #--------------------------------------------------------------------------
  4127.   # alias method: on_skill_ok
  4128.   #--------------------------------------------------------------------------
  4129.   alias catb_on_skill_ok on_skill_ok
  4130.   def on_skill_ok
  4131.     catb_on_skill_ok
  4132.     @status_window.draw_item(BattleManager.actor.index)
  4133.   end
  4134.   
  4135.   #--------------------------------------------------------------------------
  4136.   # alias method: on_item_ok
  4137.   #--------------------------------------------------------------------------
  4138.   alias catb_on_item_ok on_item_ok
  4139.   def on_item_ok
  4140.     catb_on_item_ok
  4141.     @status_window.draw_item(BattleManager.actor.index)
  4142.   end
  4143.   
  4144.   #--------------------------------------------------------------------------
  4145.   # alias method: update_info_viewport
  4146.   #--------------------------------------------------------------------------
  4147.   alias catb_update_info_viewport update_info_viewport
  4148.   def update_info_viewport
  4149.     catb_update_info_viewport
  4150.     if BattleManager.btype?(:catb)
  4151.       move_info_viewport(128) if @actor_command_window.active || @actor_window.active || @enemy_window.active || (($game_troop.all_dead? || $game_party.all_dead?)&& @bug_fix1)
  4152.       move_info_viewport(0)   if @party_command_window.active
  4153.     end
  4154.   end
  4155.   
  4156.   #--------------------------------------------------------------------------
  4157.   # rewrite method: perform_collapse_check
  4158.   #--------------------------------------------------------------------------
  4159.   def perform_collapse_check(target)
  4160.     return if YEA::BATTLE::MSG_ADDED_STATES
  4161.     if $game_troop.all_dead? || $game_party.all_dead?
  4162.       if @actor_window.active || @enemy_window.active
  4163.         @bug_fix1 = true
  4164.         @help_window.hide
  4165.         @actor_window.hide.deactivate
  4166.         @enemy_window.hide.deactivate
  4167.       end
  4168.     end
  4169.     target.perform_collapse_effect if target.can_collapse?
  4170.     @log_window.wait
  4171.   end
  4172.    
  4173. end # Scene_Battle
  4174. module YEA
  4175.   module BATTLE
  4176.     DEFAULT_BATTLE_SYSTEM = :catb
  4177.   end
  4178. end
  4179. #==============================================================================
  4180. #
  4181. # ▼ End of File
  4182. #
  4183. #==============================================================================
复制代码

作者: kapoleo    时间: 2012-1-25 11:48
本帖最后由 kapoleo 于 2012-1-25 11:48 编辑

神脚本
感谢分享

作者: 忧雪の伤    时间: 2012-1-25 12:09
转载转载,听说要扣50分的,但是为了百姓,50分就50分吧

哪里听说的。
作者: 小镜子    时间: 2012-1-25 12:12
本帖最后由 小镜子 于 2012-1-25 12:17 编辑

LZ...(谁说转载会扣分哒{:nm_9:}←当然是版规规定的正确转载)

地球村规则之转载:
——转载——
1.转载内容请附上原发布地址。
2.除非原发布站允许,否则尽量不要提供任何转载内容的下载。
3.会员个人的转载行为引发的所有版权纠纷,由会员个人负责
作者: 天使喝可乐    时间: 2012-1-25 12:17
不需要素材么- -

作者: V5の小Su    时间: 2012-1-25 12:55
神脚本呀!十分不错的战斗系统了,十分感谢LZ的分享!
作者: xuzhengchi    时间: 2012-1-25 17:20
本帖最后由 xuzhengchi 于 2012-1-25 19:08 编辑

这个长度果然是吐槽点啊
PS:不知道大家有没有遇到这个情况:战斗中执行事件出现对话框后人物的框就没了
作者: 羁绊の终    时间: 2012-1-25 23:05
这个RTAB战斗系统的确很不错的说,完全不用外加素材和复杂的设置、修改,方便又强大~
作者: 一瞬间的幻觉    时间: 2012-1-26 06:06
可惜无图,谢谢分享

作者: 宅宅の男    时间: 2012-1-26 08:22
\囧/真是让人吐血的长度啊!\囧/
作者: xmheart    时间: 2012-1-26 11:17
刚刚把RTAB跟后知后觉大大的横版战斗加在一起,各种出错。。。。。貌似不兼容啊,可是我自己都不知道怎么弄
作者: qq1049323397    时间: 2012-1-26 11:48
话说这脚本该怎么用,第483行出错
作者: 越前リョーマ    时间: 2012-1-26 14:40
连截图也没,这战斗系统叫什么也不说,这年头开个XP工程也不方便……
而且你也没说是XP的?
作者: xmheart    时间: 2012-1-27 10:35
这系统好像是叫Rtab吧…在Rb里提取的…若没猜错…是Ace的
作者: 小小阿狸    时间: 2012-1-28 20:59
反应不理解的问题×2

我想问一下,
这个铲子可以去掉么,
或是在脚本中修改一个地方换图片,
问:如果知道的话,
能不能告诉我在哪里呢.{:nm_4:}


还有,
这个+59是什么意思...
我看也没什么增加的东西啊.
每次行动结束总是显示
+59
{:nm_4:}求解

作者: kapoleo    时间: 2012-1-29 14:50
本帖最后由 kapoleo 于 2012-1-29 14:50 编辑
xuzhengchi 发表于 2012-1-25 17:20
这个长度果然是吐槽点啊
PS:不知道大家有没有遇到这个情况:战斗中执行事件出现对话框后人物的框就 ...


我也是.........=.=
求解......=.=
作者: wasdasd457    时间: 2012-2-4 10:18
@阿尔西斯的马甲  为什么我用了之后升级所需经验都是负的  但是却正常升级。。
然后技能基本上升级几级就全会啦
作者: 東方の蜘蛛    时间: 2012-2-4 19:43
【作者被禁止或删除 内容自动屏蔽】
     谁还有?楼主的我看不到了。
作者: 都不会的新手    时间: 2012-2-4 20:10
为什么被封了?
作者: 月下耶鲁夫    时间: 2012-2-4 20:23
介素什么,为什么我看到是 已屏蔽或删除
作者: 逍遥仙君    时间: 2012-2-4 20:57
本帖最后由 无双sxa 于 2012-3-18 16:26 编辑

LZ由于某种原因被封号了……
————————————————————————

来源:http://yamiworld.wordpress.com/
BUG!!:MP无法显示。
经过研究,没BUG。是因为主角没有消耗MP的技能,有MP没处用,所以不显示。
转载转载,听说要扣50分的,但是为了百姓,50分就50分吧
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Ace Battle Engine v1.18
  4. # -- Last Updated: 2012.01.24
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

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

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.24 - Compatibility Update: Enemy Levels
  15. # 2012.01.18 - Bug Fixed: Help Window clears text upon selecting nil items.
  16. # 2012.01.11 - Added <one animation> tag for multi-hit skills to play an
  17. #              animation only once.
  18. #            - Reduced lag from battle system constantly recreating bitmaps.
  19. # 2012.01.10 - Compatibility Update: Battle System FTB
  20. # 2012.01.09 - Anticrash methods implemented.
  21. #            - Damage Popups are now separate for damage formulas and recovery.
  22. # 2012.01.05 - Bug fixed: Game no longer crashes with escape skills/items.
  23. # 2012.01.02 - Compatibility Update: Target Manager
  24. #            - Added Option: AUTO_FAST
  25. #            - Random hits now show animations individually.
  26. # 2011.12.30 - Compatibility Update: Enemy Levels
  27. #            - Added Option to center the actors in the HUD.
  28. # 2011.12.27 - Bug fixed: TP Damage skills and items no longer crash game.
  29. #            - Default battle system bug fixes are now included from YEA's Ace
  30. #              Core Engine.
  31. #            - Groundwork is also made to support future battle system types.
  32. #            - Multi-hit actions no longer linger when a target dies during the
  33. #              middle of one of the hits.
  34. #            - Compatibility Update: Lunatic Objects v1.02
  35. # 2011.12.26 - Bug fixed: Multi-hit popups occured even after an enemy's dead.
  36. # 2011.12.22 - Bug fixed: Elemental Resistance popup didn't show.
  37. # 2011.12.20 - Bug fixed: Death state popups against immortal states.
  38. #            - Bug fixed: During State popup fix.
  39. #            - Added HIDE_POPUP_SWITCH.
  40. # 2011.12.17 - Compatibiilty Update: Cast Animations
  41. # 2011.12.15 - Compatibility Update: Battle Command List
  42. # 2011.12.14 - Compatibility Update: Lunatic Objects
  43. # 2011.12.13 - Compatibility Update: Command Party
  44. # 2011.12.12 - Bug fixed: Turn stalling if no inputable members.
  45. # 2011.12.10 - Compatibility update for Automatic Party HUD.
  46. #            - Popup graphical bug fixed.
  47. #            - Bug fixed: Didn't wait for boss dead animations.
  48. #            - Bug fixed: Surprise attacks that froze the game.
  49. #            - Bug fixed: Popups didn't show for straight recovery effects.
  50. # 2011.12.08 - Finished Script.
  51. # 2011.12.04 - Started Script.
  52. #
  53. #==============================================================================
  54. # ▼ Introduction
  55. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  56. # Ace Battle Engine works as a foundation for future battle engine add-ons. It
  57. # allows for easier management of the battle engine without adding too many
  58. # features, allowing users to customize what they want as they see fit. While
  59. # the Ace Battle Engine isn't an entirely new engine, it gives users control
  60. # that RPG Maker VX Ace didn't originally give them.
  61. #
  62. # Furthermore, this script provides some new features. They are as follows:
  63. #
  64. # -----------------------------------------------------------------------------
  65. # Animation Fixes
  66. # -----------------------------------------------------------------------------
  67. # Though the Yanfly Engine Ace - Ace Core Engine script contains these fixes,
  68. # these fixes are included in this script as well to ensure it's working for
  69. # the battle script in the event someone chooses not to work with the Ace Core
  70. # Engine script. The animation fixes prevent excessive animation overlaying
  71. # (and making the screen look really ugly) and prevents animation clashing
  72. # between two dual wielding normal attack animations.
  73. #
  74. # -----------------------------------------------------------------------------
  75. # Enemy Animations
  76. # -----------------------------------------------------------------------------
  77. # Enemies now show battle animations when they deliver attacks and skills
  78. # against the player's party. Before in RPG Maker VX Ace, it was nothing more
  79. # than just sound effects and the screen shaking. Now, animations play where
  80. # the status window is and relative to the position of each party member.
  81. #
  82. # -----------------------------------------------------------------------------
  83. # Left/Right Command Selection
  84. # -----------------------------------------------------------------------------
  85. # While choosing actions, the player can press Left or Right to move freely
  86. # between (alive) actors to change their skills. Players no longer have to
  87. # cancel all the way back to change one person's skill and reselect everything.
  88. # On that note, there is now the option that when a battle starts or at the
  89. # end of a turn, players will start immediately at command selection rather
  90. # than needing to select "Fight" in the Party Command Window.
  91. #
  92. # -----------------------------------------------------------------------------
  93. # Popups
  94. # -----------------------------------------------------------------------------
  95. # Dealing damage, inflicting states, adding buffs, landing critical hits,
  96. # striking weaknesses, missing attacks, you name it, there's probably a popup
  97. # for it. Popups deliver information to the player in a quick or orderly
  98. # fashion without requiring the player to read lines of text.
  99. #
  100. # -----------------------------------------------------------------------------
  101. # Targeting Window
  102. # -----------------------------------------------------------------------------
  103. # When targeting enemies, the window is no longer displayed. Instead, the
  104. # targeted enemies are highlighted and their names are shown at the top of the
  105. # screen in a help window. Another thing that's changed is when skills that
  106. # target multiple targets are selected, there is a confirmation step that the
  107. # player must take before continuing. In this confirmation step, all of the
  108. # multiple targets are selected and in the help window would display the scope
  109. # of the skill (such as "All Foes" or "Random Foes"). RPG Maker VX Ace skipped
  110. # this step by default.
  111. #
  112. # -----------------------------------------------------------------------------
  113. # Toggling On and Off Special Effects and Text
  114. # -----------------------------------------------------------------------------
  115. # Not everybody likes having the screen shake or the enemies blink when they
  116. # take damage. These effects can now be toggled on and off. Certain text can
  117. # also be toggled on and off from appearing. A lot of the displayed text has
  118. # been rendered redundant through the use of popups.
  119. #
  120. # -----------------------------------------------------------------------------
  121. # Visual Battle Status Window
  122. # -----------------------------------------------------------------------------
  123. # Rather than just having rows of names with HP and MP bars next to them, the
  124. # Battle Status Window now displays actors' faces and their gauges aligned at
  125. # the bottom. More status effects can be shown in addition to showing more
  126. # members on screen at once. The Battle Status Window is also optimized to
  127. # refresh less (thus, removing potential lag from the system).
  128. #
  129. # -----------------------------------------------------------------------------
  130. # Window Position Changes
  131. # -----------------------------------------------------------------------------
  132. # Windows such as the Skill Window and Item Window have been rearranged to
  133. # always provide the player a clear view of the battlefield rather than opening
  134. # up and covering everything. As such, the window positions are placed at the
  135. # bottom of the screen and are repositioned.
  136. #
  137. #==============================================================================
  138. # ▼ Instructions
  139. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  140. # To install this script, open up your script editor and copy/paste this script
  141. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  142. #
  143. # -----------------------------------------------------------------------------
  144. # Skill Notetags - These notetags go in the skills notebox in the database.
  145. # -----------------------------------------------------------------------------
  146. # <one animation>
  147. # Causes the action to display the action animation only once, even if it's a
  148. # multi-hit action. This is used primarily for non-all scope targeting.
  149. #
  150. # -----------------------------------------------------------------------------
  151. # Item Notetags - These notetags go in the items notebox in the database.
  152. # -----------------------------------------------------------------------------
  153. # <one animation>
  154. # Causes the action to display the action animation only once, even if it's a
  155. # multi-hit action. This is used primarily for non-all scope targeting.
  156. #
  157. # -----------------------------------------------------------------------------
  158. # Enemy Notetags - These notetags go in the enemy notebox in the database.
  159. # -----------------------------------------------------------------------------
  160. # <atk ani 1: x>
  161. # <atk ani 2: x>
  162. # Changes the normal attack animation of the particular enemy to animation x.
  163. # Attack animation 1 is the first one that plays. If there's a second animation
  164. # then the second one will play after in mirrored form.
  165. #
  166. # -----------------------------------------------------------------------------
  167. # State Notetags - These notetags go in the state notebox in the database.
  168. # -----------------------------------------------------------------------------
  169. # <popup add: string>
  170. # <popup rem: string>
  171. # <popup dur: string>
  172. # Status effects now create popups whenever they're inflicted. However, if you
  173. # don't like that a certain status effect uses a particular colour setting,
  174. # change "string" to one of the rulesets below to cause that popup to use a
  175. # different ruleset.
  176. #
  177. # <popup hide add>
  178. # <popup hide rem>
  179. # <popup hide dur>
  180. # Not everybody wants status effects to show popups when inflicted. When this
  181. # is the case, insert the respective tag to hide popups from appearing when the
  182. # state is added, removed, or during the stand-by phases.
  183. #
  184. # -----------------------------------------------------------------------------
  185. # Debug Tools - These tools only work during Test Play.
  186. # -----------------------------------------------------------------------------
  187. # - F5 Key -
  188. # Recovers all actors. Restores their HP and MP to max. Does not affect TP.
  189. # All states and buffs are removed whether they are positive or negative.
  190. #
  191. # - F6 Key -
  192. # Sets all actors to have 1 HP, 0 MP, and 0 TP. States are unaffected.
  193. #
  194. # - F7 Key -
  195. # Sets all actors to have max TP. Everything else is unaffected.
  196. #
  197. # - F8 Key -
  198. # Kills all enemies in battle. Ends the battle quickly.
  199. #
  200. #==============================================================================
  201. # ▼ Compatibility
  202. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  203. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  204. # it will run with RPG Maker VX without adjusting.
  205. #
  206. #==============================================================================

  207. module YEA
  208.   module BATTLE
  209.    
  210.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  211.     # - General Battle Settings -
  212.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  213.     # These settings are adjusted for the overall battle system. These are
  214.     # various miscellaneous options to adjust. Each of the settings below will
  215.     # explain what they do. Change default enemy battle animations here, too.
  216.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  217.     BLINK_EFFECTS      = false  # Blink sprite when damaged?
  218.     FLASH_WHITE_EFFECT = true   # Flash enemy white when it starts an attack.
  219.     SCREEN_SHAKE       = false  # Shake screen in battle?
  220.     SKIP_PARTY_COMMAND = true   # Skips the Fight/Escape menu.
  221.     AUTO_FAST          = true   # Causes message windows to not wait.
  222.     ENEMY_ATK_ANI      = 36     # Sets default attack animation for enemies.
  223.    
  224.     # If this switch is ON, popups will be hidden. If OFF, the popups will be
  225.     # shown. If you do not wish to use this switch, set it to 0.
  226.     HIDE_POPUP_SWITCH  = 0
  227.    
  228.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  229.     # - Battle Status Window -
  230.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  231.     # This sets the default battle system your game will use. If your game
  232.     # doesn't have any other battle systems installed, it will use :dtb.
  233.     #
  234.     # Battle System        Requirement
  235.     #   :dtb               - Default Turn Battle. Default system.
  236.     #   :ftb               - YEA Battle System Add-On: Free Turn Battle
  237.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  238.     DEFAULT_BATTLE_SYSTEM = :dtb     # Default battle system set.
  239.    
  240.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  241.     # - Battle Status Window -
  242.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  243.     # Here, you can adjust the settings for the battle status window. The
  244.     # battle status window, by default, will show the actor's face, HP, MP, TP
  245.     # (if viable), and any inflicted status effects.
  246.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  247.     BATTLESTATUS_NAME_FONT_SIZE = 20    # Font size used for name.
  248.     BATTLESTATUS_TEXT_FONT_SIZE = 16    # Font size used for HP, MP, TP.
  249.     BATTLESTATUS_NO_ACTION_ICON = 185   # No action icon.
  250.     BATTLESTATUS_HPGAUGE_Y_PLUS = 11    # Y Location buffer used for HP gauge.
  251.     BATTLESTATUS_CENTER_FACES   = false # Center faces for the Battle Status.
  252.    
  253.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  254.     # - Help Window Text -
  255.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  256.     # When selecting a target to attack, this is the text that will be shown
  257.     # in place of a target's name for special cases. These special cases are
  258.     # for selections that were originally non-targetable battle scopes.
  259.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  260.     HELP_TEXT_ALL_FOES        = "All Foes"
  261.     HELP_TEXT_ONE_RANDOM_FOE  = "One Random Foe"
  262.     HELP_TEXT_MANY_RANDOM_FOE = "%d Random Foes"
  263.     HELP_TEXT_ALL_ALLIES      = "All Allies"
  264.     HELP_TEXT_ALL_DEAD_ALLIES = "All Dead Allies"
  265.     HELP_TEXT_ONE_RANDOM_ALLY = "One Random Ally"
  266.     HELP_TEXT_RANDOM_ALLIES   = "%d Random Allies"
  267.    
  268.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  269.     # - Popup Settings -
  270.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  271.     # These settings will adjust the popups that appear in battle. Popups
  272.     # deliver information to your player as battlers deal damage, inflict
  273.     # status effects, and more.
  274.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  275.     ENABLE_POPUPS  = true     # Set this to false if you wish to disable them.
  276.     FLASH_CRITICAL = true     # Sets critical hits to flash.
  277.    
  278.     # This hash adjusts the popup settings that will govern how popups appear.
  279.     # Adjust them accordingly.
  280.     POPUP_SETTINGS ={
  281.       :offset     => -24,         # Height offset of a popup.
  282.       :fade       => 12,          # Fade rate for each popup.
  283.       :full       => 60,          # Frames before a popup fades.
  284.       :hp_dmg     => "-%s ",      # SprintF for HP damage.
  285.       :hp_heal    => "+%s ",      # SprintF for HP healing.
  286.       :mp_dmg     => "-%s MP",    # SprintF for MP damage.
  287.       :mp_heal    => "+%s MP",    # SprintF for MP healing.
  288.       :tp_dmg     => "-%s TP",    # SprintF for MP damage.
  289.       :tp_heal    => "+%s TP",    # SprintF for MP healing.
  290.       :drained    => "DRAIN",     # Text display for draining HP/MP.
  291.       :critical   => "CRITICAL!", # Text display for critical hit.
  292.       :missed     => "MISS",      # Text display for missed attack.
  293.       :evaded     => "EVADE!",    # Text display for evaded attack.
  294.       :nulled     => "NULL",      # Text display for nulled attack.
  295.       :failed     => "FAILED",    # Text display for a failed attack.
  296.       :add_state  => "+%s",      # SprintF for added states.
  297.       :rem_state  => "-%s",      # SprintF for removed states.
  298.       :dur_state  => "%s",        # SprintF for during states.
  299.       :ele_rates  => true,        # This will display elemental affinities.
  300.       :ele_wait   => 20,          # This is how many frames will wait.
  301.       :weakpoint  => "WEAKPOINT", # Appears if foe is weak to element.
  302.       :resistant  => "RESIST",    # Appears if foe is resistant to element.
  303.       :immune     => "IMMUNE",    # Appears if foe is immune to element.
  304.       :absorbed   => "ABSORB",    # Appears if foe can absorb the element.
  305.       :add_buff   => "%s+",      # Appears when a positive buff is applied.
  306.       :add_debuff => "%s-",      # Appears when a negative buff is applied.
  307.     } # Do not remove this.
  308.    
  309.     # This is the default font used for the popups. Adjust them accordingly
  310.     # or even add new ones.
  311.     DEFAULT = ["VL Gothic", "Verdana", "Arial", "Courier"]
  312.    
  313.     # The following are the various rules that govern the individual popup
  314.     # types that will appear. Adjust them accordingly. Here is a list of what
  315.     # each category does.
  316.     #   Zoom1    The zoom the popup starts at. Values over 2.0 may cause lag.
  317.     #   Zoom2    The zoom the popup goes to. Values over 2.0 may cause lag.
  318.     #   Sz       The font size used for the popup text.
  319.     #   Bold     Applying bold for the popup text.
  320.     #   Italic   Applying italic for the popup text.
  321.     #   Red      The red value of the popup text.
  322.     #   Grn      The green value of the popup text.
  323.     #   Blu      The blue value of the popup text.
  324.     #   Font     The font used for the popup text.
  325.     POPUP_RULES ={
  326.       # Type     => [ Zoom1, Zoom2, Sz, Bold, Italic, Red, Grn, Blu, Font]
  327.       "DEFAULT"  => [   2.0,   1.0, 24, true,  false, 255, 255, 255, DEFAULT],
  328.       "CRITICAL" => [   2.0,   1.0, 24, true,  false, 255,  80,  80, DEFAULT],
  329.       "HP_DMG"   => [   2.0,   1.0, 36, true,  false, 255, 255, 255, DEFAULT],
  330.       "HP_HEAL"  => [   2.0,   1.0, 36, true,  false, 130, 250, 130, DEFAULT],
  331.       "MP_DMG"   => [   2.0,   1.0, 36, true,  false, 220, 180, 255, DEFAULT],
  332.       "MP_HEAL"  => [   2.0,   1.0, 36, true,  false, 160, 230, 255, DEFAULT],
  333.       "TP_DMG"   => [   2.0,   1.0, 36, true,  false, 242, 108,  78, DEFAULT],
  334.       "TP_HEAL"  => [   2.0,   1.0, 36, true,  false, 251, 175,  92, DEFAULT],
  335.       "ADDSTATE" => [   2.0,   1.0, 24, true,  false, 240, 100, 100, DEFAULT],
  336.       "REMSTATE" => [   2.0,   1.0, 24, true,  false, 125, 170, 225, DEFAULT],
  337.       "DURSTATE" => [   2.0,   1.0, 24, true,  false, 255, 240, 150, DEFAULT],
  338.       "DRAIN"    => [   2.0,   1.0, 36, true,  false, 250, 190, 255, DEFAULT],
  339.       "POSITIVE" => [   2.0,   1.0, 24, true,  false, 110, 210, 245, DEFAULT],
  340.       "NEGATIVE" => [   2.0,   1.0, 24, true,  false, 245, 155, 195, DEFAULT],
  341.       "WEAK_ELE" => [   0.5,   1.0, 24, true,  false, 240, 110,  80, DEFAULT],
  342.       "IMMU_ELE" => [   0.5,   1.0, 24, true,  false, 185, 235, 255, DEFAULT],
  343.       "REST_ELE" => [   0.5,   1.0, 24, true,  false, 145, 230, 180, DEFAULT],
  344.       "ABSB_ELE" => [   0.5,   1.0, 24, true,  false, 250, 190, 255, DEFAULT],
  345.       "BUFF"     => [   2.0,   1.0, 24, true,  false, 255, 240, 100, DEFAULT],
  346.       "DEBUFF"   => [   2.0,   1.0, 24, true,  false, 160, 130, 200, DEFAULT],
  347.     } # Do not remove this.
  348.    
  349.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  350.     # - Streamlined Messages -
  351.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  352.     # Want to remove some of those annoying messages that appear all the time?
  353.     # Now you can! Select which messages you want to enable or disable. Some of
  354.     # these messages will be rendered useless due to popups.
  355.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  356.     MSG_ENEMY_APPEARS  = false  # Message when enemy appears start of battle.
  357.     MSG_CURRENT_STATE  = false  # Show which states has affected battler.
  358.     MSG_CURRENT_ACTION = true   # Show the current action of the battler.
  359.     MSG_COUNTERATTACK  = true   # Show the message for a counterattack.
  360.     MSG_REFLECT_MAGIC  = true   # Show message for reflecting magic attacks.
  361.     MSG_SUBSTITUTE_HIT = true   # Show message for ally taking another's hit.
  362.     MSG_FAILURE_HIT    = false  # Show effect failed against target.
  363.     MSG_CRITICAL_HIT   = false  # Show attack was a critical hit.
  364.     MSG_HIT_MISSED     = false  # Show attack missed the target.
  365.     MSG_EVASION        = false  # Show attack was evaded by the target.
  366.     MSG_HP_DAMAGE      = false  # Show HP damage to target.
  367.     MSG_MP_DAMAGE      = false  # Show MP damage to target.
  368.     MSG_TP_DAMAGE      = false  # Show TP damage to target.
  369.     MSG_ADDED_STATES   = false  # Show target's added states.
  370.     MSG_REMOVED_STATES = false  # Show target's removed states.
  371.     MSG_CHANGED_BUFFS  = false  # Show target's changed buffs.
  372.    
  373.   end # BATTLE
  374. end # YEA

  375. #==============================================================================
  376. # ▼ Editting anything past this point may potentially result in causing
  377. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  378. # halitosis so edit at your own risk.
  379. #==============================================================================

  380. module YEA
  381.   module REGEXP
  382.   module ENEMY
  383.    
  384.     ATK_ANI1 = /<(?:ATK_ANI_1|atk ani 1):[ ]*(\d+)>/i
  385.     ATK_ANI2 = /<(?:ATK_ANI_2|atk ani 2):[ ]*(\d+)>/i
  386.    
  387.   end # ENEMY
  388.   module USABLEITEM
  389.    
  390.     ONE_ANIMATION = /<(?:ONE_ANIMATION|one animation)>/i
  391.    
  392.   end # USABLEITEM
  393.   module STATE
  394.    
  395.     POPUP_ADD = /<(?:POPUP_ADD_RULE|popup add rule|popup add):[ ](.*)>/i
  396.     POPUP_REM = /<(?:POPUP_REM_RULE|popup rem rule|popup rem):[ ](.*)>/i
  397.     POPUP_DUR = /<(?:POPUP_DUR_RULE|popup dur rule|popup dur):[ ](.*)>/i
  398.    
  399.     HIDE_ADD  = /<(?:POPUP_HIDE_ADD|popup hide add|hide add)>/i
  400.     HIDE_REM  = /<(?:POPUP_HIDE_REM|popup hide rem|hide rem)>/i
  401.     HIDE_DUR  = /<(?:POPUP_HIDE_DUR|popup hide dur|hide dur)>/i
  402.    
  403.   end # STATE
  404.   end # REGEXP
  405. end # YEA

  406. #==============================================================================
  407. # ■ Switch
  408. #==============================================================================

  409. module Switch
  410.   
  411.   #--------------------------------------------------------------------------
  412.   # self.hide_popups
  413.   #--------------------------------------------------------------------------
  414.   def self.hide_popups
  415.     return false if YEA::BATTLE::HIDE_POPUP_SWITCH <= 0
  416.     return $game_switches[YEA::BATTLE::HIDE_POPUP_SWITCH]
  417.   end
  418.   
  419. end # Switch

  420. #==============================================================================
  421. # ■ Colour
  422. #==============================================================================

  423. module Colour
  424.   
  425.   #--------------------------------------------------------------------------
  426.   # self.text_colour
  427.   #--------------------------------------------------------------------------
  428.   def self.text_colour(index)
  429.     windowskin = Cache.system("Window")
  430.     x = 64 + (index % 8) * 8
  431.     y = 96 + (index / 8) * 8
  432.     return windowskin.get_pixel(x, y)
  433.   end
  434.   
  435. end # Colour

  436. #==============================================================================
  437. # ■ Icon
  438. #==============================================================================

  439. module Icon
  440.   
  441.   #--------------------------------------------------------------------------
  442.   # self.no_action
  443.   #--------------------------------------------------------------------------
  444.   def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
  445.    
  446. end # Icon

  447. #==============================================================================
  448. # ■ Numeric
  449. #==============================================================================

  450. class Numeric
  451.   
  452.   #--------------------------------------------------------------------------
  453.   # new method: group_digits
  454.   #--------------------------------------------------------------------------
  455.   unless $imported["YEA-CoreEngine"]
  456.   def group; return self.to_s; end
  457.   end # $imported["YEA-CoreEngine"]
  458.    
  459. end # Numeric

  460. #==============================================================================
  461. # ■ DataManager
  462. #==============================================================================

  463. module DataManager
  464.   
  465.   #--------------------------------------------------------------------------
  466.   # alias method: load_database
  467.   #--------------------------------------------------------------------------
  468.   class <<self; alias load_database_abe load_database; end
  469.   def self.load_database
  470.     load_database_abe
  471.     load_notetags_abe
  472.   end
  473.   
  474.   #--------------------------------------------------------------------------
  475.   # new method: load_notetags_abe
  476.   #--------------------------------------------------------------------------
  477.   def self.load_notetags_abe
  478.     groups = [$data_enemies, $data_states, $data_skills, $data_items]
  479.     for group in groups
  480.       for obj in group
  481.         next if obj.nil?
  482.         obj.load_notetags_abe
  483.       end
  484.     end
  485.   end
  486.   
  487. end # DataManager

  488. #==============================================================================
  489. # ■ RPG::UsableItem
  490. #==============================================================================

  491. class RPG::UsableItem < RPG::BaseItem
  492.   
  493.   #--------------------------------------------------------------------------
  494.   # public instance variables
  495.   #--------------------------------------------------------------------------
  496.   attr_accessor :one_animation
  497.   
  498.   #--------------------------------------------------------------------------
  499.   # common cache: load_notetags_abe
  500.   #--------------------------------------------------------------------------
  501.   def load_notetags_abe
  502.     @one_animation = false
  503.     #---
  504.     self.note.split(/[\r\n]+/).each { |line|
  505.       case line
  506.       #---
  507.       when YEA::REGEXP::USABLEITEM::ONE_ANIMATION
  508.         @one_animation = true
  509.       end
  510.     } # self.note.split
  511.     #---
  512.   end
  513.   
  514. end # RPG::UsableItem

  515. #==============================================================================
  516. # ■ RPG::Enemy
  517. #==============================================================================

  518. class RPG::Enemy < RPG::BaseItem
  519.   
  520.   #--------------------------------------------------------------------------
  521.   # public instance variables
  522.   #--------------------------------------------------------------------------
  523.   attr_accessor :atk_animation_id1
  524.   attr_accessor :atk_animation_id2
  525.   
  526.   #--------------------------------------------------------------------------
  527.   # common cache: load_notetags_abe
  528.   #--------------------------------------------------------------------------
  529.   def load_notetags_abe
  530.     @atk_animation_id1 = YEA::BATTLE::ENEMY_ATK_ANI
  531.     @atk_animation_id2 = 0
  532.     #---
  533.     self.note.split(/[\r\n]+/).each { |line|
  534.       case line
  535.       #---
  536.       when YEA::REGEXP::ENEMY::ATK_ANI1
  537.         @atk_animation_id1 = $1.to_i
  538.       when YEA::REGEXP::ENEMY::ATK_ANI2
  539.         @atk_animation_id2 = $1.to_i
  540.       end
  541.     } # self.note.split
  542.     #---
  543.   end
  544.   
  545. end # RPG::Enemy

  546. #==============================================================================
  547. # ■ RPG::Enemy
  548. #==============================================================================

  549. class RPG::State < RPG::BaseItem
  550.   
  551.   #--------------------------------------------------------------------------
  552.   # public instance variables
  553.   #--------------------------------------------------------------------------
  554.   attr_accessor :popup_rules
  555.   
  556.   #--------------------------------------------------------------------------
  557.   # common cache: load_notetags_abe
  558.   #--------------------------------------------------------------------------
  559.   def load_notetags_abe
  560.     @popup_rules = {
  561.       :add_state => "ADDSTATE",
  562.       :rem_state => "REMSTATE",
  563.       :dur_state => nil
  564.     } # Do not remove this.
  565.     #---
  566.     self.note.split(/[\r\n]+/).each { |line|
  567.       case line
  568.       #---
  569.       when YEA::REGEXP::STATE::POPUP_ADD
  570.         @popup_rules[:add_state] = $1.upcase.to_s
  571.       when YEA::REGEXP::STATE::POPUP_REM
  572.         @popup_rules[:rem_state] = $1.upcase.to_s
  573.       when YEA::REGEXP::STATE::POPUP_DUR
  574.         @popup_rules[:dur_state] = $1.upcase.to_s
  575.       when YEA::REGEXP::STATE::HIDE_ADD
  576.         @popup_rules[:add_state] = nil
  577.       when YEA::REGEXP::STATE::HIDE_REM
  578.         @popup_rules[:rem_state] = nil
  579.       when YEA::REGEXP::STATE::HIDE_DUR
  580.         @popup_rules[:dur_state] = nil
  581.       end
  582.     } # self.note.split
  583.     #---
  584.   end
  585.   
  586. end # RPG::State

  587. #==============================================================================
  588. # ■ BattleManager
  589. #==============================================================================

  590. module BattleManager
  591.   
  592.   #--------------------------------------------------------------------------
  593.   # overwrite method: self.battle_start
  594.   #--------------------------------------------------------------------------
  595.   def self.battle_start
  596.     $game_system.battle_count += 1
  597.     $game_party.on_battle_start
  598.     $game_troop.on_battle_start
  599.     return unless YEA::BATTLE::MSG_ENEMY_APPEARS
  600.     $game_troop.enemy_names.each do |name|
  601.       $game_message.add(sprintf(Vocab::Emerge, name))
  602.     end
  603.     if @preemptive
  604.       $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
  605.     elsif @surprise
  606.       $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
  607.     end
  608.     wait_for_message
  609.   end
  610.   
  611.   #--------------------------------------------------------------------------
  612.   # overwrite method: make_action_orders
  613.   #--------------------------------------------------------------------------
  614.   def self.make_action_orders
  615.     make_dtb_action_orders if btype?(:dtb)
  616.   end
  617.   
  618.   #--------------------------------------------------------------------------
  619.   # new method: make_dtb_action_orders
  620.   #--------------------------------------------------------------------------
  621.   def self.make_dtb_action_orders
  622.     @action_battlers = []
  623.     @action_battlers += $game_party.members unless @surprise
  624.     @action_battlers += $game_troop.members unless @preemptive
  625.     @action_battlers.each {|battler| battler.make_speed }
  626.     @action_battlers.sort! {|a,b| b.speed - a.speed }
  627.   end
  628.   
  629.   #--------------------------------------------------------------------------
  630.   # overwrite method: turn_start
  631.   #--------------------------------------------------------------------------
  632.   def self.turn_start
  633.     @phase = :turn
  634.     clear_actor
  635.     $game_troop.increase_turn
  636.     @performed_battlers = []
  637.     make_action_orders
  638.   end
  639.   
  640.   #--------------------------------------------------------------------------
  641.   # overwrite method: next_subject
  642.   #--------------------------------------------------------------------------
  643.   def self.next_subject
  644.     @performed_battlers = [] if @performed_battlers.nil?
  645.     loop do
  646.       @action_battlers -= @performed_battlers
  647.       battler = @action_battlers.shift
  648.       return nil unless battler
  649.       next unless battler.index && battler.alive?
  650.       @performed_battlers.push(battler)
  651.       return battler
  652.     end
  653.   end
  654.   
  655.   #--------------------------------------------------------------------------
  656.   # overwrite method: force_action
  657.   #--------------------------------------------------------------------------
  658.   def self.force_action(battler)
  659.     @action_forced = [] if @action_forced == nil
  660.     @action_forced.push(battler)
  661.     return unless Switch.forced_action_remove
  662.     @action_battlers.delete(battler)
  663.   end
  664.   
  665.   #--------------------------------------------------------------------------
  666.   # overwrite method: action_forced?
  667.   #--------------------------------------------------------------------------
  668.   def self.action_forced?
  669.     @action_forced != nil
  670.   end
  671.   
  672.   #--------------------------------------------------------------------------
  673.   # overwrite method: action_forced_battler
  674.   #--------------------------------------------------------------------------
  675.   def self.action_forced_battler
  676.     @action_forced.shift
  677.   end
  678.   
  679.   #--------------------------------------------------------------------------
  680.   # overwrite method: clear_action_force
  681.   #--------------------------------------------------------------------------
  682.   def self.clear_action_force
  683.     @action_forced = nil if @action_forced.empty?
  684.   end
  685.   
  686.   #--------------------------------------------------------------------------
  687.   # new method: self.init_battle_type
  688.   #--------------------------------------------------------------------------
  689.   def self.init_battle_type
  690.     set_btype($game_system.battle_system)
  691.   end
  692.   
  693.   #--------------------------------------------------------------------------
  694.   # new method: self.set_btype
  695.   #--------------------------------------------------------------------------
  696.   def self.set_btype(btype = :dtb)
  697.     @battle_type = btype
  698.   end
  699.   
  700.   #--------------------------------------------------------------------------
  701.   # new method: self.btype?
  702.   #--------------------------------------------------------------------------
  703.   def self.btype?(btype)
  704.     return @battle_type == btype
  705.   end
  706.   
  707. end # BattleManager

  708. #==============================================================================
  709. # ■ Game_System
  710. #==============================================================================

  711. class Game_System
  712.   
  713.   #--------------------------------------------------------------------------
  714.   # new method: battle_system
  715.   #--------------------------------------------------------------------------
  716.   def battle_system
  717.     if @battle_system.nil?
  718.       return battle_system_corrected(YEA::BATTLE::DEFAULT_BATTLE_SYSTEM)
  719.     else
  720.       return battle_system_corrected(@battle_system)
  721.     end
  722.   end
  723.   
  724.   #--------------------------------------------------------------------------
  725.   # new method: set_battle_system
  726.   #--------------------------------------------------------------------------
  727.   def set_battle_system(type)
  728.     case type
  729.     when :dtb; @battle_system = :dtb
  730.     when :ftb; @battle_system = $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  731.     else;      @battle_system = :dtb
  732.     end
  733.   end
  734.   
  735.   #--------------------------------------------------------------------------
  736.   # new method: battle_system_corrected
  737.   #--------------------------------------------------------------------------
  738.   def battle_system_corrected(type)
  739.     case type
  740.     when :dtb; return :dtb
  741.     when :ftb; return $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  742.     else;      return :dtb
  743.     end
  744.   end
  745.   
  746. end # Game_System

  747. #==============================================================================
  748. # ■ Sprite_Base
  749. #==============================================================================

  750. class Sprite_Base < Sprite
  751.   
  752.   #--------------------------------------------------------------------------
  753.   # new method: start_pseudo_animation
  754.   #--------------------------------------------------------------------------
  755.   unless $imported["YEA-CoreEngine"]
  756.   def start_pseudo_animation(animation, mirror = false)
  757.     dispose_animation
  758.     @animation = animation
  759.     return if @animation.nil?
  760.     @ani_mirror = mirror
  761.     set_animation_rate
  762.     @ani_duration = @animation.frame_max * @ani_rate + 1
  763.     @ani_sprites = []
  764.   end
  765.   end # $imported["YEA-CoreEngine"]
  766.   
  767. end # Sprite_Base

  768. #==============================================================================
  769. # ■ Sprite_Battler
  770. #==============================================================================

  771. class Sprite_Battler < Sprite_Base
  772.   
  773.   #--------------------------------------------------------------------------
  774.   # public instance variables
  775.   #--------------------------------------------------------------------------
  776.   attr_accessor :effect_type
  777.   attr_accessor :battler_visible
  778.   attr_accessor :popups
  779.   
  780.   #--------------------------------------------------------------------------
  781.   # alias method: initialize
  782.   #--------------------------------------------------------------------------
  783.   alias sprite_battler_initialize_abe initialize
  784.   def initialize(viewport, battler = nil)
  785.     sprite_battler_initialize_abe(viewport, battler)
  786.     @popups = []
  787.     @popup_flags = []
  788.   end
  789.   
  790.   #--------------------------------------------------------------------------
  791.   # alias method: update_bitmap
  792.   #--------------------------------------------------------------------------
  793.   alias sprite_battler_update_bitmap_abe update_bitmap
  794.   def update_bitmap
  795.     return if @battler.actor? && @battler.battler_name == ""
  796.     sprite_battler_update_bitmap_abe
  797.   end
  798.   
  799.   #--------------------------------------------------------------------------
  800.   # alias method: setup_new_animation
  801.   #--------------------------------------------------------------------------
  802.   unless $imported["YEA-CoreEngine"]
  803.   alias sprite_battler_setup_new_animation_abe setup_new_animation
  804.   def setup_new_animation
  805.     sprite_battler_setup_new_animation_abe
  806.     return if @battler.pseudo_ani_id <= 0
  807.     animation = $data_animations[@battler.pseudo_ani_id]
  808.     mirror = @battler.animation_mirror
  809.     start_pseudo_animation(animation, mirror)
  810.     @battler.pseudo_ani_id = 0
  811.   end
  812.   end # $imported["YEA-CoreEngine"]
  813.   
  814.   #--------------------------------------------------------------------------
  815.   # alias method: setup_new_effect
  816.   #--------------------------------------------------------------------------
  817.   alias sprite_battler_setup_new_effect_abe setup_new_effect
  818.   def setup_new_effect
  819.     sprite_battler_setup_new_effect_abe
  820.     setup_popups
  821.   end
  822.   
  823.   #--------------------------------------------------------------------------
  824.   # new method: setup_popups
  825.   #--------------------------------------------------------------------------
  826.   def setup_popups
  827.     return unless @battler.use_sprite?
  828.     @battler.popups = [] if @battler.popups.nil?
  829.     return if @battler.popups == []
  830.     array = @battler.popups.shift
  831.     create_new_popup(array[0], array[1], array[2])
  832.   end
  833.   
  834.   #--------------------------------------------------------------------------
  835.   # new method: create_new_popup
  836.   #--------------------------------------------------------------------------
  837.   def create_new_popup(value, rules, flags)
  838.     return if @battler == nil
  839.     return if flags & @popup_flags != []
  840.     array = YEA::BATTLE::POPUP_RULES[rules]
  841.     for popup in @popups
  842.       popup.y -= 24
  843.     end
  844.     return unless SceneManager.scene.is_a?(Scene_Battle)
  845.     return if SceneManager.scene.spriteset.nil?
  846.     view = SceneManager.scene.spriteset.viewportPopups
  847.     new_popup = Sprite_Popup.new(view, @battler, value, rules, flags)
  848.     @popups.push(new_popup)
  849.     @popup_flags.push("weakness") if flags.include?("weakness")
  850.     @popup_flags.push("resistant") if flags.include?("resistant")
  851.     @popup_flags.push("immune") if flags.include?("immune")
  852.     @popup_flags.push("absorbed") if flags.include?("absorbed")
  853.   end
  854.   
  855.   #--------------------------------------------------------------------------
  856.   # alias method: update_effect
  857.   #--------------------------------------------------------------------------
  858.   alias sprite_battler_update_effect_abe update_effect
  859.   def update_effect
  860.     sprite_battler_update_effect_abe
  861.     update_popups
  862.   end
  863.   
  864.   #--------------------------------------------------------------------------
  865.   # new method: update_popups
  866.   #--------------------------------------------------------------------------
  867.   def update_popups
  868.     for popup in @popups
  869.       popup.update
  870.       next unless popup.opacity <= 0
  871.       popup.bitmap.dispose
  872.       popup.dispose
  873.       @popups.delete(popup)
  874.       popup = nil
  875.     end
  876.     @popup_flags = [] if @popups == [] && @popup_flags != []
  877.     return unless SceneManager.scene_is?(Scene_Battle)
  878.     if @current_active_battler != SceneManager.scene.subject
  879.       @current_active_battler = SceneManager.scene.subject
  880.       @popup_flags = []
  881.     end
  882.   end
  883.   
  884. end # Sprite_Battler

  885. #==============================================================================
  886. # ■ Sprite_Popup
  887. #==============================================================================

  888. class Sprite_Popup < Sprite_Base
  889.   
  890.   #--------------------------------------------------------------------------
  891.   # public instance variables
  892.   #--------------------------------------------------------------------------
  893.   attr_accessor :flags
  894.   
  895.   #--------------------------------------------------------------------------
  896.   # initialize
  897.   #--------------------------------------------------------------------------
  898.   def initialize(viewport, battler, value, rules, flags)
  899.     super(viewport)
  900.     @value = value
  901.     @rules = rules
  902.     @rules = "DEFAULT" unless YEA::BATTLE::POPUP_RULES.include?(@rules)
  903.     @fade = YEA::BATTLE::POPUP_SETTINGS[:fade]
  904.     @full = YEA::BATTLE::POPUP_SETTINGS[:full]
  905.     @flags = flags
  906.     @battler = battler
  907.     create_popup_bitmap
  908.   end
  909.   
  910.   #--------------------------------------------------------------------------
  911.   # create_popup_bitmap
  912.   #--------------------------------------------------------------------------
  913.   def create_popup_bitmap
  914.     rules_array = YEA::BATTLE::POPUP_RULES[@rules]
  915.     bw = Graphics.width
  916.     bw += 48 if @flags.include?("state")
  917.     bh = Font.default_size * 3
  918.     bitmap = Bitmap.new(bw, bh)
  919.     bitmap.font.name = rules_array[8]
  920.     size = @flags.include?("critical") ? rules_array[2] * 1.2 : rules_array[2]
  921.     bitmap.font.size = size
  922.     bitmap.font.bold = rules_array[3]
  923.     bitmap.font.italic = rules_array[4]
  924.     if flags.include?("critical")
  925.       crit = YEA::BATTLE::POPUP_RULES["CRITICAL"]
  926.       bitmap.font.out_color.set(crit[5], crit[6], crit[7], 255)
  927.     else
  928.       bitmap.font.out_color.set(0, 0, 0, 255)
  929.     end
  930.     dx = 0; dy = 0; dw = 0
  931.     dx += 24 if @flags.include?("state")
  932.     dw += 24 if @flags.include?("state")
  933.     if @flags.include?("state") || @flags.include?("buff")
  934.       c_width = bitmap.text_size(@value).width
  935.       icon_bitmap = $game_temp.iconset
  936.       icon_index = flag_state_icon
  937.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  938.       bitmap.blt(dx+(bw-c_width)/2-36, (bh - 24)/2, icon_bitmap, rect, 255)
  939.     end
  940.     bitmap.font.color.set(rules_array[5], rules_array[6], rules_array[7])
  941.     bitmap.draw_text(dx, dy, bw-dw, bh, @value, 1)
  942.     self.bitmap = bitmap
  943.     self.x = @battler.screen_x
  944.     self.x += rand(4) - rand(4) if @battler.sprite.popups.size >= 1
  945.     self.x -= SceneManager.scene.spriteset.viewport1.ox
  946.     self.y = @battler.screen_y - @battler.sprite.oy/2
  947.     self.y -= @battler.sprite.oy/2 if @battler.actor?
  948.     self.y -= SceneManager.scene.spriteset.viewport1.oy
  949.     self.ox = bw/2; self.oy = bh/2
  950.     self.zoom_x = self.zoom_y = rules_array[0]
  951.     if @flags.include?("no zoom")
  952.       self.zoom_x = self.zoom_y = rules_array[1]
  953.     end
  954.     @target_zoom = rules_array[1]
  955.     @zoom_direction = (self.zoom_x > @target_zoom) ? "down" : "up"
  956.     self.z = 500
  957.   end
  958.   
  959.   #--------------------------------------------------------------------------
  960.   # update
  961.   #--------------------------------------------------------------------------
  962.   def update
  963.     super
  964.     #---
  965.     if @flags.include?("critical") && YEA::BATTLE::FLASH_CRITICAL
  966.       @hue_duration = 2 if @hue_duration == nil || @hue_duration == 0
  967.       @hue_duration -= 1
  968.       self.bitmap.hue_change(15) if @hue_duration <= 0
  969.     end
  970.     #---
  971.     if @zoom_direction == "up"
  972.       self.zoom_x = [self.zoom_x + 0.075, @target_zoom].min
  973.       self.zoom_y = [self.zoom_y + 0.075, @target_zoom].min
  974.     else
  975.       self.zoom_x = [self.zoom_x - 0.075, @target_zoom].max
  976.       self.zoom_y = [self.zoom_y - 0.075, @target_zoom].max
  977.     end
  978.     #---
  979.     @full -= 1
  980.     return if @full > 0
  981.     self.y -= 1
  982.     self.opacity -= @fade
  983.   end
  984.   
  985.   #--------------------------------------------------------------------------
  986.   # flag_state_icon
  987.   #--------------------------------------------------------------------------
  988.   def flag_state_icon
  989.     for item in @flags; return item if item.is_a?(Integer); end
  990.     return 0
  991.   end
  992.   
  993. end # Sprite_Popup

  994. #==============================================================================
  995. # ■ Spriteset_Battle
  996. #==============================================================================

  997. class Spriteset_Battle
  998.   
  999.   #--------------------------------------------------------------------------
  1000.   # public instance variables
  1001.   #--------------------------------------------------------------------------
  1002.   attr_accessor :actor_sprites
  1003.   attr_accessor :enemy_sprites
  1004.   attr_accessor :viewport1
  1005.   attr_accessor :viewportPopups
  1006.   
  1007.   #--------------------------------------------------------------------------
  1008.   # alias method: create_viewports
  1009.   #--------------------------------------------------------------------------
  1010.   alias spriteset_battle_create_viewports_abe create_viewports
  1011.   def create_viewports
  1012.     spriteset_battle_create_viewports_abe
  1013.     @viewportPopups = Viewport.new
  1014.     @viewportPopups.z = 200
  1015.   end
  1016.   
  1017.   #--------------------------------------------------------------------------
  1018.   # alias method: dispose_viewports
  1019.   #--------------------------------------------------------------------------
  1020.   alias spriteset_battle_dispose_viewports_abe dispose_viewports
  1021.   def dispose_viewports
  1022.     spriteset_battle_dispose_viewports_abe
  1023.     @viewportPopups.dispose
  1024.   end
  1025.   
  1026.   #--------------------------------------------------------------------------
  1027.   # alias method: update_viewports
  1028.   #--------------------------------------------------------------------------
  1029.   alias spriteset_battle_update_viewports_abe update_viewports
  1030.   def update_viewports
  1031.     spriteset_battle_update_viewports_abe
  1032.     @viewportPopups.update
  1033.   end
  1034.   
  1035. end # Spriteset_Battle

  1036. #==============================================================================
  1037. # ■ Game_Temp
  1038. #==============================================================================

  1039. class Game_Temp
  1040.   
  1041.   #--------------------------------------------------------------------------
  1042.   # public instance variables
  1043.   #--------------------------------------------------------------------------
  1044.   attr_accessor :battle_aid
  1045.   attr_accessor :evaluating
  1046.   attr_accessor :iconset
  1047.   
  1048.   #--------------------------------------------------------------------------
  1049.   # alias method: initialize
  1050.   #--------------------------------------------------------------------------
  1051.   alias game_temp_initialize_abe initialize
  1052.   def initialize
  1053.     game_temp_initialize_abe
  1054.     @iconset = Cache.system("Iconset")
  1055.   end
  1056.   
  1057. end # Game_Temp

  1058. #==============================================================================
  1059. # ■ Game_Action
  1060. #==============================================================================

  1061. class Game_Action
  1062.   
  1063.   #--------------------------------------------------------------------------
  1064.   # overwrite method: speed
  1065.   #--------------------------------------------------------------------------
  1066.   def speed
  1067.     speed = subject.agi
  1068.     speed += item.speed if item
  1069.     speed += subject.atk_speed if attack?
  1070.     return speed
  1071.   end
  1072.   
  1073.   #--------------------------------------------------------------------------
  1074.   # alias method: evaluate_item_with_target
  1075.   #--------------------------------------------------------------------------
  1076.   alias evaluate_item_with_target_abe evaluate_item_with_target
  1077.   def evaluate_item_with_target(target)
  1078.     $game_temp.evaluating = true
  1079.     result = evaluate_item_with_target_abe(target)
  1080.     $game_temp.evaluating = false
  1081.     return result
  1082.   end
  1083.   
  1084. end # Game_Action

  1085. #==============================================================================
  1086. # ■ Game_ActionResult
  1087. #==============================================================================

  1088. class Game_ActionResult
  1089.   
  1090.   #--------------------------------------------------------------------------
  1091.   # alias method: clear
  1092.   #--------------------------------------------------------------------------
  1093.   alias game_actionresult_clear_abe clear
  1094.   def clear
  1095.     game_actionresult_clear_abe
  1096.     clear_stored_damage
  1097.   end
  1098.   
  1099.   #--------------------------------------------------------------------------
  1100.   # new method: clear_stored_damage
  1101.   #--------------------------------------------------------------------------
  1102.   def clear_stored_damage
  1103.     @stored_hp_damage = 0
  1104.     @stored_mp_damage = 0
  1105.     @stored_tp_damage = 0
  1106.     @stored_hp_drain = 0
  1107.     @stored_mp_drain = 0
  1108.   end
  1109.   
  1110.   #--------------------------------------------------------------------------
  1111.   # new method: store_damage
  1112.   #--------------------------------------------------------------------------
  1113.   def store_damage
  1114.     @stored_hp_damage += @hp_damage
  1115.     @stored_mp_damage += @mp_damage
  1116.     @stored_tp_damage += @tp_damage
  1117.     @stored_hp_drain += @hp_drain
  1118.     @stored_mp_drain += @mp_drain
  1119.   end
  1120.   
  1121.   #--------------------------------------------------------------------------
  1122.   # new method: restore_damage
  1123.   #--------------------------------------------------------------------------
  1124.   def restore_damage
  1125.     @hp_damage = @stored_hp_damage
  1126.     @mp_damage = @stored_mp_damage
  1127.     @tp_damage = @stored_tp_damage
  1128.     @hp_drain = @stored_hp_drain
  1129.     @mp_drain = @stored_mp_drain
  1130.   end
  1131.   
  1132. end # Game_ActionResult

  1133. #==============================================================================
  1134. # ■ Game_BattlerBase
  1135. #==============================================================================

  1136. class Game_BattlerBase
  1137.   
  1138.   #--------------------------------------------------------------------------
  1139.   # public instance variables
  1140.   #--------------------------------------------------------------------------
  1141.   attr_accessor :popups
  1142.   
  1143.   #--------------------------------------------------------------------------
  1144.   # new method: create_popup
  1145.   #--------------------------------------------------------------------------
  1146.   def create_popup(value, rules = "DEFAULT", flags = [])
  1147.     return unless SceneManager.scene_is?(Scene_Battle)
  1148.     return unless YEA::BATTLE::ENABLE_POPUPS
  1149.     return if Switch.hide_popups
  1150.     @popups = [] if @popups.nil?
  1151.     @popups.push([value, rules, flags])
  1152.   end
  1153.   
  1154.   #--------------------------------------------------------------------------
  1155.   # new method: make_damage_popups
  1156.   #--------------------------------------------------------------------------
  1157.   def make_damage_popups(user)
  1158.     if @result.hp_drain != 0
  1159.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  1160.       rules = "DRAIN"
  1161.       user.create_popup(text, rules)
  1162.       setting = :hp_dmg  if @result.hp_drain < 0
  1163.       setting = :hp_heal if @result.hp_drain > 0
  1164.       rules = "HP_DMG"   if @result.hp_drain < 0
  1165.       rules = "HP_HEAL"  if @result.hp_drain > 0
  1166.       value = @result.hp_drain.abs
  1167.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1168.       user.create_popup(text, rules)
  1169.     end
  1170.     if @result.mp_drain != 0
  1171.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  1172.       rules = "DRAIN"
  1173.       user.create_popup(text, rules)
  1174.       setting = :mp_dmg  if @result.mp_drain < 0
  1175.       setting = :mp_heal if @result.mp_drain > 0
  1176.       rules = "HP_DMG"   if @result.mp_drain < 0
  1177.       rules = "HP_HEAL"  if @result.mp_drain > 0
  1178.       value = @result.mp_drain.abs
  1179.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1180.       user.create_popup(text, rules)
  1181.     end
  1182.     #---
  1183.     flags = []
  1184.     flags.push("critical") if @result.critical
  1185.     if @result.hp_damage != 0
  1186.       setting = :hp_dmg  if @result.hp_damage > 0
  1187.       setting = :hp_heal if @result.hp_damage < 0
  1188.       rules = "HP_DMG"   if @result.hp_damage > 0
  1189.       rules = "HP_HEAL"  if @result.hp_damage < 0
  1190.       value = @result.hp_damage.abs
  1191.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1192.       create_popup(text, rules, flags)
  1193.     end
  1194.     if @result.mp_damage != 0
  1195.       setting = :mp_dmg  if @result.mp_damage > 0
  1196.       setting = :mp_heal if @result.mp_damage < 0
  1197.       rules = "MP_DMG"   if @result.mp_damage > 0
  1198.       rules = "MP_HEAL"  if @result.mp_damage < 0
  1199.       value = @result.mp_damage.abs
  1200.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1201.       create_popup(text, rules, flags)
  1202.     end
  1203.     if @result.tp_damage != 0
  1204.       setting = :tp_dmg  if @result.tp_damage > 0
  1205.       setting = :tp_heal if @result.tp_damage < 0
  1206.       rules = "TP_DMG"   if @result.tp_damage > 0
  1207.       rules = "TP_HEAL"  if @result.tp_damage < 0
  1208.       value = @result.tp_damage.abs
  1209.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1210.       create_popup(text, rules)
  1211.     end
  1212.     @result.store_damage
  1213.     @result.clear_damage_values
  1214.   end
  1215.   
  1216.   #--------------------------------------------------------------------------
  1217.   # alias method: erase_state
  1218.   #--------------------------------------------------------------------------
  1219.   alias game_battlerbase_erase_state_abe erase_state
  1220.   def erase_state(state_id)
  1221.     make_state_popup(state_id, :rem_state) if @states.include?(state_id)
  1222.     game_battlerbase_erase_state_abe(state_id)
  1223.   end
  1224.   
  1225.   #--------------------------------------------------------------------------
  1226.   # new method: make_during_state_popup
  1227.   #--------------------------------------------------------------------------
  1228.   def make_during_state_popup
  1229.     state_id = most_important_state_id
  1230.     return if state_id == 0
  1231.     make_state_popup(state_id, :dur_state)
  1232.   end
  1233.   
  1234.   #--------------------------------------------------------------------------
  1235.   # new method: most_important_state_id
  1236.   #--------------------------------------------------------------------------
  1237.   def most_important_state_id
  1238.     states.each {|state| return state.id unless state.message3.empty? }
  1239.     return 0
  1240.   end
  1241.   
  1242.   #--------------------------------------------------------------------------
  1243.   # new method: make_state_popup
  1244.   #--------------------------------------------------------------------------
  1245.   def make_state_popup(state_id, type)
  1246.     state = $data_states[state_id]
  1247.     return if state.icon_index == 0
  1248.     rules = state.popup_rules[type]
  1249.     return if rules.nil?
  1250.     text = sprintf(YEA::BATTLE::POPUP_SETTINGS[type], state.name)
  1251.     flags = ["state", state.icon_index]
  1252.     create_popup(text, rules, flags)
  1253.   end
  1254.   
  1255.   #--------------------------------------------------------------------------
  1256.   # new method: make_miss_popups
  1257.   #--------------------------------------------------------------------------
  1258.   def make_miss_popups(user, item)
  1259.     return if dead?
  1260.     if @result.missed
  1261.       text = YEA::BATTLE::POPUP_SETTINGS[:missed]
  1262.       rules = "DEFAULT"
  1263.       create_popup(text, rules)
  1264.     end
  1265.     if @result.evaded
  1266.       text = YEA::BATTLE::POPUP_SETTINGS[:evaded]
  1267.       rules = "DEFAULT"
  1268.       create_popup(text, rules)
  1269.     end
  1270.     if @result.hit? && [email protected]
  1271.       text = YEA::BATTLE::POPUP_SETTINGS[:failed]
  1272.       rules = "DEFAULT"
  1273.       create_popup(text, rules)
  1274.     end
  1275.     if @result.hit? && item.damage.to_hp?
  1276.       if @result.hp_damage == 0 && @result.hp_damage == 0
  1277.         text = YEA::BATTLE::POPUP_SETTINGS[:nulled]
  1278.         rules = "DEFAULT"
  1279.         create_popup(text, rules)
  1280.       end
  1281.     end
  1282.   end
  1283.   
  1284.   #--------------------------------------------------------------------------
  1285.   # new method: make_rate_popup
  1286.   #--------------------------------------------------------------------------
  1287.   def make_rate_popup(rate)
  1288.     return if rate == 1.0
  1289.     flags = []
  1290.     if rate > 1.0
  1291.       text = YEA::BATTLE::POPUP_SETTINGS[:weakpoint]
  1292.       rules = "WEAK_ELE"
  1293.       flags.push("weakness")
  1294.     elsif rate == 0.0
  1295.       text = YEA::BATTLE::POPUP_SETTINGS[:immune]
  1296.       rules = "IMMU_ELE"
  1297.       flags.push("immune")
  1298.     elsif rate < 0.0
  1299.       text = YEA::BATTLE::POPUP_SETTINGS[:absorbed]
  1300.       rules = "ABSB_ELE"
  1301.       flags.push("absorbed")
  1302.     else
  1303.       text = YEA::BATTLE::POPUP_SETTINGS[:resistant]
  1304.       rules = "REST_ELE"
  1305.       flags.push("resistant")
  1306.     end
  1307.     create_popup(text, rules, flags)
  1308.   end
  1309.   
  1310.   #--------------------------------------------------------------------------
  1311.   # new method: make_buff_popup
  1312.   #--------------------------------------------------------------------------
  1313.   def make_buff_popup(param_id, positive = true)
  1314.     return unless alive?
  1315.     name = Vocab::param(param_id)
  1316.     if positive
  1317.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_buff], name)
  1318.       rules = "BUFF"
  1319.       buff_level = 1
  1320.     else
  1321.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_debuff], name)
  1322.       rules = "DEBUFF"
  1323.       buff_level = -1
  1324.     end
  1325.     icon = buff_icon_index(buff_level, param_id)
  1326.     flags = ["buff", icon]
  1327.     create_popup(text, rules, flags)
  1328.   end
  1329.   
  1330. end # Game_BattlerBase

  1331. #==============================================================================
  1332. # ■ Game_Battler
  1333. #==============================================================================

  1334. class Game_Battler < Game_BattlerBase
  1335.   
  1336.   #--------------------------------------------------------------------------
  1337.   # public instance variables
  1338.   #--------------------------------------------------------------------------
  1339.   attr_accessor :pseudo_ani_id
  1340.   
  1341.   #--------------------------------------------------------------------------
  1342.   # alias method: on_battle_end
  1343.   #--------------------------------------------------------------------------
  1344.   alias game_battler_on_battle_end_abe on_battle_end
  1345.   def on_battle_end
  1346.     game_battler_on_battle_end_abe
  1347.     @popups = []
  1348.   end
  1349.   
  1350.   #--------------------------------------------------------------------------
  1351.   # alias method: clear_sprite_effects
  1352.   #--------------------------------------------------------------------------
  1353.   alias game_battler_clear_sprite_effects_abe clear_sprite_effects
  1354.   def clear_sprite_effects
  1355.     game_battler_clear_sprite_effects_abe
  1356.     @pseudo_ani_id = 0
  1357.   end
  1358.   
  1359.   #--------------------------------------------------------------------------
  1360.   # alias method: item_apply
  1361.   #--------------------------------------------------------------------------
  1362.   alias game_battler_item_apply_abe item_apply
  1363.   def item_apply(user, item)
  1364.     game_battler_item_apply_abe(user, item)
  1365.     make_miss_popups(user, item)
  1366.   end
  1367.   
  1368.   #--------------------------------------------------------------------------
  1369.   # alias method: make_damage_value
  1370.   #--------------------------------------------------------------------------
  1371.   alias game_battler_make_damage_value_abe make_damage_value
  1372.   def make_damage_value(user, item)
  1373.     game_battler_make_damage_value_abe(user, item)
  1374.     rate = item_element_rate(user, item)
  1375.     make_rate_popup(rate) unless $game_temp.evaluating
  1376.   end
  1377.   
  1378.   #--------------------------------------------------------------------------
  1379.   # alias method: execute_damage
  1380.   #--------------------------------------------------------------------------
  1381.   alias game_battler_execute_damage_abe execute_damage
  1382.   def execute_damage(user)
  1383.     game_battler_execute_damage_abe(user)
  1384.     make_damage_popups(user)
  1385.   end
  1386.   
  1387.   #--------------------------------------------------------------------------
  1388.   # alias method: item_effect_recover_hp
  1389.   #--------------------------------------------------------------------------
  1390.   alias game_battler_item_effect_recover_hp_abe item_effect_recover_hp
  1391.   def item_effect_recover_hp(user, item, effect)
  1392.     game_battler_item_effect_recover_hp_abe(user, item, effect)
  1393.     make_damage_popups(user)
  1394.   end
  1395.   
  1396.   #--------------------------------------------------------------------------
  1397.   # alias method: item_effect_recover_mp
  1398.   #--------------------------------------------------------------------------
  1399.   alias game_battler_item_effect_recover_mp_abe item_effect_recover_mp
  1400.   def item_effect_recover_mp(user, item, effect)
  1401.     game_battler_item_effect_recover_mp_abe(user, item, effect)
  1402.     make_damage_popups(user)
  1403.   end
  1404.   
  1405.   #--------------------------------------------------------------------------
  1406.   # alias method: item_effect_gain_tp
  1407.   #--------------------------------------------------------------------------
  1408.   alias game_battler_item_effect_gain_tp_abe item_effect_gain_tp
  1409.   def item_effect_gain_tp(user, item, effect)
  1410.     game_battler_item_effect_gain_tp_abe(user, item, effect)
  1411.     make_damage_popups(user)
  1412.   end
  1413.   
  1414.   #--------------------------------------------------------------------------
  1415.   # alias method: item_user_effect
  1416.   #--------------------------------------------------------------------------
  1417.   alias game_battler_item_user_effect_abe item_user_effect
  1418.   def item_user_effect(user, item)
  1419.     game_battler_item_user_effect_abe(user, item)
  1420.     @result.restore_damage
  1421.   end
  1422.   
  1423.   #--------------------------------------------------------------------------
  1424.   # alias method: add_new_state
  1425.   #--------------------------------------------------------------------------
  1426.   alias game_battler_add_new_state_abe add_new_state
  1427.   def add_new_state(state_id)
  1428.     game_battler_add_new_state_abe(state_id)
  1429.     make_state_popup(state_id, :add_state) if @states.include?(state_id)
  1430.   end
  1431.   
  1432.   #--------------------------------------------------------------------------
  1433.   # alias method: add_buff
  1434.   #--------------------------------------------------------------------------
  1435.   alias game_battler_add_buff_abe add_buff
  1436.   def add_buff(param_id, turns)
  1437.     make_buff_popup(param_id, true)
  1438.     game_battler_add_buff_abe(param_id, turns)
  1439.   end
  1440.   
  1441.   #--------------------------------------------------------------------------
  1442.   # alias method: add_debuff
  1443.   #--------------------------------------------------------------------------
  1444.   alias game_battler_add_debuff_abe add_debuff
  1445.   def add_debuff(param_id, turns)
  1446.     make_buff_popup(param_id, false)
  1447.     game_battler_add_debuff_abe(param_id, turns)
  1448.   end
  1449.   
  1450.   #--------------------------------------------------------------------------
  1451.   # alias method: regenerate_all
  1452.   #--------------------------------------------------------------------------
  1453.   alias game_battler_regenerate_all_abe regenerate_all
  1454.   def regenerate_all
  1455.     game_battler_regenerate_all_abe
  1456.     return unless alive?
  1457.     make_damage_popups(self)
  1458.   end
  1459.   
  1460.   #--------------------------------------------------------------------------
  1461.   # new method: can_collapse?
  1462.   #--------------------------------------------------------------------------
  1463.   def can_collapse?
  1464.     return false unless dead?
  1465.     unless actor?
  1466.       return false unless sprite.battler_visible
  1467.       array = [:collapse, :boss_collapse, :instant_collapse]
  1468.       return false if array.include?(sprite.effect_type)
  1469.     end
  1470.     return true
  1471.   end
  1472.   
  1473.   #--------------------------------------------------------------------------
  1474.   # new method: draw_mp?
  1475.   #--------------------------------------------------------------------------
  1476.   def draw_mp?; return true; end
  1477.   
  1478.   #--------------------------------------------------------------------------
  1479.   # new method: draw_tp?
  1480.   #--------------------------------------------------------------------------
  1481.   def draw_tp?
  1482.     return $data_system.opt_display_tp
  1483.   end
  1484.   
  1485. end # Game_Battler

  1486. #==============================================================================
  1487. # ■ Game_Actor
  1488. #==============================================================================

  1489. class Game_Actor < Game_Battler
  1490.   
  1491.   #def battler_name
  1492.     #return "Slime"
  1493.   #end
  1494.   
  1495.   #def battler_hue
  1496.     #return 0
  1497.   #end
  1498.   
  1499.   #--------------------------------------------------------------------------
  1500.   # overwrite method: perform_damage_effect
  1501.   #--------------------------------------------------------------------------
  1502.   def perform_damage_effect
  1503.     $game_troop.screen.start_shake(5, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
  1504.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1505.     Sound.play_actor_damage
  1506.   end
  1507.   
  1508.   #--------------------------------------------------------------------------
  1509.   # overwrite method: use_sprite?
  1510.   #--------------------------------------------------------------------------
  1511.   def use_sprite?; return true; end
  1512.    
  1513.   #--------------------------------------------------------------------------
  1514.   # new method: screen_x
  1515.   #--------------------------------------------------------------------------
  1516.   def screen_x
  1517.     return 0 unless SceneManager.scene_is?(Scene_Battle)
  1518.     status_window = SceneManager.scene.status_window
  1519.     return 0 if status_window.nil?
  1520.     item_rect_width = (status_window.width-24) / $game_party.max_battle_members
  1521.     ext = SceneManager.scene.info_viewport.ox
  1522.     rect = SceneManager.scene.status_window.item_rect(self.index)
  1523.     constant = 128 + 12
  1524.     return constant + rect.x + item_rect_width / 2 - ext
  1525.   end
  1526.   
  1527.   #--------------------------------------------------------------------------
  1528.   # new method: screen_y
  1529.   #--------------------------------------------------------------------------
  1530.   def screen_y
  1531.     return Graphics.height - 120 unless SceneManager.scene_is?(Scene_Battle)
  1532.     return Graphics.height - 120 if SceneManager.scene.status_window.nil?
  1533.     return Graphics.height - (SceneManager.scene.status_window.height * 7/8)
  1534.   end
  1535.   
  1536.   #--------------------------------------------------------------------------
  1537.   # new method: screen_z
  1538.   #--------------------------------------------------------------------------
  1539.   def screen_z; return 100; end
  1540.   
  1541.   #--------------------------------------------------------------------------
  1542.   # new method: sprite
  1543.   #--------------------------------------------------------------------------
  1544.   def sprite
  1545.     index = $game_party.battle_members.index(self)
  1546.     return SceneManager.scene.spriteset.actor_sprites[index]
  1547.   end
  1548.   
  1549.   #--------------------------------------------------------------------------
  1550.   # new method: draw_mp?
  1551.   #--------------------------------------------------------------------------
  1552.   def draw_mp?
  1553.     return true unless draw_tp?
  1554.     for skill in skills
  1555.       next unless added_skill_types.include?(skill.stype_id)
  1556.       return true if skill.mp_cost > 0
  1557.     end
  1558.     return false
  1559.   end
  1560.   
  1561.   #--------------------------------------------------------------------------
  1562.   # new method: draw_tp?
  1563.   #--------------------------------------------------------------------------
  1564.   def draw_tp?
  1565.     return false unless $data_system.opt_display_tp
  1566.     for skill in skills
  1567.       next unless added_skill_types.include?(skill.stype_id)
  1568.       return true if skill.tp_cost > 0
  1569.     end
  1570.     return false
  1571.   end
  1572.   
  1573. end # Game_Actor

  1574. #==============================================================================
  1575. # ■ Game_Enemy
  1576. #==============================================================================

  1577. class Game_Enemy < Game_Battler
  1578.   
  1579.   #--------------------------------------------------------------------------
  1580.   # overwrite method: perform_damage_effect
  1581.   #--------------------------------------------------------------------------
  1582.   def perform_damage_effect
  1583.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1584.     Sound.play_enemy_damage
  1585.   end
  1586.   
  1587.   #--------------------------------------------------------------------------
  1588.   # new methods: attack_animation_id
  1589.   #--------------------------------------------------------------------------
  1590.   def atk_animation_id1; return enemy.atk_animation_id1; end
  1591.   def atk_animation_id2; return enemy.atk_animation_id2; end
  1592.   
  1593.   #--------------------------------------------------------------------------
  1594.   # new method: sprite
  1595.   #--------------------------------------------------------------------------
  1596.   def sprite
  1597.     return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
  1598.   end
  1599.   
  1600. end # Game_Enemy

  1601. #==============================================================================
  1602. # ■ Game_Unit
  1603. #==============================================================================

  1604. class Game_Unit
  1605.   
  1606.   #--------------------------------------------------------------------------
  1607.   # alias method: make_actions
  1608.   #--------------------------------------------------------------------------
  1609.   alias game_unit_make_actions_abe make_actions
  1610.   def make_actions
  1611.     game_unit_make_actions_abe
  1612.     refresh_autobattler_status_window
  1613.   end
  1614.   
  1615.   #--------------------------------------------------------------------------
  1616.   # new method: refresh_autobattler_status_window
  1617.   #--------------------------------------------------------------------------
  1618.   def refresh_autobattler_status_window
  1619.     return unless SceneManager.scene_is?(Scene_Battle)
  1620.     return unless self.is_a?(Game_Party)
  1621.     SceneManager.scene.refresh_autobattler_status_window
  1622.   end
  1623.   
  1624. end # Game_Unit

  1625. #==============================================================================
  1626. # ■ Window_PartyCommand
  1627. #==============================================================================

  1628. class Window_PartyCommand < Window_Command
  1629.   
  1630.   #--------------------------------------------------------------------------
  1631.   # overwrite method: process_handling
  1632.   #--------------------------------------------------------------------------
  1633.   def process_handling
  1634.     return unless open? && active
  1635.     return process_dir6 if Input.repeat?(:RIGHT)
  1636.     return super
  1637.   end
  1638.   
  1639.   #--------------------------------------------------------------------------
  1640.   # new method: process_dir6
  1641.   #--------------------------------------------------------------------------
  1642.   def process_dir6
  1643.     Sound.play_cursor
  1644.     Input.update
  1645.     deactivate
  1646.     call_handler(:dir6)
  1647.   end
  1648.   
  1649. end # Window_PartyCommand

  1650. #==============================================================================
  1651. # ■ Window_ActorCommand
  1652. #==============================================================================

  1653. class Window_ActorCommand < Window_Command
  1654.   
  1655.   #--------------------------------------------------------------------------
  1656.   # overwrite method: process_handling
  1657.   #--------------------------------------------------------------------------
  1658.   def process_handling
  1659.     return unless open? && active
  1660.     return process_dir4 if Input.repeat?(:LEFT)
  1661.     return process_dir6 if Input.repeat?(:RIGHT)
  1662.     return super
  1663.   end
  1664.   
  1665.   #--------------------------------------------------------------------------
  1666.   # new method: process_dir4
  1667.   #--------------------------------------------------------------------------
  1668.   def process_dir4
  1669.     Sound.play_cursor
  1670.     Input.update
  1671.     deactivate
  1672.     call_handler(:cancel)
  1673.   end
  1674.   
  1675.   #--------------------------------------------------------------------------
  1676.   # new method: process_dir6
  1677.   #--------------------------------------------------------------------------
  1678.   def process_dir6
  1679.     Sound.play_cursor
  1680.     Input.update
  1681.     deactivate
  1682.     call_handler(:dir6)
  1683.   end
  1684.   
  1685. end # Window_ActorCommand

  1686. #==============================================================================
  1687. # ■ Window_BattleStatus
  1688. #==============================================================================

  1689. class Window_BattleStatus < Window_Selectable
  1690.   
  1691.   #--------------------------------------------------------------------------
  1692.   # overwrite method: initialize
  1693.   #--------------------------------------------------------------------------
  1694.   def initialize
  1695.     super(0, 0, window_width, window_height)
  1696.     self.openness = 0
  1697.     @party = $game_party.battle_members.clone
  1698.   end
  1699.   
  1700.   #--------------------------------------------------------------------------
  1701.   # overwrite method: col_max
  1702.   #--------------------------------------------------------------------------
  1703.   def col_max; return $game_party.max_battle_members; end
  1704.   
  1705.   #--------------------------------------------------------------------------
  1706.   # new method: battle_members
  1707.   #--------------------------------------------------------------------------
  1708.   def battle_members; return $game_party.battle_members; end
  1709.   
  1710.   #--------------------------------------------------------------------------
  1711.   # new method: actor
  1712.   #--------------------------------------------------------------------------
  1713.   def actor; return battle_members[@index]; end
  1714.   
  1715.   #--------------------------------------------------------------------------
  1716.   # overwrite method: update
  1717.   #--------------------------------------------------------------------------
  1718.   def update
  1719.     super
  1720.     return if @party == $game_party.battle_members
  1721.     @party = $game_party.battle_members.clone
  1722.     refresh
  1723.   end
  1724.   
  1725.   #--------------------------------------------------------------------------
  1726.   # overwrite method: draw_item
  1727.   #--------------------------------------------------------------------------
  1728.   def draw_item(index)
  1729.     return if index.nil?
  1730.     clear_item(index)
  1731.     actor = battle_members[index]
  1732.     rect = item_rect(index)
  1733.     return if actor.nil?
  1734.     draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
  1735.     draw_actor_name(actor, rect.x, rect.y, rect.width-8)
  1736.     draw_actor_action(actor, rect.x, rect.y)
  1737.     draw_actor_icons(actor, rect.x, line_height*1, rect.width)
  1738.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
  1739.     contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
  1740.     draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
  1741.     if draw_tp?(actor) && draw_mp?(actor)
  1742.       dw = rect.width/2-2
  1743.       dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
  1744.       draw_actor_tp(actor, rect.x+2, line_height*3, dw)
  1745.       dw = rect.width - rect.width/2 - 2
  1746.       draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
  1747.     elsif draw_tp?(actor) && !draw_mp?(actor)
  1748.       draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
  1749.     else
  1750.       draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
  1751.     end
  1752.   end
  1753.   
  1754.   #--------------------------------------------------------------------------
  1755.   # overwrite method: item_rect
  1756.   #--------------------------------------------------------------------------
  1757.   def item_rect(index)
  1758.     rect = Rect.new
  1759.     rect.width = contents.width / $game_party.max_battle_members
  1760.     rect.height = contents.height
  1761.     rect.x = index * rect.width
  1762.     if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
  1763.       rect.x += (contents.width - $game_party.members.size * rect.width) / 2
  1764.     end
  1765.     rect.y = 0
  1766.     return rect
  1767.   end
  1768.   
  1769.   #--------------------------------------------------------------------------
  1770.   # overwrite method: draw_face
  1771.   #--------------------------------------------------------------------------
  1772.   def draw_face(face_name, face_index, dx, dy, enabled = true)
  1773.     bitmap = Cache.face(face_name)
  1774.     fx = [(96 - item_rect(0).width + 1) / 2, 0].max
  1775.     fy = face_index / 4 * 96 + 2
  1776.     fw = [item_rect(0).width - 4, 92].min
  1777.     rect = Rect.new(fx, fy, fw, 92)
  1778.     rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
  1779.     contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
  1780.     bitmap.dispose
  1781.   end
  1782.   
  1783.   #--------------------------------------------------------------------------
  1784.   # overwrite method: draw_actor_name
  1785.   #--------------------------------------------------------------------------
  1786.   def draw_actor_name(actor, dx, dy, dw = 112)
  1787.     reset_font_settings
  1788.     contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
  1789.     change_color(hp_color(actor))
  1790.     draw_text(dx+24, dy, dw-24, line_height, actor.name)
  1791.   end
  1792.   
  1793.   #--------------------------------------------------------------------------
  1794.   # new method: draw_actor_action
  1795.   #--------------------------------------------------------------------------
  1796.   def draw_actor_action(actor, dx, dy)
  1797.     draw_icon(action_icon(actor), dx, dy)
  1798.   end
  1799.   
  1800.   #--------------------------------------------------------------------------
  1801.   # new method: action_icon
  1802.   #--------------------------------------------------------------------------
  1803.   def action_icon(actor)
  1804.     return Icon.no_action if actor.current_action.nil?
  1805.     return Icon.no_action if actor.current_action.item.nil?
  1806.     return actor.current_action.item.icon_index
  1807.   end
  1808.   
  1809.   #--------------------------------------------------------------------------
  1810.   # new method: draw_tp?
  1811.   #--------------------------------------------------------------------------
  1812.   def draw_tp?(actor)
  1813.     return actor.draw_tp?
  1814.   end
  1815.   
  1816.   #--------------------------------------------------------------------------
  1817.   # new method: draw_mp?
  1818.   #--------------------------------------------------------------------------
  1819.   def draw_mp?(actor)
  1820.     return actor.draw_mp?
  1821.   end
  1822.   
  1823.   #--------------------------------------------------------------------------
  1824.   # overwrite method: draw_current_and_max_values
  1825.   #--------------------------------------------------------------------------
  1826.   def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
  1827.     change_color(color1)
  1828.     draw_text(dx, dy, dw, line_height, current.group, 2)
  1829.   end
  1830.   
  1831.   #--------------------------------------------------------------------------
  1832.   # overwrite method: draw_actor_hp
  1833.   #--------------------------------------------------------------------------
  1834.   def draw_actor_hp(actor, dx, dy, width = 124)
  1835.     draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  1836.     change_color(system_color)
  1837.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1838.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
  1839.     draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
  1840.       hp_color(actor), normal_color)
  1841.     end
  1842.    
  1843.   #--------------------------------------------------------------------------
  1844.   # overwrite method: draw_actor_mp
  1845.   #--------------------------------------------------------------------------
  1846.   def draw_actor_mp(actor, dx, dy, width = 124)
  1847.     draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  1848.     change_color(system_color)
  1849.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1850.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
  1851.     draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
  1852.       mp_color(actor), normal_color)
  1853.     end
  1854.    
  1855.   #--------------------------------------------------------------------------
  1856.   # overwrite method: draw_actor_tp
  1857.   #--------------------------------------------------------------------------
  1858.   def draw_actor_tp(actor, dx, dy, width = 124)
  1859.     draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  1860.     change_color(system_color)
  1861.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1862.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
  1863.     change_color(tp_color(actor))
  1864.     draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
  1865.   end
  1866.   
  1867. end # Window_BattleStatus

  1868. #==============================================================================
  1869. # ■ Window_BattleActor
  1870. #==============================================================================

  1871. class Window_BattleActor < Window_BattleStatus
  1872.   
  1873.   #--------------------------------------------------------------------------
  1874.   # overwrite method: show
  1875.   #--------------------------------------------------------------------------
  1876.   def show
  1877.     create_flags
  1878.     super
  1879.   end
  1880.   
  1881.   #--------------------------------------------------------------------------
  1882.   # new method: create_flags
  1883.   #--------------------------------------------------------------------------
  1884.   def create_flags
  1885.     set_select_flag(:any)
  1886.     select(0)
  1887.     return if $game_temp.battle_aid.nil?
  1888.     if $game_temp.battle_aid.need_selection?
  1889.       select(0)
  1890.       set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
  1891.     elsif $game_temp.battle_aid.for_user?
  1892.       battler = BattleManager.actor
  1893.       id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
  1894.       select(id)
  1895.       set_select_flag(:user)
  1896.     elsif $game_temp.battle_aid.for_all?
  1897.       select(0)
  1898.       set_select_flag(:all)
  1899.       set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
  1900.     elsif $game_temp.battle_aid.for_random?
  1901.       select(0)
  1902.       set_select_flag(:random) if $game_temp.battle_aid.for_random?
  1903.     end
  1904.   end
  1905.   
  1906.   #--------------------------------------------------------------------------
  1907.   # new method: set_flag
  1908.   #--------------------------------------------------------------------------
  1909.   def set_select_flag(flag)
  1910.     @select_flag = flag
  1911.     case @select_flag
  1912.     when :all, :all_dead, :random
  1913.       @cursor_all = true
  1914.     else
  1915.       @cursor_all = false
  1916.     end
  1917.   end
  1918.   
  1919.   #--------------------------------------------------------------------------
  1920.   # overwrite method: update_cursor
  1921.   #--------------------------------------------------------------------------
  1922.   def update_cursor
  1923.     if @cursor_all
  1924.       cursor_rect.set(0, 0, contents.width, contents.height)
  1925.       self.top_row = 0
  1926.     elsif @index < 0
  1927.       cursor_rect.empty
  1928.     else
  1929.       ensure_cursor_visible
  1930.       cursor_rect.set(item_rect(@index))
  1931.     end
  1932.   end
  1933.   
  1934.   #--------------------------------------------------------------------------
  1935.   # overwrite method: cursor_movable?
  1936.   #--------------------------------------------------------------------------
  1937.   def cursor_movable?
  1938.     return false if @select_flag == :user
  1939.     return super
  1940.   end
  1941.   
  1942.   #--------------------------------------------------------------------------
  1943.   # overwrite method: current_item_enabled?
  1944.   #--------------------------------------------------------------------------
  1945.   def current_item_enabled?
  1946.     return true if $game_temp.battle_aid.nil?
  1947.     if $game_temp.battle_aid.need_selection?
  1948.       member = $game_party.battle_members[@index]
  1949.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  1950.     elsif $game_temp.battle_aid.for_dead_friend?
  1951.       for member in $game_party.battle_members
  1952.         return true if member.dead?
  1953.       end
  1954.       return false
  1955.     end
  1956.     return true
  1957.   end
  1958.   
  1959. end # Window_BattleActor

  1960. #==============================================================================
  1961. # ■ Window_BattleStatusAid
  1962. #==============================================================================

  1963. class Window_BattleStatusAid < Window_BattleStatus
  1964.   
  1965.   #--------------------------------------------------------------------------
  1966.   # public instance variables
  1967.   #--------------------------------------------------------------------------
  1968.   attr_accessor :status_window
  1969.   
  1970.   #--------------------------------------------------------------------------
  1971.   # overwrite method: initialize
  1972.   #--------------------------------------------------------------------------
  1973.   def initialize
  1974.     super
  1975.     self.visible = false
  1976.     self.openness = 255
  1977.   end
  1978.   
  1979.   #--------------------------------------------------------------------------
  1980.   # overwrite method: window_width
  1981.   #--------------------------------------------------------------------------
  1982.   def window_width; return 128; end
  1983.   
  1984.   #--------------------------------------------------------------------------
  1985.   # overwrite method: show
  1986.   #--------------------------------------------------------------------------
  1987.   def show
  1988.     super
  1989.     refresh
  1990.   end
  1991.   
  1992.   #--------------------------------------------------------------------------
  1993.   # overwrite method: refresh
  1994.   #--------------------------------------------------------------------------
  1995.   def refresh
  1996.     contents.clear
  1997.     return if @status_window.nil?
  1998.     draw_item(@status_window.index)
  1999.   end
  2000.   
  2001.   #--------------------------------------------------------------------------
  2002.   # overwrite method: item_rect
  2003.   #--------------------------------------------------------------------------
  2004.   def item_rect(index)
  2005.     return Rect.new(0, 0, contents.width, contents.height)
  2006.   end
  2007.   
  2008. end # Window_BattleStatusAid

  2009. #==============================================================================
  2010. # ■ Window_BattleEnemy
  2011. #==============================================================================

  2012. class Window_BattleEnemy < Window_Selectable
  2013.   
  2014.   #--------------------------------------------------------------------------
  2015.   # overwrite method: initialize
  2016.   #--------------------------------------------------------------------------
  2017.   def initialize(info_viewport)
  2018.     super(0, Graphics.height, window_width, fitting_height(1))
  2019.     refresh
  2020.     self.visible = false
  2021.     @info_viewport = info_viewport
  2022.   end
  2023.   
  2024.   #--------------------------------------------------------------------------
  2025.   # overwrite method: col_max
  2026.   #--------------------------------------------------------------------------
  2027.   def col_max; return item_max; end
  2028.   
  2029.   #--------------------------------------------------------------------------
  2030.   # overwrite method: show
  2031.   #--------------------------------------------------------------------------
  2032.   def show
  2033.     create_flags
  2034.     super
  2035.   end
  2036.   
  2037.   #--------------------------------------------------------------------------
  2038.   # new method: create_flags
  2039.   #--------------------------------------------------------------------------
  2040.   def create_flags
  2041.     set_select_flag(:any)
  2042.     select(0)
  2043.     return if $game_temp.battle_aid.nil?
  2044.     if $game_temp.battle_aid.need_selection?
  2045.       select(0)
  2046.     elsif $game_temp.battle_aid.for_all?
  2047.       select(0)
  2048.       set_select_flag(:all)
  2049.     elsif $game_temp.battle_aid.for_random?
  2050.       select(0)
  2051.       set_select_flag(:random)
  2052.     end
  2053.   end
  2054.   
  2055.   #--------------------------------------------------------------------------
  2056.   # new method: set_flag
  2057.   #--------------------------------------------------------------------------
  2058.   def set_select_flag(flag)
  2059.     @select_flag = flag
  2060.     case @select_flag
  2061.     when :all, :random
  2062.       @cursor_all = true
  2063.     else
  2064.       @cursor_all = false
  2065.     end
  2066.   end
  2067.   
  2068.   #--------------------------------------------------------------------------
  2069.   # new method: select_all?
  2070.   #--------------------------------------------------------------------------
  2071.   def select_all?
  2072.     return true if @select_flag == :all
  2073.     return true if @select_flag == :random
  2074.     return false
  2075.   end
  2076.   
  2077.   #--------------------------------------------------------------------------
  2078.   # overwrite method: update_cursor
  2079.   #--------------------------------------------------------------------------
  2080.   def update_cursor
  2081.     if @cursor_all
  2082.       cursor_rect.set(0, 0, contents.width, contents.height)
  2083.       self.top_row = 0
  2084.     elsif @index < 0
  2085.       cursor_rect.empty
  2086.     else
  2087.       ensure_cursor_visible
  2088.       cursor_rect.set(item_rect(@index))
  2089.     end
  2090.   end
  2091.   
  2092.   #--------------------------------------------------------------------------
  2093.   # overwrite method: cursor_movable?
  2094.   #--------------------------------------------------------------------------
  2095.   def cursor_movable?
  2096.     return false if @select_flag == :user
  2097.     return super
  2098.   end
  2099.   
  2100.   #--------------------------------------------------------------------------
  2101.   # overwrite method: current_item_enabled?
  2102.   #--------------------------------------------------------------------------
  2103.   def current_item_enabled?
  2104.     return true if $game_temp.battle_aid.nil?
  2105.     if $game_temp.battle_aid.need_selection?
  2106.       member = $game_party.battle_members[@index]
  2107.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  2108.     elsif $game_temp.battle_aid.for_dead_friend?
  2109.       for member in $game_party.battle_members
  2110.         return true if member.dead?
  2111.       end
  2112.       return false
  2113.     end
  2114.     return true
  2115.   end
  2116.   
  2117.   #--------------------------------------------------------------------------
  2118.   # overwrite method: enemy
  2119.   #--------------------------------------------------------------------------
  2120.   def enemy; @data[index]; end
  2121.   
  2122.   #--------------------------------------------------------------------------
  2123.   # overwrite method: refresh
  2124.   #--------------------------------------------------------------------------
  2125.   def refresh
  2126.     make_item_list
  2127.     create_contents
  2128.     draw_all_items
  2129.   end
  2130.   
  2131.   #--------------------------------------------------------------------------
  2132.   # overwrite method: make_item_list
  2133.   #--------------------------------------------------------------------------
  2134.   def make_item_list
  2135.     @data = $game_troop.alive_members
  2136.     @data.sort! { |a,b| a.screen_x <=> b.screen_x }
  2137.   end
  2138.   
  2139.   #--------------------------------------------------------------------------
  2140.   # overwrite method: draw_item
  2141.   #--------------------------------------------------------------------------
  2142.   def draw_item(index); return; end
  2143.   
  2144.   #--------------------------------------------------------------------------
  2145.   # overwrite method: update
  2146.   #--------------------------------------------------------------------------
  2147.   def update
  2148.     super
  2149.     return unless active
  2150.     enemy.sprite_effect_type = :whiten
  2151.     return unless select_all?
  2152.     for enemy in $game_troop.alive_members
  2153.       enemy.sprite_effect_type = :whiten
  2154.     end
  2155.   end
  2156.   
  2157. end # Window_BattleEnemy

  2158. #==============================================================================
  2159. # ■ Window_BattleHelp
  2160. #==============================================================================

  2161. class Window_BattleHelp < Window_Help
  2162.   
  2163.   #--------------------------------------------------------------------------
  2164.   # public instance variables
  2165.   #--------------------------------------------------------------------------
  2166.   attr_accessor :actor_window
  2167.   attr_accessor :enemy_window
  2168.   
  2169.   #--------------------------------------------------------------------------
  2170.   # update
  2171.   #--------------------------------------------------------------------------
  2172.   def update
  2173.     super
  2174.     if !self.visible and @text != ""
  2175.       @text = ""
  2176.       return refresh
  2177.     end
  2178.     update_battler_name
  2179.   end
  2180.   
  2181.   #--------------------------------------------------------------------------
  2182.   # update_battler_name
  2183.   #--------------------------------------------------------------------------
  2184.   def update_battler_name
  2185.     return unless @actor_window.active || @enemy_window.active
  2186.     if @actor_window.active
  2187.       battler = $game_party.battle_members[@actor_window.index]
  2188.     elsif @enemy_window.active
  2189.       battler = @enemy_window.enemy
  2190.     end
  2191.     if special_display?
  2192.       refresh_special_case(battler)
  2193.     else
  2194.       refresh_battler_name(battler) if battler_name(battler) != @text
  2195.     end
  2196.   end
  2197.   
  2198.   #--------------------------------------------------------------------------
  2199.   # battler_name
  2200.   #--------------------------------------------------------------------------
  2201.   def battler_name(battler)
  2202.     text = battler.name.clone
  2203.     return text
  2204.   end
  2205.   
  2206.   #--------------------------------------------------------------------------
  2207.   # refresh_battler_name
  2208.   #--------------------------------------------------------------------------
  2209.   def refresh_battler_name(battler)
  2210.     contents.clear
  2211.     reset_font_settings
  2212.     change_color(normal_color)
  2213.     @text = battler_name(battler)
  2214.     icons = battler.state_icons + battler.buff_icons
  2215.     dy = icons.size <= 0 ? line_height / 2 : 0
  2216.     draw_text(0, dy, contents.width, line_height, @text, 1)
  2217.     dx = (contents.width - (icons.size * 24)) / 2
  2218.     draw_actor_icons(battler, dx, line_height, contents.width)
  2219.   end
  2220.   
  2221.   #--------------------------------------------------------------------------
  2222.   # special_display?
  2223.   #--------------------------------------------------------------------------
  2224.   def special_display?
  2225.     return false if $game_temp.battle_aid.nil?
  2226.     return false if $game_temp.battle_aid.for_user?
  2227.     return !$game_temp.battle_aid.need_selection?
  2228.   end
  2229.   
  2230.   #--------------------------------------------------------------------------
  2231.   # refresh_special_case
  2232.   #--------------------------------------------------------------------------
  2233.   def refresh_special_case(battler)
  2234.     if $game_temp.battle_aid.for_opponent?
  2235.       if $game_temp.battle_aid.for_all?
  2236.         text = YEA::BATTLE::HELP_TEXT_ALL_FOES
  2237.       else
  2238.         case $game_temp.battle_aid.number_of_targets
  2239.         when 1
  2240.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
  2241.         else
  2242.           number = $game_temp.battle_aid.number_of_targets
  2243.           text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
  2244.         end
  2245.       end
  2246.     else # $game_temp.battle_aid.for_friend?
  2247.       if $game_temp.battle_aid.for_dead_friend?
  2248.         text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
  2249.       elsif $game_temp.battle_aid.for_random?
  2250.         case $game_temp.battle_aid.number_of_targets
  2251.         when 1
  2252.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
  2253.         else
  2254.           number = $game_temp.battle_aid.number_of_targets
  2255.           text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
  2256.         end
  2257.       else
  2258.         text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
  2259.       end
  2260.     end
  2261.     return if text == @text
  2262.     @text = text
  2263.     contents.clear
  2264.     reset_font_settings
  2265.     draw_text(0, 0, contents.width, line_height*2, @text, 1)
  2266.   end
  2267.   
  2268. end # Window_BattleHelp

  2269. #==============================================================================
  2270. # ■ Window_BattleLog
  2271. #==============================================================================

  2272. class Window_BattleLog < Window_Selectable
  2273.   
  2274.   #--------------------------------------------------------------------------
  2275.   # alias method: display_current_state
  2276.   #--------------------------------------------------------------------------
  2277.   alias window_battlelog_display_current_state_abe display_current_state
  2278.   def display_current_state(subject)
  2279.     subject.make_during_state_popup
  2280.     return unless YEA::BATTLE::MSG_CURRENT_STATE
  2281.     window_battlelog_display_current_state_abe(subject)
  2282.   end
  2283.   
  2284.   #--------------------------------------------------------------------------
  2285.   # alias method: display_use_item
  2286.   #--------------------------------------------------------------------------
  2287.   alias window_battlelog_display_use_item_abe display_use_item
  2288.   def display_use_item(subject, item)
  2289.     return unless YEA::BATTLE::MSG_CURRENT_ACTION
  2290.     window_battlelog_display_use_item_abe(subject, item)
  2291.   end
  2292.   
  2293.   #--------------------------------------------------------------------------
  2294.   # alias method: display_counter
  2295.   #--------------------------------------------------------------------------
  2296.   alias window_battlelog_display_counter_abe display_counter
  2297.   def display_counter(target, item)
  2298.     if YEA::BATTLE::MSG_COUNTERATTACK
  2299.       window_battlelog_display_counter_abe(target, item)
  2300.     else
  2301.       Sound.play_evasion
  2302.     end
  2303.   end
  2304.   
  2305.   #--------------------------------------------------------------------------
  2306.   # alias method: display_reflection
  2307.   #--------------------------------------------------------------------------
  2308.   alias window_battlelog_display_reflection_abe display_reflection
  2309.   def display_reflection(target, item)
  2310.     if YEA::BATTLE::MSG_REFLECT_MAGIC
  2311.       window_battlelog_display_reflection_abe(target, item)
  2312.     else
  2313.       Sound.play_reflection
  2314.     end
  2315.   end
  2316.   
  2317.   #--------------------------------------------------------------------------
  2318.   # alias method: display_substitute
  2319.   #--------------------------------------------------------------------------
  2320.   alias window_battlelog_display_substitute_abe display_substitute
  2321.   def display_substitute(substitute, target)
  2322.     return unless YEA::BATTLE::MSG_SUBSTITUTE_HIT
  2323.     window_battlelog_display_substitute_abe(substitute, target)
  2324.   end
  2325.   
  2326.   #--------------------------------------------------------------------------
  2327.   # alias method: display_failure
  2328.   #--------------------------------------------------------------------------
  2329.   alias window_battlelog_display_failure_abe display_failure
  2330.   def display_failure(target, item)
  2331.     return unless YEA::BATTLE::MSG_FAILURE_HIT
  2332.     window_battlelog_display_failure_abe(target, item)
  2333.   end
  2334.   
  2335.   #--------------------------------------------------------------------------
  2336.   # alias method: display_critical
  2337.   #--------------------------------------------------------------------------
  2338.   alias window_battlelog_display_critical_abe display_critical
  2339.   def display_critical(target, item)
  2340.     return unless YEA::BATTLE::MSG_CRITICAL_HIT
  2341.     window_battlelog_display_critical_abe(target, item)
  2342.   end
  2343.   
  2344.   #--------------------------------------------------------------------------
  2345.   # alias method: display_miss
  2346.   #--------------------------------------------------------------------------
  2347.   alias window_battlelog_display_miss_abe display_miss
  2348.   def display_miss(target, item)
  2349.     return unless YEA::BATTLE::MSG_HIT_MISSED
  2350.     window_battlelog_display_miss_abe(target, item)
  2351.   end
  2352.   
  2353.   #--------------------------------------------------------------------------
  2354.   # alias method: display_evasion
  2355.   #--------------------------------------------------------------------------
  2356.   alias window_battlelog_display_evasion_abe display_evasion
  2357.   def display_evasion(target, item)
  2358.     if YEA::BATTLE::MSG_EVASION
  2359.       window_battlelog_display_evasion_abe(target, item)
  2360.     else
  2361.       if !item || item.physical?
  2362.         Sound.play_evasion
  2363.       else
  2364.         Sound.play_magic_evasion
  2365.       end
  2366.     end
  2367.   end
  2368.   
  2369.   #--------------------------------------------------------------------------
  2370.   # overwrite method: display_hp_damage
  2371.   #--------------------------------------------------------------------------
  2372.   def display_hp_damage(target, item)
  2373.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  2374.     if target.result.hp_damage > 0 && target.result.hp_drain == 0
  2375.       target.perform_damage_effect
  2376.     end
  2377.     Sound.play_recovery if target.result.hp_damage < 0
  2378.     return unless YEA::BATTLE::MSG_HP_DAMAGE
  2379.     add_text(target.result.hp_damage_text)
  2380.     wait
  2381.   end
  2382.   
  2383.   #--------------------------------------------------------------------------
  2384.   # overwrite method: display_mp_damage
  2385.   #--------------------------------------------------------------------------
  2386.   def display_mp_damage(target, item)
  2387.     return if target.dead? || target.result.mp_damage == 0
  2388.     Sound.play_recovery if target.result.mp_damage < 0
  2389.     return unless YEA::BATTLE::MSG_MP_DAMAGE
  2390.     add_text(target.result.mp_damage_text)
  2391.     wait
  2392.   end
  2393.   
  2394.   #--------------------------------------------------------------------------
  2395.   # overwrite method: display_tp_damage
  2396.   #--------------------------------------------------------------------------
  2397.   def display_tp_damage(target, item)
  2398.     return if target.dead? || target.result.tp_damage == 0
  2399.     Sound.play_recovery if target.result.tp_damage < 0
  2400.     return unless YEA::BATTLE::MSG_TP_DAMAGE
  2401.     add_text(target.result.tp_damage_text)
  2402.     wait
  2403.   end
  2404.   
  2405.   #--------------------------------------------------------------------------
  2406.   # alias method: display_added_states
  2407.   #--------------------------------------------------------------------------
  2408.   alias window_battlelog_display_added_states_abe display_added_states
  2409.   def display_added_states(target)
  2410.     return unless YEA::BATTLE::MSG_ADDED_STATES
  2411.     window_battlelog_display_added_states_abe(target)
  2412.   end
  2413.   
  2414.   #--------------------------------------------------------------------------
  2415.   # alias method: display_removed_states
  2416.   #--------------------------------------------------------------------------
  2417.   alias window_battlelog_display_removed_states_abe display_removed_states
  2418.   def display_removed_states(target)
  2419.     return unless YEA::BATTLE::MSG_REMOVED_STATES
  2420.     window_battlelog_display_removed_states_abe(target)
  2421.   end
  2422.   
  2423.   #--------------------------------------------------------------------------
  2424.   # alias method: display_changed_buffs
  2425.   #--------------------------------------------------------------------------
  2426.   alias window_battlelog_display_changed_buffs_abe display_changed_buffs
  2427.   def display_changed_buffs(target)
  2428.     return unless YEA::BATTLE::MSG_CHANGED_BUFFS
  2429.     window_battlelog_display_changed_buffs_abe(target)
  2430.   end
  2431.   
  2432. end # Window_BattleLog

  2433. #==============================================================================
  2434. # ■ Window_SkillList
  2435. #==============================================================================

  2436. class Window_SkillList < Window_Selectable
  2437.   
  2438.   #--------------------------------------------------------------------------
  2439.   # overwrite method: spacing
  2440.   #--------------------------------------------------------------------------
  2441.   def spacing
  2442.     return 8 if $game_party.in_battle
  2443.     return super
  2444.   end
  2445.   
  2446. end # Window_SkillList

  2447. #==============================================================================
  2448. # ■ Window_ItemList
  2449. #==============================================================================

  2450. class Window_ItemList < Window_Selectable
  2451.   
  2452.   #--------------------------------------------------------------------------
  2453.   # overwrite method: spacing
  2454.   #--------------------------------------------------------------------------
  2455.   def spacing
  2456.     return 8 if $game_party.in_battle
  2457.     return super
  2458.   end
  2459.   
  2460. end # Window_ItemList

  2461. #==============================================================================
  2462. # ■ Scene_Battle
  2463. #==============================================================================

  2464. class Scene_Battle < Scene_Base
  2465.   
  2466.   #--------------------------------------------------------------------------
  2467.   # public instance variables
  2468.   #--------------------------------------------------------------------------
  2469.   attr_accessor :enemy_window
  2470.   attr_accessor :info_viewport
  2471.   attr_accessor :spriteset
  2472.   attr_accessor :status_window
  2473.   attr_accessor :status_aid_window
  2474.   attr_accessor :subject
  2475.   
  2476.   #--------------------------------------------------------------------------
  2477.   # alias method: create_spriteset
  2478.   #--------------------------------------------------------------------------
  2479.   alias scene_battle_create_spriteset_abe create_spriteset
  2480.   def create_spriteset
  2481.     BattleManager.init_battle_type
  2482.     scene_battle_create_spriteset_abe
  2483.   end
  2484.   
  2485.   #--------------------------------------------------------------------------
  2486.   # alias method: update_basic
  2487.   #--------------------------------------------------------------------------
  2488.   alias scene_battle_update_basic_abe update_basic
  2489.   def update_basic
  2490.     scene_battle_update_basic_abe
  2491.     update_debug
  2492.   end
  2493.   
  2494.   #--------------------------------------------------------------------------
  2495.   # new method: update_debug
  2496.   #--------------------------------------------------------------------------
  2497.   def update_debug
  2498.     return unless $TEST || $BTEST
  2499.     debug_heal_party if Input.trigger?(:F5)
  2500.     debug_damage_party if Input.trigger?(:F6)
  2501.     debug_fill_tp if Input.trigger?(:F7)
  2502.     debug_kill_all if Input.trigger?(:F8)
  2503.   end
  2504.   
  2505.   #--------------------------------------------------------------------------
  2506.   # new method: debug_heal_party
  2507.   #--------------------------------------------------------------------------
  2508.   def debug_heal_party
  2509.     Sound.play_recovery
  2510.     for member in $game_party.battle_members
  2511.       member.recover_all
  2512.     end
  2513.     @status_window.refresh
  2514.   end
  2515.   
  2516.   #--------------------------------------------------------------------------
  2517.   # new method: debug_damage_party
  2518.   #--------------------------------------------------------------------------
  2519.   def debug_damage_party
  2520.     Sound.play_actor_damage
  2521.     for member in $game_party.alive_members
  2522.       member.hp = 1
  2523.       member.mp = 0
  2524.       member.tp = 0
  2525.     end
  2526.     @status_window.refresh
  2527.   end
  2528.   
  2529.   #--------------------------------------------------------------------------
  2530.   # new method: debug_fill_tp
  2531.   #--------------------------------------------------------------------------
  2532.   def debug_fill_tp
  2533.     Sound.play_recovery
  2534.     for member in $game_party.alive_members
  2535.       member.tp = member.max_tp
  2536.     end
  2537.     @status_window.refresh
  2538.   end
  2539.   
  2540.   #--------------------------------------------------------------------------
  2541.   # new method: debug_kill_all
  2542.   #--------------------------------------------------------------------------
  2543.   def debug_kill_all
  2544.     for enemy in $game_troop.alive_members
  2545.       enemy.hp = 0
  2546.       enemy.perform_collapse_effect
  2547.     end
  2548.     BattleManager.judge_win_loss
  2549.     @log_window.wait
  2550.     @log_window.wait_for_effect
  2551.   end
  2552.   
  2553.   #--------------------------------------------------------------------------
  2554.   # alias method: create_all_windows
  2555.   #--------------------------------------------------------------------------
  2556.   alias scene_battle_create_all_windows_abe create_all_windows
  2557.   def create_all_windows
  2558.     scene_battle_create_all_windows_abe
  2559.     create_battle_status_aid_window
  2560.     set_help_window
  2561.   end
  2562.   
  2563.   #--------------------------------------------------------------------------
  2564.   # alias method: create_info_viewport
  2565.   #--------------------------------------------------------------------------
  2566.   alias scene_battle_create_info_viewport_abe create_info_viewport
  2567.   def create_info_viewport
  2568.     scene_battle_create_info_viewport_abe
  2569.     @status_window.refresh
  2570.   end
  2571.   
  2572.   #--------------------------------------------------------------------------
  2573.   # new method: create_battle_status_aid_window
  2574.   #--------------------------------------------------------------------------
  2575.   def create_battle_status_aid_window
  2576.     @status_aid_window = Window_BattleStatusAid.new
  2577.     @status_aid_window.status_window = @status_window
  2578.     @status_aid_window.x = Graphics.width - @status_aid_window.width
  2579.     @status_aid_window.y = Graphics.height - @status_aid_window.height
  2580.   end
  2581.   
  2582.   #--------------------------------------------------------------------------
  2583.   # overwrite method: create_help_window
  2584.   #--------------------------------------------------------------------------
  2585.   def create_help_window
  2586.     @help_window = Window_BattleHelp.new
  2587.     @help_window.hide
  2588.   end
  2589.   
  2590.   #--------------------------------------------------------------------------
  2591.   # new method: set_help_window
  2592.   #--------------------------------------------------------------------------
  2593.   def set_help_window
  2594.     @help_window.actor_window = @actor_window
  2595.     @help_window.enemy_window = @enemy_window
  2596.   end
  2597.   
  2598.   #--------------------------------------------------------------------------
  2599.   # alias method: create_party_command_window
  2600.   #--------------------------------------------------------------------------
  2601.   alias scene_battle_create_party_command_window_abe create_party_command_window
  2602.   def create_party_command_window
  2603.     scene_battle_create_party_command_window_abe
  2604.     @party_command_window.set_handler(:dir6, method(:command_fight))
  2605.   end
  2606.   
  2607.   #--------------------------------------------------------------------------
  2608.   # alias method: create_actor_command_window
  2609.   #--------------------------------------------------------------------------
  2610.   alias scene_battle_create_actor_command_window_abe create_actor_command_window
  2611.   def create_actor_command_window
  2612.     scene_battle_create_actor_command_window_abe
  2613.     @actor_command_window.set_handler(:dir4, method(:prior_command))
  2614.     @actor_command_window.set_handler(:dir6, method(:next_command))
  2615.   end
  2616.   
  2617.   #--------------------------------------------------------------------------
  2618.   # alias method: create_skill_window
  2619.   #--------------------------------------------------------------------------
  2620.   alias scene_battle_create_skill_window_abe create_skill_window
  2621.   def create_skill_window
  2622.     scene_battle_create_skill_window_abe
  2623.     @skill_window.height = @info_viewport.rect.height
  2624.     @skill_window.width = Graphics.width - @actor_command_window.width
  2625.     @skill_window.y = Graphics.height - @skill_window.height
  2626.   end
  2627.   
  2628.   #--------------------------------------------------------------------------
  2629.   # alias method: create_item_window
  2630.   #--------------------------------------------------------------------------
  2631.   alias scene_battle_create_item_window_abe create_item_window
  2632.   def create_item_window
  2633.     scene_battle_create_item_window_abe
  2634.     @item_window.height = @skill_window.height
  2635.     @item_window.width = @skill_window.width
  2636.     @item_window.y = Graphics.height - @item_window.height
  2637.   end
  2638.   
  2639.   #--------------------------------------------------------------------------
  2640.   # alias method: show_fast?
  2641.   #--------------------------------------------------------------------------
  2642.   alias scene_battle_show_fast_abe show_fast?
  2643.   def show_fast?
  2644.     return true if YEA::BATTLE::AUTO_FAST
  2645.     return scene_battle_show_fast_abe
  2646.   end
  2647.   
  2648.   #--------------------------------------------------------------------------
  2649.   # alias method: next_command
  2650.   #--------------------------------------------------------------------------
  2651.   alias scene_battle_next_command_abe next_command
  2652.   def next_command
  2653.     @status_window.show
  2654.     redraw_current_status
  2655.     @actor_command_window.show
  2656.     @status_aid_window.hide
  2657.     scene_battle_next_command_abe
  2658.   end
  2659.   
  2660.   #--------------------------------------------------------------------------
  2661.   # alias method: prior_command
  2662.   #--------------------------------------------------------------------------
  2663.   alias scene_battle_prior_command_abe prior_command
  2664.   def prior_command
  2665.     redraw_current_status
  2666.     scene_battle_prior_command_abe
  2667.   end
  2668.   
  2669.   #--------------------------------------------------------------------------
  2670.   # new method: redraw_current_status
  2671.   #--------------------------------------------------------------------------
  2672.   def redraw_current_status
  2673.     return if @status_window.index < 0
  2674.     @status_window.draw_item(@status_window.index)
  2675.   end
  2676.   
  2677.   #--------------------------------------------------------------------------
  2678.   # alias method: command_attack
  2679.   #--------------------------------------------------------------------------
  2680.   alias scene_battle_command_attack_abe command_attack
  2681.   def command_attack
  2682.     $game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
  2683.     scene_battle_command_attack_abe
  2684.   end
  2685.   
  2686.   #--------------------------------------------------------------------------
  2687.   # alias method: command_skill
  2688.   #--------------------------------------------------------------------------
  2689.   alias scene_battle_command_skill_abe command_skill
  2690.   def command_skill
  2691.     scene_battle_command_skill_abe
  2692.     @status_window.hide
  2693.     @actor_command_window.hide
  2694.     @status_aid_window.show
  2695.   end
  2696.   
  2697.   #--------------------------------------------------------------------------
  2698.   # alias method: command_item
  2699.   #--------------------------------------------------------------------------
  2700.   alias scene_battle_command_item_abe command_item
  2701.   def command_item
  2702.     scene_battle_command_item_abe
  2703.     @status_window.hide
  2704.     @actor_command_window.hide
  2705.     @status_aid_window.show
  2706.   end
  2707.   
  2708.   #--------------------------------------------------------------------------
  2709.   # overwrite method: on_skill_ok
  2710.   #--------------------------------------------------------------------------
  2711.   def on_skill_ok
  2712.     @skill = @skill_window.item
  2713.     $game_temp.battle_aid = @skill
  2714.     BattleManager.actor.input.set_skill(@skill.id)
  2715.     BattleManager.actor.last_skill.object = @skill
  2716.     if @skill.for_opponent?
  2717.       select_enemy_selection
  2718.     elsif @skill.for_friend?
  2719.       select_actor_selection
  2720.     else
  2721.       @skill_window.hide
  2722.       next_command
  2723.       $game_temp.battle_aid = nil
  2724.     end
  2725.   end
  2726.   
  2727.   #--------------------------------------------------------------------------
  2728.   # alias method: on_skill_cancel
  2729.   #--------------------------------------------------------------------------
  2730.   alias scene_battle_on_skill_cancel_abe on_skill_cancel
  2731.   def on_skill_cancel
  2732.     scene_battle_on_skill_cancel_abe
  2733.     @status_window.show
  2734.     @actor_command_window.show
  2735.     @status_aid_window.hide
  2736.   end
  2737.   
  2738.   #--------------------------------------------------------------------------
  2739.   # overwrite method: on_item_ok
  2740.   #--------------------------------------------------------------------------
  2741.   def on_item_ok
  2742.     @item = @item_window.item
  2743.     $game_temp.battle_aid = @item
  2744.     BattleManager.actor.input.set_item(@item.id)
  2745.     if @item.for_opponent?
  2746.       select_enemy_selection
  2747.     elsif @item.for_friend?
  2748.       select_actor_selection
  2749.     else
  2750.       @item_window.hide
  2751.       next_command
  2752.       $game_temp.battle_aid = nil
  2753.     end
  2754.     $game_party.last_item.object = @item
  2755.   end
  2756.   
  2757.   #--------------------------------------------------------------------------
  2758.   # alias method: on_item_cancel
  2759.   #--------------------------------------------------------------------------
  2760.   alias scene_battle_on_item_cancel_abe on_item_cancel
  2761.   def on_item_cancel
  2762.     scene_battle_on_item_cancel_abe
  2763.     @status_window.show
  2764.     @actor_command_window.show
  2765.     @status_aid_window.hide
  2766.   end
  2767.   
  2768.   #--------------------------------------------------------------------------
  2769.   # alias method: select_actor_selection
  2770.   #--------------------------------------------------------------------------
  2771.   alias scene_battle_select_actor_selection_abe select_actor_selection
  2772.   def select_actor_selection
  2773.     @status_aid_window.refresh
  2774.     scene_battle_select_actor_selection_abe
  2775.     @status_window.hide
  2776.     @skill_window.hide
  2777.     @item_window.hide
  2778.     @help_window.show
  2779.   end
  2780.   
  2781.   #--------------------------------------------------------------------------
  2782.   # alias method: on_actor_ok
  2783.   #--------------------------------------------------------------------------
  2784.   alias scene_battle_on_actor_ok_abe on_actor_ok
  2785.   def on_actor_ok
  2786.     $game_temp.battle_aid = nil
  2787.     scene_battle_on_actor_ok_abe
  2788.     @status_window.show
  2789.     if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
  2790.       @actor_command_window.visible = !@confirm_command_window.visible
  2791.     else
  2792.       @actor_command_window.show
  2793.     end
  2794.     @status_aid_window.hide
  2795.   end
  2796.   
  2797.   #--------------------------------------------------------------------------
  2798.   # alias method: on_actor_cancel
  2799.   #--------------------------------------------------------------------------
  2800.   alias scene_battle_on_actor_cancel_abe on_actor_cancel
  2801.   def on_actor_cancel
  2802.     BattleManager.actor.input.clear
  2803.     @status_aid_window.refresh
  2804.     $game_temp.battle_aid = nil
  2805.     scene_battle_on_actor_cancel_abe
  2806.     case @actor_command_window.current_symbol
  2807.     when :skill
  2808.       @skill_window.show
  2809.     when :item
  2810.       @item_window.show
  2811.     end
  2812.   end
  2813.   
  2814.   #--------------------------------------------------------------------------
  2815.   # alias method: select_enemy_selection
  2816.   #--------------------------------------------------------------------------
  2817.   alias scene_battle_select_enemy_selection_abe select_enemy_selection
  2818.   def select_enemy_selection
  2819.     @status_aid_window.refresh
  2820.     scene_battle_select_enemy_selection_abe
  2821.     @help_window.show
  2822.   end
  2823.   #--------------------------------------------------------------------------
  2824.   # alias method: on_enemy_ok
  2825.   #--------------------------------------------------------------------------
  2826.   alias scene_battle_on_enemy_ok_abe on_enemy_ok
  2827.   def on_enemy_ok
  2828.     $game_temp.battle_aid = nil
  2829.     scene_battle_on_enemy_ok_abe
  2830.   end
  2831.   
  2832.   #--------------------------------------------------------------------------
  2833.   # alias method: on_enemy_cancel
  2834.   #--------------------------------------------------------------------------
  2835.   alias scene_battle_on_enemy_cancel_abe on_enemy_cancel
  2836.   def on_enemy_cancel
  2837.     BattleManager.actor.input.clear
  2838.     @status_aid_window.refresh
  2839.     $game_temp.battle_aid = nil
  2840.     scene_battle_on_enemy_cancel_abe
  2841.     if @skill_window.visible || @item_window.visible
  2842.       @help_window.show
  2843.     else
  2844.       @help_window.hide
  2845.     end
  2846.   end
  2847.   
  2848.   #--------------------------------------------------------------------------
  2849.   # alias method: battle_start
  2850.   #--------------------------------------------------------------------------
  2851.   alias scene_battle_battle_start_abe battle_start
  2852.   def battle_start
  2853.     scene_battle_battle_start_abe
  2854.     return unless YEA::BATTLE::SKIP_PARTY_COMMAND
  2855.     @party_command_window.deactivate
  2856.     if BattleManager.input_start
  2857.       command_fight
  2858.     else
  2859.       turn_start
  2860.     end
  2861.   end
  2862.   
  2863.   #--------------------------------------------------------------------------
  2864.   # overwrite method: turn_end
  2865.   #--------------------------------------------------------------------------
  2866.   def turn_end
  2867.     all_battle_members.each do |battler|
  2868.       battler.on_turn_end
  2869.       status_redraw_target(battler)
  2870.       @log_window.display_auto_affected_status(battler)
  2871.       @log_window.wait_and_clear
  2872.     end
  2873.     update_party_cooldowns if $imported["YEA-CommandParty"]
  2874.     BattleManager.turn_end
  2875.     process_event
  2876.     start_party_command_selection
  2877.     return unless YEA::BATTLE::SKIP_PARTY_COMMAND
  2878.     if BattleManager.input_start
  2879.       @party_command_window.deactivate
  2880.       command_fight
  2881.     else
  2882.       @party_command_window.deactivate
  2883.       turn_start
  2884.     end
  2885.   end
  2886.   
  2887.   #--------------------------------------------------------------------------
  2888.   # overwrite method: execute_action
  2889.   #--------------------------------------------------------------------------
  2890.   def execute_action
  2891.     @subject.sprite_effect_type = :whiten if YEA::BATTLE::FLASH_WHITE_EFFECT
  2892.     use_item
  2893.     @log_window.wait_and_clear
  2894.   end
  2895.   
  2896.   #--------------------------------------------------------------------------
  2897.   # overwrite method: apply_item_effects
  2898.   #--------------------------------------------------------------------------
  2899.   def apply_item_effects(target, item)
  2900.     if $imported["YEA-LunaticObjects"]
  2901.       lunatic_object_effect(:prepare, item, @subject, target)
  2902.     end
  2903.     target.item_apply(@subject, item)
  2904.     status_redraw_target(@subject)
  2905.     status_redraw_target(target) unless target == @subject
  2906.     @log_window.display_action_results(target, item)
  2907.     if $imported["YEA-LunaticObjects"]
  2908.       lunatic_object_effect(:during, item, @subject, target)
  2909.     end
  2910.     perform_collapse_check(target)
  2911.   end
  2912.   
  2913.   #--------------------------------------------------------------------------
  2914.   # overwite method: invoke_counter_attack
  2915.   #--------------------------------------------------------------------------
  2916.   def invoke_counter_attack(target, item)
  2917.     @log_window.display_counter(target, item)
  2918.     attack_skill = $data_skills[target.attack_skill_id]
  2919.     @subject.item_apply(target, attack_skill)
  2920.     status_redraw_target(@subject)
  2921.     status_redraw_target(target) unless target == @subject
  2922.     @log_window.display_action_results(@subject, attack_skill)
  2923.     perform_collapse_check(target)
  2924.     perform_collapse_check(@subject)
  2925.   end
  2926.   
  2927.   #--------------------------------------------------------------------------
  2928.   # new method: perform_collapse_check
  2929.   #--------------------------------------------------------------------------
  2930.   def perform_collapse_check(target)
  2931.     return if YEA::BATTLE::MSG_ADDED_STATES
  2932.     target.perform_collapse_effect if target.can_collapse?
  2933.     @log_window.wait
  2934.     @log_window.wait_for_effect
  2935.   end
  2936.   
  2937.   #--------------------------------------------------------------------------
  2938.   # overwrite method: show_attack_animation
  2939.   #--------------------------------------------------------------------------
  2940.   def show_attack_animation(targets)
  2941.     show_normal_animation(targets, @subject.atk_animation_id1, false)
  2942.     wait_for_animation
  2943.     show_normal_animation(targets, @subject.atk_animation_id2, true)
  2944.   end
  2945.   
  2946.   #--------------------------------------------------------------------------
  2947.   # overwrite method: show_normal_animation
  2948.   #--------------------------------------------------------------------------
  2949.   def show_normal_animation(targets, animation_id, mirror = false)
  2950.     animation = $data_animations[animation_id]
  2951.     return if animation.nil?
  2952.     ani_check = false
  2953.     targets.each do |target|
  2954.       if ani_check && target.animation_id <= 0
  2955.         target.pseudo_ani_id = animation_id
  2956.       else
  2957.         target.animation_id = animation_id
  2958.       end
  2959.       target.animation_mirror = mirror
  2960.       ani_check = true if animation.to_screen?
  2961.     end
  2962.   end
  2963.   
  2964.   #--------------------------------------------------------------------------
  2965.   # overwrite method: process_action_end
  2966.   #--------------------------------------------------------------------------
  2967.   def process_action_end
  2968.     @subject.on_action_end
  2969.     status_redraw_target(@subject)
  2970.     @log_window.display_auto_affected_status(@subject)
  2971.     @log_window.wait_and_clear
  2972.     @log_window.display_current_state(@subject)
  2973.     @log_window.wait_and_clear
  2974.     BattleManager.judge_win_loss
  2975.   end
  2976.   
  2977.   #--------------------------------------------------------------------------
  2978.   # overwrite method: use_item
  2979.   #--------------------------------------------------------------------------
  2980.   def use_item
  2981.     item = @subject.current_action.item
  2982.     @log_window.display_use_item(@subject, item)
  2983.     @subject.use_item(item)
  2984.     status_redraw_target(@subject)
  2985.     if $imported["YEA-LunaticObjects"]
  2986.       lunatic_object_effect(:before, item, @subject, @subject)
  2987.     end
  2988.     process_casting_animation if $imported["YEA-CastAnimations"]
  2989.     targets = @subject.current_action.make_targets.compact rescue []
  2990.     show_animation(targets, item.animation_id) if show_all_animation?(item)
  2991.     targets.each {|target|
  2992.       if $imported["YEA-TargetManager"]
  2993.         target = alive_random_target(target, item) if item.for_random?
  2994.       end
  2995.       item.repeats.times { invoke_item(target, item) } }
  2996.     if $imported["YEA-LunaticObjects"]
  2997.       lunatic_object_effect(:after, item, @subject, @subject)
  2998.     end
  2999.   end
  3000.   
  3001.   #--------------------------------------------------------------------------
  3002.   # alias method: invoke_item
  3003.   #--------------------------------------------------------------------------
  3004.   alias scene_battle_invoke_item_abe invoke_item
  3005.   def invoke_item(target, item)
  3006.     show_animation([target], item.animation_id) if separate_ani?(target, item)
  3007.     if target.dead? != item.for_dead_friend?
  3008.       @subject.last_target_index = target.index
  3009.       return
  3010.     end
  3011.     scene_battle_invoke_item_abe(target, item)
  3012.   end
  3013.   
  3014.   #--------------------------------------------------------------------------
  3015.   # new method: show_all_animation?
  3016.   #--------------------------------------------------------------------------
  3017.   def show_all_animation?(item)
  3018.     return true if item.one_animation
  3019.     return false if $data_animations[item.animation_id].nil?
  3020.     return false unless $data_animations[item.animation_id].to_screen?
  3021.     return true
  3022.   end
  3023.   
  3024.   #--------------------------------------------------------------------------
  3025.   # new method: separate_ani?
  3026.   #--------------------------------------------------------------------------
  3027.   def separate_ani?(target, item)
  3028.     return false if item.one_animation
  3029.     return false if $data_animations[item.animation_id].nil?
  3030.     return false if $data_animations[item.animation_id].to_screen?
  3031.     return target.dead? == item.for_dead_friend?
  3032.   end
  3033.   
  3034.   #--------------------------------------------------------------------------
  3035.   # new method: status_redraw_target
  3036.   #--------------------------------------------------------------------------
  3037.   def status_redraw_target(target)
  3038.     return unless target.actor?
  3039.     @status_window.draw_item($game_party.battle_members.index(target))
  3040.   end
  3041.   
  3042.   #--------------------------------------------------------------------------
  3043.   # alias method: start_party_command_selection
  3044.   #--------------------------------------------------------------------------
  3045.   alias start_party_command_selection_abe start_party_command_selection
  3046.   def start_party_command_selection
  3047.     @status_window.refresh unless scene_changing?
  3048.     start_party_command_selection_abe
  3049.   end
  3050.   
  3051.   #--------------------------------------------------------------------------
  3052.   # overwrite method: refresh_status
  3053.   #--------------------------------------------------------------------------
  3054.   def refresh_status; return; end
  3055.   
  3056.   #--------------------------------------------------------------------------
  3057.   # new method: refresh_autobattler_status_window
  3058.   #--------------------------------------------------------------------------
  3059.   def refresh_autobattler_status_window
  3060.     for member in $game_party.battle_members
  3061.       next unless member.auto_battle?
  3062.       @status_window.draw_item(member.index)
  3063.     end
  3064.   end
  3065.   
  3066.   #--------------------------------------------------------------------------
  3067.   # new method: hide_extra_gauges
  3068.   #--------------------------------------------------------------------------
  3069.   def hide_extra_gauges
  3070.     # Made for compatibility
  3071.   end
  3072.   
  3073.   #--------------------------------------------------------------------------
  3074.   # new method: show_extra_gauges
  3075.   #--------------------------------------------------------------------------
  3076.   def show_extra_gauges
  3077.     # Made for compatibility
  3078.   end
  3079.   
  3080. end # Scene_Battle
  3081. #==============================================================================
  3082. #
  3083. # ▼ YSA Battle System: Classical ATB
  3084. # -- Last Updated: 2012.01.20
  3085. # -- Level: Easy, Normal
  3086. # -- Requires: YEA - Ace Battle Engine v1.15+.
  3087. #
  3088. #==============================================================================

  3089. $imported = {} if $imported.nil?
  3090. $imported["YSA-CATB"] = true

  3091. #==============================================================================
  3092. # ▼ Updates
  3093. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3094. # 2012.01.20 - Compatible with: Lunatic CATB Rate.
  3095. #            - Fix a bug with first strike.
  3096. # 2012.01.19 - Fix a small bug with Action's Icon Updating.
  3097. #            - Fix a critical bug with target selecting.
  3098. #            - Fix a bug with states updating.
  3099. #            - Fix a small bug with actor's status when choosing skill/item.
  3100. #            - Fix a critical bug with auto battle.
  3101. # 2012.01.16 - Fix ATB speed changes when a battler's agi changes.
  3102. #            - Add casting time.
  3103. # 2012.01.16 - Add a function for preemptive strike and surprised.
  3104. #            - Fix a small bug with make action.
  3105. # 2012.01.13 - Bugfix for ATB Type Wait.
  3106. #            - Upgrade a little ATB gauge.
  3107. #            - Upgrade turn count.
  3108. #            - Compatible with: Lunatic CATB Start.
  3109. # 2012.01.12 - Started Script and Finished.
  3110. #
  3111. #==============================================================================
  3112. # ▼ Introduction
  3113. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3114. # This script will add a battle type into YEA Battle Engine Ace.
  3115. # Battle Type: Classical ATB.
  3116. #
  3117. #==============================================================================
  3118. # ▼ Instructions
  3119. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3120. # To install this script, open up your script editor and copy/paste this script
  3121. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  3122. #
  3123. # First, set the default battle system for your game to be :catb by either going
  3124. # to the Ace Battle Engine script and setting DEFAULT_BATTLE_SYSTEM as :catb or
  3125. # by using the following script call:
  3126. #
  3127. # $game_system:set_battle_system(:catb)
  3128. #
  3129. # Second, you can set the default wait for your game by either setting DEFAULT_WAIT
  3130. # or using the following script call:
  3131. #
  3132. # $game_system:set_catb_wait_type(wait_type)
  3133. #
  3134. # Which there are 4 types:
  3135. #   - :full     : ATB always run, except when animation run
  3136. #   - :quarter  : ATB pause when select skill/item/target
  3137. #   - :semi     : ATB pause when select target
  3138. #   - :wait     : ATB pause when choose action for actor
  3139. #
  3140. # Third, you can set the default turn counting for your game by either setting
  3141. # DEFAULT_TURN or using the following script call:
  3142. #
  3143. # $game_system:set_catb_turn_type(turn_type)
  3144. #
  3145. # Which there are 2 types:
  3146. #   - :tick     : Count as a turn after X frame
  3147. #   - :action   : Count as a turn after X actions
  3148. #
  3149. # -----------------------------------------------------------------------------
  3150. # Skill/Item Notetags - These notetags go in the skill/item notebox in the database.
  3151. # -----------------------------------------------------------------------------
  3152. # <charge rate: x%>
  3153. # Enable casting time (skill charge) for Skill or Item. Skill/Item will be charged
  3154. # at normal ATB filled speed * x%, which means it will be charged at x% rate.
  3155. #
  3156. #==============================================================================
  3157. # ▼ Compatibility
  3158. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3159. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  3160. # it will run with RPG Maker VX without adjusting.
  3161. #
  3162. # This script requires Yanfly Engine Ace - Ace Battle Engine v1.15+ and the
  3163. # script must be placed under Ace Battle Engine in the script listing.
  3164. #
  3165. #==============================================================================

  3166. #==============================================================================
  3167. # ▼ Configuration
  3168. #==============================================================================

  3169. module YSA
  3170.   module CATB
  3171.    
  3172.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3173.     # - General Configuration -
  3174.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3175.     DEFAULT_FILL_TIME = 120 # Frames
  3176.     DEFAULT_WAIT      = :wait # :full, :semi, :quarter, :wait
  3177.     FILL_TIME_VARIABLE  = 15 # Change DEFAULT_FILL_TIME by variable.
  3178.    
  3179.     PAUSE_WHEN_ACTIVE_PARTY_COMMAND = true
  3180.    
  3181.     PREEMTIVE_ATB_ACTOR = 70
  3182.     PREEMTIVE_ATB_ENEMY = 0
  3183.     SURPRISE_ATB_ACTOR = 0
  3184.     SURPRISE_ATB_ENEMY = 70
  3185.    
  3186.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3187.     # - Turn Configuration -
  3188.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3189.     DEFAULT_TURN          = :action # :tick, :action
  3190.    
  3191.     TICK_COUNT            = 150    # Turn after TICK_COUNT
  3192.     TICK_COUNT_VARIABLE   = 16     # Change TICK_COUNT by variable.
  3193.    
  3194.     AFTER_ACTION          = 1      # Turn after AFTER_ACTION actions.
  3195.     AFTER_ACTION_VARIABLE  = 17     # Change AFTER_ACTION by variable.
  3196.    
  3197.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3198.     # - Actor ATB Gauges -
  3199.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3200.     GAUGE_COLOR1 = 32
  3201.     GAUGE_COLOR2 = 31
  3202.     CHARGE_COLOR1 = 18
  3203.     CHARGE_COLOR2 = 10
  3204.     ATB_GAUGE_Y_PLUS = 12
  3205.     ATB_PHRASE = "ATB"
  3206.    
  3207.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3208.     # - Enemy ATB Gauges -
  3209.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3210.     SHOW_ENEMY_ATB_GAUGE    = true  # Display Enemy HP Gauge?
  3211.     ENEMY_GAUGE_WIDTH      = 128    # How wide the enemy gauges are.
  3212.     ENEMY_GAUGE_HEIGHT     = 12     # How tall the enemy gauges are.
  3213.     ENEMY_ATB_GAUGE_COLOUR1 = 1     # Colour 1 for ATB.
  3214.     ENEMY_ATB_GAUGE_COLOUR2 = 4     # Colour 2 for ATB.
  3215.     ENEMY_BACKGAUGE_COLOUR = 19     # Gauge Back colour.
  3216.    
  3217.   end
  3218. end

  3219. #==============================================================================
  3220. # ▼ Editting anything past this point may potentially result in causing
  3221. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  3222. # halitosis so edit at your own risk.
  3223. #==============================================================================

  3224. module YSA
  3225.   module REGEXP
  3226.   module USABLEITEM
  3227.    
  3228.     CHARGE_RATE = /<(?:CHARGE_RATE|charge rate):[ ](\d+)?([%%])>/i
  3229.    
  3230.   end # USABLEITEM
  3231.   end # REGEXP
  3232. end # YSA

  3233. #==============================================================================
  3234. # ■ DataManager
  3235. #==============================================================================

  3236. module DataManager
  3237.   
  3238.   #--------------------------------------------------------------------------
  3239.   # alias method: load_database
  3240.   #--------------------------------------------------------------------------
  3241.   class <<self; alias load_database_catb load_database; end
  3242.   def self.load_database
  3243.     load_database_catb
  3244.     load_notetags_catb
  3245.   end
  3246.   
  3247.   #--------------------------------------------------------------------------
  3248.   # new method: load_notetags_catb
  3249.   #--------------------------------------------------------------------------
  3250.   def self.load_notetags_catb
  3251.     groups = [$data_skills, $data_items]
  3252.     for group in groups
  3253.       for obj in group
  3254.         next if obj.nil?
  3255.         obj.load_notetags_catb
  3256.       end
  3257.     end
  3258.   end
  3259.   
  3260. end # DataManager

  3261. #==============================================================================
  3262. # ■ RPG::UsableItem
  3263. #==============================================================================

  3264. class RPG::UsableItem < RPG::BaseItem

  3265.   #--------------------------------------------------------------------------
  3266.   # public instance variables
  3267.   #--------------------------------------------------------------------------
  3268.   attr_accessor :charge_rate
  3269.   attr_accessor :charge_on
  3270.   
  3271.   #--------------------------------------------------------------------------
  3272.   # common cache: load_notetags_catb
  3273.   #--------------------------------------------------------------------------
  3274.   def load_notetags_catb
  3275.     @charge_rate = 100
  3276.     @charge_on = false
  3277.     #---
  3278.     self.note.split(/[\r\n]+/).each { |line|
  3279.       case line
  3280.       #---
  3281.       when YSA::REGEXP::USABLEITEM::CHARGE_RATE
  3282.         @charge_on = true
  3283.         @charge_rate = $1.to_i
  3284.       #---
  3285.       end
  3286.     } # self.note.split
  3287.     #---
  3288.     @charge_rate = 100 if @charge_rate <= 0
  3289.   end
  3290.   
  3291. end # RPG::UsableItem

  3292. #==============================================================================
  3293. # ■ BattleManager
  3294. #==============================================================================

  3295. module BattleManager
  3296.   
  3297.   #--------------------------------------------------------------------------
  3298.   # alias method:
  3299.   #     - make_action_orders
  3300.   #     - prior_command
  3301.   #     - next_command
  3302.   #     - in_turn?
  3303.   #     - battle_start
  3304.   #--------------------------------------------------------------------------
  3305.   class <<self
  3306.     alias catb_make_action_orders make_action_orders
  3307.     alias catb_prior_command prior_command
  3308.     alias catb_next_command next_command
  3309.     alias catb_in_turn? in_turn?
  3310.     alias catb_battle_start battle_start
  3311.   end
  3312.   
  3313.   #--------------------------------------------------------------------------
  3314.   # battle_start
  3315.   #--------------------------------------------------------------------------
  3316.   def self.battle_start
  3317.     catb_battle_start
  3318.     if btype?(:catb)
  3319.       @average_agi = 0
  3320.       make_catb_action_orders
  3321.       battler_hash = $game_party.members + $game_troop.members
  3322.       battler_hash.each { |a|
  3323.         if @preemptive
  3324.           a.make_first_catb_value(1)
  3325.         elsif @surprise
  3326.           a.make_first_catb_value(2)
  3327.         else
  3328.           a.make_first_catb_value(0)
  3329.         end
  3330.         @average_agi += a.agi
  3331.       }
  3332.       @average_agi /= battler_hash.size
  3333.     end
  3334.   end
  3335.   
  3336.   #--------------------------------------------------------------------------
  3337.   # next_command
  3338.   #--------------------------------------------------------------------------
  3339.   def self.next_command
  3340.     return false if btype?(:catb)
  3341.     catb_next_command
  3342.   end
  3343.   
  3344.   #--------------------------------------------------------------------------
  3345.   # alias method: in_turn?
  3346.   #--------------------------------------------------------------------------
  3347.   def self.in_turn?
  3348.     return true if btype?(:catb)
  3349.     return catb_in_turn?
  3350.   end
  3351.   
  3352.   #--------------------------------------------------------------------------
  3353.   # new method: make_catb_action_orders
  3354.   #--------------------------------------------------------------------------
  3355.   class <<self
  3356.   def make_catb_action_orders
  3357.     @action_actors = []
  3358.     @action_enemies = []
  3359.     @action_battlers = []
  3360.   end
  3361.   end
  3362.   
  3363.   #--------------------------------------------------------------------------
  3364.   # new method: average_agi
  3365.   #--------------------------------------------------------------------------
  3366.   class <<self
  3367.   def average_agi
  3368.     return @average_agi
  3369.   end
  3370.   end
  3371.   
  3372.   #--------------------------------------------------------------------------
  3373.   # new method: set_actor
  3374.   #--------------------------------------------------------------------------
  3375.   class <<self
  3376.   def set_actor(actor_index)
  3377.     @actor_index = actor_index
  3378.   end
  3379.   end
  3380.   
  3381.   #--------------------------------------------------------------------------
  3382.   # prior_command
  3383.   #--------------------------------------------------------------------------
  3384.   def self.prior_command
  3385.     return false if btype?(:catb)
  3386.     catb_prior_command
  3387.   end
  3388.   
  3389.   #--------------------------------------------------------------------------
  3390.   # new method: make_catb_action
  3391.   #--------------------------------------------------------------------------
  3392.   class <<self
  3393.   def make_catb_action(battler)
  3394.     make_catb_action_orders if !@action_battlers || !@action_actors || !@action_enemies
  3395.     return false if @action_battlers.include?(battler)
  3396.     @action_battlers.push(battler)
  3397.     @action_actors.push(battler) if battler.actor?
  3398.     @action_enemies.push(battler) if battler.enemy?
  3399.     return true
  3400.   end
  3401.   end
  3402.   
  3403.   #--------------------------------------------------------------------------
  3404.   # new method: delete_catb_action
  3405.   #--------------------------------------------------------------------------
  3406.   class <<self
  3407.   def delete_catb_action(battler)
  3408.     return false if !battler
  3409.     @action_battlers.delete(battler)
  3410.     @action_battlers = @action_battlers.compact
  3411.     @action_actors.delete(battler) if battler.actor?
  3412.     @action_actors = @action_actors.compact
  3413.     @action_enemies.delete(battler) if battler.enemy?
  3414.     @action_enemies = @action_enemies.compact
  3415.     return true
  3416.   end
  3417.   end
  3418.   
  3419.   #--------------------------------------------------------------------------
  3420.   # new method: action_list
  3421.   #--------------------------------------------------------------------------
  3422.   class <<self
  3423.   def action_list(type = :all)
  3424.     return @action_battlers if type == :all
  3425.     return @action_actors if type == :actor
  3426.     return @action_enemies if type = :enemy
  3427.   end
  3428.   end
  3429.   
  3430. end # BattleManager

  3431. #==============================================================================
  3432. # ■ Game_System
  3433. #==============================================================================

  3434. class Game_System
  3435.   
  3436.   #--------------------------------------------------------------------------
  3437.   # alias method: set_battle_system
  3438.   #--------------------------------------------------------------------------
  3439.   alias qatb_set_battle_system set_battle_system
  3440.   def set_battle_system(type)
  3441.     case type
  3442.     when :catb; @battle_system = :catb
  3443.     else;       qatb_set_battle_system(type)
  3444.     end
  3445.   end
  3446.   
  3447.   #--------------------------------------------------------------------------
  3448.   # alias method: battle_system_corrected
  3449.   #--------------------------------------------------------------------------
  3450.   alias qatb_battle_system_corrected battle_system_corrected
  3451.   def battle_system_corrected(type)
  3452.     case type
  3453.     when :catb; return :catb
  3454.     else;       return qatb_battle_system_corrected(type)
  3455.     end
  3456.   end
  3457.   
  3458.   #--------------------------------------------------------------------------
  3459.   # new method: catb_fill_time
  3460.   #--------------------------------------------------------------------------
  3461.   def catb_fill_time
  3462.     return $game_variables[YSA::CATB::FILL_TIME_VARIABLE] > 0 ? $game_variables[YSA::CATB::FILL_TIME_VARIABLE] : YSA::CATB::DEFAULT_FILL_TIME
  3463.   end
  3464.   
  3465.   #--------------------------------------------------------------------------
  3466.   # new method: catb_tick_count
  3467.   #--------------------------------------------------------------------------
  3468.   def catb_tick_count
  3469.     return $game_variables[YSA::CATB::TICK_COUNT_VARIABLE] > 0 ? $game_variables[YSA::CATB::TICK_COUNT_VARIABLE] : YSA::CATB::TICK_COUNT
  3470.   end
  3471.   
  3472.   #--------------------------------------------------------------------------
  3473.   # new method: catb_after_action
  3474.   #--------------------------------------------------------------------------
  3475.   def catb_after_action
  3476.     return $game_variables[YSA::CATB::AFTER_ACTION_VARIABLE] > 0 ? $game_variables[YSA::CATB::AFTER_ACTION_VARIABLE] : YSA::CATB::AFTER_ACTION
  3477.   end
  3478.   
  3479.   #--------------------------------------------------------------------------
  3480.   # new method: catb_turn_type
  3481.   #--------------------------------------------------------------------------
  3482.   def catb_turn_type
  3483.     return @catb_turn_type ? @catb_turn_type : YSA::CATB::DEFAULT_TURN
  3484.   end
  3485.   
  3486.   #--------------------------------------------------------------------------
  3487.   # new method: catb_wait_type
  3488.   #--------------------------------------------------------------------------
  3489.   def catb_wait_type
  3490.     return @catb_wait_type ? @catb_wait_type : YSA::CATB::DEFAULT_WAIT
  3491.   end
  3492.   
  3493.   #--------------------------------------------------------------------------
  3494.   # new method: set_catb_wait_type
  3495.   #--------------------------------------------------------------------------
  3496.   def set_catb_wait_type(type = :full)
  3497.     @catb_wait_type = type
  3498.   end
  3499.   
  3500.   #--------------------------------------------------------------------------
  3501.   # new method: set_catb_turn_type
  3502.   #--------------------------------------------------------------------------
  3503.   def set_catb_turn_type(type = :tick)
  3504.     @catb_turn_type = type
  3505.   end
  3506.   
  3507. end # Game_System

  3508. #==============================================================================
  3509. # ■ Game_Battler
  3510. #==============================================================================

  3511. class Game_Battler < Game_BattlerBase
  3512.   
  3513.   MAX_CATB_VALUE = 100000.0
  3514.   
  3515.   #--------------------------------------------------------------------------
  3516.   # alias method: initialize
  3517.   #--------------------------------------------------------------------------
  3518.   alias catb_initialize initialize
  3519.   def initialize
  3520.     catb_initialize
  3521.     @catb_value = 0
  3522.     @ct_catb_value = 0
  3523.   end
  3524.   
  3525.   #--------------------------------------------------------------------------
  3526.   # new method: base_gain_catb
  3527.   #--------------------------------------------------------------------------
  3528.   def base_gain_catb
  3529.     return MAX_CATB_VALUE / $game_system.catb_fill_time
  3530.   end
  3531.   
  3532.   #--------------------------------------------------------------------------
  3533.   # new method: real_gain_catb
  3534.   #--------------------------------------------------------------------------
  3535.   def real_gain_catb
  3536.     value = (self.agi.to_f / BattleManager.average_agi) * base_gain_catb
  3537.     return value
  3538.   end
  3539.   
  3540.   #--------------------------------------------------------------------------
  3541.   # new method: make_catb_update
  3542.   #--------------------------------------------------------------------------
  3543.   def make_catb_update
  3544.     return if @catb_value >= MAX_CATB_VALUE
  3545.     return if not normal?
  3546.     value = $imported["YSA-LunaticCATBRate"] ? lunatic_catb_rate_formula : real_gain_catb
  3547.     @catb_value += [value, MAX_CATB_VALUE - @catb_value].min
  3548.   end
  3549.   
  3550.   #--------------------------------------------------------------------------
  3551.   # new method: make_catb_action
  3552.   #--------------------------------------------------------------------------
  3553.   def make_catb_action
  3554.     return unless @catb_value >= MAX_CATB_VALUE
  3555.     return clear_catb if not normal?
  3556.     return BattleManager.make_catb_action(self)
  3557.   end
  3558.   
  3559.   #--------------------------------------------------------------------------
  3560.   # new method: make_ct_catb_update
  3561.   #--------------------------------------------------------------------------
  3562.   def make_ct_catb_update
  3563.     return if @catb_value < MAX_CATB_VALUE
  3564.     return if @ct_catb_value >= MAX_CATB_VALUE
  3565.     return if !self.current_action
  3566.     return if !self.current_action.item
  3567.     return if self.actor? && !self.current_action.confirm
  3568.     clear_catb if not normal?
  3569.     @ct_catb_value = MAX_CATB_VALUE if !self.current_action.item.charge_on
  3570.     value = $imported["YSA-LunaticCATBRate"] ? lunatic_catb_rate_formula : real_gain_catb
  3571.     @ct_catb_value += [value * self.current_action.item.charge_rate / 100, MAX_CATB_VALUE - @ct_catb_value].min
  3572.   end
  3573.   
  3574.   #--------------------------------------------------------------------------
  3575.   # new method: charge_skill_done?
  3576.   #--------------------------------------------------------------------------
  3577.   def charge_skill_done?
  3578.     return @catb_value >= MAX_CATB_VALUE && @ct_catb_value >= MAX_CATB_VALUE
  3579.   end
  3580.   
  3581.   #--------------------------------------------------------------------------
  3582.   # new method: clear_catb
  3583.   #--------------------------------------------------------------------------
  3584.   def clear_catb
  3585.     make_actions
  3586.     @catb_value = 0
  3587.     @ct_catb_value = 0
  3588.     BattleManager.clear_actor if self.actor? && BattleManager.actor == self
  3589.     BattleManager.delete_catb_action(self)
  3590.   end
  3591.   
  3592.   #--------------------------------------------------------------------------
  3593.   # new method: make_first_catb_value
  3594.   #--------------------------------------------------------------------------
  3595.   def make_first_catb_value(pre = 0)
  3596.     make_actions
  3597.     @catb_value = 0
  3598.     @catb_value = YSA::CATB::PREEMTIVE_ATB_ACTOR if self.actor? && pre == 1
  3599.     @catb_value = YSA::CATB::PREEMTIVE_ATB_ENEMY if self.enemy? && pre == 1
  3600.     @catb_value = YSA::CATB::SURPRISE_ATB_ACTOR if self.actor? && pre == 2
  3601.     @catb_value = YSA::CATB::SURPRISE_ATB_ENEMY if self.enemy? && pre == 2
  3602.     lunatic_catb_start_formula(pre) if $imported["YSA-LunaticCATBStart"]
  3603.   end
  3604.   
  3605.   #--------------------------------------------------------------------------
  3606.   # new method: catb_filled_rate
  3607.   #--------------------------------------------------------------------------
  3608.   def catb_filled_rate
  3609.     return @catb_value / MAX_CATB_VALUE
  3610.   end
  3611.   
  3612.   #--------------------------------------------------------------------------
  3613.   # new method: catb_ct_filled_rate
  3614.   #--------------------------------------------------------------------------
  3615.   def catb_ct_filled_rate
  3616.     return @catb_value < MAX_CATB_VALUE ? 0 : @ct_catb_value / MAX_CATB_VALUE
  3617.   end
  3618.   
  3619. end # Game_Battler

  3620. #==============================================================================
  3621. # ■ Game_Action
  3622. #==============================================================================

  3623. class Game_Action
  3624.    
  3625.   #--------------------------------------------------------------------------
  3626.   # alias method: clear
  3627.   #--------------------------------------------------------------------------
  3628.   alias catb_clear clear
  3629.   def clear
  3630.     catb_clear
  3631.     @confirm = false
  3632.   end
  3633.   
  3634.   #--------------------------------------------------------------------------
  3635.   # new method: confirm=
  3636.   #--------------------------------------------------------------------------
  3637.   def confirm=(con)
  3638.     @confirm = con
  3639.   end
  3640.   
  3641.   #--------------------------------------------------------------------------
  3642.   # new method: confirm
  3643.   #--------------------------------------------------------------------------
  3644.   def confirm
  3645.     return @subject.auto_battle? ? true : @confirm
  3646.   end

  3647. end # Game_Action

  3648. #==============================================================================
  3649. # ■ Window_Base
  3650. #==============================================================================

  3651. class Window_Base < Window
  3652.   #--------------------------------------------------------------------------
  3653.   # catb_gauge_color
  3654.   #--------------------------------------------------------------------------
  3655.   def catb_color1;      text_color(YSA::CATB::GAUGE_COLOR1);      end;
  3656.   def catb_color2;      text_color(YSA::CATB::GAUGE_COLOR2);      end;
  3657.   def charge_color1;      text_color(YSA::CATB::CHARGE_COLOR1);      end;
  3658.   def charge_color2;      text_color(YSA::CATB::CHARGE_COLOR2);      end;
  3659. end # Window_Base

  3660. #==============================================================================
  3661. # ■ Window_BattleStatus
  3662. #==============================================================================

  3663. class Window_BattleStatus < Window_Selectable
  3664.   
  3665.   #--------------------------------------------------------------------------
  3666.   # alias method: draw_item
  3667.   #--------------------------------------------------------------------------
  3668.   alias catb_draw_item draw_item
  3669.   def draw_item(index)
  3670.     catb_draw_item(index)
  3671.     actor = battle_members[index]
  3672.     rect = item_rect(index)
  3673.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS + YSA::CATB::ATB_GAUGE_Y_PLUS
  3674.     return unless BattleManager.btype?(:catb)
  3675.     draw_actor_catb(actor, rect.x+2, line_height*1+gx, rect.width-4)
  3676.   end
  3677.   
  3678.   #--------------------------------------------------------------------------
  3679.   # new method: draw_actor_catb
  3680.   #--------------------------------------------------------------------------
  3681.   def draw_actor_catb(actor, dx, dy, width = 124)
  3682.     draw_gauge(dx, dy, width, actor.catb_filled_rate, catb_color1, catb_color2)
  3683.     if actor.catb_ct_filled_rate > 0
  3684.       draw_gauge(dx, dy, width, actor.catb_ct_filled_rate, charge_color1, charge_color2)
  3685.     end
  3686.     change_color(system_color)
  3687.     cy = (Font.default_size - contents.font.size) / 2 + 1
  3688.     draw_text(dx+2, dy+cy, 30, line_height, YSA::CATB::ATB_PHRASE)
  3689.   end
  3690.   
  3691.   #--------------------------------------------------------------------------
  3692.   # new method: draw_item_actor_catb
  3693.   #--------------------------------------------------------------------------
  3694.   def draw_item_actor_catb(index)
  3695.     return if index.nil?
  3696.     actor = battle_members[index]
  3697.     rect = item_rect(index)
  3698.     return if actor.nil?
  3699.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS + YSA::CATB::ATB_GAUGE_Y_PLUS
  3700.     draw_actor_catb(actor, rect.x+2, line_height*1+gx, rect.width-4)
  3701.   end
  3702.   
  3703.   #--------------------------------------------------------------------------
  3704.   # new method: refresh_catb
  3705.   #--------------------------------------------------------------------------
  3706.   def refresh_catb
  3707.     return unless BattleManager.btype?(:catb)
  3708.     item_max.times {|i| draw_item_actor_catb(i) }
  3709.   end
  3710.   
  3711. end # Window_BattleStatus

  3712. #==============================================================================
  3713. # ■ Sprite_Battler
  3714. #==============================================================================

  3715. class Sprite_Battler < Sprite_Base
  3716.   
  3717.   #--------------------------------------------------------------------------
  3718.   # alias method: initialize
  3719.   #--------------------------------------------------------------------------
  3720.   alias sprite_battler_initialize_catb initialize
  3721.   def initialize(viewport, battler = nil)
  3722.     sprite_battler_initialize_catb(viewport, battler)
  3723.     create_enemy_gauges_catb
  3724.   end
  3725.   
  3726.   #--------------------------------------------------------------------------
  3727.   # alias method: dispose
  3728.   #--------------------------------------------------------------------------
  3729.   alias sprite_battler_dispose_catb dispose
  3730.   def dispose
  3731.     sprite_battler_dispose_catb
  3732.     dispose_enemy_gauges_catb
  3733.   end
  3734.   
  3735.   #--------------------------------------------------------------------------
  3736.   # alias method: update
  3737.   #--------------------------------------------------------------------------
  3738.   alias sprite_battler_update_catb update
  3739.   def update
  3740.     sprite_battler_update_catb
  3741.     update_enemy_gauges_catb
  3742.   end

  3743.   #--------------------------------------------------------------------------
  3744.   # new method: create_enemy_gauges_catb
  3745.   #--------------------------------------------------------------------------
  3746.   def create_enemy_gauges_catb
  3747.     return if @battler.nil?
  3748.     return if @battler.actor?
  3749.     return unless BattleManager.btype?(:catb)
  3750.     @catb_back_gauge_viewport = Enemy_CATB_Gauge_Viewport.new(@battler, self, :back)
  3751.     @catb_gauge_viewport = Enemy_CATB_Gauge_Viewport.new(@battler, self, :catb)
  3752.     @catb_ct_gauge_viewport = Enemy_CATB_Gauge_Viewport.new(@battler, self, :catbct)
  3753.   end
  3754.   
  3755.   #--------------------------------------------------------------------------
  3756.   # new method: dispose_enemy_gauges_catb
  3757.   #--------------------------------------------------------------------------
  3758.   def dispose_enemy_gauges_catb
  3759.     return unless BattleManager.btype?(:catb)
  3760.     @catb_back_gauge_viewport.dispose unless @catb_back_gauge_viewport.nil?
  3761.     @catb_gauge_viewport.dispose unless @catb_gauge_viewport.nil?
  3762.     @catb_ct_gauge_viewport.dispose unless @catb_ct_gauge_viewport.nil?
  3763.   end
  3764.   
  3765.   #--------------------------------------------------------------------------
  3766.   # new method: update_enemy_gauges_catb
  3767.   #--------------------------------------------------------------------------
  3768.   def update_enemy_gauges_catb
  3769.     return unless BattleManager.btype?(:catb)
  3770.     @catb_back_gauge_viewport.update unless @catb_back_gauge_viewport.nil?
  3771.     @catb_gauge_viewport.update unless @catb_gauge_viewport.nil?
  3772.     @catb_ct_gauge_viewport.update unless @catb_ct_gauge_viewport.nil?
  3773.   end
  3774.   
  3775. end # Sprite_Battler

  3776. #==============================================================================
  3777. # ■ Enemy_CATB_Gauge_Viewport
  3778. #==============================================================================

  3779. class Enemy_CATB_Gauge_Viewport < Viewport
  3780.   
  3781.   #--------------------------------------------------------------------------
  3782.   # initialize
  3783.   #--------------------------------------------------------------------------
  3784.   def initialize(battler, sprite, type)
  3785.     @battler = battler
  3786.     @base_sprite = sprite
  3787.     @type = type
  3788.     dw = YSA::CATB::ENEMY_GAUGE_WIDTH
  3789.     dw += 2 if @type == :back
  3790.     @start_width = dw
  3791.     dh = YSA::CATB::ENEMY_GAUGE_HEIGHT
  3792.     dh += 2 if @type == :back
  3793.     rect = Rect.new(0, 0, dw, dh)
  3794.     super(rect)
  3795.     self.z = 125
  3796.     create_gauge_sprites
  3797.     self.visible = false
  3798.     update_position
  3799.   end
  3800.   
  3801.   #--------------------------------------------------------------------------
  3802.   # dispose
  3803.   #--------------------------------------------------------------------------
  3804.   def dispose
  3805.     @sprite.bitmap.dispose unless @sprite.bitmap.nil?
  3806.     @sprite.dispose
  3807.     super
  3808.   end
  3809.   
  3810.   #--------------------------------------------------------------------------
  3811.   # update
  3812.   #--------------------------------------------------------------------------
  3813.   def update
  3814.     super
  3815.     self.visible = @battler.dead? ? false : YSA::CATB::SHOW_ENEMY_ATB_GAUGE
  3816.     update_position
  3817.     update_gauge
  3818.   end
  3819.   
  3820.   #--------------------------------------------------------------------------
  3821.   # create_gauge_sprites
  3822.   #--------------------------------------------------------------------------
  3823.   def create_gauge_sprites
  3824.     @sprite = Plane.new(self)
  3825.     dw = self.rect.width * 2
  3826.     @sprite.bitmap = Bitmap.new(dw, self.rect.height)
  3827.     case @type
  3828.     when :back
  3829.       colour1 = Colour.text_colour(YSA::CATB::ENEMY_BACKGAUGE_COLOUR)
  3830.       colour2 = Colour.text_colour(YSA::CATB::ENEMY_BACKGAUGE_COLOUR)
  3831.     when :catb
  3832.       colour1 = Colour.text_colour(YSA::CATB::ENEMY_ATB_GAUGE_COLOUR1)
  3833.       colour2 = Colour.text_colour(YSA::CATB::ENEMY_ATB_GAUGE_COLOUR2)
  3834.     when :catbct
  3835.       colour1 = Colour.text_colour(YSA::CATB::CHARGE_COLOR1)
  3836.       colour2 = Colour.text_colour(YSA::CATB::CHARGE_COLOR2)
  3837.     end
  3838.     dx = 0
  3839.     dy = 0
  3840.     dw = self.rect.width
  3841.     dh = self.rect.height
  3842.     self.rect.width = target_gauge_width unless @type == :back
  3843.     @gauge_width = target_gauge_width
  3844.     @sprite.bitmap.gradient_fill_rect(dx, dy, dw, dh, colour1, colour2)
  3845.     @sprite.bitmap.gradient_fill_rect(dw, dy, dw, dh, colour2, colour1)
  3846.   end

  3847.   #--------------------------------------------------------------------------
  3848.   # update_position
  3849.   #--------------------------------------------------------------------------
  3850.   def update_position
  3851.     dx = @battler.screen_x - @start_width / 2
  3852.     self.rect.x = dx
  3853.     dh = self.rect.height + 1
  3854.     dh += 2 unless @type == :back
  3855.     dy = [@battler.screen_y, Graphics.height - dh - 120].min
  3856.     dy += 1 unless @type == :back
  3857.     dy -= YEA::BATTLE::ENEMY_GAUGE_HEIGHT if $imported["YEA-EnemyHPBars"]
  3858.     self.rect.y = dy
  3859.   end
  3860.   
  3861.   #--------------------------------------------------------------------------
  3862.   # update_gauge
  3863.   #--------------------------------------------------------------------------
  3864.   def update_gauge
  3865.     return if @gauge_width == target_gauge_width
  3866.     @gauge_width = target_gauge_width if @type == :catb
  3867.     @gauge_width = target_gauge_width_ct if @type == :catbct
  3868.     return if @type == :back
  3869.     self.rect.width = @gauge_width
  3870.   end
  3871.   
  3872.   #--------------------------------------------------------------------------
  3873.   # target_gauge_width
  3874.   #--------------------------------------------------------------------------
  3875.   def target_gauge_width
  3876.     return @battler.catb_filled_rate * @start_width
  3877.   end
  3878.   
  3879.   #--------------------------------------------------------------------------
  3880.   # target_gauge_width_ct
  3881.   #--------------------------------------------------------------------------
  3882.   def target_gauge_width_ct
  3883.     return @battler.catb_ct_filled_rate * @start_width
  3884.   end
  3885.   
  3886. end # Enemy_CATB_Gauge_Viewport
  3887.   
  3888. #==============================================================================
  3889. # ■ Window_BattleEnemy
  3890. #==============================================================================

  3891. class Window_BattleEnemy < Window_Selectable
  3892.   
  3893.   #--------------------------------------------------------------------------
  3894.   # alias method: col_max
  3895.   #--------------------------------------------------------------------------
  3896.   alias catb_col_max col_max
  3897.   def col_max; return catb_col_max == 0 ? 1 : catb_col_max; end

  3898. end # Window_BattleEnemy

  3899. #==============================================================================
  3900. # ■ Scene_Battle
  3901. #==============================================================================

  3902. class Scene_Battle < Scene_Base
  3903.   
  3904.   #--------------------------------------------------------------------------
  3905.   # alias method: process_action
  3906.   #--------------------------------------------------------------------------
  3907.   alias catb_process_action process_action
  3908.   def process_action
  3909.     process_catb
  3910.     perform_catb_action(@subject, true) if BattleManager.action_forced?
  3911.     catb_process_action unless BattleManager.btype?(:catb)
  3912.   end
  3913.   
  3914.   #--------------------------------------------------------------------------
  3915.   # new method: catb_pause?
  3916.   #--------------------------------------------------------------------------
  3917.   def catb_pause?
  3918.     return YSA::CATB::PAUSE_WHEN_ACTIVE_PARTY_COMMAND if @party_command_window.active
  3919.     return false if $game_system.catb_wait_type == :full
  3920.     return true if $game_system.catb_wait_type == :wait && (@actor_command_window.active || @skill_window.active || @item_window.active || @actor_window.active || @enemy_window.active)
  3921.     return true if $game_system.catb_wait_type == :quarter && (@skill_window.active || @item_window.active || @actor_window.active || @enemy_window.active)
  3922.     return true if $game_system.catb_wait_type == :semi && (@actor_window.active || @enemy_window.active)
  3923.   end
  3924.   
  3925.   #--------------------------------------------------------------------------
  3926.   # new method: process_catb
  3927.   #--------------------------------------------------------------------------
  3928.   def process_catb
  3929.     return unless SceneManager.scene_is?(Scene_Battle)
  3930.     return if scene_changing?
  3931.     return unless BattleManager.btype?(:catb)
  3932.     return if catb_pause?
  3933.     battler_hash = $game_party.members + $game_troop.members
  3934.     battler_hash.each { |a|
  3935.       a.make_catb_update
  3936.       a.make_catb_action
  3937.       a.make_ct_catb_update
  3938.     }
  3939.     #--- Update Tick Turn
  3940.     if $game_system.catb_turn_type == :tick
  3941.       @tick_clock = 0 if !@tick_clock
  3942.       @tick_clock += 1
  3943.       if @tick_clock >= $game_system.catb_tick_count
  3944.         @tick_clock = 0
  3945.         all_battle_members.each { |battler|
  3946.           battler.on_turn_end
  3947.         }
  3948.         @status_window.refresh
  3949.         $game_troop.increase_turn
  3950.       end
  3951.     end
  3952.     #--- Fix make action
  3953.     BattleManager.action_list(:actor).each { |battler|
  3954.       battler.make_actions if (battler.actor? && !battler.input)
  3955.     }
  3956.     #---
  3957.     @status_window.refresh_catb
  3958.     #--- Setup Actor
  3959.     @f_actor_index = 0 if !@f_actor_index || @f_actor_index < 0 || @f_actor_index + 1 > BattleManager.action_list(:actor).size
  3960.     f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  3961.     @f_actor_index += 1 if (@f_actor_index + 1) < BattleManager.action_list(:actor).size && f_actor && f_actor.input && f_actor.input.item && f_actor.input.confirm
  3962.     f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  3963.     if f_actor && f_actor.input && !f_actor.input.item && (!BattleManager.actor || @status_window.index != BattleManager.actor.index)
  3964.       BattleManager.set_actor(f_actor.index)
  3965.       @status_window.select(BattleManager.actor.index)
  3966.       @actor_command_window.setup(BattleManager.actor)
  3967.     end
  3968.     BattleManager.action_list.each { |battler|
  3969.       battler.make_actions if battler.enemy?
  3970.       perform_catb_action(battler) if !@subject
  3971.     }
  3972.   end
  3973.   
  3974.   #--------------------------------------------------------------------------
  3975.   # new method: perform_catb_action
  3976.   #--------------------------------------------------------------------------
  3977.   def perform_catb_action(subject, forced = false)
  3978.     return if subject && !subject.charge_skill_done?
  3979.     return if subject && subject.actor? && !forced && !subject.input
  3980.     return if subject && subject.actor? && !forced && !subject.input.item
  3981.     return if subject && subject.actor? && !forced && !subject.input.confirm
  3982.     @subject = subject if subject
  3983.     return if !@subject
  3984.     if @subject.current_action
  3985.       @subject.current_action.prepare
  3986.       execute_action
  3987.       process_event
  3988.       @status_aid_window.refresh if @status_aid_window.visible
  3989.       if $game_system.catb_turn_type == :action
  3990.         @tick_action = 0 if !@tick_action
  3991.         @tick_action += 1
  3992.         if @tick_action >= $game_system.catb_after_action
  3993.           @tick_action = 0
  3994.           all_battle_members.each { |battler|
  3995.             battler.on_turn_end
  3996.           }
  3997.           @status_window.refresh
  3998.           $game_troop.increase_turn
  3999.         end
  4000.       end
  4001.       @subject.on_action_end
  4002.     end
  4003.     return if BattleManager.judge_win_loss
  4004.     @subject.clear_catb
  4005.     @status_window.draw_item(@subject.index) if @subject.actor?
  4006.     @subject = nil
  4007.   end
  4008.   
  4009.   #--------------------------------------------------------------------------
  4010.   # alias method: create_actor_command_window
  4011.   #--------------------------------------------------------------------------
  4012.   alias catb_create_actor_command_window create_actor_command_window
  4013.   def create_actor_command_window
  4014.     catb_create_actor_command_window
  4015.     if BattleManager.btype?(:catb)
  4016.       @actor_command_window.set_handler(:dir4, method(:prior_f_actor))
  4017.       @actor_command_window.set_handler(:dir6, method(:next_f_actor))
  4018.     end
  4019.   end
  4020.   
  4021.   #--------------------------------------------------------------------------
  4022.   # new method: prior_f_actor
  4023.   #--------------------------------------------------------------------------
  4024.   def prior_f_actor
  4025.     if @f_actor_index && BattleManager.action_list(:actor).size > 0
  4026.       @f_actor_index -= 1
  4027.       @f_actor_index = 0 if @f_actor_index < 0
  4028.       f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  4029.       if f_actor
  4030.         BattleManager.set_actor(f_actor.index)
  4031.         @status_window.select(BattleManager.actor.index)
  4032.         @actor_command_window.setup(BattleManager.actor)
  4033.       end
  4034.     end
  4035.   end
  4036.   
  4037.   #--------------------------------------------------------------------------
  4038.   # new method: next_f_actor
  4039.   #--------------------------------------------------------------------------
  4040.   def next_f_actor
  4041.     if @f_actor_index && BattleManager.action_list(:actor).size > 0
  4042.       @f_actor_index += 1
  4043.       @f_actor_index = 0 if (@f_actor_index + 1) > BattleManager.action_list(:actor).size
  4044.       f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  4045.       if f_actor
  4046.         BattleManager.set_actor(f_actor.index)
  4047.         @status_window.select(BattleManager.actor.index)
  4048.         @actor_command_window.setup(BattleManager.actor)
  4049.       end
  4050.     end
  4051.   end
  4052.   
  4053.   #--------------------------------------------------------------------------
  4054.   # alias method: turn_start
  4055.   #--------------------------------------------------------------------------
  4056.   alias catb_turn_start turn_start
  4057.   def turn_start
  4058.     if BattleManager.btype?(:catb)
  4059.       @party_command_window.close
  4060.       @actor_command_window.close
  4061.       @status_window.unselect
  4062.       @log_window.wait
  4063.       @log_window.clear
  4064.     else
  4065.       catb_turn_start
  4066.     end
  4067.   end
  4068.   
  4069.   #--------------------------------------------------------------------------
  4070.   # alias method: command_guard
  4071.   #--------------------------------------------------------------------------
  4072.   alias catb_command_guard command_guard
  4073.   def command_guard
  4074.     BattleManager.actor.input.confirm = true
  4075.     catb_command_guard
  4076.     @status_window.draw_item(BattleManager.actor.index)
  4077.   end
  4078.   
  4079.   #--------------------------------------------------------------------------
  4080.   # alias method: command_attack
  4081.   #--------------------------------------------------------------------------
  4082.   alias catb_command_attack command_attack
  4083.   def command_attack
  4084.     catb_command_attack
  4085.     @status_window.draw_item(BattleManager.actor.index)
  4086.   end
  4087.   
  4088.   #--------------------------------------------------------------------------
  4089.   # alias method: on_enemy_ok
  4090.   #--------------------------------------------------------------------------
  4091.   alias catb_on_enemy_ok on_enemy_ok
  4092.   def on_enemy_ok
  4093.     BattleManager.actor.input.confirm = true
  4094.     catb_on_enemy_ok
  4095.   end
  4096.   
  4097.   #--------------------------------------------------------------------------
  4098.   # alias method: on_enemy_cancel
  4099.   #--------------------------------------------------------------------------
  4100.   alias catb_on_enemy_cancel on_enemy_cancel
  4101.   def on_enemy_cancel
  4102.     BattleManager.actor.input.confirm = false
  4103.     catb_on_enemy_cancel
  4104.     @status_window.draw_item(BattleManager.actor.index)
  4105.   end
  4106.   
  4107.   #--------------------------------------------------------------------------
  4108.   # alias method: on_actor_ok
  4109.   #--------------------------------------------------------------------------
  4110.   alias catb_on_actor_ok on_actor_ok
  4111.   def on_actor_ok
  4112.     BattleManager.actor.input.confirm = true
  4113.     catb_on_actor_ok
  4114.   end
  4115.   
  4116.   #--------------------------------------------------------------------------
  4117.   # alias method: on_actor_cancel
  4118.   #--------------------------------------------------------------------------
  4119.   alias catb_on_actor_cancel on_actor_cancel
  4120.   def on_actor_cancel
  4121.     BattleManager.actor.input.confirm = false
  4122.     catb_on_actor_cancel
  4123.     @status_window.draw_item(BattleManager.actor.index)
  4124.   end
  4125.   
  4126.   #--------------------------------------------------------------------------
  4127.   # alias method: on_skill_ok
  4128.   #--------------------------------------------------------------------------
  4129.   alias catb_on_skill_ok on_skill_ok
  4130.   def on_skill_ok
  4131.     catb_on_skill_ok
  4132.     @status_window.draw_item(BattleManager.actor.index)
  4133.   end
  4134.   
  4135.   #--------------------------------------------------------------------------
  4136.   # alias method: on_item_ok
  4137.   #--------------------------------------------------------------------------
  4138.   alias catb_on_item_ok on_item_ok
  4139.   def on_item_ok
  4140.     catb_on_item_ok
  4141.     @status_window.draw_item(BattleManager.actor.index)
  4142.   end
  4143.   
  4144.   #--------------------------------------------------------------------------
  4145.   # alias method: update_info_viewport
  4146.   #--------------------------------------------------------------------------
  4147.   alias catb_update_info_viewport update_info_viewport
  4148.   def update_info_viewport
  4149.     catb_update_info_viewport
  4150.     if BattleManager.btype?(:catb)
  4151.       move_info_viewport(128) if @actor_command_window.active || @actor_window.active || @enemy_window.active || (($game_troop.all_dead? || $game_party.all_dead?)&& @bug_fix1)
  4152.       move_info_viewport(0)   if @party_command_window.active
  4153.     end
  4154.   end
  4155.   
  4156.   #--------------------------------------------------------------------------
  4157.   # rewrite method: perform_collapse_check
  4158.   #--------------------------------------------------------------------------
  4159.   def perform_collapse_check(target)
  4160.     return if YEA::BATTLE::MSG_ADDED_STATES
  4161.     if $game_troop.all_dead? || $game_party.all_dead?
  4162.       if @actor_window.active || @enemy_window.active
  4163.         @bug_fix1 = true
  4164.         @help_window.hide
  4165.         @actor_window.hide.deactivate
  4166.         @enemy_window.hide.deactivate
  4167.       end
  4168.     end
  4169.     target.perform_collapse_effect if target.can_collapse?
  4170.     @log_window.wait
  4171.   end
  4172.    
  4173. end # Scene_Battle
  4174. module YEA
  4175.   module BATTLE
  4176.     DEFAULT_BATTLE_SYSTEM = :catb
  4177.   end
  4178. end
  4179. #==============================================================================
  4180. #
  4181. # ▼ End of File
  4182. #
  4183. #==============================================================================
复制代码

作者: 奉命在先    时间: 2012-8-15 19:19
如果中途出现隐藏敌人我方信息栏就消失了,而且如果有个敌人设定为无法打倒,然后将敌人打成空血后又会跳错
作者: sszny    时间: 2012-8-16 18:50
怎么说呢,没什么特别亮点-=-
不过这么长-=-究竟还有什么隐藏内容呢
作者: 1243852    时间: 2012-9-2 19:23
没什么特别的啊。。。
作者: 疯狂异形    时间: 2012-10-1 05:30
等等……咦消失了?
被禁了?
呃ummmmm,大概是我运气不好吧
作者: cxyhn    时间: 2012-12-14 15:05
神马都没看到。。
作者: 夕阳幻光    时间: 2012-12-21 15:18
看看先,不知道倒地怎么样
作者: qw707869242    时间: 2012-12-22 15:20
没看到阿!




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1