Project1

标题: 战斗显示(脚本) [打印本页]

作者: 144138182    时间: 2014-1-18 22:39
标题: 战斗显示(脚本)
本帖最后由 Sion 于 2014-1-18 23:59 编辑

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

作者: 闇·貘良    时间: 2014-1-18 23:13
无图无真相




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