查看: 2970|回复: 2

[已经过期] 求修改一下yanfly大佬的这部分脚本

[复制链接]
梦石
1
星屑
3913
在线时间
592 小时
注册时间
2007-8-14
回帖
141
发表于 2018-4-5 16:11:33 | 显示全部楼层 |阅读模式

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

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

×
1.JPG
如图,因为只有3个角色,所以每个角色所占的面积很长,不太好看
所以请问有没有方法可以把脸图替换成立绘,就像下图这样:
2B5{5SL4A9XJT(3L{9S35.png

或者把脸图的部分替换成长条的图片,就像下图这样:
E~DP5[L12}WXR5`I`}3`L9E.png


赞美灵魂……
梦石
1
星屑
3913
在线时间
592 小时
注册时间
2007-8-14
回帖
141
 楼主| 发表于 2018-4-5 16:12:06 | 显示全部楼层
本帖最后由 cryhades 于 2018-4-5 16:46 编辑

忘记加脚本了……
附上脚本:
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - 战斗系统 v1.22
  4. # -- 最后更新: 2012.03.04
  5. # -- 使用难度: 普通, 困难
  6. # -- 需要脚本: 无
  7. #
  8. #==============================================================================

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

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.03.04 - Bug fixed: Input crash bug.
  15. # 2012.02.13 - Bug fixed: Odd Victory game crash fixed.
  16. # 2012.02.12 - Bug fixed: Displayed damage in combat log is correct now.
  17. # 2012.01.29 - Visual Changes: Buff stacks now show one popup upon one skill.
  18. # 2012.01.24 - Compatibility Update: Enemy Levels
  19. # 2012.01.18 - Bug Fixed: Help Window clears text upon selecting nil items.
  20. # 2012.01.11 - Added <one animation> tag for multi-hit skills to play an
  21. #              animation only once.
  22. #            - Reduced lag from battle system constantly recreating bitmaps.
  23. # 2012.01.10 - Compatibility Update: Battle System FTB
  24. # 2012.01.09 - Anticrash methods implemented.
  25. #            - Damage Popups are now separate for damage formulas and recovery.
  26. # 2012.01.05 - Bug fixed: Game no longer crashes with escape skills/items.
  27. # 2012.01.02 - Compatibility Update: Target Manager
  28. #            - Added Option: AUTO_FAST
  29. #            - Random hits now show animations individually.
  30. # 2011.12.30 - Compatibility Update: Enemy Levels
  31. #            - Added Option to center the actors in the HUD.
  32. # 2011.12.27 - Bug fixed: TP Damage skills and items no longer crash game.
  33. #            - Default battle system bug fixes are now included from YEA's Ace
  34. #              Core Engine.
  35. #            - Groundwork is also made to support future battle system types.
  36. #            - Multi-hit actions no longer linger when a target dies during the
  37. #              middle of one of the hits.
  38. #            - Compatibility Update: Lunatic Objects v1.02
  39. # 2011.12.26 - Bug fixed: Multi-hit popups occured even after an enemy's dead.
  40. # 2011.12.22 - Bug fixed: Elemental Resistance popup didn't show.
  41. # 2011.12.20 - Bug fixed: Death state popups against immortal states.
  42. #            - Bug fixed: During State popup fix.
  43. #            - Added HIDE_POPUP_SWITCH.
  44. # 2011.12.17 - Compatibiilty Update: Cast Animations
  45. # 2011.12.15 - Compatibility Update: Battle Command List
  46. # 2011.12.14 - Compatibility Update: Lunatic Objects
  47. # 2011.12.13 - Compatibility Update: Command Party
  48. # 2011.12.12 - Bug fixed: Turn stalling if no inputable members.
  49. # 2011.12.10 - Compatibility update for Automatic Party HUD.
  50. #            - Popup graphical bug fixed.
  51. #            - Bug fixed: Didn't wait for boss dead animations.
  52. #            - Bug fixed: Surprise attacks that froze the game.
  53. #            - Bug fixed: Popups didn't show for straight recovery effects.
  54. # 2011.12.08 - Finished Script.
  55. # 2011.12.04 - Started Script.
  56. #
  57. #==============================================================================
  58. # ▼ 介绍
  59. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  60. # 本脚本可以作为默认战斗系统的一个插件,允许你更轻松的管理战斗系统,自定义各种
  61. # 功能。
  62. # 以下为本脚本提供的新功能:
  63. #
  64. # -----------------------------------------------------------------------------
  65. # 动画修复
  66. # -----------------------------------------------------------------------------
  67. # 防止过多的动画重叠(使屏幕看起来非常难看),并防止动画在两个长时间播放的双持
  68. # 攻击动画之间发生冲突。
  69. # 尽管在Yanfly Engine Ace - 核心引擎 脚本中已经包含本修复内容,在本脚本中同样添
  70. # 加了此功能,以防止某些人不使用核心引擎脚本。
  71. #
  72. # -----------------------------------------------------------------------------
  73. # 敌人动画
  74. # -----------------------------------------------------------------------------
  75. # 敌人在攻击、使用技能时可以播放一个动画,而不是像原来的只是播放技能音效+画面震
  76. # 动。现在敌人使用的技能动画将在队伍状态栏处播放,且能追踪角色目标的位置。
  77. #
  78. # -----------------------------------------------------------------------------
  79. # 左/右 选择指令
  80. # -----------------------------------------------------------------------------
  81. # 默认下当你设定好前三个角色的行动后,到最后一个人行动了,想修改之前角色的行动
  82. # 时,你需要取消之前全部角色已设定好的行动。十分麻烦浪费时间。现在你可以通过左
  83. # 右方向键来选择你想要修改行动指令的角色了,变得方便快捷。还添加了玩家无需选择
  84. # "战斗"、"撤退"指令的功能。
  85. #
  86. # -----------------------------------------------------------------------------
  87. # 弹出式信息
  88. # -----------------------------------------------------------------------------
  89. # 造成伤害、添加状态、添加能力值增益、发动暴击、触发属性弱点、攻击未命中等都可以
  90. # 弹出式显示,明快而简介,玩家无须再阅读繁杂的战斗信息。
  91. #
  92. # -----------------------------------------------------------------------------
  93. # 选择目标时隐藏窗口
  94. # -----------------------------------------------------------------------------
  95. # 选择目标时会闪光强调选中的目标,同时在画面上方显示该敌人的名字。在多个目标的
  96. # 技能中,添加了确认步骤。在确认步骤中全部目标会被强调,帮助窗口中也会显示技能
  97. # 的范围(像 "全体敌人"或"一个随机敌人").RPG Maker VX Ace默认下是跳过这一步骤的.
  98. #
  99. # -----------------------------------------------------------------------------
  100. # 开启或关闭特殊效果及文本
  101. # -----------------------------------------------------------------------------
  102. # 不是所有人都喜欢角色受伤时画面震动或敌人受伤时闪烁的。这些效果可以选择性开启
  103. # 或关闭。某些文本你也可以选择显示或隐藏。在弹出式信息中弹出太多文本会显得冗杂。
  104. #
  105. # -----------------------------------------------------------------------------
  106. # 可视战斗状态窗口
  107. # -----------------------------------------------------------------------------
  108. # 不像默认只包含角色名字、HPMP条的角色状态窗口,新的状态窗口可以显示角色脸图,
  109. # 滚动显示多个状态等。同时你还可以降低状态窗口的刷新率,避免潜在的系统卡顿。
  110. #
  111. # -----------------------------------------------------------------------------
  112. # 改变窗口位置
  113. # -----------------------------------------------------------------------------
  114. # 技能和物品窗口不会覆盖在战场上,遮挡玩家视线了,而是显示在靠下的地方。
  115. #
  116. #==============================================================================
  117. # ▼ 安装方式
  118. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  119. # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
  120. # 脚本页/槽中.记得保存你的工程以使脚本生效.
  121. #
  122. # -----------------------------------------------------------------------------
  123. # 技能备注 - 在数据库-技能中可以使用的备注.
  124. # -----------------------------------------------------------------------------
  125. # <单个动画>
  126. # 可以使多目标的技能只显示一个动画.
  127. #
  128. # -----------------------------------------------------------------------------
  129. # 物品备注 - 在数据库-物品中可以使用的备注.
  130. # -----------------------------------------------------------------------------
  131. # <单个动画>
  132. # 可以使多目标的物品只显示一个动画.
  133. #
  134. # -----------------------------------------------------------------------------
  135. # 敌人备注 - 在数据库-敌人中可以使用的备注.
  136. # -----------------------------------------------------------------------------
  137. # <攻击动画1: x>
  138. # <攻击动画2: x>
  139. # 改变敌人的普通攻击动画为x号动画。如果攻击动画2存在的话,则攻击动画2会在攻击动
  140. # 画1之后显示,并且会左右镜像反转。(制造左一拳、右一拳的效果)
  141. #
  142. # -----------------------------------------------------------------------------
  143. # 状态备注 - 在数据库-状态中可以使用的备注.
  144. # -----------------------------------------------------------------------------
  145. # <添加方式: 显示方式>
  146. # <移除方式: 显示方式>
  147. # <持续方式: 显示方式>
  148. # 如果你不希望某个状态使用默认的显示方式的话,可以用以上备注来改变某个状态添加、
  149. # 移除或持续的显示方式。将"显示方式"替换为下面"POPUP_RULES"包含的显示方式。
  150. #
  151. # <不显示添加>
  152. # <不显示移除>
  153. # <不显示持续>
  154. # 使用以上备注来隐藏状态的添加、移除或持续效果。
  155. #
  156. # -----------------------------------------------------------------------------
  157. # 调试工具 - 仅在游戏测试或战斗测试中有效.
  158. # -----------------------------------------------------------------------------
  159. # - F5 键 -
  160. # 回复全部角色,使其HP、MP完全回复,TP不变,移除全部状态。
  161. #
  162. # - F6 键 -
  163. # 将全部角色设定为 1 HP, 0 MP,  0 TP.
  164. #
  165. # - F7 键 -
  166. # 将全部角色的TP值加满.
  167. #
  168. # - F8 键 -
  169. # 消灭全部敌人,迅速结束战斗.
  170. #
  171. #==============================================================================
  172. # ▼ 兼容性
  173. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  174. # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
  175. #
  176. #==============================================================================

  177. module YEA
  178.   module BATTLE
  179.    
  180.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  181.     # - 通用战斗设置 -
  182.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  183.     BLINK_EFFECTS      = false  # 是否在被伤害时闪烁?
  184.     FLASH_WHITE_EFFECT = true   # 是否在敌人发动攻击时将其闪烁?
  185.     SCREEN_SHAKE       = false  # 是否开启震动?
  186.     SKIP_PARTY_COMMAND = true   # 是否跳过 "战斗/撤退" 菜单.
  187.     AUTO_FAST          = true   # 是否加速战斗信息窗口的信息显示速度
  188.     ENEMY_ATK_ANI      = 36     # 设定敌人的普通攻击动画
  189.    
  190.     # 隐藏弹出式信息的开关,开启时隐藏,关闭时显示,不想使用这个功能的话设定为0
  191.     HIDE_POPUP_SWITCH  = 0
  192.    
  193.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  194.     # - 默认战斗系统 -
  195.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  196.     # 设定战斗系统类型,默认为回合制战斗.
  197.     #
  198.     # 战斗系统               解释
  199.     #   :dtb               - 默认的回合制战斗.
  200.     #   :ftb               - 需要脚本 YEA 战斗系统插件: 半回合制战斗(FTP)
  201.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  202.     #DEFAULT_BATTLE_SYSTEM = :dtb     # 默认战斗系统.二选一
  203.     DEFAULT_BATTLE_SYSTEM = :ftb     # 半回合战斗系统.二选一
  204.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  205.     # - 角色状态窗口 -
  206.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  207.     BATTLESTATUS_NAME_FONT_SIZE = 20    # 名称字体大小.
  208.     BATTLESTATUS_TEXT_FONT_SIZE = 16    # HP, MP, TP的字体大小
  209.     BATTLESTATUS_NO_ACTION_ICON = 185   # 无任何行动的图标.
  210.     BATTLESTATUS_HPGAUGE_Y_PLUS = 11    # HP条的Y坐标调整.
  211.     BATTLESTATUS_CENTER_FACES   = false # 是否将脸图居中.
  212.    
  213.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  214.     # - 帮助窗口文版 -
  215.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  216.     # 设定特殊技能效果范围的文本。
  217.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  218.     HELP_TEXT_ALL_FOES        = "全体敌人"
  219.     HELP_TEXT_ONE_RANDOM_FOE  = "一个随机敌人"
  220.     HELP_TEXT_MANY_RANDOM_FOE = "%d个随机敌人"
  221.     HELP_TEXT_ALL_ALLIES      = "全体队友"
  222.     HELP_TEXT_ALL_DEAD_ALLIES = "全体队友(无法战斗)"
  223.     HELP_TEXT_ONE_RANDOM_ALLY = "一个随机队友"
  224.     HELP_TEXT_RANDOM_ALLIES   = "%d个随机队友"
  225.    
  226.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  227.     # - 弹出式信息显示 -
  228.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  229.     ENABLE_POPUPS  = true     # 是否显示弹出式信息.
  230.     FLASH_CRITICAL = true     # 暴击时是否闪烁.
  231.    
  232.     # 设定弹出式信息
  233.     POPUP_SETTINGS ={
  234.       :offset     => -24,       # 高度.
  235.       :fade       => 12,        # 淡出速率.
  236.       :full       => 60,        # 淡出前的等待时间.
  237.       :hp_dmg     => "-%s ",    # HP伤害的文本.
  238.       :hp_heal    => "+%s ",    # HP回复的文本.
  239.       :mp_dmg     => "-%s MP",  # MP伤害的文本.
  240.       :mp_heal    => "+%s MP",  # MP回复的文本.
  241.       :tp_dmg     => "-%s TP",  # TP伤害的文本.
  242.       :tp_heal    => "+%s TP",  # TP回复的文本.
  243.       :drained    => "吸收",    # 吸收 HP/MP 的文本.
  244.       :critical   => "暴击!",   # 暴击的文本.
  245.       :missed     => "未命中",  # 未命中的文本
  246.       :evaded     => "闪避!",   # 闪避的文本
  247.       :nulled     => "无效果",  # 无攻击效果的文本
  248.       :failed     => "失败",    # 攻击失败的文本
  249.       :add_state  => "+%s",     # 添加状态的文本
  250.       :rem_state  => "-%s",     # 移除状态的文本
  251.       :dur_state  => "%s",      # 状态持续的文本
  252.       :ele_rates  => true,      # 是否显示属性效果.
  253.       :ele_wait   => 20,        # 属性效果的等待时间.
  254.       :weakpoint  => "弱点",    # 该属性为敌人弱点的文本
  255.       :resistant  => "抵抗",    # 该属性被敌人抵抗的文本
  256.       :immune     => "无效",    # 该属性对敌人无效的文本
  257.       :absorbed   => "吸收",    # 该属性被敌人吸收的文本
  258.       :add_buff   => "%s+",    # 强化能力的文本
  259.       :add_debuff => "%s-",    # 弱化能力的文本
  260.     } # 别动这个括号.
  261.    
  262.     # 默认字体设定
  263.     DEFAULT = ["黑体", "微软雅黑", "宋体"]
  264.    
  265.     # 以下为弹出式信息的显示方式:
  266.     #   缩放1    缩放的起始大小. 数值超过2.0可能会造成卡顿.
  267.     #   缩放2    缩放的结束大小.数值超过2.0可能会造成卡顿.
  268.     #   大小     文本字体大小.
  269.     #   加粗     字体是否加粗.
  270.     #   斜体     字体是否斜体.
  271.     #   红       字体颜色的红色值.
  272.     #   绿       字体颜色的绿色值.
  273.     #   蓝       字体颜色的蓝色值.
  274.     #   字体     使用的字体,使用默认字体则填入"DEFAULT".
  275.     POPUP_RULES ={
  276.       # 方式     => [ 缩放1, 缩放2,大小,加粗,   斜体,  红,  绿,  蓝,    字体],
  277.       "DEFAULT"  => [  2.0,   1.0,  24, true,  false, 255, 255, 255, DEFAULT],
  278.       "CRITICAL" => [  2.0,   1.0,  24, true,  false, 255,  80,  80, DEFAULT],
  279.       "HP_DMG"   => [  2.0,   1.0,  36, true,  false, 255, 255, 255, DEFAULT],
  280.       "HP_HEAL"  => [  2.0,   1.0,  36, true,  false, 130, 250, 130, DEFAULT],
  281.       "MP_DMG"   => [  2.0,   1.0,  36, true,  false, 220, 180, 255, DEFAULT],
  282.       "MP_HEAL"  => [  2.0,   1.0,  36, true,  false, 160, 230, 255, DEFAULT],
  283.       "TP_DMG"   => [  2.0,   1.0,  36, true,  false, 242, 108,  78, DEFAULT],
  284.       "TP_HEAL"  => [  2.0,   1.0,  36, true,  false, 251, 175,  92, DEFAULT],
  285.       "ADDSTATE" => [  2.0,   1.0,  24, true,  false, 240, 100, 100, DEFAULT],
  286.       "REMSTATE" => [  2.0,   1.0,  24, true,  false, 125, 170, 225, DEFAULT],
  287.       "DURSTATE" => [  2.0,   1.0,  24, true,  false, 255, 240, 150, DEFAULT],
  288.       "DRAIN"    => [  2.0,   1.0,  36, true,  false, 250, 190, 255, DEFAULT],
  289.       "POSITIVE" => [  2.0,   1.0,  24, true,  false, 110, 210, 245, DEFAULT],
  290.       "NEGATIVE" => [  2.0,   1.0,  24, true,  false, 245, 155, 195, DEFAULT],
  291.       "WEAK_ELE" => [  0.5,   1.0,  24, true,  false, 240, 110,  80, DEFAULT],
  292.       "IMMU_ELE" => [  0.5,   1.0,  24, true,  false, 185, 235, 255, DEFAULT],
  293.       "REST_ELE" => [  0.5,   1.0,  24, true,  false, 145, 230, 180, DEFAULT],
  294.       "ABSB_ELE" => [  0.5,   1.0,  24, true,  false, 250, 190, 255, DEFAULT],
  295.       "BUFF"     => [  2.0,   1.0,  24, true,  false, 255, 240, 100, DEFAULT],
  296.       "DEBUFF"   => [  2.0,   1.0,  24, true,  false, 160, 130, 200, DEFAULT],
  297.     } # 别动这个括号.
  298.    
  299.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  300.     # - 简化信息 -
  301.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  302.     # 想要移除一些冗杂烦人的弹出式信息吗?在下面设定吧!
  303.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  304.     MSG_ENEMY_APPEARS  = false  # 是否显示战斗开始时敌人出现的文本.
  305.     MSG_CURRENT_STATE  = false  # 是否显示状态的影响
  306.     MSG_CURRENT_ACTION = true   # 是否显示当前角色/敌人的行动
  307.     MSG_COUNTERATTACK  = true   # 是否显示反击的文本
  308.     MSG_REFLECT_MAGIC  = true   # 是否显示魔法反射的文本
  309.     MSG_SUBSTITUTE_HIT = true   # 是否显示替身文本
  310.     MSG_FAILURE_HIT    = false  # 是否显示效果对目标无效
  311.     MSG_CRITICAL_HIT   = false  # 是否显示暴击文本
  312.     MSG_HIT_MISSED     = false  # 是否显示未命中文本
  313.     MSG_EVASION        = false  # 是否显示闪避文本
  314.     MSG_HP_DAMAGE      = false  # 是否显示对目标造成的HP伤害
  315.     MSG_MP_DAMAGE      = false  # 是否显示对目标造成的MP伤害
  316.     MSG_TP_DAMAGE      = false  # 是否显示对目标造成的TP伤害
  317.     MSG_ADDED_STATES   = false  # 是否显示添加状态的文本
  318.     MSG_REMOVED_STATES = false  # 是否显示移除状态的文本
  319.     MSG_CHANGED_BUFFS  = false  # 是否显示状态持续的文本
  320.    
  321.   end # BATTLE
  322. end # YEA

  323. #==============================================================================
  324. # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
  325. # 所以编辑了后果自负。
  326. #==============================================================================

  327. module YEA
  328.   module REGEXP
  329.   module ENEMY
  330.    
  331.     ATK_ANI1 = /<(?:ATK_ANI_1|攻击动画1):[ ]*(\d+)>/i
  332.     ATK_ANI2 = /<(?:ATK_ANI_2|攻击动画2):[ ]*(\d+)>/i
  333.    
  334.   end # ENEMY
  335.   module USABLEITEM
  336.    
  337.     ONE_ANIMATION = /<(?:ONE_ANIMATION|单个动画)>/i
  338.    
  339.   end # USABLEITEM
  340.   module STATE
  341.    
  342.     POPUP_ADD = /<(?:POPUP_ADD_RULE|添加方式 rule|添加方式):[ ](.*)>/i
  343.     POPUP_REM = /<(?:POPUP_REM_RULE|移除方式 rule|移除方式):[ ](.*)>/i
  344.     POPUP_DUR = /<(?:POPUP_DUR_RULE|持续方式 rule|持续方式):[ ](.*)>/i
  345.    
  346.     HIDE_ADD  = /<(?:POPUP_HIDE_ADD|不显示添加|hide add)>/i
  347.     HIDE_REM  = /<(?:POPUP_HIDE_REM|不显示移除|hide rem)>/i
  348.     HIDE_DUR  = /<(?:POPUP_HIDE_DUR|不显示持续|hide dur)>/i
  349.    
  350.   end # STATE
  351.   end # REGEXP
  352. end # YEA

  353. #==============================================================================
  354. # ■ Switch
  355. #==============================================================================

  356. module Switch
  357.   
  358.   #--------------------------------------------------------------------------
  359.   # self.hide_popups
  360.   #--------------------------------------------------------------------------
  361.   def self.hide_popups
  362.     return false if YEA::BATTLE::HIDE_POPUP_SWITCH <= 0
  363.     return $game_switches[YEA::BATTLE::HIDE_POPUP_SWITCH]
  364.   end
  365.   
  366. end # Switch

  367. #==============================================================================
  368. # ■ Colour
  369. #==============================================================================

  370. module Colour
  371.   
  372.   #--------------------------------------------------------------------------
  373.   # self.text_colour
  374.   #--------------------------------------------------------------------------
  375.   def self.text_colour(index)
  376.     windowskin = Cache.system("Window")
  377.     x = 64 + (index % 8) * 8
  378.     y = 96 + (index / 8) * 8
  379.     return windowskin.get_pixel(x, y)
  380.   end
  381.   
  382. end # Colour

  383. #==============================================================================
  384. # ■ Icon
  385. #==============================================================================

  386. module Icon
  387.   
  388.   #--------------------------------------------------------------------------
  389.   # self.no_action
  390.   #--------------------------------------------------------------------------
  391.   def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
  392.    
  393. end # Icon

  394. #==============================================================================
  395. # ■ Numeric
  396. #==============================================================================

  397. class Numeric
  398.   
  399.   #--------------------------------------------------------------------------
  400.   # new method: group_digits
  401.   #--------------------------------------------------------------------------
  402.   unless $imported["YEA-CoreEngine"]
  403.   def group; return self.to_s; end
  404.   end # $imported["YEA-CoreEngine"]
  405.    
  406. end # Numeric

  407. #==============================================================================
  408. # ■ DataManager
  409. #==============================================================================

  410. module DataManager
  411.   
  412.   #--------------------------------------------------------------------------
  413.   # alias method: load_database
  414.   #--------------------------------------------------------------------------
  415.   class <<self; alias load_database_abe load_database; end
  416.   def self.load_database
  417.     load_database_abe
  418.     load_notetags_abe
  419.   end
  420.   
  421.   #--------------------------------------------------------------------------
  422.   # new method: load_notetags_abe
  423.   #--------------------------------------------------------------------------
  424.   def self.load_notetags_abe
  425.     groups = [$data_enemies, $data_states, $data_skills, $data_items]
  426.     for group in groups
  427.       for obj in group
  428.         next if obj.nil?
  429.         obj.load_notetags_abe
  430.       end
  431.     end
  432.   end
  433.   
  434. end # DataManager

  435. #==============================================================================
  436. # ■ RPG::UsableItem
  437. #==============================================================================

  438. class RPG::UsableItem < RPG::BaseItem
  439.   
  440.   #--------------------------------------------------------------------------
  441.   # public instance variables
  442.   #--------------------------------------------------------------------------
  443.   attr_accessor :one_animation
  444.   
  445.   #--------------------------------------------------------------------------
  446.   # common cache: load_notetags_abe
  447.   #--------------------------------------------------------------------------
  448.   def load_notetags_abe
  449.     @one_animation = false
  450.     #---
  451.     self.note.split(/[\r\n]+/).each { |line|
  452.       case line
  453.       #---
  454.       when YEA::REGEXP::USABLEITEM::ONE_ANIMATION
  455.         @one_animation = true
  456.       end
  457.     } # self.note.split
  458.     #---
  459.   end
  460.   
  461. end # RPG::UsableItem

  462. #==============================================================================
  463. # ■ RPG::Enemy
  464. #==============================================================================

  465. class RPG::Enemy < RPG::BaseItem
  466.   
  467.   #--------------------------------------------------------------------------
  468.   # public instance variables
  469.   #--------------------------------------------------------------------------
  470.   attr_accessor :atk_animation_id1
  471.   attr_accessor :atk_animation_id2
  472.   
  473.   #--------------------------------------------------------------------------
  474.   # common cache: load_notetags_abe
  475.   #--------------------------------------------------------------------------
  476.   def load_notetags_abe
  477.     @atk_animation_id1 = YEA::BATTLE::ENEMY_ATK_ANI
  478.     @atk_animation_id2 = 0
  479.     #---
  480.     self.note.split(/[\r\n]+/).each { |line|
  481.       case line
  482.       #---
  483.       when YEA::REGEXP::ENEMY::ATK_ANI1
  484.         @atk_animation_id1 = $1.to_i
  485.       when YEA::REGEXP::ENEMY::ATK_ANI2
  486.         @atk_animation_id2 = $1.to_i
  487.       end
  488.     } # self.note.split
  489.     #---
  490.   end
  491.   
  492. end # RPG::Enemy

  493. #==============================================================================
  494. # ■ RPG::Enemy
  495. #==============================================================================

  496. class RPG::State < RPG::BaseItem
  497.   
  498.   #--------------------------------------------------------------------------
  499.   # public instance variables
  500.   #--------------------------------------------------------------------------
  501.   attr_accessor :popup_rules
  502.   
  503.   #--------------------------------------------------------------------------
  504.   # common cache: load_notetags_abe
  505.   #--------------------------------------------------------------------------
  506.   def load_notetags_abe
  507.     @popup_rules = {
  508.       :add_state => "ADDSTATE",
  509.       :rem_state => "REMSTATE",
  510.       :dur_state => nil
  511.     } # Do not remove this.
  512.     #---
  513.     self.note.split(/[\r\n]+/).each { |line|
  514.       case line
  515.       #---
  516.       when YEA::REGEXP::STATE::POPUP_ADD
  517.         @popup_rules[:add_state] = $1.upcase.to_s
  518.       when YEA::REGEXP::STATE::POPUP_REM
  519.         @popup_rules[:rem_state] = $1.upcase.to_s
  520.       when YEA::REGEXP::STATE::POPUP_DUR
  521.         @popup_rules[:dur_state] = $1.upcase.to_s
  522.       when YEA::REGEXP::STATE::HIDE_ADD
  523.         @popup_rules[:add_state] = nil
  524.       when YEA::REGEXP::STATE::HIDE_REM
  525.         @popup_rules[:rem_state] = nil
  526.       when YEA::REGEXP::STATE::HIDE_DUR
  527.         @popup_rules[:dur_state] = nil
  528.       end
  529.     } # self.note.split
  530.     #---
  531.   end
  532.   
  533. end # RPG::State

  534. #==============================================================================
  535. # ■ BattleManager
  536. #==============================================================================

  537. module BattleManager
  538.   
  539.   #--------------------------------------------------------------------------
  540.   # overwrite method: self.battle_start
  541.   #--------------------------------------------------------------------------
  542.   def self.battle_start
  543.     $game_system.battle_count += 1
  544.     $game_party.on_battle_start
  545.     $game_troop.on_battle_start
  546.     return unless YEA::BATTLE::MSG_ENEMY_APPEARS
  547.     $game_troop.enemy_names.each do |name|
  548.       $game_message.add(sprintf(Vocab::Emerge, name))
  549.     end
  550.     if @preemptive
  551.       $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
  552.     elsif @surprise
  553.       $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
  554.     end
  555.     wait_for_message
  556.   end
  557.   
  558.   #--------------------------------------------------------------------------
  559.   # overwrite method: make_action_orders
  560.   #--------------------------------------------------------------------------
  561.   def self.make_action_orders
  562.     make_dtb_action_orders if btype?(:dtb)
  563.   end
  564.   
  565.   #--------------------------------------------------------------------------
  566.   # new method: make_dtb_action_orders
  567.   #--------------------------------------------------------------------------
  568.   def self.make_dtb_action_orders
  569.     @action_battlers = []
  570.     @action_battlers += $game_party.members unless @surprise
  571.     @action_battlers += $game_troop.members unless @preemptive
  572.     @action_battlers.each {|battler| battler.make_speed }
  573.     @action_battlers.sort! {|a,b| b.speed - a.speed }
  574.   end
  575.   
  576.   #--------------------------------------------------------------------------
  577.   # overwrite method: turn_start
  578.   #--------------------------------------------------------------------------
  579.   def self.turn_start
  580.     @phase = :turn
  581.     clear_actor
  582.     $game_troop.increase_turn
  583.     @performed_battlers = []
  584.     make_action_orders
  585.   end
  586.   
  587.   #--------------------------------------------------------------------------
  588.   # overwrite method: next_subject
  589.   #--------------------------------------------------------------------------
  590.   def self.next_subject
  591.     @performed_battlers = [] if @performed_battlers.nil?
  592.     loop do
  593.       @action_battlers -= @performed_battlers
  594.       battler = @action_battlers.shift
  595.       return nil unless battler
  596.       next unless battler.index && battler.alive?
  597.       @performed_battlers.push(battler)
  598.       return battler
  599.     end
  600.   end
  601.   
  602.   #--------------------------------------------------------------------------
  603.   # overwrite method: force_action
  604.   #--------------------------------------------------------------------------
  605.   def self.force_action(battler)
  606.     @action_forced = [] if @action_forced == nil
  607.     @action_forced.push(battler)
  608.     return unless Switch.forced_action_remove
  609.     @action_battlers.delete(battler)
  610.   end
  611.   
  612.   #--------------------------------------------------------------------------
  613.   # overwrite method: action_forced?
  614.   #--------------------------------------------------------------------------
  615.   def self.action_forced?
  616.     @action_forced != nil
  617.   end
  618.   
  619.   #--------------------------------------------------------------------------
  620.   # overwrite method: action_forced_battler
  621.   #--------------------------------------------------------------------------
  622.   def self.action_forced_battler
  623.     @action_forced.shift
  624.   end
  625.   
  626.   #--------------------------------------------------------------------------
  627.   # overwrite method: clear_action_force
  628.   #--------------------------------------------------------------------------
  629.   def self.clear_action_force
  630.     return if @action_forced.nil?
  631.     @action_forced = nil if @action_forced.empty?
  632.   end
  633.   
  634.   #--------------------------------------------------------------------------
  635.   # new method: self.init_battle_type
  636.   #--------------------------------------------------------------------------
  637.   def self.init_battle_type
  638.     set_btype($game_system.battle_system)
  639.   end
  640.   
  641.   #--------------------------------------------------------------------------
  642.   # new method: self.set_btype
  643.   #--------------------------------------------------------------------------
  644.   def self.set_btype(btype = :dtb)
  645.     @battle_type = btype
  646.   end
  647.   
  648.   #--------------------------------------------------------------------------
  649.   # new method: self.btype?
  650.   #--------------------------------------------------------------------------
  651.   def self.btype?(btype)
  652.     return @battle_type == btype
  653.   end
  654.   
  655. end # BattleManager

  656. #==============================================================================
  657. # ■ Game_System
  658. #==============================================================================

  659. class Game_System
  660.   
  661.   #--------------------------------------------------------------------------
  662.   # new method: battle_system
  663.   #--------------------------------------------------------------------------
  664.   def battle_system
  665.     if @battle_system.nil?
  666.       return battle_system_corrected(YEA::BATTLE::DEFAULT_BATTLE_SYSTEM)
  667.     else
  668.       return battle_system_corrected(@battle_system)
  669.     end
  670.   end
  671.   
  672.   #--------------------------------------------------------------------------
  673.   # new method: set_battle_system
  674.   #--------------------------------------------------------------------------
  675.   def set_battle_system(type)
  676.     case type
  677.     when :dtb; @battle_system = :dtb
  678.     when :ftb; @battle_system = $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  679.     else;      @battle_system = :dtb
  680.     end
  681.   end
  682.   
  683.   #--------------------------------------------------------------------------
  684.   # new method: battle_system_corrected
  685.   #--------------------------------------------------------------------------
  686.   def battle_system_corrected(type)
  687.     case type
  688.     when :dtb; return :dtb
  689.     when :ftb; return $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  690.     else;      return :dtb
  691.     end
  692.   end
  693.   
  694. end # Game_System

  695. #==============================================================================
  696. # ■ Sprite_Base
  697. #==============================================================================

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

  716. #==============================================================================
  717. # ■ Sprite_Battler
  718. #==============================================================================

  719. class Sprite_Battler < Sprite_Base
  720.   
  721.   #--------------------------------------------------------------------------
  722.   # public instance variables
  723.   #--------------------------------------------------------------------------
  724.   attr_accessor :effect_type
  725.   attr_accessor :battler_visible
  726.   attr_accessor :popups
  727.   
  728.   #--------------------------------------------------------------------------
  729.   # alias method: initialize
  730.   #--------------------------------------------------------------------------
  731.   alias sprite_battler_initialize_abe initialize
  732.   def initialize(viewport, battler = nil)
  733.     sprite_battler_initialize_abe(viewport, battler)
  734.     @popups = []
  735.     @popup_flags = []
  736.   end
  737.   
  738.   #--------------------------------------------------------------------------
  739.   # alias method: update_bitmap
  740.   #--------------------------------------------------------------------------
  741.   alias sprite_battler_update_bitmap_abe update_bitmap
  742.   def update_bitmap
  743.     return if @battler.actor? && @battler.battler_name == ""
  744.     sprite_battler_update_bitmap_abe
  745.   end
  746.   
  747.   #--------------------------------------------------------------------------
  748.   # alias method: setup_new_animation
  749.   #--------------------------------------------------------------------------
  750.   unless $imported["YEA-CoreEngine"]
  751.   alias sprite_battler_setup_new_animation_abe setup_new_animation
  752.   def setup_new_animation
  753.     sprite_battler_setup_new_animation_abe
  754.     return if @battler.pseudo_ani_id <= 0
  755.     animation = $data_animations[@battler.pseudo_ani_id]
  756.     mirror = @battler.animation_mirror
  757.     start_pseudo_animation(animation, mirror)
  758.     @battler.pseudo_ani_id = 0
  759.   end
  760.   end # $imported["YEA-CoreEngine"]
  761.   
  762.   #--------------------------------------------------------------------------
  763.   # alias method: setup_new_effect
  764.   #--------------------------------------------------------------------------
  765.   alias sprite_battler_setup_new_effect_abe setup_new_effect
  766.   def setup_new_effect
  767.     sprite_battler_setup_new_effect_abe
  768.     setup_popups
  769.   end
  770.   
  771.   #--------------------------------------------------------------------------
  772.   # new method: setup_popups
  773.   #--------------------------------------------------------------------------
  774.   def setup_popups
  775.     return unless @battler.use_sprite?
  776.     @battler.popups = [] if @battler.popups.nil?
  777.     return if @battler.popups == []
  778.     array = @battler.popups.shift
  779.     create_new_popup(array[0], array[1], array[2])
  780.   end
  781.   
  782.   #--------------------------------------------------------------------------
  783.   # new method: create_new_popup
  784.   #--------------------------------------------------------------------------
  785.   def create_new_popup(value, rules, flags)
  786.     return if @battler == nil
  787.     return if flags & @popup_flags != []
  788.     array = YEA::BATTLE::POPUP_RULES[rules]
  789.     for popup in @popups
  790.       popup.y -= 24
  791.     end
  792.     return unless SceneManager.scene.is_a?(Scene_Battle)
  793.     return if SceneManager.scene.spriteset.nil?
  794.     view = SceneManager.scene.spriteset.viewportPopups
  795.     new_popup = Sprite_Popup.new(view, @battler, value, rules, flags)
  796.     @popups.push(new_popup)
  797.     @popup_flags.push("weakness") if flags.include?("weakness")
  798.     @popup_flags.push("resistant") if flags.include?("resistant")
  799.     @popup_flags.push("immune") if flags.include?("immune")
  800.     @popup_flags.push("absorbed") if flags.include?("absorbed")
  801.   end
  802.   
  803.   #--------------------------------------------------------------------------
  804.   # alias method: update_effect
  805.   #--------------------------------------------------------------------------
  806.   alias sprite_battler_update_effect_abe update_effect
  807.   def update_effect
  808.     sprite_battler_update_effect_abe
  809.     update_popups
  810.   end
  811.   
  812.   #--------------------------------------------------------------------------
  813.   # new method: update_popups
  814.   #--------------------------------------------------------------------------
  815.   def update_popups
  816.     for popup in @popups
  817.       popup.update
  818.       next unless popup.opacity <= 0
  819.       popup.bitmap.dispose
  820.       popup.dispose
  821.       @popups.delete(popup)
  822.       popup = nil
  823.     end
  824.     @popup_flags = [] if @popups == [] && @popup_flags != []
  825.     return unless SceneManager.scene_is?(Scene_Battle)
  826.     if @current_active_battler != SceneManager.scene.subject
  827.       @current_active_battler = SceneManager.scene.subject
  828.       @popup_flags = []
  829.     end
  830.   end
  831.   
  832. end # Sprite_Battler

  833. #==============================================================================
  834. # ■ Sprite_Popup
  835. #==============================================================================

  836. class Sprite_Popup < Sprite_Base
  837.   
  838.   #--------------------------------------------------------------------------
  839.   # public instance variables
  840.   #--------------------------------------------------------------------------
  841.   attr_accessor :flags
  842.   
  843.   #--------------------------------------------------------------------------
  844.   # initialize
  845.   #--------------------------------------------------------------------------
  846.   def initialize(viewport, battler, value, rules, flags)
  847.     super(viewport)
  848.     @value = value
  849.     @rules = rules
  850.     @rules = "DEFAULT" unless YEA::BATTLE::POPUP_RULES.include?(@rules)
  851.     @fade = YEA::BATTLE::POPUP_SETTINGS[:fade]
  852.     @full = YEA::BATTLE::POPUP_SETTINGS[:full]
  853.     @flags = flags
  854.     @battler = battler
  855.     create_popup_bitmap
  856.   end
  857.   
  858.   #--------------------------------------------------------------------------
  859.   # create_popup_bitmap
  860.   #--------------------------------------------------------------------------
  861.   def create_popup_bitmap
  862.     rules_array = YEA::BATTLE::POPUP_RULES[@rules]
  863.     bw = Graphics.width
  864.     bw += 48 if @flags.include?("state")
  865.     bh = Font.default_size * 3
  866.     bitmap = Bitmap.new(bw, bh)
  867.     bitmap.font.name = rules_array[8]
  868.     size = @flags.include?("critical") ? rules_array[2] * 1.2 : rules_array[2]
  869.     bitmap.font.size = size
  870.     bitmap.font.bold = rules_array[3]
  871.     bitmap.font.italic = rules_array[4]
  872.     if flags.include?("critical")
  873.       crit = YEA::BATTLE::POPUP_RULES["CRITICAL"]
  874.       bitmap.font.out_color.set(crit[5], crit[6], crit[7], 255)
  875.     else
  876.       bitmap.font.out_color.set(0, 0, 0, 255)
  877.     end
  878.     dx = 0; dy = 0; dw = 0
  879.     dx += 24 if @flags.include?("state")
  880.     dw += 24 if @flags.include?("state")
  881.     if @flags.include?("state") || @flags.include?("buff")
  882.       c_width = bitmap.text_size(@value).width
  883.       icon_bitmap = $game_temp.iconset
  884.       icon_index = flag_state_icon
  885.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  886.       bitmap.blt(dx+(bw-c_width)/2-36, (bh - 24)/2, icon_bitmap, rect, 255)
  887.     end
  888.     bitmap.font.color.set(rules_array[5], rules_array[6], rules_array[7])
  889.     bitmap.draw_text(dx, dy, bw-dw, bh, @value, 1)
  890.     self.bitmap = bitmap
  891.     self.x = @battler.screen_x
  892.     self.x += rand(4) - rand(4) if @battler.sprite.popups.size >= 1
  893.     self.x -= SceneManager.scene.spriteset.viewport1.ox
  894.     self.y = @battler.screen_y - @battler.sprite.oy/2
  895.     self.y -= @battler.sprite.oy/2 if @battler.actor?
  896.     self.y -= SceneManager.scene.spriteset.viewport1.oy
  897.     self.ox = bw/2; self.oy = bh/2
  898.     self.zoom_x = self.zoom_y = rules_array[0]
  899.     if @flags.include?("no zoom")
  900.       self.zoom_x = self.zoom_y = rules_array[1]
  901.     end
  902.     @target_zoom = rules_array[1]
  903.     @zoom_direction = (self.zoom_x > @target_zoom) ? "down" : "up"
  904.     self.z = 500
  905.   end
  906.   
  907.   #--------------------------------------------------------------------------
  908.   # update
  909.   #--------------------------------------------------------------------------
  910.   def update
  911.     super
  912.     #---
  913.     if @flags.include?("critical") && YEA::BATTLE::FLASH_CRITICAL
  914.       @hue_duration = 2 if @hue_duration == nil || @hue_duration == 0
  915.       @hue_duration -= 1
  916.       self.bitmap.hue_change(15) if @hue_duration <= 0
  917.     end
  918.     #---
  919.     if @zoom_direction == "up"
  920.       self.zoom_x = [self.zoom_x + 0.075, @target_zoom].min
  921.       self.zoom_y = [self.zoom_y + 0.075, @target_zoom].min
  922.     else
  923.       self.zoom_x = [self.zoom_x - 0.075, @target_zoom].max
  924.       self.zoom_y = [self.zoom_y - 0.075, @target_zoom].max
  925.     end
  926.     #---
  927.     @full -= 1
  928.     return if @full > 0
  929.     self.y -= 1
  930.     self.opacity -= @fade
  931.   end
  932.   
  933.   #--------------------------------------------------------------------------
  934.   # flag_state_icon
  935.   #--------------------------------------------------------------------------
  936.   def flag_state_icon
  937.     for item in @flags; return item if item.is_a?(Integer); end
  938.     return 0
  939.   end
  940.   
  941. end # Sprite_Popup

  942. #==============================================================================
  943. # ■ Spriteset_Battle
  944. #==============================================================================

  945. class Spriteset_Battle
  946.   
  947.   #--------------------------------------------------------------------------
  948.   # public instance variables
  949.   #--------------------------------------------------------------------------
  950.   attr_accessor :actor_sprites
  951.   attr_accessor :enemy_sprites
  952.   attr_accessor :viewport1
  953.   attr_accessor :viewportPopups
  954.   
  955.   #--------------------------------------------------------------------------
  956.   # alias method: create_viewports
  957.   #--------------------------------------------------------------------------
  958.   alias spriteset_battle_create_viewports_abe create_viewports
  959.   def create_viewports
  960.     spriteset_battle_create_viewports_abe
  961.     @viewportPopups = Viewport.new
  962.     @viewportPopups.z = 200
  963.   end
  964.   
  965.   #--------------------------------------------------------------------------
  966.   # alias method: dispose_viewports
  967.   #--------------------------------------------------------------------------
  968.   alias spriteset_battle_dispose_viewports_abe dispose_viewports
  969.   def dispose_viewports
  970.     spriteset_battle_dispose_viewports_abe
  971.     @viewportPopups.dispose
  972.   end
  973.   
  974.   #--------------------------------------------------------------------------
  975.   # alias method: update_viewports
  976.   #--------------------------------------------------------------------------
  977.   alias spriteset_battle_update_viewports_abe update_viewports
  978.   def update_viewports
  979.     spriteset_battle_update_viewports_abe
  980.     @viewportPopups.update
  981.   end
  982.   
  983. end # Spriteset_Battle

  984. #==============================================================================
  985. # ■ Game_Temp
  986. #==============================================================================

  987. class Game_Temp
  988.   
  989.   #--------------------------------------------------------------------------
  990.   # public instance variables
  991.   #--------------------------------------------------------------------------
  992.   attr_accessor :battle_aid
  993.   attr_accessor :evaluating
  994.   attr_accessor :iconset
  995.   
  996.   #--------------------------------------------------------------------------
  997.   # alias method: initialize
  998.   #--------------------------------------------------------------------------
  999.   alias game_temp_initialize_abe initialize
  1000.   def initialize
  1001.     game_temp_initialize_abe
  1002.     @iconset = Cache.system("Iconset")
  1003.   end
  1004.   
  1005. end # Game_Temp

  1006. #==============================================================================
  1007. # ■ Game_Action
  1008. #==============================================================================

  1009. class Game_Action
  1010.   
  1011.   #--------------------------------------------------------------------------
  1012.   # overwrite method: speed
  1013.   #--------------------------------------------------------------------------
  1014.   def speed
  1015.     speed = subject.agi
  1016.     speed += item.speed if item
  1017.     speed += subject.atk_speed if attack?
  1018.     return speed
  1019.   end
  1020.   
  1021.   #--------------------------------------------------------------------------
  1022.   # alias method: evaluate_item_with_target
  1023.   #--------------------------------------------------------------------------
  1024.   alias evaluate_item_with_target_abe evaluate_item_with_target
  1025.   def evaluate_item_with_target(target)
  1026.     $game_temp.evaluating = true
  1027.     result = evaluate_item_with_target_abe(target)
  1028.     $game_temp.evaluating = false
  1029.     return result
  1030.   end
  1031.   
  1032. end # Game_Action

  1033. #==============================================================================
  1034. # ■ Game_ActionResult
  1035. #==============================================================================

  1036. class Game_ActionResult
  1037.   
  1038.   #--------------------------------------------------------------------------
  1039.   # alias method: clear
  1040.   #--------------------------------------------------------------------------
  1041.   alias game_actionresult_clear_abe clear
  1042.   def clear
  1043.     game_actionresult_clear_abe
  1044.     clear_stored_damage
  1045.   end
  1046.   
  1047.   #--------------------------------------------------------------------------
  1048.   # new method: clear_stored_damage
  1049.   #--------------------------------------------------------------------------
  1050.   def clear_stored_damage
  1051.     @stored_hp_damage = 0
  1052.     @stored_mp_damage = 0
  1053.     @stored_tp_damage = 0
  1054.     @stored_hp_drain = 0
  1055.     @stored_mp_drain = 0
  1056.   end
  1057.   
  1058.   #--------------------------------------------------------------------------
  1059.   # new method: store_damage
  1060.   #--------------------------------------------------------------------------
  1061.   def store_damage
  1062.     @stored_hp_damage += @hp_damage
  1063.     @stored_mp_damage += @mp_damage
  1064.     @stored_tp_damage += @tp_damage
  1065.     @stored_hp_drain += @hp_drain
  1066.     @stored_mp_drain += @mp_drain
  1067.   end
  1068.   
  1069.   #--------------------------------------------------------------------------
  1070.   # new method: restore_damage
  1071.   #--------------------------------------------------------------------------
  1072.   def restore_damage
  1073.     @hp_damage = @stored_hp_damage
  1074.     @mp_damage = @stored_mp_damage
  1075.     @tp_damage = @stored_tp_damage
  1076.     @hp_drain = @stored_hp_drain
  1077.     @mp_drain = @stored_mp_drain
  1078.     clear_stored_damage
  1079.   end
  1080.   
  1081. end # Game_ActionResult

  1082. #==============================================================================
  1083. # ■ Game_BattlerBase
  1084. #==============================================================================

  1085. class Game_BattlerBase
  1086.   
  1087.   #--------------------------------------------------------------------------
  1088.   # public instance variables
  1089.   #--------------------------------------------------------------------------
  1090.   attr_accessor :popups
  1091.   
  1092.   #--------------------------------------------------------------------------
  1093.   # new method: create_popup
  1094.   #--------------------------------------------------------------------------
  1095.   def create_popup(value, rules = "DEFAULT", flags = [])
  1096.     return unless SceneManager.scene_is?(Scene_Battle)
  1097.     return unless YEA::BATTLE::ENABLE_POPUPS
  1098.     return if Switch.hide_popups
  1099.     @popups = [] if @popups.nil?
  1100.     @popups.push([value, rules, flags])
  1101.   end
  1102.   
  1103.   #--------------------------------------------------------------------------
  1104.   # new method: make_damage_popups
  1105.   #--------------------------------------------------------------------------
  1106.   def make_damage_popups(user)
  1107.     if @result.hp_drain != 0
  1108.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  1109.       rules = "DRAIN"
  1110.       user.create_popup(text, rules)
  1111.       setting = :hp_dmg  if @result.hp_drain < 0
  1112.       setting = :hp_heal if @result.hp_drain > 0
  1113.       rules = "HP_DMG"   if @result.hp_drain < 0
  1114.       rules = "HP_HEAL"  if @result.hp_drain > 0
  1115.       value = @result.hp_drain.abs
  1116.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1117.       user.create_popup(text, rules)
  1118.     end
  1119.     if @result.mp_drain != 0
  1120.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  1121.       rules = "DRAIN"
  1122.       user.create_popup(text, rules)
  1123.       setting = :mp_dmg  if @result.mp_drain < 0
  1124.       setting = :mp_heal if @result.mp_drain > 0
  1125.       rules = "HP_DMG"   if @result.mp_drain < 0
  1126.       rules = "HP_HEAL"  if @result.mp_drain > 0
  1127.       value = @result.mp_drain.abs
  1128.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1129.       user.create_popup(text, rules)
  1130.     end
  1131.     #---
  1132.     flags = []
  1133.     flags.push("critical") if @result.critical
  1134.     if @result.hp_damage != 0
  1135.       setting = :hp_dmg  if @result.hp_damage > 0
  1136.       setting = :hp_heal if @result.hp_damage < 0
  1137.       rules = "HP_DMG"   if @result.hp_damage > 0
  1138.       rules = "HP_HEAL"  if @result.hp_damage < 0
  1139.       value = @result.hp_damage.abs
  1140.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1141.       create_popup(text, rules, flags)
  1142.     end
  1143.     if @result.mp_damage != 0
  1144.       setting = :mp_dmg  if @result.mp_damage > 0
  1145.       setting = :mp_heal if @result.mp_damage < 0
  1146.       rules = "MP_DMG"   if @result.mp_damage > 0
  1147.       rules = "MP_HEAL"  if @result.mp_damage < 0
  1148.       value = @result.mp_damage.abs
  1149.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1150.       create_popup(text, rules, flags)
  1151.     end
  1152.     if @result.tp_damage != 0
  1153.       setting = :tp_dmg  if @result.tp_damage > 0
  1154.       setting = :tp_heal if @result.tp_damage < 0
  1155.       rules = "TP_DMG"   if @result.tp_damage > 0
  1156.       rules = "TP_HEAL"  if @result.tp_damage < 0
  1157.       value = @result.tp_damage.abs
  1158.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1159.       create_popup(text, rules)
  1160.     end
  1161.     @result.store_damage
  1162.     @result.clear_damage_values
  1163.   end
  1164.   
  1165.   #--------------------------------------------------------------------------
  1166.   # alias method: erase_state
  1167.   #--------------------------------------------------------------------------
  1168.   alias game_battlerbase_erase_state_abe erase_state
  1169.   def erase_state(state_id)
  1170.     make_state_popup(state_id, :rem_state) if @states.include?(state_id)
  1171.     game_battlerbase_erase_state_abe(state_id)
  1172.   end
  1173.   
  1174.   #--------------------------------------------------------------------------
  1175.   # new method: make_during_state_popup
  1176.   #--------------------------------------------------------------------------
  1177.   def make_during_state_popup
  1178.     state_id = most_important_state_id
  1179.     return if state_id == 0
  1180.     make_state_popup(state_id, :dur_state)
  1181.   end
  1182.   
  1183.   #--------------------------------------------------------------------------
  1184.   # new method: most_important_state_id
  1185.   #--------------------------------------------------------------------------
  1186.   def most_important_state_id
  1187.     states.each {|state| return state.id unless state.message3.empty? }
  1188.     return 0
  1189.   end
  1190.   
  1191.   #--------------------------------------------------------------------------
  1192.   # new method: make_state_popup
  1193.   #--------------------------------------------------------------------------
  1194.   def make_state_popup(state_id, type)
  1195.     state = $data_states[state_id]
  1196.     return if state.icon_index == 0
  1197.     rules = state.popup_rules[type]
  1198.     return if rules.nil?
  1199.     text = sprintf(YEA::BATTLE::POPUP_SETTINGS[type], state.name)
  1200.     flags = ["state", state.icon_index]
  1201.     create_popup(text, rules, flags)
  1202.   end
  1203.   
  1204.   #--------------------------------------------------------------------------
  1205.   # new method: make_miss_popups
  1206.   #--------------------------------------------------------------------------
  1207.   def make_miss_popups(user, item)
  1208.     return if dead?
  1209.     if @result.missed
  1210.       text = YEA::BATTLE::POPUP_SETTINGS[:missed]
  1211.       rules = "DEFAULT"
  1212.       create_popup(text, rules)
  1213.     end
  1214.     if @result.evaded
  1215.       text = YEA::BATTLE::POPUP_SETTINGS[:evaded]
  1216.       rules = "DEFAULT"
  1217.       create_popup(text, rules)
  1218.     end
  1219.     if @result.hit? && !@result.success
  1220.       text = YEA::BATTLE::POPUP_SETTINGS[:failed]
  1221.       rules = "DEFAULT"
  1222.       create_popup(text, rules)
  1223.     end
  1224.     if @result.hit? && item.damage.to_hp?
  1225.       if @result.hp_damage == 0 && @result.hp_damage == 0
  1226.         text = YEA::BATTLE::POPUP_SETTINGS[:nulled]
  1227.         rules = "DEFAULT"
  1228.         create_popup(text, rules)
  1229.       end
  1230.     end
  1231.   end
  1232.   
  1233.   #--------------------------------------------------------------------------
  1234.   # new method: make_rate_popup
  1235.   #--------------------------------------------------------------------------
  1236.   def make_rate_popup(rate)
  1237.     return if rate == 1.0
  1238.     flags = []
  1239.     if rate > 1.0
  1240.       text = YEA::BATTLE::POPUP_SETTINGS[:weakpoint]
  1241.       rules = "WEAK_ELE"
  1242.       flags.push("weakness")
  1243.     elsif rate == 0.0
  1244.       text = YEA::BATTLE::POPUP_SETTINGS[:immune]
  1245.       rules = "IMMU_ELE"
  1246.       flags.push("immune")
  1247.     elsif rate < 0.0
  1248.       text = YEA::BATTLE::POPUP_SETTINGS[:absorbed]
  1249.       rules = "ABSB_ELE"
  1250.       flags.push("absorbed")
  1251.     else
  1252.       text = YEA::BATTLE::POPUP_SETTINGS[:resistant]
  1253.       rules = "REST_ELE"
  1254.       flags.push("resistant")
  1255.     end
  1256.     create_popup(text, rules, flags)
  1257.   end
  1258.   
  1259.   #--------------------------------------------------------------------------
  1260.   # new method: make_buff_popup
  1261.   #--------------------------------------------------------------------------
  1262.   def make_buff_popup(param_id, positive = true)
  1263.     return unless SceneManager.scene_is?(Scene_Battle)
  1264.     return unless alive?
  1265.     name = Vocab::param(param_id)
  1266.     if positive
  1267.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_buff], name)
  1268.       rules = "BUFF"
  1269.       buff_level = 1
  1270.     else
  1271.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_debuff], name)
  1272.       rules = "DEBUFF"
  1273.       buff_level = -1
  1274.     end
  1275.     icon = buff_icon_index(buff_level, param_id)
  1276.     flags = ["buff", icon]
  1277.     return if @popups.include?([text, rules, flags])
  1278.     create_popup(text, rules, flags)
  1279.   end
  1280.   
  1281. end # Game_BattlerBase

  1282. #==============================================================================
  1283. # ■ Game_Battler
  1284. #==============================================================================

  1285. class Game_Battler < Game_BattlerBase
  1286.   
  1287.   #--------------------------------------------------------------------------
  1288.   # public instance variables
  1289.   #--------------------------------------------------------------------------
  1290.   attr_accessor :pseudo_ani_id
  1291.   
  1292.   #--------------------------------------------------------------------------
  1293.   # alias method: on_battle_end
  1294.   #--------------------------------------------------------------------------
  1295.   alias game_battler_on_battle_end_abe on_battle_end
  1296.   def on_battle_end
  1297.     game_battler_on_battle_end_abe
  1298.     @popups = []
  1299.   end
  1300.   
  1301.   #--------------------------------------------------------------------------
  1302.   # alias method: clear_sprite_effects
  1303.   #--------------------------------------------------------------------------
  1304.   alias game_battler_clear_sprite_effects_abe clear_sprite_effects
  1305.   def clear_sprite_effects
  1306.     game_battler_clear_sprite_effects_abe
  1307.     @pseudo_ani_id = 0
  1308.   end
  1309.   
  1310.   #--------------------------------------------------------------------------
  1311.   # alias method: item_apply
  1312.   #--------------------------------------------------------------------------
  1313.   alias game_battler_item_apply_abe item_apply
  1314.   def item_apply(user, item)
  1315.     game_battler_item_apply_abe(user, item)
  1316.     make_miss_popups(user, item)
  1317.   end
  1318.   
  1319.   #--------------------------------------------------------------------------
  1320.   # alias method: make_damage_value
  1321.   #--------------------------------------------------------------------------
  1322.   alias game_battler_make_damage_value_abe make_damage_value
  1323.   def make_damage_value(user, item)
  1324.     game_battler_make_damage_value_abe(user, item)
  1325.     rate = item_element_rate(user, item)
  1326.     make_rate_popup(rate) unless $game_temp.evaluating
  1327.   end
  1328.   
  1329.   #--------------------------------------------------------------------------
  1330.   # alias method: execute_damage
  1331.   #--------------------------------------------------------------------------
  1332.   alias game_battler_execute_damage_abe execute_damage
  1333.   def execute_damage(user)
  1334.     game_battler_execute_damage_abe(user)
  1335.     make_damage_popups(user)
  1336.   end
  1337.   
  1338.   #--------------------------------------------------------------------------
  1339.   # alias method: item_effect_recover_hp
  1340.   #--------------------------------------------------------------------------
  1341.   alias game_battler_item_effect_recover_hp_abe item_effect_recover_hp
  1342.   def item_effect_recover_hp(user, item, effect)
  1343.     game_battler_item_effect_recover_hp_abe(user, item, effect)
  1344.     make_damage_popups(user)
  1345.   end
  1346.   
  1347.   #--------------------------------------------------------------------------
  1348.   # alias method: item_effect_recover_mp
  1349.   #--------------------------------------------------------------------------
  1350.   alias game_battler_item_effect_recover_mp_abe item_effect_recover_mp
  1351.   def item_effect_recover_mp(user, item, effect)
  1352.     game_battler_item_effect_recover_mp_abe(user, item, effect)
  1353.     make_damage_popups(user)
  1354.   end
  1355.   
  1356.   #--------------------------------------------------------------------------
  1357.   # alias method: item_effect_gain_tp
  1358.   #--------------------------------------------------------------------------
  1359.   alias game_battler_item_effect_gain_tp_abe item_effect_gain_tp
  1360.   def item_effect_gain_tp(user, item, effect)
  1361.     game_battler_item_effect_gain_tp_abe(user, item, effect)
  1362.     make_damage_popups(user)
  1363.   end
  1364.   
  1365.   #--------------------------------------------------------------------------
  1366.   # alias method: item_user_effect
  1367.   #--------------------------------------------------------------------------
  1368.   alias game_battler_item_user_effect_abe item_user_effect
  1369.   def item_user_effect(user, item)
  1370.     game_battler_item_user_effect_abe(user, item)
  1371.     @result.restore_damage
  1372.   end
  1373.   
  1374.   #--------------------------------------------------------------------------
  1375.   # alias method: add_new_state
  1376.   #--------------------------------------------------------------------------
  1377.   alias game_battler_add_new_state_abe add_new_state
  1378.   def add_new_state(state_id)
  1379.     game_battler_add_new_state_abe(state_id)
  1380.     make_state_popup(state_id, :add_state) if @states.include?(state_id)
  1381.   end
  1382.   
  1383.   #--------------------------------------------------------------------------
  1384.   # alias method: add_buff
  1385.   #--------------------------------------------------------------------------
  1386.   alias game_battler_add_buff_abe add_buff
  1387.   def add_buff(param_id, turns)
  1388.     make_buff_popup(param_id, true)
  1389.     game_battler_add_buff_abe(param_id, turns)
  1390.   end
  1391.   
  1392.   #--------------------------------------------------------------------------
  1393.   # alias method: add_debuff
  1394.   #--------------------------------------------------------------------------
  1395.   alias game_battler_add_debuff_abe add_debuff
  1396.   def add_debuff(param_id, turns)
  1397.     make_buff_popup(param_id, false)
  1398.     game_battler_add_debuff_abe(param_id, turns)
  1399.   end
  1400.   
  1401.   #--------------------------------------------------------------------------
  1402.   # alias method: regenerate_all
  1403.   #--------------------------------------------------------------------------
  1404.   alias game_battler_regenerate_all_abe regenerate_all
  1405.   def regenerate_all
  1406.     game_battler_regenerate_all_abe
  1407.     return unless alive?
  1408.     make_damage_popups(self)
  1409.   end
  1410.   
  1411.   #--------------------------------------------------------------------------
  1412.   # new method: can_collapse?
  1413.   #--------------------------------------------------------------------------
  1414.   def can_collapse?
  1415.     return false unless dead?
  1416.     unless actor?
  1417.       return false unless sprite.battler_visible
  1418.       array = [:collapse, :boss_collapse, :instant_collapse]
  1419.       return false if array.include?(sprite.effect_type)
  1420.     end
  1421.     return true
  1422.   end
  1423.   
  1424.   #--------------------------------------------------------------------------
  1425.   # new method: draw_mp?
  1426.   #--------------------------------------------------------------------------
  1427.   def draw_mp?; return true; end
  1428.   
  1429.   #--------------------------------------------------------------------------
  1430.   # new method: draw_tp?
  1431.   #--------------------------------------------------------------------------
  1432.   def draw_tp?
  1433.     return $data_system.opt_display_tp
  1434.   end
  1435.   
  1436. end # Game_Battler

  1437. #==============================================================================
  1438. # ■ Game_Actor
  1439. #==============================================================================

  1440. class Game_Actor < Game_Battler
  1441.   
  1442.   #--------------------------------------------------------------------------
  1443.   # overwrite method: perform_damage_effect
  1444.   #--------------------------------------------------------------------------
  1445.   def perform_damage_effect
  1446.     $game_troop.screen.start_shake(5, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
  1447.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1448.     Sound.play_actor_damage
  1449.   end
  1450.   
  1451.   #--------------------------------------------------------------------------
  1452.   # overwrite method: use_sprite?
  1453.   #--------------------------------------------------------------------------
  1454.   def use_sprite?; return true; end
  1455.    
  1456.   #--------------------------------------------------------------------------
  1457.   # new method: screen_x
  1458.   #--------------------------------------------------------------------------
  1459.   def screen_x
  1460.     return 0 unless SceneManager.scene_is?(Scene_Battle)
  1461.     status_window = SceneManager.scene.status_window
  1462.     return 0 if status_window.nil?
  1463.     item_rect_width = (status_window.width-24) / $game_party.max_battle_members
  1464.     ext = SceneManager.scene.info_viewport.ox
  1465.     rect = SceneManager.scene.status_window.item_rect(self.index)
  1466.     constant = 128 + 12
  1467.     return constant + rect.x + item_rect_width / 2 - ext
  1468.   end
  1469.   
  1470.   #--------------------------------------------------------------------------
  1471.   # new method: screen_y
  1472.   #--------------------------------------------------------------------------
  1473.   def screen_y
  1474.     return Graphics.height - 120 unless SceneManager.scene_is?(Scene_Battle)
  1475.     return Graphics.height - 120 if SceneManager.scene.status_window.nil?
  1476.     return Graphics.height - (SceneManager.scene.status_window.height * 7/8)
  1477.   end
  1478.   
  1479.   #--------------------------------------------------------------------------
  1480.   # new method: screen_z
  1481.   #--------------------------------------------------------------------------
  1482.   def screen_z; return 100; end
  1483.   
  1484.   #--------------------------------------------------------------------------
  1485.   # new method: sprite
  1486.   #--------------------------------------------------------------------------
  1487.   def sprite
  1488.     index = $game_party.battle_members.index(self)
  1489.     return SceneManager.scene.spriteset.actor_sprites[index]
  1490.   end
  1491.   
  1492.   #--------------------------------------------------------------------------
  1493.   # new method: draw_mp?
  1494.   #--------------------------------------------------------------------------
  1495.   def draw_mp?
  1496.     return true unless draw_tp?
  1497.     for skill in skills
  1498.       next unless added_skill_types.include?(skill.stype_id)
  1499.       return true if skill.mp_cost > 0
  1500.     end
  1501.     return false
  1502.   end
  1503.   
  1504.   #--------------------------------------------------------------------------
  1505.   # new method: draw_tp?
  1506.   #--------------------------------------------------------------------------
  1507.   def draw_tp?
  1508.     return false unless $data_system.opt_display_tp
  1509.     for skill in skills
  1510.       next unless added_skill_types.include?(skill.stype_id)
  1511.       return true if skill.tp_cost > 0
  1512.     end
  1513.     return false
  1514.   end
  1515.   
  1516.   #--------------------------------------------------------------------------
  1517.   # alias method: input
  1518.   #--------------------------------------------------------------------------
  1519.   alias game_actor_input_abe input
  1520.   def input
  1521.     if @actions.nil?
  1522.       make_actions
  1523.       @action_input_index = 0
  1524.     end
  1525.     if @actions[@action_input_index].nil?
  1526.       @actions[@action_input_index] = Game_Action.new(self)
  1527.     end
  1528.     return game_actor_input_abe
  1529.   end
  1530.   
  1531. end # Game_Actor

  1532. #==============================================================================
  1533. # ■ Game_Enemy
  1534. #==============================================================================

  1535. class Game_Enemy < Game_Battler
  1536.   
  1537.   #--------------------------------------------------------------------------
  1538.   # overwrite method: perform_damage_effect
  1539.   #--------------------------------------------------------------------------
  1540.   def perform_damage_effect
  1541.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1542.     Sound.play_enemy_damage
  1543.   end
  1544.   
  1545.   #--------------------------------------------------------------------------
  1546.   # new methods: attack_animation_id
  1547.   #--------------------------------------------------------------------------
  1548.   def atk_animation_id1; return enemy.atk_animation_id1; end
  1549.   def atk_animation_id2; return enemy.atk_animation_id2; end
  1550.   
  1551.   #--------------------------------------------------------------------------
  1552.   # new method: sprite
  1553.   #--------------------------------------------------------------------------
  1554.   def sprite
  1555.     return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
  1556.   end
  1557.   
  1558. end # Game_Enemy

  1559. #==============================================================================
  1560. # ■ Game_Unit
  1561. #==============================================================================

  1562. class Game_Unit
  1563.   
  1564.   #--------------------------------------------------------------------------
  1565.   # alias method: make_actions
  1566.   #--------------------------------------------------------------------------
  1567.   alias game_unit_make_actions_abe make_actions
  1568.   def make_actions
  1569.     game_unit_make_actions_abe
  1570.     refresh_autobattler_status_window
  1571.   end
  1572.   
  1573.   #--------------------------------------------------------------------------
  1574.   # new method: refresh_autobattler_status_window
  1575.   #--------------------------------------------------------------------------
  1576.   def refresh_autobattler_status_window
  1577.     return unless SceneManager.scene_is?(Scene_Battle)
  1578.     return unless self.is_a?(Game_Party)
  1579.     SceneManager.scene.refresh_autobattler_status_window
  1580.   end
  1581.   
  1582. end # Game_Unit

  1583. #==============================================================================
  1584. # ■ Window_PartyCommand
  1585. #==============================================================================

  1586. class Window_PartyCommand < Window_Command
  1587.   
  1588.   #--------------------------------------------------------------------------
  1589.   # overwrite method: process_handling
  1590.   #--------------------------------------------------------------------------
  1591.   def process_handling
  1592.     return unless open? && active
  1593.     return process_dir6 if Input.repeat?(:RIGHT)
  1594.     return super
  1595.   end
  1596.   
  1597.   #--------------------------------------------------------------------------
  1598.   # new method: process_dir6
  1599.   #--------------------------------------------------------------------------
  1600.   def process_dir6
  1601.     Sound.play_cursor
  1602.     Input.update
  1603.     deactivate
  1604.     call_handler(:dir6)
  1605.   end
  1606.   
  1607. end # Window_PartyCommand

  1608. #==============================================================================
  1609. # ■ Window_ActorCommand
  1610. #==============================================================================

  1611. class Window_ActorCommand < Window_Command
  1612.   
  1613.   #--------------------------------------------------------------------------
  1614.   # overwrite method: process_handling
  1615.   #--------------------------------------------------------------------------
  1616.   def process_handling
  1617.     return unless open? && active
  1618.     return process_dir4 if Input.repeat?(:LEFT)
  1619.     return process_dir6 if Input.repeat?(:RIGHT)
  1620.     return super
  1621.   end
  1622.   
  1623.   #--------------------------------------------------------------------------
  1624.   # new method: process_dir4
  1625.   #--------------------------------------------------------------------------
  1626.   def process_dir4
  1627.     Sound.play_cursor
  1628.     Input.update
  1629.     deactivate
  1630.     call_handler(:cancel)
  1631.   end
  1632.   
  1633.   #--------------------------------------------------------------------------
  1634.   # new method: process_dir6
  1635.   #--------------------------------------------------------------------------
  1636.   def process_dir6
  1637.     Sound.play_cursor
  1638.     Input.update
  1639.     deactivate
  1640.     call_handler(:dir6)
  1641.   end
  1642.   
  1643. end # Window_ActorCommand

  1644. #==============================================================================
  1645. # ■ Window_BattleStatus
  1646. #==============================================================================

  1647. class Window_BattleStatus < Window_Selectable
  1648.   
  1649.   #--------------------------------------------------------------------------
  1650.   # overwrite method: initialize
  1651.   #--------------------------------------------------------------------------
  1652.   def initialize
  1653.     super(0, 0, window_width, window_height)
  1654.     self.openness = 0
  1655.     @party = $game_party.battle_members.clone
  1656.   end
  1657.   
  1658.   #--------------------------------------------------------------------------
  1659.   # overwrite method: col_max
  1660.   #--------------------------------------------------------------------------
  1661.   def col_max; return $game_party.max_battle_members; end
  1662.   
  1663.   #--------------------------------------------------------------------------
  1664.   # new method: battle_members
  1665.   #--------------------------------------------------------------------------
  1666.   def battle_members; return $game_party.battle_members; end
  1667.   
  1668.   #--------------------------------------------------------------------------
  1669.   # new method: actor
  1670.   #--------------------------------------------------------------------------
  1671.   def actor; return battle_members[@index]; end
  1672.   
  1673.   #--------------------------------------------------------------------------
  1674.   # overwrite method: update
  1675.   #--------------------------------------------------------------------------
  1676.   def update
  1677.     super
  1678.     return if @party == $game_party.battle_members
  1679.     @party = $game_party.battle_members.clone
  1680.     refresh
  1681.   end
  1682.   #--------------------------------------------------------------------------
  1683.   # overwrite method: draw_item
  1684.   #--------------------------------------------------------------------------
  1685.   def draw_item(index)
  1686.     return if index.nil?
  1687.     clear_item(index)
  1688.     actor = battle_members[index]
  1689.     rect = item_rect(index)
  1690.     return if actor.nil?
  1691.     draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)   
  1692.     draw_actor_name(actor, rect.x, rect.y, rect.width-8)
  1693.     draw_actor_action(actor, rect.x, rect.y)
  1694.     draw_actor_icons(actor, rect.x, line_height*1, rect.width)
  1695.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
  1696.     contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
  1697.     draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
  1698.     if draw_tp?(actor) && draw_mp?(actor)
  1699.       dw = rect.width/2-2
  1700.       dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
  1701.       draw_actor_tp(actor, rect.x+2, line_height*3, dw)
  1702.       dw = rect.width - rect.width/2 - 2
  1703.       draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
  1704.     elsif draw_tp?(actor) && !draw_mp?(actor)
  1705.       draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
  1706.     else
  1707.       draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
  1708.     end
  1709.   end
  1710.   
  1711.   #--------------------------------------------------------------------------
  1712.   # overwrite method: item_rect
  1713.   #--------------------------------------------------------------------------
  1714.   def item_rect(index)
  1715.     rect = Rect.new
  1716.     rect.width = contents.width / $game_party.max_battle_members
  1717.     rect.height = contents.height
  1718.     rect.x = index * rect.width
  1719.     if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
  1720.       rect.x += (contents.width - $game_party.members.size * rect.width) / 2
  1721.     end
  1722.     rect.y = 0
  1723.     return rect
  1724.   end
  1725.   
  1726.   #--------------------------------------------------------------------------
  1727.   # overwrite method: draw_face
  1728.   #--------------------------------------------------------------------------
  1729.   def draw_face(face_name, face_index, dx, dy, enabled = true)
  1730.     bitmap = Cache.face(face_name)
  1731.     fx = [(96 - item_rect(0).width + 1) / 2, 0].max
  1732.     fy = face_index / 4 * 96 + 2
  1733.     fw = [item_rect(0).width - 4, 92].min
  1734.     rect = Rect.new(fx, fy, fw, 92)
  1735.     rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
  1736.     contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
  1737.     bitmap.dispose
  1738.   end
  1739.   
  1740.   #--------------------------------------------------------------------------
  1741.   # overwrite method: draw_actor_name
  1742.   #--------------------------------------------------------------------------
  1743.   def draw_actor_name(actor, dx, dy, dw = 112)
  1744.     reset_font_settings
  1745.     contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
  1746.     change_color(hp_color(actor))
  1747.     draw_text(dx+24, dy, dw-24, line_height, actor.name)
  1748.   end
  1749.   
  1750.   #--------------------------------------------------------------------------
  1751.   # new method: draw_actor_action
  1752.   #--------------------------------------------------------------------------
  1753.   def draw_actor_action(actor, dx, dy)
  1754.     draw_icon(action_icon(actor), dx, dy)
  1755.   end
  1756.   
  1757.   #--------------------------------------------------------------------------
  1758.   # new method: action_icon
  1759.   #--------------------------------------------------------------------------
  1760.   def action_icon(actor)
  1761.     return Icon.no_action if actor.current_action.nil?
  1762.     return Icon.no_action if actor.current_action.item.nil?
  1763.     return actor.current_action.item.icon_index
  1764.   end
  1765.   
  1766.   #--------------------------------------------------------------------------
  1767.   # new method: draw_tp?
  1768.   #--------------------------------------------------------------------------
  1769.   def draw_tp?(actor)
  1770.     return actor.draw_tp?
  1771.   end
  1772.   
  1773.   #--------------------------------------------------------------------------
  1774.   # new method: draw_mp?
  1775.   #--------------------------------------------------------------------------
  1776.   def draw_mp?(actor)
  1777.     return actor.draw_mp?
  1778.   end
  1779.   
  1780.   #--------------------------------------------------------------------------
  1781.   # overwrite method: draw_current_and_max_values
  1782.   #--------------------------------------------------------------------------
  1783.   def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
  1784.     change_color(color1)
  1785.     draw_text(dx, dy, dw, line_height, current.group, 2)
  1786.   end
  1787.   
  1788.   #--------------------------------------------------------------------------
  1789.   # overwrite method: draw_actor_hp
  1790.   #--------------------------------------------------------------------------
  1791.   def draw_actor_hp(actor, dx, dy, width = 124)
  1792.     draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  1793.     change_color(system_color)
  1794.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1795.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
  1796.     draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
  1797.       hp_color(actor), normal_color)
  1798.     end
  1799.    
  1800.   #--------------------------------------------------------------------------
  1801.   # overwrite method: draw_actor_mp
  1802.   #--------------------------------------------------------------------------
  1803.   def draw_actor_mp(actor, dx, dy, width = 124)
  1804.     draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  1805.     change_color(system_color)
  1806.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1807.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
  1808.     draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
  1809.       mp_color(actor), normal_color)
  1810.     end
  1811.    
  1812.   #--------------------------------------------------------------------------
  1813.   # overwrite method: draw_actor_tp
  1814.   #--------------------------------------------------------------------------
  1815.   def draw_actor_tp(actor, dx, dy, width = 124)
  1816.     draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  1817.     change_color(system_color)
  1818.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1819.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
  1820.     change_color(tp_color(actor))
  1821.     draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
  1822.   end
  1823.   
  1824. end # Window_BattleStatus

  1825. #==============================================================================
  1826. # ■ Window_BattleActor
  1827. #==============================================================================

  1828. class Window_BattleActor < Window_BattleStatus
  1829.   
  1830.   #--------------------------------------------------------------------------
  1831.   # overwrite method: show
  1832.   #--------------------------------------------------------------------------
  1833.   def show
  1834.     create_flags
  1835.     super
  1836.   end
  1837.   
  1838.   #--------------------------------------------------------------------------
  1839.   # new method: create_flags
  1840.   #--------------------------------------------------------------------------
  1841.   def create_flags
  1842.     set_select_flag(:any)
  1843.     select(0)
  1844.     return if $game_temp.battle_aid.nil?
  1845.     if $game_temp.battle_aid.need_selection?
  1846.       select(0)
  1847.       set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
  1848.     elsif $game_temp.battle_aid.for_user?
  1849.       battler = BattleManager.actor
  1850.       id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
  1851.       select(id)
  1852.       set_select_flag(:user)
  1853.     elsif $game_temp.battle_aid.for_all?
  1854.       select(0)
  1855.       set_select_flag(:all)
  1856.       set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
  1857.     elsif $game_temp.battle_aid.for_random?
  1858.       select(0)
  1859.       set_select_flag(:random) if $game_temp.battle_aid.for_random?
  1860.     end
  1861.   end
  1862.   
  1863.   #--------------------------------------------------------------------------
  1864.   # new method: set_flag
  1865.   #--------------------------------------------------------------------------
  1866.   def set_select_flag(flag)
  1867.     @select_flag = flag
  1868.     case @select_flag
  1869.     when :all, :all_dead, :random
  1870.       @cursor_all = true
  1871.     else
  1872.       @cursor_all = false
  1873.     end
  1874.   end
  1875.   
  1876.   #--------------------------------------------------------------------------
  1877.   # overwrite method: update_cursor
  1878.   #--------------------------------------------------------------------------
  1879.   def update_cursor
  1880.     if @cursor_all
  1881.       cursor_rect.set(0, 0, contents.width, contents.height)
  1882.       self.top_row = 0
  1883.     elsif @index < 0
  1884.       cursor_rect.empty
  1885.     else
  1886.       ensure_cursor_visible
  1887.       cursor_rect.set(item_rect(@index))
  1888.     end
  1889.   end
  1890.   
  1891.   #--------------------------------------------------------------------------
  1892.   # overwrite method: cursor_movable?
  1893.   #--------------------------------------------------------------------------
  1894.   def cursor_movable?
  1895.     return false if @select_flag == :user
  1896.     return super
  1897.   end
  1898.   
  1899.   #--------------------------------------------------------------------------
  1900.   # overwrite method: current_item_enabled?
  1901.   #--------------------------------------------------------------------------
  1902.   def current_item_enabled?
  1903.     return true if $game_temp.battle_aid.nil?
  1904.     if $game_temp.battle_aid.need_selection?
  1905.       member = $game_party.battle_members[@index]
  1906.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  1907.     elsif $game_temp.battle_aid.for_dead_friend?
  1908.       for member in $game_party.battle_members
  1909.         return true if member.dead?
  1910.       end
  1911.       return false
  1912.     end
  1913.     return true
  1914.   end
  1915.   
  1916. end # Window_BattleActor

  1917. #==============================================================================
  1918. # ■ Window_BattleStatusAid
  1919. #==============================================================================

  1920. class Window_BattleStatusAid < Window_BattleStatus
  1921.   
  1922.   #--------------------------------------------------------------------------
  1923.   # public instance variables
  1924.   #--------------------------------------------------------------------------
  1925.   attr_accessor :status_window
  1926.   
  1927.   #--------------------------------------------------------------------------
  1928.   # overwrite method: initialize
  1929.   #--------------------------------------------------------------------------
  1930.   def initialize
  1931.     super
  1932.     self.visible = false
  1933.     self.openness = 255
  1934.   end
  1935.   
  1936.   #--------------------------------------------------------------------------
  1937.   # overwrite method: window_width
  1938.   #--------------------------------------------------------------------------
  1939.   def window_width; return 128; end
  1940.   
  1941.   #--------------------------------------------------------------------------
  1942.   # overwrite method: show
  1943.   #--------------------------------------------------------------------------
  1944.   def show
  1945.     super
  1946.     refresh
  1947.   end
  1948.   
  1949.   #--------------------------------------------------------------------------
  1950.   # overwrite method: refresh
  1951.   #--------------------------------------------------------------------------
  1952.   def refresh
  1953.     contents.clear
  1954.     return if @status_window.nil?
  1955.     draw_item(@status_window.index)
  1956.   end
  1957.   
  1958.   #--------------------------------------------------------------------------
  1959.   # overwrite method: item_rect
  1960.   #--------------------------------------------------------------------------
  1961.   def item_rect(index)
  1962.     return Rect.new(0, 0, contents.width, contents.height)
  1963.   end
  1964.   
  1965. end # Window_BattleStatusAid

  1966. #==============================================================================
  1967. # ■ Window_BattleEnemy
  1968. #==============================================================================

  1969. class Window_BattleEnemy < Window_Selectable
  1970.   
  1971.   #--------------------------------------------------------------------------
  1972.   # overwrite method: initialize
  1973.   #--------------------------------------------------------------------------
  1974.   def initialize(info_viewport)
  1975.     super(0, Graphics.height, window_width, fitting_height(1))
  1976.     refresh
  1977.     self.visible = false
  1978.     @info_viewport = info_viewport
  1979.   end
  1980.   
  1981.   #--------------------------------------------------------------------------
  1982.   # overwrite method: col_max
  1983.   #--------------------------------------------------------------------------
  1984.   def col_max; return item_max; end
  1985.   
  1986.   #--------------------------------------------------------------------------
  1987.   # overwrite method: show
  1988.   #--------------------------------------------------------------------------
  1989.   def show
  1990.     create_flags
  1991.     super
  1992.   end
  1993.   
  1994.   #--------------------------------------------------------------------------
  1995.   # new method: create_flags
  1996.   #--------------------------------------------------------------------------
  1997.   def create_flags
  1998.     set_select_flag(:any)
  1999.     select(0)
  2000.     return if $game_temp.battle_aid.nil?
  2001.     if $game_temp.battle_aid.need_selection?
  2002.       select(0)
  2003.     elsif $game_temp.battle_aid.for_all?
  2004.       select(0)
  2005.       set_select_flag(:all)
  2006.     elsif $game_temp.battle_aid.for_random?
  2007.       select(0)
  2008.       set_select_flag(:random)
  2009.     end
  2010.   end
  2011.   
  2012.   #--------------------------------------------------------------------------
  2013.   # new method: set_flag
  2014.   #--------------------------------------------------------------------------
  2015.   def set_select_flag(flag)
  2016.     @select_flag = flag
  2017.     case @select_flag
  2018.     when :all, :random
  2019.       @cursor_all = true
  2020.     else
  2021.       @cursor_all = false
  2022.     end
  2023.   end
  2024.   
  2025.   #--------------------------------------------------------------------------
  2026.   # new method: select_all?
  2027.   #--------------------------------------------------------------------------
  2028.   def select_all?
  2029.     return true if @select_flag == :all
  2030.     return true if @select_flag == :random
  2031.     return false
  2032.   end
  2033.   
  2034.   #--------------------------------------------------------------------------
  2035.   # overwrite method: update_cursor
  2036.   #--------------------------------------------------------------------------
  2037.   def update_cursor
  2038.     if @cursor_all
  2039.       cursor_rect.set(0, 0, contents.width, contents.height)
  2040.       self.top_row = 0
  2041.     elsif @index < 0
  2042.       cursor_rect.empty
  2043.     else
  2044.       ensure_cursor_visible
  2045.       cursor_rect.set(item_rect(@index))
  2046.     end
  2047.   end
  2048.   
  2049.   #--------------------------------------------------------------------------
  2050.   # overwrite method: cursor_movable?
  2051.   #--------------------------------------------------------------------------
  2052.   def cursor_movable?
  2053.     return false if @select_flag == :user
  2054.     return super
  2055.   end
  2056.   
  2057.   #--------------------------------------------------------------------------
  2058.   # overwrite method: current_item_enabled?
  2059.   #--------------------------------------------------------------------------
  2060.   def current_item_enabled?
  2061.     return true if $game_temp.battle_aid.nil?
  2062.     if $game_temp.battle_aid.need_selection?
  2063.       member = $game_party.battle_members[@index]
  2064.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  2065.     elsif $game_temp.battle_aid.for_dead_friend?
  2066.       for member in $game_party.battle_members
  2067.         return true if member.dead?
  2068.       end
  2069.       return false
  2070.     end
  2071.     return true
  2072.   end
  2073.   
  2074.   #--------------------------------------------------------------------------
  2075.   # overwrite method: enemy
  2076.   #--------------------------------------------------------------------------
  2077.   def enemy; @data[index]; end
  2078.   
  2079.   #--------------------------------------------------------------------------
  2080.   # overwrite method: refresh
  2081.   #--------------------------------------------------------------------------
  2082.   def refresh
  2083.     make_item_list
  2084.     create_contents
  2085.     draw_all_items
  2086.   end
  2087.   
  2088.   #--------------------------------------------------------------------------
  2089.   # overwrite method: make_item_list
  2090.   #--------------------------------------------------------------------------
  2091.   def make_item_list
  2092.     @data = $game_troop.alive_members
  2093.     @data.sort! { |a,b| a.screen_x <=> b.screen_x }
  2094.   end
  2095.   
  2096.   #--------------------------------------------------------------------------
  2097.   # overwrite method: draw_item
  2098.   #--------------------------------------------------------------------------
  2099.   def draw_item(index); return; end
  2100.   
  2101.   #--------------------------------------------------------------------------
  2102.   # overwrite method: update
  2103.   #--------------------------------------------------------------------------
  2104.   def update
  2105.     super
  2106.     return unless active
  2107.     enemy.sprite_effect_type = :whiten
  2108.     return unless select_all?
  2109.     for enemy in $game_troop.alive_members
  2110.       enemy.sprite_effect_type = :whiten
  2111.     end
  2112.   end
  2113.   
  2114. end # Window_BattleEnemy

  2115. #==============================================================================
  2116. # ■ Window_BattleHelp
  2117. #==============================================================================

  2118. class Window_BattleHelp < Window_Help
  2119.   
  2120.   #--------------------------------------------------------------------------
  2121.   # public instance variables
  2122.   #--------------------------------------------------------------------------
  2123.   attr_accessor :actor_window
  2124.   attr_accessor :enemy_window
  2125.   
  2126.   #--------------------------------------------------------------------------
  2127.   # update
  2128.   #--------------------------------------------------------------------------
  2129.   def update
  2130.     super
  2131.     if !self.visible and @text != ""
  2132.       @text = ""
  2133.       return refresh
  2134.     end
  2135.     update_battler_name
  2136.   end
  2137.   
  2138.   #--------------------------------------------------------------------------
  2139.   # update_battler_name
  2140.   #--------------------------------------------------------------------------
  2141.   def update_battler_name
  2142.     return unless @actor_window.active || @enemy_window.active
  2143.     if @actor_window.active
  2144.       battler = $game_party.battle_members[@actor_window.index]
  2145.     elsif @enemy_window.active
  2146.       battler = @enemy_window.enemy
  2147.     end
  2148.     if special_display?
  2149.       refresh_special_case(battler)
  2150.     else
  2151.       refresh_battler_name(battler) if battler_name(battler) != @text
  2152.     end
  2153.   end
  2154.   
  2155.   #--------------------------------------------------------------------------
  2156.   # battler_name
  2157.   #--------------------------------------------------------------------------
  2158.   def battler_name(battler)
  2159.     text = battler.name.clone
  2160.     return text
  2161.   end
  2162.   
  2163.   #--------------------------------------------------------------------------
  2164.   # refresh_battler_name
  2165.   #--------------------------------------------------------------------------
  2166.   def refresh_battler_name(battler)
  2167.     contents.clear
  2168.     reset_font_settings
  2169.     change_color(normal_color)
  2170.     @text = battler_name(battler)
  2171.     icons = battler.state_icons + battler.buff_icons
  2172.     dy = icons.size <= 0 ? line_height / 2 : 0
  2173.     draw_text(0, dy, contents.width, line_height, @text, 1)
  2174.     dx = (contents.width - (icons.size * 24)) / 2
  2175.     draw_actor_icons(battler, dx, line_height, contents.width)
  2176.   end
  2177.   
  2178.   #--------------------------------------------------------------------------
  2179.   # special_display?
  2180.   #--------------------------------------------------------------------------
  2181.   def special_display?
  2182.     return false if $game_temp.battle_aid.nil?
  2183.     return false if $game_temp.battle_aid.for_user?
  2184.     return !$game_temp.battle_aid.need_selection?
  2185.   end
  2186.   
  2187.   #--------------------------------------------------------------------------
  2188.   # refresh_special_case
  2189.   #--------------------------------------------------------------------------
  2190.   def refresh_special_case(battler)
  2191.     if $game_temp.battle_aid.for_opponent?
  2192.       if $game_temp.battle_aid.for_all?
  2193.         text = YEA::BATTLE::HELP_TEXT_ALL_FOES
  2194.       else
  2195.         case $game_temp.battle_aid.number_of_targets
  2196.         when 1
  2197.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
  2198.         else
  2199.           number = $game_temp.battle_aid.number_of_targets
  2200.           text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
  2201.         end
  2202.       end
  2203.     else # $game_temp.battle_aid.for_friend?
  2204.       if $game_temp.battle_aid.for_dead_friend?
  2205.         text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
  2206.       elsif $game_temp.battle_aid.for_random?
  2207.         case $game_temp.battle_aid.number_of_targets
  2208.         when 1
  2209.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
  2210.         else
  2211.           number = $game_temp.battle_aid.number_of_targets
  2212.           text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
  2213.         end
  2214.       else
  2215.         text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
  2216.       end
  2217.     end
  2218.     return if text == @text
  2219.     @text = text
  2220.     contents.clear
  2221.     reset_font_settings
  2222.     draw_text(0, 0, contents.width, line_height*2, @text, 1)
  2223.   end
  2224.   
  2225. end # Window_BattleHelp

  2226. #==============================================================================
  2227. # ■ Window_BattleLog
  2228. #==============================================================================

  2229. class Window_BattleLog < Window_Selectable
  2230.   
  2231.   #--------------------------------------------------------------------------
  2232.   # alias method: display_current_state
  2233.   #--------------------------------------------------------------------------
  2234.   alias window_battlelog_display_current_state_abe display_current_state
  2235.   def display_current_state(subject)
  2236.     subject.make_during_state_popup
  2237.     return unless YEA::BATTLE::MSG_CURRENT_STATE
  2238.     window_battlelog_display_current_state_abe(subject)
  2239.   end
  2240.   
  2241.   #--------------------------------------------------------------------------
  2242.   # alias method: display_use_item
  2243.   #--------------------------------------------------------------------------
  2244.   alias window_battlelog_display_use_item_abe display_use_item
  2245.   def display_use_item(subject, item)
  2246.     return unless YEA::BATTLE::MSG_CURRENT_ACTION
  2247.     window_battlelog_display_use_item_abe(subject, item)
  2248.   end
  2249.   
  2250.   #--------------------------------------------------------------------------
  2251.   # alias method: display_counter
  2252.   #--------------------------------------------------------------------------
  2253.   alias window_battlelog_display_counter_abe display_counter
  2254.   def display_counter(target, item)
  2255.     if YEA::BATTLE::MSG_COUNTERATTACK
  2256.       window_battlelog_display_counter_abe(target, item)
  2257.     else
  2258.       Sound.play_evasion
  2259.     end
  2260.   end
  2261.   
  2262.   #--------------------------------------------------------------------------
  2263.   # alias method: display_reflection
  2264.   #--------------------------------------------------------------------------
  2265.   alias window_battlelog_display_reflection_abe display_reflection
  2266.   def display_reflection(target, item)
  2267.     if YEA::BATTLE::MSG_REFLECT_MAGIC
  2268.       window_battlelog_display_reflection_abe(target, item)
  2269.     else
  2270.       Sound.play_reflection
  2271.     end
  2272.   end
  2273.   
  2274.   #--------------------------------------------------------------------------
  2275.   # alias method: display_substitute
  2276.   #--------------------------------------------------------------------------
  2277.   alias window_battlelog_display_substitute_abe display_substitute
  2278.   def display_substitute(substitute, target)
  2279.     return unless YEA::BATTLE::MSG_SUBSTITUTE_HIT
  2280.     window_battlelog_display_substitute_abe(substitute, target)
  2281.   end
  2282.   
  2283.   #--------------------------------------------------------------------------
  2284.   # alias method: display_failure
  2285.   #--------------------------------------------------------------------------
  2286.   alias window_battlelog_display_failure_abe display_failure
  2287.   def display_failure(target, item)
  2288.     return unless YEA::BATTLE::MSG_FAILURE_HIT
  2289.     window_battlelog_display_failure_abe(target, item)
  2290.   end
  2291.   
  2292.   #--------------------------------------------------------------------------
  2293.   # alias method: display_critical
  2294.   #--------------------------------------------------------------------------
  2295.   alias window_battlelog_display_critical_abe display_critical
  2296.   def display_critical(target, item)
  2297.     return unless YEA::BATTLE::MSG_CRITICAL_HIT
  2298.     window_battlelog_display_critical_abe(target, item)
  2299.   end
  2300.   
  2301.   #--------------------------------------------------------------------------
  2302.   # alias method: display_miss
  2303.   #--------------------------------------------------------------------------
  2304.   alias window_battlelog_display_miss_abe display_miss
  2305.   def display_miss(target, item)
  2306.     return unless YEA::BATTLE::MSG_HIT_MISSED
  2307.     window_battlelog_display_miss_abe(target, item)
  2308.   end
  2309.   
  2310.   #--------------------------------------------------------------------------
  2311.   # alias method: display_evasion
  2312.   #--------------------------------------------------------------------------
  2313.   alias window_battlelog_display_evasion_abe display_evasion
  2314.   def display_evasion(target, item)
  2315.     if YEA::BATTLE::MSG_EVASION
  2316.       window_battlelog_display_evasion_abe(target, item)
  2317.     else
  2318.       if !item || item.physical?
  2319.         Sound.play_evasion
  2320.       else
  2321.         Sound.play_magic_evasion
  2322.       end
  2323.     end
  2324.   end
  2325.   
  2326.   #--------------------------------------------------------------------------
  2327.   # overwrite method: display_hp_damage
  2328.   #--------------------------------------------------------------------------
  2329.   def display_hp_damage(target, item)
  2330.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  2331.     if target.result.hp_damage > 0 && target.result.hp_drain == 0
  2332.       target.perform_damage_effect
  2333.     end
  2334.     Sound.play_recovery if target.result.hp_damage < 0
  2335.     return unless YEA::BATTLE::MSG_HP_DAMAGE
  2336.     add_text(target.result.hp_damage_text)
  2337.     wait
  2338.   end
  2339.   
  2340.   #--------------------------------------------------------------------------
  2341.   # overwrite method: display_mp_damage
  2342.   #--------------------------------------------------------------------------
  2343.   def display_mp_damage(target, item)
  2344.     return if target.dead? || target.result.mp_damage == 0
  2345.     Sound.play_recovery if target.result.mp_damage < 0
  2346.     return unless YEA::BATTLE::MSG_MP_DAMAGE
  2347.     add_text(target.result.mp_damage_text)
  2348.     wait
  2349.   end
  2350.   
  2351.   #--------------------------------------------------------------------------
  2352.   # overwrite method: display_tp_damage
  2353.   #--------------------------------------------------------------------------
  2354.   def display_tp_damage(target, item)
  2355.     return if target.dead? || target.result.tp_damage == 0
  2356.     Sound.play_recovery if target.result.tp_damage < 0
  2357.     return unless YEA::BATTLE::MSG_TP_DAMAGE
  2358.     add_text(target.result.tp_damage_text)
  2359.     wait
  2360.   end
  2361.   
  2362.   #--------------------------------------------------------------------------
  2363.   # alias method: display_added_states
  2364.   #--------------------------------------------------------------------------
  2365.   alias window_battlelog_display_added_states_abe display_added_states
  2366.   def display_added_states(target)
  2367.     return unless YEA::BATTLE::MSG_ADDED_STATES
  2368.     window_battlelog_display_added_states_abe(target)
  2369.   end
  2370.   
  2371.   #--------------------------------------------------------------------------
  2372.   # alias method: display_removed_states
  2373.   #--------------------------------------------------------------------------
  2374.   alias window_battlelog_display_removed_states_abe display_removed_states
  2375.   def display_removed_states(target)
  2376.     return unless YEA::BATTLE::MSG_REMOVED_STATES
  2377.     window_battlelog_display_removed_states_abe(target)
  2378.   end
  2379.   
  2380.   #--------------------------------------------------------------------------
  2381.   # alias method: display_changed_buffs
  2382.   #--------------------------------------------------------------------------
  2383.   alias window_battlelog_display_changed_buffs_abe display_changed_buffs
  2384.   def display_changed_buffs(target)
  2385.     return unless YEA::BATTLE::MSG_CHANGED_BUFFS
  2386.     window_battlelog_display_changed_buffs_abe(target)
  2387.   end
  2388.   
  2389. end # Window_BattleLog

  2390. #==============================================================================
  2391. # ■ Window_SkillList
  2392. #==============================================================================

  2393. class Window_SkillList < Window_Selectable
  2394.   
  2395.   #--------------------------------------------------------------------------
  2396.   # overwrite method: spacing
  2397.   #--------------------------------------------------------------------------
  2398.   def spacing
  2399.     return 8 if $game_party.in_battle
  2400.     return super
  2401.   end
  2402.   
  2403. end # Window_SkillList

  2404. #==============================================================================
  2405. # ■ Window_ItemList
  2406. #==============================================================================

  2407. class Window_ItemList < Window_Selectable
  2408.   
  2409.   #--------------------------------------------------------------------------
  2410.   # overwrite method: spacing
  2411.   #--------------------------------------------------------------------------
  2412.   def spacing
  2413.     return 8 if $game_party.in_battle
  2414.     return super
  2415.   end
  2416.   
  2417. end # Window_ItemList

  2418. #==============================================================================
  2419. # ■ Scene_Battle
  2420. #==============================================================================

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

  3050. #==============================================================================
  3051. #
  3052. # ▼ End of File
  3053. #
  3054. #==============================================================================
复制代码

点评

[code]0v0[/code]或者用那个 < > 按钮  发表于 2018-4-5 16:28
赞美灵魂……
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部