查看: 1588|回复: 2

[已经解决] 新人Yanfly Engine Ace求教?如何设置脸图个数?

[复制链接]
梦石
0
星屑
50
在线时间
171 小时
注册时间
2013-8-6
回帖
91
发表于 2013-8-24 02:10:17 | 显示全部楼层 |阅读模式

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

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

×
用了大神的Glimmer_LP_v1.03范例参考,增到6个角色到一个队伍,结果出现脸图破格,只能看到4个人(无法选择了),后面2个出窗口了。
新人求教,研究了一晚上看教程和搜索,修改Window_BattleStatus等等无果,真心不是伸手党
估计是要修改脚本Ace Battle Engine v1.19,请大神们帮帮忙,谢谢
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Ace Battle Engine v1.19
  4. # -- Last Updated: 2012.01.29
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

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

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

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

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

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

  407. #==============================================================================
  408. # ■ Switch
  409. #==============================================================================

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

  421. #==============================================================================
  422. # ■ Colour
  423. #==============================================================================

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

  437. #==============================================================================
  438. # ■ Icon
  439. #==============================================================================

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

  448. #==============================================================================
  449. # ■ Numeric
  450. #==============================================================================

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

  461. #==============================================================================
  462. # ■ DataManager
  463. #==============================================================================

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

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

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

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

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

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

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

  588. #==============================================================================
  589. # ■ BattleManager
  590. #==============================================================================

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

  710. #==============================================================================
  711. # ■ Game_System
  712. #==============================================================================

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

  749. #==============================================================================
  750. # ■ Sprite_Base
  751. #==============================================================================

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

  770. #==============================================================================
  771. # ■ Sprite_Battler
  772. #==============================================================================

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

  887. #==============================================================================
  888. # ■ Sprite_Popup
  889. #==============================================================================

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

  996. #==============================================================================
  997. # ■ Spriteset_Battle
  998. #==============================================================================

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

  1038. #==============================================================================
  1039. # ■ Game_Temp
  1040. #==============================================================================

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

  1060. #==============================================================================
  1061. # ■ Game_Action
  1062. #==============================================================================

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

  1087. #==============================================================================
  1088. # ■ Game_ActionResult
  1089. #==============================================================================

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

  1135. #==============================================================================
  1136. # ■ Game_BattlerBase
  1137. #==============================================================================

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

  1334. #==============================================================================
  1335. # ■ Game_Battler
  1336. #==============================================================================

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

  1489. #==============================================================================
  1490. # ■ Game_Actor
  1491. #==============================================================================

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

  1577. #==============================================================================
  1578. # ■ Game_Enemy
  1579. #==============================================================================

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

  1604. #==============================================================================
  1605. # ■ Game_Unit
  1606. #==============================================================================

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

  1628. #==============================================================================
  1629. # ■ Window_PartyCommand
  1630. #==============================================================================

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

  1653. #==============================================================================
  1654. # ■ Window_ActorCommand
  1655. #==============================================================================

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

  1689. #==============================================================================
  1690. # ■ Window_BattleStatus
  1691. #==============================================================================

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

  1878. #==============================================================================
  1879. # ■ Window_BattleActor
  1880. #==============================================================================

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

  1971. #==============================================================================
  1972. # ■ Window_BattleStatusAid
  1973. #==============================================================================

  1974. class Window_BattleStatusAid < Window_BattleStatus
  1975.   
  1976.   #--------------------------------------------------------------------------
  1977.   # public instance variables
  1978.   #--------------------------------------------------------------------------
  1979.   attr_accessor :status_window
  1980.   
  1981.   #--------------------------------------------------------------------------
  1982.   # overwrite method: initialize
  1983.   #--------------------------------------------------------------------------
  1984.   def initialize
  1985.     super
  1986.     self.visible = false
  1987.     self.openness = 255
  1988.   end
  1989.   
  1990.   #--------------------------------------------------------------------------
  1991.   # overwrite method: window_width
  1992.   #--------------------------------------------------------------------------
  1993.   def window_width; return 128; end
  1994.   
  1995.   #--------------------------------------------------------------------------
  1996.   # overwrite method: show
  1997.   #--------------------------------------------------------------------------
  1998.   def show
  1999.     super
  2000.     refresh
  2001.   end
  2002.   
  2003.   #--------------------------------------------------------------------------
  2004.   # overwrite method: refresh
  2005.   #--------------------------------------------------------------------------
  2006.   def refresh
  2007.     contents.clear
  2008.     return if @status_window.nil?
  2009.     draw_item(@status_window.index)
  2010.   end
  2011.   
  2012.   #--------------------------------------------------------------------------
  2013.   # overwrite method: item_rect
  2014.   #--------------------------------------------------------------------------
  2015.   def item_rect(index)
  2016.     return Rect.new(0, 0, contents.width, contents.height)
  2017.   end
  2018.   
  2019. end # Window_BattleStatusAid

  2020. #==============================================================================
  2021. # ■ Window_BattleEnemy
  2022. #==============================================================================

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

  2169. #==============================================================================
  2170. # ■ Window_BattleHelp
  2171. #==============================================================================

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

  2280. #==============================================================================
  2281. # ■ Window_BattleLog
  2282. #==============================================================================

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

  2444. #==============================================================================
  2445. # ■ Window_SkillList
  2446. #==============================================================================

  2447. class Window_SkillList < Window_Selectable
  2448.   
  2449.   #--------------------------------------------------------------------------
  2450.   # overwrite method: spacing
  2451.   #--------------------------------------------------------------------------
  2452.   def spacing
  2453.     return 8 if $game_party.in_battle
  2454.     return super
  2455.   end
  2456.   
  2457. end # Window_SkillList

  2458. #==============================================================================
  2459. # ■ Window_ItemList
  2460. #==============================================================================

  2461. class Window_ItemList < Window_Selectable
  2462.   
  2463.   #--------------------------------------------------------------------------
  2464.   # overwrite method: spacing
  2465.   #--------------------------------------------------------------------------
  2466.   def spacing
  2467.     return 8 if $game_party.in_battle
  2468.     return super
  2469.   end
  2470.   
  2471. end # Window_ItemList

  2472. #==============================================================================
  2473. # ■ Scene_Battle
  2474. #==============================================================================

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

  3095. #==============================================================================
  3096. #
  3097. # ▼ End of File
  3098. #
  3099. #==============================================================================
复制代码
help2.JPG
help.JPG

梦石
1
星屑
23371
在线时间
9572 小时
注册时间
2012-6-19
回帖
7021

开拓者短篇九导演组冠军

发表于 2013-8-24 16:28:22 | 显示全部楼层
回复

使用道具 举报

梦石
1
星屑
23371
在线时间
9572 小时
注册时间
2012-6-19
回帖
7021

开拓者短篇九导演组冠军

发表于 2013-8-24 18:12:16 | 显示全部楼层
新建一个名为“bff 加上角色ID”的文件,和之前的脸图放在同一个目录下
(比如1号角色就是bff1.png)



  1. class Game_Party < Game_Unit
  2.   def max_battle_members
  3.     return 6
  4.   end
  5. end

  6. #==============================================================================
  7. #
  8. # ▼ Yanfly Engine Ace - Ace Battle Engine v1.19
  9. # -- Last Updated: 2012.01.29
  10. # -- Level: Normal, Hard
  11. # -- Requires: n/a
  12. #
  13. #==============================================================================

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

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

  213. module YEA
  214.   module BATTLE

  215.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  216.     # - General Battle Settings -
  217.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  218.     # These settings are adjusted for the overall battle system. These are
  219.     # various miscellaneous options to adjust. Each of the settings below will
  220.     # explain what they do. Change default enemy battle animations here, too.
  221.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  222.     BLINK_EFFECTS      = false  # Blink sprite when damaged?
  223.     FLASH_WHITE_EFFECT = true   # Flash enemy white when it starts an attack.
  224.     SCREEN_SHAKE       = false  # Shake screen in battle?
  225.     SKIP_PARTY_COMMAND = true   # Skips the Fight/Escape menu.
  226.     AUTO_FAST          = true   # Causes message windows to not wait.
  227.     ENEMY_ATK_ANI      = 36     # Sets default attack animation for enemies.

  228.     # If this switch is ON, popups will be hidden. If OFF, the popups will be
  229.     # shown. If you do not wish to use this switch, set it to 0.
  230.     HIDE_POPUP_SWITCH  = 11

  231.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  232.     # - Battle Status Window -
  233.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  234.     # This sets the default battle system your game will use. If your game
  235.     # doesn't have any other battle systems installed, it will use :dtb.
  236.     #
  237.     # Battle System        Requirement
  238.     #   :dtb               - Default Turn Battle. Default system.
  239.     #   :ftb               - YEA Battle System Add-On: Free Turn Battle
  240.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  241.     DEFAULT_BATTLE_SYSTEM = :dtb     # Default battle system set.

  242.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  243.     # - Battle Status Window -
  244.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  245.     # Here, you can adjust the settings for the battle status window. The
  246.     # battle status window, by default, will show the actor's face, HP, MP, TP
  247.     # (if viable), and any inflicted status effects.
  248.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  249.     BATTLESTATUS_NAME_FONT_SIZE = 20    # Font size used for name.
  250.     BATTLESTATUS_TEXT_FONT_SIZE = 20    # Font size used for HP, MP, TP.
  251.     BATTLESTATUS_NO_ACTION_ICON = 185   # No action icon.
  252.     BATTLESTATUS_HPGAUGE_Y_PLUS = 31    # Y Location buffer used for HP gauge.
  253.     BATTLESTATUS_CENTER_FACES   = false # Center faces for the Battle Status.

  254.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  255.     # - Help Window Text -
  256.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  257.     # When selecting a target to attack, this is the text that will be shown
  258.     # in place of a target's name for special cases. These special cases are
  259.     # for selections that were originally non-targetable battle scopes.
  260.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  261.     HELP_TEXT_ALL_FOES        = "敌方全体"
  262.     HELP_TEXT_ONE_RANDOM_FOE  = "敌方随机成员一名"
  263.     HELP_TEXT_MANY_RANDOM_FOE = "敌方随机成员%d名"
  264.     HELP_TEXT_ALL_ALLIES      = "我方全体"
  265.     HELP_TEXT_ALL_DEAD_ALLIES = "我方全体(战斗不能)"
  266.     HELP_TEXT_ONE_RANDOM_ALLY = "我方随机成员一名"
  267.     HELP_TEXT_RANDOM_ALLIES   = "我方随机成员%d名"

  268.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  269.     # - Popup Settings -
  270.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  271.     # These settings will adjust the popups that appear in battle. Popups
  272.     # deliver information to your player as battlers deal damage, inflict
  273.     # status effects, and more.
  274.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  275.     ENABLE_POPUPS  = false#true     # Set this to false if you wish to disable them.
  276.     FLASH_CRITICAL = true     # Sets critical hits to flash.

  277.     # This hash adjusts the popup settings that will govern how popups appear.
  278.     # Adjust them accordingly.
  279.     POPUP_SETTINGS ={
  280.       :offset     => -24,         # Height offset of a popup.
  281.       :fade       => 12,          # Fade rate for each popup.
  282.       :full       => 60,          # Frames before a popup fades.
  283.       :hp_dmg     => "-%s ",      # SprintF for HP damage.
  284.       :hp_heal    => "+%s ",      # SprintF for HP healing.
  285.       :mp_dmg     => "-%s MP",    # SprintF for MP damage.
  286.       :mp_heal    => "+%s MP",    # SprintF for MP healing.
  287.       :tp_dmg     => "-%s TP",    # SprintF for MP damage.
  288.       :tp_heal    => "+%s TP",    # SprintF for MP healing.
  289.       :drained    => "DRAIN",     # Text display for draining HP/MP.
  290.       :critical   => "CRITICAL!", # Text display for critical hit.
  291.       :missed     => "MISS",      # Text display for missed attack.
  292.       :evaded     => "EVADE!",    # Text display for evaded attack.
  293.       :nulled     => "NULL",      # Text display for nulled attack.
  294.       :failed     => "FAILED",    # Text display for a failed attack.
  295.       :add_state  => "+%s",      # SprintF for added states.
  296.       :rem_state  => "-%s",      # SprintF for removed states.
  297.       :dur_state  => "%s",        # SprintF for during states.
  298.       :ele_rates  => true,        # This will display elemental affinities.
  299.       :ele_wait   => 20,          # This is how many frames will wait.
  300.       :weakpoint  => "WEAKPOINT", # Appears if foe is weak to element.
  301.       :resistant  => "RESIST",    # Appears if foe is resistant to element.
  302.       :immune     => "IMMUNE",    # Appears if foe is immune to element.
  303.       :absorbed   => "ABSORB",    # Appears if foe can absorb the element.
  304.       :add_buff   => "%s+",      # Appears when a positive buff is applied.
  305.       :add_debuff => "%s-",      # Appears when a negative buff is applied.
  306.     } # Do not remove this.

  307.     # This is the default font used for the popups. Adjust them accordingly
  308.     # or even add new ones.
  309.     DEFAULT = ["Microsoft Yahei","微软雅黑","黑体", "VL Gothic", "Verdana", "Arial", "Courier"]
  310. #~  
  311.     # The following are the various rules that govern the individual popup
  312.     # types that will appear. Adjust them accordingly. Here is a list of what
  313.     # each category does.
  314.     #   Zoom1    The zoom the popup starts at. Values over 2.0 may cause lag.
  315.     #   Zoom2    The zoom the popup goes to. Values over 2.0 may cause lag.
  316.     #   Sz       The font size used for the popup text.
  317.     #   Bold     Applying bold for the popup text.
  318.     #   Italic   Applying italic for the popup text.
  319.     #   Red      The red value of the popup text.
  320.     #   Grn      The green value of the popup text.
  321.     #   Blu      The blue value of the popup text.
  322.     #   Font     The font used for the popup text.
  323.     POPUP_RULES ={
  324.       # Type     => [ Zoom1, Zoom2, Sz, Bold, Italic, Red, Grn, Blu, Font]
  325.       "DEFAULT"  => [   2.0,   1.0, 24, true,  false, 255, 255, 255, DEFAULT],
  326.       "CRITICAL" => [   2.0,   1.0, 24, true,  false, 255,  80,  80, DEFAULT],
  327.       "HP_DMG"   => [   2.0,   1.0, 36, true,  false, 255, 255, 255, DEFAULT],
  328.       "HP_HEAL"  => [   2.0,   1.0, 36, true,  false, 130, 250, 130, DEFAULT],
  329.       "MP_DMG"   => [   2.0,   1.0, 36, true,  false, 220, 180, 255, DEFAULT],
  330.       "MP_HEAL"  => [   2.0,   1.0, 36, true,  false, 160, 230, 255, DEFAULT],
  331.       "TP_DMG"   => [   2.0,   1.0, 36, true,  false, 242, 108,  78, DEFAULT],
  332.       "TP_HEAL"  => [   2.0,   1.0, 36, true,  false, 251, 175,  92, DEFAULT],
  333.       "ADDSTATE" => [   2.0,   1.0, 24, true,  false, 240, 100, 100, DEFAULT],
  334.       "REMSTATE" => [   2.0,   1.0, 24, true,  false, 125, 170, 225, DEFAULT],
  335.       "DURSTATE" => [   2.0,   1.0, 24, true,  false, 255, 240, 150, DEFAULT],
  336.       "DRAIN"    => [   2.0,   1.0, 36, true,  false, 250, 190, 255, DEFAULT],
  337.       "POSITIVE" => [   2.0,   1.0, 24, true,  false, 110, 210, 245, DEFAULT],
  338.       "NEGATIVE" => [   2.0,   1.0, 24, true,  false, 245, 155, 195, DEFAULT],
  339.       "WEAK_ELE" => [   0.5,   1.0, 24, true,  false, 240, 110,  80, DEFAULT],
  340.       "IMMU_ELE" => [   0.5,   1.0, 24, true,  false, 185, 235, 255, DEFAULT],
  341.       "REST_ELE" => [   0.5,   1.0, 24, true,  false, 145, 230, 180, DEFAULT],
  342.       "ABSB_ELE" => [   0.5,   1.0, 24, true,  false, 250, 190, 255, DEFAULT],
  343.       "BUFF"     => [   2.0,   1.0, 24, true,  false, 255, 240, 100, DEFAULT],
  344.       "DEBUFF"   => [   2.0,   1.0, 24, true,  false, 160, 130, 200, DEFAULT],
  345.     } # Do not remove this.

  346.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  347.     # - Streamlined Messages -
  348.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  349.     # Want to remove some of those annoying messages that appear all the time?
  350.     # Now you can! Select which messages you want to enable or disable. Some of
  351.     # these messages will be rendered useless due to popups.
  352.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  353.     MSG_ENEMY_APPEARS  = false  # Message when enemy appears start of battle.
  354.     MSG_CURRENT_STATE  = false  # Show which states has affected battler.
  355.     MSG_CURRENT_ACTION = true   # Show the current action of the battler.
  356.     MSG_COUNTERATTACK  = true   # Show the message for a counterattack.
  357.     MSG_REFLECT_MAGIC  = true   # Show message for reflecting magic attacks.
  358.     MSG_SUBSTITUTE_HIT = true   # Show message for ally taking another's hit.
  359.     MSG_FAILURE_HIT    = false  # Show effect failed against target.
  360.     MSG_CRITICAL_HIT   = false  # Show attack was a critical hit.
  361.     MSG_HIT_MISSED     = false  # Show attack missed the target.
  362.     MSG_EVASION        = false  # Show attack was evaded by the target.
  363.     MSG_HP_DAMAGE      = false  # Show HP damage to target.
  364.     MSG_MP_DAMAGE      = false  # Show MP damage to target.
  365.     MSG_TP_DAMAGE      = false  # Show TP damage to target.
  366.     MSG_ADDED_STATES   = false  # Show target's added states.
  367.     MSG_REMOVED_STATES = false  # Show target's removed states.
  368.     MSG_CHANGED_BUFFS  = false  # Show target's changed buffs.

  369.   end # BATTLE
  370. end # YEA

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

  376. module YEA
  377.   module REGEXP
  378.   module ENEMY

  379.     ATK_ANI1 = /<(?:ATK_ANI_1|atk ani 1):[ ]*(\d+)>/i
  380.     ATK_ANI2 = /<(?:ATK_ANI_2|atk ani 2):[ ]*(\d+)>/i

  381.   end # ENEMY
  382.   module USABLEITEM

  383.     ONE_ANIMATION = /<(?:ONE_ANIMATION|one animation)>/i

  384.   end # USABLEITEM
  385.   module STATE

  386.     POPUP_ADD = /<(?:POPUP_ADD_RULE|popup add rule|popup add):[ ](.*)>/i
  387.     POPUP_REM = /<(?:POPUP_REM_RULE|popup rem rule|popup rem):[ ](.*)>/i
  388.     POPUP_DUR = /<(?:POPUP_DUR_RULE|popup dur rule|popup dur):[ ](.*)>/i

  389.     HIDE_ADD  = /<(?:POPUP_HIDE_ADD|popup hide add|hide add)>/i
  390.     HIDE_REM  = /<(?:POPUP_HIDE_REM|popup hide rem|hide rem)>/i
  391.     HIDE_DUR  = /<(?:POPUP_HIDE_DUR|popup hide dur|hide dur)>/i

  392.   end # STATE
  393.   end # REGEXP
  394. end # YEA

  395. #==============================================================================
  396. # ■ Switch
  397. #==============================================================================

  398. module Switch

  399.   #--------------------------------------------------------------------------
  400.   # self.hide_popups
  401.   #--------------------------------------------------------------------------
  402.   def self.hide_popups
  403.     return false if YEA::BATTLE::HIDE_POPUP_SWITCH <= 0
  404.     return $game_switches[YEA::BATTLE::HIDE_POPUP_SWITCH]
  405.   end

  406. end # Switch

  407. #==============================================================================
  408. # ■ Colour
  409. #==============================================================================

  410. module Colour

  411.   #--------------------------------------------------------------------------
  412.   # self.text_colour
  413.   #--------------------------------------------------------------------------
  414.   def self.text_colour(index)
  415.     windowskin = Cache.system("Window")
  416.     x = 64 + (index % 8) * 8
  417.     y = 96 + (index / 8) * 8
  418.     return windowskin.get_pixel(x, y)
  419.   end

  420. end # Colour

  421. #==============================================================================
  422. # ■ Icon
  423. #==============================================================================

  424. module Icon

  425.   #--------------------------------------------------------------------------
  426.   # self.no_action
  427.   #--------------------------------------------------------------------------
  428.   def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end

  429. end # Icon

  430. #==============================================================================
  431. # ■ Numeric
  432. #==============================================================================

  433. class Numeric

  434.   #--------------------------------------------------------------------------
  435.   # new method: group_digits
  436.   #--------------------------------------------------------------------------
  437.   unless $imported["YEA-CoreEngine"]
  438.   def group; return self.to_s; end
  439.   end # $imported["YEA-CoreEngine"]

  440. end # Numeric

  441. #==============================================================================
  442. # ■ DataManager
  443. #==============================================================================

  444. module DataManager

  445.   #--------------------------------------------------------------------------
  446.   # alias method: load_database
  447.   #--------------------------------------------------------------------------
  448.   class <<self; alias load_database_abe load_database; end
  449.   def self.load_database
  450.     load_database_abe
  451.     load_notetags_abe
  452.   end

  453.   #--------------------------------------------------------------------------
  454.   # new method: load_notetags_abe
  455.   #--------------------------------------------------------------------------
  456.   def self.load_notetags_abe
  457.     groups = [$data_enemies, $data_states, $data_skills, $data_items]
  458.     for group in groups
  459.       for obj in group
  460.         next if obj.nil?
  461.         obj.load_notetags_abe
  462.       end
  463.     end
  464.   end

  465. end # DataManager

  466. #==============================================================================
  467. # ■ RPG::UsableItem
  468. #==============================================================================

  469. class RPG::UsableItem < RPG::BaseItem

  470.   #--------------------------------------------------------------------------
  471.   # public instance variables
  472.   #--------------------------------------------------------------------------
  473.   attr_accessor :one_animation

  474.   #--------------------------------------------------------------------------
  475.   # common cache: load_notetags_abe
  476.   #--------------------------------------------------------------------------
  477.   def load_notetags_abe
  478.     @one_animation = false
  479.     #---
  480.     self.note.split(/[\r\n]+/).each { |line|
  481.       case line
  482.       #---
  483.       when YEA::REGEXP::USABLEITEM::ONE_ANIMATION
  484.         @one_animation = true
  485.       end
  486.     } # self.note.split
  487.     #---
  488.   end

  489. end # RPG::UsableItem

  490. #==============================================================================
  491. # ■ RPG::Enemy
  492. #==============================================================================

  493. class RPG::Enemy < RPG::BaseItem

  494.   #--------------------------------------------------------------------------
  495.   # public instance variables
  496.   #--------------------------------------------------------------------------
  497.   attr_accessor :atk_animation_id1
  498.   attr_accessor :atk_animation_id2

  499.   #--------------------------------------------------------------------------
  500.   # common cache: load_notetags_abe
  501.   #--------------------------------------------------------------------------
  502.   def load_notetags_abe
  503.     @atk_animation_id1 = YEA::BATTLE::ENEMY_ATK_ANI
  504.     @atk_animation_id2 = 0
  505.     #---
  506.     self.note.split(/[\r\n]+/).each { |line|
  507.       case line
  508.       #---
  509.       when YEA::REGEXP::ENEMY::ATK_ANI1
  510.         @atk_animation_id1 = $1.to_i
  511.       when YEA::REGEXP::ENEMY::ATK_ANI2
  512.         @atk_animation_id2 = $1.to_i
  513.       end
  514.     } # self.note.split
  515.     #---
  516.   end

  517. end # RPG::Enemy

  518. #==============================================================================
  519. # ■ RPG::Enemy
  520. #==============================================================================

  521. class RPG::State < RPG::BaseItem

  522.   #--------------------------------------------------------------------------
  523.   # public instance variables
  524.   #--------------------------------------------------------------------------
  525.   attr_accessor :popup_rules

  526.   #--------------------------------------------------------------------------
  527.   # common cache: load_notetags_abe
  528.   #--------------------------------------------------------------------------
  529.   def load_notetags_abe
  530.     @popup_rules = {
  531.       :add_state => "ADDSTATE",
  532.       :rem_state => "REMSTATE",
  533.       :dur_state => nil
  534.     } # Do not remove this.
  535.     #---
  536.     self.note.split(/[\r\n]+/).each { |line|
  537.       case line
  538.       #---
  539.       when YEA::REGEXP::STATE::POPUP_ADD
  540.         @popup_rules[:add_state] = $1.upcase.to_s
  541.       when YEA::REGEXP::STATE::POPUP_REM
  542.         @popup_rules[:rem_state] = $1.upcase.to_s
  543.       when YEA::REGEXP::STATE::POPUP_DUR
  544.         @popup_rules[:dur_state] = $1.upcase.to_s
  545.       when YEA::REGEXP::STATE::HIDE_ADD
  546.         @popup_rules[:add_state] = nil
  547.       when YEA::REGEXP::STATE::HIDE_REM
  548.         @popup_rules[:rem_state] = nil
  549.       when YEA::REGEXP::STATE::HIDE_DUR
  550.         @popup_rules[:dur_state] = nil
  551.       end
  552.     } # self.note.split
  553.     #---
  554.   end

  555. end # RPG::State

  556. #==============================================================================
  557. # ■ BattleManager
  558. #==============================================================================

  559. module BattleManager

  560.   #--------------------------------------------------------------------------
  561.   # overwrite method: self.battle_start
  562.   #--------------------------------------------------------------------------
  563.   def self.battle_start
  564.     $game_system.battle_count += 1
  565.     $game_party.on_battle_start
  566.     $game_troop.on_battle_start
  567.     return unless YEA::BATTLE::MSG_ENEMY_APPEARS
  568.     $game_troop.enemy_names.each do |name|
  569.       $game_message.add(sprintf(Vocab::Emerge, name))
  570.     end
  571.     if @preemptive
  572.       $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
  573.     elsif @surprise
  574.       $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
  575.     end
  576.     wait_for_message
  577.   end

  578.   #--------------------------------------------------------------------------
  579.   # overwrite method: make_action_orders
  580.   #--------------------------------------------------------------------------
  581.   def self.make_action_orders
  582.     make_dtb_action_orders if btype?(:dtb)
  583.   end

  584.   #--------------------------------------------------------------------------
  585.   # new method: make_dtb_action_orders
  586.   #--------------------------------------------------------------------------
  587.   def self.make_dtb_action_orders
  588.     @action_battlers = []
  589.     @action_battlers += $game_party.members unless @surprise
  590.     @action_battlers += $game_troop.members unless @preemptive
  591.     @action_battlers.each {|battler| battler.make_speed }
  592.     @action_battlers.sort! {|a,b| b.speed - a.speed }
  593.   end

  594.   #--------------------------------------------------------------------------
  595.   # overwrite method: turn_start
  596.   #--------------------------------------------------------------------------
  597.   def self.turn_start
  598.     @phase = :turn
  599.     clear_actor
  600.     $game_troop.increase_turn
  601.     @performed_battlers = []
  602.     make_action_orders
  603.   end

  604.   #--------------------------------------------------------------------------
  605.   # overwrite method: next_subject
  606.   #--------------------------------------------------------------------------
  607.   def self.next_subject
  608.     @performed_battlers = [] if @performed_battlers.nil?
  609.     loop do
  610.       @action_battlers -= @performed_battlers
  611.       battler = @action_battlers.shift
  612.       return nil unless battler
  613.       next unless battler.index && battler.alive?
  614.       @performed_battlers.push(battler)
  615.       return battler
  616.     end
  617.   end

  618.   #--------------------------------------------------------------------------
  619.   # overwrite method: force_action
  620.   #--------------------------------------------------------------------------
  621.   def self.force_action(battler)
  622.     @action_forced = [] if @action_forced == nil
  623.     @action_forced.push(battler)
  624.     return unless Switch.forced_action_remove
  625.     @action_battlers.delete(battler)
  626.   end

  627.   #--------------------------------------------------------------------------
  628.   # overwrite method: action_forced?
  629.   #--------------------------------------------------------------------------
  630.   def self.action_forced?
  631.     @action_forced != nil
  632.   end

  633.   #--------------------------------------------------------------------------
  634.   # overwrite method: action_forced_battler
  635.   #--------------------------------------------------------------------------
  636.   def self.action_forced_battler
  637.     @action_forced.shift
  638.   end

  639.   #--------------------------------------------------------------------------
  640.   # overwrite method: clear_action_force
  641.   #--------------------------------------------------------------------------
  642.   def self.clear_action_force
  643.     return if @action_forced.nil?
  644.     @action_forced = nil if @action_forced.empty?
  645.   end

  646.   #--------------------------------------------------------------------------
  647.   # new method: self.init_battle_type
  648.   #--------------------------------------------------------------------------
  649.   def self.init_battle_type
  650.     set_btype($game_system.battle_system)
  651.   end

  652.   #--------------------------------------------------------------------------
  653.   # new method: self.set_btype
  654.   #--------------------------------------------------------------------------
  655.   def self.set_btype(btype = :dtb)
  656.     @battle_type = btype
  657.   end

  658.   #--------------------------------------------------------------------------
  659.   # new method: self.btype?
  660.   #--------------------------------------------------------------------------
  661.   def self.btype?(btype)
  662.     return @battle_type == btype
  663.   end

  664. end # BattleManager

  665. #==============================================================================
  666. # ■ Game_System
  667. #==============================================================================

  668. class Game_System

  669.   #--------------------------------------------------------------------------
  670.   # new method: battle_system
  671.   #--------------------------------------------------------------------------
  672.   def battle_system
  673.     if @battle_system.nil?
  674.       return battle_system_corrected(YEA::BATTLE::DEFAULT_BATTLE_SYSTEM)
  675.     else
  676.       return battle_system_corrected(@battle_system)
  677.     end
  678.   end

  679.   #--------------------------------------------------------------------------
  680.   # new method: set_battle_system
  681.   #--------------------------------------------------------------------------
  682.   def set_battle_system(type)
  683.     case type
  684.     when :dtb; @battle_system = :dtb
  685.     when :ftb; @battle_system = $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  686.     else;      @battle_system = :dtb
  687.     end
  688.   end

  689.   #--------------------------------------------------------------------------
  690.   # new method: battle_system_corrected
  691.   #--------------------------------------------------------------------------
  692.   def battle_system_corrected(type)
  693.     case type
  694.     when :dtb; return :dtb
  695.     when :ftb; return $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  696.     else;      return :dtb
  697.     end
  698.   end

  699. end # Game_System

  700. #==============================================================================
  701. # ■ Sprite_Base
  702. #==============================================================================

  703. class Sprite_Base < Sprite

  704.   #--------------------------------------------------------------------------
  705.   # new method: start_pseudo_animation
  706.   #--------------------------------------------------------------------------
  707.   unless $imported["YEA-CoreEngine"]
  708.   def start_pseudo_animation(animation, mirror = false)
  709.     dispose_animation
  710.     @animation = animation
  711.     return if @animation.nil?
  712.     @ani_mirror = mirror
  713.     set_animation_rate
  714.     @ani_duration = @animation.frame_max * @ani_rate + 1
  715.     @ani_sprites = []
  716.   end
  717.   end # $imported["YEA-CoreEngine"]

  718. end # Sprite_Base

  719. #==============================================================================
  720. # ■ Sprite_Battler
  721. #==============================================================================

  722. class Sprite_Battler < Sprite_Base

  723.   #--------------------------------------------------------------------------
  724.   # public instance variables
  725.   #--------------------------------------------------------------------------
  726.   attr_accessor :effect_type
  727.   attr_accessor :battler_visible
  728.   attr_accessor :popups

  729.   #--------------------------------------------------------------------------
  730.   # alias method: initialize
  731.   #--------------------------------------------------------------------------
  732.   alias sprite_battler_initialize_abe initialize
  733.   def initialize(viewport, battler = nil)
  734.     sprite_battler_initialize_abe(viewport, battler)
  735.     @popups = []
  736.     @popup_flags = []
  737.   end

  738.   #--------------------------------------------------------------------------
  739.   # alias method: update_bitmap
  740.   #--------------------------------------------------------------------------
  741.   alias sprite_battler_update_bitmap_abe update_bitmap
  742.   def update_bitmap
  743.     return if @battler.actor? && @battler.battler_name == ""
  744.     sprite_battler_update_bitmap_abe
  745.   end

  746.   #--------------------------------------------------------------------------
  747.   # alias method: setup_new_animation
  748.   #--------------------------------------------------------------------------
  749.   unless $imported["YEA-CoreEngine"]
  750.   alias sprite_battler_setup_new_animation_abe setup_new_animation
  751.   def setup_new_animation
  752.     sprite_battler_setup_new_animation_abe
  753.     return if @battler.pseudo_ani_id <= 0
  754.     animation = $data_animations[@battler.pseudo_ani_id]
  755.     mirror = @battler.animation_mirror
  756.     start_pseudo_animation(animation, mirror)
  757.     @battler.pseudo_ani_id = 0
  758.   end
  759.   end # $imported["YEA-CoreEngine"]

  760.   #--------------------------------------------------------------------------
  761.   # alias method: setup_new_effect
  762.   #--------------------------------------------------------------------------
  763.   alias sprite_battler_setup_new_effect_abe setup_new_effect
  764.   def setup_new_effect
  765.     sprite_battler_setup_new_effect_abe
  766.     setup_popups
  767.   end

  768.   #--------------------------------------------------------------------------
  769.   # new method: setup_popups
  770.   #--------------------------------------------------------------------------
  771.   def setup_popups
  772.     return unless @battler.use_sprite?
  773.     @battler.popups = [] if @battler.popups.nil?
  774.     return if @battler.popups == []
  775.     array = @battler.popups.shift
  776.     create_new_popup(array[0], array[1], array[2])
  777.   end

  778.   #--------------------------------------------------------------------------
  779.   # new method: create_new_popup
  780.   #--------------------------------------------------------------------------
  781.   def create_new_popup(value, rules, flags)
  782.     return if [url=home.php?mod=space&uid=133701]@battler[/url] == nil
  783.     return if flags & @popup_flags != []
  784.     array = YEA::BATTLE::POPUP_RULES[rules]
  785.     for popup in @popups
  786.       popup.y -= 24
  787.     end
  788.     return unless SceneManager.scene.is_a?(Scene_Battle)
  789.     return if SceneManager.scene.spriteset.nil?
  790.     view = SceneManager.scene.spriteset.viewportPopups
  791.     new_popup = Sprite_Popup.new(view, @battler, value, rules, flags)
  792.     @popups.push(new_popup)
  793.     @popup_flags.push("weakness") if flags.include?("weakness")
  794.     @popup_flags.push("resistant") if flags.include?("resistant")
  795.     @popup_flags.push("immune") if flags.include?("immune")
  796.     @popup_flags.push("absorbed") if flags.include?("absorbed")
  797.   end

  798.   #--------------------------------------------------------------------------
  799.   # alias method: update_effect
  800.   #--------------------------------------------------------------------------
  801.   alias sprite_battler_update_effect_abe update_effect
  802.   def update_effect
  803.     sprite_battler_update_effect_abe
  804.     update_popups
  805.   end

  806.   #--------------------------------------------------------------------------
  807.   # new method: update_popups
  808.   #--------------------------------------------------------------------------
  809.   def update_popups
  810.     for popup in @popups
  811.       popup.update
  812.       next unless popup.opacity <= 0
  813.       popup.bitmap.dispose
  814.       popup.dispose
  815.       @popups.delete(popup)
  816.       popup = nil
  817.     end
  818.     @popup_flags = [] if @popups == [] && @popup_flags != []
  819.     return unless SceneManager.scene_is?(Scene_Battle)
  820.     if @current_active_battler != SceneManager.scene.subject
  821.       @current_active_battler = SceneManager.scene.subject
  822.       @popup_flags = []
  823.     end
  824.   end

  825. end # Sprite_Battler

  826. #==============================================================================
  827. # ■ Sprite_Popup
  828. #==============================================================================

  829. class Sprite_Popup < Sprite_Base

  830.   #--------------------------------------------------------------------------
  831.   # public instance variables
  832.   #--------------------------------------------------------------------------
  833.   attr_accessor :flags

  834.   #--------------------------------------------------------------------------
  835.   # initialize
  836.   #--------------------------------------------------------------------------
  837.   def initialize(viewport, battler, value, rules, flags)
  838.     super(viewport)
  839.     @value = value
  840.     @rules = rules
  841.     @rules = "DEFAULT" unless YEA::BATTLE::POPUP_RULES.include?(@rules)
  842.     [url=home.php?mod=space&uid=274289]@fade[/url] = YEA::BATTLE::POPUP_SETTINGS[:fade]
  843.     @full = YEA::BATTLE::POPUP_SETTINGS[:full]
  844.     @flags = flags
  845.     @battler = battler
  846.     create_popup_bitmap
  847.   end

  848.   #--------------------------------------------------------------------------
  849.   # create_popup_bitmap
  850.   #--------------------------------------------------------------------------
  851.   def create_popup_bitmap
  852.     rules_array = YEA::BATTLE::POPUP_RULES[@rules]
  853.     bw = Graphics.width
  854.     bw += 48 if @flags.include?("state")
  855.     bh = Font.default_size * 3
  856.     bitmap = Bitmap.new(bw, bh)
  857.     bitmap.font.name = rules_array[8]
  858.     size = @flags.include?("critical") ? rules_array[2] * 1.2 : rules_array[2]
  859.     bitmap.font.size = size
  860.     bitmap.font.bold = rules_array[3]
  861.     bitmap.font.italic = rules_array[4]
  862.     if flags.include?("critical")
  863.       crit = YEA::BATTLE::POPUP_RULES["CRITICAL"]
  864.       bitmap.font.out_color.set(crit[5], crit[6], crit[7], 255)
  865.     else
  866.       bitmap.font.out_color.set(0, 0, 0, 255)
  867.     end
  868.     dx = 0; dy = 0; dw = 0
  869.     dx += 24 if @flags.include?("state")
  870.     dw += 24 if @flags.include?("state")
  871.     if @flags.include?("state") || @flags.include?("buff")
  872.       c_width = bitmap.text_size(@value).width
  873.       icon_bitmap = $game_temp.iconset
  874.       icon_index = flag_state_icon
  875.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  876.       bitmap.blt(dx+(bw-c_width)/2-36, (bh - 24)/2, icon_bitmap, rect, 255)
  877.     end
  878.     bitmap.font.color.set(rules_array[5], rules_array[6], rules_array[7])
  879.     bitmap.draw_text(dx, dy, bw-dw, bh, @value, 1)
  880.     self.bitmap = bitmap
  881.     self.x = @battler.screen_x
  882.     self.x += rand(4) - rand(4) if @battler.sprite.popups.size >= 1
  883.     self.x -= SceneManager.scene.spriteset.viewport1.ox
  884.     self.y = @battler.screen_y - @battler.sprite.oy/2
  885.     self.y -= @battler.sprite.oy/2 if @battler.actor?
  886.     self.y -= SceneManager.scene.spriteset.viewport1.oy
  887.     self.ox = bw/2; self.oy = bh/2
  888.     self.zoom_x = self.zoom_y = rules_array[0]
  889.     if @flags.include?("no zoom")
  890.       self.zoom_x = self.zoom_y = rules_array[1]
  891.     end
  892.     @target_zoom = rules_array[1]
  893.     @zoom_direction = (self.zoom_x > @target_zoom) ? "down" : "up"
  894.     self.z = 500
  895.   end

  896.   #--------------------------------------------------------------------------
  897.   # update
  898.   #--------------------------------------------------------------------------
  899.   def update
  900.     super
  901.     #---
  902.     if @flags.include?("critical") && YEA::BATTLE::FLASH_CRITICAL
  903.       @hue_duration = 2 if @hue_duration == nil || @hue_duration == 0
  904.       @hue_duration -= 1
  905.       self.bitmap.hue_change(15) if @hue_duration <= 0
  906.     end
  907.     #---
  908.     if @zoom_direction == "up"
  909.       self.zoom_x = [self.zoom_x + 0.075, @target_zoom].min
  910.       self.zoom_y = [self.zoom_y + 0.075, @target_zoom].min
  911.     else
  912.       self.zoom_x = [self.zoom_x - 0.075, @target_zoom].max
  913.       self.zoom_y = [self.zoom_y - 0.075, @target_zoom].max
  914.     end
  915.     #---
  916.     @full -= 1
  917.     return if @full > 0
  918.     self.y -= 1
  919.     self.opacity -= @fade
  920.   end

  921.   #--------------------------------------------------------------------------
  922.   # flag_state_icon
  923.   #--------------------------------------------------------------------------
  924.   def flag_state_icon
  925.     for item in @flags; return item if item.is_a?(Integer); end
  926.     return 0
  927.   end

  928. end # Sprite_Popup

  929. #==============================================================================
  930. # ■ Spriteset_Battle
  931. #==============================================================================

  932. class Spriteset_Battle

  933.   #--------------------------------------------------------------------------
  934.   # public instance variables
  935.   #--------------------------------------------------------------------------
  936.   attr_accessor :actor_sprites
  937.   attr_accessor :enemy_sprites
  938.   attr_accessor :viewport1
  939.   attr_accessor :viewportPopups

  940.   #--------------------------------------------------------------------------
  941.   # alias method: create_viewports
  942.   #--------------------------------------------------------------------------
  943.   alias spriteset_battle_create_viewports_abe create_viewports
  944.   def create_viewports
  945.     spriteset_battle_create_viewports_abe
  946.     @viewportPopups = Viewport.new
  947.     @viewportPopups.z = 200
  948.   end

  949.   #--------------------------------------------------------------------------
  950.   # alias method: dispose_viewports
  951.   #--------------------------------------------------------------------------
  952.   alias spriteset_battle_dispose_viewports_abe dispose_viewports
  953.   def dispose_viewports
  954.     spriteset_battle_dispose_viewports_abe
  955.     @viewportPopups.dispose
  956.   end

  957.   #--------------------------------------------------------------------------
  958.   # alias method: update_viewports
  959.   #--------------------------------------------------------------------------
  960.   alias spriteset_battle_update_viewports_abe update_viewports
  961.   def update_viewports
  962.     spriteset_battle_update_viewports_abe
  963.     @viewportPopups.update
  964.   end

  965. end # Spriteset_Battle

  966. #==============================================================================
  967. # ■ Game_Temp
  968. #==============================================================================

  969. class Game_Temp

  970.   #--------------------------------------------------------------------------
  971.   # public instance variables
  972.   #--------------------------------------------------------------------------
  973.   attr_accessor :battle_aid
  974.   attr_accessor :evaluating
  975.   attr_accessor :iconset

  976.   #--------------------------------------------------------------------------
  977.   # alias method: initialize
  978.   #--------------------------------------------------------------------------
  979.   alias game_temp_initialize_abe initialize
  980.   def initialize
  981.     game_temp_initialize_abe
  982.     @iconset = Cache.system("Iconset")
  983.   end

  984. end # Game_Temp

  985. #==============================================================================
  986. # ■ Game_Action
  987. #==============================================================================

  988. class Game_Action

  989.   #--------------------------------------------------------------------------
  990.   # overwrite method: speed
  991.   #--------------------------------------------------------------------------
  992.   def speed
  993.     speed = subject.agi
  994.     speed += item.speed if item
  995.     speed += subject.atk_speed if attack?
  996.     return speed
  997.   end

  998.   #--------------------------------------------------------------------------
  999.   # alias method: evaluate_item_with_target
  1000.   #--------------------------------------------------------------------------
  1001.   alias evaluate_item_with_target_abe evaluate_item_with_target
  1002.   def evaluate_item_with_target(target)
  1003.     $game_temp.evaluating = true
  1004.     result = evaluate_item_with_target_abe(target)
  1005.     $game_temp.evaluating = false
  1006.     return result
  1007.   end

  1008. end # Game_Action

  1009. #==============================================================================
  1010. # ■ Game_ActionResult
  1011. #==============================================================================

  1012. class Game_ActionResult

  1013.   #--------------------------------------------------------------------------
  1014.   # alias method: clear
  1015.   #--------------------------------------------------------------------------
  1016.   alias game_actionresult_clear_abe clear
  1017.   def clear
  1018.     game_actionresult_clear_abe
  1019.     clear_stored_damage
  1020.   end

  1021.   #--------------------------------------------------------------------------
  1022.   # new method: clear_stored_damage
  1023.   #--------------------------------------------------------------------------
  1024.   def clear_stored_damage
  1025.     @stored_hp_damage = 0
  1026.     @stored_mp_damage = 0
  1027.     @stored_tp_damage = 0
  1028.     @stored_hp_drain = 0
  1029.     @stored_mp_drain = 0
  1030.   end

  1031.   #--------------------------------------------------------------------------
  1032.   # new method: store_damage
  1033.   #--------------------------------------------------------------------------
  1034.   def store_damage
  1035.     @stored_hp_damage += @hp_damage
  1036.     @stored_mp_damage += @mp_damage
  1037.     @stored_tp_damage += @tp_damage
  1038.     @stored_hp_drain += @hp_drain
  1039.     @stored_mp_drain += @mp_drain
  1040.   end

  1041.   #--------------------------------------------------------------------------
  1042.   # new method: restore_damage
  1043.   #--------------------------------------------------------------------------
  1044.   def restore_damage
  1045.     @hp_damage = @stored_hp_damage
  1046.     @mp_damage = @stored_mp_damage
  1047.     @tp_damage = @stored_tp_damage
  1048.     @hp_drain = @stored_hp_drain
  1049.     @mp_drain = @stored_mp_drain
  1050.   end

  1051. end # Game_ActionResult

  1052. #==============================================================================
  1053. # ■ Game_BattlerBase
  1054. #==============================================================================

  1055. class Game_BattlerBase

  1056.   #--------------------------------------------------------------------------
  1057.   # public instance variables
  1058.   #--------------------------------------------------------------------------
  1059.   attr_accessor :popups

  1060.   #--------------------------------------------------------------------------
  1061.   # new method: create_popup
  1062.   #--------------------------------------------------------------------------
  1063.   def create_popup(value, rules = "DEFAULT", flags = [])
  1064.     return unless SceneManager.scene_is?(Scene_Battle)
  1065.     return unless YEA::BATTLE::ENABLE_POPUPS
  1066.     return if Switch.hide_popups
  1067.     @popups = [] if @popups.nil?
  1068.     @popups.push([value, rules, flags])
  1069.   end

  1070.   #--------------------------------------------------------------------------
  1071.   # new method: make_damage_popups
  1072.   #--------------------------------------------------------------------------
  1073.   def make_damage_popups(user)
  1074.     if @result.hp_drain != 0
  1075.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  1076.       rules = "DRAIN"
  1077.       user.create_popup(text, rules)
  1078.       setting = :hp_dmg  if @result.hp_drain < 0
  1079.       setting = :hp_heal if @result.hp_drain > 0
  1080.       rules = "HP_DMG"   if @result.hp_drain < 0
  1081.       rules = "HP_HEAL"  if @result.hp_drain > 0
  1082.       value = @result.hp_drain.abs
  1083.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1084.       user.create_popup(text, rules)
  1085.     end
  1086.     if @result.mp_drain != 0
  1087.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  1088.       rules = "DRAIN"
  1089.       user.create_popup(text, rules)
  1090.       setting = :mp_dmg  if @result.mp_drain < 0
  1091.       setting = :mp_heal if @result.mp_drain > 0
  1092.       rules = "HP_DMG"   if @result.mp_drain < 0
  1093.       rules = "HP_HEAL"  if @result.mp_drain > 0
  1094.       value = @result.mp_drain.abs
  1095.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1096.       user.create_popup(text, rules)
  1097.     end
  1098.     #---
  1099.     flags = []
  1100.     flags.push("critical") if @result.critical
  1101.     if @result.hp_damage != 0
  1102.       setting = :hp_dmg  if @result.hp_damage > 0
  1103.       setting = :hp_heal if @result.hp_damage < 0
  1104.       rules = "HP_DMG"   if @result.hp_damage > 0
  1105.       rules = "HP_HEAL"  if @result.hp_damage < 0
  1106.       value = @result.hp_damage.abs
  1107.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1108.       create_popup(text, rules, flags)
  1109.     end
  1110.     if @result.mp_damage != 0
  1111.       setting = :mp_dmg  if @result.mp_damage > 0
  1112.       setting = :mp_heal if @result.mp_damage < 0
  1113.       rules = "MP_DMG"   if @result.mp_damage > 0
  1114.       rules = "MP_HEAL"  if @result.mp_damage < 0
  1115.       value = @result.mp_damage.abs
  1116.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1117.       create_popup(text, rules, flags)
  1118.     end
  1119.     if @result.tp_damage != 0
  1120.       setting = :tp_dmg  if @result.tp_damage > 0
  1121.       setting = :tp_heal if @result.tp_damage < 0
  1122.       rules = "TP_DMG"   if @result.tp_damage > 0
  1123.       rules = "TP_HEAL"  if @result.tp_damage < 0
  1124.       value = @result.tp_damage.abs
  1125.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1126.       create_popup(text, rules)
  1127.     end
  1128.     @result.store_damage
  1129.     @result.clear_damage_values
  1130.   end

  1131.   #--------------------------------------------------------------------------
  1132.   # alias method: erase_state
  1133.   #--------------------------------------------------------------------------
  1134.   alias game_battlerbase_erase_state_abe erase_state
  1135.   def erase_state(state_id)
  1136.     make_state_popup(state_id, :rem_state) if @states.include?(state_id)
  1137.     game_battlerbase_erase_state_abe(state_id)
  1138.   end

  1139.   #--------------------------------------------------------------------------
  1140.   # new method: make_during_state_popup
  1141.   #--------------------------------------------------------------------------
  1142.   def make_during_state_popup
  1143.     state_id = most_important_state_id
  1144.     return if state_id == 0
  1145.     make_state_popup(state_id, :dur_state)
  1146.   end

  1147.   #--------------------------------------------------------------------------
  1148.   # new method: most_important_state_id
  1149.   #--------------------------------------------------------------------------
  1150.   def most_important_state_id
  1151.     states.each {|state| return state.id unless state.message3.empty? }
  1152.     return 0
  1153.   end

  1154.   #--------------------------------------------------------------------------
  1155.   # new method: make_state_popup
  1156.   #--------------------------------------------------------------------------
  1157.   def make_state_popup(state_id, type)
  1158.     state = $data_states[state_id]
  1159.     return if state.icon_index == 0
  1160.     rules = state.popup_rules[type]
  1161.     return if rules.nil?
  1162.     text = sprintf(YEA::BATTLE::POPUP_SETTINGS[type], state.name)
  1163.     flags = ["state", state.icon_index]
  1164.     create_popup(text, rules, flags)
  1165.   end

  1166.   #--------------------------------------------------------------------------
  1167.   # new method: make_miss_popups
  1168.   #--------------------------------------------------------------------------
  1169.   def make_miss_popups(user, item)
  1170.     return if dead?
  1171.     if @result.missed
  1172.       text = YEA::BATTLE::POPUP_SETTINGS[:missed]
  1173.       rules = "DEFAULT"
  1174.       create_popup(text, rules)
  1175.     end
  1176.     if @result.evaded
  1177.       text = YEA::BATTLE::POPUP_SETTINGS[:evaded]
  1178.       rules = "DEFAULT"
  1179.       create_popup(text, rules)
  1180.     end
  1181.     if @result.hit? && !@result.success
  1182.       text = YEA::BATTLE::POPUP_SETTINGS[:failed]
  1183.       rules = "DEFAULT"
  1184.       create_popup(text, rules)
  1185.     end
  1186.     if @result.hit? && item.damage.to_hp?
  1187.       if @result.hp_damage == 0 && @result.hp_damage == 0
  1188.         text = YEA::BATTLE::POPUP_SETTINGS[:nulled]
  1189.         rules = "DEFAULT"
  1190.         create_popup(text, rules)
  1191.       end
  1192.     end
  1193.   end

  1194.   #--------------------------------------------------------------------------
  1195.   # new method: make_rate_popup
  1196.   #--------------------------------------------------------------------------
  1197.   def make_rate_popup(rate)
  1198.     return if rate == 1.0
  1199.     flags = []
  1200.     if rate > 1.0
  1201.       text = YEA::BATTLE::POPUP_SETTINGS[:weakpoint]
  1202.       rules = "WEAK_ELE"
  1203.       flags.push("weakness")
  1204.     elsif rate == 0.0
  1205.       text = YEA::BATTLE::POPUP_SETTINGS[:immune]
  1206.       rules = "IMMU_ELE"
  1207.       flags.push("immune")
  1208.     elsif rate < 0.0
  1209.       text = YEA::BATTLE::POPUP_SETTINGS[:absorbed]
  1210.       rules = "ABSB_ELE"
  1211.       flags.push("absorbed")
  1212.     else
  1213.       text = YEA::BATTLE::POPUP_SETTINGS[:resistant]
  1214.       rules = "REST_ELE"
  1215.       flags.push("resistant")
  1216.     end
  1217.     create_popup(text, rules, flags)
  1218.   end

  1219.   #--------------------------------------------------------------------------
  1220.   # new method: make_buff_popup
  1221.   #--------------------------------------------------------------------------
  1222.   def make_buff_popup(param_id, positive = true)
  1223.     return unless alive?
  1224.     name = Vocab::param(param_id)
  1225.     if positive
  1226.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_buff], name)
  1227.       rules = "BUFF"
  1228.       buff_level = 1
  1229.     else
  1230.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_debuff], name)
  1231.       rules = "DEBUFF"
  1232.       buff_level = -1
  1233.     end
  1234.     icon = buff_icon_index(buff_level, param_id)
  1235.     flags = ["buff", icon]
  1236.     return if @popups.include?([text, rules, flags])
  1237.     create_popup(text, rules, flags)
  1238.   end

  1239. end # Game_BattlerBase

  1240. #==============================================================================
  1241. # ■ Game_Battler
  1242. #==============================================================================

  1243. class Game_Battler < Game_BattlerBase

  1244.   #--------------------------------------------------------------------------
  1245.   # public instance variables
  1246.   #--------------------------------------------------------------------------
  1247.   attr_accessor :pseudo_ani_id

  1248.   #--------------------------------------------------------------------------
  1249.   # alias method: on_battle_end
  1250.   #--------------------------------------------------------------------------
  1251.   alias game_battler_on_battle_end_abe on_battle_end
  1252.   def on_battle_end
  1253.     game_battler_on_battle_end_abe
  1254.     @popups = []
  1255.   end

  1256.   #--------------------------------------------------------------------------
  1257.   # alias method: clear_sprite_effects
  1258.   #--------------------------------------------------------------------------
  1259.   alias game_battler_clear_sprite_effects_abe clear_sprite_effects
  1260.   def clear_sprite_effects
  1261.     game_battler_clear_sprite_effects_abe
  1262.     @pseudo_ani_id = 0
  1263.   end

  1264.   #--------------------------------------------------------------------------
  1265.   # alias method: item_apply
  1266.   #--------------------------------------------------------------------------
  1267.   alias game_battler_item_apply_abe item_apply
  1268.   def item_apply(user, item)
  1269.     game_battler_item_apply_abe(user, item)
  1270.     make_miss_popups(user, item)
  1271.   end

  1272.   #--------------------------------------------------------------------------
  1273.   # alias method: make_damage_value
  1274.   #--------------------------------------------------------------------------
  1275.   alias game_battler_make_damage_value_abe make_damage_value
  1276.   def make_damage_value(user, item)
  1277.     game_battler_make_damage_value_abe(user, item)
  1278.     rate = item_element_rate(user, item)
  1279.     make_rate_popup(rate) unless $game_temp.evaluating
  1280.   end

  1281.   #--------------------------------------------------------------------------
  1282.   # alias method: execute_damage
  1283.   #--------------------------------------------------------------------------
  1284.   alias game_battler_execute_damage_abe execute_damage
  1285.   def execute_damage(user)
  1286.     game_battler_execute_damage_abe(user)
  1287.     make_damage_popups(user)
  1288.   end

  1289.   #--------------------------------------------------------------------------
  1290.   # alias method: item_effect_recover_hp
  1291.   #--------------------------------------------------------------------------
  1292.   alias game_battler_item_effect_recover_hp_abe item_effect_recover_hp
  1293.   def item_effect_recover_hp(user, item, effect)
  1294.     game_battler_item_effect_recover_hp_abe(user, item, effect)
  1295.     make_damage_popups(user)
  1296.   end

  1297.   #--------------------------------------------------------------------------
  1298.   # alias method: item_effect_recover_mp
  1299.   #--------------------------------------------------------------------------
  1300.   alias game_battler_item_effect_recover_mp_abe item_effect_recover_mp
  1301.   def item_effect_recover_mp(user, item, effect)
  1302.     game_battler_item_effect_recover_mp_abe(user, item, effect)
  1303.     make_damage_popups(user)
  1304.   end

  1305.   #--------------------------------------------------------------------------
  1306.   # alias method: item_effect_gain_tp
  1307.   #--------------------------------------------------------------------------
  1308.   alias game_battler_item_effect_gain_tp_abe item_effect_gain_tp
  1309.   def item_effect_gain_tp(user, item, effect)
  1310.     game_battler_item_effect_gain_tp_abe(user, item, effect)
  1311.     make_damage_popups(user)
  1312.   end

  1313.   #--------------------------------------------------------------------------
  1314.   # alias method: item_user_effect
  1315.   #--------------------------------------------------------------------------
  1316.   alias game_battler_item_user_effect_abe item_user_effect
  1317.   def item_user_effect(user, item)
  1318.     game_battler_item_user_effect_abe(user, item)
  1319.     @result.restore_damage
  1320.   end

  1321.   #--------------------------------------------------------------------------
  1322.   # alias method: add_new_state
  1323.   #--------------------------------------------------------------------------
  1324.   alias game_battler_add_new_state_abe add_new_state
  1325.   def add_new_state(state_id)
  1326.     game_battler_add_new_state_abe(state_id)
  1327.     make_state_popup(state_id, :add_state) if @states.include?(state_id)
  1328.   end

  1329.   #--------------------------------------------------------------------------
  1330.   # alias method: add_buff
  1331.   #--------------------------------------------------------------------------
  1332.   alias game_battler_add_buff_abe add_buff
  1333.   def add_buff(param_id, turns)
  1334.     make_buff_popup(param_id, true)
  1335.     game_battler_add_buff_abe(param_id, turns)
  1336.   end

  1337.   #--------------------------------------------------------------------------
  1338.   # alias method: add_debuff
  1339.   #--------------------------------------------------------------------------
  1340.   alias game_battler_add_debuff_abe add_debuff
  1341.   def add_debuff(param_id, turns)
  1342.     make_buff_popup(param_id, false)
  1343.     game_battler_add_debuff_abe(param_id, turns)
  1344.   end

  1345.   #--------------------------------------------------------------------------
  1346.   # alias method: regenerate_all
  1347.   #--------------------------------------------------------------------------
  1348.   alias game_battler_regenerate_all_abe regenerate_all
  1349.   def regenerate_all
  1350.     game_battler_regenerate_all_abe
  1351.     return unless alive?
  1352.     make_damage_popups(self)
  1353.   end

  1354.   #--------------------------------------------------------------------------
  1355.   # new method: can_collapse?
  1356.   #--------------------------------------------------------------------------
  1357.   def can_collapse?
  1358.     return false unless dead?
  1359.     unless actor?
  1360.       return false unless sprite.battler_visible
  1361.       array = [:collapse, :boss_collapse, :instant_collapse]
  1362.       return false if array.include?(sprite.effect_type)
  1363.     end
  1364.     return true
  1365.   end

  1366.   #--------------------------------------------------------------------------
  1367.   # new method: draw_mp?
  1368.   #--------------------------------------------------------------------------
  1369.   def draw_mp?; return true; end

  1370.   #--------------------------------------------------------------------------
  1371.   # new method: draw_tp?
  1372.   #--------------------------------------------------------------------------
  1373.   def draw_tp?
  1374.     return $data_system.opt_display_tp
  1375.   end

  1376. end # Game_Battler

  1377. #==============================================================================
  1378. # ■ Game_Actor
  1379. #==============================================================================

  1380. class Game_Actor < Game_Battler

  1381.   #def battler_name
  1382.     #return "Slime"
  1383.   #end

  1384.   #def battler_hue
  1385.     #return 0
  1386.   #end

  1387.   #--------------------------------------------------------------------------
  1388.   # overwrite method: perform_damage_effect
  1389.   #--------------------------------------------------------------------------
  1390.   def perform_damage_effect
  1391.     $game_troop.screen.start_shake(5, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
  1392.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1393.     Sound.play_actor_damage
  1394.   end

  1395.   #--------------------------------------------------------------------------
  1396.   # overwrite method: use_sprite?
  1397.   #--------------------------------------------------------------------------
  1398.   def use_sprite?; return true; end

  1399.   #--------------------------------------------------------------------------
  1400.   # new method: screen_x
  1401.   #--------------------------------------------------------------------------
  1402.   def screen_x
  1403.     return 0 unless SceneManager.scene_is?(Scene_Battle)
  1404.     status_window = SceneManager.scene.status_window
  1405.     return 0 if status_window.nil?
  1406.     item_rect_width = (status_window.width-24) / $game_party.max_battle_members
  1407.     ext = SceneManager.scene.info_viewport.ox
  1408.     rect = SceneManager.scene.status_window.item_rect(self.index)
  1409.     constant = 128 + 12
  1410.     return constant + rect.x + item_rect_width / 2 - ext
  1411.   end

  1412.   #--------------------------------------------------------------------------
  1413.   # new method: screen_y
  1414.   #--------------------------------------------------------------------------
  1415.   def screen_y
  1416.     return Graphics.height - 120 unless SceneManager.scene_is?(Scene_Battle)
  1417.     return Graphics.height - 120 if SceneManager.scene.status_window.nil?
  1418.     return Graphics.height - (SceneManager.scene.status_window.height * 7/8)
  1419.   end

  1420.   #--------------------------------------------------------------------------
  1421.   # new method: screen_z
  1422.   #--------------------------------------------------------------------------
  1423.   def screen_z; return 100; end

  1424.   #--------------------------------------------------------------------------
  1425.   # new method: sprite
  1426.   #--------------------------------------------------------------------------
  1427.   def sprite
  1428.     index = $game_party.battle_members.index(self)
  1429.     return SceneManager.scene.spriteset.actor_sprites[index]
  1430.   end

  1431.   #--------------------------------------------------------------------------
  1432.   # new method: draw_mp?
  1433.   #--------------------------------------------------------------------------
  1434.   def draw_mp?
  1435.     return true unless draw_tp?
  1436.     for skill in skills
  1437.       next unless added_skill_types.include?(skill.stype_id)
  1438.       return true if skill.mp_cost > 0
  1439.     end
  1440.     return false
  1441.   end

  1442.   #--------------------------------------------------------------------------
  1443.   # new method: draw_tp?
  1444.   #--------------------------------------------------------------------------
  1445.   def draw_tp?
  1446.     return false unless $data_system.opt_display_tp
  1447.     for skill in skills
  1448.       next unless added_skill_types.include?(skill.stype_id)
  1449.       return true if skill.tp_cost > 0
  1450.     end
  1451.     return false
  1452.   end

  1453. end # Game_Actor

  1454. #==============================================================================
  1455. # ■ Game_Enemy
  1456. #==============================================================================

  1457. class Game_Enemy < Game_Battler

  1458.   #--------------------------------------------------------------------------
  1459.   # overwrite method: perform_damage_effect
  1460.   #--------------------------------------------------------------------------
  1461.   def perform_damage_effect
  1462.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1463.     Sound.play_enemy_damage
  1464.   end

  1465.   #--------------------------------------------------------------------------
  1466.   # new methods: attack_animation_id
  1467.   #--------------------------------------------------------------------------
  1468.   def atk_animation_id1; return enemy.atk_animation_id1; end
  1469.   def atk_animation_id2; return enemy.atk_animation_id2; end

  1470.   #--------------------------------------------------------------------------
  1471.   # new method: sprite
  1472.   #--------------------------------------------------------------------------
  1473.   def sprite
  1474.     return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
  1475.   end

  1476. end # Game_Enemy

  1477. #==============================================================================
  1478. # ■ Game_Unit
  1479. #==============================================================================

  1480. class Game_Unit

  1481.   #--------------------------------------------------------------------------
  1482.   # alias method: make_actions
  1483.   #--------------------------------------------------------------------------
  1484.   alias game_unit_make_actions_abe make_actions
  1485.   def make_actions
  1486.     game_unit_make_actions_abe
  1487.     refresh_autobattler_status_window
  1488.   end

  1489.   #--------------------------------------------------------------------------
  1490.   # new method: refresh_autobattler_status_window
  1491.   #--------------------------------------------------------------------------
  1492.   def refresh_autobattler_status_window
  1493.     return unless SceneManager.scene_is?(Scene_Battle)
  1494.     return unless self.is_a?(Game_Party)
  1495.     SceneManager.scene.refresh_autobattler_status_window
  1496.   end

  1497. end # Game_Unit

  1498. #==============================================================================
  1499. # ■ Window_PartyCommand
  1500. #==============================================================================

  1501. class Window_PartyCommand < Window_Command

  1502.   #--------------------------------------------------------------------------
  1503.   # overwrite method: process_handling
  1504.   #--------------------------------------------------------------------------
  1505.   def process_handling
  1506.     return unless open? && active
  1507.     return process_dir6 if Input.repeat?(:RIGHT)
  1508.     return super
  1509.   end

  1510.   #--------------------------------------------------------------------------
  1511.   # new method: process_dir6
  1512.   #--------------------------------------------------------------------------
  1513.   def process_dir6
  1514.     Sound.play_cursor
  1515.     Input.update
  1516.     deactivate
  1517.     call_handler(:dir6)
  1518.   end

  1519. end # Window_PartyCommand

  1520. #==============================================================================
  1521. # ■ Window_ActorCommand
  1522. #==============================================================================

  1523. class Window_ActorCommand < Window_Command

  1524.   #--------------------------------------------------------------------------
  1525.   # overwrite method: process_handling
  1526.   #--------------------------------------------------------------------------
  1527.   def process_handling
  1528.     return unless open? && active
  1529.     return process_dir4 if Input.repeat?(:LEFT)
  1530.     return process_dir6 if Input.repeat?(:RIGHT)
  1531.     return super
  1532.   end

  1533.   #--------------------------------------------------------------------------
  1534.   # new method: process_dir4
  1535.   #--------------------------------------------------------------------------
  1536.   def process_dir4
  1537.     Sound.play_cursor
  1538.     Input.update
  1539.     deactivate
  1540.     call_handler(:cancel)
  1541.   end

  1542.   #--------------------------------------------------------------------------
  1543.   # new method: process_dir6
  1544.   #--------------------------------------------------------------------------
  1545.   def process_dir6
  1546.     Sound.play_cursor
  1547.     #Input.update
  1548.     #deactivate
  1549.     #call_handler(:dir6)
  1550.   end

  1551. end # Window_ActorCommand

  1552. #==============================================================================
  1553. # ■ Window_BattleStatus
  1554. #==============================================================================

  1555. class Window_BattleStatus < Window_Selectable

  1556.   #--------------------------------------------------------------------------
  1557.   # overwrite method: initialize
  1558.   #--------------------------------------------------------------------------
  1559.   def initialize
  1560.     super(0, 0, window_width, window_height+24)
  1561.     self.openness = 0
  1562.     @party = $game_party.battle_members.clone
  1563.   end

  1564.   #--------------------------------------------------------------------------
  1565.   # overwrite method: col_max
  1566.   #--------------------------------------------------------------------------
  1567.   def col_max; return $game_party.max_battle_members; end

  1568.   #--------------------------------------------------------------------------
  1569.   # new method: battle_members
  1570.   #--------------------------------------------------------------------------
  1571.   def battle_members; return $game_party.battle_members; end

  1572.   #--------------------------------------------------------------------------
  1573.   # new method: actor
  1574.   #--------------------------------------------------------------------------
  1575.   def actor; return battle_members[@index]; end

  1576.   #--------------------------------------------------------------------------
  1577.   # overwrite method: update
  1578.   #--------------------------------------------------------------------------
  1579.   def update
  1580.     super
  1581.     return if @party == $game_party.battle_members
  1582.     @party = $game_party.battle_members.clone
  1583.     refresh
  1584.   end

  1585.   def draw_actor_figure(actor, x, y, enabled = true)
  1586.     bitmap = Cache.system("bf"+actor.id.to_s+".png")
  1587.     rect = Rect.new(0,0,bitmap.width, bitmap.height)   
  1588.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  1589.     bitmap.dispose
  1590.   end
  1591.   #--------------------------------------------------------------------------
  1592.   # overwrite method: draw_item
  1593.   #--------------------------------------------------------------------------
  1594.   def draw_item(index)
  1595.     return if index.nil?
  1596.     clear_item(index)
  1597.     actor = battle_members[index]
  1598.     rect = item_rect(index)
  1599.     item_x = rect.x #+ 6
  1600.     return if actor.nil?
  1601. #~     draw_actor_figure(actor, item_x+2, rect.y+2, actor.alive?)
  1602.     draw_actor_figure(actor, item_x, rect.y, actor.alive?)
  1603.     draw_actor_name(actor, item_x, rect.y, rect.width)
  1604. #~     draw_actor_action(actor, item_x + 96, rect.y - 2)
  1605.     draw_actor_action(actor, item_x+41, line_height-7)
  1606.     draw_actor_icons(actor, item_x, rect.y + 2, rect.width)
  1607.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
  1608.     yadj = 10
  1609.     contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
  1610.     draw_actor_hp(actor, item_x+2, line_height*2+gx, rect.width)
  1611.     if draw_tp?(actor) && draw_mp?(actor)
  1612.       dw = rect.width/2-2-16
  1613.       dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
  1614.       draw_actor_tp(actor, item_x+2, line_height*3+gx-yadj+3, dw)
  1615.       dw = rect.width - rect.width/2 - 2-6
  1616.       draw_actor_mp(actor, item_x+rect.width/2-6, line_height*3+gx-yadj+3, dw)
  1617.     elsif draw_tp?(actor) && !draw_mp?(actor)
  1618.       draw_actor_tp(actor, item_x+2, line_height*3+gx-yadj+3, rect.width)
  1619.     else
  1620.       draw_actor_mp(actor, item_x+2, line_height*3+gx-yadj+3, rect.width)
  1621.     end
  1622.   end
  1623.   #--------------------------------------------------------------------------
  1624.   # overwrite method: item_rect
  1625.   #--------------------------------------------------------------------------
  1626.   def item_rect(index)
  1627.     rect = Rect.new
  1628.     rect.width = contents.width / 6 #$game_party.max_battle_members + 32
  1629.     rect.height = contents.height
  1630.     rect.x = index * rect.width
  1631.     if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
  1632.       rect.x += (contents.width - $game_party.members.size * rect.width) / 2
  1633.     end
  1634.     rect.y = 0
  1635.     return rect
  1636.   end

  1637.   #--------------------------------------------------------------------------
  1638.   # overwrite method: draw_face
  1639.   #--------------------------------------------------------------------------
  1640.   def draw_face(face_name, face_index, dx, dy, enabled = true)
  1641.     bitmap = Cache.face(face_name)
  1642.     fx = [(96 - item_rect(0).width + 1) / 2, 0].max
  1643.     fy = face_index / 4 * 96 + 2
  1644.     fw = [item_rect(0).width - 4, 92].min
  1645.     rect = Rect.new(fx, fy, fw, 92)
  1646.     rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
  1647.     contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
  1648.     bitmap.dispose
  1649.   end

  1650.   #--------------------------------------------------------------------------
  1651.   # overwrite method: draw_actor_name
  1652.   #--------------------------------------------------------------------------
  1653.   def draw_actor_name(actor, dx, dy, dw = 112)
  1654.     reset_font_settings
  1655.     contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
  1656.     change_color(hp_color(actor))
  1657. #~     draw_text(dx+24, dy, dw-24, line_height, actor.name)
  1658.     draw_text(dx, dy, dw, line_height, actor.name)
  1659.   end

  1660.   #--------------------------------------------------------------------------
  1661.   # new method: draw_actor_action
  1662.   #--------------------------------------------------------------------------
  1663.   def draw_actor_action(actor, dx, dy)
  1664.     draw_icon(action_icon(actor), dx, dy)
  1665.   end

  1666.   #--------------------------------------------------------------------------
  1667.   # new method: action_icon
  1668.   #--------------------------------------------------------------------------
  1669.   def action_icon(actor)
  1670.     return Icon.no_action if actor.current_action.nil?
  1671.     return Icon.no_action if actor.current_action.item.nil?
  1672.     return actor.current_action.item.icon_index
  1673.   end

  1674.   #--------------------------------------------------------------------------
  1675.   # new method: draw_tp?
  1676.   #--------------------------------------------------------------------------
  1677.   def draw_tp?(actor)
  1678.     return actor.draw_tp?
  1679.   end

  1680.   #--------------------------------------------------------------------------
  1681.   # new method: draw_mp?
  1682.   #--------------------------------------------------------------------------
  1683.   def draw_mp?(actor)
  1684.     return actor.draw_mp?
  1685.   end

  1686.   #--------------------------------------------------------------------------
  1687.   # overwrite method: draw_current_and_max_values
  1688.   #--------------------------------------------------------------------------
  1689.   def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
  1690.     change_color(color1)
  1691.     draw_text(dx, dy, dw, line_height, current.group, 2)
  1692.   end

  1693.   #--------------------------------------------------------------------------
  1694.   # overwrite method: draw_actor_hp
  1695.   #--------------------------------------------------------------------------
  1696.   def draw_actor_hp(actor, dx, dy, width = 124)
  1697.     draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  1698.     change_color(system_color)
  1699.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1700. #~     draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
  1701.     draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
  1702.       hp_color(actor), normal_color)
  1703.     end

  1704.   #--------------------------------------------------------------------------
  1705.   # overwrite method: draw_actor_mp
  1706.   #--------------------------------------------------------------------------
  1707.   def draw_actor_mp(actor, dx, dy, width = 124)
  1708.     draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  1709.     change_color(system_color)
  1710.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1711. #~     draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
  1712.     draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
  1713.       mp_color(actor), normal_color)
  1714.     end

  1715.   #--------------------------------------------------------------------------
  1716.   # overwrite method: draw_actor_tp
  1717.   #--------------------------------------------------------------------------
  1718.   def draw_actor_tp(actor, dx, dy, width = 124)
  1719.     draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  1720.     change_color(system_color)
  1721.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1722.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
  1723.     change_color(tp_color(actor))
  1724.     draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
  1725.   end

  1726. end # Window_BattleStatus

  1727. #==============================================================================
  1728. # ■ Window_BattleActor
  1729. #==============================================================================

  1730. class Window_BattleActor < Window_BattleStatus

  1731.   #--------------------------------------------------------------------------
  1732.   # overwrite method: show
  1733.   #--------------------------------------------------------------------------
  1734.   def show
  1735.     create_flags
  1736.     super
  1737.   end

  1738.   #--------------------------------------------------------------------------
  1739.   # new method: create_flags
  1740.   #--------------------------------------------------------------------------
  1741.   def create_flags
  1742.     set_select_flag(:any)
  1743.     select(0)
  1744.     return if $game_temp.battle_aid.nil?
  1745.     if $game_temp.battle_aid.need_selection?
  1746.       select(0)
  1747.       #set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
  1748.     elsif $game_temp.battle_aid.for_user?
  1749.       battler = BattleManager.actor
  1750.       id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
  1751.       select(id)
  1752.       set_select_flag(:user)
  1753.     elsif $game_temp.battle_aid.for_all?
  1754.       select(0)
  1755.       set_select_flag(:all)
  1756.       set_select_flag(:all) if $game_temp.battle_aid.for_dead_friend?
  1757.       #set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
  1758.     elsif $game_temp.battle_aid.for_random?
  1759.       select(0)
  1760.       set_select_flag(:random) if $game_temp.battle_aid.for_random?
  1761.     end
  1762.   end

  1763.   #--------------------------------------------------------------------------
  1764.   # new method: set_flag
  1765.   #--------------------------------------------------------------------------
  1766.   def set_select_flag(flag)
  1767.     @select_flag = flag
  1768.     case @select_flag
  1769.     when :all, :all_dead, :random
  1770.       @cursor_all = true
  1771.     else
  1772.       @cursor_all = false
  1773.     end
  1774.   end

  1775.   #--------------------------------------------------------------------------
  1776.   # overwrite method: update_cursor
  1777.   #--------------------------------------------------------------------------
  1778.   def update_cursor
  1779.     if @cursor_all
  1780.       cursor_rect.set(0, 0, contents.width, contents.height)
  1781.       self.top_row = 0
  1782.     elsif @index < 0
  1783.       cursor_rect.empty
  1784.     else
  1785.       ensure_cursor_visible
  1786.       cursor_rect.set(item_rect(@index))
  1787.     end
  1788.   end

  1789.   #--------------------------------------------------------------------------
  1790.   # overwrite method: cursor_movable?
  1791.   #--------------------------------------------------------------------------
  1792.   def cursor_movable?
  1793.     return false if @select_flag == :user
  1794.     return super
  1795.   end

  1796.   #--------------------------------------------------------------------------
  1797.   # overwrite method: current_item_enabled?
  1798.   #--------------------------------------------------------------------------
  1799.   def current_item_enabled?
  1800.     return true if $game_temp.battle_aid.nil?
  1801.     if $game_temp.battle_aid.need_selection?
  1802.       member = $game_party.battle_members[@index]
  1803.       return true#member.dead? if $game_temp.battle_aid.for_dead_friend?
  1804.     elsif $game_temp.battle_aid.for_dead_friend?
  1805.       for member in $game_party.battle_members
  1806.         return true #if member.dead?
  1807.       end
  1808.       return false
  1809.     end
  1810.     return true
  1811.   end

  1812. end # Window_BattleActor

  1813. #==============================================================================
  1814. # ■ Window_BattleStatusAid
  1815. #==============================================================================

  1816. class Window_BattleStatusAid < Window_BattleStatus

  1817.   #--------------------------------------------------------------------------
  1818.   # public instance variables
  1819.   #--------------------------------------------------------------------------
  1820.   attr_accessor :status_window

  1821.   #--------------------------------------------------------------------------
  1822.   # overwrite method: initialize
  1823.   #--------------------------------------------------------------------------
  1824.   def initialize
  1825.     super
  1826.     self.visible = false
  1827.     self.openness = 255
  1828.   end

  1829.   #--------------------------------------------------------------------------
  1830.   # overwrite method: window_width
  1831.   #--------------------------------------------------------------------------
  1832.   def window_width; return 128; end

  1833.   #--------------------------------------------------------------------------
  1834.   # overwrite method: show
  1835.   #--------------------------------------------------------------------------
  1836.   def show
  1837.     super
  1838.     refresh
  1839.   end

  1840.   #--------------------------------------------------------------------------
  1841.   # overwrite method: refresh
  1842.   #--------------------------------------------------------------------------
  1843.   def refresh
  1844.     contents.clear
  1845.     return if @status_window.nil?
  1846.     draw_item(@status_window.index)
  1847.   end

  1848.   #--------------------------------------------------------------------------
  1849.   # overwrite method: item_rect
  1850.   #--------------------------------------------------------------------------
  1851.   def item_rect(index)
  1852.     return Rect.new(0, 0, contents.width, contents.height)
  1853.   end
  1854.   
  1855.   def draw_item(index)
  1856.     return if index.nil?
  1857.     clear_item(index)
  1858.     actor = battle_members[index]
  1859.     rect = item_rect(index)
  1860.     item_x = rect.x
  1861.     return if actor.nil?
  1862.     draw_actor_figure(actor, item_x + 4 , rect.y+2, actor.alive?)
  1863.     draw_actor_name(actor, item_x, rect.y, rect.width)
  1864.     draw_actor_action(actor, item_x, rect.y - 2)
  1865.     draw_actor_icons(actor, item_x, rect.y + 2, rect.width)
  1866.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
  1867.     yadj = 10
  1868.     contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
  1869.     draw_actor_hp(actor, item_x+2, line_height*2+gx, rect.width)
  1870.     if draw_tp?(actor) && draw_mp?(actor)
  1871.       dw = rect.width/2-2-16
  1872.       dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
  1873.       draw_actor_tp(actor, item_x+2, line_height*3+gx-yadj+3, dw)
  1874.       dw = rect.width - rect.width/2 - 2-6
  1875.       draw_actor_mp(actor, item_x+rect.width/2-6, line_height*3+gx-yadj+3, dw)
  1876.     elsif draw_tp?(actor) && !draw_mp?(actor)
  1877.       draw_actor_tp(actor, item_x+2, line_height*3+gx-yadj+3, rect.width)
  1878.     else
  1879.       draw_actor_mp(actor, item_x+2, line_height*3+gx-yadj+3, rect.width)
  1880.     end
  1881.   end
  1882.   
  1883.   def draw_actor_name(actor, dx, dy, dw = 112)
  1884.     reset_font_settings
  1885.     contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
  1886.     change_color(hp_color(actor))
  1887.     draw_text(dx+24, dy, dw-24, line_height, actor.name)
  1888.   end
  1889.   
  1890.   def draw_actor_figure(actor, x, y, enabled = true)
  1891.     bitmap = Cache.system("bff"+actor.id.to_s+".png")
  1892.     rect = Rect.new(0,0,bitmap.width, bitmap.height)   
  1893.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  1894.     bitmap.dispose
  1895.   end
  1896.   
  1897.   

  1898. end # Window_BattleStatusAid

  1899. #==============================================================================
  1900. # ■ Window_BattleEnemy
  1901. #==============================================================================

  1902. class Window_BattleEnemy < Window_Selectable
  1903.   #--------------------------------------------------------------------------
  1904.   # overwrite method: initialize
  1905.   #--------------------------------------------------------------------------
  1906.   def initialize(info_viewport)
  1907.     super(0, Graphics.height, window_width, fitting_height(1))
  1908.     refresh
  1909.     self.visible = false
  1910.     @info_viewport = info_viewport
  1911.   end

  1912.   #--------------------------------------------------------------------------
  1913.   # overwrite method: col_max
  1914.   #--------------------------------------------------------------------------
  1915.   def col_max; return item_max; end

  1916.   #--------------------------------------------------------------------------
  1917.   # overwrite method: show
  1918.   #--------------------------------------------------------------------------
  1919.   def show
  1920.     create_flags
  1921.     super
  1922.   end

  1923.   #--------------------------------------------------------------------------
  1924.   # new method: create_flags
  1925.   #--------------------------------------------------------------------------
  1926.   def create_flags
  1927.     set_select_flag(:any)
  1928.     select(0)
  1929.     return if $game_temp.battle_aid.nil?
  1930.     if $game_temp.battle_aid.need_selection?
  1931.       select(0)
  1932.     elsif $game_temp.battle_aid.for_all?
  1933.       select(0)
  1934.       set_select_flag(:all)
  1935.     elsif $game_temp.battle_aid.for_random?
  1936.       select(0)
  1937.       set_select_flag(:random)
  1938.     end
  1939.   end

  1940.   #--------------------------------------------------------------------------
  1941.   # new method: set_flag
  1942.   #--------------------------------------------------------------------------
  1943.   def set_select_flag(flag)
  1944.     @select_flag = flag
  1945.     case @select_flag
  1946.     when :all, :random
  1947.       @cursor_all = true
  1948.     else
  1949.       @cursor_all = false
  1950.     end
  1951.   end

  1952.   #--------------------------------------------------------------------------
  1953.   # new method: select_all?
  1954.   #--------------------------------------------------------------------------
  1955.   def select_all?
  1956.     return true if @select_flag == :all
  1957.     return true if @select_flag == :random
  1958.     return false
  1959.   end

  1960.   #--------------------------------------------------------------------------
  1961.   # overwrite method: update_cursor
  1962.   #--------------------------------------------------------------------------
  1963.   def update_cursor
  1964.     if @cursor_all
  1965.       cursor_rect.set(0, 0, contents.width, contents.height)
  1966.       self.top_row = 0
  1967.     elsif @index < 0
  1968.       cursor_rect.empty
  1969.     else
  1970.       ensure_cursor_visible
  1971.       cursor_rect.set(item_rect(@index))
  1972.     end
  1973.   end

  1974.   #--------------------------------------------------------------------------
  1975.   # overwrite method: cursor_movable?
  1976.   #--------------------------------------------------------------------------
  1977.   def cursor_movable?
  1978.     return false if @select_flag == :user
  1979.     return super
  1980.   end

  1981.   #--------------------------------------------------------------------------
  1982.   # overwrite method: current_item_enabled?
  1983.   #--------------------------------------------------------------------------
  1984.   def current_item_enabled?
  1985.     return true if $game_temp.battle_aid.nil?
  1986.     if $game_temp.battle_aid.need_selection?
  1987.       member = $game_party.battle_members[@index]
  1988.       return true#member.dead? if $game_temp.battle_aid.for_dead_friend?
  1989.     elsif $game_temp.battle_aid.for_dead_friend?
  1990.       for member in $game_party.battle_members
  1991.         return true #if member.dead?
  1992.       end
  1993.       return false
  1994.     end
  1995.     return true
  1996.   end

  1997.   #--------------------------------------------------------------------------
  1998.   # overwrite method: enemy
  1999.   #--------------------------------------------------------------------------
  2000.   def enemy; @data[index]; end

  2001.   #--------------------------------------------------------------------------
  2002.   # overwrite method: refresh
  2003.   #--------------------------------------------------------------------------
  2004.   def refresh
  2005.     make_item_list
  2006.     create_contents
  2007.     draw_all_items
  2008.   end

  2009.   #--------------------------------------------------------------------------
  2010.   # overwrite method: make_item_list
  2011.   #--------------------------------------------------------------------------
  2012.   def make_item_list
  2013.     @data = $game_troop.alive_members
  2014.     @data.sort! { |a,b| a.screen_x <=> b.screen_x }
  2015.   end

  2016.   #--------------------------------------------------------------------------
  2017.   # overwrite method: draw_item
  2018.   #--------------------------------------------------------------------------
  2019.   def draw_item(index); return; end

  2020.   #--------------------------------------------------------------------------
  2021.   # overwrite method: update
  2022.   #--------------------------------------------------------------------------
  2023.   def update
  2024.     super
  2025.     return unless active
  2026.     enemy.sprite_effect_type = :whiten
  2027.     return unless select_all?
  2028.     for enemy in $game_troop.alive_members
  2029.       enemy.sprite_effect_type = :whiten
  2030.     end
  2031.   end

  2032. end # Window_BattleEnemy

  2033. #==============================================================================
  2034. # ■ Window_BattleHelp
  2035. #==============================================================================

  2036. class Window_BattleHelp < Window_Help

  2037.   #--------------------------------------------------------------------------
  2038.   # public instance variables
  2039.   #--------------------------------------------------------------------------
  2040.   attr_accessor :actor_window
  2041.   attr_accessor :enemy_window

  2042.   #--------------------------------------------------------------------------
  2043.   # update
  2044.   #--------------------------------------------------------------------------
  2045.   def update
  2046.     super
  2047.     if !self.visible and @text != ""
  2048.       @text = ""
  2049.       return refresh
  2050.     end
  2051.     update_battler_name
  2052.   end

  2053.   #--------------------------------------------------------------------------
  2054.   # update_battler_name
  2055.   #--------------------------------------------------------------------------
  2056.   def update_battler_name
  2057.     return unless @actor_window.active || @enemy_window.active
  2058.     if @actor_window.active
  2059.       battler = $game_party.battle_members[@actor_window.index]
  2060.     elsif @enemy_window.active
  2061.       battler = @enemy_window.enemy
  2062.     end
  2063.     if special_display?
  2064.       refresh_special_case(battler)
  2065.     else
  2066.       refresh_battler_name(battler) if battler_name(battler) != @text
  2067.     end
  2068.   end

  2069.   #--------------------------------------------------------------------------
  2070.   # battler_name
  2071.   #--------------------------------------------------------------------------
  2072.   def battler_name(battler)
  2073.     text = battler.name.clone
  2074.     return text
  2075.   end

  2076.   #--------------------------------------------------------------------------
  2077.   # refresh_battler_name
  2078.   #--------------------------------------------------------------------------
  2079.   def refresh_battler_name(battler)
  2080.     contents.clear
  2081.     reset_font_settings
  2082.     change_color(normal_color)
  2083.     @text = battler_name(battler)
  2084.     icons = battler.state_icons + battler.buff_icons
  2085.     dy = icons.size <= 0 ? line_height / 2 : 0
  2086.     draw_text(0, dy, contents.width, line_height, @text, 1)
  2087.     dx = (contents.width - (icons.size * 24)) / 2
  2088.     draw_actor_icons(battler, dx, line_height, contents.width)
  2089.   end

  2090.   #--------------------------------------------------------------------------
  2091.   # special_display?
  2092.   #--------------------------------------------------------------------------
  2093.   def special_display?
  2094.     return false if $game_temp.battle_aid.nil?
  2095.     return false if $game_temp.battle_aid.for_user?
  2096.     return !$game_temp.battle_aid.need_selection?
  2097.   end

  2098.   #--------------------------------------------------------------------------
  2099.   # refresh_special_case
  2100.   #--------------------------------------------------------------------------
  2101.   def refresh_special_case(battler)
  2102.     if $game_temp.battle_aid.for_opponent?
  2103.       if $game_temp.battle_aid.for_all?
  2104.         text = YEA::BATTLE::HELP_TEXT_ALL_FOES
  2105.       else
  2106.         case $game_temp.battle_aid.number_of_targets
  2107.         when 1
  2108.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
  2109.         else
  2110.           number = $game_temp.battle_aid.number_of_targets
  2111.           text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
  2112.         end
  2113.       end
  2114.     else # $game_temp.battle_aid.for_friend?
  2115.       if $game_temp.battle_aid.for_dead_friend?
  2116.         text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
  2117.       elsif $game_temp.battle_aid.for_random?
  2118.         case $game_temp.battle_aid.number_of_targets
  2119.         when 1
  2120.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
  2121.         else
  2122.           number = $game_temp.battle_aid.number_of_targets
  2123.           text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
  2124.         end
  2125.       else
  2126.         text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
  2127.       end
  2128.     end
  2129.     return if text == @text
  2130.     @text = text
  2131.     contents.clear
  2132.     reset_font_settings
  2133.     draw_text(0, 0, contents.width, line_height*2, @text, 1)
  2134.   end

  2135. end # Window_BattleHelp

  2136. #==============================================================================
  2137. # ■ Window_BattleLog
  2138. #==============================================================================

  2139. class Window_BattleLog < Window_Selectable

  2140.   #--------------------------------------------------------------------------
  2141.   # alias method: display_current_state
  2142.   #--------------------------------------------------------------------------
  2143.   alias window_battlelog_display_current_state_abe display_current_state
  2144.   def display_current_state(subject)
  2145.     subject.make_during_state_popup
  2146.     return unless YEA::BATTLE::MSG_CURRENT_STATE
  2147.     window_battlelog_display_current_state_abe(subject)
  2148.   end

  2149.   #--------------------------------------------------------------------------
  2150.   # alias method: display_use_item
  2151.   #--------------------------------------------------------------------------
  2152.   alias window_battlelog_display_use_item_abe display_use_item
  2153.   def display_use_item(subject, item)
  2154.     return unless YEA::BATTLE::MSG_CURRENT_ACTION
  2155.     window_battlelog_display_use_item_abe(subject, item)
  2156.   end

  2157.   #--------------------------------------------------------------------------
  2158.   # alias method: display_counter
  2159.   #--------------------------------------------------------------------------
  2160.   alias window_battlelog_display_counter_abe display_counter
  2161.   def display_counter(target, item)
  2162.     if YEA::BATTLE::MSG_COUNTERATTACK
  2163.       window_battlelog_display_counter_abe(target, item)
  2164.     else
  2165.       Sound.play_evasion
  2166.     end
  2167.   end

  2168.   #--------------------------------------------------------------------------
  2169.   # alias method: display_reflection
  2170.   #--------------------------------------------------------------------------
  2171.   alias window_battlelog_display_reflection_abe display_reflection
  2172.   def display_reflection(target, item)
  2173.     if YEA::BATTLE::MSG_REFLECT_MAGIC
  2174.       window_battlelog_display_reflection_abe(target, item)
  2175.     else
  2176.       Sound.play_reflection
  2177.     end
  2178.   end

  2179.   #--------------------------------------------------------------------------
  2180.   # alias method: display_substitute
  2181.   #--------------------------------------------------------------------------
  2182.   alias window_battlelog_display_substitute_abe display_substitute
  2183.   def display_substitute(substitute, target)
  2184.     return unless YEA::BATTLE::MSG_SUBSTITUTE_HIT
  2185.     window_battlelog_display_substitute_abe(substitute, target)
  2186.   end

  2187.   #--------------------------------------------------------------------------
  2188.   # alias method: display_failure
  2189.   #--------------------------------------------------------------------------
  2190.   alias window_battlelog_display_failure_abe display_failure
  2191.   def display_failure(target, item)
  2192.     return unless YEA::BATTLE::MSG_FAILURE_HIT
  2193.     window_battlelog_display_failure_abe(target, item)
  2194.   end

  2195.   #--------------------------------------------------------------------------
  2196.   # alias method: display_critical
  2197.   #--------------------------------------------------------------------------
  2198.   alias window_battlelog_display_critical_abe display_critical
  2199.   def display_critical(target, item)
  2200.     return unless YEA::BATTLE::MSG_CRITICAL_HIT
  2201.     window_battlelog_display_critical_abe(target, item)
  2202.   end

  2203.   #--------------------------------------------------------------------------
  2204.   # alias method: display_miss
  2205.   #--------------------------------------------------------------------------
  2206.   alias window_battlelog_display_miss_abe display_miss
  2207.   def display_miss(target, item)
  2208.     return unless YEA::BATTLE::MSG_HIT_MISSED
  2209.     window_battlelog_display_miss_abe(target, item)
  2210.   end

  2211.   #--------------------------------------------------------------------------
  2212.   # alias method: display_evasion
  2213.   #--------------------------------------------------------------------------
  2214.   alias window_battlelog_display_evasion_abe display_evasion
  2215.   def display_evasion(target, item)
  2216.     if YEA::BATTLE::MSG_EVASION
  2217.       window_battlelog_display_evasion_abe(target, item)
  2218.     else
  2219.       if !item || item.physical?
  2220.         Sound.play_evasion
  2221.       else
  2222.         Sound.play_magic_evasion
  2223.       end
  2224.     end
  2225.   end

  2226.   #--------------------------------------------------------------------------
  2227.   # overwrite method: display_hp_damage
  2228.   #--------------------------------------------------------------------------
  2229.   def display_hp_damage(target, item)
  2230.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  2231.     if target.result.hp_damage > 0 && target.result.hp_drain == 0
  2232.       target.perform_damage_effect
  2233.     end
  2234.     Sound.play_recovery if target.result.hp_damage < 0
  2235.     return unless YEA::BATTLE::MSG_HP_DAMAGE
  2236.     add_text(target.result.hp_damage_text)
  2237.     wait
  2238.   end

  2239.   #--------------------------------------------------------------------------
  2240.   # overwrite method: display_mp_damage
  2241.   #--------------------------------------------------------------------------
  2242.   def display_mp_damage(target, item)
  2243.     return if target.dead? || target.result.mp_damage == 0
  2244.     Sound.play_recovery if target.result.mp_damage < 0
  2245.     return unless YEA::BATTLE::MSG_MP_DAMAGE
  2246.     add_text(target.result.mp_damage_text)
  2247.     wait
  2248.   end

  2249.   #--------------------------------------------------------------------------
  2250.   # overwrite method: display_tp_damage
  2251.   #--------------------------------------------------------------------------
  2252.   def display_tp_damage(target, item)
  2253.     return if target.dead? || target.result.tp_damage == 0
  2254.     Sound.play_recovery if target.result.tp_damage < 0
  2255.     return unless YEA::BATTLE::MSG_TP_DAMAGE
  2256.     add_text(target.result.tp_damage_text)
  2257.     wait
  2258.   end

  2259.   #--------------------------------------------------------------------------
  2260.   # alias method: display_added_states
  2261.   #--------------------------------------------------------------------------
  2262.   alias window_battlelog_display_added_states_abe display_added_states
  2263.   def display_added_states(target)
  2264.     return unless YEA::BATTLE::MSG_ADDED_STATES
  2265.     window_battlelog_display_added_states_abe(target)
  2266.   end

  2267.   #--------------------------------------------------------------------------
  2268.   # alias method: display_removed_states
  2269.   #--------------------------------------------------------------------------
  2270.   alias window_battlelog_display_removed_states_abe display_removed_states
  2271.   def display_removed_states(target)
  2272.     return unless YEA::BATTLE::MSG_REMOVED_STATES
  2273.     window_battlelog_display_removed_states_abe(target)
  2274.   end

  2275.   #--------------------------------------------------------------------------
  2276.   # alias method: display_changed_buffs
  2277.   #--------------------------------------------------------------------------
  2278.   alias window_battlelog_display_changed_buffs_abe display_changed_buffs
  2279.   def display_changed_buffs(target)
  2280.     return unless YEA::BATTLE::MSG_CHANGED_BUFFS
  2281.     window_battlelog_display_changed_buffs_abe(target)
  2282.   end

  2283. end # Window_BattleLog

  2284. #==============================================================================
  2285. # ■ Window_SkillList
  2286. #==============================================================================

  2287. class Window_SkillList < Window_Selectable

  2288.   #--------------------------------------------------------------------------
  2289.   # overwrite method: spacing
  2290.   #--------------------------------------------------------------------------
  2291.   def spacing
  2292.     return 8 if $game_party.in_battle
  2293.     return super
  2294.   end

  2295. end # Window_SkillList

  2296. #==============================================================================
  2297. # ■ Window_ItemList
  2298. #==============================================================================

  2299. class Window_ItemList < Window_Selectable

  2300.   #--------------------------------------------------------------------------
  2301.   # overwrite method: spacing
  2302.   #--------------------------------------------------------------------------
  2303.   def spacing
  2304.     return 8 if $game_party.in_battle
  2305.     return super
  2306.   end

  2307. end # Window_ItemList

  2308. #==============================================================================
  2309. # ■ Scene_Battle
  2310. #==============================================================================

  2311. class Scene_Battle < Scene_Base

  2312.   #--------------------------------------------------------------------------
  2313.   # public instance variables
  2314.   #--------------------------------------------------------------------------
  2315.   attr_accessor :enemy_window
  2316.   attr_accessor :info_viewport
  2317.   attr_accessor :spriteset
  2318.   attr_accessor :status_window
  2319.   attr_accessor :status_aid_window
  2320.   attr_accessor :subject

  2321.   #--------------------------------------------------------------------------
  2322.   # alias method: create_spriteset
  2323.   #--------------------------------------------------------------------------
  2324.   alias scene_battle_create_spriteset_abe create_spriteset
  2325.   def create_spriteset
  2326.     BattleManager.init_battle_type
  2327.     scene_battle_create_spriteset_abe
  2328.   end

  2329.   #--------------------------------------------------------------------------
  2330.   # alias method: update_basic
  2331.   #--------------------------------------------------------------------------
  2332.   alias scene_battle_update_basic_abe update_basic
  2333.   def update_basic
  2334.     scene_battle_update_basic_abe
  2335.     update_debug
  2336.   end

  2337.   #--------------------------------------------------------------------------
  2338.   # new method: update_debug
  2339.   #--------------------------------------------------------------------------
  2340.   def update_debug
  2341.     return unless $TEST || $BTEST
  2342.     debug_heal_party if Input.trigger?(:F5)
  2343.     debug_damage_party if Input.trigger?(:F6)
  2344.     debug_fill_tp if Input.trigger?(:F7)
  2345.     debug_kill_all if Input.trigger?(:F8)
  2346.   end

  2347.   #--------------------------------------------------------------------------
  2348.   # new method: debug_heal_party
  2349.   #--------------------------------------------------------------------------
  2350.   def debug_heal_party
  2351.     Sound.play_recovery
  2352.     for member in $game_party.battle_members
  2353.       member.recover_all
  2354.     end
  2355.     @status_window.refresh
  2356.   end

  2357.   #--------------------------------------------------------------------------
  2358.   # new method: debug_damage_party
  2359.   #--------------------------------------------------------------------------
  2360.   def debug_damage_party
  2361.     Sound.play_actor_damage
  2362.     for member in $game_party.alive_members
  2363.       member.hp = 1
  2364.       member.mp = 0
  2365.       member.tp = 0
  2366.     end
  2367.     @status_window.refresh
  2368.   end

  2369.   #--------------------------------------------------------------------------
  2370.   # new method: debug_fill_tp
  2371.   #--------------------------------------------------------------------------
  2372.   def debug_fill_tp
  2373.     Sound.play_recovery
  2374.     for member in $game_party.alive_members
  2375.       member.tp = member.max_tp
  2376.     end
  2377.     @status_window.refresh
  2378.   end

  2379.   #--------------------------------------------------------------------------
  2380.   # new method: debug_kill_all
  2381.   #--------------------------------------------------------------------------
  2382.   def debug_kill_all
  2383.     for enemy in $game_troop.alive_members
  2384.       enemy.hp = 0
  2385.       enemy.perform_collapse_effect
  2386.     end
  2387.     BattleManager.judge_win_loss
  2388.     @log_window.wait
  2389.     @log_window.wait_for_effect
  2390.   end

  2391.   #--------------------------------------------------------------------------
  2392.   # alias method: create_all_windows
  2393.   #--------------------------------------------------------------------------
  2394.   alias scene_battle_create_all_windows_abe create_all_windows
  2395.   def create_all_windows
  2396.     scene_battle_create_all_windows_abe
  2397.     create_battle_status_aid_window
  2398.     set_help_window
  2399.   end

  2400.   #--------------------------------------------------------------------------
  2401.   # alias method: create_info_viewport
  2402.   #--------------------------------------------------------------------------
  2403.   alias scene_battle_create_info_viewport_abe create_info_viewport
  2404.   def create_info_viewport
  2405.     scene_battle_create_info_viewport_abe
  2406.     @status_window.refresh
  2407.   end

  2408.   #--------------------------------------------------------------------------
  2409.   # new method: create_battle_status_aid_window
  2410.   #--------------------------------------------------------------------------
  2411.   def create_battle_status_aid_window
  2412.     @status_aid_window = Window_BattleStatusAid.new
  2413.     @status_aid_window.status_window = @status_window
  2414.     @status_aid_window.x = Graphics.width - @status_aid_window.width
  2415.     @status_aid_window.y = Graphics.height - @status_aid_window.height
  2416.   end

  2417.   #--------------------------------------------------------------------------
  2418.   # overwrite method: create_help_window
  2419.   #--------------------------------------------------------------------------
  2420.   def create_help_window
  2421.     @help_window = Window_BattleHelp.new
  2422.     @help_window.hide
  2423.   end

  2424.   #--------------------------------------------------------------------------
  2425.   # new method: set_help_window
  2426.   #--------------------------------------------------------------------------
  2427.   def set_help_window
  2428.     @help_window.actor_window = @actor_window
  2429.     @help_window.enemy_window = @enemy_window
  2430.   end

  2431.   #--------------------------------------------------------------------------
  2432.   # alias method: create_party_command_window
  2433.   #--------------------------------------------------------------------------
  2434.   alias scene_battle_create_party_command_window_abe create_party_command_window
  2435.   def create_party_command_window
  2436.     scene_battle_create_party_command_window_abe
  2437.     @party_command_window.set_handler(:dir6, method(:command_fight))
  2438.   end

  2439.   #--------------------------------------------------------------------------
  2440.   # alias method: create_actor_command_window
  2441.   #--------------------------------------------------------------------------
  2442.   alias scene_battle_create_actor_command_window_abe create_actor_command_window
  2443.   def create_actor_command_window
  2444.     scene_battle_create_actor_command_window_abe
  2445.     @actor_command_window.set_handler(:dir4, method(:prior_command))
  2446.     @actor_command_window.set_handler(:dir6, method(:next_command))
  2447.   end

  2448.   #--------------------------------------------------------------------------
  2449.   # alias method: create_skill_window
  2450.   #--------------------------------------------------------------------------
  2451.   alias scene_battle_create_skill_window_abe create_skill_window
  2452.   def create_skill_window
  2453.     scene_battle_create_skill_window_abe
  2454.     @skill_window.height = @info_viewport.rect.height
  2455.     @skill_window.width = Graphics.width - @actor_command_window.width
  2456.     @skill_window.y = Graphics.height - @skill_window.height
  2457.   end

  2458.   #--------------------------------------------------------------------------
  2459.   # alias method: create_item_window
  2460.   #--------------------------------------------------------------------------
  2461.   alias scene_battle_create_item_window_abe create_item_window
  2462.   def create_item_window
  2463.     scene_battle_create_item_window_abe
  2464.     @item_window.height = @skill_window.height
  2465.     @item_window.width = @skill_window.width
  2466.     @item_window.y = Graphics.height - @item_window.height
  2467.   end

  2468.   #--------------------------------------------------------------------------
  2469.   # alias method: show_fast?
  2470.   #--------------------------------------------------------------------------
  2471.   alias scene_battle_show_fast_abe show_fast?
  2472.   def show_fast?
  2473.     return true if YEA::BATTLE::AUTO_FAST
  2474.     return scene_battle_show_fast_abe
  2475.   end

  2476.   #--------------------------------------------------------------------------
  2477.   # alias method: next_command
  2478.   #--------------------------------------------------------------------------
  2479.   alias scene_battle_next_command_abe next_command
  2480.   def next_command
  2481.     @status_window.show
  2482.     redraw_current_status
  2483.     @actor_command_window.show
  2484.     @status_aid_window.hide
  2485.     scene_battle_next_command_abe
  2486.   end

  2487.   #--------------------------------------------------------------------------
  2488.   # alias method: prior_command
  2489.   #--------------------------------------------------------------------------
  2490.   alias scene_battle_prior_command_abe prior_command
  2491.   def prior_command
  2492.     redraw_current_status
  2493.     scene_battle_prior_command_abe
  2494.   end

  2495.   #--------------------------------------------------------------------------
  2496.   # new method: redraw_current_status
  2497.   #--------------------------------------------------------------------------
  2498.   def redraw_current_status
  2499.     return if @status_window.index < 0
  2500.     @status_window.draw_item(@status_window.index)
  2501.   end

  2502.   #--------------------------------------------------------------------------
  2503.   # alias method: command_attack
  2504.   #--------------------------------------------------------------------------
  2505.   alias scene_battle_command_attack_abe command_attack
  2506.   def command_attack
  2507.     $game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
  2508.     scene_battle_command_attack_abe
  2509.   end

  2510.   #--------------------------------------------------------------------------
  2511.   # alias method: command_skill
  2512.   #--------------------------------------------------------------------------
  2513.   alias scene_battle_command_skill_abe command_skill
  2514.   def command_skill
  2515.     scene_battle_command_skill_abe
  2516.     @status_window.hide
  2517.     @actor_command_window.hide
  2518.     @status_aid_window.show
  2519.   end

  2520.   #--------------------------------------------------------------------------
  2521.   # alias method: command_item
  2522.   #--------------------------------------------------------------------------
  2523.   alias scene_battle_command_item_abe command_item
  2524.   def command_item
  2525.     scene_battle_command_item_abe
  2526.     @status_window.hide
  2527.     @actor_command_window.hide
  2528.     @status_aid_window.show
  2529.   end

  2530.   #--------------------------------------------------------------------------
  2531.   # overwrite method: on_skill_ok
  2532.   #--------------------------------------------------------------------------
  2533.   def on_skill_ok
  2534.     @skill = @skill_window.item
  2535.     $game_temp.battle_aid = @skill
  2536.     BattleManager.actor.input.set_skill(@skill.id)
  2537.     BattleManager.actor.last_skill.object = @skill
  2538.     if @skill.for_opponent?
  2539.       select_enemy_selection
  2540.     elsif @skill.for_friend?
  2541.       select_actor_selection
  2542.     else
  2543.       @skill_window.hide
  2544.       next_command
  2545.       $game_temp.battle_aid = nil
  2546.     end
  2547.   end

  2548.   #--------------------------------------------------------------------------
  2549.   # alias method: on_skill_cancel
  2550.   #--------------------------------------------------------------------------
  2551.   alias scene_battle_on_skill_cancel_abe on_skill_cancel
  2552.   def on_skill_cancel
  2553.     scene_battle_on_skill_cancel_abe
  2554.     @status_window.show
  2555.     @actor_command_window.show
  2556.     @status_aid_window.hide
  2557.   end

  2558.   #--------------------------------------------------------------------------
  2559.   # overwrite method: on_item_ok
  2560.   #--------------------------------------------------------------------------
  2561.   def on_item_ok
  2562.     @item = @item_window.item
  2563.     $game_temp.battle_aid = @item
  2564.     BattleManager.actor.input.set_item(@item.id)
  2565.     if @item.for_opponent?
  2566.       select_enemy_selection
  2567.     elsif @item.for_friend?
  2568.       select_actor_selection
  2569.     else
  2570.       @item_window.hide
  2571.       next_command
  2572.       $game_temp.battle_aid = nil
  2573.     end
  2574.     $game_party.last_item.object = @item
  2575.   end

  2576.   #--------------------------------------------------------------------------
  2577.   # alias method: on_item_cancel
  2578.   #--------------------------------------------------------------------------
  2579.   alias scene_battle_on_item_cancel_abe on_item_cancel
  2580.   def on_item_cancel
  2581.     scene_battle_on_item_cancel_abe
  2582.     @status_window.show
  2583.     @actor_command_window.show
  2584.     @status_aid_window.hide
  2585.   end

  2586.   #--------------------------------------------------------------------------
  2587.   # alias method: select_actor_selection
  2588.   #--------------------------------------------------------------------------
  2589.   alias scene_battle_select_actor_selection_abe select_actor_selection
  2590.   def select_actor_selection
  2591.     @status_aid_window.refresh
  2592.     scene_battle_select_actor_selection_abe
  2593.     @status_window.hide
  2594.     @skill_window.hide
  2595.     @item_window.hide
  2596.     @help_window.show
  2597.   end

  2598.   #--------------------------------------------------------------------------
  2599.   # alias method: on_actor_ok
  2600.   #--------------------------------------------------------------------------
  2601.   alias scene_battle_on_actor_ok_abe on_actor_ok
  2602.   def on_actor_ok
  2603.     $game_temp.battle_aid = nil
  2604.     scene_battle_on_actor_ok_abe
  2605.     @status_window.show
  2606.     if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
  2607.       @actor_command_window.visible = !@confirm_command_window.visible
  2608.     else
  2609.       @actor_command_window.show
  2610.     end
  2611.     @status_aid_window.hide
  2612.   end

  2613.   #--------------------------------------------------------------------------
  2614.   # alias method: on_actor_cancel
  2615.   #--------------------------------------------------------------------------
  2616.   alias scene_battle_on_actor_cancel_abe on_actor_cancel
  2617.   def on_actor_cancel
  2618.     BattleManager.actor.input.clear
  2619.     @status_aid_window.refresh
  2620.     $game_temp.battle_aid = nil
  2621.     scene_battle_on_actor_cancel_abe
  2622.     case @actor_command_window.current_symbol
  2623.     when :skill
  2624.       @skill_window.show
  2625.     when :item
  2626.       @item_window.show
  2627.     end
  2628.   end

  2629.   #--------------------------------------------------------------------------
  2630.   # alias method: select_enemy_selection
  2631.   #--------------------------------------------------------------------------
  2632.   alias scene_battle_select_enemy_selection_abe select_enemy_selection
  2633.   def select_enemy_selection
  2634.     @status_aid_window.refresh
  2635.     scene_battle_select_enemy_selection_abe
  2636.     @help_window.show
  2637.   end
  2638.   #--------------------------------------------------------------------------
  2639.   # alias method: on_enemy_ok
  2640.   #--------------------------------------------------------------------------
  2641.   alias scene_battle_on_enemy_ok_abe on_enemy_ok
  2642.   def on_enemy_ok
  2643.     $game_temp.battle_aid = nil
  2644.     scene_battle_on_enemy_ok_abe
  2645.   end

  2646.   #--------------------------------------------------------------------------
  2647.   # alias method: on_enemy_cancel
  2648.   #--------------------------------------------------------------------------
  2649.   alias scene_battle_on_enemy_cancel_abe on_enemy_cancel
  2650.   def on_enemy_cancel
  2651.     BattleManager.actor.input.clear
  2652.     @status_aid_window.refresh
  2653.     $game_temp.battle_aid = nil
  2654.     scene_battle_on_enemy_cancel_abe
  2655.     if @skill_window.visible || @item_window.visible
  2656.       @help_window.show
  2657.     else
  2658.       @help_window.hide
  2659.     end
  2660.   end

  2661.   #--------------------------------------------------------------------------
  2662.   # alias method: battle_start
  2663.   #--------------------------------------------------------------------------
  2664.   alias scene_battle_battle_start_abe battle_start
  2665.   def battle_start
  2666.     scene_battle_battle_start_abe
  2667.     return unless YEA::BATTLE::SKIP_PARTY_COMMAND
  2668.     @party_command_window.deactivate
  2669.     if BattleManager.input_start
  2670.       command_fight
  2671.     else
  2672.       turn_start
  2673.     end
  2674.   end

  2675.   #--------------------------------------------------------------------------
  2676.   # overwrite method: turn_end
  2677.   #--------------------------------------------------------------------------
  2678.   def turn_end
  2679.     all_battle_members.each do |battler|
  2680.       battler.on_turn_end
  2681.       status_redraw_target(battler)
  2682.       @log_window.display_auto_affected_status(battler)
  2683.       @log_window.wait_and_clear
  2684.     end
  2685.     update_party_cooldowns if $imported["YEA-CommandParty"]
  2686.     BattleManager.turn_end
  2687.     process_event
  2688.     start_party_command_selection
  2689.     return unless YEA::BATTLE::SKIP_PARTY_COMMAND
  2690.     if BattleManager.input_start
  2691.       @party_command_window.deactivate
  2692.       command_fight
  2693.     else
  2694.       @party_command_window.deactivate
  2695.       turn_start
  2696.     end
  2697.   end

  2698.   #--------------------------------------------------------------------------
  2699.   # overwrite method: execute_action
  2700.   #--------------------------------------------------------------------------
  2701.   def execute_action
  2702.     @subject.sprite_effect_type = :whiten if YEA::BATTLE::FLASH_WHITE_EFFECT
  2703.     use_item
  2704.     @log_window.wait_and_clear
  2705.   end

  2706.   #--------------------------------------------------------------------------
  2707.   # overwrite method: apply_item_effects
  2708.   #--------------------------------------------------------------------------
  2709.   def apply_item_effects(target, item)
  2710.     if $imported["YEA-LunaticObjects"]
  2711.       lunatic_object_effect(:prepare, item, @subject, target)
  2712.     end
  2713.     target.item_apply(@subject, item)
  2714.     status_redraw_target(@subject)
  2715.     status_redraw_target(target) unless target == @subject
  2716.     @log_window.display_action_results(target, item)
  2717.     if $imported["YEA-LunaticObjects"]
  2718.       lunatic_object_effect(:during, item, @subject, target)
  2719.     end
  2720.     perform_collapse_check(target)
  2721.   end

  2722.   #--------------------------------------------------------------------------
  2723.   # overwite method: invoke_counter_attack
  2724.   #--------------------------------------------------------------------------
  2725.   def invoke_counter_attack(target, item)
  2726.     @log_window.display_counter(target, item)
  2727.     attack_skill = $data_skills[target.attack_skill_id]
  2728.     @subject.item_apply(target, attack_skill)
  2729.     status_redraw_target(@subject)
  2730.     status_redraw_target(target) unless target == @subject
  2731.     @log_window.display_action_results(@subject, attack_skill)
  2732.     perform_collapse_check(target)
  2733.     perform_collapse_check(@subject)
  2734.   end

  2735.   #--------------------------------------------------------------------------
  2736.   # new method: perform_collapse_check
  2737.   #--------------------------------------------------------------------------
  2738.   def perform_collapse_check(target)
  2739.     return if YEA::BATTLE::MSG_ADDED_STATES
  2740.     target.perform_collapse_effect if target.can_collapse?
  2741.     @log_window.wait
  2742.     @log_window.wait_for_effect
  2743.   end

  2744.   #--------------------------------------------------------------------------
  2745.   # overwrite method: show_attack_animation
  2746.   #--------------------------------------------------------------------------
  2747.   def show_attack_animation(targets)
  2748.     show_normal_animation(targets, @subject.atk_animation_id1, false)
  2749.     wait_for_animation
  2750.     show_normal_animation(targets, @subject.atk_animation_id2, true)
  2751.   end

  2752.   #--------------------------------------------------------------------------
  2753.   # overwrite method: show_normal_animation
  2754.   #--------------------------------------------------------------------------
  2755.   def show_normal_animation(targets, animation_id, mirror = false)
  2756.     animation = $data_animations[animation_id]
  2757.     return if animation.nil?
  2758.     ani_check = false
  2759.     if targets != nil
  2760.     targets.each do |target|
  2761.       if ani_check && target.animation_id <= 0
  2762.         target.pseudo_ani_id = animation_id
  2763.       else
  2764.         target.animation_id = animation_id
  2765.       end
  2766.       target.animation_mirror = mirror
  2767.       ani_check = true if animation.to_screen?
  2768.     end
  2769.     end
  2770.   end

  2771.   #--------------------------------------------------------------------------
  2772.   # overwrite method: process_action_end
  2773.   #--------------------------------------------------------------------------
  2774.   def process_action_end
  2775.     @subject.on_action_end
  2776.     status_redraw_target(@subject)
  2777.     @log_window.display_auto_affected_status(@subject)
  2778.     @log_window.wait_and_clear
  2779.     @log_window.display_current_state(@subject)
  2780.     @log_window.wait_and_clear
  2781.     BattleManager.judge_win_loss
  2782.   end

  2783.   #--------------------------------------------------------------------------
  2784.   # overwrite method: use_item
  2785.   #--------------------------------------------------------------------------
  2786.   def use_item
  2787.     item = @subject.current_action.item
  2788.     @log_window.display_use_item(@subject, item)
  2789.     @subject.use_item(item)
  2790.     status_redraw_target(@subject)
  2791.     if $imported["YEA-LunaticObjects"]
  2792.       lunatic_object_effect(:before, item, @subject, @subject)
  2793.     end
  2794.     process_casting_animation if $imported["YEA-CastAnimations"]
  2795.     targets = @subject.current_action.make_targets.compact rescue []
  2796.     show_animation(targets, item.animation_id) if show_all_animation?(item)
  2797.     targets.each {|target|
  2798.       if $imported["YEA-TargetManager"]
  2799.         target = alive_random_target(target, item) if item.for_random?
  2800.       end
  2801.       item.repeats.times { invoke_item(target, item) } }
  2802.     if $imported["YEA-LunaticObjects"]
  2803.       lunatic_object_effect(:after, item, @subject, @subject)
  2804.     end
  2805.   end

  2806.   #--------------------------------------------------------------------------
  2807.   # alias method: invoke_item
  2808.   #--------------------------------------------------------------------------
  2809.   alias scene_battle_invoke_item_abe invoke_item
  2810.   def invoke_item(target, item)
  2811.     show_animation([target], item.animation_id) if separate_ani?(target, item)
  2812.     #if target.dead? != item.for_dead_friend?
  2813.     #  @subject.last_target_index = target.index
  2814.     #  return
  2815.     #end
  2816.     scene_battle_invoke_item_abe(target, item)
  2817.   end

  2818.   #--------------------------------------------------------------------------
  2819.   # new method: show_all_animation?
  2820.   #--------------------------------------------------------------------------
  2821.   def show_all_animation?(item)
  2822.     return true if item.one_animation
  2823.     return false if $data_animations[item.animation_id].nil?
  2824.     return false unless $data_animations[item.animation_id].to_screen?
  2825.     return true
  2826.   end

  2827.   #--------------------------------------------------------------------------
  2828.   # new method: separate_ani?
  2829.   #--------------------------------------------------------------------------
  2830.   def separate_ani?(target, item)
  2831.     #return false if item.one_animation
  2832.     #return false if $data_animations[item.animation_id].nil?
  2833.     #return false if $data_animations[item.animation_id].to_screen?
  2834.     #return target.dead? == item.for_dead_friend?
  2835.     return false
  2836.   end

  2837.   #--------------------------------------------------------------------------
  2838.   # new method: status_redraw_target
  2839.   #--------------------------------------------------------------------------
  2840.   def status_redraw_target(target)
  2841.     return unless target.actor?
  2842.     @status_window.draw_item($game_party.battle_members.index(target))
  2843.   end

  2844.   #--------------------------------------------------------------------------
  2845.   # alias method: start_party_command_selection
  2846.   #--------------------------------------------------------------------------
  2847.   alias start_party_command_selection_abe start_party_command_selection
  2848.   def start_party_command_selection
  2849.     @status_window.refresh unless scene_changing?
  2850.     start_party_command_selection_abe
  2851.   end

  2852.   #--------------------------------------------------------------------------
  2853.   # overwrite method: refresh_status
  2854.   #--------------------------------------------------------------------------
  2855.   def refresh_status; return; end

  2856.   #--------------------------------------------------------------------------
  2857.   # new method: refresh_autobattler_status_window
  2858.   #--------------------------------------------------------------------------
  2859.   def refresh_autobattler_status_window
  2860.     for member in $game_party.battle_members
  2861.       next unless member.auto_battle?
  2862.       @status_window.draw_item(member.index)
  2863.     end
  2864.   end

  2865.   #--------------------------------------------------------------------------
  2866.   # new method: hide_extra_gauges
  2867.   #--------------------------------------------------------------------------
  2868.   def hide_extra_gauges
  2869.     # Made for compatibility
  2870.   end

  2871.   #--------------------------------------------------------------------------
  2872.   # new method: show_extra_gauges
  2873.   #--------------------------------------------------------------------------
  2874.   def show_extra_gauges
  2875.     # Made for compatibility
  2876.   end

  2877. end # Scene_Battle

  2878. #==============================================================================
  2879. #
  2880. # ▼ End of File
  2881. #
  2882. #==============================================================================
复制代码


未命名.PNG

评分

参与人数 1梦石 +1 收起 理由
Sion + 1 认可答案

查看全部评分

回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部