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

Project1

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

[转载] Charge Turn Battle已经放出【3楼】

[复制链接]
头像被屏蔽

Lv1.梦旅人

梦石
0
星屑
49
在线时间
88 小时
注册时间
2011-12-17
帖子
281
跳转到指定楼层
1
发表于 2012-1-30 10:44:03 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽

Lv1.梦旅人

梦石
0
星屑
66
在线时间
434 小时
注册时间
2006-5-25
帖子
201
2
发表于 2012-1-30 23:40:02 | 只看该作者
LZ的脚本呢?去哪里了?被删了还是怎么样?
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

名侦探小柯

梦石
0
星屑
3263
在线时间
3616 小时
注册时间
2006-9-6
帖子
37399

开拓者贵宾第3届短篇游戏大赛主流游戏组亚军第5届短篇游戏比赛亚军

3
发表于 2012-1-30 23:54:58 | 只看该作者
以下摘自LZ:

Yami虽然神隐了,但是CTB还是留下了。先发一下站下坑,待会我处理成完整脚本
http://yamiworld.wordpress.com
  1. =begin
  2. To have enemies play different attack animations, use the following notetags:
  3. <atk ani 1: x>
  4. <atk ani 2: x>
  5. #放在敌人身上表示敌人行动动画
  6. If you want status effects to use different popup rules,
  7. use the following notetags:

  8. <popup add: string>
  9. <popup rem: string>
  10. <popup dur: string>
  11. Status effects now create popups whenever they’re inflicted.
  12. However, if you don’t like that a certain status effect uses
  13. a particular colour setting, change “string” to one of the
  14. rulesets below to cause that popup to use a different ruleset.

  15. <popup hide add>
  16. <popup hide rem>
  17. <popup hide dur>
  18. Not everybody wants status effects to show popups when inflicted.
  19. When this is the case, insert the respective tag to hide popups from
  20. appearing when the state is added, removed, or during the stand-by phases.
  21. #以上不实用。
  22. =end
  23. #==============================================================================
  24. #
  25. # ▼ Yanfly Engine Ace - Ace Battle Engine v1.19
  26. # -- Last Updated: 2012.01.29
  27. # -- Level: Normal, Hard
  28. # -- Requires: n/a
  29. #
  30. #==============================================================================

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

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

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

  398. #==============================================================================
  399. # ▼ Editting anything past this point may potentially result in causing
  400. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  401. # halitosis so edit at your own risk.
  402. #==============================================================================

  403. module YEA
  404.   module REGEXP
  405.   module ENEMY
  406.    
  407.     ATK_ANI1 = /<(?:ATK_ANI_1|atk ani 1):[ ]*(\d+)>/i
  408.     ATK_ANI2 = /<(?:ATK_ANI_2|atk ani 2):[ ]*(\d+)>/i
  409.    
  410.   end # ENEMY
  411.   module USABLEITEM
  412.    
  413.     ONE_ANIMATION = /<(?:ONE_ANIMATION|one animation)>/i
  414.    
  415.   end # USABLEITEM
  416.   module STATE
  417.    
  418.     POPUP_ADD = /<(?:POPUP_ADD_RULE|popup add rule|popup add):[ ](.*)>/i
  419.     POPUP_REM = /<(?:POPUP_REM_RULE|popup rem rule|popup rem):[ ](.*)>/i
  420.     POPUP_DUR = /<(?:POPUP_DUR_RULE|popup dur rule|popup dur):[ ](.*)>/i
  421.    
  422.     HIDE_ADD  = /<(?:POPUP_HIDE_ADD|popup hide add|hide add)>/i
  423.     HIDE_REM  = /<(?:POPUP_HIDE_REM|popup hide rem|hide rem)>/i
  424.     HIDE_DUR  = /<(?:POPUP_HIDE_DUR|popup hide dur|hide dur)>/i
  425.    
  426.   end # STATE
  427.   end # REGEXP
  428. end # YEA

  429. #==============================================================================
  430. # ■ Switch
  431. #==============================================================================

  432. module Switch
  433.   
  434.   #--------------------------------------------------------------------------
  435.   # self.hide_popups
  436.   #--------------------------------------------------------------------------
  437.   def self.hide_popups
  438.     return false if YEA::BATTLE::HIDE_POPUP_SWITCH <= 0
  439.     return $game_switches[YEA::BATTLE::HIDE_POPUP_SWITCH]
  440.   end
  441.   
  442. end # Switch

  443. #==============================================================================
  444. # ■ Colour
  445. #==============================================================================

  446. module Colour
  447.   
  448.   #--------------------------------------------------------------------------
  449.   # self.text_colour
  450.   #--------------------------------------------------------------------------
  451.   def self.text_colour(index)
  452.     windowskin = Cache.system("Window")
  453.     x = 64 + (index % 8) * 8
  454.     y = 96 + (index / 8) * 8
  455.     return windowskin.get_pixel(x, y)
  456.   end
  457.   
  458. end # Colour

  459. #==============================================================================
  460. # ■ Icon
  461. #==============================================================================

  462. module Icon
  463.   
  464.   #--------------------------------------------------------------------------
  465.   # self.no_action
  466.   #--------------------------------------------------------------------------
  467.   def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
  468.    
  469. end # Icon

  470. #==============================================================================
  471. # ■ Numeric
  472. #==============================================================================

  473. class Numeric
  474.   
  475.   #--------------------------------------------------------------------------
  476.   # new method: group_digits
  477.   #--------------------------------------------------------------------------
  478.   unless $imported["YEA-CoreEngine"]
  479.   def group; return self.to_s; end
  480.   end # $imported["YEA-CoreEngine"]
  481.    
  482. end # Numeric

  483. #==============================================================================
  484. # ■ DataManager
  485. #==============================================================================

  486. module DataManager
  487.   
  488.   #--------------------------------------------------------------------------
  489.   # alias method: load_database
  490.   #--------------------------------------------------------------------------
  491.   class <<self; alias load_database_abe load_database; end
  492.   def self.load_database
  493.     load_database_abe
  494.     load_notetags_abe
  495.   end
  496.   
  497.   #--------------------------------------------------------------------------
  498.   # new method: load_notetags_abe
  499.   #--------------------------------------------------------------------------
  500.   def self.load_notetags_abe
  501.     groups = [$data_enemies, $data_states, $data_skills, $data_items]
  502.     for group in groups
  503.       for obj in group
  504.         next if obj.nil?
  505.         obj.load_notetags_abe
  506.       end
  507.     end
  508.   end
  509.   
  510. end # DataManager

  511. #==============================================================================
  512. # ■ RPG::UsableItem
  513. #==============================================================================

  514. class RPG::UsableItem < RPG::BaseItem
  515.   
  516.   #--------------------------------------------------------------------------
  517.   # public instance variables
  518.   #--------------------------------------------------------------------------
  519.   attr_accessor :one_animation
  520.   
  521.   #--------------------------------------------------------------------------
  522.   # common cache: load_notetags_abe
  523.   #--------------------------------------------------------------------------
  524.   def load_notetags_abe
  525.     @one_animation = false
  526.     #---
  527.     self.note.split(/[\r\n]+/).each { |line|
  528.       case line
  529.       #---
  530.       when YEA::REGEXP::USABLEITEM::ONE_ANIMATION
  531.         @one_animation = true
  532.       end
  533.     } # self.note.split
  534.     #---
  535.   end
  536.   
  537. end # RPG::UsableItem

  538. #==============================================================================
  539. # ■ RPG::Enemy
  540. #==============================================================================

  541. class RPG::Enemy < RPG::BaseItem
  542.   
  543.   #--------------------------------------------------------------------------
  544.   # public instance variables
  545.   #--------------------------------------------------------------------------
  546.   attr_accessor :atk_animation_id1
  547.   attr_accessor :atk_animation_id2
  548.   
  549.   #--------------------------------------------------------------------------
  550.   # common cache: load_notetags_abe
  551.   #--------------------------------------------------------------------------
  552.   def load_notetags_abe
  553.     @atk_animation_id1 = YEA::BATTLE::ENEMY_ATK_ANI
  554.     @atk_animation_id2 = 0
  555.     #---
  556.     self.note.split(/[\r\n]+/).each { |line|
  557.       case line
  558.       #---
  559.       when YEA::REGEXP::ENEMY::ATK_ANI1
  560.         @atk_animation_id1 = $1.to_i
  561.       when YEA::REGEXP::ENEMY::ATK_ANI2
  562.         @atk_animation_id2 = $1.to_i
  563.       end
  564.     } # self.note.split
  565.     #---
  566.   end
  567.   
  568. end # RPG::Enemy

  569. #==============================================================================
  570. # ■ RPG::Enemy
  571. #==============================================================================

  572. class RPG::State < RPG::BaseItem
  573.   
  574.   #--------------------------------------------------------------------------
  575.   # public instance variables
  576.   #--------------------------------------------------------------------------
  577.   attr_accessor :popup_rules
  578.   
  579.   #--------------------------------------------------------------------------
  580.   # common cache: load_notetags_abe
  581.   #--------------------------------------------------------------------------
  582.   def load_notetags_abe
  583.     @popup_rules = {
  584.       :add_state => "ADDSTATE",
  585.       :rem_state => "REMSTATE",
  586.       :dur_state => nil
  587.     } # Do not remove this.
  588.     #---
  589.     self.note.split(/[\r\n]+/).each { |line|
  590.       case line
  591.       #---
  592.       when YEA::REGEXP::STATE::POPUP_ADD
  593.         @popup_rules[:add_state] = $1.upcase.to_s
  594.       when YEA::REGEXP::STATE::POPUP_REM
  595.         @popup_rules[:rem_state] = $1.upcase.to_s
  596.       when YEA::REGEXP::STATE::POPUP_DUR
  597.         @popup_rules[:dur_state] = $1.upcase.to_s
  598.       when YEA::REGEXP::STATE::HIDE_ADD
  599.         @popup_rules[:add_state] = nil
  600.       when YEA::REGEXP::STATE::HIDE_REM
  601.         @popup_rules[:rem_state] = nil
  602.       when YEA::REGEXP::STATE::HIDE_DUR
  603.         @popup_rules[:dur_state] = nil
  604.       end
  605.     } # self.note.split
  606.     #---
  607.   end
  608.   
  609. end # RPG::State

  610. #==============================================================================
  611. # ■ BattleManager
  612. #==============================================================================

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

  732. #==============================================================================
  733. # ■ Game_System
  734. #==============================================================================

  735. class Game_System
  736.   
  737.   #--------------------------------------------------------------------------
  738.   # new method: battle_system
  739.   #--------------------------------------------------------------------------
  740.   def battle_system
  741.     if @battle_system.nil?
  742.       return battle_system_corrected(YEA::BATTLE::DEFAULT_BATTLE_SYSTEM)
  743.     else
  744.       return battle_system_corrected(@battle_system)
  745.     end
  746.   end
  747.   
  748.   #--------------------------------------------------------------------------
  749.   # new method: set_battle_system
  750.   #--------------------------------------------------------------------------
  751.   def set_battle_system(type)
  752.     case type
  753.     when :dtb; @battle_system = :dtb
  754.     when :ftb; @battle_system = $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  755.     else;      @battle_system = :dtb
  756.     end
  757.   end
  758.   
  759.   #--------------------------------------------------------------------------
  760.   # new method: battle_system_corrected
  761.   #--------------------------------------------------------------------------
  762.   def battle_system_corrected(type)
  763.     case type
  764.     when :dtb; return :dtb
  765.     when :ftb; return $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  766.     else;      return :dtb
  767.     end
  768.   end
  769.   
  770. end # Game_System

  771. #==============================================================================
  772. # ■ Sprite_Base
  773. #==============================================================================

  774. class Sprite_Base < Sprite
  775.   
  776.   #--------------------------------------------------------------------------
  777.   # new method: start_pseudo_animation
  778.   #--------------------------------------------------------------------------
  779.   unless $imported["YEA-CoreEngine"]
  780.   def start_pseudo_animation(animation, mirror = false)
  781.     dispose_animation
  782.     @animation = animation
  783.     return if @animation.nil?
  784.     @ani_mirror = mirror
  785.     set_animation_rate
  786.     @ani_duration = @animation.frame_max * @ani_rate + 1
  787.     @ani_sprites = []
  788.   end
  789.   end # $imported["YEA-CoreEngine"]
  790.   
  791. end # Sprite_Base

  792. #==============================================================================
  793. # ■ Sprite_Battler
  794. #==============================================================================

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

  909. #==============================================================================
  910. # ■ Sprite_Popup
  911. #==============================================================================

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

  1018. #==============================================================================
  1019. # ■ Spriteset_Battle
  1020. #==============================================================================

  1021. class Spriteset_Battle
  1022.   
  1023.   #--------------------------------------------------------------------------
  1024.   # public instance variables
  1025.   #--------------------------------------------------------------------------
  1026.   attr_accessor :actor_sprites
  1027.   attr_accessor :enemy_sprites
  1028.   attr_accessor :viewport1
  1029.   attr_accessor :viewportPopups
  1030.   
  1031.   #--------------------------------------------------------------------------
  1032.   # alias method: create_viewports
  1033.   #--------------------------------------------------------------------------
  1034.   alias spriteset_battle_create_viewports_abe create_viewports
  1035.   def create_viewports
  1036.     spriteset_battle_create_viewports_abe
  1037.     @viewportPopups = Viewport.new
  1038.     @viewportPopups.z = 200
  1039.   end
  1040.   
  1041.   #--------------------------------------------------------------------------
  1042.   # alias method: dispose_viewports
  1043.   #--------------------------------------------------------------------------
  1044.   alias spriteset_battle_dispose_viewports_abe dispose_viewports
  1045.   def dispose_viewports
  1046.     spriteset_battle_dispose_viewports_abe
  1047.     @viewportPopups.dispose
  1048.   end
  1049.   
  1050.   #--------------------------------------------------------------------------
  1051.   # alias method: update_viewports
  1052.   #--------------------------------------------------------------------------
  1053.   alias spriteset_battle_update_viewports_abe update_viewports
  1054.   def update_viewports
  1055.     spriteset_battle_update_viewports_abe
  1056.     @viewportPopups.update
  1057.   end
  1058.   
  1059. end # Spriteset_Battle

  1060. #==============================================================================
  1061. # ■ Game_Temp
  1062. #==============================================================================

  1063. class Game_Temp
  1064.   
  1065.   #--------------------------------------------------------------------------
  1066.   # public instance variables
  1067.   #--------------------------------------------------------------------------
  1068.   attr_accessor :battle_aid
  1069.   attr_accessor :evaluating
  1070.   attr_accessor :iconset
  1071.   
  1072.   #--------------------------------------------------------------------------
  1073.   # alias method: initialize
  1074.   #--------------------------------------------------------------------------
  1075.   alias game_temp_initialize_abe initialize
  1076.   def initialize
  1077.     game_temp_initialize_abe
  1078.     @iconset = Cache.system("Iconset")
  1079.   end
  1080.   
  1081. end # Game_Temp

  1082. #==============================================================================
  1083. # ■ Game_Action
  1084. #==============================================================================

  1085. class Game_Action
  1086.   
  1087.   #--------------------------------------------------------------------------
  1088.   # overwrite method: speed
  1089.   #--------------------------------------------------------------------------
  1090.   def speed
  1091.     speed = subject.agi
  1092.     speed += item.speed if item
  1093.     speed += subject.atk_speed if attack?
  1094.     return speed
  1095.   end
  1096.   
  1097.   #--------------------------------------------------------------------------
  1098.   # alias method: evaluate_item_with_target
  1099.   #--------------------------------------------------------------------------
  1100.   alias evaluate_item_with_target_abe evaluate_item_with_target
  1101.   def evaluate_item_with_target(target)
  1102.     $game_temp.evaluating = true
  1103.     result = evaluate_item_with_target_abe(target)
  1104.     $game_temp.evaluating = false
  1105.     return result
  1106.   end
  1107.   
  1108. end # Game_Action

  1109. #==============================================================================
  1110. # ■ Game_ActionResult
  1111. #==============================================================================

  1112. class Game_ActionResult
  1113.   
  1114.   #--------------------------------------------------------------------------
  1115.   # alias method: clear
  1116.   #--------------------------------------------------------------------------
  1117.   alias game_actionresult_clear_abe clear
  1118.   def clear
  1119.     game_actionresult_clear_abe
  1120.     clear_stored_damage
  1121.   end
  1122.   
  1123.   #--------------------------------------------------------------------------
  1124.   # new method: clear_stored_damage
  1125.   #--------------------------------------------------------------------------
  1126.   def clear_stored_damage
  1127.     @stored_hp_damage = 0
  1128.     @stored_mp_damage = 0
  1129.     @stored_tp_damage = 0
  1130.     @stored_hp_drain = 0
  1131.     @stored_mp_drain = 0
  1132.   end
  1133.   
  1134.   #--------------------------------------------------------------------------
  1135.   # new method: store_damage
  1136.   #--------------------------------------------------------------------------
  1137.   def store_damage
  1138.     @stored_hp_damage += @hp_damage
  1139.     @stored_mp_damage += @mp_damage
  1140.     @stored_tp_damage += @tp_damage
  1141.     @stored_hp_drain += @hp_drain
  1142.     @stored_mp_drain += @mp_drain
  1143.   end
  1144.   
  1145.   #--------------------------------------------------------------------------
  1146.   # new method: restore_damage
  1147.   #--------------------------------------------------------------------------
  1148.   def restore_damage
  1149.     @hp_damage = @stored_hp_damage
  1150.     @mp_damage = @stored_mp_damage
  1151.     @tp_damage = @stored_tp_damage
  1152.     @hp_drain = @stored_hp_drain
  1153.     @mp_drain = @stored_mp_drain
  1154.   end
  1155.   
  1156. end # Game_ActionResult

  1157. #==============================================================================
  1158. # ■ Game_BattlerBase
  1159. #==============================================================================

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

  1356. #==============================================================================
  1357. # ■ Game_Battler
  1358. #==============================================================================

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

  1511. #==============================================================================
  1512. # ■ Game_Actor
  1513. #==============================================================================

  1514. class Game_Actor < Game_Battler
  1515.   
  1516.   #def battler_name
  1517.     #return "Slime"
  1518.   #end
  1519.   
  1520.   #def battler_hue
  1521.     #return 0
  1522.   #end
  1523.   
  1524.   #--------------------------------------------------------------------------
  1525.   # overwrite method: perform_damage_effect
  1526.   #--------------------------------------------------------------------------
  1527.   def perform_damage_effect
  1528.     $game_troop.screen.start_shake(5, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
  1529.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1530.     Sound.play_actor_damage
  1531.   end
  1532.   
  1533.   #--------------------------------------------------------------------------
  1534.   # overwrite method: use_sprite?
  1535.   #--------------------------------------------------------------------------
  1536.   def use_sprite?; return true; end
  1537.    
  1538.   #--------------------------------------------------------------------------
  1539.   # new method: screen_x
  1540.   #--------------------------------------------------------------------------
  1541.   def screen_x
  1542.     return 0 unless SceneManager.scene_is?(Scene_Battle)
  1543.     status_window = SceneManager.scene.status_window
  1544.     return 0 if status_window.nil?
  1545.     item_rect_width = (status_window.width-24) / $game_party.max_battle_members
  1546.     ext = SceneManager.scene.info_viewport.ox
  1547.     rect = SceneManager.scene.status_window.item_rect(self.index)
  1548.     constant = 128 + 12
  1549.     return constant + rect.x + item_rect_width / 2 - ext
  1550.   end
  1551.   
  1552.   #--------------------------------------------------------------------------
  1553.   # new method: screen_y
  1554.   #--------------------------------------------------------------------------
  1555.   def screen_y
  1556.     return Graphics.height - 120 unless SceneManager.scene_is?(Scene_Battle)
  1557.     return Graphics.height - 120 if SceneManager.scene.status_window.nil?
  1558.     return Graphics.height - (SceneManager.scene.status_window.height * 7/8)
  1559.   end
  1560.   
  1561.   #--------------------------------------------------------------------------
  1562.   # new method: screen_z
  1563.   #--------------------------------------------------------------------------
  1564.   def screen_z; return 100; end
  1565.   
  1566.   #--------------------------------------------------------------------------
  1567.   # new method: sprite
  1568.   #--------------------------------------------------------------------------
  1569.   def sprite
  1570.     index = $game_party.battle_members.index(self)
  1571.     return SceneManager.scene.spriteset.actor_sprites[index]
  1572.   end
  1573.   
  1574.   #--------------------------------------------------------------------------
  1575.   # new method: draw_mp?
  1576.   #--------------------------------------------------------------------------
  1577.   def draw_mp?
  1578.     return true unless draw_tp?
  1579.     for skill in skills
  1580.       next unless added_skill_types.include?(skill.stype_id)
  1581.       return true if skill.mp_cost > 0
  1582.     end
  1583.     return false
  1584.   end
  1585.   
  1586.   #--------------------------------------------------------------------------
  1587.   # new method: draw_tp?
  1588.   #--------------------------------------------------------------------------
  1589.   def draw_tp?
  1590.     return false unless $data_system.opt_display_tp
  1591.     for skill in skills
  1592.       next unless added_skill_types.include?(skill.stype_id)
  1593.       return true if skill.tp_cost > 0
  1594.     end
  1595.     return false
  1596.   end
  1597.   
  1598. end # Game_Actor

  1599. #==============================================================================
  1600. # ■ Game_Enemy
  1601. #==============================================================================

  1602. class Game_Enemy < Game_Battler
  1603.   
  1604.   #--------------------------------------------------------------------------
  1605.   # overwrite method: perform_damage_effect
  1606.   #--------------------------------------------------------------------------
  1607.   def perform_damage_effect
  1608.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1609.     Sound.play_enemy_damage
  1610.   end
  1611.   
  1612.   #--------------------------------------------------------------------------
  1613.   # new methods: attack_animation_id
  1614.   #--------------------------------------------------------------------------
  1615.   def atk_animation_id1; return enemy.atk_animation_id1; end
  1616.   def atk_animation_id2; return enemy.atk_animation_id2; end
  1617.   
  1618.   #--------------------------------------------------------------------------
  1619.   # new method: sprite
  1620.   #--------------------------------------------------------------------------
  1621.   def sprite
  1622.     return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
  1623.   end
  1624.   
  1625. end # Game_Enemy

  1626. #==============================================================================
  1627. # ■ Game_Unit
  1628. #==============================================================================

  1629. class Game_Unit
  1630.   
  1631.   #--------------------------------------------------------------------------
  1632.   # alias method: make_actions
  1633.   #--------------------------------------------------------------------------
  1634.   alias game_unit_make_actions_abe make_actions
  1635.   def make_actions
  1636.     game_unit_make_actions_abe
  1637.     refresh_autobattler_status_window
  1638.   end
  1639.   
  1640.   #--------------------------------------------------------------------------
  1641.   # new method: refresh_autobattler_status_window
  1642.   #--------------------------------------------------------------------------
  1643.   def refresh_autobattler_status_window
  1644.     return unless SceneManager.scene_is?(Scene_Battle)
  1645.     return unless self.is_a?(Game_Party)
  1646.     SceneManager.scene.refresh_autobattler_status_window
  1647.   end
  1648.   
  1649. end # Game_Unit

  1650. #==============================================================================
  1651. # ■ Window_PartyCommand
  1652. #==============================================================================

  1653. class Window_PartyCommand < Window_Command
  1654.   
  1655.   #--------------------------------------------------------------------------
  1656.   # overwrite method: process_handling
  1657.   #--------------------------------------------------------------------------
  1658.   def process_handling
  1659.     return unless open? && active
  1660.     return process_dir6 if Input.repeat?(:RIGHT)
  1661.     return super
  1662.   end
  1663.   
  1664.   #--------------------------------------------------------------------------
  1665.   # new method: process_dir6
  1666.   #--------------------------------------------------------------------------
  1667.   def process_dir6
  1668.     Sound.play_cursor
  1669.     Input.update
  1670.     deactivate
  1671.     call_handler(:dir6)
  1672.   end
  1673.   
  1674. end # Window_PartyCommand

  1675. #==============================================================================
  1676. # ■ Window_ActorCommand
  1677. #==============================================================================

  1678. class Window_ActorCommand < Window_Command
  1679.   
  1680.   #--------------------------------------------------------------------------
  1681.   # overwrite method: process_handling
  1682.   #--------------------------------------------------------------------------
  1683.   def process_handling
  1684.     return unless open? && active
  1685.     return process_dir4 if Input.repeat?(:LEFT)
  1686.     return process_dir6 if Input.repeat?(:RIGHT)
  1687.     return super
  1688.   end
  1689.   
  1690.   #--------------------------------------------------------------------------
  1691.   # new method: process_dir4
  1692.   #--------------------------------------------------------------------------
  1693.   def process_dir4
  1694.     Sound.play_cursor
  1695.     Input.update
  1696.     deactivate
  1697.     call_handler(:cancel)
  1698.   end
  1699.   
  1700.   #--------------------------------------------------------------------------
  1701.   # new method: process_dir6
  1702.   #--------------------------------------------------------------------------
  1703.   def process_dir6
  1704.     Sound.play_cursor
  1705.     Input.update
  1706.     deactivate
  1707.     call_handler(:dir6)
  1708.   end
  1709.   
  1710. end # Window_ActorCommand

  1711. #==============================================================================
  1712. # ■ Window_BattleStatus
  1713. #==============================================================================

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

  1893. #==============================================================================
  1894. # ■ Window_BattleActor
  1895. #==============================================================================

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

  1985. #==============================================================================
  1986. # ■ Window_BattleStatusAid
  1987. #==============================================================================

  1988. class Window_BattleStatusAid < Window_BattleStatus
  1989.   
  1990.   #--------------------------------------------------------------------------
  1991.   # public instance variables
  1992.   #--------------------------------------------------------------------------
  1993.   attr_accessor :status_window
  1994.   
  1995.   #--------------------------------------------------------------------------
  1996.   # overwrite method: initialize
  1997.   #--------------------------------------------------------------------------
  1998.   def initialize
  1999.     super
  2000.     self.visible = false
  2001.     self.openness = 255
  2002.   end
  2003.   
  2004.   #--------------------------------------------------------------------------
  2005.   # overwrite method: window_width
  2006.   #--------------------------------------------------------------------------
  2007.   def window_width; return 128; end
  2008.   
  2009.   #--------------------------------------------------------------------------
  2010.   # overwrite method: show
  2011.   #--------------------------------------------------------------------------
  2012.   def show
  2013.     super
  2014.     refresh
  2015.   end
  2016.   
  2017.   #--------------------------------------------------------------------------
  2018.   # overwrite method: refresh
  2019.   #--------------------------------------------------------------------------
  2020.   def refresh
  2021.     contents.clear
  2022.     return if @status_window.nil?
  2023.     draw_item(@status_window.index)
  2024.   end
  2025.   
  2026.   #--------------------------------------------------------------------------
  2027.   # overwrite method: item_rect
  2028.   #--------------------------------------------------------------------------
  2029.   def item_rect(index)
  2030.     return Rect.new(0, 0, contents.width, contents.height)
  2031.   end
  2032.   
  2033. end # Window_BattleStatusAid

  2034. #==============================================================================
  2035. # ■ Window_BattleEnemy
  2036. #==============================================================================

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

  2183. #==============================================================================
  2184. # ■ Window_BattleHelp
  2185. #==============================================================================

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

  2294. #==============================================================================
  2295. # ■ Window_BattleLog
  2296. #==============================================================================

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

  2458. #==============================================================================
  2459. # ■ Window_SkillList
  2460. #==============================================================================

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

  2472. #==============================================================================
  2473. # ■ Window_ItemList
  2474. #==============================================================================

  2475. class Window_ItemList < Window_Selectable
  2476.   
  2477.   #--------------------------------------------------------------------------
  2478.   # overwrite method: spacing
  2479.   #--------------------------------------------------------------------------
  2480.   def spacing
  2481.     return 8 if $game_party.in_battle
  2482.     return super
  2483.   end
  2484.   
  2485. end # Window_ItemList

  2486. #==============================================================================
  2487. # ■ Scene_Battle
  2488. #==============================================================================

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

  3106. #==============================================================================
  3107. #
  3108. # ▼ End of File
  3109. #
  3110. #==============================================================================
  3111. #==============================================================================
  3112. #
  3113. # ¥ YSA Battle System: Charge Turn Battle
  3114. # -- Last Updated: 2012.01.20
  3115. # -- Level: Easy, Normal
  3116. # -- Requires: YEA - Ace Battle Engine v1.15+.
  3117. #
  3118. #==============================================================================

  3119. $imported = {} if $imported.nil?
  3120. $imported["YSA-YCTB"] = true

  3121. #==============================================================================
  3122. # ¥ Updates
  3123. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3124. # 2012.01.29 - Bugfixes for various things.
  3125. # 2012.01.24 - Started Script and Finished.
  3126. #
  3127. #==============================================================================
  3128. # ¥ Introduction
  3129. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3130. # This script will add a battle type into YEA Battle Engine Ace.
  3131. # Battle Type: CTB.
  3132. #
  3133. #==============================================================================
  3134. # ¥ Instructions
  3135. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3136. # To install this script, open up your script editor and copy/paste this script
  3137. # to an open slot below ¥ Materials/‘fÞ but above ¥ Main. Remember to save.
  3138. #
  3139. # First, set the default battle system for your game to be :yctb by either going
  3140. # to the Ace Battle Engine script and setting DEFAULT_BATTLE_SYSTEM as :yctb or
  3141. # by using the following script call:
  3142. #
  3143. # $game_system:set_battle_system(:yctb)
  3144. #
  3145. # Second, you can set the default turn counting for your game by either setting
  3146. # DEFAULT_TURN or using the following script call:
  3147. #
  3148. # $game_system:set_yctb_turn_type(turn_type)
  3149. #
  3150. # Which there are 2 types:
  3151. #   - :tick     : Count as a turn after X frame
  3152. #   - :action   : Count as a turn after X actions
  3153. #
  3154. #==============================================================================
  3155. # ¥ Compatibility
  3156. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3157. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  3158. # it will run with RPG Maker VX without adjusting.
  3159. #
  3160. # This script requires Yanfly Engine Ace - Ace Battle Engine v1.15+ and the
  3161. # script must be placed under Ace Battle Engine in the script listing.
  3162. #
  3163. #==============================================================================

  3164. #==============================================================================
  3165. # ¥ Configuration
  3166. #==============================================================================

  3167. module YSA
  3168.   module YCTB
  3169.    
  3170.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3171.     # - General Configuration -
  3172.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3173.     DEFAULT_RESOLUTION = 120 # In ATB, this is filling time.
  3174.     DEFAULT_RESOLUTION_VARIABLE  = 15 # Change DEFAULT_RESOLUTION by variable.
  3175.       
  3176.     PREEMTIVE_ATB_ACTOR = 70
  3177.     PREEMTIVE_ATB_ENEMY = 0
  3178.     SURPRISE_ATB_ACTOR = 0
  3179.     SURPRISE_ATB_ENEMY = 70
  3180.    
  3181.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3182.     # - Turn Configuration -
  3183.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3184.     DEFAULT_TURN          = :tick # :tick, :action
  3185.    
  3186.     TICK_COUNT            = 240    # Turn after TICK_COUNT
  3187.     TICK_COUNT_VARIABLE   = 16     # Change TICK_COUNT by variable.
  3188.    
  3189.     AFTER_ACTION          = 4    # Turn after AFTER_ACTION actions.
  3190.     AFTER_ACTION_VARIABLE  = 17     # Change AFTER_ACTION by variable.
  3191.    
  3192.   end
  3193. end

  3194. #==============================================================================
  3195. # ¥ Editting anything past this point may potentially result in causing
  3196. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  3197. # halitosis so edit at your own risk.
  3198. #==============================================================================

  3199. #==============================================================================
  3200. # ¡ BattleManager
  3201. #==============================================================================

  3202. module BattleManager
  3203.   
  3204.   #--------------------------------------------------------------------------
  3205.   # alias method:
  3206.   #     - make_action_orders
  3207.   #     - prior_command
  3208.   #     - next_command
  3209.   #     - in_turn?
  3210.   #     - battle_start
  3211.   #--------------------------------------------------------------------------
  3212.   class <<self
  3213.     alias yctb_make_action_orders make_action_orders
  3214.     alias yctb_prior_command prior_command
  3215.     alias yctb_next_command next_command
  3216.     alias yctb_in_turn? in_turn?
  3217.     alias yctb_battle_start battle_start
  3218.   end
  3219.   
  3220.   #--------------------------------------------------------------------------
  3221.   # battle_start
  3222.   #--------------------------------------------------------------------------
  3223.   def self.battle_start
  3224.     yctb_battle_start
  3225.     if btype?(:yctb)
  3226.       @average_agi = 0
  3227.       make_yctb_action_orders
  3228.       battler_hash = $game_party.members + $game_troop.members
  3229.       battler_hash.each { |a|
  3230.         if @preemptive
  3231.           a.make_first_yctb_value(1)
  3232.         elsif @surprise
  3233.           a.make_first_yctb_value(2)
  3234.         else
  3235.           a.make_first_yctb_value(0)
  3236.         end
  3237.         @average_agi += a.agi
  3238.       }
  3239.       @average_agi /= battler_hash.size
  3240.     end
  3241.   end
  3242.   
  3243.   #--------------------------------------------------------------------------
  3244.   # make_action_orders
  3245.   #--------------------------------------------------------------------------
  3246.   def self.make_action_orders
  3247.     return if btype?(:yctb)
  3248.     yctb_make_action_orders unless btype?(:yctb)
  3249.   end
  3250.   
  3251.   #--------------------------------------------------------------------------
  3252.   # next_command
  3253.   #--------------------------------------------------------------------------
  3254.   def self.next_command
  3255.     return false if btype?(:yctb)
  3256.     yctb_next_command
  3257.   end
  3258.   
  3259.   #--------------------------------------------------------------------------
  3260.   # alias method: in_turn?
  3261.   #--------------------------------------------------------------------------
  3262.   def self.in_turn?
  3263.     return true if btype?(:yctb)
  3264.     return yctb_in_turn?
  3265.   end
  3266.   
  3267.   #--------------------------------------------------------------------------
  3268.   # new method: make_yctb_action_orders
  3269.   #--------------------------------------------------------------------------
  3270.   class <<self
  3271.   def make_yctb_action_orders
  3272.     @action_battlers = []
  3273.   end
  3274.   end
  3275.   
  3276.   #--------------------------------------------------------------------------
  3277.   # new method: average_agi
  3278.   #--------------------------------------------------------------------------
  3279.   class <<self
  3280.   def average_agi
  3281.     return @average_agi
  3282.   end
  3283.   end
  3284.   
  3285.   #--------------------------------------------------------------------------
  3286.   # new method: set_actor
  3287.   #--------------------------------------------------------------------------
  3288.   class <<self
  3289.   def set_actor(actor_index)
  3290.     @actor_index = actor_index
  3291.   end
  3292.   end
  3293.   
  3294.   #--------------------------------------------------------------------------
  3295.   # prior_command
  3296.   #--------------------------------------------------------------------------
  3297.   def self.prior_command
  3298.     return false if btype?(:yctb)
  3299.     yctb_prior_command
  3300.   end
  3301.   
  3302.   #--------------------------------------------------------------------------
  3303.   # new method: make_yctb_action
  3304.   #--------------------------------------------------------------------------
  3305.   class <<self
  3306.   def make_yctb_action(battler)
  3307.     make_yctb_action_orders if !@action_battlers
  3308.     return false if @action_battlers.include?(battler)
  3309.     @action_battlers.push(battler)
  3310.     return true
  3311.   end
  3312.   end
  3313.   
  3314.   #--------------------------------------------------------------------------
  3315.   # new method: delete_yctb_action
  3316.   #--------------------------------------------------------------------------
  3317.   class <<self
  3318.   def delete_yctb_action(battler)
  3319.     return false if !battler
  3320.     @action_battlers.delete(battler)
  3321.     @action_battlers = @action_battlers.compact
  3322.     return true
  3323.   end
  3324.   end
  3325.   
  3326.   #--------------------------------------------------------------------------
  3327.   # new method: action_list
  3328.   #--------------------------------------------------------------------------
  3329.   class <<self
  3330.   def action_list_ctb
  3331.     return @action_battlers
  3332.   end
  3333.   end
  3334.   
  3335. end # BattleManager

  3336. #==============================================================================
  3337. # ¡ Game_System
  3338. #==============================================================================

  3339. class Game_System
  3340.   
  3341.   #--------------------------------------------------------------------------
  3342.   # alias method: set_battle_system
  3343.   #--------------------------------------------------------------------------
  3344.   alias yctb_set_battle_system set_battle_system
  3345.   def set_battle_system(type)
  3346.     case type
  3347.     when :yctb; @battle_system = :yctb
  3348.     else;       yctb_set_battle_system(type)
  3349.     end
  3350.   end
  3351.   
  3352.   #--------------------------------------------------------------------------
  3353.   # alias method: battle_system_corrected
  3354.   #--------------------------------------------------------------------------
  3355.   alias yctb_battle_system_corrected battle_system_corrected
  3356.   def battle_system_corrected(type)
  3357.     case type
  3358.     when :yctb; return :yctb
  3359.     else;       return yctb_battle_system_corrected(type)
  3360.     end
  3361.   end
  3362.   
  3363.   #--------------------------------------------------------------------------
  3364.   # new method: yctb_fill_time
  3365.   #--------------------------------------------------------------------------
  3366.   def yctb_fill_time
  3367.     return $game_variables[YSA::YCTB::DEFAULT_RESOLUTION_VARIABLE] > 0 ? $game_variables[YSA::YCTB::DEFAULT_RESOLUTION_VARIABLE] : YSA::YCTB::DEFAULT_RESOLUTION
  3368.   end
  3369.   
  3370.   #--------------------------------------------------------------------------
  3371.   # new method: yctb_tick_count
  3372.   #--------------------------------------------------------------------------
  3373.   def yctb_tick_count
  3374.     return $game_variables[YSA::YCTB::TICK_COUNT_VARIABLE] > 0 ? $game_variables[YSA::YCTB::TICK_COUNT_VARIABLE] : YSA::YCTB::TICK_COUNT
  3375.   end
  3376.   
  3377.   #--------------------------------------------------------------------------
  3378.   # new method: yctb_after_action
  3379.   #--------------------------------------------------------------------------
  3380.   def yctb_after_action
  3381.     return $game_variables[YSA::YCTB::AFTER_ACTION_VARIABLE] > 0 ? $game_variables[YSA::YCTB::AFTER_ACTION_VARIABLE] : YSA::YCTB::AFTER_ACTION
  3382.   end
  3383.   
  3384.   #--------------------------------------------------------------------------
  3385.   # new method: yctb_turn_type
  3386.   #--------------------------------------------------------------------------
  3387.   def yctb_turn_type
  3388.     return @yctb_turn_type ? @yctb_turn_type : YSA::YCTB::DEFAULT_TURN
  3389.   end
  3390.   
  3391.   #--------------------------------------------------------------------------
  3392.   # new method: set_yctb_turn_type
  3393.   #--------------------------------------------------------------------------
  3394.   def set_yctb_turn_type(type = :tick)
  3395.     @yctb_turn_type = type
  3396.   end
  3397.   
  3398. end # Game_System

  3399. #==============================================================================
  3400. # ¡ Game_Battler
  3401. #==============================================================================

  3402. class Game_Battler < Game_BattlerBase
  3403.   
  3404.   MAX_YCTB_VALUE = 100000.0
  3405.   
  3406.   #--------------------------------------------------------------------------
  3407.   # alias method: initialize
  3408.   #--------------------------------------------------------------------------
  3409.   alias yctb_initialize initialize
  3410.   def initialize
  3411.     yctb_initialize
  3412.     @yctb_value = 0
  3413.   end
  3414.   
  3415.   #--------------------------------------------------------------------------
  3416.   # new method: base_gain_yctb
  3417.   #--------------------------------------------------------------------------
  3418.   def base_gain_yctb
  3419.     return MAX_YCTB_VALUE / $game_system.yctb_fill_time
  3420.   end
  3421.   
  3422.   #--------------------------------------------------------------------------
  3423.   # new method: real_gain_yctb
  3424.   #--------------------------------------------------------------------------
  3425.   def real_gain_yctb
  3426.     value = (self.agi.to_f / BattleManager.average_agi) * base_gain_yctb
  3427.     return value
  3428.   end
  3429.   
  3430.   #--------------------------------------------------------------------------
  3431.   # new method: make_yctb_update
  3432.   #--------------------------------------------------------------------------
  3433.   def make_yctb_update
  3434.     return @yctb_value = MAX_YCTB_VALUE if @yctb_value >= MAX_YCTB_VALUE
  3435.     return if not movable?
  3436.     value = $imported["YSA-LunaticYCTBRate"] ? lunatic_yctb_rate_formula : real_gain_yctb
  3437.     @yctb_value += value
  3438.   end
  3439.   
  3440.   #--------------------------------------------------------------------------
  3441.   # new method: yctb_value
  3442.   #--------------------------------------------------------------------------
  3443.   def yctb_value
  3444.     return @yctb_value
  3445.   end
  3446.   
  3447.   #--------------------------------------------------------------------------
  3448.   # new method: make_yctb_action
  3449.   #--------------------------------------------------------------------------
  3450.   def make_yctb_action
  3451.     return unless @yctb_value >= MAX_YCTB_VALUE
  3452.     return clear_yctb if not movable?
  3453.     make_actions
  3454.     return BattleManager.make_yctb_action(self)
  3455.   end
  3456.   
  3457.   #--------------------------------------------------------------------------
  3458.   # new method: clear_yctb
  3459.   #--------------------------------------------------------------------------
  3460.   def clear_yctb(value = 0)
  3461.     @yctb_value = value
  3462.     @ct_yctb_value = 0
  3463.     BattleManager.clear_actor if self.actor? && BattleManager.actor == self
  3464.     BattleManager.delete_yctb_action(self)
  3465.   end
  3466.   
  3467.   #--------------------------------------------------------------------------
  3468.   # new method: clear_yctb_charge
  3469.   #--------------------------------------------------------------------------
  3470.   def clear_yctb_charge
  3471.     @ct_catb_value = 0
  3472.   end
  3473.   
  3474.   #--------------------------------------------------------------------------
  3475.   # new method: make_first_yctb_value
  3476.   #--------------------------------------------------------------------------
  3477.   def make_first_yctb_value(pre = 0)
  3478.     make_actions
  3479.     @yctb_value = 0
  3480.     @yctb_value = YSA::YCTB::PREEMTIVE_ATB_ACTOR if self.actor? && pre == 1
  3481.     @yctb_value = YSA::YCTB::PREEMTIVE_ATB_ENEMY if self.enemy? && pre == 1
  3482.     @yctb_value = YSA::YCTB::SURPRISE_ATB_ACTOR if self.actor? && pre == 2
  3483.     @yctb_value = YSA::YCTB::SURPRISE_ATB_ENEMY if self.enemy? && pre == 2
  3484.     lunatic_yctb_start_formula(pre) if $imported["YSA-LunaticYCTBStart"]
  3485.   end
  3486.   
  3487.   #--------------------------------------------------------------------------
  3488.   # new method: yctb_remaining_tick
  3489.   #--------------------------------------------------------------------------
  3490.   def yctb_remaining_tick
  3491.     return (MAX_YCTB_VALUE - @yctb_value) / real_gain_yctb.to_f
  3492.   end
  3493.   
  3494.   #--------------------------------------------------------------------------
  3495.   # new method: yctb_index
  3496.   #--------------------------------------------------------------------------
  3497.   def yctb_index
  3498.     return BattleManager.action_list_ctb.index(self)
  3499.   end
  3500.   
  3501.   #--------------------------------------------------------------------------
  3502.   # overwrite method: update_state_turns
  3503.   #--------------------------------------------------------------------------
  3504.   def update_state_turns
  3505.     states.each do |state|
  3506.       @state_turns[state.id] -= 1 if @state_turns[state.id] > 0 && state.auto_removal_timing == 2
  3507.     end
  3508.   end
  3509.   
  3510.   #--------------------------------------------------------------------------
  3511.   # new method: update_state_actions
  3512.   #--------------------------------------------------------------------------
  3513.   def update_state_actions
  3514.     states.each do |state|
  3515.       @state_turns[state.id] -= 1 if @state_turns[state.id] > 0 && state.auto_removal_timing == 1
  3516.     end
  3517.   end
  3518.   
  3519.   #--------------------------------------------------------------------------
  3520.   # alias method: on_action_end
  3521.   #--------------------------------------------------------------------------
  3522.   alias yctb_on_action_end on_action_end
  3523.   def on_action_end
  3524.     yctb_on_action_end
  3525.     update_state_actions
  3526.   end
  3527.   
  3528.   #--------------------------------------------------------------------------
  3529.   # alias method: on_restrict
  3530.   #--------------------------------------------------------------------------
  3531.   alias yctb_on_restrict on_restrict
  3532.   def on_restrict
  3533.     if BattleManager.btype?(:yctb)
  3534.       clear_yctb(0)
  3535.       states.each do |state|
  3536.         remove_state(state.id) if state.remove_by_restriction
  3537.       end
  3538.     end
  3539.     yctb_on_restrict unless BattleManager.btype?(:yctb)
  3540.   end
  3541.   
  3542.   #--------------------------------------------------------------------------
  3543.   # alias method: force_action
  3544.   #--------------------------------------------------------------------------
  3545.   alias yctb_force_action force_action
  3546.   def force_action(skill_id, target_index)
  3547.     if BattleManager.btype?(:yctb)
  3548.       action = Game_Action.new(self, true)
  3549.       action.set_skill(skill_id)
  3550.       if target_index == -2
  3551.         action.target_index = last_target_index
  3552.       elsif target_index == -1
  3553.         action.decide_random_target
  3554.       else
  3555.         action.target_index = target_index
  3556.       end
  3557.       @actions = [action] + @actions
  3558.     end
  3559.     yctb_force_action(skill_id, target_index) unless BattleManager.btype?(:yctb)
  3560.   end
  3561.   
  3562.   #--------------------------------------------------------------------------
  3563.   # alias method: make_action_times
  3564.   #--------------------------------------------------------------------------
  3565.   alias yctb_make_action_times make_action_times
  3566.   def make_action_times
  3567.     BattleManager.btype?(:yctb) ? 1 : yctb_make_action_times
  3568.   end
  3569.   
  3570. end # Game_Battler

  3571. #==============================================================================
  3572. # ¡ Game_Action
  3573. #==============================================================================

  3574. class Game_Action
  3575.    
  3576.   #--------------------------------------------------------------------------
  3577.   # alias method: clear
  3578.   #--------------------------------------------------------------------------
  3579.   alias yctb_clear clear
  3580.   def clear
  3581.     yctb_clear
  3582.     @confirm = false
  3583.   end
  3584.   
  3585.   #--------------------------------------------------------------------------
  3586.   # new method: confirm=
  3587.   #--------------------------------------------------------------------------
  3588.   def confirm=(con)
  3589.     @confirm = con
  3590.   end
  3591.   
  3592.   #--------------------------------------------------------------------------
  3593.   # new method: confirm
  3594.   #--------------------------------------------------------------------------
  3595.   def confirm
  3596.     return @subject.auto_battle? ? true : @confirm
  3597.   end

  3598. end # Game_Action
  3599.   
  3600. #==============================================================================
  3601. # ¡ Window_BattleEnemy
  3602. #==============================================================================

  3603. class Window_BattleEnemy < Window_Selectable
  3604.   
  3605.   #--------------------------------------------------------------------------
  3606.   # alias method: col_max
  3607.   #--------------------------------------------------------------------------
  3608.   alias yctb_col_max col_max
  3609.   def col_max; return yctb_col_max == 0 ? 1 : yctb_col_max; end

  3610. end # Window_BattleEnemy

  3611. #==============================================================================
  3612. # ¡ Scene_Battle
  3613. #==============================================================================

  3614. class Scene_Battle < Scene_Base
  3615.   
  3616.   #--------------------------------------------------------------------------
  3617.   # alias method: process_action
  3618.   #--------------------------------------------------------------------------
  3619.   alias yctb_process_action process_action
  3620.   def process_action
  3621.     if BattleManager.btype?(:yctb)
  3622.       if BattleManager.action_forced?
  3623.         perform_yctb_action(@subject, true)
  3624.       end
  3625.       process_yctb
  3626.     end
  3627.     yctb_process_action unless BattleManager.btype?(:yctb)
  3628.   end
  3629.   
  3630.   #--------------------------------------------------------------------------
  3631.   # new method: yctb_pause?
  3632.   #--------------------------------------------------------------------------
  3633.   def yctb_pause?
  3634.     return true if BattleManager.action_forced?
  3635.     return true if @subject
  3636.     return true if $imported["YEA-CombatLogDisplay"] && @combatlog_window && @combatlog_window.visible
  3637.     return @party_command_window.active
  3638.     return false
  3639.   end
  3640.   
  3641.   #--------------------------------------------------------------------------
  3642.   # new method: process_yctb
  3643.   #--------------------------------------------------------------------------
  3644.   def process_yctb
  3645.     return unless SceneManager.scene_is?(Scene_Battle)
  3646.     return if scene_changing?
  3647.     return unless BattleManager.btype?(:yctb)
  3648.     return if yctb_pause?
  3649.     while !BattleManager.action_list_ctb[0]
  3650.       battler_hash = $game_party.members + $game_troop.members
  3651.       battler_hash.each { |a|
  3652.         a.make_yctb_update
  3653.         a.make_yctb_action
  3654.       }
  3655.       #--- Update Tick Turn
  3656.       if $game_system.yctb_turn_type == :tick
  3657.         @tick_clock = 0 if !@tick_clock
  3658.         @tick_clock += 1
  3659.         if @tick_clock >= $game_system.yctb_tick_count
  3660.           @tick_clock = 0
  3661.           all_battle_members.each { |battler|
  3662.             battler.on_turn_end
  3663.           }
  3664.           @status_window.refresh
  3665.           $game_troop.increase_turn
  3666.         end
  3667.       end
  3668.     end
  3669.     #--- Fix make action
  3670.     BattleManager.action_list_ctb.each { |battler|
  3671.       battler.make_actions if (battler.actor? && !battler.input)
  3672.     }
  3673.     #--- Fix battle order
  3674.     BattleManager.action_list_ctb.sort! { |a,b|
  3675.       if a.yctb_value != b.yctb_value
  3676.         b.yctb_value <=> a.yctb_value
  3677.       elsif a.agi != b.agi
  3678.         b.agi <=> a.agi
  3679.       else
  3680.         a.name <=> b.name
  3681.       end
  3682.     }
  3683.     #---
  3684.     battler = BattleManager.action_list_ctb[0]
  3685.     return if !battler
  3686.     battler.make_actions if battler.enemy? && battler.actions.size <= 0
  3687.     perform_yctb_action(battler) if !@subject
  3688.     #--- Setup Actor
  3689.     f_actor = BattleManager.action_list_ctb[0]
  3690.     if f_actor && f_actor.actor? && f_actor.input && !f_actor.input.confirm && (!BattleManager.actor || @status_window.index != BattleManager.actor.index) && !@actor_command_window.active
  3691.       BattleManager.set_actor(f_actor.index)
  3692.       @status_window.select(BattleManager.actor.index)
  3693.       @actor_command_window.setup(BattleManager.actor)
  3694.     end
  3695.   end
  3696.   
  3697.   #--------------------------------------------------------------------------
  3698.   # new method: perform_yctb_action
  3699.   #--------------------------------------------------------------------------
  3700.   def perform_yctb_action(subject, forced = false)
  3701.     @forced_confusion = forced || subject.confusion?
  3702.     return if subject && subject.actor? && !@forced_confusion && !subject.input
  3703.     return if subject && subject.actor? && !@forced_confusion && !subject.input.item
  3704.     return if subject && subject.actor? && !@forced_confusion && !subject.input.confirm
  3705.     @subject = subject if subject
  3706.     return if !@subject
  3707.     if @subject.current_action
  3708.       @subject.current_action.prepare
  3709.       execute_action if @subject.current_action.valid?
  3710.       reset_value = $imported["YSA-LunaticYCTBReset"] ? @subject.lunatic_yctb_reset_formula : 0
  3711.       loop do
  3712.         @subject.remove_current_action
  3713.         break if forced || [email protected]_action || [email protected]_action.valid?
  3714.         @subject.current_action.prepare
  3715.         execute_action
  3716.       end
  3717.       process_event
  3718.       if $game_system.yctb_turn_type == :action && !forced
  3719.         @tick_action = 0 if !@tick_action
  3720.         @tick_action += 1
  3721.         if @tick_action >= $game_system.yctb_after_action
  3722.           @tick_action = 0
  3723.           all_battle_members.each { |battler|
  3724.             battler.on_turn_end
  3725.           }
  3726.           @status_window.refresh
  3727.           $game_troop.increase_turn
  3728.         end
  3729.       end
  3730.       @status_aid_window.refresh if @status_aid_window.visible
  3731.       process_action_end
  3732.     end
  3733.     return if BattleManager.judge_win_loss
  3734.     if @subject && @subject.current_action && [email protected]_action.valid?
  3735.       @subject.clear_yctb_charge
  3736.       @status_window.draw_item(@subject.index) if @subject.actor?
  3737.       @subject = nil
  3738.     end
  3739.     if @subject && @subject.actions.size <= 0
  3740.       @subject.clear_yctb(reset_value) unless forced
  3741.       @status_window.draw_item(@subject.index) if @subject.actor?
  3742.       @subject = nil
  3743.     end
  3744.     if $imported["YSA-OrderBattler"]
  3745.       for order in @spriteset_order
  3746.         order.make_destination
  3747.       end
  3748.     end
  3749.   end
  3750.   
  3751.   #--------------------------------------------------------------------------
  3752.   # alias method: turn_start
  3753.   #--------------------------------------------------------------------------
  3754.   alias yctb_turn_start turn_start
  3755.   def turn_start
  3756.     if BattleManager.btype?(:yctb)
  3757.       @party_command_window.close
  3758.       @actor_command_window.close
  3759.       @status_window.unselect
  3760.       @log_window.wait
  3761.       @log_window.clear
  3762.     else
  3763.       yctb_turn_start
  3764.     end
  3765.   end
  3766.   
  3767.   #--------------------------------------------------------------------------
  3768.   # alias method: command_guard
  3769.   #--------------------------------------------------------------------------
  3770.   alias yctb_command_guard command_guard
  3771.   def command_guard
  3772.     BattleManager.actor.input.confirm = true
  3773.     yctb_command_guard
  3774.     @status_window.draw_item(BattleManager.actor.index)
  3775.   end
  3776.   
  3777.   #--------------------------------------------------------------------------
  3778.   # alias method: command_attack
  3779.   #--------------------------------------------------------------------------
  3780.   alias yctb_command_attack command_attack
  3781.   def command_attack
  3782.     yctb_command_attack
  3783.     @status_window.draw_item(BattleManager.actor.index)
  3784.   end
  3785.   
  3786.   #--------------------------------------------------------------------------
  3787.   # alias method: on_enemy_cancel
  3788.   #--------------------------------------------------------------------------
  3789.   alias yctb_on_enemy_cancel on_enemy_cancel
  3790.   def on_enemy_cancel
  3791.     yctb_on_enemy_cancel
  3792.     @status_window.draw_item(BattleManager.actor.index)
  3793.   end
  3794.   
  3795.   #--------------------------------------------------------------------------
  3796.   # alias method: on_enemy_ok
  3797.   #--------------------------------------------------------------------------
  3798.   alias yctb_on_enemy_ok on_enemy_ok
  3799.   def on_enemy_ok
  3800.     BattleManager.actor.input.confirm = true
  3801.     yctb_on_enemy_ok
  3802.   end
  3803.   
  3804.   #--------------------------------------------------------------------------
  3805.   # alias method: on_actor_cancel
  3806.   #--------------------------------------------------------------------------
  3807.   alias yctb_on_actor_cancel on_actor_cancel
  3808.   def on_actor_cancel
  3809.     yctb_on_actor_cancel
  3810.     @status_window.draw_item(BattleManager.actor.index)
  3811.   end
  3812.   
  3813.   #--------------------------------------------------------------------------
  3814.   # alias method: on_actor_ok
  3815.   #--------------------------------------------------------------------------
  3816.   alias yctb_on_actor_ok on_actor_ok
  3817.   def on_actor_ok
  3818.     BattleManager.actor.input.confirm = true
  3819.     yctb_on_actor_ok
  3820.   end
  3821.   
  3822.   #--------------------------------------------------------------------------
  3823.   # alias method: on_skill_ok
  3824.   #--------------------------------------------------------------------------
  3825.   alias yctb_on_skill_ok on_skill_ok
  3826.   def on_skill_ok
  3827.     yctb_on_skill_ok
  3828.     @status_window.draw_item(BattleManager.actor.index)
  3829.   end
  3830.   
  3831.   #--------------------------------------------------------------------------
  3832.   # alias method: on_item_ok
  3833.   #--------------------------------------------------------------------------
  3834.   alias yctb_on_item_ok on_item_ok
  3835.   def on_item_ok
  3836.     yctb_on_item_ok
  3837.     @status_window.draw_item(BattleManager.actor.index)
  3838.   end
  3839.   
  3840.   #--------------------------------------------------------------------------
  3841.   # alias method: update_info_viewport
  3842.   #--------------------------------------------------------------------------
  3843.   alias yctb_update_info_viewport update_info_viewport
  3844.   def update_info_viewport
  3845.     yctb_update_info_viewport
  3846.     if BattleManager.btype?(:yctb)
  3847.       move_info_viewport(128) if @actor_command_window.active || @actor_window.active || @enemy_window.active || (($game_troop.all_dead? || $game_party.all_dead?)&& @bug_fix1)
  3848.       move_info_viewport(0)   if @party_command_window.active
  3849.       move_info_viewport(0)   if $imported["YEA-CombatLogDisplay"] && @combatlog_window && @combatlog_window.visible
  3850.     end
  3851.   end
  3852.   
  3853.   #--------------------------------------------------------------------------
  3854.   # rewrite method: perform_collapse_check
  3855.   #--------------------------------------------------------------------------
  3856.   def perform_collapse_check(target)
  3857.     return if YEA::BATTLE::MSG_ADDED_STATES
  3858.     if $game_troop.all_dead? || $game_party.all_dead?
  3859.       if @actor_window.active || @enemy_window.active
  3860.         @bug_fix1 = true
  3861.         @help_window.hide
  3862.         @actor_window.hide.deactivate
  3863.         @enemy_window.hide.deactivate
  3864.       end
  3865.     end
  3866.     if target.can_collapse?
  3867.       target.perform_collapse_effect
  3868.     end
  3869.     @log_window.wait
  3870.   end
  3871.   
  3872.   #--------------------------------------------------------------------------
  3873.   # alias method: update_message_open
  3874.   #--------------------------------------------------------------------------
  3875.   alias yctb_update_message_open update_message_open
  3876.   def update_message_open
  3877.     yctb_update_message_open
  3878.     if !$game_message.busy? && @status_window.close? && !$game_troop.all_dead? && !$game_party.all_dead?
  3879.       @status_window.open
  3880.     end
  3881.   end
  3882.    
  3883. end # Scene_Battle

  3884. #==============================================================================
  3885. #
  3886. # ¥ End of File
  3887. #
  3888. #==============================================================================
复制代码
好了。DefaultBattleSystem请自己改,我不负责了。

评分

参与人数 1星屑 +40 收起 理由
无双sxa + 40 感谢分享。

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
66
在线时间
434 小时
注册时间
2006-5-25
帖子
201
4
发表于 2012-1-31 08:39:33 手机端发表。 | 只看该作者
本帖最后由 xmheart 于 2012-1-31 20:42 编辑

这个Ctb是不是跟那种速度和行动共同影响动作顺序那种系统啊?


‘‘

DefaultBattleSystem我改成了FTB,结果就出现这个错误,是在新建工程那里弄的,这是?


──xmheart于2012-1-31 20:41补充以上内容’’

点评

我是LZ,号被封了用小号帮你解释一下。 CTB是根据速度决定行动对象,但木有AT条的一个东东。 可以看成是韩云溪半即时的加强版  发表于 2012-1-31 11:09
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 04:45

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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