Advertisement
Guest User

All-in 1

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