Advertisement
Archeia

Yanfly Engine Ace - Ace Battle Engine v1.22

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