Guest User

Ar tonelico script xp

a guest
Oct 26th, 2011
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 162.67 KB | None | 0 0
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2. # Ar Tonelico Custom Battle System
  3. # Author: Kread-EX
  4. # Version 1.1
  5. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  6.  
  7. # TERMS OF USAGE
  8. # #------------------------------------------------------------------------------------------------------------------
  9. # # You are free to adapt this work to suit your needs.
  10. # #
  11. # # You cannot use this work for commercial purposes.
  12. # #
  13. # # This work can only be distributed by the following websites:
  14. # # http://www.creationasylum.net/
  15. # # http://www.rpgrevolution.com/ --> Standalone Scripts ONLY (not the demo !)
  16. # # http://www.rmvxp.com/
  17. # # If you want to distribute it elsewhere, contact me first. I'll most likely accept (unless I have
  18. # # some kind of grudge against a certain place), but I want to keep track of the places.
  19. # # Note that I will support and update this script on the above places ONLY.
  20. # #------------------------------------------------------------------------------------------------------------------
  21.  
  22.  
  23. #===========================================================
  24. # INTRODUCTION
  25. #
  26. # This script is a custom battle system (CBS) destined to replicate more or less the system used
  27. # in the game "Ar Tonelico - Sekai no Owari de Shi Tsudukeru Shoujo". I say more or less because
  28. # I changed some things.
  29. #
  30. #
  31. # HOW TO USE
  32. # This script is designed to be used with Minkoff/DerVVulfman's Animated Battlers. It won't work
  33. # with the default layout neither will it with Xiderowg's FullMotion script.
  34. # If you downloaded the script from RRR, you'll have to get the Animated Battlers script.
  35. # You can find it there: http://www.creationasylum.net/forum/index.php?showtopic=11827
  36. # Put the main script above the Animated Battlers, and the patch below.
  37. # Read carefully the configuration steps in the KreadCFG section and if the Animated Battlers if
  38. # necessary.
  39. #
  40. # COMPATIBILITY ISSUES
  41. #
  42. # Will clash with the SDK, but not with the MACL.
  43. # In order to avoid lag, I have overwritten most methods insteads of aliasing them, which means
  44. # most battle add-ons will clash with this script.
  45. # If will write add-ons for the next releases depending of user feedback.
  46. #
  47. # CREDITS
  48. #
  49. # Gust Entertainment and Banpresto for making Ar Tonelico in the first place.
  50. # Minkoff and DerVVulfman for their Animated Battlers script.
  51. # MoyasiWhite for the icons.
  52. # Dollmage, Nakka and Grin for the battler graphics.
  53. # Gozaru for the face graphics.
  54. #===========================================================
  55.  
  56. #===========================================================
  57. # ** KreadCFG
  58. #------------------------------------------------------------------------------
  59. # Configuration module.
  60. #===========================================================
  61.  
  62. module KreadCFG
  63.  
  64. # Name of Reyvateil class.
  65. ReyvateilClass = 'Reyvateil'
  66.  
  67. # Name of Song Magic.
  68. SongMagicName = 'Song Magic'
  69.  
  70. # Name of Song Activation.
  71. SongActivate = 'Activate Song'
  72.  
  73. # Name of Song Cancellation.
  74. SongCancel = 'Cancel Song'
  75.  
  76. # Animation ID for Song Activation
  77. SongActivateAnimID = 105
  78.  
  79. # Animation ID for Song Cancellation
  80. SongCancelAnimID = 104
  81.  
  82. # Name of Red Magic and Blue Magic
  83. SongRed = 'Red Magic'
  84. SongBlue = 'Blue Magic'
  85.  
  86. # List of charging animation for Song Magic (Red type only).
  87. # Format: {Skill ID => Animation ID}
  88. SongMagicChargeAnim = {82 => 102, 83 => 107}
  89.  
  90. # Max Burst value before Song Magic evolution.
  91. # Format: {Skill ID => value}
  92. SongMagicMaxBurst = {82 => 700, 83 => 3000, 89 => 6000}
  93.  
  94. # Skill Evolution Pattern. Determine in which skill a previous skill will evolve when the
  95. # Max Burst value has been reached.
  96. # Format: {Old Skill ID => New Skill ID}
  97. SongMagicEvolve = {82 => 83}
  98.  
  99. # Harmo Overdrive Skills ID (skills available using Harmonics gauge)
  100. # Format: [Skill ID, Skill ID, ...]
  101. HarmoOverdriveSkills = [85, 86]
  102.  
  103. # Set here the IDs for Fire, Ice and Wind elements.
  104. FireElement = 1
  105. IceElement = 2
  106. WindElement = 6
  107.  
  108. # Hit number for skills.
  109. # Format: when Skill ID then #nb of hits. Default is 1.
  110. def self.skill_hits(skill_id)
  111. case skill_id
  112. when 57 then 2
  113. when 60, 82, 83 then 5
  114. when 68 then 3
  115. else
  116. 1
  117. end
  118. end
  119.  
  120. # Hit timings. Goes with Hit numbers.
  121. # Enter here the Frame number that triggers the hit.
  122. # If the skill has 1 hit, then you don't have to configure this.
  123. # Format: {Skill ID => [frame, frame, frame...]}
  124. HitTimings = {
  125. 57 => [3, 6],
  126. 60 => [2, 5, 8, 11, 14],
  127. 68 => [2, 7, 12],
  128. 82 => [54, 56, 58, 60, 62],
  129. 83 => [54, 56, 58, 60, 62]
  130. }
  131.  
  132. # Skill speed multiplier.
  133. # Format: when Skill ID then Float number. Default is 0.8.
  134. def self.skill_speed(skill_id)
  135. case skill_id
  136. when 58, 59, 66, 67, 70, 71 then 0.6
  137. when 30, 60, 68, 72 then 0.3
  138. when 85 then 0.2
  139. when 86 then 0.1
  140. else
  141. 0.8
  142. end
  143. end
  144.  
  145. # Item speed multiplier.
  146. ItemSpeed = 1.5
  147.  
  148. # Battle speed. The higher, the faster. Minimum is 2 and maximum is 100.
  149. BattleSpeed = 10
  150.  
  151. #--------------------------------------------------------------------------
  152. # * Checks if the given actor is a Reyvateil
  153. #--------------------------------------------------------------------------
  154. def self.is_reyvateil?(actor)
  155. return false if !actor.is_a?(Game_Actor)
  156. return $data_classes[actor.class_id].name == ReyvateilClass
  157. end
  158. #--------------------------------------------------------------------------
  159. # * Checks if there is a Reyvateil in the party at all
  160. #--------------------------------------------------------------------------
  161. def self.reyvateil_party?
  162. $game_party.actors.each {|actor|
  163. return true if self.is_reyvateil?(actor)
  164. }
  165. return false
  166. end
  167. #--------------------------------------------------------------------------
  168. # * Returns the Reyvateil in the party
  169. #--------------------------------------------------------------------------
  170. def self.return_reyvateil
  171. $game_party.actors.each {|actor|
  172. return actor if self.is_reyvateil?(actor)
  173. }
  174. return nil
  175. end
  176. #--------------------------------------------------------------------------
  177. # * Checks if there are two Reyvateils
  178. #--------------------------------------------------------------------------
  179. def self.too_many_reyvateils?
  180. rev_count = 0
  181. $game_party.actors.each {|actor|
  182. rev_count += 1 if self.is_reyvateil?(actor)
  183. }
  184. return rev_count >= 2
  185. end
  186. #--------------------------------------------------------------------------
  187. end
  188.  
  189. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  190. # Ar Tonelico Custom Battle System
  191. # Author: Kread-EX
  192. # Version 1.1
  193. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  194.  
  195. #===========================================================
  196. # ** Scene_Battle
  197. #------------------------------------------------------------------------------
  198. # This class performs battle screen processing.
  199. #===========================================================
  200.  
  201. class Scene_Battle
  202. #--------------------------------------------------------------------------
  203. # * Public instance variables
  204. #--------------------------------------------------------------------------
  205. attr_reader :skill
  206. attr_accessor :vanguards_harmonics
  207. attr_accessor :reyvateil_harmonics
  208. #--------------------------------------------------------------------------
  209. # * Main Processing
  210. #--------------------------------------------------------------------------
  211. def main
  212. # Checks if too many reyvateils
  213. if KreadCFG.too_many_reyvateils?
  214. print("You cannot have more than 1 Reyvateil in your party !\n" +
  215. "Please take this into account when designing your game.")
  216. exit
  217. end
  218. # Checks for alone reyvateil
  219. if $game_party.actors.size == 1 && KreadCFG.reyvateil_party?
  220. print("You cannot have a lone Reyvateil in your party !")
  221. exit
  222. end
  223. set_global_variables
  224. set_troop_data
  225. set_initial_action_meters
  226. create_sprites_and_windows
  227. # Initialize wait count
  228. @wait_count = 0
  229. # Assign Reyvateil
  230. @reyvateil = KreadCFG.return_reyvateil
  231. if @reyvateil != nil
  232. @reyvateil.song_chant = false
  233. @reyvateil.song_blue = false
  234. @reyvateil.harmonics = 0
  235. @reyvateil.burst_value = 0
  236. end
  237. # Prepare Vanguards Harmonics
  238. @vanguards_harmonics = 0
  239. # Prepare Reyvateil Harmonics
  240. @reyvateil_harmonics = 0
  241. # Initialize delayed command
  242. @delayed_command = false
  243. # Start pre-battle phase
  244. start_phase1
  245. # But switch to Reyvateil command menu if there is a Reyvateil
  246. start_phase6 if KreadCFG.reyvateil_party?
  247. execute_transition
  248. execute_basic_loop
  249. terminate_scene
  250. end
  251. #--------------------------------------------------------------------------
  252. # * Fake judge
  253. #--------------------------------------------------------------------------
  254. def fake_judge
  255. # If all dead determinant is true, or number of members in party is 0
  256. if $game_party.all_dead? or $game_party.actors.size == 0
  257. # If possible to lose
  258. if $game_temp.battle_can_lose
  259. # Desactive Reyvateil Menu
  260. @reyvateil_menu = 'desactivated'
  261. @delayed_command = false
  262. # Return true
  263. return true
  264. end
  265. # Desactive Reyvateil Menu
  266. @reyvateil_menu = 'desactivated'
  267. @delayed_command = false
  268. # Return true
  269. return true
  270. end
  271. # Return false if even 1 enemy exists
  272. for enemy in $game_troop.enemies
  273. if enemy.exist?
  274. return false
  275. end
  276. end
  277. # Desactive Reyvateil Menu
  278. @reyvateil_menu = 'desactivated'
  279. @delayed_command = false
  280. # Return true
  281. return true
  282. end
  283. #--------------------------------------------------------------------------
  284. # * Initialize all globals
  285. #--------------------------------------------------------------------------
  286. def set_global_variables
  287. # Initialize each kind of temporary battle data
  288. $game_temp.in_battle = true
  289. $game_temp.battle_turn = 0
  290. $game_temp.battle_event_flags.clear
  291. $game_temp.battle_abort = false
  292. $game_temp.battle_main_phase = false
  293. $game_temp.battleback_name = $game_map.battleback_name
  294. $game_temp.forcing_battler = nil
  295. $game_temp.max_harmonics = 1000
  296. # Initialize battle event interpreter
  297. $game_system.battle_interpreter.setup(nil, 0)
  298. $game_party.harmonics = 0
  299. end
  300. #--------------------------------------------------------------------------
  301. # * Prepare troop
  302. #--------------------------------------------------------------------------
  303. def set_troop_data
  304. @troop_id = $game_temp.battle_troop_id
  305. $game_troop.setup(@troop_id)
  306. end
  307. #--------------------------------------------------------------------------
  308. # * Computes the initial Action Meters for all battlers
  309. #--------------------------------------------------------------------------
  310. def set_initial_action_meters
  311. ($game_party.actors + $game_troop.enemies).each {|battler|
  312. battler.action_meter = battler.agi + rand(battler.agi / 50)
  313. }
  314. end
  315. #--------------------------------------------------------------------------
  316. # * Create the permanently used sprites and windows
  317. #--------------------------------------------------------------------------
  318. def create_sprites_and_windows
  319. # Make sprite set
  320. @spriteset = Spriteset_Battle.new
  321. # Status windows for each actor
  322. @status_windows = []
  323. i = 0
  324. old_y = 350
  325. (0...$game_party.actors.size).each {|j|
  326. i = (($game_party.actors.size - 1) - j)
  327. @status_windows[i] = Battle_Status.new(i)
  328. @status_windows[i].y = old_y
  329. old_y -= 58
  330. }
  331. # Reyvateil command sprite (if there is a Reyvateil in the party)
  332. if KreadCFG.reyvateil_party?
  333. @reyvateil_command = Reyvateil_Command.new(@spriteset.viewport5)
  334. end
  335. # Action system graphic interface
  336. @action_system = Action_System.new(@spriteset.viewport5)
  337. # Create message window
  338. @message_window = Window_Message.new
  339. # Create the Harmonics gauge
  340. @harmonics_gauge = Harmonics_Gauge.new(@spriteset.viewport5, KreadCFG.return_reyvateil)
  341. end
  342. #--------------------------------------------------------------------------
  343. # * Perform the start-battle transition
  344. #--------------------------------------------------------------------------
  345. def execute_transition
  346. if $data_system.battle_transition == ''
  347. Graphics.transition(20)
  348. else
  349. Graphics.transition(40, 'Graphics/Transitions/' + $data_system.battle_transition)
  350. end
  351. end
  352. #--------------------------------------------------------------------------
  353. # * Basic scene loop
  354. #--------------------------------------------------------------------------
  355. def execute_basic_loop
  356. # Main loop
  357. loop {
  358. # Update game screen
  359. Graphics.update
  360. # Update input information
  361. Input.update
  362. # Frame update
  363. update
  364. # Abort loop if screen is changed
  365. break if $scene != self
  366. }
  367. end
  368. #--------------------------------------------------------------------------
  369. # * Destroy all objects
  370. #--------------------------------------------------------------------------
  371. def dispose_objects
  372. @message_window.dispose
  373. @spriteset.dispose
  374. @status_windows.each {|spr| spr.dispose}
  375. if @reyvateil_command != nil
  376. @reyvateil_command.bitmap.dispose
  377. @reyvateil_command.dispose
  378. end
  379. if @levelup_sprites != nil
  380. @levelup_sprites.each {|spr| spr.dispose}
  381. end
  382. @reyvateil_ring.dispose if @reyvateil_ring != nil
  383. @result_window.dispose if @result_window != nil
  384. @action_system.dispose
  385. end
  386. #--------------------------------------------------------------------------
  387. # * Link to next scene
  388. #--------------------------------------------------------------------------
  389. def terminate_scene
  390. # Refresh map
  391. $game_map.refresh
  392. # Prepare for transition
  393. Graphics.freeze
  394. # Dispose of all objects
  395. dispose_objects
  396. # Clear cache
  397. RPG::Cache.clear
  398. # If switching to title screen
  399. if $scene.is_a?(Scene_Title)
  400. # Fade out screen
  401. Graphics.transition
  402. Graphics.freeze
  403. end
  404. # If switching from battle test to any screen other than game over screen
  405. if $BTEST and not $scene.is_a?(Scene_Gameover)
  406. $scene = nil
  407. end
  408. end
  409. #--------------------------------------------------------------------------
  410. # * Frame Update
  411. #--------------------------------------------------------------------------
  412. def update
  413. update_battle_interpreter
  414. update_globals
  415. update_harmonics
  416. update_sprites_and_windows
  417. update_transition
  418. update_reyvateil_command
  419. if @reyvateil != nil && @blue_launch
  420. update_phase6_blue_magic unless (@reyvateil.dead? || [email protected]_blue)
  421. @blue_launch = false
  422. end
  423. # If message window is showing, then stops
  424. return if $game_temp.message_window_showing
  425. # If effect is showing, then stops
  426. return if @spriteset.effect?
  427. # If game over
  428. if $game_temp.gameover
  429. # Switch to game over screen
  430. $scene = Scene_Gameover.new
  431. return
  432. end
  433. # If returning to title screen
  434. if $game_temp.to_title
  435. # Switch to title screen
  436. $scene = Scene_Title.new
  437. return
  438. end
  439. # If battle is aborted
  440. if $game_temp.battle_abort
  441. # Return to BGM used before battle started
  442. $game_system.bgm_play($game_temp.map_bgm)
  443. # Battle ends
  444. battle_end(1)
  445. return
  446. end
  447. # If waiting
  448. if @wait_count > 0
  449. # Decrease wait count
  450. @wait_count -= 1
  451. return
  452. end
  453. # If battler forcing an action doesn't exist, and battle event is running, then stops
  454. return if $game_temp.forcing_battler == nil && $game_system.battle_interpreter.running?
  455. update_phases
  456. end
  457. #--------------------------------------------------------------------------
  458. # * Update the battle interpreter
  459. #--------------------------------------------------------------------------
  460. def update_battle_interpreter
  461. # If battle event is running
  462. if $game_system.battle_interpreter.running?
  463. # Update interpreter
  464. $game_system.battle_interpreter.update
  465. # If a battler which is forcing actions doesn't exist
  466. if $game_temp.forcing_battler == nil
  467. # If battle event has finished running
  468. unless $game_system.battle_interpreter.running?
  469. # Rerun battle event set up if battle continues
  470. setup_battle_event unless judge
  471. end
  472. end
  473. end
  474. end
  475. #--------------------------------------------------------------------------
  476. # * Update the global variables
  477. #--------------------------------------------------------------------------
  478. def update_globals
  479. # Update system (timer) and screen
  480. $game_system.update
  481. $game_screen.update
  482. # If timer has reached 0
  483. if $game_system.timer_working && $game_system.timer == 0
  484. # Abort battle
  485. $game_temp.battle_abort = true
  486. end
  487. end
  488. #--------------------------------------------------------------------------
  489. # * Update Harmonics
  490. #--------------------------------------------------------------------------
  491. def update_harmonics
  492. return if @phase == 4 && @phase4_step.between?(2, 4)
  493. # If there is a change, perform it.
  494. if @vanguards_harmonics > 0
  495. if @reyvateil != nil
  496. $game_party.harmonics = [($game_party.harmonics + 2),
  497. ($game_temp.max_harmonics - @reyvateil.harmonics)].min
  498. else
  499. $game_party.harmonics = [($game_party.harmonics + 2),
  500. ($game_temp.max_harmonics)].min
  501. end
  502. @vanguards_harmonics -= 2
  503. elsif @vanguards_harmonics < 0
  504. $game_party.harmonics = [($game_party.harmonics - 5), 0].max
  505. @vanguards_harmonics += 5
  506. end
  507. if @reyvateil_harmonics < 0
  508. @reyvateil.harmonics = [(@reyvateil.harmonics - 5), 0].max
  509. @reyvateil_harmonics += 5
  510. end
  511. end
  512. #--------------------------------------------------------------------------
  513. # * Simply updates all permanent sprites and windows
  514. #--------------------------------------------------------------------------
  515. def update_sprites_and_windows
  516. @message_window.update
  517. @spriteset.update
  518. @status_windows.each {|spr| spr.update}
  519. @action_system.update
  520. @help_window.update if @help_window != nil
  521. @burst_gauge.update if @burst_gauge != nil
  522. @harmonics_gauge.update
  523. end
  524. #--------------------------------------------------------------------------
  525. # * Update the transition effects
  526. #--------------------------------------------------------------------------
  527. def update_transition
  528. # If transition is processing
  529. if $game_temp.transition_processing
  530. # Clear transition processing flag
  531. $game_temp.transition_processing = false
  532. # Execute transition
  533. execute_transition
  534. end
  535. end
  536. #--------------------------------------------------------------------------
  537. # * Update the activation of Reyvateil menu
  538. #--------------------------------------------------------------------------
  539. def update_reyvateil_command
  540. # Quit if there isn't any reyvateil or already active
  541. return if !KreadCFG.reyvateil_party? || !@reyvateil_command.visible || @reyvateil.dead?
  542. # Activates by pressing B
  543. if Input.trigger?(Input::B)
  544. # Effect depends of the current situation
  545. case @reyvateil_menu
  546. when 'immediate'
  547. # Stores previous phase
  548. @previous_phase = @phase
  549. # Switch to phase 6
  550. start_phase6
  551. when 'delayed'
  552. @delayed_command = true
  553. @reyvateil_command.visible = false
  554. when 'desactivated'
  555. $game_system.se_play($data_system.buzzer_se)
  556. end
  557. end
  558. end
  559. #--------------------------------------------------------------------------
  560. # * Update the various battle phases
  561. #--------------------------------------------------------------------------
  562. def update_phases
  563. # Branch according to phase
  564. case @phase
  565. when 1 # pre-battle phase
  566. update_phase1
  567. when 2 # party command phase
  568. update_phase2
  569. when 3 # actor command phase
  570. update_phase3
  571. when 4 # main phase
  572. update_phase4
  573. when 5 # after battle phase
  574. update_phase5
  575. when 6 # Reyvateil command phase
  576. update_phase6
  577. end
  578. end
  579. #--------------------------------------------------------------------------
  580. # * Start Pre-Battle Phase
  581. #--------------------------------------------------------------------------
  582. def start_phase1
  583. # Shift to phase 1
  584. @phase = 1
  585. # Clear active battler
  586. @active_battler = nil
  587. # Reyvateil command is immediate
  588. @reyvateil_menu = 'immediate'
  589. # Set up battle event
  590. setup_battle_event
  591. end
  592. #--------------------------------------------------------------------------
  593. # * Frame Update (pre-battle phase)
  594. #--------------------------------------------------------------------------
  595. def update_phase1
  596. # Determine win/loss situation
  597. if judge
  598. # If won or lost: end method
  599. return
  600. end
  601. # Switch to phase 4 in case of forcing battler
  602. if $game_temp.forcing_battler != nil
  603. @active_battler = $game_temp.forcing_battler
  604. @reyvateil_menu = 'desactivated'
  605. start_phase4
  606. return
  607. end
  608. # Update Burst value SP consumption and Reyvateil Harmonics
  609. update_phase1_reyvateil_system
  610. # Update Action Meters
  611. update_phase1_action_meters
  612. # Try to select an active battler
  613. update_phase1_battler_selection
  614. # Switch to next phase if there is an active battler
  615. if @active_battler != nil
  616. # If it's an enemy
  617. if @active_battler.is_a?(Game_Enemy)
  618. # Decrease Ambiance Field of all enemies, and set this one to 0.
  619. $game_troop.enemies.each {|enemy|
  620. enemy.ambiance_field = [(enemy.ambiance_field - 1), 0].max
  621. }
  622. @active_battler.ambiance_field = 0
  623. # Clear skill
  624. @skill = nil
  625. # Program action
  626. @active_battler.make_action
  627. # Switch to phase 4
  628. start_phase4
  629. # Else, it's a standard actor
  630. else
  631. if !@active_battler.inputable?
  632. @active_battler.action_meter = @active_battler.agi
  633. start_phase4
  634. return
  635. end
  636. # Switch to phase 3
  637. start_phase3
  638. end
  639. end
  640. end
  641. #--------------------------------------------------------------------------
  642. # * Frame Update (phase 1: Burst value, SP and R. Harmo update)
  643. #--------------------------------------------------------------------------
  644. def update_phase1_reyvateil_system
  645. # Quit if there's no Reyvateil in party.
  646. return unless KreadCFG.reyvateil_party?
  647. # Update Reyvateil death
  648. if @reyvateil.dead?
  649. @reyvateil.harmonics = 0
  650. @reyvateil.burst_value = 0
  651. @reyvateil.song_chant = false
  652. @reyvateil.song_blue = false
  653. @reyvateil.current_action.clear
  654. if @burst_gauge != nil
  655. @burst_gauge.dispose
  656. @burst_gauge = nil
  657. end
  658. return
  659. end
  660. # Update Harmonics
  661. @reyvateil.harmonics = [(@reyvateil.harmonics + 1),
  662. ($game_temp.max_harmonics - $game_party.harmonics)].min
  663. # Restores SP if not chanting
  664. @reyvateil.sp += (10 * (1 + $game_party.global_harmonics / 1000.00)).round
  665. @status_windows[@reyvateil.index].refresh_sp_only
  666. return
  667. end
  668. # Updates SP consumption
  669. @reyvateil.sp -= ($data_skills[@reyvateil.current_action.skill_id].sp_cost *
  670. (1 - $game_party.global_harmonics / 900.00)).round
  671. # Cancels the song if ran out of SP
  672. if @reyvateil.sp <= 0
  673. @reyvateil.sp = 0
  674. # Play animation
  675. @reyvateil.animation_id = KreadCFG::SongCancelAnimID
  676. # Destroy Burst
  677. @burst_gauge.dispose
  678. @burst_gauge = nil
  679. # Clear action
  680. @reyvateil.song_chant = false
  681. @reyvateil.song_blue = false
  682. @reyvateil.loop_animation_id = 0
  683. @reyvateil.current_action.clear
  684. end
  685. @status_windows[@reyvateil.index].refresh_sp_only
  686. # Updates value
  687. @reyvateil.burst_value += (5 + $game_party.global_harmonics / 100)
  688. # If the burst match the Evolve stage, then the spell evolve
  689. current_song = @reyvateil.current_action.skill_id
  690. if KreadCFG::SongMagicEvolve[current_song] != nil
  691. if KreadCFG::SongMagicMaxBurst[current_song] <= @reyvateil.burst_value
  692. @reyvateil.current_action.skill_id = KreadCFG::SongMagicEvolve[current_song]
  693. @reyvateil.loop_animation_id = KreadCFG::SongMagicChargeAnim[@reyvateil.current_action.skill_id]
  694. @reyvateil.animation_id = KreadCFG::SongActivateAnimID
  695. end
  696. end
  697. end
  698. #--------------------------------------------------------------------------
  699. # * Frame Update (phase 1: Action Meters update)
  700. #--------------------------------------------------------------------------
  701. def update_phase1_action_meters
  702. # Adds the BattleSpeed value to AMs. Corrects if under 2 or over 100.
  703. inc = [[KreadCFG::BattleSpeed, 2].max, 100].min
  704. ($game_party.actors + $game_troop.enemies).each {|battler|
  705. next unless battler.exist?
  706. battler.action_meter += inc
  707. }
  708. end
  709. #--------------------------------------------------------------------------
  710. # * Frame Update (phase 1: active battler selection)
  711. #--------------------------------------------------------------------------
  712. def update_phase1_battler_selection
  713. # Iterate both parties searching for a battler with full AM
  714. ($game_party.actors + $game_troop.enemies).each {|battler|
  715. next unless battler.exist?
  716. if battler.action_meter >= 1000 && battler == @action_system.queue.first.battler
  717. @active_battler = battler
  718. return
  719. end
  720. }
  721. end
  722. #--------------------------------------------------------------------------
  723. # * Frame Update (party command phase: escape)
  724. #--------------------------------------------------------------------------
  725. def update_phase2_escape
  726. # Calculate enemy agility average
  727. enemies_agi = 0
  728. enemies_number = 0
  729. for enemy in $game_troop.enemies
  730. if enemy.exist?
  731. enemies_agi += enemy.agi
  732. enemies_number += 1
  733. end
  734. end
  735. if enemies_number > 0
  736. enemies_agi /= enemies_number
  737. end
  738. # Calculate actor agility average
  739. actors_agi = 0
  740. actors_number = 0
  741. for actor in $game_party.actors
  742. if actor.exist?
  743. actors_agi += actor.agi
  744. actors_number += 1
  745. end
  746. end
  747. if actors_number > 0
  748. actors_agi /= actors_number
  749. end
  750. # Determine if escape is successful
  751. success = rand(100) < 50 * actors_agi / enemies_agi
  752. # If escape is successful
  753. if success
  754. # Play escape SE
  755. $game_system.se_play($data_system.escape_se)
  756. # Return to BGM before battle started
  757. $game_system.bgm_play($game_temp.map_bgm)
  758. # Battle ends
  759. battle_end(1)
  760. # If escape is failure
  761. else
  762. # Update Action Meters
  763. @active_battler.action_meter = @active_battler.agi
  764. @active_battler.blink = false
  765. @action_system.update_order
  766. @action_system.update_coordinates
  767. @active_battler = nil
  768. @wait_count = 12
  769. # Switch to phase 4
  770. start_phase4
  771. end
  772. end
  773. #--------------------------------------------------------------------------
  774. # * Start Actor Command Phase
  775. #--------------------------------------------------------------------------
  776. def start_phase3
  777. # Shift to phase 3
  778. @phase = 3
  779. # Blink
  780. @active_battler.blink = true
  781. # Shifts to right action order
  782. @action_system.right_shift
  783. # Create the command ring
  784. @command_ring = Command_Ring.new(@active_battler)
  785. # Reyvateil command is desactivated
  786. @reyvateil_menu = 'desactivated'
  787. end
  788. #--------------------------------------------------------------------------
  789. # * Frame Update (actor command phase)
  790. #--------------------------------------------------------------------------
  791. def update_phase3
  792. # Update enemy arrow
  793. if @enemy_arrow != nil
  794. update_phase3_enemy_select
  795. # Update actor arrow
  796. elsif @actor_arrow != nil
  797. update_phase3_actor_select
  798. # If skill window is enabled
  799. elsif @skill_window != nil
  800. update_phase3_skill_select
  801. # If item window is enabled
  802. elsif @item_window != nil
  803. update_phase3_item_select
  804. # Update command ring if active
  805. elsif @command_ring.active
  806. update_phase3_command_ring
  807. end
  808. end
  809. #--------------------------------------------------------------------------
  810. # * Frame Update (phase 3: actor command selection)
  811. #--------------------------------------------------------------------------
  812. def update_phase3_command_ring
  813. # Update object
  814. @command_ring.update
  815. # C: Validate command
  816. if Input.trigger?(Input::C)
  817. # Play SE
  818. $game_system.se_play($data_system.decision_se)
  819. # Hide command ring
  820. @command_ring.toggle_visibility
  821. @command_ring.toggle_activity
  822. # Branch by command
  823. case @command_ring.command
  824. when 'Attack'
  825. # Play decision SE
  826. $game_system.se_play($data_system.decision_se)
  827. # Set action
  828. @active_battler.current_action.kind = 0
  829. @active_battler.current_action.basic = 0
  830. # Store current action meter
  831. @current_am = @active_battler.action_meter
  832. # And set the next action meter value
  833. @active_battler.action_meter = @active_battler.agi
  834. # Enemy selection
  835. start_enemy_select
  836. when 'Skill'
  837. # Play decision SE
  838. $game_system.se_play($data_system.decision_se)
  839. # Skill selection
  840. start_skill_select
  841. when 'Item'
  842. # Play decision SE
  843. $game_system.se_play($data_system.decision_se)
  844. # Item selection
  845. start_item_select
  846. when 'Guard'
  847. # Play decision SE
  848. $game_system.se_play($data_system.decision_se)
  849. # Set action
  850. @active_battler.current_action.kind = 0
  851. @active_battler.current_action.basic = 1
  852. # And set the next action meter value
  853. @active_battler.action_meter = @active_battler.agi * 2
  854. # Switch to phase 4
  855. start_phase4
  856. when 'Flee'
  857. update_phase2_escape
  858. end
  859. end
  860. end
  861. #--------------------------------------------------------------------------
  862. # * Start Skill Selection
  863. #--------------------------------------------------------------------------
  864. def start_skill_select
  865. # Make skill help window
  866. @skill_help = Window_SkillHelp.new
  867. # Make skill window
  868. @skill_window = Window_BattleSkill.new(@active_battler)
  869. # Associate the two
  870. @skill_window.help_window = @skill_help
  871. # Stores last skill and current AM value
  872. @last_skill = nil
  873. @current_am = @active_battler.action_meter
  874. end
  875. #--------------------------------------------------------------------------
  876. # * Frame Update (actor command phase : skill selection)
  877. #--------------------------------------------------------------------------
  878. def update_phase3_skill_select
  879. # Update skill window
  880. @skill_window.update
  881. # Virtualize next action turn
  882. @skill = @skill_window.skill
  883. if @last_skill != @skill
  884. @last_skill = @skill
  885. @active_battler.action_meter = @active_battler.agi * KreadCFG.skill_speed(@skill.id)
  886. @action_system.update_order
  887. @action_system.update_coordinates
  888. end
  889. # If B button was pressed
  890. if Input.trigger?(Input::B)
  891. # Play cancel SE
  892. $game_system.se_play($data_system.cancel_se)
  893. # End skill selection
  894. end_skill_select
  895. # Restores AM
  896. @active_battler.action_meter = @current_am
  897. # End virtualization
  898. @action_system.update_order
  899. @action_system.update_coordinates(true)
  900. return
  901. end
  902. # If C button was pressed
  903. if Input.trigger?(Input::C)
  904. # Get currently selected data on the skill window
  905. @skill = @skill_window.skill
  906. # If it can't be used
  907. if @skill == nil || !@active_battler.skill_can_use?(@skill.id)
  908. # Play buzzer SE
  909. $game_system.se_play($data_system.buzzer_se)
  910. return
  911. end
  912. # Play decision SE
  913. $game_system.se_play($data_system.decision_se)
  914. # Set action
  915. @active_battler.current_action.kind = 1
  916. @active_battler.current_action.skill_id = @skill.id
  917. # Make skill window and skill help window invisible
  918. @skill_window.visible = @skill_help.visible = false
  919. # If effect scope is single enemy
  920. if @skill.scope == 1
  921. # Start enemy selection
  922. start_enemy_select
  923. # If effect scope is single ally
  924. elsif @skill.scope == 3 or @skill.scope == 5
  925. # Start actor selection
  926. start_actor_select
  927. # If effect scope is not single
  928. else
  929. # End skill selection
  930. end_skill_select
  931. # Start phase 4
  932. start_phase4
  933. end
  934. return
  935. end
  936. end
  937. #--------------------------------------------------------------------------
  938. # * End Skill Selection
  939. #--------------------------------------------------------------------------
  940. def end_skill_select
  941. # Dispose of skill window
  942. @skill_window.dispose
  943. @skill_window = nil
  944. # Dispose of help windiw
  945. @skill_help.dispose
  946. @skill_help = nil
  947. # Retrieve command ring
  948. @command_ring.toggle_visibility
  949. @command_ring.toggle_activity
  950. end
  951. #--------------------------------------------------------------------------
  952. # * Start Item Selection
  953. #--------------------------------------------------------------------------
  954. def start_item_select
  955. # Make item help window
  956. @item_help = Window_SkillHelp.new
  957. # Make item window
  958. @item_window = Window_BattleItem.new
  959. # Associate the two
  960. @item_window.help_window = @item_help
  961. # Stores current AM value
  962. @current_am = @active_battler.action_meter
  963. # Update AM
  964. @active_battler.action_meter = @active_battler.agi * KreadCFG::ItemSpeed
  965. end
  966. #--------------------------------------------------------------------------
  967. # * Frame Update (actor command phase : item selection)
  968. #--------------------------------------------------------------------------
  969. def update_phase3_item_select
  970. # Update item window
  971. @item_window.update
  972. # If B button was pressed
  973. if Input.trigger?(Input::B)
  974. # Play cancel SE
  975. $game_system.se_play($data_system.cancel_se)
  976. # End item selection
  977. end_item_select
  978. # Restores AM
  979. @active_battler.action_meter = @current_am
  980. # End virtualization
  981. @action_system.update_order
  982. @action_system.update_coordinates(true)
  983. return
  984. end
  985. # If C button was pressed
  986. if Input.trigger?(Input::C)
  987. # Get currently selected data on the item window
  988. @item = @item_window.item
  989. # If it can't be used
  990. if @item == nil
  991. # Play buzzer SE
  992. $game_system.se_play($data_system.buzzer_se)
  993. return
  994. end
  995. # Play decision SE
  996. $game_system.se_play($data_system.decision_se)
  997. # Set action
  998. @active_battler.current_action.kind = 2
  999. @active_battler.current_action.item_id = @item.id
  1000. # Make item window and item help window invisible
  1001. @item_window.visible = @item_help.visible = false
  1002. # If effect scope is single enemy
  1003. if @item.scope == 1
  1004. # Start enemy selection
  1005. start_enemy_select
  1006. # If effect scope is single ally
  1007. elsif @item.scope == 3 or @item.scope == 5
  1008. # Start actor selection
  1009. start_actor_select
  1010. # If effect scope is not single
  1011. else
  1012. # End item selection
  1013. end_item_select
  1014. # Start phase 4
  1015. start_phase4
  1016. end
  1017. return
  1018. end
  1019. end
  1020. #--------------------------------------------------------------------------
  1021. # * End Item Selection
  1022. #--------------------------------------------------------------------------
  1023. def end_item_select
  1024. # Dispose of item window
  1025. @item_window.dispose
  1026. @item_window = nil
  1027. # Dispose of help window
  1028. @item_help.dispose
  1029. @item_help = nil
  1030. # Retrieve command ring
  1031. @command_ring.toggle_visibility
  1032. @command_ring.toggle_activity
  1033. end
  1034. #--------------------------------------------------------------------------
  1035. # * Start Enemy Selection
  1036. #--------------------------------------------------------------------------
  1037. def start_enemy_select
  1038. # Make Ambiance Field the help window
  1039. @help_window = Ambiance_Field.new
  1040. # Make enemy arrow
  1041. @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
  1042. # Associate help window
  1043. @enemy_arrow.help_window = @help_window
  1044. @enemy_arrow.update
  1045. # Virtualize next action turn
  1046. @action_system.update_order
  1047. @action_system.update_coordinates
  1048. end
  1049. #--------------------------------------------------------------------------
  1050. # * Frame Update (actor command phase : enemy selection)
  1051. #--------------------------------------------------------------------------
  1052. def update_phase3_enemy_select
  1053. # Update enemy arrow
  1054. @enemy_arrow.update
  1055. # If B button was pressed
  1056. if Input.trigger?(Input::B)
  1057. # Play cancel SE
  1058. $game_system.se_play($data_system.cancel_se)
  1059. # Restore old Action Meter
  1060. @active_battler.action_meter = @current_am if @command_ring.command == 'Attack'
  1061. # End enemy selection
  1062. end_enemy_select
  1063. # End virtualization
  1064. if @command_ring.command == 'Attack'
  1065. @action_system.update_order
  1066. @action_system.update_coordinates(true)
  1067. end
  1068. # Retrieve skill window
  1069. if @skill_window != nil
  1070. @skill_window.visible = @skill_help.visible = true
  1071. # Retrieve item window
  1072. elsif @item_window != nil
  1073. @item_window.visible = @item_help.visible = true
  1074. end
  1075. return
  1076. end
  1077. # If C button was pressed
  1078. if Input.trigger?(Input::C)
  1079. # Play decision SE
  1080. $game_system.se_play($data_system.decision_se)
  1081. # Set action
  1082. @active_battler.current_action.target_index = @enemy_arrow.index
  1083. # End enemy selection
  1084. end_enemy_select
  1085. # If skill window is showing
  1086. if @skill_window != nil
  1087. # End skill selection
  1088. end_skill_select
  1089. end
  1090. # If item window is showing
  1091. if @item_window != nil
  1092. # End item selection
  1093. end_item_select
  1094. end
  1095. # Switch to action phase
  1096. start_phase4
  1097. end
  1098. end
  1099. #--------------------------------------------------------------------------
  1100. # * End Enemy Selection
  1101. #--------------------------------------------------------------------------
  1102. def end_enemy_select
  1103. # Dispose of enemy arrow
  1104. @enemy_arrow.dispose
  1105. @enemy_arrow = nil
  1106. # Dispose of Ambiance Field
  1107. @help_window.dispose
  1108. @help_window = nil
  1109. # If command is [fight]
  1110. if @command_ring.command == 'Attack'
  1111. # Enable command ring
  1112. @command_ring.toggle_visibility
  1113. @command_ring.toggle_activity
  1114. end
  1115. end
  1116. #--------------------------------------------------------------------------
  1117. # * Start Actor Selection
  1118. #--------------------------------------------------------------------------
  1119. def start_actor_select
  1120. # Make Ambiance Field the help window
  1121. @help_window = Ambiance_Field.new
  1122. # Make actor arrow
  1123. @actor_arrow = Arrow_Actor.new(@spriteset.viewport1)
  1124. # Associate help window
  1125. @actor_arrow.help_window = @help_window
  1126. @actor_arrow.update
  1127. # Virtualize next action turn
  1128. @action_system.update_order
  1129. @action_system.update_coordinates
  1130. end
  1131. #--------------------------------------------------------------------------
  1132. # * Frame Update (actor command phase : actor selection)
  1133. #--------------------------------------------------------------------------
  1134. def update_phase3_actor_select
  1135. # Update actor arrow
  1136. @actor_arrow.update
  1137. # If B button was pressed
  1138. if Input.trigger?(Input::B)
  1139. # Play cancel SE
  1140. $game_system.se_play($data_system.cancel_se)
  1141. # Restore old Action Meter
  1142. @active_battler.action_meter = @current_am
  1143. # End actor selection
  1144. end_actor_select
  1145. # End virtualization
  1146. @action_system.update_order
  1147. @action_system.update_coordinates(true)
  1148. # Retrieve skill window
  1149. if @skill_window != nil
  1150. @skill_window.visible = @skill_help.visible = true
  1151. # Retrieve item window
  1152. elsif @item_window != nil
  1153. @item_window.visible = @item_help.visible = true
  1154. end
  1155. return
  1156. end
  1157. # If C button was pressed
  1158. if Input.trigger?(Input::C)
  1159. # Play decision SE
  1160. $game_system.se_play($data_system.decision_se)
  1161. # Set action
  1162. @active_battler.current_action.target_index = @actor_arrow.index
  1163. # End actor selection
  1164. end_actor_select
  1165. # If skill window is showing
  1166. if @skill_window != nil
  1167. # End skill selection
  1168. end_skill_select
  1169. end
  1170. # If item window is showing
  1171. if @item_window != nil
  1172. # End item selection
  1173. end_item_select
  1174. end
  1175. # Switch to action phase
  1176. start_phase4
  1177. end
  1178. end
  1179. #--------------------------------------------------------------------------
  1180. # * End Actor Selection
  1181. #--------------------------------------------------------------------------
  1182. def end_actor_select
  1183. # Dispose of actor arrow
  1184. @actor_arrow.dispose
  1185. @actor_arrow = nil
  1186. # Dispose of Ambiance Field
  1187. @help_window.dispose
  1188. @help_window = nil
  1189. end
  1190. #--------------------------------------------------------------------------
  1191. # * Start Main Phase
  1192. #--------------------------------------------------------------------------
  1193. def start_phase4
  1194. # Shift to phase 4
  1195. @phase = 4
  1196. # Switch Reyvateil ring mode
  1197. @reyvateil_menu = 'delayed' unless $game_temp.forcing_battler != nil
  1198. # Destroy Command Ring
  1199. if @command_ring != nil
  1200. @command_ring.dispose
  1201. @command_ring = nil
  1202. end
  1203. # Clear skill and item
  1204. @skill = @item = nil
  1205. # Turn count
  1206. $game_temp.battle_turn += 1
  1207. # Switch to phase 1 if @active_battler is nil
  1208. if @active_battler == nil
  1209. start_phase1
  1210. return
  1211. end
  1212. # Right shift when enemy attack
  1213. @action_system.right_shift if @active_battler.is_a?(Game_Enemy)
  1214. # Blink
  1215. @active_battler.blink = false
  1216. # Create help window
  1217. @help_window = Action_Help.new(@spriteset.viewport5, @active_battler.current_action)
  1218. # Set main phase flag
  1219. $game_temp.battle_main_phase = true
  1220. # Shift to step 1
  1221. @phase4_step = 1
  1222. end
  1223. #--------------------------------------------------------------------------
  1224. # * Frame Update (main phase)
  1225. #--------------------------------------------------------------------------
  1226. def update_phase4
  1227. case @phase4_step
  1228. when 1
  1229. update_phase4_step1
  1230. when 2
  1231. update_phase4_step2
  1232. when 3
  1233. update_phase4_step3
  1234. when 4
  1235. update_phase4_step4
  1236. when 5
  1237. update_phase4_step5
  1238. when 6
  1239. update_phase4_step6
  1240. end
  1241. end
  1242. #--------------------------------------------------------------------------
  1243. # * Frame Update (main phase step 1 : action preparation)
  1244. #--------------------------------------------------------------------------
  1245. def update_phase4_step1
  1246. # Determine win/loss
  1247. if judge
  1248. # If won, or if lost : end method
  1249. return
  1250. end
  1251. # Initialize animation ID and common event ID
  1252. @animation1_id = 0
  1253. @animation2_id = 0
  1254. @common_event_id = 0
  1255. # Slip damage
  1256. if @active_battler.hp > 0 and @active_battler.slip_damage?
  1257. @active_battler.slip_damage_effect
  1258. @active_battler.damage_pop = true
  1259. end
  1260. # Natural removal of states
  1261. @active_battler.remove_states_auto
  1262. # Refresh status window (active battler only)
  1263. @status_windows[@active_battler.index].refresh if @active_battler.is_a?(Game_Actor)
  1264. # Shift to step 2
  1265. @phase4_step = 2
  1266. end
  1267. #--------------------------------------------------------------------------
  1268. # * Frame Update (main phase step 2 : start action)
  1269. #--------------------------------------------------------------------------
  1270. def update_phase4_step2
  1271. # If not a forcing action
  1272. unless @active_battler.current_action.forcing
  1273. # If restriction is [normal attack enemy] or [normal attack ally]
  1274. if @active_battler.restriction == 2 or @active_battler.restriction == 3
  1275. # Set attack as an action
  1276. @active_battler.current_action.kind = 0
  1277. @active_battler.current_action.basic = 0
  1278. end
  1279. # If restriction is [cannot perform action]
  1280. if @active_battler.restriction == 4
  1281. # Clear battler being forced into action
  1282. $game_temp.forcing_battler = nil
  1283. # Shift to step 1
  1284. @phase4_step = 1
  1285. return
  1286. end
  1287. end
  1288. # Clear target battlers
  1289. @target_battlers = []
  1290. # Branch according to each action
  1291. case @active_battler.current_action.kind
  1292. when 0 # basic
  1293. make_basic_action_result
  1294. when 1 # skill
  1295. make_skill_action_result
  1296. when 2 # item
  1297. make_item_action_result
  1298. end
  1299. # Shift to step 3
  1300. @phase4_step = 3
  1301. end
  1302. #--------------------------------------------------------------------------
  1303. # * Make Basic Action Results
  1304. #--------------------------------------------------------------------------
  1305. def make_basic_action_result
  1306. # If attack
  1307. if @active_battler.current_action.basic == 0
  1308. # Set animation ID
  1309. @animation1_id = @active_battler.animation1_id
  1310. @animation2_id = @active_battler.animation2_id
  1311. # If action battler is enemy
  1312. if @active_battler.is_a?(Game_Enemy)
  1313. if @active_battler.restriction == 3
  1314. target = $game_troop.random_target_enemy
  1315. elsif @active_battler.restriction == 2
  1316. target = $game_party.random_target_actor
  1317. else
  1318. index = @active_battler.current_action.target_index
  1319. target = $game_party.smooth_target_actor(index)
  1320. end
  1321. end
  1322. # If action battler is actor
  1323. if @active_battler.is_a?(Game_Actor)
  1324. if @active_battler.restriction == 3
  1325. target = $game_party.random_target_actor
  1326. elsif @active_battler.restriction == 2
  1327. target = $game_troop.random_target_enemy
  1328. else
  1329. index = @active_battler.current_action.target_index
  1330. target = $game_troop.smooth_target_enemy(index)
  1331. end
  1332. end
  1333. # Set array of targeted battlers
  1334. @target_battlers = [target]
  1335. # Apply normal attack results
  1336. @target_battlers.each {|target| target.attack_effect(@active_battler)}
  1337. return
  1338. end
  1339. # If escape
  1340. if @active_battler.is_a?(Game_Enemy) and
  1341. @active_battler.current_action.basic == 2
  1342. # Escape
  1343. @active_battler.escape
  1344. return
  1345. end
  1346. # If doing nothing
  1347. if @active_battler.current_action.basic == 3
  1348. # Clear battler being forced into action
  1349. $game_temp.forcing_battler = nil
  1350. # Shift to step 1
  1351. @phase4_step = 5
  1352. return
  1353. end
  1354. end
  1355. #--------------------------------------------------------------------------
  1356. # * Make Skill Action Results
  1357. #--------------------------------------------------------------------------
  1358. def make_skill_action_result
  1359. # Get skill
  1360. @skill = $data_skills[@active_battler.current_action.skill_id]
  1361. # Set animation ID
  1362. @animation1_id = @skill.animation1_id
  1363. @animation2_id = @skill.animation2_id
  1364. # Removes HP, SP or Harmonics
  1365. if KreadCFG::HarmoOverdriveSkills.include?(@skill.id) && @active_battler.is_a?(Game_Actor)
  1366. @reyvateil.harmonics = 0
  1367. $game_party.harmonics = 0
  1368. end
  1369. if $game_system.vanguards_sp || @active_battler.is_a?(Game_Enemy)
  1370. @active_battler.sp -= @skill.sp_cost
  1371. else
  1372. @active_battler.hp =
  1373. [(@active_battler.hp - (@skill.sp_cost * @active_battler.maxhp) / 100), 0].max
  1374. end
  1375. # Set command event ID
  1376. @common_event_id = @skill.common_event_id
  1377. # Set target battlers
  1378. set_target_battlers(@skill.scope)
  1379. # Check skill hit number
  1380. hit_nb = KreadCFG.skill_hits(skill.id)
  1381. # If number is 1, apply the effect once
  1382. if hit_nb == 1
  1383. @target_battlers.each {|target| target.skill_effect(@active_battler, @skill)}
  1384. # Else, apply the effect for each hit
  1385. else
  1386. for i in (1..hit_nb)
  1387. for target in @target_battlers
  1388. target.skill_effect(@active_battler, @skill, (i - 1))
  1389. end
  1390. end
  1391. end
  1392. end
  1393. #--------------------------------------------------------------------------
  1394. # * Make Item Action Results
  1395. #--------------------------------------------------------------------------
  1396. def make_item_action_result
  1397. # Get item
  1398. @item = $data_items[@active_battler.current_action.item_id]
  1399. # If unable to use due to items running out
  1400. unless $game_party.item_can_use?(@item.id)
  1401. # Shift to step 1
  1402. @phase4_step = 1
  1403. return
  1404. end
  1405. # If consumable
  1406. if @item.consumable
  1407. # Decrease used item by 1
  1408. $game_party.lose_item(@item.id, 1)
  1409. end
  1410. # Set animation ID
  1411. @animation1_id = @item.animation1_id
  1412. @animation2_id = @item.animation2_id
  1413. # Set common event ID
  1414. @common_event_id = @item.common_event_id
  1415. # Decide on target
  1416. index = @active_battler.current_action.target_index
  1417. target = $game_party.smooth_target_actor(index)
  1418. # Set targeted battlers
  1419. set_target_battlers(@item.scope)
  1420. # Apply item effect
  1421. for target in @target_battlers
  1422. target.item_effect(@item)
  1423. end
  1424. end
  1425. #--------------------------------------------------------------------------
  1426. # * Make Song Magic Action Results
  1427. #--------------------------------------------------------------------------
  1428. def make_song_action_result
  1429. # Get skill
  1430. @skill = $data_skills[@reyvateil.current_action.skill_id]
  1431. # Set animation ID
  1432. @animation1_id = @skill.animation1_id
  1433. @animation2_id = @skill.animation2_id
  1434. # Refresh status window
  1435. @status_windows[@reyvateil.index].refresh
  1436. # Set command event ID
  1437. @common_event_id = @skill.common_event_id
  1438. # Set target battlers
  1439. set_target_battlers(@skill.scope)
  1440. # Check skill hit number
  1441. hit_nb = KreadCFG.skill_hits(skill.id)
  1442. # If number is 1, apply the effect once
  1443. if hit_nb == 1
  1444. @target_battlers.each {|target|
  1445. target.song_effect(@reyvateil, @skill)
  1446. target.damage_pop = true if @reyvateil.song_blue
  1447. }
  1448. # Else, apply the effect for each hit
  1449. else
  1450. for i in (1..hit_nb)
  1451. for target in @target_battlers
  1452. target.song_effect(@reyvateil, @skill, (i - 1))
  1453. target.damage_pop = true if @reyvateil.song_blue
  1454. end
  1455. end
  1456. end
  1457. end
  1458. #--------------------------------------------------------------------------
  1459. # * Frame Update (main phase step 3 : animation for action performer)
  1460. #--------------------------------------------------------------------------
  1461. def update_phase4_step3
  1462. # Animation for action performer (if ID is 0, then white flash)
  1463. if @animation1_id == 0
  1464. @active_battler.white_flash = true
  1465. else
  1466. @active_battler.animation_id = @animation1_id
  1467. @active_battler.animation_hit = true
  1468. end
  1469. # Refresh status window (active battler only)
  1470. @status_windows[@active_battler.index].refresh if @active_battler.is_a?(Game_Actor)
  1471. # Shift to step 4
  1472. @phase4_step = 4
  1473. end
  1474. #--------------------------------------------------------------------------
  1475. # * Frame Update (main phase step 4 : animation for target)
  1476. #--------------------------------------------------------------------------
  1477. def update_phase4_step4
  1478. # Animation for target
  1479. @target_battlers.each {|target|
  1480. target.animation_id = @animation2_id
  1481. target.animation_hit = (target.damage[0] != 'Miss')
  1482. }
  1483. # Shift to step 5
  1484. @phase4_step = 5
  1485. end
  1486. #--------------------------------------------------------------------------
  1487. # * Frame Update (main phase step 5 : damage display)
  1488. #--------------------------------------------------------------------------
  1489. def update_phase4_step5
  1490. # Destroy help window
  1491. @help_window.dispose
  1492. @help_window = nil
  1493. # Display damage
  1494. @target_battlers.each {|target|
  1495. if target.damage.size > 0
  1496. target.damage_pop = true
  1497. end
  1498. }
  1499. # Refresh status windows
  1500. @status_windows.each {|win| win.refresh}
  1501. # Refreshes Action Meters
  1502. @action_system.update_order
  1503. @action_system.update_coordinates
  1504. if $game_temp.battle_turn % ($game_party.actors.size + $game_troop.enemies.size - 1) == 0
  1505. @blue_launch = true if @reyvateil != nil && @reyvateil.song_blue
  1506. end
  1507. # Wait 12 frames
  1508. @wait_count = 12
  1509. # Clear the forcing battler
  1510. $game_temp.forcing_battler = nil
  1511. # Shift to phase 1
  1512. start_phase1
  1513. # Switch to phase 6
  1514. if @delayed_command
  1515. start_phase6 unless fake_judge
  1516. @delayed_command = false
  1517. end
  1518. end
  1519. #--------------------------------------------------------------------------
  1520. # * Start After Battle Phase
  1521. #--------------------------------------------------------------------------
  1522. def start_phase5
  1523. # Shift to phase 5
  1524. @phase = 5
  1525. # Play battle end ME
  1526. $game_system.me_play($game_system.battle_end_me)
  1527. # Return to BGM before battle started
  1528. $game_system.bgm_play($game_temp.map_bgm)
  1529. # Initialize EXP, amount of gold, and treasure
  1530. exp = 0
  1531. gold = 0
  1532. treasures = []
  1533. # Loop
  1534. for enemy in $game_troop.enemies
  1535. # If enemy is not hidden
  1536. unless enemy.hidden
  1537. # Add EXP and amount of gold obtained
  1538. exp += enemy.exp
  1539. gold += enemy.gold
  1540. # Determine if treasure appears
  1541. if rand(100) < enemy.treasure_prob
  1542. if enemy.item_id > 0
  1543. treasures.push($data_items[enemy.item_id])
  1544. end
  1545. if enemy.weapon_id > 0
  1546. treasures.push($data_weapons[enemy.weapon_id])
  1547. end
  1548. if enemy.armor_id > 0
  1549. treasures.push($data_armors[enemy.armor_id])
  1550. end
  1551. end
  1552. end
  1553. end
  1554. # Treasure is limited to a maximum of 6 items
  1555. treasures = treasures[0..5]
  1556. # Obtaining EXP
  1557. @levelup_sprites = []
  1558. for i in 0...$game_party.actors.size
  1559. actor = $game_party.actors[i]
  1560. @levelup_sprites.push(Sprite_LevelUP.new(@spriteset.viewport5, actor))
  1561. if actor.cant_get_exp? == false
  1562. last_level = actor.level
  1563. actor.exp += exp
  1564. if actor.level > last_level
  1565. @levelup_sprites[actor.index].visible = true
  1566. end
  1567. end
  1568. end
  1569. # Obtaining gold
  1570. $game_party.gain_gold(gold)
  1571. # Obtaining treasure
  1572. for item in treasures
  1573. case item
  1574. when RPG::Item
  1575. $game_party.gain_item(item.id, 1)
  1576. when RPG::Weapon
  1577. $game_party.gain_weapon(item.id, 1)
  1578. when RPG::Armor
  1579. $game_party.gain_armor(item.id, 1)
  1580. end
  1581. end
  1582. # Make battle result window
  1583. @result_window = Window_BattleResult.new(exp, gold, treasures)
  1584. # Set wait count
  1585. @phase5_wait_count = 100
  1586. end
  1587. #--------------------------------------------------------------------------
  1588. # * Frame Update (after battle phase)
  1589. #--------------------------------------------------------------------------
  1590. def update_phase5
  1591. # If wait count is larger than 0
  1592. if @phase5_wait_count > 0
  1593. # Decrease wait count
  1594. @phase5_wait_count -= 1
  1595. # If wait count reaches 0
  1596. if @phase5_wait_count == 0
  1597. # Show result window
  1598. @result_window.visible = true
  1599. # Clear main phase flag
  1600. $game_temp.battle_main_phase = false
  1601. end
  1602. return
  1603. end
  1604. # If C button was pressed
  1605. if Input.trigger?(Input::C)
  1606. # Battle ends
  1607. battle_end(0)
  1608. end
  1609. end
  1610. #--------------------------------------------------------------------------
  1611. # * Start Reyvateil Command Phase
  1612. #--------------------------------------------------------------------------
  1613. def start_phase6
  1614. # Shift to phase 6
  1615. @phase = 6
  1616. # Blink
  1617. @reyvateil.blink = true
  1618. # Set action meter to max
  1619. @reyvateil.action_meter = 1000
  1620. # Create battler icon
  1621. @action_system.insert_reyvateil
  1622. # Make Reyvateil Command sprite invisible
  1623. @reyvateil_command.visible = false
  1624. # Prepare action
  1625. @song_activate = false
  1626. @wait_count = 10
  1627. end
  1628. #--------------------------------------------------------------------------
  1629. # * Frame Update (Reyvateil command phase)
  1630. #--------------------------------------------------------------------------
  1631. def update_phase6
  1632. # Create Reyvateil Command Ring
  1633. if @reyvateil_ring == nil
  1634. @reyvateil_ring = Command_Ring.new(@reyvateil)
  1635. end
  1636. # Update Song activation
  1637. if @song_activate
  1638. update_phase6_song_activation
  1639. # Update Song selection
  1640. elsif @song_window != nil
  1641. update_phase6_song_select
  1642. # Update Reyvateil ring
  1643. elsif @reyvateil_ring != nil
  1644. update_phase6_reyvateil_ring
  1645. end
  1646. end
  1647. #--------------------------------------------------------------------------
  1648. # * Frame Update (phase 6: Song Magic activation)
  1649. #--------------------------------------------------------------------------
  1650. def update_phase6_song_activation
  1651. # Supress animations
  1652. @reyvateil.loop_animation_id = 0
  1653. @reyvateil.song_chant = false
  1654. # Make skill result
  1655. @target_battlers = []
  1656. @active_battler = @reyvateil
  1657. @skill = $data_skills[@active_battler.current_action.skill_id]
  1658. set_target_battlers(@skill.scope)
  1659. make_song_action_result
  1660. @target_battlers.each {|target|
  1661. target.animation_id = @animation2_id
  1662. target.animation_hit = (target.damage[0] != 'Miss')
  1663. }
  1664. @reyvateil.animation_id = KreadCFG::SongActivateAnimID
  1665. @active_battler = nil
  1666. # Destroy Burst
  1667. @burst_gauge.dispose
  1668. @burst_gauge = nil
  1669. @reyvateil.burst_value = 0
  1670. end_reyvateil_command
  1671. end
  1672. #--------------------------------------------------------------------------
  1673. # * Frame Update (phase 6: Song Magic activation - Blue)
  1674. #--------------------------------------------------------------------------
  1675. def update_phase6_blue_magic
  1676. # Make skill result
  1677. prev_ab = @active_battler
  1678. @target_battlers = []
  1679. @active_battler = @reyvateil
  1680. @skill = $data_skills[@active_battler.current_action.skill_id]
  1681. set_target_battlers(@skill.scope)
  1682. make_song_action_result
  1683. @target_battlers.each {|target|
  1684. target.animation_id = @animation2_id
  1685. target.animation_hit = (target.damage[0] != 'Miss')
  1686. }
  1687. @status_windows.each {|win| win.refresh}
  1688. @active_battler = prev_ab
  1689. end
  1690. #--------------------------------------------------------------------------
  1691. # * Frame Update (phase 6: Song Magic selection)
  1692. #--------------------------------------------------------------------------
  1693. def update_phase6_song_select
  1694. # Update window
  1695. @song_window.update
  1696. # B: Return to Ring
  1697. if Input.trigger?(Input::B)
  1698. # Play SE
  1699. $game_system.se_play($data_system.cancel_se)
  1700. # Retrieve command ring
  1701. @reyvateil_ring.toggle_visibility
  1702. @reyvateil_ring.toggle_activity
  1703. # Destroy song window
  1704. @song_window.dispose
  1705. @song_window = nil
  1706. # Destroy help window
  1707. @help_window.dispose
  1708. @help_window = nil
  1709. return
  1710. end
  1711. # C: Validate Song Magic
  1712. if Input.trigger?(Input::C)
  1713. # Play SE
  1714. $game_system.se_play($data_system.decision_se)
  1715. # Set battler action
  1716. @reyvateil.song_chant = true
  1717. @reyvateil.song_blue = [3, 4, 5, 6].include?(@song_window.skill.scope)
  1718. @reyvateil.burst_value = 0
  1719. @reyvateil.current_action.kind = 1
  1720. @reyvateil.current_action.skill_id = @song_window.skill.id
  1721. # Set animation and loop animation
  1722. @reyvateil.animation_id = @song_window.skill.animation1_id
  1723. @reyvateil.loop_animation_id = KreadCFG::SongMagicChargeAnim[@song_window.skill.id]
  1724. @reyvateil.loop_animation_id = 0 if @reyvateil.loop_animation_id == nil
  1725. # Create Burst Gauge
  1726. if @burst_gauge == nil
  1727. @burst_gauge = Burst_Gauge.new(@spriteset.viewport5, @reyvateil)
  1728. end
  1729. @blue_launch = @reyvateil.song_blue
  1730. # Return to previous phase
  1731. end_reyvateil_command
  1732. return
  1733. end
  1734. end
  1735. #--------------------------------------------------------------------------
  1736. # * Frame Update (phase 6: Reyvateil Command selection)
  1737. #--------------------------------------------------------------------------
  1738. def update_phase6_reyvateil_ring
  1739. # Update ring
  1740. @reyvateil_ring.update
  1741. # B: Cancels command
  1742. if Input.trigger?(Input::B)
  1743. # Play SE
  1744. $game_system.se_play($data_system.cancel_se)
  1745. # Return to previous phase
  1746. end_reyvateil_command
  1747. end
  1748. # C: Validate command
  1749. if Input.trigger?(Input::C)
  1750. # Branch by command
  1751. case @reyvateil_ring.command
  1752. when KreadCFG::SongMagicName
  1753. # Play decision SE
  1754. $game_system.se_play($data_system.decision_se)
  1755. # Hide command ring
  1756. @reyvateil_ring.toggle_visibility
  1757. @reyvateil_ring.toggle_activity
  1758. # Create Song Magic window and help window
  1759. @help_window = Window_SongHelp.new
  1760. @song_window = Window_BattleSkill.new(@reyvateil)
  1761. @song_window.help_window = @help_window
  1762. when KreadCFG::SongActivate
  1763. # Do nothing if no song is chanted
  1764. unless (@reyvateil.song_chant && [email protected]_blue)
  1765. $game_system.se_play($data_system.buzzer_se)
  1766. return
  1767. end
  1768. # Activates the song
  1769. @song_activate = true
  1770. when KreadCFG::SongCancel
  1771. # Do nothing if no song is chanted
  1772. unless @reyvateil.song_chant
  1773. $game_system.se_play($data_system.buzzer_se)
  1774. return
  1775. end
  1776. # Play animation
  1777. @reyvateil.animation_id = KreadCFG::SongCancelAnimID
  1778. # Destroy Burst
  1779. @burst_gauge.dispose
  1780. @burst_gauge = nil
  1781. # Clear action
  1782. @reyvateil.song_chant = false
  1783. @reyvateil.song_blue = false
  1784. @reyvateil.loop_animation_id = 0
  1785. @reyvateil.current_action.clear
  1786. end_reyvateil_command
  1787. when 'Flee'
  1788. # Play escape SE
  1789. $game_system.se_play($data_system.escape_se)
  1790. # Return to BGM before battle started
  1791. $game_system.bgm_play($game_temp.map_bgm)
  1792. # Battle ends
  1793. battle_end(1)
  1794. end
  1795. end
  1796. end
  1797. #--------------------------------------------------------------------------
  1798. # * End Reyvateil Command
  1799. #--------------------------------------------------------------------------
  1800. def end_reyvateil_command
  1801. @reyvateil_command.visible = true
  1802. @reyvateil.blink = false
  1803. # Destroy all
  1804. @reyvateil_ring.dispose
  1805. @reyvateil_ring = nil
  1806. if @song_window != nil
  1807. @song_window.dispose
  1808. @song_window = nil
  1809. end
  1810. if @help_window != nil
  1811. @help_window.dispose
  1812. @help_window = nil
  1813. end
  1814. @action_system.remove_reyvateil
  1815. if @previous_phase == nil
  1816. start_phase1
  1817. else
  1818. @phase = @previous_phase
  1819. end
  1820. end
  1821. #--------------------------------------------------------------------------
  1822. end
  1823.  
  1824. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1825. # Ar Tonelico Custom Battle System
  1826. # Author: Kread-EX
  1827. # Version 1.1
  1828. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1829.  
  1830. #===========================================================
  1831. # ** Sprite
  1832. #------------------------------------------------------------------------------
  1833. # Basic sprite class, enhanced with moving capabilities
  1834. #===========================================================
  1835.  
  1836. class Sprite
  1837. #--------------------------------------------------------------------------
  1838. # * Public Instance Variables
  1839. #--------------------------------------------------------------------------
  1840. attr_reader :x_destination
  1841. #--------------------------------------------------------------------------
  1842. # * Object Initialization
  1843. #--------------------------------------------------------------------------
  1844. alias_method :krx_move_sprite_init, :initialize
  1845. def initialize(viewport = nil)
  1846. krx_move_sprite_init(viewport) # Original call
  1847. # When these two variables are different than the coordinates, the sprite moves.
  1848. @x_destination = nil
  1849. @y_destination = nil
  1850. # Coordinates incrementation.
  1851. @increment = 0
  1852. end
  1853. #--------------------------------------------------------------------------
  1854. # * Horizontal move
  1855. #--------------------------------------------------------------------------
  1856. def x_slide(x_dest, inc)
  1857. @x_destination = x_dest
  1858. @increment= inc
  1859. end
  1860. #--------------------------------------------------------------------------
  1861. # * Vertical move
  1862. #--------------------------------------------------------------------------
  1863. def y_slide(y_dest, inc)
  1864. @y_destination = y_dest
  1865. @increment = inc
  1866. end
  1867. #--------------------------------------------------------------------------
  1868. # * Frame Update
  1869. #--------------------------------------------------------------------------
  1870. alias_method :krx_move_sprite_update, :update
  1871. def update
  1872. update_x_slide
  1873. update_y_slide
  1874. return if self.is_sliding?
  1875. krx_move_sprite_update # Original call
  1876. end
  1877. #--------------------------------------------------------------------------
  1878. # * Update horizontal motion
  1879. #--------------------------------------------------------------------------
  1880. def update_x_slide
  1881. return if @x_destination == nil
  1882. if @x_destination > self.x
  1883. self.x = [self.x + @increment, @x_destination].min
  1884. else
  1885. self.x = [self.x - @increment, @x_destination].max
  1886. end
  1887. @x_destination = nil if @x_destination == self.x
  1888. end
  1889. #--------------------------------------------------------------------------
  1890. # * Update vertical motion
  1891. #--------------------------------------------------------------------------
  1892. def update_y_slide
  1893. return if @y_destination == nil
  1894. if @y_destination > self.y
  1895. self.y = [self.y + @increment, @y_destination].min
  1896. else
  1897. self.y = [self.y - @increment, @y_destination].max
  1898. end
  1899. @y_destination = nil if @y_destination == self.y
  1900. end
  1901. #--------------------------------------------------------------------------
  1902. # * Checks if moving
  1903. #--------------------------------------------------------------------------
  1904. def is_sliding?
  1905. return (@x_destination != nil || @y_destination != nil)
  1906. end
  1907. #--------------------------------------------------------------------------
  1908. end
  1909.  
  1910. #===========================================================
  1911. # ** RPG::Sprite
  1912. #------------------------------------------------------------------------------
  1913. # Basic RGSS class, enhanced to display damage with image files and processing multi-hit skills.
  1914. #===========================================================
  1915.  
  1916. class RPG::Sprite
  1917. #--------------------------------------------------------------------------
  1918. # * Object Initialization
  1919. #--------------------------------------------------------------------------
  1920. def initialize(viewport = nil)
  1921. super(viewport)
  1922. @_whiten_duration = 0
  1923. @_appear_duration = 0
  1924. @_escape_duration = 0
  1925. @_collapse_duration = 0
  1926. @_damage_sprites = []
  1927. @_damage_durations = []
  1928. @_animation_duration = 0
  1929. @_blink = false
  1930. end
  1931. #--------------------------------------------------------------------------
  1932. # * Dispose all
  1933. #--------------------------------------------------------------------------
  1934. def dispose
  1935. @_damage_sprites.each {|spr| dispose_damage(spr)}
  1936. dispose_animation
  1937. dispose_loop_animation
  1938. super
  1939. end
  1940. #--------------------------------------------------------------------------
  1941. # * Determine if effects are displayed
  1942. #--------------------------------------------------------------------------
  1943. def effect?
  1944. @_whiten_duration > 0 ||
  1945. @_appear_duration > 0 ||
  1946. @_escape_duration > 0 ||
  1947. @_collapse_duration > 0 ||
  1948. @_animation_duration > 0
  1949. end
  1950. #--------------------------------------------------------------------------
  1951. # * Dispose the damage sprites
  1952. #--------------------------------------------------------------------------
  1953. def dispose_damage(sprite)
  1954. if sprite != nil
  1955. sprite.dispose
  1956. @_damage_durations.delete_at(@_damage_sprites.index(sprite))
  1957. @_damage_durations.compact!
  1958. @_damage_sprites.delete(sprite)
  1959. @_damage_sprites.compact!
  1960. end
  1961. end
  1962. #--------------------------------------------------------------------------
  1963. # * Display damage
  1964. #--------------------------------------------------------------------------
  1965. def damage(value)
  1966. # Creates the bitmap
  1967. bitmap = Bitmap.new(519, 124)
  1968. bitmap.draw_damage(value) unless value == ''
  1969. # And draw it on the sprite
  1970. @_damage_sprites.push(::Sprite.new(self.viewport))
  1971. @_damage_sprites[-1].bitmap = bitmap
  1972. @_damage_sprites[-1].ox = 47 + self.viewport.ox
  1973. @_damage_sprites[-1].oy = 32
  1974. @_damage_sprites[-1].x = self.x + self.viewport.rect.x
  1975. @_damage_sprites[-1].y = self.y - self.oy / 2 + self.viewport.rect.y
  1976. @_damage_sprites[-1].z = 3000
  1977. # Setup damage durations
  1978. @_damage_durations[@_damage_sprites.index(@_damage_sprites[-1])] = 40
  1979. end
  1980. #--------------------------------------------------------------------------
  1981. # * Frame Update
  1982. #--------------------------------------------------------------------------
  1983. def update
  1984. super
  1985. # Update white flash
  1986. if @_whiten_duration > 0
  1987. @_whiten_duration -= 1
  1988. self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  1989. end
  1990. # Update enemy appearance
  1991. if @_appear_duration > 0
  1992. @_appear_duration -= 1
  1993. self.opacity = (16 - @_appear_duration) * 16
  1994. end
  1995. # Update escape
  1996. if @_escape_duration > 0
  1997. @_escape_duration -= 1
  1998. self.opacity = 256 - (32 - @_escape_duration) * 10
  1999. end
  2000. # Update collapse animation
  2001. if @_collapse_duration > 0
  2002. @_collapse_duration -= 1
  2003. self.opacity = 256 - (48 - @_collapse_duration) * 6
  2004. end
  2005. # Update damage sprites
  2006. @_damage_sprites.each {|sprite|
  2007. if @_damage_durations[@_damage_sprites.index(sprite)] > 0
  2008. @_damage_durations[@_damage_sprites.index(sprite)] -= 1
  2009. sprite.y -= 3
  2010. sprite.opacity -= 8
  2011. if @_damage_durations[@_damage_sprites.index(sprite)] == 0
  2012. dispose_damage(sprite)
  2013. end
  2014. end
  2015. }
  2016. # Update animation
  2017. if @_animation != nil && (Graphics.frame_count % 2 == 0)
  2018. @_animation_duration -= 1
  2019. update_animation
  2020. end
  2021. # Update state animation
  2022. if @_loop_animation != nil && (Graphics.frame_count % 2 == 0)
  2023. update_loop_animation
  2024. @_loop_animation_index += 1
  2025. @_loop_animation_index %= @_loop_animation.frame_max
  2026. end
  2027. # Update blink for actor command
  2028. if @_blink
  2029. @_blink_count = (@_blink_count + 1) % 32
  2030. if @_blink_count < 16
  2031. alpha = (16 - @_blink_count) * 6
  2032. else
  2033. alpha = (@_blink_count - 16) * 6
  2034. end
  2035. self.color.set(255, 255, 255, alpha)
  2036. end
  2037. # Clear the animation data
  2038. @@_animations.clear
  2039. end
  2040. #--------------------------------------------------------------------------
  2041. end
  2042.  
  2043. #===========================================================
  2044. # ** Sprite_Battler
  2045. #------------------------------------------------------------------------------
  2046. # This sprite is used to display the battler.It observes the Game_Character
  2047. # class and automatically changes sprite conditions.
  2048. #===========================================================
  2049.  
  2050. class Sprite_Battler < RPG::Sprite
  2051. #--------------------------------------------------------------------------
  2052. # * Object Initialization
  2053. # viewport : viewport
  2054. # battler : battler (Game_Battler)
  2055. #--------------------------------------------------------------------------
  2056. alias_method :krx_atcbs_sprite_battler_initialize, :initialize
  2057. def initialize(viewport, battler = nil)
  2058. krx_atcbs_sprite_battler_initialize(viewport, battler)
  2059. @loop_anim_id = 0
  2060. end
  2061. #--------------------------------------------------------------------------
  2062. # * Frame Update
  2063. #--------------------------------------------------------------------------
  2064. def update
  2065. super
  2066. # Quit if battler is nil
  2067. if @battler == nil
  2068. self.bitmap = nil
  2069. loop_animation(nil)
  2070. return
  2071. end
  2072. # If file name or hue are different than current ones
  2073. if @battler.battler_name != @battler_name || @battler.battler_hue != @battler_hue
  2074. # Get and set bitmap
  2075. @battler_name = @battler.battler_name
  2076. @battler_hue = @battler.battler_hue
  2077. self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  2078. @width = bitmap.width
  2079. @height = bitmap.height
  2080. self.ox = @width / 2
  2081. self.oy = @height
  2082. # Change opacity level to 0 when dead or hidden
  2083. self.opacity = 0 if @battler.dead? or @battler.hidden
  2084. end
  2085. # If battler dies when chanting
  2086. if @battler.dead?
  2087. @battler.burst_value = 0
  2088. @battler.song_chant = false
  2089. @battler.loop_animation_id = 0
  2090. end
  2091. # If animation ID is different than current one
  2092. if @battler.damage.size == 0 && @battler.state_animation_id != @state_animation_id
  2093. @state_animation_id = @battler.state_animation_id
  2094. loop_animation($data_animations[@state_animation_id])
  2095. end
  2096. # Song Magic loop animation
  2097. if KreadCFG.is_reyvateil?(@battler) && @battler.loop_animation_id != @loop_anim_id
  2098. @loop_anim_id = @battler.loop_animation_id
  2099. if @battler.loop_animation_id == 0
  2100. loop_animation(nil)
  2101. return
  2102. end
  2103. skill_id = @battler.current_action.skill_id
  2104. if skill_id != 0
  2105. loop_animation($data_animations[KreadCFG::SongMagicChargeAnim[skill_id]])
  2106. else
  2107. loop_animation(nil)
  2108. end
  2109. end
  2110. # Blink
  2111. if @battler.blink
  2112. blink_on
  2113. else
  2114. blink_off
  2115. end
  2116. # If invisible
  2117. unless @battler_visible
  2118. # Appear
  2119. if [email protected] && [email protected]? && (@battler.damage.size == 0 || @battler.damage_pop)
  2120. appear
  2121. @battler_visible = true
  2122. end
  2123. end
  2124. # If visible
  2125. if @battler_visible
  2126. # Escape
  2127. if @battler.hidden
  2128. $game_system.se_play($data_system.escape_se)
  2129. escape
  2130. @battler_visible = false
  2131. end
  2132. # White flash
  2133. if @battler.white_flash
  2134. whiten
  2135. @battler.white_flash = false
  2136. end
  2137. # Animation
  2138. if @battler.animation_id != 0
  2139. animation = $data_animations[@battler.animation_id]
  2140. animation(animation, @battler.animation_hit)
  2141. @battler.animation_id = 0
  2142. end
  2143. # Damage
  2144. if @battler.damage_pop
  2145. damage(@battler.damage.shift)
  2146. @battler.critical = false
  2147. @battler.damage_pop = false
  2148. end
  2149. # Collapse
  2150. if @battler.damage.size == 0 && @battler.dead?
  2151. if @battler.is_a?(Game_Enemy)
  2152. $game_system.se_play($data_system.enemy_collapse_se)
  2153. else
  2154. $game_system.se_play($data_system.actor_collapse_se)
  2155. end
  2156. collapse
  2157. @battler_visible = false
  2158. end
  2159. end
  2160. # Set sprite coordinates
  2161. self.x = @battler.screen_x
  2162. self.y = @battler.screen_y
  2163. self.z = @battler.screen_z
  2164. end
  2165. #--------------------------------------------------------------------------
  2166. # * Frame Update: Animation
  2167. #--------------------------------------------------------------------------
  2168. def update_animation
  2169. # Get animation data
  2170. if @_animation_duration > 0
  2171. frame_index = @_animation.frame_max - @_animation_duration
  2172. cell_data = @_animation.frames[frame_index].cell_data
  2173. position = @_animation.position
  2174. animation_set_sprites(@_animation_sprites, cell_data, position)
  2175. # Checks if there is a skill and the skill has multiple hits
  2176. skill = $scene.skill
  2177. if skill != nil && KreadCFG.skill_hits(skill.id) > 1
  2178. # If the frame index match one of the skill timings
  2179. KreadCFG::HitTimings[skill.id].each {|i|
  2180. if frame_index == i
  2181. # Display damage if there is any
  2182. @battler.damage_pop = true if @battler.damage.size > 0
  2183. end
  2184. }
  2185. end
  2186. # Process timings
  2187. @_animation.timings.each {|timing|
  2188. if timing.frame == frame_index
  2189. animation_process_timing(timing, @_animation_hit)
  2190. end
  2191. }
  2192. else
  2193. dispose_animation
  2194. end
  2195. end
  2196. #--------------------------------------------------------------------------
  2197. end
  2198.  
  2199. #===========================================================
  2200. # ** Bitmap
  2201. #------------------------------------------------------------------------------
  2202. # Basic bitmap class, enhanced with various drawing methods.
  2203. #===========================================================
  2204.  
  2205. class Bitmap
  2206. #--------------------------------------------------------------------------
  2207. # * Draws text, but with outline
  2208. #--------------------------------------------------------------------------
  2209. def draw_outlined_text(x, y, width, height, string, align = 0, outline_color = Color.new(0, 0, 0))
  2210. old_color = self.font.color.dup
  2211. self.font.color = outline_color
  2212. self.draw_text(x - 1, y - 1, width + 1, height + 1, string, align)
  2213. self.draw_text(x - 1, y + 1, width + 1, height + 1, string, align)
  2214. self.draw_text(x + 1, y - 1, width + 1, height + 1, string, align)
  2215. self.draw_text(x + 1, y + 1, width + 1, height + 1, string, align)
  2216. self.font.color = old_color
  2217. self.draw_text(x, y, width, height, string, align)
  2218. end
  2219. #--------------------------------------------------------------------------
  2220. # * Draws the damage values
  2221. #--------------------------------------------------------------------------
  2222. def draw_damage(value, element_set = $scene.skill != nil ? $scene.skill.element_set : [])
  2223. # Process numeric values
  2224. if value.is_a?(Numeric)
  2225. # Computes the first digit
  2226. if value != 0
  2227. digit = Math.log10(value.abs).to_i
  2228. # Automatically 0 if the value if 0
  2229. else
  2230. digit = 0
  2231. end
  2232. # Checks if the value if negative
  2233. if value < 0
  2234. filename = 'Damage_Recovery'
  2235. # Checks the element_set to know which file to load
  2236. elsif element_set.include?(KreadCFG::FireElement)
  2237. filename = 'Damage_Fire'
  2238. elsif element_set.include?(KreadCFG::IceElement)
  2239. filename = 'Damage_Ice'
  2240. elsif element_set.include?(KreadCFG::WindElement)
  2241. filename = 'Damage_Wind'
  2242. else
  2243. filename = 'Damage'
  2244. end
  2245. value = value.abs
  2246. # Loads the bitmap
  2247. bmp = RPG::Cache.picture(filename)
  2248. # Transfer one digit after the other until none remains
  2249. x = 0
  2250. while digit >= 0
  2251. self.blt(x, 0, bmp, Rect.new((value / (10 ** digit)) * 47, 0, 47, 62))
  2252. x += 14
  2253. value %= 10 ** digit
  2254. digit -= 1
  2255. end
  2256. # Process string damage
  2257. else
  2258. # Loads the bitmap
  2259. bmp = RPG::Cache.picture("Damage_#{value}")
  2260. self.blt(0, 0, bmp, bmp.rect)
  2261. end
  2262. end
  2263. #--------------------------------------------------------------------------
  2264. end
  2265.  
  2266. #===========================================================
  2267. # ** Spriteset_Battle
  2268. #------------------------------------------------------------------------------
  2269. # This class brings together battle screen sprites. It's used within
  2270. # the Scene_Battle class.
  2271. #===========================================================
  2272.  
  2273. class Spriteset_Battle
  2274. #--------------------------------------------------------------------------
  2275. # * Public Instance Variables
  2276. #--------------------------------------------------------------------------
  2277. attr_reader :viewport5 # interface sprites viewport
  2278. #--------------------------------------------------------------------------
  2279. # * Object Initialization
  2280. #--------------------------------------------------------------------------
  2281. def initialize
  2282. # Make viewports
  2283. @viewport1 = Viewport.new(0, 0, 640, 480)
  2284. @viewport2 = Viewport.new(0, 0, 640, 480)
  2285. @viewport3 = Viewport.new(0, 0, 640, 480)
  2286. @viewport4 = Viewport.new(0, 0, 640, 480)
  2287. @viewport5 = Viewport.new(0, 0, 640, 480)
  2288. @viewport2.z = 101
  2289. @viewport3.z = 200
  2290. @viewport4.z = 5000
  2291. @viewport5.z = 6000
  2292. # Make battleback sprite
  2293. @battleback_sprite = Sprite.new(@viewport1)
  2294. # Make enemy sprites
  2295. @enemy_sprites = []
  2296. $game_troop.enemies.reverse.each {|enemy|
  2297. @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  2298. }
  2299. # Make actor sprites
  2300. @actor_sprites = []
  2301. @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2302. @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2303. @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2304. @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2305. # Make weather
  2306. @weather = RPG::Weather.new(@viewport1)
  2307. # Make picture sprites
  2308. @picture_sprites = []
  2309. (51..100).each {|i|
  2310. @picture_sprites.push(Sprite_Picture.new(@viewport3,$game_screen.pictures[i]))
  2311. }
  2312. # Make timer sprite
  2313. @timer_sprite = Sprite_Timer.new
  2314. # Frame update
  2315. update
  2316. end
  2317. #--------------------------------------------------------------------------
  2318. # * Dispose
  2319. #--------------------------------------------------------------------------
  2320. alias_method :krx_atcbs_dispose, :dispose
  2321. def dispose
  2322. krx_atcbs_dispose
  2323. @viewport5.dispose
  2324. end
  2325. #--------------------------------------------------------------------------
  2326. # * Frame Update
  2327. #--------------------------------------------------------------------------
  2328. def update
  2329. # Update actor sprite bitmap (corresponds with actor switching)
  2330. @actor_sprites[0].battler = $game_party.actors[0]
  2331. @actor_sprites[1].battler = $game_party.actors[1]
  2332. @actor_sprites[2].battler = $game_party.actors[2]
  2333. @actor_sprites[3].battler = $game_party.actors[3]
  2334. # If battleback file name is different from current one
  2335. if @battleback_name != $game_temp.battleback_name
  2336. @battleback_name = $game_temp.battleback_name
  2337. if @battleback_sprite.bitmap != nil
  2338. @battleback_sprite.bitmap.dispose
  2339. end
  2340. # Stretches the battleback if necessary
  2341. bmp = RPG::Cache.battleback(@battleback_name)
  2342. @battleback_sprite.bitmap = Bitmap.new(640, 480)
  2343. @battleback_sprite.bitmap.stretch_blt(@battleback_sprite.bitmap.rect, bmp, bmp.rect)
  2344. end
  2345. # Update battler sprites
  2346. (@enemy_sprites + @actor_sprites).each {|sprite| sprite.update}
  2347. # Update weather graphic
  2348. @weather.type = $game_screen.weather_type
  2349. @weather.max = $game_screen.weather_max
  2350. @weather.update
  2351. # Update picture sprites
  2352. @picture_sprites.each {|sprite| sprite.update}
  2353. # Update timer sprite
  2354. @timer_sprite.update
  2355. # Set screen color tone and shake position
  2356. @viewport1.tone = $game_screen.tone
  2357. @viewport1.ox = $game_screen.shake
  2358. # Set screen flash color
  2359. @viewport4.color = $game_screen.flash_color
  2360. # Update viewports
  2361. @viewport1.update
  2362. @viewport2.update
  2363. @viewport4.update
  2364. @viewport5.update
  2365. end
  2366. #--------------------------------------------------------------------------
  2367. end
  2368.  
  2369. #===========================================================
  2370. # ** Action_System
  2371. #------------------------------------------------------------------------------
  2372. # Displays the turn order in battle
  2373. #===========================================================
  2374.  
  2375. class Action_System < Sprite
  2376. #--------------------------------------------------------------------------
  2377. # * Public instance variables
  2378. #--------------------------------------------------------------------------
  2379. attr_reader :queue
  2380. #--------------------------------------------------------------------------
  2381. # * Object Initialization
  2382. #--------------------------------------------------------------------------
  2383. def initialize(viewport)
  2384. super(viewport)
  2385. create_bitmap
  2386. create_battler_icons
  2387. update_order
  2388. update_coordinates_immediate
  2389. end
  2390. #--------------------------------------------------------------------------
  2391. # * Create the bitmap
  2392. #--------------------------------------------------------------------------
  2393. def create_bitmap
  2394. self.bitmap = RPG::Cache.picture('Action_Turns')
  2395. end
  2396. #--------------------------------------------------------------------------
  2397. # * Create the icons representing the battlers
  2398. #--------------------------------------------------------------------------
  2399. def create_battler_icons
  2400. @queue = []
  2401. ($game_party.actors + $game_troop.enemies).each {|battler|
  2402. next if KreadCFG.is_reyvateil?(battler)
  2403. @queue.push(Battler_Icon.new(self.viewport, battler))
  2404. }
  2405. end
  2406. #--------------------------------------------------------------------------
  2407. # * Frame Update
  2408. #--------------------------------------------------------------------------
  2409. def update
  2410. super
  2411. @queue.each {|spr| spr.update}
  2412. end
  2413. #--------------------------------------------------------------------------
  2414. # * Update icons order by action meter
  2415. #--------------------------------------------------------------------------
  2416. def update_order
  2417. max_nb = $game_party.actors.size + $game_troop.enemies.size
  2418. sel_bat = nil
  2419. if @queue.size != max_nb
  2420. ($game_party.actors + $game_troop.enemies).each {|bat|
  2421. sel_bat = bat
  2422. already_in_queue = false
  2423. next if !bat.exist? || bat == KreadCFG.return_reyvateil
  2424. @queue.each {|ico|
  2425. if ico.battler == sel_bat
  2426. already_in_queue = true
  2427. break
  2428. end
  2429. }
  2430. next if already_in_queue
  2431. @queue.push(Battler_Icon.new(self.viewport, bat))
  2432. }
  2433. end
  2434. inds = []
  2435. @queue.each_index {|i|
  2436. if !@queue[i].battler.exist?
  2437. @queue[i].dispose
  2438. inds.push(i)
  2439. end
  2440. }
  2441. inds.each {|j| @queue[j] = nil}
  2442. @queue.compact!
  2443. @queue.sort! {|a, b| b.battler.action_meter <=> a.battler.action_meter}
  2444. end
  2445. #--------------------------------------------------------------------------
  2446. # * Update icons coordinates by order
  2447. #--------------------------------------------------------------------------
  2448. def update_coordinates(with_right_shift = false)
  2449. @queue.each_index {|i| @queue[i].x_slide((self.bitmap.width - 130) - 53 * i, 24)}
  2450. if with_right_shift
  2451. @queue.each_index {|i|
  2452. @queue[i].x_slide(@queue[i].x_destination + (i == 0 ? 60 : 53), 12)
  2453. }
  2454. end
  2455. end
  2456. #--------------------------------------------------------------------------
  2457. # * Update icons coordinates by order immediately
  2458. #--------------------------------------------------------------------------
  2459. def update_coordinates_immediate
  2460. @queue.each_index {|i| @queue[i].x = (self.bitmap.width - 130) - 53 * i}
  2461. end
  2462. #--------------------------------------------------------------------------
  2463. # * Shift the icons to the right
  2464. #--------------------------------------------------------------------------
  2465. def right_shift
  2466. @queue.each_index {|i|
  2467. @queue[i].x_slide(@queue[i].x + (i == 0 ? 60 : 53), 12)
  2468. }
  2469. end
  2470. #--------------------------------------------------------------------------
  2471. # * Insert the Reyvateil icon
  2472. #--------------------------------------------------------------------------
  2473. def insert_reyvateil
  2474. @queue.push(Battler_Icon.new(self.viewport, $game_party.actors[-1]))
  2475. @queue[-1].x = @queue[0].x + 60
  2476. end
  2477. #--------------------------------------------------------------------------
  2478. # * Remove the Reyvateil icon
  2479. #--------------------------------------------------------------------------
  2480. def remove_reyvateil
  2481. @queue[-1].dispose
  2482. @queue[-1] = nil
  2483. @queue.compact!
  2484. end
  2485. #--------------------------------------------------------------------------
  2486. end
  2487.  
  2488. #===========================================================
  2489. # ** Battler_Icon
  2490. #------------------------------------------------------------------------------
  2491. # Displays the battler's graphic for turns in battle
  2492. #===========================================================
  2493.  
  2494. class Battler_Icon < Sprite
  2495. #--------------------------------------------------------------------------
  2496. # * Public instance variables
  2497. #--------------------------------------------------------------------------
  2498. attr_reader :battler
  2499. #--------------------------------------------------------------------------
  2500. # * Object Initialization
  2501. #--------------------------------------------------------------------------
  2502. def initialize(viewport, battler)
  2503. super(viewport)
  2504. @battler = battler
  2505. @am = 0
  2506. create_bitmap
  2507. setup_initial_coordinates
  2508. update
  2509. end
  2510. #--------------------------------------------------------------------------
  2511. # * Create the bitmap
  2512. #--------------------------------------------------------------------------
  2513. def create_bitmap
  2514. # If enemies don't have custom icons, use the default one
  2515. bmp = RPG::Cache.picture("BattleFace_#{@battler.name}") rescue NIL
  2516. if bmp != nil
  2517. self.bitmap = bmp
  2518. else
  2519. if @battler.is_a?(Game_Enemy)
  2520. self.bitmap = RPG::Cache.picture('BattleFace_Enemy').clone
  2521. end
  2522. end
  2523. # Loads action meter bitmap
  2524. @am_bmp = RPG::Cache.picture('ActionBar_Full')
  2525. end
  2526. #--------------------------------------------------------------------------
  2527. # * Setups the coordinates for the battle entry
  2528. #--------------------------------------------------------------------------
  2529. def setup_initial_coordinates
  2530. self.y, self.z = 7, 1
  2531. end
  2532. #--------------------------------------------------------------------------
  2533. # * Frame Update
  2534. #--------------------------------------------------------------------------
  2535. def update
  2536. super
  2537. # Updates Action Meter if necessary
  2538. if @am != @battler.action_meter
  2539. # Computes AM / Max AM ratio
  2540. ratio = [(@battler.action_meter / 1000.0), 1000].min
  2541. am_rect = Rect.new(0, 0, @am_bmp.width, @am_bmp.height * ratio)
  2542. self.bitmap.fill_rect(48, 0, 5, 48, Color.new(0, 0, 0))
  2543. self.bitmap.blt(49, 1, @am_bmp, am_rect)
  2544. @am = @battler.action_meter
  2545. end
  2546. end
  2547. #--------------------------------------------------------------------------
  2548. end
  2549.  
  2550. #===========================================================
  2551. # ** Arrow_Actor
  2552. #------------------------------------------------------------------------------
  2553. # This arrow cursor is used to choose an actor. This class inherits from the
  2554. # Arrow_Base class.
  2555. #===========================================================
  2556.  
  2557. class Arrow_Actor < Arrow_Base
  2558. #--------------------------------------------------------------------------
  2559. # * Frame Update
  2560. #--------------------------------------------------------------------------
  2561. alias_method :krx_atcbs_update, :update
  2562. def update
  2563. krx_atcbs_update
  2564. # Set help window coordinates
  2565. if @help_window != nil
  2566. @help_window.x = self.x - 64
  2567. @help_window.y = self.y - 8
  2568. end
  2569. end
  2570. #--------------------------------------------------------------------------
  2571. end
  2572.  
  2573. #===========================================================
  2574. # ** Arrow_Enemy
  2575. #------------------------------------------------------------------------------
  2576. # This arrow cursor is used to choose enemies. This class inherits from the
  2577. # Arrow_Base class.
  2578. #===========================================================
  2579.  
  2580. class Arrow_Enemy < Arrow_Base
  2581. #--------------------------------------------------------------------------
  2582. # * Frame Update
  2583. #--------------------------------------------------------------------------
  2584. alias_method :krx_atcbs_update, :update
  2585. def update
  2586. krx_atcbs_update
  2587. # Set help window coordinates
  2588. if @help_window != nil
  2589. @help_window.x = self.x - 64
  2590. @help_window.y = self.y - 8
  2591. end
  2592. end
  2593. #--------------------------------------------------------------------------
  2594. end
  2595.  
  2596. #===========================================================
  2597. # ** Action_Help
  2598. #------------------------------------------------------------------------------
  2599. # Displays action name in battle
  2600. #===========================================================
  2601.  
  2602. class Action_Help < Sprite
  2603. #--------------------------------------------------------------------------
  2604. # * Object Initialization
  2605. #--------------------------------------------------------------------------
  2606. def initialize(viewport, action)
  2607. super(viewport)
  2608. @action = action
  2609. set_bitmap
  2610. set_coordinates
  2611. refresh
  2612. end
  2613. #--------------------------------------------------------------------------
  2614. # * Setup the bitmap
  2615. #--------------------------------------------------------------------------
  2616. def set_bitmap
  2617. # Dispose bitmap if already existing
  2618. if self.bitmap != nil
  2619. self.bitmap.dispose
  2620. self.bitmap = nil
  2621. end
  2622. # Branch by action kind
  2623. if @action.kind == 0 # Basics
  2624. self.bitmap = Bitmap.new(8, 8) # Blank Bitmap
  2625. else # Skills and Items
  2626. self.bitmap = Bitmap.new('Graphics/Pictures/Help')
  2627. end
  2628. end
  2629. #--------------------------------------------------------------------------
  2630. # * Setup the coordinates
  2631. #--------------------------------------------------------------------------
  2632. def set_coordinates
  2633. self.ox = self.bitmap.width / 2
  2634. self.oy = self.bitmap.height / 2
  2635. self.x = 320
  2636. self.y = 96
  2637. end
  2638. #--------------------------------------------------------------------------
  2639. # * Refresh
  2640. #--------------------------------------------------------------------------
  2641. def refresh
  2642. # Sets font
  2643. self.bitmap.font.name = 'Arial'
  2644. self.bitmap.font.size = 32
  2645. self.bitmap.font.italic = true
  2646. # Branch by kind
  2647. case @action.kind
  2648. when 1 # Skill
  2649. text = $data_skills[@action.skill_id].name
  2650. self.bitmap.draw_text(0, 12, self.bitmap.width, 32, text, 1)
  2651. when 2 # Item
  2652. text = $data_items[@action.item_id].name
  2653. self.bitmap.draw_text(0, 12, self.bitmap.width, 32, text, 1)
  2654. end
  2655. end
  2656. #--------------------------------------------------------------------------
  2657. end
  2658.  
  2659. #===========================================================
  2660. # ** Reyvateil_Command
  2661. #------------------------------------------------------------------------------
  2662. # Displays the Reyvateil special command
  2663. #===========================================================
  2664.  
  2665. class Reyvateil_Command < Sprite
  2666. #--------------------------------------------------------------------------
  2667. # * Object Initialization
  2668. #--------------------------------------------------------------------------
  2669. def initialize(viewport)
  2670. super(viewport)
  2671. self.bitmap = Bitmap.new(190, 40)
  2672. self.bitmap.font.name = ['Sylfaen', 'Arial']
  2673. self.bitmap.font.bold = self.bitmap.font.italic = true
  2674. refresh
  2675. end
  2676. #--------------------------------------------------------------------------
  2677. # * Refresh
  2678. #--------------------------------------------------------------------------
  2679. def refresh
  2680. ico = RPG::Cache.icon('button_13')
  2681. self.x = 640 - self.bitmap.width
  2682. self.y = 480 - self.bitmap.height
  2683. self.bitmap.blt(0, 6, ico, ico.rect)
  2684. self.bitmap.draw_outlined_text(28, 0, self.bitmap.width, 32,
  2685. KreadCFG::ReyvateilClass + ' Command')
  2686. end
  2687. #--------------------------------------------------------------------------
  2688. end
  2689.  
  2690. #===========================================================
  2691. # ** Burst_Gauge
  2692. #------------------------------------------------------------------------------
  2693. # Displays the Burst Gauge
  2694. #===========================================================
  2695.  
  2696. class Burst_Gauge < Sprite
  2697. #--------------------------------------------------------------------------
  2698. # * Object Initialization
  2699. #--------------------------------------------------------------------------
  2700. def initialize(viewport, reyvateil)
  2701. super(viewport)
  2702. @reyvateil = reyvateil
  2703. @last_value = 0
  2704. @value_sprite = Burst_Value.new(viewport, reyvateil)
  2705. set_bitmap
  2706. set_coordinates
  2707. end
  2708. #--------------------------------------------------------------------------
  2709. # * Dispose all
  2710. #--------------------------------------------------------------------------
  2711. def dispose
  2712. super
  2713. @value_sprite.dispose
  2714. end
  2715. #--------------------------------------------------------------------------
  2716. # * Create the bitmap
  2717. #--------------------------------------------------------------------------
  2718. def set_bitmap
  2719. @back = RPG::Cache.picture('BurstGauge_Back')
  2720. self.bitmap = Bitmap.new(@back.width, @back.height)
  2721. self.bitmap.blt(0, 0, @back, @back.rect)
  2722. end
  2723. #--------------------------------------------------------------------------
  2724. # * Setup initial coordinates
  2725. #--------------------------------------------------------------------------
  2726. def set_coordinates
  2727. self.x, self.y, self.z = 8, 416, -5
  2728. end
  2729. #--------------------------------------------------------------------------
  2730. # * Frame Update
  2731. #--------------------------------------------------------------------------
  2732. def update
  2733. super
  2734. # Quit unless stored burst value is different than current burst value
  2735. return unless @last_value != @reyvateil.burst_value
  2736. return if @reyvateil.dead?
  2737. # Refreshes the gauge
  2738. filler = RPG::Cache.picture('BurstGauge_Fill')
  2739. ratio = (@reyvateil.burst_value * 1.00) /
  2740. (KreadCFG::SongMagicMaxBurst[@reyvateil.current_action.skill_id] * 1.00)
  2741. rect = Rect.new(0, 0, [(filler.width * ratio).round, filler.width].min, filler.height)
  2742. self.bitmap.clear
  2743. self.bitmap.blt(0, 0, @back, @back.rect)
  2744. self.bitmap.blt(2, 2, filler, rect)
  2745. @value_sprite.refresh(@reyvateil.burst_value)
  2746. @last_value = @reyvateil.burst_value
  2747. end
  2748. #--------------------------------------------------------------------------
  2749. end
  2750.  
  2751.  
  2752. #===========================================================
  2753. # ** Burst_Value
  2754. #------------------------------------------------------------------------------
  2755. # Displays the Burst value
  2756. #===========================================================
  2757.  
  2758. class Burst_Value < Sprite
  2759. #--------------------------------------------------------------------------
  2760. # * Object Initialization
  2761. #--------------------------------------------------------------------------
  2762. def initialize(viewport, reyvateil)
  2763. super(viewport)
  2764. set_bitmap
  2765. set_coordinates
  2766. end
  2767. #--------------------------------------------------------------------------
  2768. # * Create the bitmap
  2769. #--------------------------------------------------------------------------
  2770. def set_bitmap
  2771. self.bitmap = Bitmap.new(320, 96)
  2772. self.bitmap.font.name = ['Abduction II', 'Arial']
  2773. self.bitmap.font.size = 32
  2774. self.bitmap.draw_outlined_text(2, 2, 320, 96, '0%')
  2775. end
  2776. #--------------------------------------------------------------------------
  2777. # * Setup initial coordinates
  2778. #--------------------------------------------------------------------------
  2779. def set_coordinates
  2780. self.x, self.y, self.z = 332, 375, -4
  2781. end
  2782. #--------------------------------------------------------------------------
  2783. # * Refresh
  2784. #--------------------------------------------------------------------------
  2785. def refresh(new_value)
  2786. self.bitmap.clear
  2787. self.bitmap.draw_outlined_text(2, 2, 320, 96, new_value.to_s + '%')
  2788. end
  2789. #--------------------------------------------------------------------------
  2790. end
  2791.  
  2792. #===========================================================
  2793. # ** Harmonics_Gauge
  2794. #------------------------------------------------------------------------------
  2795. # Displays the Harmonics gauge.
  2796. #===========================================================
  2797.  
  2798. class Harmonics_Gauge < Sprite
  2799. #--------------------------------------------------------------------------
  2800. # * Object Initialization
  2801. #--------------------------------------------------------------------------
  2802. def initialize(viewport, reyvateil)
  2803. super(viewport)
  2804. self.x, self.y = 6, 440
  2805. self.bitmap = RPG::Cache.picture('Harmonics_Back')
  2806. @reyvateil = reyvateil
  2807. @last_harmo = nil
  2808. create_vanguards_bar
  2809. create_reyvateil_bar if @reyvateil != nil
  2810. end
  2811. #--------------------------------------------------------------------------
  2812. # * Dispose all
  2813. #--------------------------------------------------------------------------
  2814. def dispose
  2815. super
  2816. if @v_bar != nil
  2817. @vanguards_fill.dispose
  2818. @v_bar.bitmap.dispose
  2819. @v_bar.dispose
  2820. end
  2821. if @r_bar != nil
  2822. @reyvateil_fill.dispose
  2823. @r_bar.bitmap.dispose
  2824. @r_bar.dispose
  2825. end
  2826. end
  2827. #--------------------------------------------------------------------------
  2828. # * Create the gauge bar (Vanguards)
  2829. #--------------------------------------------------------------------------
  2830. def create_vanguards_bar
  2831. @vanguards_fill = RPG::Cache.picture('Harmonics_Vanguards')
  2832. @v_bar = Sprite.new(self.viewport)
  2833. @v_bar.bitmap = Bitmap.new(@vanguards_fill.width, @vanguards_fill.height)
  2834. @v_bar.x, @v_bar.y, @v_bar.z = self.x + 7, self.y + 7, self.z + 1
  2835. end
  2836. #--------------------------------------------------------------------------
  2837. # * Create the gauge bar (Reyvateil)
  2838. #--------------------------------------------------------------------------
  2839. def create_reyvateil_bar
  2840. @reyvateil_fill = RPG::Cache.picture('Harmonics_Reyvateil')
  2841. @r_bar = Sprite.new(self.viewport)
  2842. @r_bar.mirror = true
  2843. @r_bar.bitmap = Bitmap.new(@reyvateil_fill.width, @reyvateil_fill.height)
  2844. @r_bar.x, @r_bar.y, @r_bar.z = self.x + 7, self.y + 7, self.z + 1
  2845. end
  2846. #--------------------------------------------------------------------------
  2847. # * Frame Update
  2848. #--------------------------------------------------------------------------
  2849. def update
  2850. super
  2851. # Quit if Harmonics value didn't change
  2852. return unless $game_party.global_harmonics != @last_harmo
  2853. # If the global harmonics are maxed, then show special bar
  2854. if $game_party.global_harmonics == $game_temp.max_harmonics
  2855. bmp = RPG::Cache.picture('Harmonics_Maxed')
  2856. rect = bmp.rect
  2857. @r_bar.bitmap.clear if @r_bar != nil
  2858. @v_bar.bitmap.clear
  2859. @v_bar.bitmap.blt(0, 0, bmp, rect)
  2860. @last_harmo = $game_party.global_harmonics
  2861. return
  2862. end
  2863. # Update Vanguards bar
  2864. if @v_bar != nil
  2865. # Computes the amount of global harmonics due to Vanguards
  2866. ratio = $game_party.harmonics.to_f / $game_temp.max_harmonics.to_f
  2867. # And adjust the rect coordinate
  2868. rect = Rect.new(0, 0, (@vanguards_fill.width * ratio).round, @vanguards_fill.height)
  2869. @v_bar.bitmap.clear
  2870. @v_bar.bitmap.blt(0, 0, @vanguards_fill, rect)
  2871. end
  2872. # Update Reyvateil bar
  2873. if @r_bar != nil
  2874. # Computes the amount of global harmonics due to Reyvateil
  2875. ratio = @reyvateil.harmonics.to_f / $game_temp.max_harmonics.to_f
  2876. # And adjust the rect coordinate
  2877. rect = Rect.new(0, 0, (@reyvateil_fill.width * ratio).round, @reyvateil_fill.height)
  2878. @r_bar.bitmap.clear
  2879. @r_bar.bitmap.blt(0, 0, @reyvateil_fill, rect)
  2880. end
  2881. @last_harmo = $game_party.global_harmonics
  2882. end
  2883. #--------------------------------------------------------------------------
  2884. end
  2885.  
  2886. #===========================================================
  2887. # ** Sprite_LevelUp
  2888. #------------------------------------------------------------------------------
  2889. # Displays levelling up
  2890. #===========================================================
  2891.  
  2892. class Sprite_LevelUP < Sprite
  2893. #--------------------------------------------------------------------------
  2894. # * Object Initialization
  2895. #--------------------------------------------------------------------------
  2896. def initialize(viewport, actor)
  2897. super(viewport)
  2898. self.bitmap = Bitmap.new(120, 64)
  2899. self.bitmap.font.color = Color.new(0, 0, 0)
  2900. self.bitmap.draw_text(1, 1, 80, 32, 'Level Up')
  2901. self.bitmap.draw_text(1, 3, 80, 32, 'Level Up')
  2902. self.bitmap.draw_text(3, 1, 80, 32, 'Level Up')
  2903. self.bitmap.draw_text(3, 3, 80, 32, 'Level Up')
  2904. self.bitmap.font.color = Color.new(255, 255, 255)
  2905. self.bitmap.draw_text(2, 2, 80, 32, 'Level Up')
  2906. self.visible = false
  2907. self.x = 560
  2908. self.y = 176 + (actor.index * 58)
  2909. end
  2910. #--------------------------------------------------------------------------
  2911. end
  2912.  
  2913. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2914. # Ar Tonelico Custom Battle System
  2915. # Author: Kread-EX
  2916. # Version 1.1
  2917. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2918.  
  2919. #===========================================================
  2920. # ** Window
  2921. #------------------------------------------------------------------------------
  2922. # Basic window class, enhanced with moving capabilities
  2923. #===========================================================
  2924.  
  2925. class Window
  2926. #--------------------------------------------------------------------------
  2927. # * Object Initialization
  2928. #--------------------------------------------------------------------------
  2929. alias_method :krx_move_window_init, :initialize
  2930. def initialize(viewport = nil)
  2931. krx_move_window_init(viewport) # Original call
  2932. # When these two variables are different than the coordinates, the window moves.
  2933. @x_destination = nil
  2934. @y_destination = nil
  2935. # Coordinates incrementation.
  2936. @increment = 0
  2937. end
  2938. #--------------------------------------------------------------------------
  2939. # * Horizontal move
  2940. #--------------------------------------------------------------------------
  2941. def x_slide(x_dest, inc)
  2942. @x_destination = x_dest
  2943. @increment= inc
  2944. end
  2945. #--------------------------------------------------------------------------
  2946. # * Vertical move
  2947. #--------------------------------------------------------------------------
  2948. def y_slide(y_dest, inc)
  2949. @y_destination = y_dest
  2950. @increment = inc
  2951. end
  2952. #--------------------------------------------------------------------------
  2953. # * Frame Update
  2954. #--------------------------------------------------------------------------
  2955. alias_method :krx_move_window_update, :update
  2956. def update
  2957. update_x_slide
  2958. update_y_slide
  2959. return if self.is_sliding?
  2960. krx_move_window_update # Original call
  2961. end
  2962. #--------------------------------------------------------------------------
  2963. # * Update horizontal motion
  2964. #--------------------------------------------------------------------------
  2965. def update_x_slide
  2966. return if @x_destination == nil
  2967. if @x_destination > self.x
  2968. self.x = [self.x + @increment, @x_destination].min
  2969. else
  2970. self.x = [self.x - @increment, @x_destination].max
  2971. end
  2972. @x_destination = nil if @x_destination == self.x
  2973. end
  2974. #--------------------------------------------------------------------------
  2975. # * Update vertical motion
  2976. #--------------------------------------------------------------------------
  2977. def update_y_slide
  2978. return if @y_destination == nil
  2979. if @y_destination > self.y
  2980. self.y = [self.y + @increment, @y_destination].min
  2981. else
  2982. self.y = [self.y - @increment, @y_destination].max
  2983. end
  2984. @y_destination = nil if @y_destination == self.y
  2985. end
  2986. #--------------------------------------------------------------------------
  2987. # * Checks if moving
  2988. #--------------------------------------------------------------------------
  2989. def is_sliding?
  2990. return (@x_destination != nil || @y_destination != nil)
  2991. end
  2992. #--------------------------------------------------------------------------
  2993. end
  2994.  
  2995. #===========================================================
  2996. # ** Command_Ring
  2997. #------------------------------------------------------------------------------
  2998. # Ring menu for selecting commands in battle.
  2999. #===========================================================
  3000.  
  3001. class Command_Ring < Window_Base
  3002. #--------------------------------------------------------------------------
  3003. # * Object Initialization
  3004. #--------------------------------------------------------------------------
  3005. def initialize(actor)
  3006. super(500, 350, 320, 320)
  3007. self.contents = Bitmap.new(width - 32, height - 32)
  3008. self.opacity = 0
  3009. @actor = actor
  3010. @center_x = [actor.screen_x, 500].min
  3011. @center_y = actor.screen_y - 32
  3012. @last_x, @last_y = @center_x, @center_y
  3013. @index = 0
  3014. @active = true
  3015. create_commands
  3016. create_icons
  3017. setup_icons_coordinates
  3018. make_self_coordinates
  3019. refresh
  3020. end
  3021. #--------------------------------------------------------------------------
  3022. # * Get Index
  3023. #--------------------------------------------------------------------------
  3024. def index
  3025. return @index
  3026. end
  3027. #--------------------------------------------------------------------------
  3028. # * Get selected command
  3029. #--------------------------------------------------------------------------
  3030. def command
  3031. return @commands[@index]
  3032. end
  3033. #--------------------------------------------------------------------------
  3034. # * Dispose objects
  3035. #--------------------------------------------------------------------------
  3036. def dispose
  3037. super
  3038. @icons.each {|ico| ico.bitmap.dispose ; ico.dispose}
  3039. end
  3040. #--------------------------------------------------------------------------
  3041. # * Frame Update
  3042. #--------------------------------------------------------------------------
  3043. def update
  3044. super
  3045. make_self_coordinates
  3046. correct_coordinates
  3047. # Quit here is the ring isn't active
  3048. return if !@active
  3049. process_rotation
  3050. @icons.each {|ico| ico.update}
  3051. end
  3052. #--------------------------------------------------------------------------
  3053. # * Rotates the ring upon keyboard input
  3054. #--------------------------------------------------------------------------
  3055. def process_rotation
  3056. return if self.is_sliding?
  3057. # Clockwise
  3058. if Input.trigger?(Input::RIGHT)
  3059. rotate
  3060. @icons[@index].zoom_x = @icons[@index].zoom_y = 2.0
  3061. # Counterclockwise
  3062. elsif Input.trigger?(Input::LEFT)
  3063. rotate(true)
  3064. @icons[@index].zoom_x = @icons[@index].zoom_y = 2.0
  3065. end
  3066. end
  3067. #--------------------------------------------------------------------------
  3068. # * Refresh
  3069. #--------------------------------------------------------------------------
  3070. def refresh
  3071. command = @commands[@index]
  3072. self.contents.clear
  3073. self.contents.font.color = Color.new(70, 100, 235, 255)
  3074. self.contents.font.name = 'Verdana'
  3075. self.contents.font.size = 22
  3076. self.contents.font.bold = self.contents.font.italic = true
  3077. self.contents.draw_text(0, 0, 320, 36, command)
  3078. self.contents.draw_text(0, 2, 320, 36, command)
  3079. self.contents.draw_text(2, 0, 320, 36, command)
  3080. self.contents.draw_text(2, 2, 320, 36, command)
  3081. self.contents.font.color = Color.new(255, 255, 255, 255)
  3082. self.contents.draw_text(1, 1, 320, 36, command)
  3083. end
  3084. #--------------------------------------------------------------------------
  3085. # * Makes the ring visible or invisible
  3086. #--------------------------------------------------------------------------
  3087. def toggle_visibility
  3088. self.visible = !self.visible
  3089. @icons.each {|ico| ico.visible = !ico.visible}
  3090. end
  3091. #--------------------------------------------------------------------------
  3092. # * Makes the ring active or inactive
  3093. #--------------------------------------------------------------------------
  3094. def toggle_activity
  3095. @active = !@active
  3096. end
  3097. #--------------------------------------------------------------------------
  3098. # * Rotate the ring
  3099. #--------------------------------------------------------------------------
  3100. def rotate(counterclockwise = false)
  3101. make_new_index(counterclockwise)
  3102. reset_zoom
  3103. d1 = 2.0 * Math::PI / @commands.size
  3104. ([email protected]).each {|i|
  3105. j = i - @index
  3106. d = d1 * j + d1
  3107. @icons[i].x_slide(@center_x + (96 * Math.sin(d)).to_i, 15) rescue nil
  3108. @icons[i].y_slide(@center_y - (96 * Math.cos(d)).to_i, 15)
  3109. }
  3110. end
  3111. #--------------------------------------------------------------------------
  3112. # * Correct the coordinates
  3113. #--------------------------------------------------------------------------
  3114. def correct_coordinates
  3115. @center_x, @center_y = [@actor.screen_x, 500].min, @actor.screen_y - 32
  3116. if @last_x != @center_x || @last_y != @center_y
  3117. self.x_slide(@center_x, 64)
  3118. self.y_slide(@center_y, 64)
  3119. ([email protected]).each {|i|
  3120. d1 = 2.0 * Math::PI / @commands.size
  3121. j = i - @index
  3122. d = d1 * j + d1
  3123. @icons[i].x_slide(@center_x + (96 * Math.sin(d)).to_i, 64) rescue nil
  3124. @icons[i].y_slide(@center_y - (96 * Math.cos(d)).to_i, 64)
  3125. }
  3126. @last_x, @last_y = @center_x, @center_y
  3127. end
  3128. end
  3129. #--------------------------------------------------------------------------
  3130. # * Determine if the ring is moving
  3131. #--------------------------------------------------------------------------
  3132. def moving?
  3133. @icons.each {|ico| return true if ico.moving?}
  3134. return false
  3135. end
  3136. #--------------------------------------------------------------------------
  3137. # * Initialize the icons coordinates
  3138. #--------------------------------------------------------------------------
  3139. def setup_icons_coordinates
  3140. d1 = 2.0 * Math::PI / @commands.size
  3141. ([email protected]).each {|i|
  3142. j = i - @index
  3143. d = d1 * j + d1
  3144. @icons[i].x = @center_x + (96 * Math.sin(d)).to_i
  3145. @icons[i].y = @center_y - (96 * Math.cos(d)).to_i
  3146. @icons[i].z += 1000
  3147. @icons[i].ox = @icons[i].oy = 12
  3148. }
  3149. end
  3150. #--------------------------------------------------------------------------
  3151. # * Calculate the new index
  3152. #--------------------------------------------------------------------------
  3153. def make_new_index(minus)
  3154. @index = minus ? @index - 1 : @index + 1
  3155. @index %= @commands.size
  3156. refresh
  3157. end
  3158. #--------------------------------------------------------------------------
  3159. # * Calculate the new coordinates
  3160. #--------------------------------------------------------------------------
  3161. def make_self_coordinates
  3162. command = @commands[@index].is_a?(Array) ? @commands[@index][0] : @commands[@index]
  3163. self.x = @icons[@index].x - (58 + self.contents.text_size(command).width)
  3164. self.y = @icons[@index].y - 32
  3165. self.z += 1000
  3166. end
  3167. #--------------------------------------------------------------------------
  3168. # * Reset zoom
  3169. #--------------------------------------------------------------------------
  3170. def reset_zoom
  3171. @counter = 0
  3172. @icons.each {|ico|
  3173. ico.zoom_x = 1.0
  3174. ico.zoom_y = 1.0
  3175. }
  3176. end
  3177. #--------------------------------------------------------------------------
  3178. # * Create commands
  3179. #--------------------------------------------------------------------------
  3180. def create_commands
  3181. # Switch to Reyvateil Command if necessary
  3182. if KreadCFG.is_reyvateil?(@actor)
  3183. create_reyvateil_commands
  3184. return
  3185. end
  3186. @commands = ['Attack']
  3187. # Adds Skill if character knows at least one skill
  3188. @commands.push('Skill') if @actor.skills.size > 0
  3189. # Adds Guard
  3190. @commands.push('Guard')
  3191. # Adds Item
  3192. @commands.push('Item')
  3193. # Adds Flee if escape is enabled for this battle
  3194. @commands.push('Flee') if $game_temp.battle_can_escape
  3195. end
  3196. #--------------------------------------------------------------------------
  3197. # * Create icons
  3198. #--------------------------------------------------------------------------
  3199. def create_icons
  3200. # Quit if the actor is a Reyvateil
  3201. return if KreadCFG.is_reyvateil?(@actor)
  3202. @icons = []
  3203. # Check commands and add icons corresponding to them
  3204. @commands.each {|str|
  3205. @icons.push(Sprite.new(self.viewport))
  3206. @icons[-1].bitmap = RPG::Cache.icon("RingIcon_#{str.downcase}")
  3207. }
  3208. end
  3209. #--------------------------------------------------------------------------
  3210. # * Create commands and icons (Reyvateil Only)
  3211. #--------------------------------------------------------------------------
  3212. def create_reyvateil_commands
  3213. @commands = [KreadCFG::SongMagicName, KreadCFG::SongActivate, KreadCFG::SongCancel]
  3214. @icons = [] ; 3.times {@icons.push(Sprite.new(self.viewport))}
  3215. @icons[0].bitmap = RPG::Cache.icon('RingIcon_SongMagic')
  3216. @icons[1].bitmap = RPG::Cache.icon('RingIcon_SongActivate')
  3217. @icons[2].bitmap = RPG::Cache.icon('RingIcon_SongCancel')
  3218. # Adds Flee is possible...
  3219. return unless $game_temp.battle_can_escape
  3220. @commands.push('Flee')
  3221. @icons.push(Sprite.new(self.viewport))
  3222. @icons[-1].bitmap = RPG::Cache.icon('RingIcon_flee')
  3223. end
  3224. #--------------------------------------------------------------------------
  3225. end
  3226.  
  3227. #===========================================================
  3228. # ** Ambiance_Field
  3229. #------------------------------------------------------------------------------
  3230. # Displays ambiance field, as well as enemy name and status effects
  3231. #===========================================================
  3232.  
  3233. class Ambiance_Field < Window_Base
  3234. #--------------------------------------------------------------------------
  3235. # * Object Initialization
  3236. #--------------------------------------------------------------------------
  3237. def initialize
  3238. super(0, 0, 260, 96)
  3239. self.contents = Bitmap.new(width - 32, height - 32)
  3240. self.opacity = 0
  3241. self.z = 5000
  3242. @battler = nil
  3243. end
  3244. #--------------------------------------------------------------------------
  3245. # * Displays actor information
  3246. #--------------------------------------------------------------------------
  3247. def set_actor(actor)
  3248. set_battler(actor)
  3249. end
  3250. #--------------------------------------------------------------------------
  3251. # * Displays enemy information
  3252. #--------------------------------------------------------------------------
  3253. def set_enemy(enemy)
  3254. set_battler(enemy)
  3255. display_ambiance_field_value(enemy) if $game_system.ambiance_field
  3256. end
  3257. #--------------------------------------------------------------------------
  3258. # * Displays battler information
  3259. #--------------------------------------------------------------------------
  3260. def set_battler(battler)
  3261. return if @battler == battler
  3262. self.contents.clear
  3263. display_name(battler)
  3264. display_hp(battler)
  3265. @battler = battler
  3266. end
  3267. #--------------------------------------------------------------------------
  3268. # * Displays the name
  3269. #--------------------------------------------------------------------------
  3270. def display_name(battler)
  3271. self.contents.font.color = Color.new(70, 100, 235, 255)
  3272. self.contents.font.name = 'Verdana'
  3273. self.contents.font.size = 22
  3274. self.contents.font.bold = self.contents.font.italic = true
  3275. self.contents.draw_text(0, 0, 102, 36, battler.name, 1)
  3276. self.contents.draw_text(0, 2, 102, 36, battler.name, 1)
  3277. self.contents.draw_text(2, 0, 102, 36, battler.name, 1)
  3278. self.contents.draw_text(2, 2, 102, 36, battler.name, 1)
  3279. self.contents.font.color = Color.new(255, 255, 255, 255)
  3280. self.contents.draw_text(1, 1, 102, 36, battler.name, 1)
  3281. end
  3282. #--------------------------------------------------------------------------
  3283. # * Displays the hp bar
  3284. #--------------------------------------------------------------------------
  3285. def display_hp(battler)
  3286. # Draws Bar back
  3287. self.contents.fill_rect(0, 32, 96, 5, Color.new(0, 0, 0))
  3288. # Computes HP / Max HP ratio
  3289. ratio = battler.hp.to_f / battler.maxhp.to_f
  3290. # Draws Bar
  3291. full = RPG::Cache.picture('HpBar_Full')
  3292. rect = Rect.new(0, 0, (ratio * full.width).round, full.height)
  3293. self.contents.blt(1, 33, full, rect)
  3294. end
  3295. #--------------------------------------------------------------------------
  3296. # * Displays the value of the Ambiance Field
  3297. #--------------------------------------------------------------------------
  3298. def display_ambiance_field_value(enemy)
  3299. self.contents.font.size = 52
  3300. self.contents.font.color = Color.new(230, 100, 100, 255)
  3301. self.contents.draw_text(110, 2, 320, 64, enemy.ambiance_field.to_s)
  3302. self.contents.draw_text(110, 4, 320, 64, enemy.ambiance_field.to_s)
  3303. self.contents.draw_text(112, 2, 320, 64, enemy.ambiance_field.to_s)
  3304. self.contents.draw_text(112, 4, 320, 64, enemy.ambiance_field.to_s)
  3305. self.contents.font.color = Color.new(255, 255, 255, 255)
  3306. self.contents.draw_text(111, 3, 320, 64, enemy.ambiance_field.to_s)
  3307. end
  3308. #--------------------------------------------------------------------------
  3309. end
  3310.  
  3311. #===========================================================
  3312. # ** Window_BattleSkill
  3313. #------------------------------------------------------------------------------
  3314. # This window displays usable skills on the battle screens.
  3315. #===========================================================
  3316.  
  3317. class Window_BattleSkill < Window_Selectable
  3318. #--------------------------------------------------------------------------
  3319. # * Object Initialization
  3320. # actor : actor
  3321. #--------------------------------------------------------------------------
  3322. def initialize(actor)
  3323. super(0, 128, 240, 256)
  3324. self.index = 0
  3325. self.back_opacity = 160
  3326. self.z = 7000
  3327. @actor = actor
  3328. @column_max = 1
  3329. refresh
  3330. end
  3331. #--------------------------------------------------------------------------
  3332. # * Acquiring Skill
  3333. #--------------------------------------------------------------------------
  3334. def skill
  3335. return @data[self.index]
  3336. end
  3337. #--------------------------------------------------------------------------
  3338. # * Refresh
  3339. #--------------------------------------------------------------------------
  3340. def refresh
  3341. if self.contents != nil
  3342. self.contents.dispose
  3343. self.contents = nil
  3344. end
  3345. @data = []
  3346. ([email protected]).each {|i|
  3347. skill = $data_skills[@actor.skills[i]]
  3348. @data.push(skill) if skill != nil
  3349. }
  3350. # If item count is not 0, make a bit map and draw all items
  3351. @item_max = @data.size
  3352. if @item_max > 0
  3353. self.contents = Bitmap.new(width - 32, row_max * 32)
  3354. (0...@item_max).each {|i| draw_item(i)}
  3355. end
  3356. end
  3357. #--------------------------------------------------------------------------
  3358. # * Draw Item
  3359. # index : item number
  3360. #--------------------------------------------------------------------------
  3361. def draw_item(index)
  3362. skill = @data[index]
  3363. if @actor.skill_can_use?(skill.id)
  3364. self.contents.font.color = normal_color
  3365. else
  3366. self.contents.font.color = disabled_color
  3367. end
  3368. x = 4 + index % 1 * (288 + 32)
  3369. y = index * 32
  3370. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  3371. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3372. bitmap = RPG::Cache.icon(skill.icon_name)
  3373. opacity = self.contents.font.color == normal_color ? 255 : 128
  3374. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  3375. self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  3376. end
  3377. #--------------------------------------------------------------------------
  3378. # * Help Text Update
  3379. #--------------------------------------------------------------------------
  3380. def update_help
  3381. if @help_window.class == Window_SkillHelp
  3382. @help_window.set_skill(self.skill, @actor)
  3383. else
  3384. @help_window.set_skill(self.skill)
  3385. end
  3386. end
  3387. #--------------------------------------------------------------------------
  3388. end
  3389.  
  3390. #===========================================================
  3391. # ** Window_BattleItem
  3392. #------------------------------------------------------------------------------
  3393. # This window displays usable items on the battle screens.
  3394. #===========================================================
  3395.  
  3396. class Window_BattleItem < Window_Selectable
  3397. #--------------------------------------------------------------------------
  3398. # * Object Initialization
  3399. #--------------------------------------------------------------------------
  3400. def initialize
  3401. super(0, 128, 240, 256)
  3402. self.index = 0
  3403. self.back_opacity = 160
  3404. self.z = 7000
  3405. @column_max = 1
  3406. refresh
  3407. end
  3408. #--------------------------------------------------------------------------
  3409. # * Acquiring Item
  3410. #--------------------------------------------------------------------------
  3411. def item
  3412. return @data[self.index]
  3413. end
  3414. #--------------------------------------------------------------------------
  3415. # * Refresh
  3416. #--------------------------------------------------------------------------
  3417. def refresh
  3418. if self.contents != nil
  3419. self.contents.dispose
  3420. self.contents = nil
  3421. end
  3422. @data = []
  3423. (1...$data_items.size).each {|i|
  3424. item = $data_items[i]
  3425. @data.push(item) if [0, 1].include?(item.occasion) && $game_party.item_number(item.id) > 0
  3426. }
  3427. # If item count is not 0, make a bit map and draw all items
  3428. @item_max = @data.size
  3429. if @item_max > 0
  3430. self.contents = Bitmap.new(width - 32, row_max * 32)
  3431. (0...@item_max).each {|i| draw_item(i)}
  3432. end
  3433. end
  3434. #--------------------------------------------------------------------------
  3435. # * Draw Item
  3436. # index : item number
  3437. #--------------------------------------------------------------------------
  3438. def draw_item(index)
  3439. item = @data[index]
  3440. x = 4 + index % 1 * (288 + 32)
  3441. y = index * 32
  3442. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  3443. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3444. bitmap = RPG::Cache.icon(item.icon_name)
  3445. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  3446. self.contents.draw_text(x + 28, y, 204, 32, item.name, 0)
  3447. end
  3448. #--------------------------------------------------------------------------
  3449. # * Help Text Update
  3450. #--------------------------------------------------------------------------
  3451. def update_help
  3452. @help_window.set_item(self.item)
  3453. end
  3454. #--------------------------------------------------------------------------
  3455. end
  3456.  
  3457. #===========================================================
  3458. # ** Window_SkillHelp
  3459. #------------------------------------------------------------------------------
  3460. # This window displays skill effect on the battle screen. Also works for items.
  3461. #===========================================================
  3462.  
  3463. class Window_SkillHelp < Window_Base
  3464. #--------------------------------------------------------------------------
  3465. # * Object Initialization
  3466. #--------------------------------------------------------------------------
  3467. def initialize
  3468. super(240, 128, 240, 256)
  3469. self.back_opacity = 160
  3470. self.contents = Bitmap.new(width - 32, height - 32)
  3471. self.z = 7000
  3472. end
  3473. #--------------------------------------------------------------------------
  3474. # * Set skill
  3475. #--------------------------------------------------------------------------
  3476. def set_skill(skill, actor)
  3477. if @skill != skill || @actor != actor
  3478. @skill = skill
  3479. @actor = actor
  3480. self.contents.clear
  3481. draw_skill_hp_cost if !$game_system.vanguards_sp
  3482. draw_skill_sp_cost if $game_system.vanguards_sp
  3483. draw_skill_description
  3484. end
  3485. end
  3486. #--------------------------------------------------------------------------
  3487. # * Set item
  3488. #--------------------------------------------------------------------------
  3489. def set_item(item)
  3490. if @skill != item
  3491. @skill = item
  3492. self.contents.clear
  3493. draw_item_number
  3494. draw_skill_description
  3495. end
  3496. end
  3497. #--------------------------------------------------------------------------
  3498. # * Draw the hp cost of the skill
  3499. #--------------------------------------------------------------------------
  3500. def draw_skill_hp_cost
  3501. self.contents.font.color = system_color
  3502. self.contents.font.italic = true
  3503. self.contents.draw_text(0, 0, 96, 32, 'HP Cost')
  3504. self.contents.font.color = normal_color
  3505. self.contents.draw_text(87, 0, 96, 32, ((@actor.maxhp * @skill.sp_cost) / 100).to_s)
  3506. self.contents.font.italic = false
  3507. end
  3508. #--------------------------------------------------------------------------
  3509. # * Draw the sp cost of the skill
  3510. #--------------------------------------------------------------------------
  3511. def draw_skill_sp_cost
  3512. self.contents.font.color = system_color
  3513. self.contents.font.italic = true
  3514. self.contents.draw_text(0, 0, 96, 32, 'SP Cost')
  3515. self.contents.font.color = normal_color
  3516. self.contents.draw_text(87, 0, 96, 32, @skill.sp_cost.to_s)
  3517. self.contents.font.italic = false
  3518. end
  3519. #--------------------------------------------------------------------------
  3520. # * Draw skill description
  3521. #--------------------------------------------------------------------------
  3522. def draw_skill_description
  3523. # Break the text in lines
  3524. lines, last_word, current_text = [], 0, ''
  3525. text = @skill.description.clone
  3526. (0..text.size).each do |i|
  3527. if text[i, 1] == ' ' || i == text.size || text[i, 2] == "\n"
  3528. word = text[last_word, i-last_word]
  3529. if self.contents.text_size("#{current_text} #{word}").width > (self.width - 32) ||
  3530. word.include?("\n")
  3531. lines.push(current_text)
  3532. current_text = word
  3533. else
  3534. current_text += (current_text == '' ? word : " #{word}")
  3535. end
  3536. last_word = i+1
  3537. end
  3538. end
  3539. lines.push("#{current_text} #{text[last_word, text.size-last_word]}")
  3540. # Draw the text
  3541. self.contents.font.color = normal_color
  3542. lines.each_index {|i| self.contents.draw_text(0, 32 + 32 * i, self.width - 32, 32, lines[i])}
  3543. end
  3544. #--------------------------------------------------------------------------
  3545. # * Draw the number possessed of an item
  3546. #--------------------------------------------------------------------------
  3547. def draw_item_number
  3548. self.contents.font.color = system_color
  3549. self.contents.font.italic = true
  3550. self.contents.draw_text(0, 0, 96, 32, 'Possessed')
  3551. self.contents.font.color = normal_color
  3552. self.contents.draw_text(103, 0, 96, 32, $game_party.item_number(@skill.id).to_s)
  3553. self.contents.font.italic = false
  3554. end
  3555. #--------------------------------------------------------------------------
  3556. end
  3557.  
  3558. #===========================================================
  3559. # ** Window_SongHelp
  3560. #------------------------------------------------------------------------------
  3561. # This window displays Song Magic effect on the battle screen
  3562. #===========================================================
  3563.  
  3564. class Window_SongHelp < Window_Base
  3565. #--------------------------------------------------------------------------
  3566. # * Object Initialization
  3567. #--------------------------------------------------------------------------
  3568. def initialize
  3569. super(240, 128, 320, 256)
  3570. self.back_opacity = 160
  3571. self.contents = Bitmap.new(width - 32, height - 32)
  3572. self.z = 7000
  3573. end
  3574. #--------------------------------------------------------------------------
  3575. # * Set skill
  3576. #--------------------------------------------------------------------------
  3577. def set_skill(skill)
  3578. if @skill != skill
  3579. @skill = skill
  3580. self.contents.clear
  3581. draw_skill_category
  3582. draw_ruler
  3583. draw_skill_sp_cost
  3584. draw_skill_description
  3585. draw_burst_evolutions
  3586. end
  3587. end
  3588. #--------------------------------------------------------------------------
  3589. # * Draw Song Magic category (Red or Blue)
  3590. #--------------------------------------------------------------------------
  3591. def draw_skill_category
  3592. category = @skill.scope == 2 ? KreadCFG::SongRed : KreadCFG::SongBlue
  3593. self.contents.font.color = system_color
  3594. self.contents.draw_text(0, 0, 240, 32, category)
  3595. end
  3596. #--------------------------------------------------------------------------
  3597. # * Draw ruler
  3598. #--------------------------------------------------------------------------
  3599. def draw_ruler
  3600. self.contents.font.name = 'Arial'
  3601. self.contents.font.size = 16
  3602. char_size = self.contents.text_size('_').width
  3603. self.contents.draw_text(0, 8, self.width - 40, 32, '_' * ((self.width - 40) / char_size), 1)
  3604. self.contents.font.name = Font.default_name
  3605. self.contents.font.size = Font.default_size
  3606. end
  3607. #--------------------------------------------------------------------------
  3608. # * Draw the sp cost of the skill
  3609. #--------------------------------------------------------------------------
  3610. def draw_skill_sp_cost
  3611. self.contents.font.italic = true
  3612. self.contents.draw_text(0, 192, 96, 32, 'SP Rate')
  3613. self.contents.font.color = normal_color
  3614. self.contents.draw_text(72, 192, 96, 32, @skill.sp_cost.to_s)
  3615. self.contents.font.italic = false
  3616. end
  3617. #--------------------------------------------------------------------------
  3618. # * Draw skill description
  3619. #--------------------------------------------------------------------------
  3620. def draw_skill_description
  3621. # Break the text in lines
  3622. @lines, last_word, current_text = [], 0, ''
  3623. text = @skill.description.clone
  3624. (0..text.size).each do |i|
  3625. if text[i, 1] == ' ' || i == text.size || text[i, 2] == "\n"
  3626. word = text[last_word, i-last_word]
  3627. if self.contents.text_size("#{current_text} #{word}").width > (self.width - 32) ||
  3628. word.include?("\n")
  3629. @lines.push(current_text)
  3630. current_text = word
  3631. else
  3632. current_text += (current_text == '' ? word : " #{word}")
  3633. end
  3634. last_word = i+1
  3635. end
  3636. end
  3637. @lines.push("#{current_text} #{text[last_word, text.size-last_word]}")
  3638. # Draw the text
  3639. self.contents.font.color = normal_color
  3640. @lines.each_index {|i| self.contents.draw_text(0, 32 + 32 * i, self.width - 32, 32, @lines[i])}
  3641. end
  3642. #--------------------------------------------------------------------------
  3643. # * Draw burst evolutions
  3644. #--------------------------------------------------------------------------
  3645. def draw_burst_evolutions
  3646. # Checks evolution pattern
  3647. pattern = []
  3648. bursts = []
  3649. new_skill = @skill.id
  3650. while new_skill != nil
  3651. unless new_skill == @skill.id
  3652. pattern.push($data_skills[new_skill])
  3653. bursts.push(KreadCFG::SongMagicMaxBurst[new_skill])
  3654. end
  3655. new_skill = KreadCFG::SongMagicEvolve[new_skill]
  3656. end
  3657. # Draws the pattern on the window
  3658. return if pattern.size == 0
  3659. y = 32 + 32 * @lines.size
  3660. self.contents.font.color = system_color
  3661. self.contents.font.italic = true
  3662. (0...pattern.size).each {|i|
  3663. self.contents.draw_text(0, y + i * 32, 320, 32,
  3664. "Becomes #{pattern[i].name} at #{bursts[i]}%.")
  3665. }
  3666. end
  3667. #--------------------------------------------------------------------------
  3668. end
  3669.  
  3670. #===========================================================
  3671. # ** Battle_Status
  3672. #------------------------------------------------------------------------------
  3673. # Displays the status of a party member on the battle screen.
  3674. #===========================================================
  3675.  
  3676. class Battle_Status < Window_Base
  3677. #--------------------------------------------------------------------------
  3678. # * Object Initialization
  3679. #--------------------------------------------------------------------------
  3680. def initialize(actor_index)
  3681. super(432, 0, 240, 96)
  3682. self.contents = Bitmap.new(width - 32, height - 32)
  3683. self.contents.font.name = ['Staccato222 BT', 'Arial']
  3684. self.contents.font.size = 20
  3685. self.z = 900
  3686. self.opacity = 0
  3687. # Get actor
  3688. @actor = $game_party.actors[actor_index]
  3689. refresh
  3690. end
  3691. #--------------------------------------------------------------------------
  3692. # * Refresh
  3693. #--------------------------------------------------------------------------
  3694. def refresh
  3695. self.contents.clear
  3696. # Create the background
  3697. if !KreadCFG.is_reyvateil?(@actor) && !$game_system.vanguards_sp
  3698. back = RPG::Cache.picture('Status_Window2')
  3699. else
  3700. back = RPG::Cache.picture('Status_Window')
  3701. end
  3702. self.contents.blt(0, 0, back, back.rect)
  3703. # Create the face
  3704. face = RPG::Cache.picture("Status_Window_#{@actor.name}")
  3705. self.contents.blt(144, 4, face, face.rect)
  3706. # Display HP and SP
  3707. refresh_hp
  3708. refresh_sp
  3709. end
  3710. #--------------------------------------------------------------------------
  3711. # * Draws current and max HP
  3712. #--------------------------------------------------------------------------
  3713. def refresh_hp
  3714. # Computes HP / Max HP ratio
  3715. ratio = @actor.hp.to_f / @actor.maxhp.to_f
  3716. # Draws Bar
  3717. bar = RPG::Cache.picture('HpBar_Full')
  3718. rect = Rect.new(0, 0, (ratio * bar.width).round, bar.height)
  3719. self.contents.blt(49, 22, bar, rect)
  3720. first_text_size = self.contents.text_size(@actor.hp.to_s).width
  3721. second_text_size = self.contents.text_size("/#{@actor.maxhp}").width
  3722. # Draws the values
  3723. self.contents.font.color = @actor.hp == 0 ? Color.new(255, 64, 0) :
  3724. (@actor.hp <= @actor.maxhp / 4) ? Color.new(255, 255, 64) : Color.new(255, 255, 255)
  3725. self.contents.draw_outlined_text(48, 0, bar.width - second_text_size, 32, @actor.hp.to_s, 1)
  3726. self.contents.font.color = Color.new(255, 255, 255)
  3727. self.contents.draw_outlined_text(48 + first_text_size, 0, bar.width - first_text_size, 32,
  3728. "/#{@actor.maxhp}", 1)
  3729. end
  3730. #--------------------------------------------------------------------------
  3731. # * Draws current and max SP
  3732. #--------------------------------------------------------------------------
  3733. def refresh_sp
  3734. # Quit in the actor is a vanguard and SP usage disabled
  3735. return if !KreadCFG.is_reyvateil?(@actor) && !$game_system.vanguards_sp
  3736. # Computes SP / Max SP ratio
  3737. ratio = @actor.sp.to_f / @actor.maxsp.to_f
  3738. # Draws Bar
  3739. bar = RPG::Cache.picture('SpBar_Full')
  3740. rect = Rect.new(0, 0, (ratio * bar.width).round, bar.height)
  3741. self.contents.blt(49, 42, bar, rect)
  3742. first_text_size = self.contents.text_size(@actor.sp.to_s).width
  3743. second_text_size = self.contents.text_size("/#{@actor.maxsp}").width
  3744. # Draws the values
  3745. self.contents.font.color = @actor.sp == 0 ? Color.new(255, 64, 0) :
  3746. (@actor.sp <= @actor.maxsp / 4) ? Color.new(255, 255, 64) : Color.new(255, 255, 255)
  3747. self.contents.draw_outlined_text(48, 20, bar.width - second_text_size, 32, @actor.sp.to_s, 1)
  3748. self.contents.font.color = Color.new(255, 255, 255)
  3749. self.contents.draw_outlined_text(48 + first_text_size, 20, bar.width - first_text_size, 32,
  3750. "/#{@actor.maxsp}", 1)
  3751. end
  3752. #--------------------------------------------------------------------------
  3753. # * Draws current and max SP (Reyvateil chanting only)
  3754. #--------------------------------------------------------------------------
  3755. def refresh_sp_only
  3756. # Clears the SP part of the bitmap
  3757. crop = RPG::Cache.picture('Status_Window_Crop')
  3758. self.contents.fill_rect(4, 28, 140, 20, Color.new(0, 0, 0, 0))
  3759. self.contents.blt(4, 28, crop, crop.rect)
  3760. # Computes SP / Max SP ratio
  3761. ratio = @actor.sp.to_f / @actor.maxsp.to_f
  3762. # Draw bar
  3763. bar = RPG::Cache.picture('SpBar_Full')
  3764. rect = Rect.new(0, 0, (ratio * bar.width).round, bar.height)
  3765. self.contents.blt(49, 42, bar, rect)
  3766. first_text_size = self.contents.text_size(@actor.sp.to_s).width
  3767. second_text_size = self.contents.text_size("/#{@actor.maxsp}").width
  3768. # Draws the values
  3769. self.contents.font.color = @actor.sp == 0 ? Color.new(255, 64, 0) :
  3770. (@actor.sp <= @actor.maxsp / 4) ? Color.new(255, 255, 64) : Color.new(255, 255, 255)
  3771. self.contents.draw_outlined_text(48, 20, bar.width - second_text_size, 32, @actor.sp.to_s, 1)
  3772. self.contents.font.color = Color.new(255, 255, 255)
  3773. self.contents.draw_outlined_text(48 + first_text_size, 20, bar.width - first_text_size, 32,
  3774. "/#{@actor.maxsp}", 1)
  3775. end
  3776. #--------------------------------------------------------------------------
  3777. end
  3778.  
  3779. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  3780. # Ar Tonelico Custom Battle System
  3781. # Author: Kread-EX
  3782. # Version 1.1
  3783. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  3784.  
  3785. #===========================================================
  3786. # ** Game_System
  3787. #------------------------------------------------------------------------------
  3788. # This class handles data surrounding the system. Backround music, etc.
  3789. # is managed here as well. Refer to "$game_system" for the instance of
  3790. # this class.
  3791. #===========================================================
  3792.  
  3793. class Game_System
  3794. #--------------------------------------------------------------------------
  3795. # * Public Instance Variables
  3796. #--------------------------------------------------------------------------
  3797. attr_accessor :ambiance_field # If true, the ambiance field is activated
  3798. attr_accessor :vanguards_sp # If true, the front liners use SP for their skills
  3799. #--------------------------------------------------------------------------
  3800. # * Object Initialization
  3801. #--------------------------------------------------------------------------
  3802. alias_method :krx_atcbs_initialize, :initialize
  3803. def initialize
  3804. krx_atcbs_initialize
  3805. @ambiance_field = true
  3806. @vanguards_sp = false
  3807. end
  3808. #--------------------------------------------------------------------------
  3809. end
  3810.  
  3811. #===========================================================
  3812. # ** Game_Battler
  3813. #------------------------------------------------------------------------------
  3814. # This class deals with battlers. It's used as a superclass for the Game_Actor
  3815. # and Game_Enemy classes.
  3816. #===========================================================
  3817.  
  3818. class Game_Battler
  3819. #--------------------------------------------------------------------------
  3820. # * Public Instance Variables
  3821. #--------------------------------------------------------------------------
  3822. attr_accessor :action_meter # Sort of ATB counter - roughly
  3823. attr_accessor :song_chant # If true, the a song is currently active
  3824. attr_accessor :song_blue # If true, the current song is Blue Magic
  3825. attr_accessor :burst_value # Actual burst value for the song
  3826. attr_accessor :harmonics # Actual harmonics value (Reyvateil only)
  3827. attr_accessor :loop_animation_id # ID of the looping animation
  3828. #--------------------------------------------------------------------------
  3829. # * Object Initialization
  3830. #--------------------------------------------------------------------------
  3831. alias_method :krx_atcbs_initialize, :initialize
  3832. def initialize
  3833. krx_atcbs_initialize
  3834. @action_meter = 0
  3835. @song_chant = false
  3836. @song_blue = false
  3837. @burst_value = 0
  3838. @harmonics = 0
  3839. @loop_animation_id = 0
  3840. @damage = []
  3841. end
  3842. #--------------------------------------------------------------------------
  3843. # * Determine Usable Skills
  3844. # skill_id : skill ID
  3845. #--------------------------------------------------------------------------
  3846. def skill_can_use?(skill_id)
  3847. # Check HP requirements.
  3848. if !$game_system.vanguards_sp
  3849. if self.is_a?(Game_Actor) && !KreadCFG.is_reyvateil?(self)
  3850. return false if self.hp <= (self.maxhp * $data_skills[skill_id].sp_cost) / 100
  3851. end
  3852. end
  3853. # In case of Harmo Overdrive, need the correct amount of Harmonics
  3854. if KreadCFG::HarmoOverdriveSkills.include?(skill_id) && self.is_a?(Game_Actor)
  3855. if $game_party.global_harmonics < $game_temp.max_harmonics
  3856. return false
  3857. end
  3858. end
  3859. # If there's not enough SP, the skill cannot be used.
  3860. if $data_skills[skill_id].sp_cost > self.sp
  3861. return false
  3862. end
  3863. # Unusable if incapacitated
  3864. if dead?
  3865. return false
  3866. end
  3867. # If silent, only physical skills can be used
  3868. if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
  3869. return false
  3870. end
  3871. # Get usable time
  3872. occasion = $data_skills[skill_id].occasion
  3873. # If in battle
  3874. if $game_temp.in_battle
  3875. # Usable with [Normal] and [Only Battle]
  3876. return (occasion == 0 or occasion == 1)
  3877. # If not in battle
  3878. else
  3879. # Usable with [Normal] and [Only Menu]
  3880. return (occasion == 0 or occasion == 2)
  3881. end
  3882. end
  3883. #--------------------------------------------------------------------------
  3884. # * Applying Normal Attack Effects
  3885. # attacker : battler
  3886. #--------------------------------------------------------------------------
  3887. def attack_effect(attacker)
  3888. # Clear critical flag
  3889. self.critical = false
  3890. # First hit detection
  3891. hit_result = (rand(100) < attacker.hit)
  3892. # If hit occurs
  3893. if hit_result == true
  3894. # Calculate basic damage
  3895. atk = [attacker.atk - self.pdef / 2, 0].max
  3896. self.damage[0] = atk * (20 + attacker.str) / 20
  3897. # Element correction
  3898. self.damage[0] *= elements_correct(attacker.element_set)
  3899. self.damage[0] /= 100
  3900. # If damage value is strictly positive
  3901. if self.damage[0] > 0
  3902. # Critical correction
  3903. if rand(100) < 4 * attacker.dex / self.agi
  3904. self.damage[0] *= 2
  3905. self.critical = true
  3906. end
  3907. # Guard correction
  3908. self.damage[0] /= 2 if self.guarding?
  3909. end
  3910. # Dispersion
  3911. if self.damage[0].abs > 0
  3912. amp = [self.damage[0].abs * 15 / 100, 1].max
  3913. self.damage[0] += rand(amp+1) + rand(amp+1) - amp
  3914. end
  3915. # Second hit detection
  3916. eva = 8 * self.agi / attacker.dex + self.eva
  3917. hit = self.damage[0] < 0 ? 100 : 100 - eva
  3918. hit = self.cant_evade? ? 100 : hit
  3919. hit_result = (rand(100) < hit)
  3920. end
  3921. # If hit occurs
  3922. if hit_result == true
  3923. # State Removed by Shock
  3924. remove_states_shock
  3925. # Substract damage from HP
  3926. self.hp -= self.damage[0]
  3927. # Raise Ambiance Field
  3928. if $game_system.ambiance_field
  3929. @ambiance_field = [(@ambiance_field + 1), 3].min if self.is_a?(Game_Enemy)
  3930. end
  3931. # State change
  3932. @state_changed = false
  3933. states_plus(attacker.plus_state_set)
  3934. states_minus(attacker.minus_state_set)
  3935. # Update harmonics
  3936. if attacker.is_a?(Game_Actor)
  3937. $scene.vanguards_harmonics += 50
  3938. else
  3939. if KreadCFG.return_reyvateil == self
  3940. $scene.reyvateil_harmonics -= 50
  3941. else
  3942. $scene.vanguards_harmonics -= 50
  3943. end
  3944. end
  3945. # When missing
  3946. else
  3947. # Set damage to "Miss"
  3948. self.damage[0] = 'Miss'
  3949. # Clear critical flag
  3950. self.critical = false
  3951. end
  3952. # End Method
  3953. return true
  3954. end
  3955. #--------------------------------------------------------------------------
  3956. # * Apply Skill Effects
  3957. # user : the one using skills (battler)
  3958. # skill : skill
  3959. #--------------------------------------------------------------------------
  3960. def skill_effect(user, skill, hit_number = 0)
  3961. # Clear critical flag
  3962. self.critical = false
  3963. # If skill scope is for ally with 1 or more HP, and your own HP = 0,
  3964. # or skill scope is for ally with 0, and your own HP = 1 or more
  3965. if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  3966. ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  3967. # End Method
  3968. return false
  3969. end
  3970. # Clear effective flag
  3971. effective = false
  3972. # Set effective flag if common ID is effective
  3973. effective |= skill.common_event_id > 0
  3974. # First hit detection
  3975. hit = skill.hit
  3976. if skill.atk_f > 0
  3977. hit *= user.hit / 100
  3978. end
  3979. hit_result = (rand(100) < hit)
  3980. # Set effective flag if skill is uncertain
  3981. effective |= hit < 100
  3982. # If hit occurs
  3983. if hit_result == true
  3984. # Calculate power
  3985. power = skill.power + user.atk * skill.atk_f / 100
  3986. if power > 0
  3987. power -= self.pdef * skill.pdef_f / 200
  3988. power -= self.mdef * skill.mdef_f / 200
  3989. power = [power, 0].max
  3990. end
  3991. # Calculate rate
  3992. rate = 20
  3993. rate += (user.str * skill.str_f / 100)
  3994. rate += (user.dex * skill.dex_f / 100)
  3995. rate += (user.agi * skill.agi_f / 100)
  3996. rate += (user.int * skill.int_f / 100)
  3997. # Calculate basic damage
  3998. self.damage[hit_number] = power * rate / 20
  3999. # Element correction
  4000. self.damage[hit_number] *= elements_correct(skill.element_set)
  4001. self.damage[hit_number] /= 100
  4002. # If damage value is strictly positive
  4003. if self.damage[hit_number] > 0
  4004. # Raise Ambiance Field
  4005. @ambiance_field = [(@ambiance_field + 1), 3].min if self.is_a?(Game_Enemy)
  4006. # Guard correction
  4007. if self.guarding?
  4008. self.damage[hit_number] /= 2
  4009. end
  4010. end
  4011. # Dispersion
  4012. if skill.variance > 0 and self.damage[-1].abs > 0
  4013. amp = [self.damage[hit_number].abs * skill.variance / 100, 1].max
  4014. self.damage[hit_number] += rand(amp+1) + rand(amp+1) - amp
  4015. end
  4016. # Second hit detection
  4017. eva = 8 * self.agi / user.dex + self.eva
  4018. hit = self.damage[hit_number] < 0 ? 100 : 100 - eva * skill.eva_f / 100
  4019. hit = self.cant_evade? ? 100 : hit
  4020. hit_result = (rand(100) < hit)
  4021. # Set effective flag if skill is uncertain
  4022. effective |= hit < 100
  4023. end
  4024. # If hit occurs
  4025. if hit_result == true
  4026. # Update harmonics
  4027. if hit_number == 0 && !KreadCFG::HarmoOverdriveSkills.include?(skill.id) && skill.scope < 3
  4028. if user.is_a?(Game_Actor)
  4029. $scene.vanguards_harmonics += skill.scope == 1 ? 80 : 20
  4030. else
  4031. if KreadCFG.return_reyvateil == self
  4032. $scene.reyvateil_harmonics -= 80
  4033. else
  4034. $scene.vanguards_harmonics -= skill.scope == 1 ? 80 : 20
  4035. end
  4036. end
  4037. end
  4038. # If physical attack has power other than 0
  4039. if skill.power != 0 and skill.atk_f > 0
  4040. # State Removed by Shock
  4041. remove_states_shock
  4042. # Set to effective flag
  4043. effective = true
  4044. end
  4045. # Substract damage from HP
  4046. last_hp = self.hp
  4047. self.hp -= self.damage[hit_number]
  4048. effective |= self.hp != last_hp
  4049. # State change
  4050. @state_changed = false
  4051. effective |= states_plus(skill.plus_state_set)
  4052. effective |= states_minus(skill.minus_state_set)
  4053. # If power is 0
  4054. if skill.power == 0
  4055. # Set damage to an empty string
  4056. self.damage[hit_number] = ''
  4057. # If state is unchanged
  4058. unless @state_changed
  4059. # Set damage to "Miss"
  4060. self.damage[hit_number] = 'Miss'
  4061. end
  4062. end
  4063. # If miss occurs
  4064. else
  4065. # Set damage to "Miss"
  4066. self.damage[hit_number] = 'Miss'
  4067. end
  4068. # If not in battle
  4069. unless $game_temp.in_battle
  4070. # Set damage to an empty array
  4071. self.damage = []
  4072. end
  4073. # End Method
  4074. return effective
  4075. end
  4076. #--------------------------------------------------------------------------
  4077. # * Apply Song Magic effects
  4078. # user : the Reyvateil
  4079. # skill : skill
  4080. #--------------------------------------------------------------------------
  4081. def song_effect(user, skill, hit_number = 0)
  4082. # If skill scope is for ally with 1 or more HP, and your own HP = 0,
  4083. # or skill scope is for ally with 0, and your own HP = 1 or more
  4084. if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  4085. ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  4086. # End Method
  4087. return false
  4088. end
  4089. # Song Magic never miss, so no hit detection is performed
  4090. # Power calculation method (for Red Magic only):
  4091. if skill.scope == 2
  4092. power = (([(user.int - self.mdef), 0].max + user.burst_value) * (skill.power / 100.00)).round
  4093. else
  4094. # For Blue Magic, skill base power only
  4095. power = skill.power
  4096. power -= user.int if power != 0
  4097. end
  4098. self.damage[hit_number] = power
  4099. # Ambiance Field correction
  4100. self.damage[hit_number] += (@ambiance_field / 3) * power if self.damage[hit_number] > 0
  4101. # Element correction
  4102. self.damage[hit_number] *= elements_correct(skill.element_set)
  4103. self.damage[hit_number] /= 100
  4104. # Dispersion
  4105. if skill.variance > 0 and self.damage[hit_number].abs > 0
  4106. amp = [self.damage[hit_number].abs * skill.variance / 100, 1].max
  4107. self.damage[hit_number] += rand(amp+1) + rand(amp+1) - amp
  4108. end
  4109. # Substract damage from HP
  4110. last_hp = self.hp
  4111. self.hp -= self.damage[hit_number]
  4112. return true
  4113. end
  4114. #--------------------------------------------------------------------------
  4115. # * Application of Item Effects
  4116. # item : item
  4117. #--------------------------------------------------------------------------
  4118. def item_effect(item)
  4119. # Clear critical flag
  4120. self.critical = false
  4121. # If item scope is for ally with 1 or more HP, and your own HP = 0,
  4122. # or item scope is for ally with 0 HP, and your own HP = 1 or more
  4123. if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
  4124. ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  4125. # End Method
  4126. return false
  4127. end
  4128. # Clear effective flag
  4129. effective = false
  4130. # Set effective flag if common ID is effective
  4131. effective |= item.common_event_id > 0
  4132. # Determine hit
  4133. hit_result = (rand(100) < item.hit)
  4134. # Set effective flag is skill is uncertain
  4135. effective |= item.hit < 100
  4136. # If hit occurs
  4137. if hit_result == true
  4138. # Calculate amount of recovery
  4139. recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
  4140. recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
  4141. if recover_hp < 0
  4142. recover_hp += self.pdef * item.pdef_f / 20
  4143. recover_hp += self.mdef * item.mdef_f / 20
  4144. recover_hp = [recover_hp, 0].min
  4145. end
  4146. # Element correction
  4147. recover_hp *= elements_correct(item.element_set)
  4148. recover_hp /= 100
  4149. recover_sp *= elements_correct(item.element_set)
  4150. recover_sp /= 100
  4151. # Dispersion
  4152. if item.variance > 0 and recover_hp.abs > 0
  4153. amp = [recover_hp.abs * item.variance / 100, 1].max
  4154. recover_hp += rand(amp+1) + rand(amp+1) - amp
  4155. end
  4156. if item.variance > 0 and recover_sp.abs > 0
  4157. amp = [recover_sp.abs * item.variance / 100, 1].max
  4158. recover_sp += rand(amp+1) + rand(amp+1) - amp
  4159. end
  4160. # If recovery code is negative
  4161. if recover_hp < 0
  4162. # Guard correction
  4163. if self.guarding?
  4164. recover_hp /= 2
  4165. end
  4166. end
  4167. # Set damage value and reverse HP recovery amount
  4168. self.damage << -recover_hp
  4169. # HP and SP recovery
  4170. last_hp = self.hp
  4171. last_sp = self.sp
  4172. self.hp += recover_hp
  4173. self.sp += recover_sp
  4174. effective |= self.hp != last_hp
  4175. effective |= self.sp != last_sp
  4176. # State change
  4177. @state_changed = false
  4178. effective |= states_plus(item.plus_state_set)
  4179. effective |= states_minus(item.minus_state_set)
  4180. # If parameter value increase is effective
  4181. if item.parameter_type > 0 and item.parameter_points != 0
  4182. # Branch by parameter
  4183. case item.parameter_type
  4184. when 1 # Max HP
  4185. @maxhp_plus += item.parameter_points
  4186. when 2 # Max SP
  4187. @maxsp_plus += item.parameter_points
  4188. when 3 # Strength
  4189. @str_plus += item.parameter_points
  4190. when 4 # Dexterity
  4191. @dex_plus += item.parameter_points
  4192. when 5 # Agility
  4193. @agi_plus += item.parameter_points
  4194. when 6 # Intelligence
  4195. @int_plus += item.parameter_points
  4196. end
  4197. # Set to effective flag
  4198. effective = true
  4199. end
  4200. # If HP recovery rate and recovery amount are 0
  4201. if item.recover_hp_rate == 0 and item.recover_hp == 0
  4202. # Set damage to empty string
  4203. self.damage << ''
  4204. # If SP recovery rate / recovery amount are 0, and parameter increase
  4205. # value is ineffective.
  4206. if item.recover_sp_rate == 0 and item.recover_sp == 0 and
  4207. (item.parameter_type == 0 or item.parameter_points == 0)
  4208. # If state is unchanged
  4209. unless @state_changed
  4210. # Set damage to "Miss"
  4211. self.damage << 'Miss'
  4212. end
  4213. end
  4214. end
  4215. # If miss occurs
  4216. else
  4217. # Set damage to "Miss"
  4218. self.damage << 'Miss'
  4219. end
  4220. # If not in battle
  4221. unless $game_temp.in_battle
  4222. # Set damage to an empty array
  4223. self.damage = []
  4224. end
  4225. # End Method
  4226. return effective
  4227. end
  4228. #--------------------------------------------------------------------------
  4229. # * Application of Slip Damage Effects
  4230. #--------------------------------------------------------------------------
  4231. def slip_damage_effect
  4232. # Set damage
  4233. self.damage << self.maxhp / 10
  4234. # Dispersion
  4235. if self.damage[-1].abs > 0
  4236. amp = [self.damage[-1].abs * 15 / 100, 1].max
  4237. self.damage[-1] += rand(amp+1) + rand(amp+1) - amp
  4238. end
  4239. # Subtract damage from HP
  4240. self.hp -= self.damage[-1]
  4241. # End Method
  4242. return true
  4243. end
  4244. #--------------------------------------------------------------------------
  4245. end
  4246.  
  4247. #===========================================================
  4248. # ** Game_Enemy
  4249. #------------------------------------------------------------------------------
  4250. # This class handles enemies. It's used within the Game_Troop class
  4251. # ($game_troop).
  4252. #===========================================================
  4253.  
  4254. class Game_Enemy < Game_Battler
  4255. #--------------------------------------------------------------------------
  4256. # * Public Instance Variables
  4257. #--------------------------------------------------------------------------
  4258. attr_accessor :ambiance_field
  4259. #--------------------------------------------------------------------------
  4260. # * Object Initialization
  4261. #--------------------------------------------------------------------------
  4262. alias_method :krx_atcbs_game_enemy_initialize, :initialize
  4263. def initialize(troop_id, member_index)
  4264. @ambiance_field = 0
  4265. krx_atcbs_game_enemy_initialize(troop_id, member_index)
  4266. end
  4267. #--------------------------------------------------------------------------
  4268. # * Make Action
  4269. #--------------------------------------------------------------------------
  4270. def make_action
  4271. # Clear current action
  4272. self.current_action.clear
  4273. # If unable to move
  4274. unless self.movable?
  4275. # End Method
  4276. return
  4277. end
  4278. # Extract current effective actions
  4279. available_actions = []
  4280. rating_max = 0
  4281. for action in self.actions
  4282. # Confirm turn conditions
  4283. n = $game_temp.battle_turn
  4284. a = action.condition_turn_a
  4285. b = action.condition_turn_b
  4286. if (b == 0 and n != a) or
  4287. (b > 0 and (n < 1 or n < a or n % b != a % b))
  4288. next
  4289. end
  4290. # Confirm HP conditions
  4291. if self.hp * 100.0 / self.maxhp > action.condition_hp
  4292. next
  4293. end
  4294. # Confirm level conditions
  4295. if $game_party.max_level < action.condition_level
  4296. next
  4297. end
  4298. # Confirm switch conditions
  4299. switch_id = action.condition_switch_id
  4300. if switch_id > 0 and $game_switches[switch_id] == false
  4301. next
  4302. end
  4303. # Add this action to applicable conditions
  4304. available_actions.push(action)
  4305. if action.rating > rating_max
  4306. rating_max = action.rating
  4307. end
  4308. end
  4309. # Calculate total with max rating value at 3 (exclude 0 or less)
  4310. ratings_total = 0
  4311. for action in available_actions
  4312. if action.rating > rating_max - 3
  4313. ratings_total += action.rating - (rating_max - 3)
  4314. end
  4315. end
  4316. # If ratings total isn't 0
  4317. if ratings_total > 0
  4318. # Create random numbers
  4319. value = rand(ratings_total)
  4320. # Set things that correspond to created random numbers as current action
  4321. for action in available_actions
  4322. if action.rating > rating_max - 3
  4323. if value < action.rating - (rating_max - 3)
  4324. self.current_action.kind = action.kind
  4325. self.current_action.basic = action.basic
  4326. self.current_action.skill_id = action.skill_id
  4327. self.current_action.decide_random_target_for_enemy
  4328. case action.kind
  4329. when 0
  4330. self.action_meter = self.agi
  4331. when 1
  4332. self.action_meter = self.agi * KreadCFG.skill_speed(action.skill_id)
  4333. end
  4334. return
  4335. else
  4336. value -= action.rating - (rating_max - 3)
  4337. end
  4338. end
  4339. end
  4340. end
  4341. end
  4342. #--------------------------------------------------------------------------
  4343. end
  4344.  
  4345. #===========================================================
  4346. # ** Game_Party
  4347. #------------------------------------------------------------------------------
  4348. # This class handles the party. It includes information on amount of gold
  4349. # and items. Refer to "$game_party" for the instance of this class.
  4350. #===========================================================
  4351.  
  4352. class Game_Party
  4353. #--------------------------------------------------------------------------
  4354. # * Public Instance Variables
  4355. #--------------------------------------------------------------------------
  4356. attr_reader :harmonics # Vanguards Harmonics, without Reyvateil value
  4357. #--------------------------------------------------------------------------
  4358. # * Object Initialization
  4359. #--------------------------------------------------------------------------
  4360. alias_method :krx_atcbs_initialize, :initialize
  4361. def initialize
  4362. krx_atcbs_initialize # Original call
  4363. @harmonics = 0
  4364. end
  4365. #--------------------------------------------------------------------------
  4366. # * Change Harmonic value
  4367. #--------------------------------------------------------------------------
  4368. def harmonics=(harmonics)
  4369. @harmonics = harmonics
  4370. if self.global_harmonics > $game_temp.max_harmonics
  4371. substract = KreadCFG.return_reyvateil == nil ? 0 : KreadCFG.return_reyvateil.harmonics
  4372. @harmonics = $game_temp.max_harmonics - substract
  4373. end
  4374. end
  4375. #--------------------------------------------------------------------------
  4376. # * Returns Global Harmonics value
  4377. #--------------------------------------------------------------------------
  4378. def global_harmonics
  4379. return @harmonics if KreadCFG.return_reyvateil == nil
  4380. return (@harmonics + KreadCFG.return_reyvateil.harmonics)
  4381. end
  4382. #--------------------------------------------------------------------------
  4383. end
  4384.  
  4385. #===========================================================
  4386. # ** Game_Temp
  4387. #------------------------------------------------------------------------------
  4388. # This class handles temporary data that is not included with save data.
  4389. # Refer to "$game_temp" for the instance of this class.
  4390. #===========================================================
  4391.  
  4392. class Game_Temp
  4393. #--------------------------------------------------------------------------
  4394. # * Public Instance Variables
  4395. #--------------------------------------------------------------------------
  4396. attr_accessor :max_harmonics
  4397. #--------------------------------------------------------------------------
  4398. # * Object Initialization
  4399. #--------------------------------------------------------------------------
  4400. alias_method :krx_atcbs_initialize, :initialize
  4401. def initialize
  4402. krx_atcbs_initialize
  4403. @max_harmonics = 1000
  4404. end
  4405. #--------------------------------------------------------------------------
  4406. end
  4407.  
Advertisement
Add Comment
Please, Sign In to add comment