设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 691|回复: 0
打印 上一主题 下一主题

[已经过期] YEA战斗脚本的一些问题……

[复制链接]

Lv1.梦旅人

梦石
0
星屑
70
在线时间
1083 小时
注册时间
2013-3-29
帖子
2394
跳转到指定楼层
1
发表于 2015-6-8 21:14:44 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
是这样的:
第一个回合选择技能 魔法的时候:

过了一个回合:

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

坑的进度如上                                                                                                        点击↑
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-12-1 15:12

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表