Advertisement
roninator2

Yanfly Battle Engine mod - Showing a tp gauge and icon

Dec 4th, 2024 (edited)
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 126.93 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # �� Yanfly Engine Ace - Ace Battle Engine v1.24 (mod by Roninator2)
  4. # -- Last Updated: 2012.08.21
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. # -- Mod by Roninator2 - Showing a tp gauge and icon
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-BattleEngine"] = true
  12.  
  13. #==============================================================================
  14. # �� Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.08.06 - Bug fixed: Repeating sound effect when using a revive spell/item.
  17. #
  18. # 2012.08.06 - Bug fixed: Screen effect for Slip Damage.
  19. #            - Bug fixed: Performing Collapse for Slip Damage.
  20. #            - Bug fixed: Divided by Zero when Troop has no member.
  21. # 2012.03.04 - Bug fixed: Input crash bug.
  22. # 2012.02.13 - Bug fixed: Odd Victory game crash fixed.
  23. # 2012.02.12 - Bug fixed: Displayed damage in combat log is correct now.
  24. # 2012.01.29 - Visual Changes: Buff stacks now show one popup upon one skill.
  25. # 2012.01.24 - Compatibility Update: Enemy Levels
  26. # 2012.01.18 - Bug Fixed: Help Window clears text upon selecting nil items.
  27. # 2012.01.11 - Added <one animation> tag for multi-hit skills to play an
  28. #              animation only once.
  29. #            - Reduced lag from battle system constantly recreating bitmaps.
  30. # 2012.01.10 - Compatibility Update: Battle System FTB
  31. # 2012.01.09 - Anticrash methods implemented.
  32. #            - Damage Popups are now separate for damage formulas and recovery.
  33. # 2012.01.05 - Bug fixed: Game no longer crashes with escape skills/items.
  34. # 2012.01.02 - Compatibility Update: Target Manager
  35. #            - Added Option: AUTO_FAST
  36. #            - Random hits now show animations individually.
  37. # 2011.12.30 - Compatibility Update: Enemy Levels
  38. #            - Added Option to center the actors in the HUD.
  39. # 2011.12.27 - Bug fixed: TP Damage skills and items no longer crash game.
  40. #            - Default battle system bug fixes are now included from YEA's Ace
  41. #              Core Engine.
  42. #            - Groundwork is also made to support future battle system types.
  43. #            - Multi-hit actions no longer linger when a target dies during the
  44. #              middle of one of the hits.
  45. #            - Compatibility Update: Lunatic Objects v1.02
  46. # 2011.12.26 - Bug fixed: Multi-hit popups occured even after an enemy's dead.
  47. # 2011.12.22 - Bug fixed: Elemental Resistance popup didn't show.
  48. # 2011.12.20 - Bug fixed: Death state popups against immortal states.
  49. #            - Bug fixed: During State popup fix.
  50. #            - Added HIDE_POPUP_SWITCH.
  51. # 2011.12.17 - Compatibiilty Update: Cast Animations
  52. # 2011.12.15 - Compatibility Update: Battle Command List
  53. # 2011.12.14 - Compatibility Update: Lunatic Objects
  54. # 2011.12.13 - Compatibility Update: Command Party
  55. # 2011.12.12 - Bug fixed: Turn stalling if no inputable members.
  56. # 2011.12.10 - Compatibility update for Automatic Party HUD.
  57. #            - Popup graphical bug fixed.
  58. #            - Bug fixed: Didn't wait for boss dead animations.
  59. #            - Bug fixed: Surprise attacks that froze the game.
  60. #            - Bug fixed: Popups didn't show for straight recovery effects.
  61. # 2011.12.08 - Finished Script.
  62. # 2011.12.04 - Started Script.
  63. #
  64. #==============================================================================
  65. # �� Introduction
  66. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  67. # Ace Battle Engine works as a foundation for future battle engine add-ons. It
  68. # allows for easier management of the battle engine without adding too many
  69. # features, allowing users to customize what they want as they see fit. While
  70. # the Ace Battle Engine isn't an entirely new engine, it gives users control
  71. # that RPG Maker VX Ace didn't originally give them.
  72. #
  73. # Furthermore, this script provides some new features. They are as follows:
  74. #
  75. # -----------------------------------------------------------------------------
  76. # Animation Fixes
  77. # -----------------------------------------------------------------------------
  78. # Though the Yanfly Engine Ace - Ace Core Engine script contains these fixes,
  79. # these fixes are included in this script as well to ensure it's working for
  80. # the battle script in the event someone chooses not to work with the Ace Core
  81. # Engine script. The animation fixes prevent excessive animation overlaying
  82. # (and making the screen look really ugly) and prevents animation clashing
  83. # between two dual wielding normal attack animations.
  84. #
  85. # -----------------------------------------------------------------------------
  86. # Enemy Animations
  87. # -----------------------------------------------------------------------------
  88. # Enemies now show battle animations when they deliver attacks and skills
  89. # against the player's party. Before in RPG Maker VX Ace, it was nothing more
  90. # than just sound effects and the screen shaking. Now, animations play where
  91. # the status window is and relative to the position of each party member.
  92. #
  93. # -----------------------------------------------------------------------------
  94. # Left/Right Command Selection
  95. # -----------------------------------------------------------------------------
  96. # While choosing actions, the player can press Left or Right to move freely
  97. # between (alive) actors to change their skills. Players no longer have to
  98. # cancel all the way back to change one person's skill and reselect everything.
  99. # On that note, there is now the option that when a battle starts or at the
  100. # end of a turn, players will start immediately at command selection rather
  101. # than needing to select "Fight" in the Party Command Window.
  102. #
  103. # -----------------------------------------------------------------------------
  104. # Popups
  105. # -----------------------------------------------------------------------------
  106. # Dealing damage, inflicting states, adding buffs, landing critical hits,
  107. # striking weaknesses, missing attacks, you name it, there's probably a popup
  108. # for it. Popups deliver information to the player in a quick or orderly
  109. # fashion without requiring the player to read lines of text.
  110. #
  111. # -----------------------------------------------------------------------------
  112. # Targeting Window
  113. # -----------------------------------------------------------------------------
  114. # When targeting enemies, the window is no longer displayed. Instead, the
  115. # targeted enemies are highlighted and their names are shown at the top of the
  116. # screen in a help window. Another thing that's changed is when skills that
  117. # target multiple targets are selected, there is a confirmation step that the
  118. # player must take before continuing. In this confirmation step, all of the
  119. # multiple targets are selected and in the help window would display the scope
  120. # of the skill (such as "All Foes" or "Random Foes"). RPG Maker VX Ace skipped
  121. # this step by default.
  122. #
  123. # -----------------------------------------------------------------------------
  124. # Toggling On and Off Special Effects and Text
  125. # -----------------------------------------------------------------------------
  126. # Not everybody likes having the screen shake or the enemies blink when they
  127. # take damage. These effects can now be toggled on and off. Certain text can
  128. # also be toggled on and off from appearing. A lot of the displayed text has
  129. # been rendered redundant through the use of popups.
  130. #
  131. # -----------------------------------------------------------------------------
  132. # Visual Battle Status Window
  133. # -----------------------------------------------------------------------------
  134. # Rather than just having rows of names with HP and MP bars next to them, the
  135. # Battle Status Window now displays actors' faces and their gauges aligned at
  136. # the bottom. More status effects can be shown in addition to showing more
  137. # members on screen at once. The Battle Status Window is also optimized to
  138. # refresh less (thus, removing potential lag from the system).
  139. #
  140. # -----------------------------------------------------------------------------
  141. # Window Position Changes
  142. # -----------------------------------------------------------------------------
  143. # Windows such as the Skill Window and Item Window have been rearranged to
  144. # always provide the player a clear view of the battlefield rather than opening
  145. # up and covering everything. As such, the window positions are placed at the
  146. # bottom of the screen and are repositioned.
  147. #
  148. #==============================================================================
  149. # �� Instructions
  150. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  151. # To install this script, open up your script editor and copy/paste this script
  152. # to an open slot below �� Materials/�ef?T but above �� Main. Remember to save.
  153. #
  154. # -----------------------------------------------------------------------------
  155. # Skill Notetags - These notetags go in the skills notebox in the database.
  156. # -----------------------------------------------------------------------------
  157. # <one animation>
  158. # Causes the action to display the action animation only once, even if it's a
  159. # multi-hit action. This is used primarily for non-all scope targeting.
  160. #
  161. # -----------------------------------------------------------------------------
  162. # Item Notetags - These notetags go in the items notebox in the database.
  163. # -----------------------------------------------------------------------------
  164. # <one animation>
  165. # Causes the action to display the action animation only once, even if it's a
  166. # multi-hit action. This is used primarily for non-all scope targeting.
  167. #
  168. # -----------------------------------------------------------------------------
  169. # Enemy Notetags - These notetags go in the enemy notebox in the database.
  170. # -----------------------------------------------------------------------------
  171. # <atk ani 1: x>
  172. # <atk ani 2: x>
  173. # Changes the normal attack animation of the particular enemy to animation x.
  174. # Attack animation 1 is the first one that plays. If there's a second animation
  175. # then the second one will play after in mirrored form.
  176. #
  177. # -----------------------------------------------------------------------------
  178. # State Notetags - These notetags go in the state notebox in the database.
  179. # -----------------------------------------------------------------------------
  180. # <popup add: string>
  181. # <popup rem: string>
  182. # <popup dur: string>
  183. # Status effects now create popups whenever they're inflicted. However, if you
  184. # don't like that a certain status effect uses a particular colour setting,
  185. # change "string" to one of the rulesets below to cause that popup to use a
  186. # different ruleset.
  187. #
  188. # <popup hide add>
  189. # <popup hide rem>
  190. # <popup hide dur>
  191. # Not everybody wants status effects to show popups when inflicted. When this
  192. # is the case, insert the respective tag to hide popups from appearing when the
  193. # state is added, removed, or during the stand-by phases.
  194. #
  195. # -----------------------------------------------------------------------------
  196. # Debug Tools - These tools only work during Test Play.
  197. # -----------------------------------------------------------------------------
  198. # - F5 Key -
  199. # Recovers all actors. Restores their HP and MP to max. Does not affect TP.
  200. # All states and buffs are removed whether they are positive or negative.
  201. #
  202. # - F6 Key -
  203. # Sets all actors to have 1 HP, 0 MP, and 0 TP. States are unaffected.
  204. #
  205. # - F7 Key -
  206. # Sets all actors to have max TP. Everything else is unaffected.
  207. #
  208. # - F8 Key -
  209. # Kills all enemies in battle. Ends the battle quickly.
  210. #
  211. #==============================================================================
  212. # �� Compatibility
  213. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  214. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  215. # it will run with RPG Maker VX without adjusting.
  216. #
  217. #==============================================================================
  218.  
  219. module YEA
  220.   module BATTLE
  221.    
  222.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  223.     # - General Battle Settings -
  224.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  225.     # These settings are adjusted for the overall battle system. These are
  226.     # various miscellaneous options to adjust. Each of the settings below will
  227.     # explain what they do. Change default enemy battle animations here, too.
  228.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  229.     BLINK_EFFECTS      = false  # Blink sprite when damaged?
  230.     FLASH_WHITE_EFFECT = true   # Flash enemy white when it starts an attack.
  231.     SCREEN_SHAKE       = false  # Shake screen in battle?
  232.     SKIP_PARTY_COMMAND = true   # Skips the Fight/Escape menu.
  233.     AUTO_FAST          = true   # Causes message windows to not wait.
  234.     ENEMY_ATK_ANI      = 36     # Sets default attack animation for enemies.
  235.    
  236.     # If this switch is ON, popups will be hidden. If OFF, the popups will be
  237.     # shown. If you do not wish to use this switch, set it to 0.
  238.     HIDE_POPUP_SWITCH  = 0
  239.    
  240.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  241.     # - Battle Status Window -
  242.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  243.     # This sets the default battle system your game will use. If your game
  244.     # doesn't have any other battle systems installed, it will use :dtb.
  245.     #
  246.     # Battle System        Requirement
  247.     #   :dtb               - Default Turn Battle. Default system.
  248.     #   :ftb               - YEA Battle System Add-On: Free Turn Battle
  249.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  250.     DEFAULT_BATTLE_SYSTEM = :dtb     # Default battle system set.
  251.    
  252.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  253.     # - Battle Status Window -
  254.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  255.     # Here, you can adjust the settings for the battle status window. The
  256.     # battle status window, by default, will show the actor's face, HP, MP, TP
  257.     # (if viable), and any inflicted status effects.
  258.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  259.     BATTLESTATUS_NAME_FONT_SIZE = 20    # Font size used for name.
  260.     BATTLESTATUS_TEXT_FONT_SIZE = 16    # Font size used for HP, MP, TP.
  261.     BATTLESTATUS_NO_ACTION_ICON = 185   # No action icon.
  262.     BATTLESTATUS_HPGAUGE_Y_PLUS = 11    # Y Location buffer used for HP gauge.
  263.     BATTLESTATUS_CENTER_FACES   = false # Center faces for the Battle Status.
  264.     BATTLESTATUS_TP_ICON_GAUGE  = true  # Draw TP Icon or Gauge; true = icon
  265.     BATTLESTATUS_TP_ICON        = 805   # Draw TP Icon for the Battle Status.
  266.    
  267.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  268.     # - Help Window Text -
  269.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  270.     # When selecting a target to attack, this is the text that will be shown
  271.     # in place of a target's name for special cases. These special cases are
  272.     # for selections that were originally non-targetable battle scopes.
  273.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  274.     HELP_TEXT_ALL_FOES        = "All Foes"
  275.     HELP_TEXT_ONE_RANDOM_FOE  = "One Random Foe"
  276.     HELP_TEXT_MANY_RANDOM_FOE = "%d Random Foes"
  277.     HELP_TEXT_ALL_ALLIES      = "All Allies"
  278.     HELP_TEXT_ALL_DEAD_ALLIES = "All Dead Allies"
  279.     HELP_TEXT_ONE_RANDOM_ALLY = "One Random Ally"
  280.     HELP_TEXT_RANDOM_ALLIES   = "%d Random Allies"
  281.    
  282.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  283.     # - Popup Settings -
  284.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  285.     # These settings will adjust the popups that appear in battle. Popups
  286.     # deliver information to your player as battlers deal damage, inflict
  287.     # status effects, and more.
  288.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  289.     ENABLE_POPUPS  = true     # Set this to false if you wish to disable them.
  290.     FLASH_CRITICAL = true     # Sets critical hits to flash.
  291.    
  292.     # This hash adjusts the popup settings that will govern how popups appear.
  293.     # Adjust them accordingly.
  294.     POPUP_SETTINGS ={
  295.       :offset     => -24,         # Height offset of a popup.
  296.       :fade       => 12,          # Fade rate for each popup.
  297.       :full       => 60,          # Frames before a popup fades.
  298.       :hp_dmg     => "-%s ",      # SprintF for HP damage.
  299.       :hp_heal    => "+%s ",      # SprintF for HP healing.
  300.       :mp_dmg     => "-%s MP",    # SprintF for MP damage.
  301.       :mp_heal    => "+%s MP",    # SprintF for MP healing.
  302.       :tp_dmg     => "-%s TP",    # SprintF for MP damage.
  303.       :tp_heal    => "+%s TP",    # SprintF for MP healing.
  304.       :drained    => "DRAIN",     # Text display for draining HP/MP.
  305.       :critical   => "CRITICAL!", # Text display for critical hit.
  306.       :missed     => "MISS",      # Text display for missed attack.
  307.       :evaded     => "EVADE!",    # Text display for evaded attack.
  308.       :nulled     => "NULL",      # Text display for nulled attack.
  309.       :failed     => "FAILED",    # Text display for a failed attack.
  310.       :add_state  => "+%s",       # SprintF for added states.
  311.       :rem_state  => "-%s",       # SprintF for removed states.
  312.       :dur_state  => "%s",        # SprintF for during states.
  313.       :ele_rates  => true,        # This will display elemental affinities.
  314.       :ele_wait   => 20,          # This is how many frames will wait.
  315.       :weakpoint  => "WEAKPOINT", # Appears if foe is weak to element.
  316.       :resistant  => "RESIST",    # Appears if foe is resistant to element.
  317.       :immune     => "IMMUNE",    # Appears if foe is immune to element.
  318.       :absorbed   => "ABSORB",    # Appears if foe can absorb the element.
  319.       :add_buff   => "%s?{",      # Appears when a positive buff is applied.
  320.       :add_debuff => "%s?|",      # Appears when a negative buff is applied.
  321.     } # Do not remove this.
  322.    
  323.     # This is the default font used for the popups. Adjust them accordingly
  324.     # or even add new ones.
  325.     DEFAULT = ["VL Gothic", "Verdana", "Arial", "Courier"]
  326.    
  327.     # The following are the various rules that govern the individual popup
  328.     # types that will appear. Adjust them accordingly. Here is a list of what
  329.     # each category does.
  330.     #   Zoom1    The zoom the popup starts at. Values over 2.0 may cause lag.
  331.     #   Zoom2    The zoom the popup goes to. Values over 2.0 may cause lag.
  332.     #   Sz       The font size used for the popup text.
  333.     #   Bold     Applying bold for the popup text.
  334.     #   Italic   Applying italic for the popup text.
  335.     #   Red      The red value of the popup text.
  336.     #   Grn      The green value of the popup text.
  337.     #   Blu      The blue value of the popup text.
  338.     #   Font     The font used for the popup text.
  339.     POPUP_RULES ={
  340.       # Type     => [ Zoom1, Zoom2, Sz, Bold, Italic, Red, Grn, Blu, Font]
  341.       "DEFAULT"  => [   2.0,   1.0, 24, true,  false, 255, 255, 255, DEFAULT],
  342.       "CRITICAL" => [   2.0,   1.0, 24, true,  false, 255,  80,  80, DEFAULT],
  343.       "HP_DMG"   => [   2.0,   1.0, 36, true,  false, 255, 255, 255, DEFAULT],
  344.       "HP_HEAL"  => [   2.0,   1.0, 36, true,  false, 130, 250, 130, DEFAULT],
  345.       "MP_DMG"   => [   2.0,   1.0, 36, true,  false, 220, 180, 255, DEFAULT],
  346.       "MP_HEAL"  => [   2.0,   1.0, 36, true,  false, 160, 230, 255, DEFAULT],
  347.       "TP_DMG"   => [   2.0,   1.0, 36, true,  false, 242, 108,  78, DEFAULT],
  348.       "TP_HEAL"  => [   2.0,   1.0, 36, true,  false, 251, 175,  92, DEFAULT],
  349.       "ADDSTATE" => [   2.0,   1.0, 24, true,  false, 240, 100, 100, DEFAULT],
  350.       "REMSTATE" => [   2.0,   1.0, 24, true,  false, 125, 170, 225, DEFAULT],
  351.       "DURSTATE" => [   2.0,   1.0, 24, true,  false, 255, 240, 150, DEFAULT],
  352.       "DRAIN"    => [   2.0,   1.0, 36, true,  false, 250, 190, 255, DEFAULT],
  353.       "POSITIVE" => [   2.0,   1.0, 24, true,  false, 110, 210, 245, DEFAULT],
  354.       "NEGATIVE" => [   2.0,   1.0, 24, true,  false, 245, 155, 195, DEFAULT],
  355.       "WEAK_ELE" => [   0.5,   1.0, 24, true,  false, 240, 110,  80, DEFAULT],
  356.       "IMMU_ELE" => [   0.5,   1.0, 24, true,  false, 185, 235, 255, DEFAULT],
  357.       "REST_ELE" => [   0.5,   1.0, 24, true,  false, 145, 230, 180, DEFAULT],
  358.       "ABSB_ELE" => [   0.5,   1.0, 24, true,  false, 250, 190, 255, DEFAULT],
  359.       "BUFF"     => [   2.0,   1.0, 24, true,  false, 255, 240, 100, DEFAULT],
  360.       "DEBUFF"   => [   2.0,   1.0, 24, true,  false, 160, 130, 200, DEFAULT],
  361.     } # Do not remove this.
  362.    
  363.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  364.     # - Streamlined Messages -
  365.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  366.     # Want to remove some of those annoying messages that appear all the time?
  367.     # Now you can! Select which messages you want to enable or disable. Some of
  368.     # these messages will be rendered useless due to popups.
  369.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  370.     MSG_ENEMY_APPEARS  = false  # Message when enemy appears start of battle.
  371.     MSG_CURRENT_STATE  = false  # Show which states has affected battler.
  372.     MSG_CURRENT_ACTION = true   # Show the current action of the battler.
  373.     MSG_COUNTERATTACK  = true   # Show the message for a counterattack.
  374.     MSG_REFLECT_MAGIC  = true   # Show message for reflecting magic attacks.
  375.     MSG_SUBSTITUTE_HIT = true   # Show message for ally taking another's hit.
  376.     MSG_FAILURE_HIT    = false  # Show effect failed against target.
  377.     MSG_CRITICAL_HIT   = false  # Show attack was a critical hit.
  378.     MSG_HIT_MISSED     = false  # Show attack missed the target.
  379.     MSG_EVASION        = false  # Show attack was evaded by the target.
  380.     MSG_HP_DAMAGE      = false  # Show HP damage to target.
  381.     MSG_MP_DAMAGE      = false  # Show MP damage to target.
  382.     MSG_TP_DAMAGE      = false  # Show TP damage to target.
  383.     MSG_ADDED_STATES   = false  # Show target's added states.
  384.     MSG_REMOVED_STATES = false  # Show target's removed states.
  385.     MSG_CHANGED_BUFFS  = false  # Show target's changed buffs.
  386.    
  387.   end # BATTLE
  388. end # YEA
  389.  
  390. #==============================================================================
  391. # �� Editting anything past this point may potentially result in causing
  392. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  393. # halitosis so edit at your own risk.
  394. #==============================================================================
  395.  
  396. module YEA
  397.   module REGEXP
  398.   module ENEMY
  399.    
  400.     ATK_ANI1 = /<(?:ATK_ANI_1|atk ani 1):[ ]*(\d+)>/i
  401.     ATK_ANI2 = /<(?:ATK_ANI_2|atk ani 2):[ ]*(\d+)>/i
  402.    
  403.   end # ENEMY
  404.   module USABLEITEM
  405.    
  406.     ONE_ANIMATION = /<(?:ONE_ANIMATION|one animation)>/i
  407.    
  408.   end # USABLEITEM
  409.   module STATE
  410.    
  411.     POPUP_ADD = /<(?:POPUP_ADD_RULE|popup add rule|popup add):[ ](.*)>/i
  412.     POPUP_REM = /<(?:POPUP_REM_RULE|popup rem rule|popup rem):[ ](.*)>/i
  413.     POPUP_DUR = /<(?:POPUP_DUR_RULE|popup dur rule|popup dur):[ ](.*)>/i
  414.    
  415.     HIDE_ADD  = /<(?:POPUP_HIDE_ADD|popup hide add|hide add)>/i
  416.     HIDE_REM  = /<(?:POPUP_HIDE_REM|popup hide rem|hide rem)>/i
  417.     HIDE_DUR  = /<(?:POPUP_HIDE_DUR|popup hide dur|hide dur)>/i
  418.    
  419.   end # STATE
  420.   end # REGEXP
  421. end # YEA
  422.  
  423. #==============================================================================
  424. # ?! Switch
  425. #==============================================================================
  426.  
  427. module Switch
  428.  
  429.   #--------------------------------------------------------------------------
  430.   # self.hide_popups
  431.   #--------------------------------------------------------------------------
  432.   def self.hide_popups
  433.     return false if YEA::BATTLE::HIDE_POPUP_SWITCH <= 0
  434.     return $game_switches[YEA::BATTLE::HIDE_POPUP_SWITCH]
  435.   end
  436.  
  437. end # Switch
  438.  
  439. #==============================================================================
  440. # ?! Colour
  441. #==============================================================================
  442.  
  443. module Colour
  444.  
  445.   #--------------------------------------------------------------------------
  446.   # self.text_colour
  447.   #--------------------------------------------------------------------------
  448.   def self.text_colour(index)
  449.     windowskin = Cache.system("Window")
  450.     x = 64 + (index % 8) * 8
  451.     y = 96 + (index / 8) * 8
  452.     return windowskin.get_pixel(x, y)
  453.   end
  454.  
  455. end # Colour
  456.  
  457. #==============================================================================
  458. # ?! Icon
  459. #==============================================================================
  460.  
  461. module Icon
  462.  
  463.   #--------------------------------------------------------------------------
  464.   # self.no_action
  465.   #--------------------------------------------------------------------------
  466.   def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
  467.    
  468. end # Icon
  469.  
  470. #==============================================================================
  471. # ?! Numeric
  472. #==============================================================================
  473.  
  474. class Numeric
  475.  
  476.   #--------------------------------------------------------------------------
  477.   # new method: group_digits
  478.   #--------------------------------------------------------------------------
  479.   unless $imported["YEA-CoreEngine"]
  480.   def group; return self.to_s; end
  481.   end # $imported["YEA-CoreEngine"]
  482.    
  483. end # Numeric
  484.  
  485. #==============================================================================
  486. # ?! DataManager
  487. #==============================================================================
  488.  
  489. module DataManager
  490.  
  491.   #--------------------------------------------------------------------------
  492.   # alias method: load_database
  493.   #--------------------------------------------------------------------------
  494.   class <<self; alias load_database_abe load_database; end
  495.   def self.load_database
  496.     load_database_abe
  497.     load_notetags_abe
  498.   end
  499.  
  500.   #--------------------------------------------------------------------------
  501.   # new method: load_notetags_abe
  502.   #--------------------------------------------------------------------------
  503.   def self.load_notetags_abe
  504.     groups = [$data_enemies, $data_states, $data_skills, $data_items]
  505.     for group in groups
  506.       for obj in group
  507.         next if obj.nil?
  508.         obj.load_notetags_abe
  509.       end
  510.     end
  511.   end
  512.  
  513. end # DataManager
  514.  
  515. #==============================================================================
  516. # ?! RPG::UsableItem
  517. #==============================================================================
  518.  
  519. class RPG::UsableItem < RPG::BaseItem
  520.  
  521.   #--------------------------------------------------------------------------
  522.   # public instance variables
  523.   #--------------------------------------------------------------------------
  524.   attr_accessor :one_animation
  525.  
  526.   #--------------------------------------------------------------------------
  527.   # common cache: load_notetags_abe
  528.   #--------------------------------------------------------------------------
  529.   def load_notetags_abe
  530.     @one_animation = false
  531.     #---
  532.     self.note.split(/[\r\n]+/).each { |line|
  533.       case line
  534.       #---
  535.       when YEA::REGEXP::USABLEITEM::ONE_ANIMATION
  536.         @one_animation = true
  537.       end
  538.     } # self.note.split
  539.     #---
  540.   end
  541.  
  542. end # RPG::UsableItem
  543.  
  544. #==============================================================================
  545. # ?! RPG::Enemy
  546. #==============================================================================
  547.  
  548. class RPG::Enemy < RPG::BaseItem
  549.  
  550.   #--------------------------------------------------------------------------
  551.   # public instance variables
  552.   #--------------------------------------------------------------------------
  553.   attr_accessor :atk_animation_id1
  554.   attr_accessor :atk_animation_id2
  555.  
  556.   #--------------------------------------------------------------------------
  557.   # common cache: load_notetags_abe
  558.   #--------------------------------------------------------------------------
  559.   def load_notetags_abe
  560.     @atk_animation_id1 = YEA::BATTLE::ENEMY_ATK_ANI
  561.     @atk_animation_id2 = 0
  562.     #---
  563.     self.note.split(/[\r\n]+/).each { |line|
  564.       case line
  565.       #---
  566.       when YEA::REGEXP::ENEMY::ATK_ANI1
  567.         @atk_animation_id1 = $1.to_i
  568.       when YEA::REGEXP::ENEMY::ATK_ANI2
  569.         @atk_animation_id2 = $1.to_i
  570.       end
  571.     } # self.note.split
  572.     #---
  573.   end
  574.  
  575. end # RPG::Enemy
  576.  
  577. #==============================================================================
  578. # ?! RPG::Enemy
  579. #==============================================================================
  580.  
  581. class RPG::State < RPG::BaseItem
  582.  
  583.   #--------------------------------------------------------------------------
  584.   # public instance variables
  585.   #--------------------------------------------------------------------------
  586.   attr_accessor :popup_rules
  587.  
  588.   #--------------------------------------------------------------------------
  589.   # common cache: load_notetags_abe
  590.   #--------------------------------------------------------------------------
  591.   def load_notetags_abe
  592.     @popup_rules = {
  593.       :add_state => "ADDSTATE",
  594.       :rem_state => "REMSTATE",
  595.       :dur_state => nil
  596.     } # Do not remove this.
  597.     #---
  598.     self.note.split(/[\r\n]+/).each { |line|
  599.       case line
  600.       #---
  601.       when YEA::REGEXP::STATE::POPUP_ADD
  602.         @popup_rules[:add_state] = $1.upcase.to_s
  603.       when YEA::REGEXP::STATE::POPUP_REM
  604.         @popup_rules[:rem_state] = $1.upcase.to_s
  605.       when YEA::REGEXP::STATE::POPUP_DUR
  606.         @popup_rules[:dur_state] = $1.upcase.to_s
  607.       when YEA::REGEXP::STATE::HIDE_ADD
  608.         @popup_rules[:add_state] = nil
  609.       when YEA::REGEXP::STATE::HIDE_REM
  610.         @popup_rules[:rem_state] = nil
  611.       when YEA::REGEXP::STATE::HIDE_DUR
  612.         @popup_rules[:dur_state] = nil
  613.       end
  614.     } # self.note.split
  615.     #---
  616.   end
  617.  
  618. end # RPG::State
  619.  
  620. #==============================================================================
  621. # ?! BattleManager
  622. #==============================================================================
  623.  
  624. module BattleManager
  625.  
  626.   #--------------------------------------------------------------------------
  627.   # overwrite method: self.battle_start
  628.   #--------------------------------------------------------------------------
  629.   def self.battle_start
  630.     $game_system.battle_count += 1
  631.     $game_party.on_battle_start
  632.     $game_troop.on_battle_start
  633.     return unless YEA::BATTLE::MSG_ENEMY_APPEARS
  634.     $game_troop.enemy_names.each do |name|
  635.       $game_message.add(sprintf(Vocab::Emerge, name))
  636.     end
  637.     if @preemptive
  638.       $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
  639.     elsif @surprise
  640.       $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
  641.     end
  642.     wait_for_message
  643.   end
  644.  
  645.   #--------------------------------------------------------------------------
  646.   # overwrite method: make_action_orders
  647.   #--------------------------------------------------------------------------
  648.   def self.make_action_orders
  649.     make_dtb_action_orders if btype?(:dtb)
  650.   end
  651.  
  652.   #--------------------------------------------------------------------------
  653.   # new method: make_dtb_action_orders
  654.   #--------------------------------------------------------------------------
  655.   def self.make_dtb_action_orders
  656.     @action_battlers = []
  657.     @action_battlers += $game_party.members unless @surprise
  658.     @action_battlers += $game_troop.members unless @preemptive
  659.     @action_battlers.each {|battler| battler.make_speed }
  660.     @action_battlers.sort! {|a,b| b.speed - a.speed }
  661.   end
  662.  
  663.   #--------------------------------------------------------------------------
  664.   # overwrite method: turn_start
  665.   #--------------------------------------------------------------------------
  666.   def self.turn_start
  667.     @phase = :turn
  668.     clear_actor
  669.     $game_troop.increase_turn
  670.     @performed_battlers = []
  671.     make_action_orders
  672.   end
  673.  
  674.   #--------------------------------------------------------------------------
  675.   # overwrite method: next_subject
  676.   #--------------------------------------------------------------------------
  677.   def self.next_subject
  678.     @performed_battlers = [] if @performed_battlers.nil?
  679.     loop do
  680.       @action_battlers -= @performed_battlers
  681.       battler = @action_battlers.shift
  682.       return nil unless battler
  683.       next unless battler.index && battler.alive?
  684.       @performed_battlers.push(battler)
  685.       return battler
  686.     end
  687.   end
  688.  
  689.   #--------------------------------------------------------------------------
  690.   # overwrite method: force_action
  691.   #--------------------------------------------------------------------------
  692.   def self.force_action(battler)
  693.     @action_forced = [] if @action_forced == nil
  694.     @action_forced.push(battler)
  695.     return unless Switch.forced_action_remove
  696.     @action_battlers.delete(battler)
  697.   end
  698.  
  699.   #--------------------------------------------------------------------------
  700.   # overwrite method: action_forced?
  701.   #--------------------------------------------------------------------------
  702.   def self.action_forced?
  703.     @action_forced != nil
  704.   end
  705.  
  706.   #--------------------------------------------------------------------------
  707.   # overwrite method: action_forced_battler
  708.   #--------------------------------------------------------------------------
  709.   def self.action_forced_battler
  710.     @action_forced.shift
  711.   end
  712.  
  713.   #--------------------------------------------------------------------------
  714.   # overwrite method: clear_action_force
  715.   #--------------------------------------------------------------------------
  716.   def self.clear_action_force
  717.     return if @action_forced.nil?
  718.     @action_forced = nil if @action_forced.empty?
  719.   end
  720.  
  721.   #--------------------------------------------------------------------------
  722.   # new method: self.init_battle_type
  723.   #--------------------------------------------------------------------------
  724.   def self.init_battle_type
  725.     set_btype($game_system.battle_system)
  726.   end
  727.  
  728.   #--------------------------------------------------------------------------
  729.   # new method: self.set_btype
  730.   #--------------------------------------------------------------------------
  731.   def self.set_btype(btype = :dtb)
  732.     @battle_type = btype
  733.   end
  734.  
  735.   #--------------------------------------------------------------------------
  736.   # new method: self.btype?
  737.   #--------------------------------------------------------------------------
  738.   def self.btype?(btype)
  739.     return @battle_type == btype
  740.   end
  741.  
  742. end # BattleManager
  743.  
  744. #==============================================================================
  745. # ?! Game_System
  746. #==============================================================================
  747.  
  748. class Game_System
  749.  
  750.   #--------------------------------------------------------------------------
  751.   # new method: battle_system
  752.   #--------------------------------------------------------------------------
  753.   def battle_system
  754.     if @battle_system.nil?
  755.       return battle_system_corrected(YEA::BATTLE::DEFAULT_BATTLE_SYSTEM)
  756.     else
  757.       return battle_system_corrected(@battle_system)
  758.     end
  759.   end
  760.  
  761.   #--------------------------------------------------------------------------
  762.   # new method: set_battle_system
  763.   #--------------------------------------------------------------------------
  764.   def set_battle_system(type)
  765.     case type
  766.     when :dtb; @battle_system = :dtb
  767.     when :ftb; @battle_system = $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  768.     else;      @battle_system = :dtb
  769.     end
  770.   end
  771.  
  772.   #--------------------------------------------------------------------------
  773.   # new method: battle_system_corrected
  774.   #--------------------------------------------------------------------------
  775.   def battle_system_corrected(type)
  776.     case type
  777.     when :dtb; return :dtb
  778.     when :ftb; return $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  779.     else;      return :dtb
  780.     end
  781.   end
  782.  
  783. end # Game_System
  784.  
  785. #==============================================================================
  786. # ?! Sprite_Base
  787. #==============================================================================
  788.  
  789. class Sprite_Base < Sprite
  790.  
  791.   #--------------------------------------------------------------------------
  792.   # new method: start_pseudo_animation
  793.   #--------------------------------------------------------------------------
  794.   unless $imported["YEA-CoreEngine"]
  795.   def start_pseudo_animation(animation, mirror = false)
  796.     dispose_animation
  797.     @animation = animation
  798.     return if @animation.nil?
  799.     @ani_mirror = mirror
  800.     set_animation_rate
  801.     @ani_duration = @animation.frame_max * @ani_rate + 1
  802.     @ani_sprites = []
  803.   end
  804.   end # $imported["YEA-CoreEngine"]
  805.  
  806. end # Sprite_Base
  807.  
  808. #==============================================================================
  809. # ?! Sprite_Battler
  810. #==============================================================================
  811.  
  812. class Sprite_Battler < Sprite_Base
  813.  
  814.   #--------------------------------------------------------------------------
  815.   # public instance variables
  816.   #--------------------------------------------------------------------------
  817.   attr_accessor :effect_type
  818.   attr_accessor :battler_visible
  819.   attr_accessor :popups
  820.  
  821.   #--------------------------------------------------------------------------
  822.   # alias method: initialize
  823.   #--------------------------------------------------------------------------
  824.   alias sprite_battler_initialize_abe initialize
  825.   def initialize(viewport, battler = nil)
  826.     sprite_battler_initialize_abe(viewport, battler)
  827.     @popups = []
  828.     @popup_flags = []
  829.   end
  830.  
  831.   #--------------------------------------------------------------------------
  832.   # alias method: update_bitmap
  833.   #--------------------------------------------------------------------------
  834.   alias sprite_battler_update_bitmap_abe update_bitmap
  835.   def update_bitmap
  836.     return if @battler.actor? && @battler.battler_name == ""
  837.     sprite_battler_update_bitmap_abe
  838.   end
  839.  
  840.   #--------------------------------------------------------------------------
  841.   # alias method: setup_new_animation
  842.   #--------------------------------------------------------------------------
  843.   unless $imported["YEA-CoreEngine"]
  844.   alias sprite_battler_setup_new_animation_abe setup_new_animation
  845.   def setup_new_animation
  846.     sprite_battler_setup_new_animation_abe
  847.     return if @battler.pseudo_ani_id <= 0
  848.     animation = $data_animations[@battler.pseudo_ani_id]
  849.     mirror = @battler.animation_mirror
  850.     start_pseudo_animation(animation, mirror)
  851.     @battler.pseudo_ani_id = 0
  852.   end
  853.   end # $imported["YEA-CoreEngine"]
  854.  
  855.   #--------------------------------------------------------------------------
  856.   # alias method: setup_new_effect
  857.   #--------------------------------------------------------------------------
  858.   alias sprite_battler_setup_new_effect_abe setup_new_effect
  859.   def setup_new_effect
  860.     sprite_battler_setup_new_effect_abe
  861.     setup_popups
  862.   end
  863.  
  864.   #--------------------------------------------------------------------------
  865.   # new method: setup_popups
  866.   #--------------------------------------------------------------------------
  867.   def setup_popups
  868.     return unless @battler.use_sprite?
  869.     @battler.popups = [] if @battler.popups.nil?
  870.     return if @battler.popups == []
  871.     array = @battler.popups.shift
  872.     create_new_popup(array[0], array[1], array[2])
  873.   end
  874.  
  875.   #--------------------------------------------------------------------------
  876.   # new method: create_new_popup
  877.   #--------------------------------------------------------------------------
  878.   def create_new_popup(value, rules, flags)
  879.     return if @battler == nil
  880.     return if flags & @popup_flags != []
  881.     array = YEA::BATTLE::POPUP_RULES[rules]
  882.     for popup in @popups
  883.       popup.y -= 24
  884.     end
  885.     return unless SceneManager.scene.is_a?(Scene_Battle)
  886.     return if SceneManager.scene.spriteset.nil?
  887.     view = SceneManager.scene.spriteset.viewportPopups
  888.     new_popup = Sprite_Popup.new(view, @battler, value, rules, flags)
  889.     @popups.push(new_popup)
  890.     @popup_flags.push("weakness") if flags.include?("weakness")
  891.     @popup_flags.push("resistant") if flags.include?("resistant")
  892.     @popup_flags.push("immune") if flags.include?("immune")
  893.     @popup_flags.push("absorbed") if flags.include?("absorbed")
  894.   end
  895.  
  896.   #--------------------------------------------------------------------------
  897.   # alias method: update_effect
  898.   #--------------------------------------------------------------------------
  899.   alias sprite_battler_update_effect_abe update_effect
  900.   def update_effect
  901.     sprite_battler_update_effect_abe
  902.     update_popups
  903.   end
  904.  
  905.   #--------------------------------------------------------------------------
  906.   # new method: update_popups
  907.   #--------------------------------------------------------------------------
  908.   def update_popups
  909.     for popup in @popups
  910.       popup.update
  911.       next unless popup.opacity <= 0
  912.       popup.bitmap.dispose
  913.       popup.dispose
  914.       @popups.delete(popup)
  915.       popup = nil
  916.     end
  917.     @popup_flags = [] if @popups == [] && @popup_flags != []
  918.     return unless SceneManager.scene_is?(Scene_Battle)
  919.     if @current_active_battler != SceneManager.scene.subject
  920.       @current_active_battler = SceneManager.scene.subject
  921.       @popup_flags = []
  922.     end
  923.   end
  924.  
  925. end # Sprite_Battler
  926.  
  927. #==============================================================================
  928. # ?! Sprite_Popup
  929. #==============================================================================
  930.  
  931. class Sprite_Popup < Sprite_Base
  932.  
  933.   #--------------------------------------------------------------------------
  934.   # public instance variables
  935.   #--------------------------------------------------------------------------
  936.   attr_accessor :flags
  937.  
  938.   #--------------------------------------------------------------------------
  939.   # initialize
  940.   #--------------------------------------------------------------------------
  941.   def initialize(viewport, battler, value, rules, flags)
  942.     super(viewport)
  943.     @value = value
  944.     @rules = rules
  945.     @rules = "DEFAULT" unless YEA::BATTLE::POPUP_RULES.include?(@rules)
  946.     @fade = YEA::BATTLE::POPUP_SETTINGS[:fade]
  947.     @full = YEA::BATTLE::POPUP_SETTINGS[:full]
  948.     @flags = flags
  949.     @battler = battler
  950.     create_popup_bitmap
  951.   end
  952.  
  953.   #--------------------------------------------------------------------------
  954.   # create_popup_bitmap
  955.   #--------------------------------------------------------------------------
  956.   def create_popup_bitmap
  957.     rules_array = YEA::BATTLE::POPUP_RULES[@rules]
  958.     bw = Graphics.width
  959.     bw += 48 if @flags.include?("state")
  960.     bh = Font.default_size * 3
  961.     bitmap = Bitmap.new(bw, bh)
  962.     bitmap.font.name = rules_array[8]
  963.     size = @flags.include?("critical") ? rules_array[2] * 1.2 : rules_array[2]
  964.     bitmap.font.size = size
  965.     bitmap.font.bold = rules_array[3]
  966.     bitmap.font.italic = rules_array[4]
  967.     if flags.include?("critical")
  968.       crit = YEA::BATTLE::POPUP_RULES["CRITICAL"]
  969.       bitmap.font.out_color.set(crit[5], crit[6], crit[7], 255)
  970.     else
  971.       bitmap.font.out_color.set(0, 0, 0, 255)
  972.     end
  973.     dx = 0; dy = 0; dw = 0
  974.     dx += 24 if @flags.include?("state")
  975.     dw += 24 if @flags.include?("state")
  976.     if @flags.include?("state") || @flags.include?("buff")
  977.       c_width = bitmap.text_size(@value).width
  978.       icon_bitmap = $game_temp.iconset
  979.       icon_index = flag_state_icon
  980.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  981.       bitmap.blt(dx+(bw-c_width)/2-36, (bh - 24)/2, icon_bitmap, rect, 255)
  982.     end
  983.     bitmap.font.color.set(rules_array[5], rules_array[6], rules_array[7])
  984.     bitmap.draw_text(dx, dy, bw-dw, bh, @value, 1)
  985.     self.bitmap = bitmap
  986.     self.x = @battler.screen_x
  987.     self.x += rand(4) - rand(4) if @battler.sprite.popups.size >= 1
  988.     self.x -= SceneManager.scene.spriteset.viewport1.ox
  989.     self.y = @battler.screen_y - @battler.sprite.oy/2
  990.     self.y -= @battler.sprite.oy/2 if @battler.actor?
  991.     self.y -= SceneManager.scene.spriteset.viewport1.oy
  992.     self.ox = bw/2; self.oy = bh/2
  993.     self.zoom_x = self.zoom_y = rules_array[0]
  994.     if @flags.include?("no zoom")
  995.       self.zoom_x = self.zoom_y = rules_array[1]
  996.     end
  997.     @target_zoom = rules_array[1]
  998.     @zoom_direction = (self.zoom_x > @target_zoom) ? "down" : "up"
  999.     self.z = 500
  1000.   end
  1001.  
  1002.   #--------------------------------------------------------------------------
  1003.   # update
  1004.   #--------------------------------------------------------------------------
  1005.   def update
  1006.     super
  1007.     #---
  1008.     if @flags.include?("critical") && YEA::BATTLE::FLASH_CRITICAL
  1009.       @hue_duration = 2 if @hue_duration == nil || @hue_duration == 0
  1010.       @hue_duration -= 1
  1011.       self.bitmap.hue_change(15) if @hue_duration <= 0
  1012.     end
  1013.     #---
  1014.     if @zoom_direction == "up"
  1015.       self.zoom_x = [self.zoom_x + 0.075, @target_zoom].min
  1016.       self.zoom_y = [self.zoom_y + 0.075, @target_zoom].min
  1017.     else
  1018.       self.zoom_x = [self.zoom_x - 0.075, @target_zoom].max
  1019.       self.zoom_y = [self.zoom_y - 0.075, @target_zoom].max
  1020.     end
  1021.     #---
  1022.     @full -= 1
  1023.     return if @full > 0
  1024.     self.y -= 1
  1025.     self.opacity -= @fade
  1026.   end
  1027.  
  1028.   #--------------------------------------------------------------------------
  1029.   # flag_state_icon
  1030.   #--------------------------------------------------------------------------
  1031.   def flag_state_icon
  1032.     for item in @flags; return item if item.is_a?(Integer); end
  1033.     return 0
  1034.   end
  1035.  
  1036. end # Sprite_Popup
  1037.  
  1038. #==============================================================================
  1039. # ?! Spriteset_Battle
  1040. #==============================================================================
  1041.  
  1042. class Spriteset_Battle
  1043.  
  1044.   #--------------------------------------------------------------------------
  1045.   # public instance variables
  1046.   #--------------------------------------------------------------------------
  1047.   attr_accessor :actor_sprites
  1048.   attr_accessor :enemy_sprites
  1049.   attr_accessor :viewport1
  1050.   attr_accessor :viewportPopups
  1051.  
  1052.   #--------------------------------------------------------------------------
  1053.   # alias method: create_viewports
  1054.   #--------------------------------------------------------------------------
  1055.   alias spriteset_battle_create_viewports_abe create_viewports
  1056.   def create_viewports
  1057.     spriteset_battle_create_viewports_abe
  1058.     @viewportPopups = Viewport.new
  1059.     @viewportPopups.z = 200
  1060.   end
  1061.  
  1062.   #--------------------------------------------------------------------------
  1063.   # alias method: dispose_viewports
  1064.   #--------------------------------------------------------------------------
  1065.   alias spriteset_battle_dispose_viewports_abe dispose_viewports
  1066.   def dispose_viewports
  1067.     spriteset_battle_dispose_viewports_abe
  1068.     @viewportPopups.dispose
  1069.   end
  1070.  
  1071.   #--------------------------------------------------------------------------
  1072.   # alias method: update_viewports
  1073.   #--------------------------------------------------------------------------
  1074.   alias spriteset_battle_update_viewports_abe update_viewports
  1075.   def update_viewports
  1076.     spriteset_battle_update_viewports_abe
  1077.     @viewportPopups.update
  1078.   end
  1079.  
  1080. end # Spriteset_Battle
  1081.  
  1082. #==============================================================================
  1083. # ?! Game_Temp
  1084. #==============================================================================
  1085.  
  1086. class Game_Temp
  1087.  
  1088.   #--------------------------------------------------------------------------
  1089.   # public instance variables
  1090.   #--------------------------------------------------------------------------
  1091.   attr_accessor :battle_aid
  1092.   attr_accessor :evaluating
  1093.   attr_accessor :iconset
  1094.  
  1095.   #--------------------------------------------------------------------------
  1096.   # alias method: initialize
  1097.   #--------------------------------------------------------------------------
  1098.   alias game_temp_initialize_abe initialize
  1099.   def initialize
  1100.     game_temp_initialize_abe
  1101.     @iconset = Cache.system("Iconset")
  1102.   end
  1103.  
  1104. end # Game_Temp
  1105.  
  1106. #==============================================================================
  1107. # ?! Game_Action
  1108. #==============================================================================
  1109.  
  1110. class Game_Action
  1111.  
  1112.   #--------------------------------------------------------------------------
  1113.   # overwrite method: speed
  1114.   #--------------------------------------------------------------------------
  1115.   def speed
  1116.     speed = subject.agi
  1117.     speed += item.speed if item
  1118.     speed += subject.atk_speed if attack?
  1119.     return speed
  1120.   end
  1121.  
  1122.   #--------------------------------------------------------------------------
  1123.   # alias method: evaluate_item_with_target
  1124.   #--------------------------------------------------------------------------
  1125.   alias evaluate_item_with_target_abe evaluate_item_with_target
  1126.   def evaluate_item_with_target(target)
  1127.     $game_temp.evaluating = true
  1128.     result = evaluate_item_with_target_abe(target)
  1129.     $game_temp.evaluating = false
  1130.     return result
  1131.   end
  1132.  
  1133. end # Game_Action
  1134.  
  1135. #==============================================================================
  1136. # ?! Game_ActionResult
  1137. #==============================================================================
  1138.  
  1139. class Game_ActionResult
  1140.  
  1141.   #--------------------------------------------------------------------------
  1142.   # alias method: clear
  1143.   #--------------------------------------------------------------------------
  1144.   alias game_actionresult_clear_abe clear
  1145.   def clear
  1146.     game_actionresult_clear_abe
  1147.     clear_stored_damage
  1148.   end
  1149.  
  1150.   #--------------------------------------------------------------------------
  1151.   # new method: clear_stored_damage
  1152.   #--------------------------------------------------------------------------
  1153.   def clear_stored_damage
  1154.     @stored_hp_damage = 0
  1155.     @stored_mp_damage = 0
  1156.     @stored_tp_damage = 0
  1157.     @stored_hp_drain = 0
  1158.     @stored_mp_drain = 0
  1159.   end
  1160.  
  1161.   #--------------------------------------------------------------------------
  1162.   # new method: store_damage
  1163.   #--------------------------------------------------------------------------
  1164.   def store_damage
  1165.     @stored_hp_damage += @hp_damage
  1166.     @stored_mp_damage += @mp_damage
  1167.     @stored_tp_damage += @tp_damage
  1168.     @stored_hp_drain += @hp_drain
  1169.     @stored_mp_drain += @mp_drain
  1170.   end
  1171.  
  1172.   #--------------------------------------------------------------------------
  1173.   # new method: restore_damage
  1174.   #--------------------------------------------------------------------------
  1175.   def restore_damage
  1176.     @hp_damage = @stored_hp_damage
  1177.     @mp_damage = @stored_mp_damage
  1178.     @tp_damage = @stored_tp_damage
  1179.     @hp_drain = @stored_hp_drain
  1180.     @mp_drain = @stored_mp_drain
  1181.     clear_stored_damage
  1182.   end
  1183.  
  1184. end # Game_ActionResult
  1185.  
  1186. #==============================================================================
  1187. # ?! Game_BattlerBase
  1188. #==============================================================================
  1189.  
  1190. class Game_BattlerBase
  1191.  
  1192.   #--------------------------------------------------------------------------
  1193.   # public instance variables
  1194.   #--------------------------------------------------------------------------
  1195.   attr_accessor :popups
  1196.  
  1197.   #--------------------------------------------------------------------------
  1198.   # new method: create_popup
  1199.   #--------------------------------------------------------------------------
  1200.   def create_popup(value, rules = "DEFAULT", flags = [])
  1201.     return unless SceneManager.scene_is?(Scene_Battle)
  1202.     return unless YEA::BATTLE::ENABLE_POPUPS
  1203.     return if Switch.hide_popups
  1204.     @popups = [] if @popups.nil?
  1205.     @popups.push([value, rules, flags])
  1206.   end
  1207.  
  1208.   #--------------------------------------------------------------------------
  1209.   # new method: make_damage_popups
  1210.   #--------------------------------------------------------------------------
  1211.   def make_damage_popups(user)
  1212.     if @result.hp_drain != 0
  1213.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  1214.       rules = "DRAIN"
  1215.       user.create_popup(text, rules)
  1216.       setting = :hp_dmg  if @result.hp_drain < 0
  1217.       setting = :hp_heal if @result.hp_drain > 0
  1218.       rules = "HP_DMG"   if @result.hp_drain < 0
  1219.       rules = "HP_HEAL"  if @result.hp_drain > 0
  1220.       value = @result.hp_drain.abs
  1221.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1222.       user.create_popup(text, rules)
  1223.     end
  1224.     if @result.mp_drain != 0
  1225.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  1226.       rules = "DRAIN"
  1227.       user.create_popup(text, rules)
  1228.       setting = :mp_dmg  if @result.mp_drain < 0
  1229.       setting = :mp_heal if @result.mp_drain > 0
  1230.       rules = "HP_DMG"   if @result.mp_drain < 0
  1231.       rules = "HP_HEAL"  if @result.mp_drain > 0
  1232.       value = @result.mp_drain.abs
  1233.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1234.       user.create_popup(text, rules)
  1235.     end
  1236.     #---
  1237.     flags = []
  1238.     flags.push("critical") if @result.critical
  1239.     if @result.hp_damage != 0
  1240.       setting = :hp_dmg  if @result.hp_damage > 0
  1241.       setting = :hp_heal if @result.hp_damage < 0
  1242.       rules = "HP_DMG"   if @result.hp_damage > 0
  1243.       rules = "HP_HEAL"  if @result.hp_damage < 0
  1244.       value = @result.hp_damage.abs
  1245.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1246.       create_popup(text, rules, flags)
  1247.     end
  1248.     if @result.mp_damage != 0
  1249.       setting = :mp_dmg  if @result.mp_damage > 0
  1250.       setting = :mp_heal if @result.mp_damage < 0
  1251.       rules = "MP_DMG"   if @result.mp_damage > 0
  1252.       rules = "MP_HEAL"  if @result.mp_damage < 0
  1253.       value = @result.mp_damage.abs
  1254.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1255.       create_popup(text, rules, flags)
  1256.     end
  1257.     if @result.tp_damage != 0
  1258.       setting = :tp_dmg  if @result.tp_damage > 0
  1259.       setting = :tp_heal if @result.tp_damage < 0
  1260.       rules = "TP_DMG"   if @result.tp_damage > 0
  1261.       rules = "TP_HEAL"  if @result.tp_damage < 0
  1262.       value = @result.tp_damage.abs
  1263.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1264.       create_popup(text, rules)
  1265.     end
  1266.     @result.store_damage
  1267.     @result.clear_damage_values
  1268.   end
  1269.  
  1270.   #--------------------------------------------------------------------------
  1271.   # alias method: erase_state
  1272.   #--------------------------------------------------------------------------
  1273.   alias game_battlerbase_erase_state_abe erase_state
  1274.   def erase_state(state_id)
  1275.     make_state_popup(state_id, :rem_state) if @states.include?(state_id)
  1276.     game_battlerbase_erase_state_abe(state_id)
  1277.   end
  1278.  
  1279.   #--------------------------------------------------------------------------
  1280.   # new method: make_during_state_popup
  1281.   #--------------------------------------------------------------------------
  1282.   def make_during_state_popup
  1283.     state_id = most_important_state_id
  1284.     return if state_id == 0
  1285.     make_state_popup(state_id, :dur_state)
  1286.   end
  1287.  
  1288.   #--------------------------------------------------------------------------
  1289.   # new method: most_important_state_id
  1290.   #--------------------------------------------------------------------------
  1291.   def most_important_state_id
  1292.     states.each {|state| return state.id unless state.message3.empty? }
  1293.     return 0
  1294.   end
  1295.  
  1296.   #--------------------------------------------------------------------------
  1297.   # new method: make_state_popup
  1298.   #--------------------------------------------------------------------------
  1299.   def make_state_popup(state_id, type)
  1300.     state = $data_states[state_id]
  1301.     return if state.icon_index == 0
  1302.     rules = state.popup_rules[type]
  1303.     return if rules.nil?
  1304.     text = sprintf(YEA::BATTLE::POPUP_SETTINGS[type], state.name)
  1305.     flags = ["state", state.icon_index]
  1306.     create_popup(text, rules, flags)
  1307.   end
  1308.  
  1309.   #--------------------------------------------------------------------------
  1310.   # new method: make_miss_popups
  1311.   #--------------------------------------------------------------------------
  1312.   def make_miss_popups(user, item)
  1313.     return if dead?
  1314.     if @result.missed
  1315.       text = YEA::BATTLE::POPUP_SETTINGS[:missed]
  1316.       rules = "DEFAULT"
  1317.       create_popup(text, rules)
  1318.     end
  1319.     if @result.evaded
  1320.       text = YEA::BATTLE::POPUP_SETTINGS[:evaded]
  1321.       rules = "DEFAULT"
  1322.       create_popup(text, rules)
  1323.     end
  1324.     if @result.hit? && !@result.success
  1325.       text = YEA::BATTLE::POPUP_SETTINGS[:failed]
  1326.       rules = "DEFAULT"
  1327.       create_popup(text, rules)
  1328.     end
  1329.     if @result.hit? && item.damage.to_hp?
  1330.       if @result.hp_damage == 0 && @result.hp_damage == 0
  1331.         text = YEA::BATTLE::POPUP_SETTINGS[:nulled]
  1332.         rules = "DEFAULT"
  1333.         create_popup(text, rules)
  1334.       end
  1335.     end
  1336.   end
  1337.  
  1338.   #--------------------------------------------------------------------------
  1339.   # new method: make_rate_popup
  1340.   #--------------------------------------------------------------------------
  1341.   def make_rate_popup(rate)
  1342.     return if rate == 1.0
  1343.     flags = []
  1344.     if rate > 1.0
  1345.       text = YEA::BATTLE::POPUP_SETTINGS[:weakpoint]
  1346.       rules = "WEAK_ELE"
  1347.       flags.push("weakness")
  1348.     elsif rate == 0.0
  1349.       text = YEA::BATTLE::POPUP_SETTINGS[:immune]
  1350.       rules = "IMMU_ELE"
  1351.       flags.push("immune")
  1352.     elsif rate < 0.0
  1353.       text = YEA::BATTLE::POPUP_SETTINGS[:absorbed]
  1354.       rules = "ABSB_ELE"
  1355.       flags.push("absorbed")
  1356.     else
  1357.       text = YEA::BATTLE::POPUP_SETTINGS[:resistant]
  1358.       rules = "REST_ELE"
  1359.       flags.push("resistant")
  1360.     end
  1361.     create_popup(text, rules, flags)
  1362.   end
  1363.  
  1364.   #--------------------------------------------------------------------------
  1365.   # new method: make_buff_popup
  1366.   #--------------------------------------------------------------------------
  1367.   def make_buff_popup(param_id, positive = true)
  1368.     return unless SceneManager.scene_is?(Scene_Battle)
  1369.     return unless alive?
  1370.     name = Vocab::param(param_id)
  1371.     if positive
  1372.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_buff], name)
  1373.       rules = "BUFF"
  1374.       buff_level = 1
  1375.     else
  1376.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_debuff], name)
  1377.       rules = "DEBUFF"
  1378.       buff_level = -1
  1379.     end
  1380.     icon = buff_icon_index(buff_level, param_id)
  1381.     flags = ["buff", icon]
  1382.     return if @popups.include?([text, rules, flags])
  1383.     create_popup(text, rules, flags)
  1384.   end
  1385.  
  1386. end # Game_BattlerBase
  1387.  
  1388. #==============================================================================
  1389. # ?! Game_Battler
  1390. #==============================================================================
  1391.  
  1392. class Game_Battler < Game_BattlerBase
  1393.  
  1394.   #--------------------------------------------------------------------------
  1395.   # public instance variables
  1396.   #--------------------------------------------------------------------------
  1397.   attr_accessor :pseudo_ani_id
  1398.  
  1399.   #--------------------------------------------------------------------------
  1400.   # alias method: on_battle_end
  1401.   #--------------------------------------------------------------------------
  1402.   alias game_battler_on_battle_end_abe on_battle_end
  1403.   def on_battle_end
  1404.     game_battler_on_battle_end_abe
  1405.     @popups = []
  1406.   end
  1407.  
  1408.   #--------------------------------------------------------------------------
  1409.   # alias method: clear_sprite_effects
  1410.   #--------------------------------------------------------------------------
  1411.   alias game_battler_clear_sprite_effects_abe clear_sprite_effects
  1412.   def clear_sprite_effects
  1413.     game_battler_clear_sprite_effects_abe
  1414.     @pseudo_ani_id = 0
  1415.   end
  1416.  
  1417.   #--------------------------------------------------------------------------
  1418.   # alias method: item_apply
  1419.   #--------------------------------------------------------------------------
  1420.   alias game_battler_item_apply_abe item_apply
  1421.   def item_apply(user, item)
  1422.     game_battler_item_apply_abe(user, item)
  1423.     make_miss_popups(user, item)
  1424.   end
  1425.  
  1426.   #--------------------------------------------------------------------------
  1427.   # alias method: make_damage_value
  1428.   #--------------------------------------------------------------------------
  1429.   alias game_battler_make_damage_value_abe make_damage_value
  1430.   def make_damage_value(user, item)
  1431.     game_battler_make_damage_value_abe(user, item)
  1432.     rate = item_element_rate(user, item)
  1433.     make_rate_popup(rate) unless $game_temp.evaluating
  1434.   end
  1435.  
  1436.   #--------------------------------------------------------------------------
  1437.   # alias method: execute_damage
  1438.   #--------------------------------------------------------------------------
  1439.   alias game_battler_execute_damage_abe execute_damage
  1440.   def execute_damage(user)
  1441.     game_battler_execute_damage_abe(user)
  1442.     make_damage_popups(user)
  1443.   end
  1444.  
  1445.   #--------------------------------------------------------------------------
  1446.   # alias method: item_effect_recover_hp
  1447.   #--------------------------------------------------------------------------
  1448.   alias game_battler_item_effect_recover_hp_abe item_effect_recover_hp
  1449.   def item_effect_recover_hp(user, item, effect)
  1450.     game_battler_item_effect_recover_hp_abe(user, item, effect)
  1451.     make_damage_popups(user)
  1452.   end
  1453.  
  1454.   #--------------------------------------------------------------------------
  1455.   # alias method: item_effect_recover_mp
  1456.   #--------------------------------------------------------------------------
  1457.   alias game_battler_item_effect_recover_mp_abe item_effect_recover_mp
  1458.   def item_effect_recover_mp(user, item, effect)
  1459.     game_battler_item_effect_recover_mp_abe(user, item, effect)
  1460.     make_damage_popups(user)
  1461.   end
  1462.  
  1463.   #--------------------------------------------------------------------------
  1464.   # alias method: item_effect_gain_tp
  1465.   #--------------------------------------------------------------------------
  1466.   alias game_battler_item_effect_gain_tp_abe item_effect_gain_tp
  1467.   def item_effect_gain_tp(user, item, effect)
  1468.     game_battler_item_effect_gain_tp_abe(user, item, effect)
  1469.     make_damage_popups(user)
  1470.   end
  1471.  
  1472.   #--------------------------------------------------------------------------
  1473.   # alias method: item_user_effect
  1474.   #--------------------------------------------------------------------------
  1475.   alias game_battler_item_user_effect_abe item_user_effect
  1476.   def item_user_effect(user, item)
  1477.     game_battler_item_user_effect_abe(user, item)
  1478.     @result.restore_damage
  1479.   end
  1480.  
  1481.   #--------------------------------------------------------------------------
  1482.   # alias method: add_new_state
  1483.   #--------------------------------------------------------------------------
  1484.   alias game_battler_add_new_state_abe add_new_state
  1485.   def add_new_state(state_id)
  1486.     game_battler_add_new_state_abe(state_id)
  1487.     make_state_popup(state_id, :add_state) if @states.include?(state_id)
  1488.   end
  1489.  
  1490.   #--------------------------------------------------------------------------
  1491.   # alias method: add_buff
  1492.   #--------------------------------------------------------------------------
  1493.   alias game_battler_add_buff_abe add_buff
  1494.   def add_buff(param_id, turns)
  1495.     make_buff_popup(param_id, true)
  1496.     game_battler_add_buff_abe(param_id, turns)
  1497.   end
  1498.  
  1499.   #--------------------------------------------------------------------------
  1500.   # alias method: add_debuff
  1501.   #--------------------------------------------------------------------------
  1502.   alias game_battler_add_debuff_abe add_debuff
  1503.   def add_debuff(param_id, turns)
  1504.     make_buff_popup(param_id, false)
  1505.     game_battler_add_debuff_abe(param_id, turns)
  1506.   end
  1507.  
  1508.   #--------------------------------------------------------------------------
  1509.   # alias method: regenerate_all
  1510.   #--------------------------------------------------------------------------
  1511.   alias game_battler_regenerate_all_abe regenerate_all
  1512.   def regenerate_all
  1513.     game_battler_regenerate_all_abe
  1514.     return unless alive?
  1515.     make_damage_popups(self)
  1516.   end
  1517.  
  1518.   #--------------------------------------------------------------------------
  1519.   # overwrite method: regenerate_hp
  1520.   #--------------------------------------------------------------------------
  1521.   def regenerate_hp
  1522.     damage = -(mhp * hrg).to_i
  1523.     perform_map_damage_effect if !$game_party.in_battle && damage > 0
  1524.     @result.hp_damage = [damage, max_slip_damage].min
  1525.     self.hp -= @result.hp_damage
  1526.   end
  1527.  
  1528.   #--------------------------------------------------------------------------
  1529.   # new method: can_collapse?
  1530.   #--------------------------------------------------------------------------
  1531.   def can_collapse?
  1532.     return false unless dead?
  1533.     unless actor?
  1534.       return false unless sprite.battler_visible
  1535.       array = [:collapse, :boss_collapse, :instant_collapse]
  1536.       return false if array.include?(sprite.effect_type)
  1537.     end
  1538.     return true
  1539.   end
  1540.  
  1541.   #--------------------------------------------------------------------------
  1542.   # new method: draw_mp?
  1543.   #--------------------------------------------------------------------------
  1544.   def draw_mp?; return true; end
  1545.  
  1546.   #--------------------------------------------------------------------------
  1547.   # new method: draw_tp?
  1548.   #--------------------------------------------------------------------------
  1549.   def draw_tp?
  1550.     return $data_system.opt_display_tp
  1551.   end
  1552.  
  1553. end # Game_Battler
  1554.  
  1555. #==============================================================================
  1556. # ?! Game_Actor
  1557. #==============================================================================
  1558.  
  1559. class Game_Actor < Game_Battler
  1560.  
  1561.   #--------------------------------------------------------------------------
  1562.   # overwrite method: perform_damage_effect
  1563.   #--------------------------------------------------------------------------
  1564.   def perform_damage_effect
  1565.     $game_troop.screen.start_shake(5, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
  1566.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1567.     Sound.play_actor_damage
  1568.   end
  1569.  
  1570.   #--------------------------------------------------------------------------
  1571.   # overwrite method: use_sprite?
  1572.   #--------------------------------------------------------------------------
  1573.   def use_sprite?; return true; end
  1574.    
  1575.   #--------------------------------------------------------------------------
  1576.   # new method: screen_x
  1577.   #--------------------------------------------------------------------------
  1578.   def screen_x
  1579.     return 0 unless SceneManager.scene_is?(Scene_Battle)
  1580.     status_window = SceneManager.scene.status_window
  1581.     return 0 if status_window.nil?
  1582.     item_rect_width = (status_window.width-24) / $game_party.max_battle_members
  1583.     ext = SceneManager.scene.info_viewport.ox
  1584.     rect = SceneManager.scene.status_window.item_rect(self.index)
  1585.     constant = 128 + 12
  1586.     return constant + rect.x + item_rect_width / 2 - ext
  1587.   end
  1588.  
  1589.   #--------------------------------------------------------------------------
  1590.   # new method: screen_y
  1591.   #--------------------------------------------------------------------------
  1592.   def screen_y
  1593.     return Graphics.height - 120 unless SceneManager.scene_is?(Scene_Battle)
  1594.     return Graphics.height - 120 if SceneManager.scene.status_window.nil?
  1595.     return Graphics.height - (SceneManager.scene.status_window.height * 7/8)
  1596.   end
  1597.  
  1598.   #--------------------------------------------------------------------------
  1599.   # new method: screen_z
  1600.   #--------------------------------------------------------------------------
  1601.   def screen_z; return 100; end
  1602.  
  1603.   #--------------------------------------------------------------------------
  1604.   # new method: sprite
  1605.   #--------------------------------------------------------------------------
  1606.   def sprite
  1607.     index = $game_party.battle_members.index(self)
  1608.     return SceneManager.scene.spriteset.actor_sprites[index]
  1609.   end
  1610.  
  1611.   #--------------------------------------------------------------------------
  1612.   # new method: draw_mp?
  1613.   #--------------------------------------------------------------------------
  1614.   def draw_mp?
  1615.     return true unless draw_tp?
  1616.     for skill in skills
  1617.       next unless added_skill_types.include?(skill.stype_id)
  1618.       return true if skill.mp_cost > 0
  1619.     end
  1620.     return false
  1621.   end
  1622.  
  1623.   #--------------------------------------------------------------------------
  1624.   # new method: draw_tp?
  1625.   #--------------------------------------------------------------------------
  1626.   def draw_tp?
  1627.     return false unless $data_system.opt_display_tp
  1628.     for skill in skills
  1629.       next unless added_skill_types.include?(skill.stype_id)
  1630.       return true if skill.tp_cost > 0
  1631.     end
  1632.     return false
  1633.   end
  1634.  
  1635.   #--------------------------------------------------------------------------
  1636.   # alias method: input
  1637.   #--------------------------------------------------------------------------
  1638.   alias game_actor_input_abe input
  1639.   def input
  1640.     if @actions.nil?
  1641.       make_actions
  1642.       @action_input_index = 0
  1643.     end
  1644.     if @actions[@action_input_index].nil?
  1645.       @actions[@action_input_index] = Game_Action.new(self)
  1646.     end
  1647.     return game_actor_input_abe
  1648.   end
  1649.  
  1650. end # Game_Actor
  1651.  
  1652. #==============================================================================
  1653. # ?! Game_Enemy
  1654. #==============================================================================
  1655.  
  1656. class Game_Enemy < Game_Battler
  1657.  
  1658.   #--------------------------------------------------------------------------
  1659.   # overwrite method: perform_damage_effect
  1660.   #--------------------------------------------------------------------------
  1661.   def perform_damage_effect
  1662.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1663.     Sound.play_enemy_damage
  1664.   end
  1665.  
  1666.   #--------------------------------------------------------------------------
  1667.   # new methods: attack_animation_id
  1668.   #--------------------------------------------------------------------------
  1669.   def atk_animation_id1; return enemy.atk_animation_id1; end
  1670.   def atk_animation_id2; return enemy.atk_animation_id2; end
  1671.  
  1672.   #--------------------------------------------------------------------------
  1673.   # new method: sprite
  1674.   #--------------------------------------------------------------------------
  1675.   def sprite
  1676.     return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
  1677.   end
  1678.  
  1679. end # Game_Enemy
  1680.  
  1681. #==============================================================================
  1682. # ?! Game_Unit
  1683. #==============================================================================
  1684.  
  1685. class Game_Unit
  1686.  
  1687.   #--------------------------------------------------------------------------
  1688.   # alias method: make_actions
  1689.   #--------------------------------------------------------------------------
  1690.   alias game_unit_make_actions_abe make_actions
  1691.   def make_actions
  1692.     game_unit_make_actions_abe
  1693.     refresh_autobattler_status_window
  1694.   end
  1695.  
  1696.   #--------------------------------------------------------------------------
  1697.   # new method: refresh_autobattler_status_window
  1698.   #--------------------------------------------------------------------------
  1699.   def refresh_autobattler_status_window
  1700.     return unless SceneManager.scene_is?(Scene_Battle)
  1701.     return unless self.is_a?(Game_Party)
  1702.     SceneManager.scene.refresh_autobattler_status_window
  1703.   end
  1704.  
  1705. end # Game_Unit
  1706.  
  1707. #==============================================================================
  1708. # ?! Window_PartyCommand
  1709. #==============================================================================
  1710.  
  1711. class Window_PartyCommand < Window_Command
  1712.  
  1713.   #--------------------------------------------------------------------------
  1714.   # overwrite method: process_handling
  1715.   #--------------------------------------------------------------------------
  1716.   def process_handling
  1717.     return unless open? && active
  1718.     return process_dir6 if Input.repeat?(:RIGHT)
  1719.     return super
  1720.   end
  1721.  
  1722.   #--------------------------------------------------------------------------
  1723.   # new method: process_dir6
  1724.   #--------------------------------------------------------------------------
  1725.   def process_dir6
  1726.     Sound.play_cursor
  1727.     Input.update
  1728.     deactivate
  1729.     call_handler(:dir6)
  1730.   end
  1731.  
  1732. end # Window_PartyCommand
  1733.  
  1734. #==============================================================================
  1735. # ?! Window_ActorCommand
  1736. #==============================================================================
  1737.  
  1738. class Window_ActorCommand < Window_Command
  1739.  
  1740.   #--------------------------------------------------------------------------
  1741.   # overwrite method: process_handling
  1742.   #--------------------------------------------------------------------------
  1743.   def process_handling
  1744.     return unless open? && active
  1745.     return process_dir4 if Input.repeat?(:LEFT)
  1746.     return process_dir6 if Input.repeat?(:RIGHT)
  1747.     return super
  1748.   end
  1749.  
  1750.   #--------------------------------------------------------------------------
  1751.   # new method: process_dir4
  1752.   #--------------------------------------------------------------------------
  1753.   def process_dir4
  1754.     Sound.play_cursor
  1755.     Input.update
  1756.     deactivate
  1757.     call_handler(:cancel)
  1758.   end
  1759.  
  1760.   #--------------------------------------------------------------------------
  1761.   # new method: process_dir6
  1762.   #--------------------------------------------------------------------------
  1763.   def process_dir6
  1764.     Sound.play_cursor
  1765.     Input.update
  1766.     deactivate
  1767.     call_handler(:dir6)
  1768.   end
  1769.  
  1770. end # Window_ActorCommand
  1771.  
  1772. #==============================================================================
  1773. # ?! Window_BattleStatus
  1774. #==============================================================================
  1775.  
  1776. class Window_BattleStatus < Window_Selectable
  1777.  
  1778.   #--------------------------------------------------------------------------
  1779.   # overwrite method: initialize
  1780.   #--------------------------------------------------------------------------
  1781.   def initialize
  1782.     super(0, 0, window_width, window_height)
  1783.     self.openness = 0
  1784.     @party = $game_party.battle_members.clone
  1785.   end
  1786.  
  1787.   #--------------------------------------------------------------------------
  1788.   # overwrite method: col_max
  1789.   #--------------------------------------------------------------------------
  1790.   def col_max; return $game_party.max_battle_members; end
  1791.  
  1792.   #--------------------------------------------------------------------------
  1793.   # new method: battle_members
  1794.   #--------------------------------------------------------------------------
  1795.   def battle_members; return $game_party.battle_members; end
  1796.  
  1797.   #--------------------------------------------------------------------------
  1798.   # new method: actor
  1799.   #--------------------------------------------------------------------------
  1800.   def actor; return battle_members[@index]; end
  1801.  
  1802.   #--------------------------------------------------------------------------
  1803.   # overwrite method: update
  1804.   #--------------------------------------------------------------------------
  1805.   def update
  1806.     super
  1807.     return if @party == $game_party.battle_members
  1808.     @party = $game_party.battle_members.clone
  1809.     refresh
  1810.   end
  1811.  
  1812.   #--------------------------------------------------------------------------
  1813.   # overwrite method: draw_item
  1814.   #--------------------------------------------------------------------------
  1815.   def draw_item(index)
  1816.     return if index.nil?
  1817.     clear_item(index)
  1818.     actor = battle_members[index]
  1819.     rect = item_rect(index)
  1820.     return if actor.nil?
  1821.     draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
  1822.     draw_actor_name(actor, rect.x, rect.y, rect.width-8)
  1823.     draw_actor_action(actor, rect.x, rect.y)
  1824.     draw_actor_icons(actor, rect.x, line_height*1, rect.width)
  1825.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
  1826.     contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
  1827.     draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
  1828.     if draw_tp?(actor) && draw_mp?(actor)
  1829.       dw = rect.width/2-2
  1830.       dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
  1831.       draw_actor_tp(actor, rect.x+2, line_height*3, dw)
  1832.       if YEA::BATTLE::BATTLESTATUS_TP_ICON_GAUGE
  1833.         draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
  1834.       else
  1835.         dw = rect.width - rect.width/2 - 2
  1836.         draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
  1837.       end
  1838.     elsif draw_tp?(actor) && !draw_mp?(actor)
  1839.       draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
  1840.     else
  1841.       draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
  1842.     end
  1843.   end
  1844.  
  1845.   #--------------------------------------------------------------------------
  1846.   # overwrite method: item_rect
  1847.   #--------------------------------------------------------------------------
  1848.   def item_rect(index)
  1849.     rect = Rect.new
  1850.     rect.width = contents.width / $game_party.max_battle_members
  1851.     rect.height = contents.height
  1852.     rect.x = index * rect.width
  1853.     if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
  1854.       rect.x += (contents.width - $game_party.members.size * rect.width) / 2
  1855.     end
  1856.     rect.y = 0
  1857.     return rect
  1858.   end
  1859.  
  1860.   #--------------------------------------------------------------------------
  1861.   # overwrite method: draw_face
  1862.   #--------------------------------------------------------------------------
  1863.   def draw_face(face_name, face_index, dx, dy, enabled = true)
  1864.     bitmap = Cache.face(face_name)
  1865.     fx = [(96 - item_rect(0).width + 1) / 2, 0].max
  1866.     fy = face_index / 4 * 96 + 2
  1867.     fw = [item_rect(0).width - 4, 92].min
  1868.     rect = Rect.new(fx, fy, fw, 92)
  1869.     rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
  1870.     contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
  1871.     bitmap.dispose
  1872.   end
  1873.  
  1874.   #--------------------------------------------------------------------------
  1875.   # overwrite method: draw_actor_name
  1876.   #--------------------------------------------------------------------------
  1877.   def draw_actor_name(actor, dx, dy, dw = 112)
  1878.     reset_font_settings
  1879.     contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
  1880.     change_color(hp_color(actor))
  1881.     draw_text(dx+24, dy, dw-24, line_height, actor.name)
  1882.   end
  1883.  
  1884.   #--------------------------------------------------------------------------
  1885.   # new method: draw_actor_action
  1886.   #--------------------------------------------------------------------------
  1887.   def draw_actor_action(actor, dx, dy)
  1888.     draw_icon(action_icon(actor), dx, dy)
  1889.   end
  1890.  
  1891.   #--------------------------------------------------------------------------
  1892.   # new method: action_icon
  1893.   #--------------------------------------------------------------------------
  1894.   def action_icon(actor)
  1895.     return Icon.no_action if actor.current_action.nil?
  1896.     return Icon.no_action if actor.current_action.item.nil?
  1897.     return actor.current_action.item.icon_index
  1898.   end
  1899.  
  1900.   #--------------------------------------------------------------------------
  1901.   # new method: draw_tp?
  1902.   #--------------------------------------------------------------------------
  1903.   def draw_tp?(actor)
  1904.     return actor.draw_tp?
  1905.   end
  1906.  
  1907.   #--------------------------------------------------------------------------
  1908.   # new method: draw_mp?
  1909.   #--------------------------------------------------------------------------
  1910.   def draw_mp?(actor)
  1911.     return actor.draw_mp?
  1912.   end
  1913.  
  1914.   #--------------------------------------------------------------------------
  1915.   # overwrite method: draw_current_and_max_values
  1916.   #--------------------------------------------------------------------------
  1917.   def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
  1918.     change_color(color1)
  1919.     draw_text(dx, dy, dw, line_height, current.group, 2)
  1920.   end
  1921.  
  1922.   #--------------------------------------------------------------------------
  1923.   # overwrite method: draw_actor_hp
  1924.   #--------------------------------------------------------------------------
  1925.   def draw_actor_hp(actor, dx, dy, width = 124)
  1926.     draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  1927.     change_color(system_color)
  1928.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1929.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
  1930.     draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
  1931.       hp_color(actor), normal_color)
  1932.     end
  1933.    
  1934.   #--------------------------------------------------------------------------
  1935.   # overwrite method: draw_actor_mp
  1936.   #--------------------------------------------------------------------------
  1937.   def draw_actor_mp(actor, dx, dy, width = 124)
  1938.     draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  1939.     change_color(system_color)
  1940.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1941.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
  1942.     draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
  1943.       mp_color(actor), normal_color)
  1944.     end
  1945.    
  1946.   #--------------------------------------------------------------------------
  1947.   # overwrite method: draw_actor_tp
  1948.   #--------------------------------------------------------------------------
  1949.   if YEA::BATTLE::BATTLESTATUS_TP_ICON_GAUGE
  1950.     def draw_actor_tp(actor, dx, dy, width = 124)
  1951.       cy = (Font.default_size - contents.font.size) / 2 + 1
  1952.       icon = YEA::BATTLE::BATTLESTATUS_TP_ICON
  1953.       draw_icon(icon, dx+70, dy-53)
  1954.       draw_text(dx+46, dy-48, 42, line_height, actor.tp.to_i, 2)
  1955.     end
  1956.   else
  1957.     def draw_actor_tp(actor, dx, dy, width = 124)
  1958.       draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  1959.       change_color(system_color)
  1960.       cy = (Font.default_size - contents.font.size) / 2 + 1
  1961.       draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
  1962.       change_color(tp_color(actor))
  1963.       draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
  1964.     end
  1965.   end
  1966. end # Window_BattleStatus
  1967.  
  1968. #==============================================================================
  1969. # ?! Window_BattleActor
  1970. #==============================================================================
  1971.  
  1972. class Window_BattleActor < Window_BattleStatus
  1973.  
  1974.   #--------------------------------------------------------------------------
  1975.   # overwrite method: show
  1976.   #--------------------------------------------------------------------------
  1977.   def show
  1978.     create_flags
  1979.     super
  1980.   end
  1981.  
  1982.   #--------------------------------------------------------------------------
  1983.   # new method: create_flags
  1984.   #--------------------------------------------------------------------------
  1985.   def create_flags
  1986.     set_select_flag(:any)
  1987.     select(0)
  1988.     return if $game_temp.battle_aid.nil?
  1989.     if $game_temp.battle_aid.need_selection?
  1990.       select(0)
  1991.       set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
  1992.     elsif $game_temp.battle_aid.for_user?
  1993.       battler = BattleManager.actor
  1994.       id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
  1995.       select(id)
  1996.       set_select_flag(:user)
  1997.     elsif $game_temp.battle_aid.for_all?
  1998.       select(0)
  1999.       set_select_flag(:all)
  2000.       set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
  2001.     elsif $game_temp.battle_aid.for_random?
  2002.       select(0)
  2003.       set_select_flag(:random) if $game_temp.battle_aid.for_random?
  2004.     end
  2005.   end
  2006.  
  2007.   #--------------------------------------------------------------------------
  2008.   # new method: set_flag
  2009.   #--------------------------------------------------------------------------
  2010.   def set_select_flag(flag)
  2011.     @select_flag = flag
  2012.     case @select_flag
  2013.     when :all, :all_dead, :random
  2014.       @cursor_all = true
  2015.     else
  2016.       @cursor_all = false
  2017.     end
  2018.   end
  2019.  
  2020.   #--------------------------------------------------------------------------
  2021.   # overwrite method: update_cursor
  2022.   #--------------------------------------------------------------------------
  2023.   def update_cursor
  2024.     if @cursor_all
  2025.       cursor_rect.set(0, 0, contents.width, contents.height)
  2026.       self.top_row = 0
  2027.     elsif @index < 0
  2028.       cursor_rect.empty
  2029.     else
  2030.       ensure_cursor_visible
  2031.       cursor_rect.set(item_rect(@index))
  2032.     end
  2033.   end
  2034.  
  2035.   #--------------------------------------------------------------------------
  2036.   # overwrite method: cursor_movable?
  2037.   #--------------------------------------------------------------------------
  2038.   def cursor_movable?
  2039.     return false if @select_flag == :user
  2040.     return super
  2041.   end
  2042.  
  2043.   #--------------------------------------------------------------------------
  2044.   # overwrite method: current_item_enabled?
  2045.   #--------------------------------------------------------------------------
  2046.   def current_item_enabled?
  2047.     return true if $game_temp.battle_aid.nil?
  2048.     if $game_temp.battle_aid.need_selection?
  2049.       member = $game_party.battle_members[@index]
  2050.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  2051.     elsif $game_temp.battle_aid.for_dead_friend?
  2052.       for member in $game_party.battle_members
  2053.         return true if member.dead?
  2054.       end
  2055.       return false
  2056.     end
  2057.     return true
  2058.   end
  2059.  
  2060. end # Window_BattleActor
  2061.  
  2062. #==============================================================================
  2063. # ?! Window_BattleStatusAid
  2064. #==============================================================================
  2065.  
  2066. class Window_BattleStatusAid < Window_BattleStatus
  2067.  
  2068.   #--------------------------------------------------------------------------
  2069.   # public instance variables
  2070.   #--------------------------------------------------------------------------
  2071.   attr_accessor :status_window
  2072.  
  2073.   #--------------------------------------------------------------------------
  2074.   # overwrite method: initialize
  2075.   #--------------------------------------------------------------------------
  2076.   def initialize
  2077.     super
  2078.     self.visible = false
  2079.     self.openness = 255
  2080.   end
  2081.  
  2082.   #--------------------------------------------------------------------------
  2083.   # overwrite method: window_width
  2084.   #--------------------------------------------------------------------------
  2085.   def window_width; return 128; end
  2086.  
  2087.   #--------------------------------------------------------------------------
  2088.   # overwrite method: show
  2089.   #--------------------------------------------------------------------------
  2090.   def show
  2091.     super
  2092.     refresh
  2093.   end
  2094.  
  2095.   #--------------------------------------------------------------------------
  2096.   # overwrite method: refresh
  2097.   #--------------------------------------------------------------------------
  2098.   def refresh
  2099.     contents.clear
  2100.     return if @status_window.nil?
  2101.     draw_item(@status_window.index)
  2102.   end
  2103.  
  2104.   #--------------------------------------------------------------------------
  2105.   # overwrite method: item_rect
  2106.   #--------------------------------------------------------------------------
  2107.   def item_rect(index)
  2108.     return Rect.new(0, 0, contents.width, contents.height)
  2109.   end
  2110.  
  2111. end # Window_BattleStatusAid
  2112.  
  2113. #==============================================================================
  2114. # ?! Window_BattleEnemy
  2115. #==============================================================================
  2116.  
  2117. class Window_BattleEnemy < Window_Selectable
  2118.  
  2119.   #--------------------------------------------------------------------------
  2120.   # overwrite method: initialize
  2121.   #--------------------------------------------------------------------------
  2122.   def initialize(info_viewport)
  2123.     super(0, Graphics.height, window_width, fitting_height(1))
  2124.     refresh
  2125.     self.visible = false
  2126.     @info_viewport = info_viewport
  2127.   end
  2128.  
  2129.   #--------------------------------------------------------------------------
  2130.   # overwrite method: col_max
  2131.   #--------------------------------------------------------------------------
  2132.   def col_max; return item_max > 0 ? item_max : 1; end
  2133.  
  2134.   #--------------------------------------------------------------------------
  2135.   # overwrite method: show
  2136.   #--------------------------------------------------------------------------
  2137.   def show
  2138.     create_flags
  2139.     super
  2140.   end
  2141.  
  2142.   #--------------------------------------------------------------------------
  2143.   # new method: create_flags
  2144.   #--------------------------------------------------------------------------
  2145.   def create_flags
  2146.     set_select_flag(:any)
  2147.     select(0)
  2148.     return if $game_temp.battle_aid.nil?
  2149.     if $game_temp.battle_aid.need_selection?
  2150.       select(0)
  2151.     elsif $game_temp.battle_aid.for_all?
  2152.       select(0)
  2153.       set_select_flag(:all)
  2154.     elsif $game_temp.battle_aid.for_random?
  2155.       select(0)
  2156.       set_select_flag(:random)
  2157.     end
  2158.   end
  2159.  
  2160.   #--------------------------------------------------------------------------
  2161.   # new method: set_flag
  2162.   #--------------------------------------------------------------------------
  2163.   def set_select_flag(flag)
  2164.     @select_flag = flag
  2165.     case @select_flag
  2166.     when :all, :random
  2167.       @cursor_all = true
  2168.     else
  2169.       @cursor_all = false
  2170.     end
  2171.   end
  2172.  
  2173.   #--------------------------------------------------------------------------
  2174.   # new method: select_all?
  2175.   #--------------------------------------------------------------------------
  2176.   def select_all?
  2177.     return true if @select_flag == :all
  2178.     return true if @select_flag == :random
  2179.     return false
  2180.   end
  2181.  
  2182.   #--------------------------------------------------------------------------
  2183.   # overwrite method: update_cursor
  2184.   #--------------------------------------------------------------------------
  2185.   def update_cursor
  2186.     if @cursor_all
  2187.       cursor_rect.set(0, 0, contents.width, contents.height)
  2188.       self.top_row = 0
  2189.     elsif @index < 0
  2190.       cursor_rect.empty
  2191.     else
  2192.       ensure_cursor_visible
  2193.       cursor_rect.set(item_rect(@index))
  2194.     end
  2195.   end
  2196.  
  2197.   #--------------------------------------------------------------------------
  2198.   # overwrite method: cursor_movable?
  2199.   #--------------------------------------------------------------------------
  2200.   def cursor_movable?
  2201.     return false if @select_flag == :user
  2202.     return super
  2203.   end
  2204.  
  2205.   #--------------------------------------------------------------------------
  2206.   # overwrite method: current_item_enabled?
  2207.   #--------------------------------------------------------------------------
  2208.   def current_item_enabled?
  2209.     return true if $game_temp.battle_aid.nil?
  2210.     if $game_temp.battle_aid.need_selection?
  2211.       member = $game_party.battle_members[@index]
  2212.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  2213.     elsif $game_temp.battle_aid.for_dead_friend?
  2214.       for member in $game_party.battle_members
  2215.         return true if member.dead?
  2216.       end
  2217.       return false
  2218.     end
  2219.     return true
  2220.   end
  2221.  
  2222.   #--------------------------------------------------------------------------
  2223.   # overwrite method: enemy
  2224.   #--------------------------------------------------------------------------
  2225.   def enemy; @data[index]; end
  2226.  
  2227.   #--------------------------------------------------------------------------
  2228.   # overwrite method: refresh
  2229.   #--------------------------------------------------------------------------
  2230.   def refresh
  2231.     make_item_list
  2232.     create_contents
  2233.     draw_all_items
  2234.   end
  2235.  
  2236.   #--------------------------------------------------------------------------
  2237.   # overwrite method: make_item_list
  2238.   #--------------------------------------------------------------------------
  2239.   def make_item_list
  2240.     @data = $game_troop.alive_members
  2241.     @data.sort! { |a,b| a.screen_x <=> b.screen_x }
  2242.   end
  2243.  
  2244.   #--------------------------------------------------------------------------
  2245.   # overwrite method: draw_item
  2246.   #--------------------------------------------------------------------------
  2247.   def draw_item(index); return; end
  2248.  
  2249.   #--------------------------------------------------------------------------
  2250.   # overwrite method: update
  2251.   #--------------------------------------------------------------------------
  2252.   def update
  2253.     super
  2254.     return unless active
  2255.     enemy.sprite_effect_type = :whiten
  2256.     return unless select_all?
  2257.     for enemy in $game_troop.alive_members
  2258.       enemy.sprite_effect_type = :whiten
  2259.     end
  2260.   end
  2261.  
  2262. end # Window_BattleEnemy
  2263.  
  2264. #==============================================================================
  2265. # ?! Window_BattleHelp
  2266. #==============================================================================
  2267.  
  2268. class Window_BattleHelp < Window_Help
  2269.  
  2270.   #--------------------------------------------------------------------------
  2271.   # public instance variables
  2272.   #--------------------------------------------------------------------------
  2273.   attr_accessor :actor_window
  2274.   attr_accessor :enemy_window
  2275.  
  2276.   #--------------------------------------------------------------------------
  2277.   # update
  2278.   #--------------------------------------------------------------------------
  2279.   def update
  2280.     super
  2281.     if !self.visible and @text != ""
  2282.       @text = ""
  2283.       return refresh
  2284.     end
  2285.     update_battler_name
  2286.   end
  2287.  
  2288.   #--------------------------------------------------------------------------
  2289.   # update_battler_name
  2290.   #--------------------------------------------------------------------------
  2291.   def update_battler_name
  2292.     return unless @actor_window.active || @enemy_window.active
  2293.     if @actor_window.active
  2294.       battler = $game_party.battle_members[@actor_window.index]
  2295.     elsif @enemy_window.active
  2296.       battler = @enemy_window.enemy
  2297.     end
  2298.     if special_display?
  2299.       refresh_special_case(battler)
  2300.     else
  2301.       refresh_battler_name(battler) if battler_name(battler) != @text
  2302.     end
  2303.   end
  2304.  
  2305.   #--------------------------------------------------------------------------
  2306.   # battler_name
  2307.   #--------------------------------------------------------------------------
  2308.   def battler_name(battler)
  2309.     text = battler.name.clone
  2310.     return text
  2311.   end
  2312.  
  2313.   #--------------------------------------------------------------------------
  2314.   # refresh_battler_name
  2315.   #--------------------------------------------------------------------------
  2316.   def refresh_battler_name(battler)
  2317.     contents.clear
  2318.     reset_font_settings
  2319.     change_color(normal_color)
  2320.     @text = battler_name(battler)
  2321.     icons = battler.state_icons + battler.buff_icons
  2322.     dy = icons.size <= 0 ? line_height / 2 : 0
  2323.     draw_text(0, dy, contents.width, line_height, @text, 1)
  2324.     dx = (contents.width - (icons.size * 24)) / 2
  2325.     draw_actor_icons(battler, dx, line_height, contents.width)
  2326.   end
  2327.  
  2328.   #--------------------------------------------------------------------------
  2329.   # special_display?
  2330.   #--------------------------------------------------------------------------
  2331.   def special_display?
  2332.     return false if $game_temp.battle_aid.nil?
  2333.     return false if $game_temp.battle_aid.for_user?
  2334.     return !$game_temp.battle_aid.need_selection?
  2335.   end
  2336.  
  2337.   #--------------------------------------------------------------------------
  2338.   # refresh_special_case
  2339.   #--------------------------------------------------------------------------
  2340.   def refresh_special_case(battler)
  2341.     if $game_temp.battle_aid.for_opponent?
  2342.       if $game_temp.battle_aid.for_all?
  2343.         text = YEA::BATTLE::HELP_TEXT_ALL_FOES
  2344.       else
  2345.         case $game_temp.battle_aid.number_of_targets
  2346.         when 1
  2347.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
  2348.         else
  2349.           number = $game_temp.battle_aid.number_of_targets
  2350.           text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
  2351.         end
  2352.       end
  2353.     else # $game_temp.battle_aid.for_friend?
  2354.       if $game_temp.battle_aid.for_dead_friend?
  2355.         text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
  2356.       elsif $game_temp.battle_aid.for_random?
  2357.         case $game_temp.battle_aid.number_of_targets
  2358.         when 1
  2359.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
  2360.         else
  2361.           number = $game_temp.battle_aid.number_of_targets
  2362.           text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
  2363.         end
  2364.       else
  2365.         text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
  2366.       end
  2367.     end
  2368.     return if text == @text
  2369.     @text = text
  2370.     contents.clear
  2371.     reset_font_settings
  2372.     draw_text(0, 0, contents.width, line_height*2, @text, 1)
  2373.   end
  2374.  
  2375. end # Window_BattleHelp
  2376.  
  2377. #==============================================================================
  2378. # ?! Window_BattleLog
  2379. #==============================================================================
  2380.  
  2381. class Window_BattleLog < Window_Selectable
  2382.  
  2383.   #--------------------------------------------------------------------------
  2384.   # alias method: display_current_state
  2385.   #--------------------------------------------------------------------------
  2386.   alias window_battlelog_display_current_state_abe display_current_state
  2387.   def display_current_state(subject)
  2388.     subject.make_during_state_popup
  2389.     return unless YEA::BATTLE::MSG_CURRENT_STATE
  2390.     window_battlelog_display_current_state_abe(subject)
  2391.   end
  2392.  
  2393.   #--------------------------------------------------------------------------
  2394.   # alias method: display_use_item
  2395.   #--------------------------------------------------------------------------
  2396.   alias window_battlelog_display_use_item_abe display_use_item
  2397.   def display_use_item(subject, item)
  2398.     return unless YEA::BATTLE::MSG_CURRENT_ACTION
  2399.     window_battlelog_display_use_item_abe(subject, item)
  2400.   end
  2401.  
  2402.   #--------------------------------------------------------------------------
  2403.   # alias method: display_counter
  2404.   #--------------------------------------------------------------------------
  2405.   alias window_battlelog_display_counter_abe display_counter
  2406.   def display_counter(target, item)
  2407.     if YEA::BATTLE::MSG_COUNTERATTACK
  2408.       window_battlelog_display_counter_abe(target, item)
  2409.     else
  2410.       Sound.play_evasion
  2411.     end
  2412.   end
  2413.  
  2414.   #--------------------------------------------------------------------------
  2415.   # alias method: display_reflection
  2416.   #--------------------------------------------------------------------------
  2417.   alias window_battlelog_display_reflection_abe display_reflection
  2418.   def display_reflection(target, item)
  2419.     if YEA::BATTLE::MSG_REFLECT_MAGIC
  2420.       window_battlelog_display_reflection_abe(target, item)
  2421.     else
  2422.       Sound.play_reflection
  2423.     end
  2424.   end
  2425.  
  2426.   #--------------------------------------------------------------------------
  2427.   # alias method: display_substitute
  2428.   #--------------------------------------------------------------------------
  2429.   alias window_battlelog_display_substitute_abe display_substitute
  2430.   def display_substitute(substitute, target)
  2431.     return unless YEA::BATTLE::MSG_SUBSTITUTE_HIT
  2432.     window_battlelog_display_substitute_abe(substitute, target)
  2433.   end
  2434.  
  2435.   #--------------------------------------------------------------------------
  2436.   # alias method: display_failure
  2437.   #--------------------------------------------------------------------------
  2438.   alias window_battlelog_display_failure_abe display_failure
  2439.   def display_failure(target, item)
  2440.     return unless YEA::BATTLE::MSG_FAILURE_HIT
  2441.     window_battlelog_display_failure_abe(target, item)
  2442.   end
  2443.  
  2444.   #--------------------------------------------------------------------------
  2445.   # alias method: display_critical
  2446.   #--------------------------------------------------------------------------
  2447.   alias window_battlelog_display_critical_abe display_critical
  2448.   def display_critical(target, item)
  2449.     return unless YEA::BATTLE::MSG_CRITICAL_HIT
  2450.     window_battlelog_display_critical_abe(target, item)
  2451.   end
  2452.  
  2453.   #--------------------------------------------------------------------------
  2454.   # alias method: display_miss
  2455.   #--------------------------------------------------------------------------
  2456.   alias window_battlelog_display_miss_abe display_miss
  2457.   def display_miss(target, item)
  2458.     return unless YEA::BATTLE::MSG_HIT_MISSED
  2459.     window_battlelog_display_miss_abe(target, item)
  2460.   end
  2461.  
  2462.   #--------------------------------------------------------------------------
  2463.   # alias method: display_evasion
  2464.   #--------------------------------------------------------------------------
  2465.   alias window_battlelog_display_evasion_abe display_evasion
  2466.   def display_evasion(target, item)
  2467.     if YEA::BATTLE::MSG_EVASION
  2468.       window_battlelog_display_evasion_abe(target, item)
  2469.     else
  2470.       if !item || item.physical?
  2471.         Sound.play_evasion
  2472.       else
  2473.         Sound.play_magic_evasion
  2474.       end
  2475.     end
  2476.   end
  2477.  
  2478.   #--------------------------------------------------------------------------
  2479.   # overwrite method: display_hp_damage
  2480.   #--------------------------------------------------------------------------
  2481.   def display_hp_damage(target, item)
  2482.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  2483.     if target.result.hp_damage > 0 && target.result.hp_drain == 0
  2484.       target.perform_damage_effect
  2485.     end
  2486.     Sound.play_recovery if target.result.hp_damage < 0
  2487.     return unless YEA::BATTLE::MSG_HP_DAMAGE
  2488.     add_text(target.result.hp_damage_text)
  2489.     wait
  2490.   end
  2491.  
  2492.   #--------------------------------------------------------------------------
  2493.   # overwrite method: display_mp_damage
  2494.   #--------------------------------------------------------------------------
  2495.   def display_mp_damage(target, item)
  2496.     return if target.dead? || target.result.mp_damage == 0
  2497.     Sound.play_recovery if target.result.mp_damage < 0
  2498.     return unless YEA::BATTLE::MSG_MP_DAMAGE
  2499.     add_text(target.result.mp_damage_text)
  2500.     wait
  2501.   end
  2502.  
  2503.   #--------------------------------------------------------------------------
  2504.   # overwrite method: display_tp_damage
  2505.   #--------------------------------------------------------------------------
  2506.   def display_tp_damage(target, item)
  2507.     return if target.dead? || target.result.tp_damage == 0
  2508.     Sound.play_recovery if target.result.tp_damage < 0
  2509.     return unless YEA::BATTLE::MSG_TP_DAMAGE
  2510.     add_text(target.result.tp_damage_text)
  2511.     wait
  2512.   end
  2513.  
  2514.   #--------------------------------------------------------------------------
  2515.   # alias method: display_added_states
  2516.   #--------------------------------------------------------------------------
  2517.   alias window_battlelog_display_added_states_abe display_added_states
  2518.   def display_added_states(target)
  2519.     target.perform_collapse_effect if target.can_collapse?
  2520.     return unless YEA::BATTLE::MSG_ADDED_STATES
  2521.     window_battlelog_display_added_states_abe(target)
  2522.   end
  2523.  
  2524.   #--------------------------------------------------------------------------
  2525.   # alias method: display_removed_states
  2526.   #--------------------------------------------------------------------------
  2527.   alias window_battlelog_display_removed_states_abe display_removed_states
  2528.   def display_removed_states(target)
  2529.     return unless YEA::BATTLE::MSG_REMOVED_STATES
  2530.     window_battlelog_display_removed_states_abe(target)
  2531.   end
  2532.  
  2533.   #--------------------------------------------------------------------------
  2534.   # alias method: display_changed_buffs
  2535.   #--------------------------------------------------------------------------
  2536.   alias window_battlelog_display_changed_buffs_abe display_changed_buffs
  2537.   def display_changed_buffs(target)
  2538.     return unless YEA::BATTLE::MSG_CHANGED_BUFFS
  2539.     window_battlelog_display_changed_buffs_abe(target)
  2540.   end
  2541.  
  2542. end # Window_BattleLog
  2543.  
  2544. #==============================================================================
  2545. # ?! Window_SkillList
  2546. #==============================================================================
  2547.  
  2548. class Window_SkillList < Window_Selectable
  2549.  
  2550.   #--------------------------------------------------------------------------
  2551.   # overwrite method: spacing
  2552.   #--------------------------------------------------------------------------
  2553.   def spacing
  2554.     return 8 if $game_party.in_battle
  2555.     return super
  2556.   end
  2557.  
  2558. end # Window_SkillList
  2559.  
  2560. #==============================================================================
  2561. # ?! Window_ItemList
  2562. #==============================================================================
  2563.  
  2564. class Window_ItemList < Window_Selectable
  2565.  
  2566.   #--------------------------------------------------------------------------
  2567.   # overwrite method: spacing
  2568.   #--------------------------------------------------------------------------
  2569.   def spacing
  2570.     return 8 if $game_party.in_battle
  2571.     return super
  2572.   end
  2573.  
  2574. end # Window_ItemList
  2575.  
  2576. #==============================================================================
  2577. # ?! Scene_Battle
  2578. #==============================================================================
  2579.  
  2580. class Scene_Battle < Scene_Base
  2581.  
  2582.   #--------------------------------------------------------------------------
  2583.   # public instance variables
  2584.   #--------------------------------------------------------------------------
  2585.   attr_accessor :enemy_window
  2586.   attr_accessor :info_viewport
  2587.   attr_accessor :spriteset
  2588.   attr_accessor :status_window
  2589.   attr_accessor :status_aid_window
  2590.   attr_accessor :subject
  2591.  
  2592.   #--------------------------------------------------------------------------
  2593.   # alias method: create_spriteset
  2594.   #--------------------------------------------------------------------------
  2595.   alias scene_battle_create_spriteset_abe create_spriteset
  2596.   def create_spriteset
  2597.     BattleManager.init_battle_type
  2598.     scene_battle_create_spriteset_abe
  2599.   end
  2600.  
  2601.   #--------------------------------------------------------------------------
  2602.   # alias method: update_basic
  2603.   #--------------------------------------------------------------------------
  2604.   alias scene_battle_update_basic_abe update_basic
  2605.   def update_basic
  2606.     scene_battle_update_basic_abe
  2607.     update_debug
  2608.   end
  2609.  
  2610.   #--------------------------------------------------------------------------
  2611.   # new method: update_debug
  2612.   #--------------------------------------------------------------------------
  2613.   def update_debug
  2614.     return unless $TEST || $BTEST
  2615.     debug_heal_party if Input.trigger?(:F5)
  2616.     debug_damage_party if Input.trigger?(:F6)
  2617.     debug_fill_tp if Input.trigger?(:F7)
  2618.     debug_kill_all if Input.trigger?(:F8)
  2619.   end
  2620.  
  2621.   #--------------------------------------------------------------------------
  2622.   # new method: debug_heal_party
  2623.   #--------------------------------------------------------------------------
  2624.   def debug_heal_party
  2625.     Sound.play_recovery
  2626.     for member in $game_party.battle_members
  2627.       member.recover_all
  2628.     end
  2629.     @status_window.refresh
  2630.   end
  2631.  
  2632.   #--------------------------------------------------------------------------
  2633.   # new method: debug_damage_party
  2634.   #--------------------------------------------------------------------------
  2635.   def debug_damage_party
  2636.     Sound.play_actor_damage
  2637.     for member in $game_party.alive_members
  2638.       member.hp = 1
  2639.       member.mp = 0
  2640.       member.tp = 0
  2641.     end
  2642.     @status_window.refresh
  2643.   end
  2644.  
  2645.   #--------------------------------------------------------------------------
  2646.   # new method: debug_fill_tp
  2647.   #--------------------------------------------------------------------------
  2648.   def debug_fill_tp
  2649.     Sound.play_recovery
  2650.     for member in $game_party.alive_members
  2651.       member.tp = member.max_tp
  2652.     end
  2653.     @status_window.refresh
  2654.   end
  2655.  
  2656.   #--------------------------------------------------------------------------
  2657.   # new method: debug_kill_all
  2658.   #--------------------------------------------------------------------------
  2659.   def debug_kill_all
  2660.     for enemy in $game_troop.alive_members
  2661.       enemy.hp = 0
  2662.       enemy.perform_collapse_effect
  2663.     end
  2664.     BattleManager.judge_win_loss
  2665.     @log_window.wait
  2666.     @log_window.wait_for_effect
  2667.   end
  2668.  
  2669.   #--------------------------------------------------------------------------
  2670.   # alias method: create_all_windows
  2671.   #--------------------------------------------------------------------------
  2672.   alias scene_battle_create_all_windows_abe create_all_windows
  2673.   def create_all_windows
  2674.     scene_battle_create_all_windows_abe
  2675.     create_battle_status_aid_window
  2676.     set_help_window
  2677.   end
  2678.  
  2679.   #--------------------------------------------------------------------------
  2680.   # alias method: create_info_viewport
  2681.   #--------------------------------------------------------------------------
  2682.   alias scene_battle_create_info_viewport_abe create_info_viewport
  2683.   def create_info_viewport
  2684.     scene_battle_create_info_viewport_abe
  2685.     @status_window.refresh
  2686.   end
  2687.  
  2688.   #--------------------------------------------------------------------------
  2689.   # new method: create_battle_status_aid_window
  2690.   #--------------------------------------------------------------------------
  2691.   def create_battle_status_aid_window
  2692.     @status_aid_window = Window_BattleStatusAid.new
  2693.     @status_aid_window.status_window = @status_window
  2694.     @status_aid_window.x = Graphics.width - @status_aid_window.width
  2695.     @status_aid_window.y = Graphics.height - @status_aid_window.height
  2696.   end
  2697.  
  2698.   #--------------------------------------------------------------------------
  2699.   # overwrite method: create_help_window
  2700.   #--------------------------------------------------------------------------
  2701.   def create_help_window
  2702.     @help_window = Window_BattleHelp.new
  2703.     @help_window.hide
  2704.   end
  2705.  
  2706.   #--------------------------------------------------------------------------
  2707.   # new method: set_help_window
  2708.   #--------------------------------------------------------------------------
  2709.   def set_help_window
  2710.     @help_window.actor_window = @actor_window
  2711.     @help_window.enemy_window = @enemy_window
  2712.   end
  2713.  
  2714.   #--------------------------------------------------------------------------
  2715.   # alias method: create_party_command_window
  2716.   #--------------------------------------------------------------------------
  2717.   alias scene_battle_create_party_command_window_abe create_party_command_window
  2718.   def create_party_command_window
  2719.     scene_battle_create_party_command_window_abe
  2720.     @party_command_window.set_handler(:dir6, method(:command_fight))
  2721.   end
  2722.  
  2723.   #--------------------------------------------------------------------------
  2724.   # alias method: create_actor_command_window
  2725.   #--------------------------------------------------------------------------
  2726.   alias scene_battle_create_actor_command_window_abe create_actor_command_window
  2727.   def create_actor_command_window
  2728.     scene_battle_create_actor_command_window_abe
  2729.     @actor_command_window.set_handler(:dir4, method(:prior_command))
  2730.     @actor_command_window.set_handler(:dir6, method(:next_command))
  2731.   end
  2732.  
  2733.   #--------------------------------------------------------------------------
  2734.   # alias method: create_skill_window
  2735.   #--------------------------------------------------------------------------
  2736.   alias scene_battle_create_skill_window_abe create_skill_window
  2737.   def create_skill_window
  2738.     scene_battle_create_skill_window_abe
  2739.     @skill_window.height = @info_viewport.rect.height
  2740.     @skill_window.width = Graphics.width - @actor_command_window.width
  2741.     @skill_window.y = Graphics.height - @skill_window.height
  2742.   end
  2743.  
  2744.   #--------------------------------------------------------------------------
  2745.   # alias method: create_item_window
  2746.   #--------------------------------------------------------------------------
  2747.   alias scene_battle_create_item_window_abe create_item_window
  2748.   def create_item_window
  2749.     scene_battle_create_item_window_abe
  2750.     @item_window.height = @skill_window.height
  2751.     @item_window.width = @skill_window.width
  2752.     @item_window.y = Graphics.height - @item_window.height
  2753.   end
  2754.  
  2755.   #--------------------------------------------------------------------------
  2756.   # alias method: show_fast?
  2757.   #--------------------------------------------------------------------------
  2758.   alias scene_battle_show_fast_abe show_fast?
  2759.   def show_fast?
  2760.     return true if YEA::BATTLE::AUTO_FAST
  2761.     return scene_battle_show_fast_abe
  2762.   end
  2763.  
  2764.   #--------------------------------------------------------------------------
  2765.   # alias method: next_command
  2766.   #--------------------------------------------------------------------------
  2767.   alias scene_battle_next_command_abe next_command
  2768.   def next_command
  2769.     @status_window.show
  2770.     redraw_current_status
  2771.     @actor_command_window.show
  2772.     @status_aid_window.hide
  2773.     scene_battle_next_command_abe
  2774.   end
  2775.  
  2776.   #--------------------------------------------------------------------------
  2777.   # alias method: prior_command
  2778.   #--------------------------------------------------------------------------
  2779.   alias scene_battle_prior_command_abe prior_command
  2780.   def prior_command
  2781.     redraw_current_status
  2782.     scene_battle_prior_command_abe
  2783.   end
  2784.  
  2785.   #--------------------------------------------------------------------------
  2786.   # new method: redraw_current_status
  2787.   #--------------------------------------------------------------------------
  2788.   def redraw_current_status
  2789.     return if @status_window.index < 0
  2790.     @status_window.draw_item(@status_window.index)
  2791.   end
  2792.  
  2793.   #--------------------------------------------------------------------------
  2794.   # alias method: command_attack
  2795.   #--------------------------------------------------------------------------
  2796.   alias scene_battle_command_attack_abe command_attack
  2797.   def command_attack
  2798.     $game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
  2799.     scene_battle_command_attack_abe
  2800.   end
  2801.  
  2802.   #--------------------------------------------------------------------------
  2803.   # alias method: command_skill
  2804.   #--------------------------------------------------------------------------
  2805.   alias scene_battle_command_skill_abe command_skill
  2806.   def command_skill
  2807.     scene_battle_command_skill_abe
  2808.     @status_window.hide
  2809.     @actor_command_window.hide
  2810.     @status_aid_window.show
  2811.   end
  2812.  
  2813.   #--------------------------------------------------------------------------
  2814.   # alias method: command_item
  2815.   #--------------------------------------------------------------------------
  2816.   alias scene_battle_command_item_abe command_item
  2817.   def command_item
  2818.     scene_battle_command_item_abe
  2819.     @status_window.hide
  2820.     @actor_command_window.hide
  2821.     @status_aid_window.show
  2822.   end
  2823.  
  2824.   #--------------------------------------------------------------------------
  2825.   # overwrite method: on_skill_ok
  2826.   #--------------------------------------------------------------------------
  2827.   def on_skill_ok
  2828.     @skill = @skill_window.item
  2829.     $game_temp.battle_aid = @skill
  2830.     BattleManager.actor.input.set_skill(@skill.id)
  2831.     BattleManager.actor.last_skill.object = @skill
  2832.     if @skill.for_opponent?
  2833.       select_enemy_selection
  2834.     elsif @skill.for_friend?
  2835.       select_actor_selection
  2836.     else
  2837.       @skill_window.hide
  2838.       next_command
  2839.       $game_temp.battle_aid = nil
  2840.     end
  2841.   end
  2842.  
  2843.   #--------------------------------------------------------------------------
  2844.   # alias method: on_skill_cancel
  2845.   #--------------------------------------------------------------------------
  2846.   alias scene_battle_on_skill_cancel_abe on_skill_cancel
  2847.   def on_skill_cancel
  2848.     scene_battle_on_skill_cancel_abe
  2849.     @status_window.show
  2850.     @actor_command_window.show
  2851.     @status_aid_window.hide
  2852.   end
  2853.  
  2854.   #--------------------------------------------------------------------------
  2855.   # overwrite method: on_item_ok
  2856.   #--------------------------------------------------------------------------
  2857.   def on_item_ok
  2858.     @item = @item_window.item
  2859.     $game_temp.battle_aid = @item
  2860.     BattleManager.actor.input.set_item(@item.id)
  2861.     if @item.for_opponent?
  2862.       select_enemy_selection
  2863.     elsif @item.for_friend?
  2864.       select_actor_selection
  2865.     else
  2866.       @item_window.hide
  2867.       next_command
  2868.       $game_temp.battle_aid = nil
  2869.     end
  2870.     $game_party.last_item.object = @item
  2871.   end
  2872.  
  2873.   #--------------------------------------------------------------------------
  2874.   # alias method: on_item_cancel
  2875.   #--------------------------------------------------------------------------
  2876.   alias scene_battle_on_item_cancel_abe on_item_cancel
  2877.   def on_item_cancel
  2878.     scene_battle_on_item_cancel_abe
  2879.     @status_window.show
  2880.     @actor_command_window.show
  2881.     @status_aid_window.hide
  2882.   end
  2883.  
  2884.   #--------------------------------------------------------------------------
  2885.   # alias method: select_actor_selection
  2886.   #--------------------------------------------------------------------------
  2887.   alias scene_battle_select_actor_selection_abe select_actor_selection
  2888.   def select_actor_selection
  2889.     @status_aid_window.refresh
  2890.     scene_battle_select_actor_selection_abe
  2891.     @status_window.hide
  2892.     @skill_window.hide
  2893.     @item_window.hide
  2894.     @help_window.show
  2895.   end
  2896.  
  2897.   #--------------------------------------------------------------------------
  2898.   # alias method: on_actor_ok
  2899.   #--------------------------------------------------------------------------
  2900.   alias scene_battle_on_actor_ok_abe on_actor_ok
  2901.   def on_actor_ok
  2902.     $game_temp.battle_aid = nil
  2903.     scene_battle_on_actor_ok_abe
  2904.     @status_window.show
  2905.     if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
  2906.       @actor_command_window.visible = !@confirm_command_window.visible
  2907.     else
  2908.       @actor_command_window.show
  2909.     end
  2910.     @status_aid_window.hide
  2911.   end
  2912.  
  2913.   #--------------------------------------------------------------------------
  2914.   # alias method: on_actor_cancel
  2915.   #--------------------------------------------------------------------------
  2916.   alias scene_battle_on_actor_cancel_abe on_actor_cancel
  2917.   def on_actor_cancel
  2918.     BattleManager.actor.input.clear
  2919.     @status_aid_window.refresh
  2920.     $game_temp.battle_aid = nil
  2921.     scene_battle_on_actor_cancel_abe
  2922.     case @actor_command_window.current_symbol
  2923.     when :skill
  2924.       @skill_window.show
  2925.     when :item
  2926.       @item_window.show
  2927.     end
  2928.   end
  2929.  
  2930.   #--------------------------------------------------------------------------
  2931.   # alias method: select_enemy_selection
  2932.   #--------------------------------------------------------------------------
  2933.   alias scene_battle_select_enemy_selection_abe select_enemy_selection
  2934.   def select_enemy_selection
  2935.     @status_aid_window.refresh
  2936.     scene_battle_select_enemy_selection_abe
  2937.     @help_window.show
  2938.   end
  2939.   #--------------------------------------------------------------------------
  2940.   # alias method: on_enemy_ok
  2941.   #--------------------------------------------------------------------------
  2942.   alias scene_battle_on_enemy_ok_abe on_enemy_ok
  2943.   def on_enemy_ok
  2944.     $game_temp.battle_aid = nil
  2945.     scene_battle_on_enemy_ok_abe
  2946.   end
  2947.  
  2948.   #--------------------------------------------------------------------------
  2949.   # alias method: on_enemy_cancel
  2950.   #--------------------------------------------------------------------------
  2951.   alias scene_battle_on_enemy_cancel_abe on_enemy_cancel
  2952.   def on_enemy_cancel
  2953.     BattleManager.actor.input.clear
  2954.     @status_aid_window.refresh
  2955.     $game_temp.battle_aid = nil
  2956.     scene_battle_on_enemy_cancel_abe
  2957.     if @skill_window.visible || @item_window.visible
  2958.       @help_window.show
  2959.     else
  2960.       @help_window.hide
  2961.     end
  2962.   end
  2963.  
  2964.   #--------------------------------------------------------------------------
  2965.   # alias method: battle_start
  2966.   #--------------------------------------------------------------------------
  2967.   alias scene_battle_battle_start_abe battle_start
  2968.   def battle_start
  2969.     scene_battle_battle_start_abe
  2970.     return unless YEA::BATTLE::SKIP_PARTY_COMMAND
  2971.     @party_command_window.deactivate
  2972.     if BattleManager.input_start
  2973.       command_fight
  2974.     else
  2975.       turn_start
  2976.     end
  2977.   end
  2978.  
  2979.   #--------------------------------------------------------------------------
  2980.   # overwrite method: turn_end
  2981.   #--------------------------------------------------------------------------
  2982.   def turn_end
  2983.     all_battle_members.each do |battler|
  2984.       battler.on_turn_end
  2985.       status_redraw_target(battler)
  2986.       @log_window.display_auto_affected_status(battler)
  2987.       @log_window.wait_and_clear
  2988.     end
  2989.     update_party_cooldowns if $imported["YEA-CommandParty"]
  2990.     BattleManager.turn_end
  2991.     process_event
  2992.     start_party_command_selection
  2993.     return if end_battle_conditions?
  2994.     return unless YEA::BATTLE::SKIP_PARTY_COMMAND
  2995.     if BattleManager.input_start
  2996.       @party_command_window.deactivate
  2997.       command_fight
  2998.     else
  2999.       @party_command_window.deactivate
  3000.       turn_start
  3001.     end
  3002.   end
  3003.  
  3004.   #--------------------------------------------------------------------------
  3005.   # new method: end_battle_conditions?
  3006.   #--------------------------------------------------------------------------
  3007.   def end_battle_conditions?
  3008.     return true if $game_party.members.empty?
  3009.     return true if $game_party.all_dead?
  3010.     return true if $game_troop.all_dead?
  3011.     return true if BattleManager.aborting?
  3012.     return false
  3013.   end
  3014.  
  3015.   #--------------------------------------------------------------------------
  3016.   # overwrite method: execute_action
  3017.   #--------------------------------------------------------------------------
  3018.   def execute_action
  3019.     @subject.sprite_effect_type = :whiten if YEA::BATTLE::FLASH_WHITE_EFFECT
  3020.     use_item
  3021.     @log_window.wait_and_clear
  3022.   end
  3023.  
  3024.   #--------------------------------------------------------------------------
  3025.   # overwrite method: apply_item_effects
  3026.   #--------------------------------------------------------------------------
  3027.   def apply_item_effects(target, item)
  3028.     if $imported["YEA-LunaticObjects"]
  3029.       lunatic_object_effect(:prepare, item, @subject, target)
  3030.     end
  3031.     target.item_apply(@subject, item)
  3032.     status_redraw_target(@subject)
  3033.     status_redraw_target(target) unless target == @subject
  3034.     @log_window.display_action_results(target, item)
  3035.     if $imported["YEA-LunaticObjects"]
  3036.       lunatic_object_effect(:during, item, @subject, target)
  3037.     end
  3038.     perform_collapse_check(target)
  3039.   end
  3040.  
  3041.   #--------------------------------------------------------------------------
  3042.   # overwite method: invoke_counter_attack
  3043.   #--------------------------------------------------------------------------
  3044.   def invoke_counter_attack(target, item)
  3045.     @log_window.display_counter(target, item)
  3046.     attack_skill = $data_skills[target.attack_skill_id]
  3047.     @subject.item_apply(target, attack_skill)
  3048.     status_redraw_target(@subject)
  3049.     status_redraw_target(target) unless target == @subject
  3050.     @log_window.display_action_results(@subject, attack_skill)
  3051.     perform_collapse_check(target)
  3052.     perform_collapse_check(@subject)
  3053.   end
  3054.  
  3055.   #--------------------------------------------------------------------------
  3056.   # new method: perform_collapse_check
  3057.   #--------------------------------------------------------------------------
  3058.   def perform_collapse_check(target)
  3059.     return if YEA::BATTLE::MSG_ADDED_STATES
  3060.     target.perform_collapse_effect if target.can_collapse?
  3061.     @log_window.wait
  3062.     @log_window.wait_for_effect
  3063.   end
  3064.  
  3065.   #--------------------------------------------------------------------------
  3066.   # overwrite method: show_attack_animation
  3067.   #--------------------------------------------------------------------------
  3068.   def show_attack_animation(targets)
  3069.     show_normal_animation(targets, @subject.atk_animation_id1, false)
  3070.     wait_for_animation
  3071.     show_normal_animation(targets, @subject.atk_animation_id2, true)
  3072.   end
  3073.  
  3074.   #--------------------------------------------------------------------------
  3075.   # overwrite method: show_normal_animation
  3076.   #--------------------------------------------------------------------------
  3077.   def show_normal_animation(targets, animation_id, mirror = false)
  3078.     animation = $data_animations[animation_id]
  3079.     return if animation.nil?
  3080.     ani_check = false
  3081.     targets.each do |target|
  3082.       if ani_check && target.animation_id <= 0
  3083.         target.pseudo_ani_id = animation_id
  3084.       else
  3085.         target.animation_id = animation_id
  3086.       end
  3087.       target.animation_mirror = mirror
  3088.       ani_check = true if animation.to_screen?
  3089.     end
  3090.   end
  3091.  
  3092.   #--------------------------------------------------------------------------
  3093.   # overwrite method: process_action_end
  3094.   #--------------------------------------------------------------------------
  3095.   def process_action_end
  3096.     @subject.on_action_end
  3097.     status_redraw_target(@subject)
  3098.     @log_window.display_auto_affected_status(@subject)
  3099.     @log_window.wait_and_clear
  3100.     @log_window.display_current_state(@subject)
  3101.     @log_window.wait_and_clear
  3102.     BattleManager.judge_win_loss
  3103.   end
  3104.  
  3105.   #--------------------------------------------------------------------------
  3106.   # overwrite method: use_item
  3107.   #--------------------------------------------------------------------------
  3108.   def use_item
  3109.     item = @subject.current_action.item
  3110.     @log_window.display_use_item(@subject, item)
  3111.     @subject.use_item(item)
  3112.     status_redraw_target(@subject)
  3113.     if $imported["YEA-LunaticObjects"]
  3114.       lunatic_object_effect(:before, item, @subject, @subject)
  3115.     end
  3116.     process_casting_animation if $imported["YEA-CastAnimations"]
  3117.     targets = @subject.current_action.make_targets.compact rescue []
  3118.     show_animation(targets, item.animation_id) if show_all_animation?(item)
  3119.     targets.each {|target|
  3120.       if $imported["YEA-TargetManager"]
  3121.         target = alive_random_target(target, item) if item.for_random?
  3122.       end
  3123.       item.repeats.times { invoke_item(target, item) } }
  3124.     if $imported["YEA-LunaticObjects"]
  3125.       lunatic_object_effect(:after, item, @subject, @subject)
  3126.     end
  3127.   end
  3128.  
  3129.   #--------------------------------------------------------------------------
  3130.   # alias method: invoke_item
  3131.   #--------------------------------------------------------------------------
  3132.   alias scene_battle_invoke_item_abe invoke_item
  3133.   def invoke_item(target, item)
  3134.     show_animation([target], item.animation_id) if separate_ani?(target, item)
  3135.     if target.dead? != item.for_dead_friend?
  3136.       @subject.last_target_index = target.index
  3137.       return
  3138.     end
  3139.     scene_battle_invoke_item_abe(target, item)
  3140.   end
  3141.  
  3142.   #--------------------------------------------------------------------------
  3143.   # new method: show_all_animation?
  3144.   #--------------------------------------------------------------------------
  3145.   def show_all_animation?(item)
  3146.     return true if item.one_animation
  3147.     return false if $data_animations[item.animation_id].nil?
  3148.     return false unless $data_animations[item.animation_id].to_screen?
  3149.     return true
  3150.   end
  3151.  
  3152.   #--------------------------------------------------------------------------
  3153.   # new method: separate_ani?
  3154.   #--------------------------------------------------------------------------
  3155.   def separate_ani?(target, item)
  3156.     return false if item.one_animation
  3157.     return false if $data_animations[item.animation_id].nil?
  3158.     return false if $data_animations[item.animation_id].to_screen?
  3159.     return target.dead? == item.for_dead_friend?
  3160.   end
  3161.  
  3162.   #--------------------------------------------------------------------------
  3163.   # new method: status_redraw_target
  3164.   #--------------------------------------------------------------------------
  3165.   def status_redraw_target(target)
  3166.     return unless target.actor?
  3167.     @status_window.draw_item($game_party.battle_members.index(target))
  3168.   end
  3169.  
  3170.   #--------------------------------------------------------------------------
  3171.   # alias method: start_party_command_selection
  3172.   #--------------------------------------------------------------------------
  3173.   alias start_party_command_selection_abe start_party_command_selection
  3174.   def start_party_command_selection
  3175.     @status_window.refresh unless scene_changing?
  3176.     start_party_command_selection_abe
  3177.   end
  3178.  
  3179.   #--------------------------------------------------------------------------
  3180.   # overwrite method: refresh_status
  3181.   #--------------------------------------------------------------------------
  3182.   def refresh_status; return; end
  3183.  
  3184.   #--------------------------------------------------------------------------
  3185.   # new method: refresh_autobattler_status_window
  3186.   #--------------------------------------------------------------------------
  3187.   def refresh_autobattler_status_window
  3188.     for member in $game_party.battle_members
  3189.       next unless member.auto_battle?
  3190.       @status_window.draw_item(member.index)
  3191.     end
  3192.   end
  3193.  
  3194.   #--------------------------------------------------------------------------
  3195.   # new method: hide_extra_gauges
  3196.   #--------------------------------------------------------------------------
  3197.   def hide_extra_gauges
  3198.     # Made for compatibility
  3199.   end
  3200.  
  3201.   #--------------------------------------------------------------------------
  3202.   # new method: show_extra_gauges
  3203.   #--------------------------------------------------------------------------
  3204.   def show_extra_gauges
  3205.     # Made for compatibility
  3206.   end
  3207.  
  3208. end # Scene_Battle
  3209.  
  3210. #==============================================================================
  3211. #
  3212. # �� End of File
  3213. #
  3214. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement