Guest User

New Edited YEA Battle system by Josh from Digital Ice games

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