Advertisement
Guest User

ech

a guest
Jun 30th, 2016
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.51 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ YSA Battle System: Classical ATB
  4. # -- Last Updated: 2012.01.30
  5. # -- Level: Easy, Normal
  6. # -- Requires: YEA - Ace Battle Engine v1.15+.
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YSA-CATB"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.30 - Fix various things with force actions.
  17. # - Disable Additional Action.
  18. # - Compatible with: YEA - Active Chain Skills.
  19. # 2012.01.27 - Compatible with: Lunatic CATB Reset.
  20. # 2012.01.26 - Fix a bug with status window.
  21. # - Compatible with: Yanfly Engine Ace - Combat Log Display.
  22. # - Fix a bug with PAUSE_WHEN_ACTIVE_PARTY_COMMAND.
  23. # 2012.01.25 - Fix a small bug with states updating.
  24. # 2012.01.20 - Compatible with: Lunatic CATB Rate.
  25. # - Fix a bug with first strike.
  26. # 2012.01.19 - Fix a small bug with Action's Icon Updating.
  27. # - Fix a critical bug with target selecting.
  28. # - Fix a bug with states updating.
  29. # - Fix a small bug with actor's status when choosing skill/item.
  30. # - Fix a critical bug with auto battle.
  31. # 2012.01.16 - Fix ATB speed changes when a battler's agi changes.
  32. # - Add casting time.
  33. # 2012.01.16 - Add a function for preemptive strike and surprised.
  34. # - Fix a small bug with make action.
  35. # 2012.01.13 - Bugfix for ATB Type Wait.
  36. # - Upgrade a little ATB gauge.
  37. # - Upgrade turn count.
  38. # - Compatible with: Lunatic CATB Start.
  39. # 2012.01.12 - Started Script and Finished.
  40. #
  41. #==============================================================================
  42. # ▼ Introduction
  43. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  44. # This script will add a battle type into YEA Battle Engine Ace.
  45. # Battle Type: Classical ATB.
  46. #
  47. #==============================================================================
  48. # ▼ Instructions
  49. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  50. # To install this script, open up your script editor and copy/paste this script
  51. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  52. #
  53. # First, set the default battle system for your game to be :catb by either going
  54. # to the Ace Battle Engine script and setting DEFAULT_BATTLE_SYSTEM as :catb or
  55. # by using the following script call:
  56. #
  57. # $game_system:set_battle_system(:catb)
  58. #
  59. # Second, you can set the default wait for your game by either setting DEFAULT_WAIT
  60. # or using the following script call:
  61. #
  62. # $game_system:set_catb_wait_type(wait_type)
  63. #
  64. # Which there are 4 types:
  65. # - :full : ATB always run, except when animation run
  66. # - :quarter : ATB pause when select skill/item/target
  67. # - :semi : ATB pause when select target
  68. # - :wait : ATB pause when choose action for actor
  69. #
  70. # Third, you can set the default turn counting for your game by either setting
  71. # DEFAULT_TURN or using the following script call:
  72. #
  73. # $game_system:set_catb_turn_type(turn_type)
  74. #
  75. # Which there are 2 types:
  76. # - :tick : Count as a turn after X frame
  77. # - :action : Count as a turn after X actions
  78. #
  79. # -----------------------------------------------------------------------------
  80. # Skill/Item Notetags - These notetags go in the skill/item notebox in the database.
  81. # -----------------------------------------------------------------------------
  82. # <charge rate: x%>
  83. # Enable casting time (skill charge) for Skill or Item. Skill/Item will be charged
  84. # at normal ATB filled speed * x%, which means it will be charged at x% rate.
  85. #
  86. #==============================================================================
  87. # ▼ Compatibility
  88. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  89. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  90. # it will run with RPG Maker VX without adjusting.
  91. #
  92. # This script requires Yanfly Engine Ace - Ace Battle Engine v1.15+ and the
  93. # script must be placed under Ace Battle Engine in the script listing.
  94. #
  95. #==============================================================================
  96.  
  97. #==============================================================================
  98. # ▼ Configuration
  99. #==============================================================================
  100.  
  101. module YSA
  102. module CATB
  103.  
  104. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  105. # - General Configuration -
  106. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  107. DEFAULT_FILL_TIME = 180 # Frames
  108. DEFAULT_WAIT = :quarter # :full, :semi, :quarter, :wait
  109. FILL_TIME_VARIABLE = 15 # Change DEFAULT_FILL_TIME by variable.
  110.  
  111. PAUSE_WHEN_ACTIVE_PARTY_COMMAND = true
  112.  
  113. PREEMTIVE_ATB_ACTOR = 70
  114. PREEMTIVE_ATB_ENEMY = 0
  115. SURPRISE_ATB_ACTOR = 0
  116. SURPRISE_ATB_ENEMY = 70
  117.  
  118. FORCE_ACTION_CLEAR_ATB = false
  119.  
  120. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  121. # - Turn Configuration -
  122. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  123. DEFAULT_TURN = :tick # :tick, :action
  124.  
  125. TICK_COUNT = 150 # Turn after TICK_COUNT
  126. TICK_COUNT_VARIABLE = 16 # Change TICK_COUNT by variable.
  127.  
  128. AFTER_ACTION = 1 # Turn after AFTER_ACTION actions.
  129. AFTER_ACTION_VARIABLE = 17 # Change AFTER_ACTION by variable.
  130. FORCE_ACTION_COUNT = false # Count force action as a turn action?
  131.  
  132. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  133. # - Actor ATB Gauges -
  134. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  135. GAUGE_COLOR1 = 32
  136. GAUGE_COLOR2 = 31
  137. CHARGE_COLOR1 = 18
  138. CHARGE_COLOR2 = 10
  139. ATB_GAUGE_Y_PLUS = 12
  140. ATB_PHRASE = "ATB"
  141.  
  142. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  143. # - Enemy ATB Gauges -
  144. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  145. SHOW_ENEMY_ATB_GAUGE = true # Display Enemy HP Gauge?
  146. ENEMY_GAUGE_WIDTH = 128 # How wide the enemy gauges are.
  147. ENEMY_GAUGE_HEIGHT = 12 # How tall the enemy gauges are.
  148. ENEMY_ATB_GAUGE_COLOUR1 = 1 # Colour 1 for ATB.
  149. ENEMY_ATB_GAUGE_COLOUR2 = 4 # Colour 2 for ATB.
  150. ENEMY_BACKGAUGE_COLOUR = 19 # Gauge Back colour.
  151.  
  152. end
  153. end
  154.  
  155. #==============================================================================
  156. # ▼ Editting anything past this point may potentially result in causing
  157. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  158. # halitosis so edit at your own risk.
  159. #==============================================================================
  160.  
  161. module YSA
  162. module REGEXP
  163. module USABLEITEM
  164.  
  165. CHARGE_RATE = /<(?:CHARGE_RATE|charge rate):[ ](\d+)?([%%])>/i
  166.  
  167. end # USABLEITEM
  168. end # REGEXP
  169. end # YSA
  170.  
  171. #==============================================================================
  172. # ■ DataManager
  173. #==============================================================================
  174.  
  175. module DataManager
  176.  
  177. #--------------------------------------------------------------------------
  178. # alias method: load_database
  179. #--------------------------------------------------------------------------
  180. class <<self; alias load_database_catb load_database; end
  181. def self.load_database
  182. load_database_catb
  183. load_notetags_catb
  184. end
  185.  
  186. #--------------------------------------------------------------------------
  187. # new method: load_notetags_catb
  188. #--------------------------------------------------------------------------
  189. def self.load_notetags_catb
  190. groups = [$data_skills, $data_items]
  191. for group in groups
  192. for obj in group
  193. next if obj.nil?
  194. obj.load_notetags_catb
  195. end
  196. end
  197. end
  198.  
  199. end # DataManager
  200.  
  201. #==============================================================================
  202. # ■ RPG::UsableItem
  203. #==============================================================================
  204.  
  205. class RPG::UsableItem < RPG::BaseItem
  206.  
  207. #--------------------------------------------------------------------------
  208. # public instance variables
  209. #--------------------------------------------------------------------------
  210. attr_accessor :charge_rate
  211. attr_accessor :charge_on
  212.  
  213. #--------------------------------------------------------------------------
  214. # common cache: load_notetags_catb
  215. #--------------------------------------------------------------------------
  216. def load_notetags_catb
  217. @charge_rate = 100
  218. @charge_on = false
  219. #---
  220. self.note.split(/[\r\n]+/).each { |line|
  221. case line
  222. #---
  223. when YSA::REGEXP::USABLEITEM::CHARGE_RATE
  224. @charge_on = true
  225. @charge_rate = $1.to_i
  226. #---
  227. end
  228. } # self.note.split
  229. #---
  230. @charge_rate = 100 if @charge_rate <= 0
  231. end
  232.  
  233. end # RPG::UsableItem
  234.  
  235. #==============================================================================
  236. # ■ BattleManager
  237. #==============================================================================
  238.  
  239. module BattleManager
  240.  
  241. #--------------------------------------------------------------------------
  242. # alias method:
  243. # - make_action_orders
  244. # - prior_command
  245. # - next_command
  246. # - in_turn?
  247. # - battle_start
  248. #--------------------------------------------------------------------------
  249. class <<self
  250. alias catb_make_action_orders make_action_orders
  251. alias catb_prior_command prior_command
  252. alias catb_next_command next_command
  253. alias catb_in_turn? in_turn?
  254. alias catb_battle_start battle_start
  255. end
  256.  
  257. #--------------------------------------------------------------------------
  258. # battle_start
  259. #--------------------------------------------------------------------------
  260. def self.battle_start
  261. catb_battle_start
  262. if btype?(:catb)
  263. @average_agi = 0
  264. make_catb_action_orders
  265. battler_hash = $game_party.members + $game_troop.members
  266. battler_hash.each { |a|
  267. if @preemptive
  268. a.make_first_catb_value(1)
  269. elsif @surprise
  270. a.make_first_catb_value(2)
  271. else
  272. a.make_first_catb_value(0)
  273. end
  274. @average_agi += a.agi
  275. }
  276. @average_agi /= battler_hash.size
  277. end
  278. end
  279.  
  280. #--------------------------------------------------------------------------
  281. # make_action_orders
  282. #--------------------------------------------------------------------------
  283. def self.make_action_orders
  284. return if btype?(:catb)
  285. catb_make_action_orders unless btype?(:catb)
  286. end
  287.  
  288. #--------------------------------------------------------------------------
  289. # next_command
  290. #--------------------------------------------------------------------------
  291. def self.next_command
  292. return false if btype?(:catb)
  293. catb_next_command
  294. end
  295.  
  296. #--------------------------------------------------------------------------
  297. # alias method: in_turn?
  298. #--------------------------------------------------------------------------
  299. def self.in_turn?
  300. return true if btype?(:catb)
  301. return catb_in_turn?
  302. end
  303.  
  304. #--------------------------------------------------------------------------
  305. # new method: make_catb_action_orders
  306. #--------------------------------------------------------------------------
  307. class <<self
  308. def make_catb_action_orders
  309. @action_actors = []
  310. @action_enemies = []
  311. @action_battlers = []
  312. end
  313. end
  314.  
  315. #--------------------------------------------------------------------------
  316. # new method: average_agi
  317. #--------------------------------------------------------------------------
  318. class <<self
  319. def average_agi
  320. return @average_agi
  321. end
  322. end
  323.  
  324. #--------------------------------------------------------------------------
  325. # new method: set_actor
  326. #--------------------------------------------------------------------------
  327. class <<self
  328. def set_actor(actor_index)
  329. @actor_index = actor_index
  330. end
  331. end
  332.  
  333. #--------------------------------------------------------------------------
  334. # prior_command
  335. #--------------------------------------------------------------------------
  336. def self.prior_command
  337. return false if btype?(:catb)
  338. catb_prior_command
  339. end
  340.  
  341. #--------------------------------------------------------------------------
  342. # new method: make_catb_action
  343. #--------------------------------------------------------------------------
  344. class <<self
  345. def make_catb_action(battler)
  346. make_catb_action_orders if !@action_battlers || !@action_actors || !@action_enemies
  347. return false if @action_battlers.include?(battler)
  348. @action_battlers.push(battler)
  349. @action_actors.push(battler) if battler.actor?
  350. @action_enemies.push(battler) if battler.enemy?
  351. return true
  352. end
  353. end
  354.  
  355. #--------------------------------------------------------------------------
  356. # new method: delete_catb_action
  357. #--------------------------------------------------------------------------
  358. class <<self
  359. def delete_catb_action(battler)
  360. return false if !battler
  361. @action_battlers.delete(battler)
  362. @action_battlers = @action_battlers.compact
  363. @action_actors.delete(battler) if battler.actor?
  364. @action_actors = @action_actors.compact
  365. @action_enemies.delete(battler) if battler.enemy?
  366. @action_enemies = @action_enemies.compact
  367. return true
  368. end
  369. end
  370.  
  371. #--------------------------------------------------------------------------
  372. # new method: action_list
  373. #--------------------------------------------------------------------------
  374. class <<self
  375. def action_list(type = :all)
  376. return @action_battlers if type == :all
  377. return @action_actors if type == :actor
  378. return @action_enemies if type = :enemy
  379. end
  380. end
  381.  
  382. end # BattleManager
  383.  
  384. #==============================================================================
  385. # ■ Game_System
  386. #==============================================================================
  387.  
  388. class Game_System
  389.  
  390. #--------------------------------------------------------------------------
  391. # alias method: set_battle_system
  392. #--------------------------------------------------------------------------
  393. alias qatb_set_battle_system set_battle_system
  394. def set_battle_system(type)
  395. case type
  396. when :catb; @battle_system = :catb
  397. else; qatb_set_battle_system(type)
  398. end
  399. end
  400.  
  401. #--------------------------------------------------------------------------
  402. # alias method: battle_system_corrected
  403. #--------------------------------------------------------------------------
  404. alias qatb_battle_system_corrected battle_system_corrected
  405. def battle_system_corrected(type)
  406. case type
  407. when :catb; return :catb
  408. else; return qatb_battle_system_corrected(type)
  409. end
  410. end
  411.  
  412. #--------------------------------------------------------------------------
  413. # new method: catb_fill_time
  414. #--------------------------------------------------------------------------
  415. def catb_fill_time
  416. return $game_variables[YSA::CATB::FILL_TIME_VARIABLE] > 0 ? $game_variables[YSA::CATB::FILL_TIME_VARIABLE] : YSA::CATB::DEFAULT_FILL_TIME
  417. end
  418.  
  419. #--------------------------------------------------------------------------
  420. # new method: catb_tick_count
  421. #--------------------------------------------------------------------------
  422. def catb_tick_count
  423. return $game_variables[YSA::CATB::TICK_COUNT_VARIABLE] > 0 ? $game_variables[YSA::CATB::TICK_COUNT_VARIABLE] : YSA::CATB::TICK_COUNT
  424. end
  425.  
  426. #--------------------------------------------------------------------------
  427. # new method: catb_after_action
  428. #--------------------------------------------------------------------------
  429. def catb_after_action
  430. return $game_variables[YSA::CATB::AFTER_ACTION_VARIABLE] > 0 ? $game_variables[YSA::CATB::AFTER_ACTION_VARIABLE] : YSA::CATB::AFTER_ACTION
  431. end
  432.  
  433. #--------------------------------------------------------------------------
  434. # new method: catb_turn_type
  435. #--------------------------------------------------------------------------
  436. def catb_turn_type
  437. return @catb_turn_type ? @catb_turn_type : YSA::CATB::DEFAULT_TURN
  438. end
  439.  
  440. #--------------------------------------------------------------------------
  441. # new method: catb_wait_type
  442. #--------------------------------------------------------------------------
  443. def catb_wait_type
  444. return @catb_wait_type ? @catb_wait_type : YSA::CATB::DEFAULT_WAIT
  445. end
  446.  
  447. #--------------------------------------------------------------------------
  448. # new method: set_catb_wait_type
  449. #--------------------------------------------------------------------------
  450. def set_catb_wait_type(type = :full)
  451. @catb_wait_type = type
  452. end
  453.  
  454. #--------------------------------------------------------------------------
  455. # new method: set_catb_turn_type
  456. #--------------------------------------------------------------------------
  457. def set_catb_turn_type(type = :tick)
  458. @catb_turn_type = type
  459. end
  460.  
  461. end # Game_System
  462.  
  463. #==============================================================================
  464. # ■ Game_Battler
  465. #==============================================================================
  466.  
  467. class Game_Battler < Game_BattlerBase
  468.  
  469. MAX_CATB_VALUE = 100000.0
  470.  
  471. #--------------------------------------------------------------------------
  472. # alias method: initialize
  473. #--------------------------------------------------------------------------
  474. alias catb_initialize initialize
  475. def initialize
  476. catb_initialize
  477. @catb_value = 0
  478. @ct_catb_value = 0
  479. end
  480.  
  481. #--------------------------------------------------------------------------
  482. # new method: base_gain_catb
  483. #--------------------------------------------------------------------------
  484. def base_gain_catb
  485. return MAX_CATB_VALUE / $game_system.catb_fill_time
  486. end
  487.  
  488. #--------------------------------------------------------------------------
  489. # new method: real_gain_catb
  490. #--------------------------------------------------------------------------
  491. def real_gain_catb
  492. value = (self.agi.to_f / BattleManager.average_agi) * base_gain_catb
  493. return value
  494. end
  495.  
  496. #--------------------------------------------------------------------------
  497. # new method: make_catb_update
  498. #--------------------------------------------------------------------------
  499. def make_catb_update
  500. return if @catb_value >= MAX_CATB_VALUE
  501. return if not movable?
  502. value = $imported["YSA-LunaticCATBRate"] ? lunatic_catb_rate_formula : real_gain_catb
  503. @catb_value += [value, MAX_CATB_VALUE - @catb_value].min
  504. end
  505.  
  506. #--------------------------------------------------------------------------
  507. # new method: make_catb_action
  508. #--------------------------------------------------------------------------
  509. def make_catb_action
  510. return unless @catb_value >= MAX_CATB_VALUE
  511. return clear_catb if not movable?
  512. return BattleManager.make_catb_action(self)
  513. end
  514.  
  515. #--------------------------------------------------------------------------
  516. # new method: make_ct_catb_update
  517. #--------------------------------------------------------------------------
  518. def make_ct_catb_update
  519. return if @catb_value < MAX_CATB_VALUE
  520. return if @ct_catb_value >= MAX_CATB_VALUE
  521. return if !self.current_action
  522. return if !self.current_action.item
  523. return if self.actor? && !self.current_action.confirm
  524. clear_catb if not movable?
  525. @ct_catb_value = MAX_CATB_VALUE if !self.current_action.item.charge_on
  526. value = $imported["YSA-LunaticCATBRate"] ? lunatic_catb_rate_formula : real_gain_catb
  527. @ct_catb_value += [value * self.current_action.item.charge_rate / 100, MAX_CATB_VALUE - @ct_catb_value].min
  528. end
  529.  
  530. #--------------------------------------------------------------------------
  531. # new method: charge_skill_done?
  532. #--------------------------------------------------------------------------
  533. def charge_skill_done?
  534. return @catb_value >= MAX_CATB_VALUE && @ct_catb_value >= MAX_CATB_VALUE
  535. end
  536.  
  537. #--------------------------------------------------------------------------
  538. # new method: clear_catb
  539. #--------------------------------------------------------------------------
  540. def clear_catb(value = 0)
  541. @catb_value = value
  542. @ct_catb_value = 0
  543. BattleManager.clear_actor if self.actor? && BattleManager.actor == self
  544. BattleManager.delete_catb_action(self)
  545. end
  546.  
  547. #--------------------------------------------------------------------------
  548. # new method: clear_catb_charge
  549. #--------------------------------------------------------------------------
  550. def clear_catb_charge
  551. @ct_catb_value = 0
  552. end
  553.  
  554. #--------------------------------------------------------------------------
  555. # new method: make_first_catb_value
  556. #--------------------------------------------------------------------------
  557. def make_first_catb_value(pre = 0)
  558. make_actions
  559. @catb_value = 0
  560. @catb_value = YSA::CATB::PREEMTIVE_ATB_ACTOR if self.actor? && pre == 1
  561. @catb_value = YSA::CATB::PREEMTIVE_ATB_ENEMY if self.enemy? && pre == 1
  562. @catb_value = YSA::CATB::SURPRISE_ATB_ACTOR if self.actor? && pre == 2
  563. @catb_value = YSA::CATB::SURPRISE_ATB_ENEMY if self.enemy? && pre == 2
  564. lunatic_catb_start_formula(pre) if $imported["YSA-LunaticCATBStart"]
  565. end
  566.  
  567. #--------------------------------------------------------------------------
  568. # new method: catb_filled_rate
  569. #--------------------------------------------------------------------------
  570. def catb_filled_rate
  571. return @catb_value / MAX_CATB_VALUE
  572. end
  573.  
  574. #--------------------------------------------------------------------------
  575. # new method: catb_ct_filled_rate
  576. #--------------------------------------------------------------------------
  577. def catb_ct_filled_rate
  578. return @catb_value < MAX_CATB_VALUE ? 0 : @ct_catb_value / MAX_CATB_VALUE
  579. end
  580.  
  581. #--------------------------------------------------------------------------
  582. # overwrite method: update_state_turns
  583. #--------------------------------------------------------------------------
  584. def update_state_turns
  585. states.each do |state|
  586. @state_turns[state.id] -= 1 if @state_turns[state.id] > 0 && state.auto_removal_timing == 2
  587. end
  588. end
  589.  
  590. #--------------------------------------------------------------------------
  591. # new method: update_state_actions
  592. #--------------------------------------------------------------------------
  593. def update_state_actions
  594. states.each do |state|
  595. @state_turns[state.id] -= 1 if @state_turns[state.id] > 0 && state.auto_removal_timing == 1
  596. end
  597. end
  598.  
  599. #--------------------------------------------------------------------------
  600. # alias method: on_action_end
  601. #--------------------------------------------------------------------------
  602. alias catb_on_action_end on_action_end
  603. def on_action_end
  604. catb_on_action_end
  605. update_state_actions
  606. end
  607.  
  608. #--------------------------------------------------------------------------
  609. # alias method: on_restrict
  610. #--------------------------------------------------------------------------
  611. alias catb_on_restrict on_restrict
  612. def on_restrict
  613. if BattleManager.btype?(:catb)
  614. clear_catb(0)
  615. states.each do |state|
  616. remove_state(state.id) if state.remove_by_restriction
  617. end
  618. end
  619. catb_on_restrict unless BattleManager.btype?(:catb)
  620. end
  621.  
  622. #--------------------------------------------------------------------------
  623. # alias method: force_action
  624. #--------------------------------------------------------------------------
  625. alias catb_force_action force_action
  626. def force_action(skill_id, target_index)
  627. if BattleManager.btype?(:catb)
  628. action = Game_Action.new(self, true)
  629. action.set_skill(skill_id)
  630. if target_index == -2
  631. action.target_index = last_target_index
  632. elsif target_index == -1
  633. action.decide_random_target
  634. else
  635. action.target_index = target_index
  636. end
  637. @actions = [action] + @actions
  638. end
  639. catb_force_action(skill_id, target_index) unless BattleManager.btype?(:catb)
  640. end
  641.  
  642. #--------------------------------------------------------------------------
  643. # alias method: make_action_times
  644. #--------------------------------------------------------------------------
  645. alias catb_make_action_times make_action_times
  646. def make_action_times
  647. BattleManager.btype?(:catb) ? 1 : catb_make_action_times
  648. end
  649.  
  650.  
  651. end # Game_Battler
  652.  
  653. #==============================================================================
  654. # ■ Game_Action
  655. #==============================================================================
  656.  
  657. class Game_Action
  658.  
  659. #--------------------------------------------------------------------------
  660. # alias method: clear
  661. #--------------------------------------------------------------------------
  662. alias catb_clear clear
  663. def clear
  664. catb_clear
  665. @confirm = false
  666. end
  667.  
  668. #--------------------------------------------------------------------------
  669. # new method: confirm=
  670. #--------------------------------------------------------------------------
  671. def confirm=(con)
  672. @confirm = con
  673. end
  674.  
  675. #--------------------------------------------------------------------------
  676. # new method: confirm
  677. #--------------------------------------------------------------------------
  678. def confirm
  679. return @subject.auto_battle? ? true : @confirm
  680. end
  681.  
  682. end # Game_Action
  683.  
  684. #==============================================================================
  685. # ■ Window_Base
  686. #==============================================================================
  687.  
  688. class Window_Base < Window
  689. #--------------------------------------------------------------------------
  690. # catb_gauge_color
  691. #--------------------------------------------------------------------------
  692. def catb_color1; text_color(YSA::CATB::GAUGE_COLOR1); end;
  693. def catb_color2; text_color(YSA::CATB::GAUGE_COLOR2); end;
  694. def charge_color1; text_color(YSA::CATB::CHARGE_COLOR1); end;
  695. def charge_color2; text_color(YSA::CATB::CHARGE_COLOR2); end;
  696. end # Window_Base
  697.  
  698. #==============================================================================
  699. # ■ Window_BattleStatus
  700. #==============================================================================
  701.  
  702. class Window_BattleStatus < Window_Selectable
  703.  
  704. #--------------------------------------------------------------------------
  705. # alias method: draw_item
  706. #--------------------------------------------------------------------------
  707. alias catb_draw_item draw_item
  708. def draw_item(index)
  709. catb_draw_item(index)
  710. actor = battle_members[index]
  711. rect = item_rect(index)
  712. gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS + YSA::CATB::ATB_GAUGE_Y_PLUS
  713. return unless BattleManager.btype?(:catb)
  714. draw_actor_catb(actor, rect.x+2, line_height*1+gx, rect.width-4)
  715. end
  716.  
  717. #--------------------------------------------------------------------------
  718. # new method: draw_actor_catb
  719. #--------------------------------------------------------------------------
  720. def draw_actor_catb(actor, dx, dy, width = 124)
  721. draw_gauge(dx, dy, width, actor.catb_filled_rate, catb_color1, catb_color2)
  722. if actor.catb_ct_filled_rate > 0
  723. draw_gauge(dx, dy, width, actor.catb_ct_filled_rate, charge_color1, charge_color2)
  724. end
  725. change_color(system_color)
  726. cy = (Font.default_size - contents.font.size) / 2 + 1
  727. draw_text(dx+2, dy+cy, 30, line_height, YSA::CATB::ATB_PHRASE)
  728. end
  729.  
  730. #--------------------------------------------------------------------------
  731. # new method: draw_item_actor_catb
  732. #--------------------------------------------------------------------------
  733. def draw_item_actor_catb(index)
  734. return if index.nil?
  735. actor = battle_members[index]
  736. rect = item_rect(index)
  737. return if actor.nil?
  738. gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS + YSA::CATB::ATB_GAUGE_Y_PLUS
  739. draw_actor_catb(actor, rect.x+2, line_height*1+gx, rect.width-4)
  740. end
  741.  
  742. #--------------------------------------------------------------------------
  743. # new method: refresh_catb
  744. #--------------------------------------------------------------------------
  745. def refresh_catb
  746. return unless BattleManager.btype?(:catb)
  747. item_max.times {|i| draw_item_actor_catb(i) }
  748. end
  749.  
  750. end # Window_BattleStatus
  751.  
  752. #==============================================================================
  753. # ■ Sprite_Battler
  754. #==============================================================================
  755.  
  756. class Sprite_Battler < Sprite_Base
  757.  
  758. #--------------------------------------------------------------------------
  759. # alias method: initialize
  760. #--------------------------------------------------------------------------
  761. alias sprite_battler_initialize_catb initialize
  762. def initialize(viewport, battler = nil)
  763. sprite_battler_initialize_catb(viewport, battler)
  764. create_enemy_gauges_catb
  765. end
  766.  
  767. #--------------------------------------------------------------------------
  768. # alias method: dispose
  769. #--------------------------------------------------------------------------
  770. alias sprite_battler_dispose_catb dispose
  771. def dispose
  772. sprite_battler_dispose_catb
  773. dispose_enemy_gauges_catb
  774. end
  775.  
  776. #--------------------------------------------------------------------------
  777. # alias method: update
  778. #--------------------------------------------------------------------------
  779. alias sprite_battler_update_catb update
  780. def update
  781. sprite_battler_update_catb
  782. update_enemy_gauges_catb
  783. end
  784.  
  785. #--------------------------------------------------------------------------
  786. # new method: create_enemy_gauges_catb
  787. #--------------------------------------------------------------------------
  788. def create_enemy_gauges_catb
  789. return if @battler.nil?
  790. return if @battler.actor?
  791. return unless BattleManager.btype?(:catb)
  792. @catb_back_gauge_viewport = Enemy_CATB_Gauge_Viewport.new(@battler, self, :back)
  793. @catb_gauge_viewport = Enemy_CATB_Gauge_Viewport.new(@battler, self, :catb)
  794. @catb_ct_gauge_viewport = Enemy_CATB_Gauge_Viewport.new(@battler, self, :catbct)
  795. end
  796.  
  797. #--------------------------------------------------------------------------
  798. # new method: dispose_enemy_gauges_catb
  799. #--------------------------------------------------------------------------
  800. def dispose_enemy_gauges_catb
  801. return unless BattleManager.btype?(:catb)
  802. @catb_back_gauge_viewport.dispose unless @catb_back_gauge_viewport.nil?
  803. @catb_gauge_viewport.dispose unless @catb_gauge_viewport.nil?
  804. @catb_ct_gauge_viewport.dispose unless @catb_ct_gauge_viewport.nil?
  805. end
  806.  
  807. #--------------------------------------------------------------------------
  808. # new method: update_enemy_gauges_catb
  809. #--------------------------------------------------------------------------
  810. def update_enemy_gauges_catb
  811. return unless BattleManager.btype?(:catb)
  812. @catb_back_gauge_viewport.update unless @catb_back_gauge_viewport.nil?
  813. @catb_gauge_viewport.update unless @catb_gauge_viewport.nil?
  814. @catb_ct_gauge_viewport.update unless @catb_ct_gauge_viewport.nil?
  815. end
  816.  
  817. end # Sprite_Battler
  818.  
  819. #==============================================================================
  820. # ■ Enemy_CATB_Gauge_Viewport
  821. #==============================================================================
  822.  
  823. class Enemy_CATB_Gauge_Viewport < Viewport
  824.  
  825. #--------------------------------------------------------------------------
  826. # initialize
  827. #--------------------------------------------------------------------------
  828. def initialize(battler, sprite, type)
  829. @battler = battler
  830. @base_sprite = sprite
  831. @type = type
  832. dw = YSA::CATB::ENEMY_GAUGE_WIDTH
  833. dw += 2 if @type == :back
  834. @start_width = dw
  835. dh = YSA::CATB::ENEMY_GAUGE_HEIGHT
  836. dh += 2 if @type == :back
  837. rect = Rect.new(0, 0, dw, dh)
  838. super(rect)
  839. self.z = 125
  840. create_gauge_sprites
  841. self.visible = false
  842. update_position
  843. end
  844.  
  845. #--------------------------------------------------------------------------
  846. # dispose
  847. #--------------------------------------------------------------------------
  848. def dispose
  849. @sprite.bitmap.dispose unless @sprite.bitmap.nil?
  850. @sprite.dispose
  851. super
  852. end
  853.  
  854. #--------------------------------------------------------------------------
  855. # update
  856. #--------------------------------------------------------------------------
  857. def update
  858. super
  859. self.visible = @battler.dead? ? false : @battler.hidden? ? false : YSA::CATB::SHOW_ENEMY_ATB_GAUGE
  860. update_position
  861. update_gauge
  862. end
  863.  
  864. #--------------------------------------------------------------------------
  865. # create_gauge_sprites
  866. #--------------------------------------------------------------------------
  867. def create_gauge_sprites
  868. @sprite = Plane.new(self)
  869. dw = self.rect.width * 2
  870. @sprite.bitmap = Bitmap.new(dw, self.rect.height)
  871. case @type
  872. when :back
  873. colour1 = Colour.text_colour(YSA::CATB::ENEMY_BACKGAUGE_COLOUR)
  874. colour2 = Colour.text_colour(YSA::CATB::ENEMY_BACKGAUGE_COLOUR)
  875. when :catb
  876. colour1 = Colour.text_colour(YSA::CATB::ENEMY_ATB_GAUGE_COLOUR1)
  877. colour2 = Colour.text_colour(YSA::CATB::ENEMY_ATB_GAUGE_COLOUR2)
  878. when :catbct
  879. colour1 = Colour.text_colour(YSA::CATB::CHARGE_COLOR1)
  880. colour2 = Colour.text_colour(YSA::CATB::CHARGE_COLOR2)
  881. end
  882. dx = 0
  883. dy = 0
  884. dw = self.rect.width
  885. dh = self.rect.height
  886. self.rect.width = target_gauge_width unless @type == :back
  887. @gauge_width = target_gauge_width
  888. @sprite.bitmap.gradient_fill_rect(dx, dy, dw, dh, colour1, colour2)
  889. @sprite.bitmap.gradient_fill_rect(dw, dy, dw, dh, colour2, colour1)
  890. end
  891.  
  892. #--------------------------------------------------------------------------
  893. # update_position
  894. #--------------------------------------------------------------------------
  895. def update_position
  896. dx = @battler.screen_x - @start_width / 2
  897. self.rect.x = dx
  898. dh = self.rect.height + 1
  899. dh += 2 unless @type == :back
  900. dy = [@battler.screen_y, Graphics.height - dh - 120].min
  901. dy += 1 unless @type == :back
  902. dy -= YEA::BATTLE::ENEMY_GAUGE_HEIGHT if $imported["YEA-EnemyHPBars"]
  903. self.rect.y = dy
  904. end
  905.  
  906. #--------------------------------------------------------------------------
  907. # update_gauge
  908. #--------------------------------------------------------------------------
  909. def update_gauge
  910. return if @gauge_width == target_gauge_width
  911. @gauge_width = target_gauge_width if @type == :catb
  912. @gauge_width = target_gauge_width_ct if @type == :catbct
  913. return if @type == :back
  914. self.rect.width = @gauge_width
  915. end
  916.  
  917. #--------------------------------------------------------------------------
  918. # target_gauge_width
  919. #--------------------------------------------------------------------------
  920. def target_gauge_width
  921. return @battler.catb_filled_rate * @start_width
  922. end
  923.  
  924. #--------------------------------------------------------------------------
  925. # target_gauge_width_ct
  926. #--------------------------------------------------------------------------
  927. def target_gauge_width_ct
  928. return @battler.catb_ct_filled_rate * @start_width
  929. end
  930.  
  931. end # Enemy_CATB_Gauge_Viewport
  932.  
  933. #==============================================================================
  934. # ■ Window_BattleEnemy
  935. #==============================================================================
  936.  
  937. class Window_BattleEnemy < Window_Selectable
  938.  
  939. #--------------------------------------------------------------------------
  940. # alias method: col_max
  941. #--------------------------------------------------------------------------
  942. alias catb_col_max col_max
  943. def col_max; return catb_col_max == 0 ? 1 : catb_col_max; end
  944.  
  945. end # Window_BattleEnemy
  946.  
  947. #==============================================================================
  948. # ■ Scene_Battle
  949. #==============================================================================
  950.  
  951. class Scene_Battle < Scene_Base
  952.  
  953. #--------------------------------------------------------------------------
  954. # alias method: process_action
  955. #--------------------------------------------------------------------------
  956. alias catb_process_action process_action
  957. def process_action
  958. if BattleManager.btype?(:catb)
  959. process_catb
  960. perform_catb_action(@subject, true) if BattleManager.action_forced?
  961. end
  962. catb_process_action unless BattleManager.btype?(:catb)
  963. end
  964.  
  965. #--------------------------------------------------------------------------
  966. # new method: catb_pause?
  967. #--------------------------------------------------------------------------
  968. def catb_pause?
  969. return true if BattleManager.action_forced?
  970. return YSA::CATB::PAUSE_WHEN_ACTIVE_PARTY_COMMAND if @party_command_window.active
  971. return true if $imported["YEA-CombatLogDisplay"] && @combatlog_window && @combatlog_window.visible
  972. return false if $game_system.catb_wait_type == :full
  973. return true if $game_system.catb_wait_type == :wait && (@actor_command_window.active || @skill_window.active || @item_window.active || @actor_window.active || @enemy_window.active)
  974. return true if $game_system.catb_wait_type == :quarter && (@skill_window.active || @item_window.active || @actor_window.active || @enemy_window.active)
  975. return true if $game_system.catb_wait_type == :semi && (@actor_window.active || @enemy_window.active)
  976. end
  977.  
  978. #--------------------------------------------------------------------------
  979. # new method: process_catb
  980. #--------------------------------------------------------------------------
  981. def process_catb
  982. if @status_window.index >= 0 && ($game_party.members[@status_window.index].dead? || !BattleManager.action_list(:actor).include?($game_party.members[@status_window.index]))
  983. $game_party.members[@status_window.index].clear_catb
  984. if @skill_window.visible || @item_window.visible
  985. @status_window.open
  986. @status_window.show
  987. @status_aid_window.hide
  988. end
  989. @actor_window.hide.deactivate
  990. @enemy_window.hide.deactivate
  991. @actor_command_window.deactivate
  992. @actor_command_window.close
  993. @skill_window.hide.deactivate
  994. @item_window.hide.deactivate
  995. @status_window.unselect
  996. end
  997. return unless SceneManager.scene_is?(Scene_Battle)
  998. return if scene_changing?
  999. return unless BattleManager.btype?(:catb)
  1000. return if catb_pause?
  1001. battler_hash = $game_party.members + $game_troop.members
  1002. battler_hash.each { |a|
  1003. a.make_catb_update
  1004. a.make_catb_action
  1005. a.make_ct_catb_update
  1006. }
  1007. #--- Update Tick Turn
  1008. if $game_system.catb_turn_type == :tick
  1009. @tick_clock = 0 if !@tick_clock
  1010. @tick_clock += 1
  1011. if @tick_clock >= $game_system.catb_tick_count
  1012. @tick_clock = 0
  1013. all_battle_members.each { |battler|
  1014. battler.on_turn_end
  1015. }
  1016. @status_window.refresh
  1017. $game_troop.increase_turn
  1018. end
  1019. end
  1020. #--- Fix make action
  1021. BattleManager.action_list(:actor).each { |battler|
  1022. battler.make_actions if (battler.actor? && !battler.input)
  1023. }
  1024. #---
  1025. @status_window.refresh_catb
  1026. #--- Setup Actor
  1027. @f_actor_index = 0 if !@f_actor_index || @f_actor_index < 0 || @f_actor_index + 1 > BattleManager.action_list(:actor).size
  1028. f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  1029. @f_actor_index += 1 if (@f_actor_index + 1) < BattleManager.action_list(:actor).size && f_actor && f_actor.input && f_actor.input.item && f_actor.input.confirm
  1030. f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  1031. if f_actor && f_actor.input && !f_actor.input.confirm && (!BattleManager.actor || @status_window.index != BattleManager.actor.index) && !@actor_command_window.active && !@party_command_window.active
  1032. BattleManager.set_actor(f_actor.index)
  1033. @status_window.select(BattleManager.actor.index)
  1034. @actor_command_window.setup(BattleManager.actor)
  1035. @actor_command_window.show
  1036. end
  1037. BattleManager.action_list.each { |battler|
  1038. battler.make_actions if battler.enemy?
  1039. perform_catb_action(battler) if !@subject
  1040. }
  1041. end
  1042.  
  1043. #--------------------------------------------------------------------------
  1044. # new method: perform_catb_action
  1045. #--------------------------------------------------------------------------
  1046. def perform_catb_action(subject, forced = false)
  1047. return if subject && !subject.charge_skill_done? && !forced
  1048. return if subject && subject.actor? && !forced && !subject.input
  1049. return if subject && subject.actor? && !forced && !subject.input.item
  1050. return if subject && subject.actor? && !forced && !subject.input.confirm
  1051. @subject = subject if subject
  1052. return if !@subject
  1053. if @subject.current_action
  1054. @subject.current_action.prepare
  1055. execute_action if @subject.current_action.valid?
  1056. reset_value = $imported["YSA-LunaticCATBReset"] ? @subject.lunatic_catb_reset_formula : 0
  1057. process_event
  1058. loop do
  1059. @subject.remove_current_action
  1060. break if forced || !@subject.current_action || !@subject.current_action.valid?
  1061. @subject.current_action.prepare
  1062. execute_action
  1063. end
  1064. if $game_system.catb_turn_type == :action
  1065. @tick_action = 0 if !@tick_action
  1066. @tick_action += 1 if !forced || (forced && YSA::CATB::FORCE_ACTION_COUNT)
  1067. if @tick_action >= $game_system.catb_after_action
  1068. @tick_action = 0
  1069. all_battle_members.each { |battler|
  1070. battler.on_turn_end
  1071. }
  1072. @status_window.refresh
  1073. $game_troop.increase_turn
  1074. end
  1075. end
  1076. @status_aid_window.refresh if @status_aid_window.visible
  1077. process_action_end
  1078. end
  1079. return if BattleManager.judge_win_loss
  1080. if @subject
  1081. @subject.clear_catb(reset_value) if (YSA::CATB::FORCE_ACTION_CLEAR_ATB && forced) || !forced
  1082. @status_window.draw_item(@subject.index) if @subject.actor?
  1083. @subject = nil
  1084. end
  1085. end
  1086.  
  1087. #--------------------------------------------------------------------------
  1088. # alias method: create_actor_command_window
  1089. #--------------------------------------------------------------------------
  1090. alias catb_create_actor_command_window create_actor_command_window
  1091. def create_actor_command_window
  1092. catb_create_actor_command_window
  1093. if BattleManager.btype?(:catb)
  1094. @actor_command_window.set_handler(:dir4, method(:prior_f_actor))
  1095. @actor_command_window.set_handler(:dir6, method(:next_f_actor))
  1096. end
  1097. end
  1098.  
  1099. #--------------------------------------------------------------------------
  1100. # new method: prior_f_actor
  1101. #--------------------------------------------------------------------------
  1102. def prior_f_actor
  1103. if @f_actor_index && BattleManager.action_list(:actor).size > 0
  1104. @f_actor_index -= 1
  1105. @f_actor_index = 0 if @f_actor_index < 0
  1106. f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  1107. if f_actor
  1108. BattleManager.set_actor(f_actor.index)
  1109. @status_window.select(BattleManager.actor.index)
  1110. @actor_command_window.setup(BattleManager.actor)
  1111. end
  1112. end
  1113. end
  1114.  
  1115. #--------------------------------------------------------------------------
  1116. # new method: next_f_actor
  1117. #--------------------------------------------------------------------------
  1118. def next_f_actor
  1119. if @f_actor_index && BattleManager.action_list(:actor).size > 0
  1120. @f_actor_index += 1
  1121. @f_actor_index = 0 if (@f_actor_index + 1) > BattleManager.action_list(:actor).size
  1122. f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  1123. if f_actor
  1124. BattleManager.set_actor(f_actor.index)
  1125. @status_window.select(BattleManager.actor.index)
  1126. @actor_command_window.setup(BattleManager.actor)
  1127. end
  1128. end
  1129. end
  1130.  
  1131. #--------------------------------------------------------------------------
  1132. # alias method: turn_start
  1133. #--------------------------------------------------------------------------
  1134. alias catb_turn_start turn_start
  1135. def turn_start
  1136. if BattleManager.btype?(:catb)
  1137. @party_command_window.close
  1138. @actor_command_window.close
  1139. @status_window.unselect
  1140. @log_window.wait
  1141. @log_window.clear
  1142. else
  1143. catb_turn_start
  1144. end
  1145. end
  1146.  
  1147. #--------------------------------------------------------------------------
  1148. # alias method: command_guard
  1149. #--------------------------------------------------------------------------
  1150. alias catb_command_guard command_guard
  1151. def command_guard
  1152. BattleManager.actor.input.confirm = true
  1153. catb_command_guard
  1154. @status_window.draw_item(BattleManager.actor.index)
  1155. end
  1156.  
  1157. #--------------------------------------------------------------------------
  1158. # alias method: command_attack
  1159. #--------------------------------------------------------------------------
  1160. alias catb_command_attack command_attack
  1161. def command_attack
  1162. catb_command_attack
  1163. @status_window.draw_item(BattleManager.actor.index)
  1164. end
  1165.  
  1166. #--------------------------------------------------------------------------
  1167. # alias method: on_enemy_ok
  1168. #--------------------------------------------------------------------------
  1169. alias catb_on_enemy_ok on_enemy_ok
  1170. def on_enemy_ok
  1171. BattleManager.actor.input.confirm = true
  1172. catb_on_enemy_ok
  1173. end
  1174.  
  1175. #--------------------------------------------------------------------------
  1176. # alias method: on_enemy_cancel
  1177. #--------------------------------------------------------------------------
  1178. alias catb_on_enemy_cancel on_enemy_cancel
  1179. def on_enemy_cancel
  1180. BattleManager.actor.input.confirm = false
  1181. catb_on_enemy_cancel
  1182. @status_window.draw_item(BattleManager.actor.index)
  1183. end
  1184.  
  1185. #--------------------------------------------------------------------------
  1186. # alias method: on_actor_ok
  1187. #--------------------------------------------------------------------------
  1188. alias catb_on_actor_ok on_actor_ok
  1189. def on_actor_ok
  1190. BattleManager.actor.input.confirm = true
  1191. catb_on_actor_ok
  1192. end
  1193.  
  1194. #--------------------------------------------------------------------------
  1195. # alias method: on_actor_cancel
  1196. #--------------------------------------------------------------------------
  1197. alias catb_on_actor_cancel on_actor_cancel
  1198. def on_actor_cancel
  1199. BattleManager.actor.input.confirm = false
  1200. catb_on_actor_cancel
  1201. @status_window.draw_item(BattleManager.actor.index)
  1202. end
  1203.  
  1204. #--------------------------------------------------------------------------
  1205. # alias method: on_skill_ok
  1206. #--------------------------------------------------------------------------
  1207. alias catb_on_skill_ok on_skill_ok
  1208. def on_skill_ok
  1209. catb_on_skill_ok
  1210. @status_window.draw_item(BattleManager.actor.index)
  1211. end
  1212.  
  1213. #--------------------------------------------------------------------------
  1214. # alias method: on_item_ok
  1215. #--------------------------------------------------------------------------
  1216. alias catb_on_item_ok on_item_ok
  1217. def on_item_ok
  1218. catb_on_item_ok
  1219. @status_window.draw_item(BattleManager.actor.index)
  1220. end
  1221.  
  1222. #--------------------------------------------------------------------------
  1223. # alias method: update_info_viewport
  1224. #--------------------------------------------------------------------------
  1225. alias catb_update_info_viewport update_info_viewport
  1226. def update_info_viewport
  1227. catb_update_info_viewport
  1228. if BattleManager.btype?(:catb)
  1229. move_info_viewport(128) if @actor_command_window.active || @actor_window.active || @enemy_window.active || (($game_troop.all_dead? || $game_party.all_dead?)&& @bug_fix1)
  1230. move_info_viewport(0) if @party_command_window.active
  1231. move_info_viewport(0) if $imported["YEA-CombatLogDisplay"] && @combatlog_window && @combatlog_window.visible
  1232. end
  1233. end
  1234.  
  1235. #--------------------------------------------------------------------------
  1236. # rewrite method: perform_collapse_check
  1237. #--------------------------------------------------------------------------
  1238. def perform_collapse_check(target)
  1239. return if YEA::BATTLE::MSG_ADDED_STATES
  1240. if $game_troop.all_dead? || $game_party.all_dead?
  1241. if @actor_window.active || @enemy_window.active
  1242. @bug_fix1 = true
  1243. @help_window.hide
  1244. @actor_window.hide.deactivate
  1245. @enemy_window.hide.deactivate
  1246. end
  1247. @actor_command_window.hide.deactivate
  1248. @party_command_window.hide.deactivate
  1249. @skill_window.hide.deactivate
  1250. @item_window.hide.deactivate
  1251. move_info_viewport(64)
  1252. end
  1253. target.perform_collapse_effect if target.can_collapse?
  1254. @log_window.wait
  1255. end
  1256.  
  1257. #--------------------------------------------------------------------------
  1258. # alias method: update_message_open
  1259. #--------------------------------------------------------------------------
  1260. alias catb_update_message_open update_message_open
  1261. def update_message_open
  1262. catb_update_message_open
  1263. if !$game_message.busy? && @status_window.close? && !$game_troop.all_dead? && !$game_party.all_dead?
  1264. @status_window.open
  1265. end
  1266. end
  1267.  
  1268. end # Scene_Battle
  1269.  
  1270. #==============================================================================
  1271. #
  1272. # ▼ End of File
  1273. #
  1274. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement