Advertisement
Guest User

Untitled

a guest
Aug 13th, 2012
491
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.87 KB | None | 0 0
  1. #===============================================================================
  2. # ** RBS - Ramiro's Battle System (PART III - Actions)
  3. # Version 2.2
  4. # Difficulty Very Hard.
  5. # +little Shield Addon by Stesc
  6. #-------------------------------------------------------------------------------
  7. # If you don't know what to do... DO NOT EDIT THIS FILE.
  8. #-------------------------------------------------------------------------------
  9. # License:
  10. #Copyright (c) 2012, Ramiro Rojo
  11. #All rights reserved.
  12. #
  13. #Redistribution and use in source and binary forms, with or without
  14. #modification, are permitted provided that the following conditions are met:
  15. #
  16. #1. Redistributions of source code must retain the above copyright notice, this
  17. # list of conditions and the following disclaimer.
  18. #2. Redistributions in binary form must reproduce the above copyright notice,
  19. # this list of conditions and the following disclaimer in the documentation
  20. # and/or other materials provided with the distribution.
  21. #
  22. #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  23. #ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  24. #WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. #DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  26. #ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  27. #(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28. #LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  29. #ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31. #SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. #
  33. #The views and conclusions contained in the software and documentation are those
  34. #of the authors and should not be interpreted as representing official policies,
  35. #either expressed or implied, of the FreeBSD Project.
  36. #===============================================================================
  37.  
  38. #==============================================================================
  39. # ¦ Scene_Battle
  40. #==============================================================================
  41.  
  42. class Scene_Battle < Scene_Base
  43.  
  44. def setup_battle_commands
  45.  
  46. # ADDING A COMMAND:
  47. # BattleInterpreter::Commands['command in upercase'] = [needs close, linked method]
  48.  
  49. # <pose: target, character_index, pose_id, style, loops, interval> (WORKS!)
  50. BattleInterpreter::Commands['POSE'] = [false, method(:on_pose_command)]
  51. # <wait: time> (WORKS!)
  52. BattleInterpreter::Commands['WAIT'] = [false, method(:on_wait_command)]
  53. # <move: mover, target, x_correction, y_correction, jump, time> (WORKS!)
  54. BattleInterpreter::Commands['MOVE'] = [false, method(:on_move_command)]
  55. # <zoom: target, zoom_x, zoom_y, time> (WORKS!)
  56. BattleInterpreter::Commands['ZOOM'] = [false, method(:on_zoom_command)]
  57. # <angle: target, angle, time> (WORKS!)
  58. BattleInterpreter::Commands['ANGLE'] = [false, method(:on_angle_command)]
  59. # <opacity: target, opacity, time> (WORKS!)
  60. BattleInterpreter::Commands['OPACITY'] = [false, method(:on_opacity_command)]
  61. # <animation: target, animation_id, flip> (WORKS!)
  62. BattleInterpreter::Commands['ANIMATION'] = [false, method(:on_animation_command)]
  63. # <effects>
  64. BattleInterpreter::Commands['EFFECTS'] = [false, method(:on_effects_command)]
  65. # <if: 'evaluating condition'> (WORKS!)
  66. BattleInterpreter::Commands['IF'] = [true, method(:on_if_command)]
  67. # <repeat: 'times'> (WORKS!)
  68. BattleInterpreter::Commands['REPEAT'] = [true, method(:on_repeat_command)]
  69. # <while: 'evaluating condition'> (WORKS!)
  70. BattleInterpreter::Commands['WHILE'] = [true, method(:on_while_command)]
  71. # <afterimage: target, count, separation> (WORKS!)
  72. BattleInterpreter::Commands['AFTERIMAGE'] = [false, method(:on_afterimage_command)]
  73. # <mirror: target, value> (WORKS!)
  74. BattleInterpreter::Commands['MIRROR'] = [false, method(:on_mirror_command)]
  75. # <show pic: id, name, origin, x, y, zoom_x, zoom_y, opacity, blend_type> (WORKS!)
  76. BattleInterpreter::Commands['SHOW PIC'] = [false, method(:on_show_picture_command)]
  77. # <move pic: id, origin, x, y, zoom_x, zoom_y, opacity, blend_type, duration> (WORKS!)
  78. BattleInterpreter::Commands['MOVE PIC'] = [false, method(:on_move_picture_command)]
  79. # <move pic ex: id, target, x_correction, y_correction, time> (WORKS!)
  80. BattleInterpreter::Commands['MOVE PIC EX'] = [false, method(:on_move_picture_ex_command)]
  81. # <zoom pic ex: id, zoom_x, zoom_y, time> (WORKS!)
  82. BattleInterpreter::Commands['ZOOM PIC'] = [false, method(:on_zoom_picture_command)]
  83. # <opacity pic ex: id, opacity, time> (WORKS!)
  84. BattleInterpreter::Commands['OPACITY PIC'] = [false, method(:on_opacity_picture_command)]
  85. # <anime pic: id, animation_id, flip> (WORKS!)
  86. BattleInterpreter::Commands['ANIME PIC'] = [false, method(:on_anime_picture_command)]
  87. # <rotate pic: id, speed> (WORKS!)
  88. BattleInterpreter::Commands['ROTATE PIC'] = [false, method(:on_rotate_picture_command)]
  89. # <tone pic: id, red, green, blue, gray>, time (WORKS!)
  90. BattleInterpreter::Commands['TONE PIC'] = [false, method(:on_tone_picture_command)]
  91. # <delete pic: id> (WORKS!)
  92. BattleInterpreter::Commands['DELETE PIC'] = [false, method(:on_delete_picture_command)]
  93. # <ruby: script> (WORKS!)
  94. BattleInterpreter::Commands['RUBY'] = [false, method(:on_ruby_script_command)]
  95. # <each process: target> (WORKS!)
  96. BattleInterpreter::Commands['EACH PROCESS'] = [true, method(:on_each_process_command)]
  97. # <change target: target> (WORKS!)
  98. BattleInterpreter::Commands['CHANGE TARGET'] = [false, method(:on_target_change_command)]
  99. # <target change: battler_array> (used by some Commands) (WORKS!)
  100. BattleInterpreter::Commands['TARGET CHANGE EX'] = [false, method(:on_target_change_special_command)]
  101. # <end> (WORKS!)
  102. BattleInterpreter::Commands['END'] = [false, method(:on_end_command)]
  103. # <check counter> (READY!)
  104. BattleInterpreter::Commands['CHECK COUNTER'] = [false, method(:on_counter_check_command)]
  105. # <check reflect> (READY!)
  106. BattleInterpreter::Commands['CHECK REFLECT'] = [false, method(:on_reflect_check_command)]
  107. # <check substitute> (READY!)
  108. BattleInterpreter::Commands['CHECK SUBSTITUTE'] = [false, method(:on_substitute_check_command)]
  109. # <link skill: skill_id, chance> (READY!)
  110. BattleInterpreter::Commands['LINK SKILL'] = [false, method(:on_link_skill_command)]
  111. # <link item: item_id, chance> (READY!)
  112. BattleInterpreter::Commands['LINK ITEM'] = [false, method(:on_link_item_command)]
  113. # <damage>
  114. BattleInterpreter::Commands['DAMAGE'] = [false, method(:on_damage_command)]
  115. # <move camera: target, x, y, time>
  116. BattleInterpreter::Commands['MOVE CAMERA'] = [false, method(:on_move_camera_command)]
  117. # <zoom camera: zoom, time>
  118. BattleInterpreter::Commands['ZOOM CAMERA'] = [false, method(:on_zoom_camera_command)]
  119. # <target camera: target>
  120. BattleInterpreter::Commands['TARGET CAMERA'] = [false, method(:on_target_camera_command)]
  121. # <perform collapse>
  122. BattleInterpreter::Commands['PERFORM COLLAPSE'] = [false, method(:on_perform_collapse_command)]
  123. # <abort>
  124. BattleInterpreter::Commands['ABORT'] = [false, method(:on_abort_command)]
  125. # 1.1 and bigger ===============================================================================
  126. # <weapon: target, x_corr, y_corr, start_angle, end_angle, time, left_hand, over>
  127. BattleInterpreter::Commands['WEAPON'] = [false, method(:on_weapon_command)]
  128. # <shield: target, x_corr, y_corr, start_angle, end_angle, time, over>
  129. BattleInterpreter::Commands['SHIELD'] = [false, method(:on_shield_command)]
  130. # <weapon ex: target, bitmap, x _corr, y_corr, frames, interval, over> (WORKS!)
  131. BattleInterpreter::Commands['WEAPON EX'] = [false, method(:on_weapon_ex_command)]
  132. # <log text: text> (WORKS!)
  133. BattleInterpreter::Commands['LOG TEXT'] = [false, method(:on_log_text_command)]
  134. # <balloon: target, balloon_id> (WORKS!)
  135. BattleInterpreter::Commands['BALLOON'] = [false, method(:on_balloon_command)]
  136. # 1.2 and bigger ===============================================================================
  137. # <fps: frames> (WORKS!)
  138. BattleInterpreter::Commands['FPS'] = [false, method(:on_fps_command)]
  139. # <switch: id, value> (WORKS!)
  140. BattleInterpreter::Commands['SWITCH'] = [false, method(:on_switch_command)]
  141. # <variable: id, value> (WORKS!)
  142. BattleInterpreter::Commands['VARIABLE'] = [false, method(:on_variable_command)]
  143. # <movie: name> (WORKS!)
  144. BattleInterpreter::Commands['MOVIE'] = [false, method(:on_movie_command)]
  145. # <save bgm> (WORKS!)
  146. BattleInterpreter::Commands['SAVE BGM'] = [false, method(:on_save_bgm_command)]
  147. # <replay bgm> (WORKS!)
  148. BattleInterpreter::Commands['REPLAY BGM'] = [false, method(:on_replay_bgm_command)]
  149. # <save bgs> (WORKS!)
  150. BattleInterpreter::Commands['SAVE BGS'] = [false, method(:on_save_bgs_command)]
  151. # <replay bgs> (WORKS!)
  152. BattleInterpreter::Commands['REPLAY BGS'] = [false, method(:on_replay_bgs_command)]
  153. # <play bgm: name, volume, pitch, pos> (WORKS!)
  154. BattleInterpreter::Commands['PLAY BGM'] = [false, method(:on_play_bgm_command)]
  155. # <play bgs: name, volume, pitch, pos> (WORKS!)
  156. BattleInterpreter::Commands['PLAY BGS'] = [false, method(:on_play_bgs_command)]
  157. # <play me: name, volume, pitch> (WORKS!)
  158. BattleInterpreter::Commands['PLAY ME'] = [false, method(:on_play_me_command)]
  159. # <play se: name, volume, pitch> (WORKS!)
  160. BattleInterpreter::Commands['PLAY SE'] = [false, method(:on_play_se_command)]
  161. # <stop bgm> (WORKS!)
  162. BattleInterpreter::Commands['STOP BGM'] = [false, method(:on_stop_bgm_command)]
  163. # <stop bgs> (WORKS!)
  164. BattleInterpreter::Commands['STOP BGS'] = [false, method(:on_stop_bgs_command)]
  165. # <stop me> (WORKS!)
  166. BattleInterpreter::Commands['STOP ME'] = [false, method(:on_stop_me_command)]
  167. # <stop se> (WORKS!)
  168. BattleInterpreter::Commands['STOP SE'] = [false, method(:on_stop_se_command)]
  169. # <fade bgm: time> (WORKS!)
  170. BattleInterpreter::Commands['FADE BGM'] = [false, method(:on_fade_bgm_command)]
  171. # <fade bgs: time> (WORKS!)
  172. BattleInterpreter::Commands['FADE BGS'] = [false, method(:on_fade_bgs_command)]
  173. # <fade me: time> (WORKS!)
  174. BattleInterpreter::Commands['FADE ME'] = [false, method(:on_fade_me_command)]
  175. end
  176.  
  177. def on_pose_command(action, params)
  178. action.analize_battler_sprites_string(params[0], false, false).each do |i|
  179. i.set_pose(params[1], params[2], params[3], params[4], params[5])
  180. end
  181. end
  182.  
  183. def on_wait_command(action, params)
  184. if params[0].is_a?(String) && params[0][/animation/mi]
  185. wait_for_battle_interpreter
  186. elsif params[0].is_a?(String)
  187. action.wait(action.eval_data(params[0]))
  188. else
  189. action.wait(params[0])
  190. end
  191. end
  192.  
  193. def on_move_command(action, params)
  194. users = action.analize_battler_sprites_string(params[0], false, false)
  195. targets = action.analize_battler_sprites_string(params[1], true, true)
  196. if targets == :screen
  197. users.each do |i|
  198. i.set_movement(params[2], params[3], params[4], params[5])
  199. end
  200. elsif targets == :origin
  201. users.each do |i|
  202. corr_x = params[2]
  203. corr_y = params[3]
  204. corr_x *= -1 if i.battler.actor? && BattleConfig::InvertXCorrection
  205. corr_y *= -1 if i.battler.actor? && BattleConfig::InvertYCorrection
  206. i.set_movement(corr_x+i.original_x, corr_y+i.original_y, params[4], params[5])
  207. end
  208. else
  209. pos_x = 0
  210. pos_y = 0
  211. targets.each do |i|
  212. pos_x += i.current_x
  213. pos_y += i.current_y
  214. end
  215. if targets.size > 0
  216. pos_x /= targets.size
  217. pos_y /= targets.size
  218. else
  219. return
  220. end
  221. users.each do |i|
  222. x = pos_x
  223. y = pos_y
  224. x += i.battler.actor? && BattleConfig::InvertXCorrection ? -params[2] : params[2]
  225. y += i.battler.actor? && BattleConfig::InvertYCorrection ? -params[3] : params[3]
  226. i.set_movement(x, y, params[4], params[5])
  227. end
  228. end
  229. end
  230.  
  231. def on_zoom_command(action, params)
  232. action.analize_battler_sprites_string(params[0], false, false).each do |i|
  233. i.set_zoom(params[1] / 100.0, params[2] / 100.0, params[3])
  234. end
  235. end
  236.  
  237. def on_angle_command(action, params)
  238. action.analize_battler_sprites_string(params[0], false, false).each do |i|
  239. i.set_angle(params[1], params[2])
  240. end
  241. end
  242.  
  243. def on_opacity_command(action, params)
  244. action.analize_battler_sprites_string(params[0], false, false).each do |i|
  245. i.set_opacity(params[1], params[2])
  246. end
  247. end
  248. def on_animation_command(action, params)
  249. animations = []
  250. if params[1] < 0
  251. if params[1] == -1
  252. animations.push(action.user.atk_animation_id1)
  253. else
  254. animations.push(action.user.atk_animation_id2)
  255. end
  256. elsif params[1] == 0
  257. id = action.item.animation_id
  258. if id < 1
  259. animations.push(action.user.atk_animation_id1)
  260. animations.push(action.user.atk_animation_id2)
  261. else
  262. animations.push(id)
  263. end
  264. else
  265. animations.push(params[1])
  266. end
  267. targets = action.analize_battler_sprites_string(params[0], false, false)
  268. show_animation_ex(targets, animations[0], params[2])
  269. if animations[1]
  270. wait_for_animation
  271. show_animation_ex(targets, animations[1], !params[2])
  272. end
  273. end
  274.  
  275. def on_effects_command(action, params)
  276. end
  277.  
  278. def on_if_command(action, params)
  279. check = params[0].is_a?(String) ? action.eval_data(params[0]) : params[0]
  280. if check
  281. action.insert_commands_as_next(params[1])
  282. end
  283. end
  284.  
  285. def on_repeat_command(action, params)
  286. t = params[0].is_a?(String) ? action.eval_data(params[0]) : params[0]
  287. t.times do |i|
  288. action.insert_commands_as_next(params[1])
  289. end
  290. end
  291.  
  292. def on_while_command(action, params)
  293. check = params[0].is_a?(String) ? action.eval_data(params[0]) : params[0]
  294. if check
  295. action.insert_commands_as_next([['END', [] ]])
  296. action.insert_commands_as_next(params[1])
  297. action.insert_commands_as_next([ ['WHILE', [ params[0] ] ] ])
  298. action.insert_commands_as_next(params[1])
  299. end
  300. end
  301.  
  302. def on_afterimage_command(action, params)
  303. action.analize_battler_sprites_string(params[0], false, false).each do |i|
  304. visible = params[1] <= 0 ? false : true
  305. i.set_aftermages(visible, params[1], params[2])
  306. end
  307. end
  308.  
  309. def on_mirror_command(action, params)
  310. targets = action.analize_battler_sprites_string(params[0], false, false)
  311. targets.each do |target|
  312. target.set_mirror_value(params[1])
  313. end
  314. end
  315.  
  316. def on_show_picture_command(action, params)
  317. picture = $game_troop.screen.pictures[params[0]]
  318. i = params[1]
  319. wpns = action.user.weapons
  320. wpn = wpns[-i - 1] ? wpns[-i - 1] : (wpns[0] ? wpns[0] : nil)
  321. index = wpn ? wpn.icon_index : 0
  322. index = i == 0 ? action.item.icon_index : index
  323. bmp = i.is_a?(String) ? i : (i > 0 ? i : index)
  324. picture.show(bmp, params[2], params[3], params[4], params[5],
  325. params[6], params[7], params[8])
  326. end
  327.  
  328. def on_move_picture_command(action, params)
  329. picture = $game_troop.screen.pictures[params[0]]
  330. picture.move(params[1], params[2], params[3], params[4], params[5],
  331. params[6], params[7], params[8])
  332. end
  333.  
  334. def on_move_picture_ex_command(action, params)
  335. picture = $game_troop.screen.pictures[params[0]]
  336. targets = action.analize_battler_sprites_string(params[1], false, true)
  337. pos_x = 0
  338. pos_y = 0
  339. if targets != :screen
  340. targets.each do |i|
  341. pos_x += i.current_x
  342. pos_y += i.current_y
  343. end
  344. if targets.size > 0
  345. pos_x /= targets.size
  346. pos_y /= targets.size
  347. else
  348. return
  349. end
  350. end
  351. pos_x += params[2]
  352. pos_y += params[3]
  353.  
  354. picture.move_ex(pos_x, pos_y, params[4])
  355. end
  356.  
  357. def on_zoom_picture_command(action, params)
  358. picture = $game_troop.screen.pictures[params[0]]
  359. picture.set_zoom(params[1], params[2], params[3])
  360. end
  361.  
  362. def on_opacity_picture_command(action, params)
  363. picture = $game_troop.screen.pictures[params[0]]
  364. picture.set_opacity(params[1], params[2])
  365. end
  366.  
  367. def on_anime_picture_command(action, params)
  368. picture = $game_troop.screen.pictures[params[0]]
  369. if params[1] < 0
  370. if params[1] == -1
  371. animation_id = action.user.atk_animation_id1
  372. else
  373. animation_id = action.user.atk_animation_id2
  374. end
  375. else
  376. animation_id = params[1]
  377. end
  378. picture.set_animation(animation_id, params[2])
  379.  
  380.  
  381. end
  382.  
  383. def on_rotate_picture_command(action, params)
  384. picture = $game_troop.screen.pictures[params[0]]
  385. picture.rotate(params[1])
  386. end
  387.  
  388. def on_delete_picture_command(action, params)
  389. picture = $game_troop.screen.pictures[params[0]]
  390. picture.erase
  391. end
  392.  
  393. def on_tone_picture_command(action, params)
  394. picture = $game_troop.screen.pictures[params[0]]
  395. picture.start_tone_change(Tone.new(params[1], params[2], params[3],
  396. params[4]), params[5])
  397. end
  398.  
  399. def on_ruby_script_command(action, params)
  400. action.eval_data(params[0])
  401. end
  402.  
  403. def on_each_process_command(action, params)
  404. @new_targets = action.analize_target_string(params[0])
  405. return if @new_targets.size == 0
  406. @for_alive_targets = @new_targets[0] && @new_targets[0].alive?
  407. @for_friend_target = @new_targets[0] && @new_targets[0].actor? == action.user.actor?
  408. @target_size = 1
  409. @last_targets = action.targets
  410. @remove_targets = []
  411. comm = []
  412. @new_targets.each do |i|
  413. comm += [['TARGET CHANGE EX', [i] ]] + params[1]
  414. end
  415. action.insert_commands_as_next(comm + [['TARGET CHANGE EX', @last_targets]])
  416. end
  417.  
  418. def on_target_change_special_command(action, params)
  419. if @collapse_checked
  420. params.each do |battler|
  421. if battler.alive? != @for_alive_targets
  422. params.delete(battler)
  423. end
  424. end
  425. if params.size <= 0
  426. unit = @for_friend_target ? acion.user.friend_unit : action.user.enemy_unit
  427. params = @for_alive_targets ? unit.alive_members : unit.dead_members
  428. params = params[0...@target_size].compact
  429. end
  430. @collapse_checked = false
  431. end
  432. action.targets = params
  433. action.linked_actions.each do |a|
  434. a.targets = action.targets
  435. end
  436. end
  437.  
  438. def on_target_change_command(action, params)
  439. action.targets = action.analize_target_string(params[0])
  440. action.linked_actions.each do |a|
  441. a.targets = action.targets
  442. end
  443. end
  444.  
  445. def on_end_command(action, params)
  446. action.loop_depth -= 1
  447. end
  448.  
  449. def on_counter_check_command(action, params)
  450. action.pause
  451. action.targets.each do |target|
  452. if rand < target.item_cnt(action.user, action.item) && action.counter_active?
  453. action.abort
  454. invoke_counter_attack_ex(action.user, target, action.item)
  455. end
  456. end
  457. wait_for_battle_interpreter
  458. action.resume
  459. end
  460.  
  461. def on_reflect_check_command(action, params)
  462. action.pause
  463. action.targets.each do |target|
  464. if rand < target.item_mrf(action.user, action.item)
  465. invoke_magic_reflection_ex(action, target)
  466. end
  467. end
  468. wait_for_battle_interpreter
  469. action.resume
  470. end
  471.  
  472. def on_substitute_check_command(action, params)
  473. @substitutes = []
  474. action.pause
  475. action.targets.each do |target|
  476. apply_substitute_ex(action, target, action.item)
  477. end
  478. wait_for_battle_interpreter
  479. action.resume
  480. @substitutes.clear
  481. end
  482.  
  483. def on_link_skill_command(action, params)
  484. result = params[1].is_a?(String) ? action.eval_data(params[1]) : params[1]
  485. if rand(100) < result
  486. if params[0] < 1
  487. id = action.user.attack_skill_id
  488. else
  489. id = params[0]
  490. end
  491. action.abort
  492. action.user.current_action.set_skill(id)
  493. @subject = action.user
  494. use_item
  495. end
  496. end
  497.  
  498. def on_link_item_command(action, params)
  499. result = params[1].is_a?(String) ? action.eval_data(params[1]) : params[1]
  500. if rand(100) < result
  501. action.abort
  502. user.current_action.set_item(id)
  503. @subject = action.user
  504. use_item
  505. end
  506. end
  507.  
  508. def on_damage_command(action, params)
  509. action.targets.each do |target|
  510. apply_item_effects_ex(action.user, target, action.item)
  511. end
  512. end
  513.  
  514. def on_move_camera_command(action, params)
  515. target = action.analize_battler_sprites_string(params[0], false, true)
  516. if target == :screen
  517. BattleCamera.set_movement(params[1], params[2], params[3])
  518. else
  519. cx = 0
  520. cy = 0
  521. target.each do |i|
  522. cx += i.current_x
  523. cy += i.current_y
  524. end
  525. if target.size > 0
  526. cx /= target.size
  527. cy /= target.size
  528. end
  529. BattleCamera.set_movement(cx+params[1], cy+params[2], params[3])
  530. end
  531. end
  532.  
  533. def on_zoom_camera_command(action, params)
  534. BattleCamera.set_zoom(params[0] / 100.0, params[1])
  535. end
  536.  
  537. def on_target_camera_command(action, params)
  538. target = action.analize_battler_sprites_string(params[0], false, true)
  539. BattleCamera.set_target(target)
  540. end
  541.  
  542. def on_perform_collapse_command(action, params)
  543. @collapse_checked = true
  544. action.targets.each do |target|
  545. if target.dead?
  546. if target.die_sequence?
  547. sequence = target.get_die_sequence
  548. BattleInterpreter.add_action(target, [target], sequence, nil, false)
  549. else
  550. target.perform_collapse_effect
  551. end
  552. action.targets.delete(target)
  553. @dead_battlers.push(target)
  554. @last_targets.delete(target) if @last_targets
  555. @remove_targets.push(target) if @remove_targets
  556. end
  557. end
  558. end
  559.  
  560. def on_abort_command(action, params)
  561. action.abort
  562. end
  563.  
  564. def on_weapon_command(action, params)
  565. targets = action.analize_battler_sprites_string(params[0], false, false)
  566. targets.each do |target|
  567. x = target.battler.actor? && BattleConfig::InvertXCorrection ? -params[1] : params[1]
  568. y = target.battler.actor? && BattleConfig::InvertYCorrection ? -params[2] : params[2]
  569. sa = target.battler.actor? ? 360 - params[3] : params[3]
  570. ea = target.battler.actor? ? 360 - params[4] : params[4]
  571. target.set_weapon_icon(x, y, sa, ea, params[5], params[6], params[7])
  572. end
  573. end
  574.  
  575. def on_shield_command(action, params)
  576. targets = action.analize_battler_sprites_string(params[0], false, false)
  577. targets.each do |target|
  578. x = target.battler.actor? && BattleConfig::InvertXCorrection ? -params[1] : params[1]
  579. y = target.battler.actor? && BattleConfig::InvertYCorrection ? -params[2] : params[2]
  580. sa = target.battler.actor? ? 360 - params[3] : params[3]
  581. ea = target.battler.actor? ? 360 - params[4] : params[4]
  582. target.set_shield_icon(x, y, sa, ea, params[5], params[6])
  583.  
  584. end
  585.  
  586. end
  587.  
  588. def on_weapon_ex_command(action, params)
  589. targets = action.analize_battler_sprites_string(params[0], false, false)
  590. targets.each do |target|
  591. x = target.battler.actor? && BattleConfig::InvertXCorrection ? -params[2] : params[2]
  592. y = target.battler.actor? && BattleConfig::InvertYCorrection ? -params[3] : params[3]
  593. target.set_weapon_sprite(params[1], x, y, params[4], params[5], params[6])
  594. end
  595. end
  596.  
  597. def on_log_text_command(action, params)
  598. @log_window.add_text(params[0])
  599. end
  600.  
  601. def on_balloon_command(action, params)
  602. targets = action.analize_battler_sprites_string(params[0], false, false)
  603. targets.each do |target|
  604. target.start_balloon(params[1])
  605. end
  606. end
  607.  
  608. def on_fps_command(action, params)
  609. Graphics.frame_rate = params[0]
  610. end
  611.  
  612. def on_switch_command(action, params)
  613. $game_switches[params[0]] = params[1]
  614. end
  615.  
  616. def on_variable_command(action, params)
  617. $game_variables[params[0]] = params[1]
  618. end
  619.  
  620. def on_movie_command(action, params)
  621. Graphics.play_movie(params[0])
  622. end
  623.  
  624. def on_save_bgm_command(action, params)
  625. @last_bgm_played = RPG::BGM.last
  626. end
  627.  
  628. def on_replay_bgm_command(action, params)
  629. @last_bgm_played.replay if @last_bgm_played
  630. @last_bgm_played = nil
  631. end
  632.  
  633. def on_save_bgs_command(action, params)
  634. @last_bgs_played = RPG::BGS.last
  635. end
  636.  
  637. def on_replay_bgs_command(action, params)
  638. @last_bgs_played.replay if @last_bgs_played
  639. @last_bgs_played = nil
  640. end
  641.  
  642. def on_play_bgm_command(action, params)
  643. RPG::BGM.new(params[0], params[1], params[2], params[3]).play
  644. end
  645.  
  646. def on_play_bgs_command(action, params)
  647. RPG::BGS.new(params[0], params[1], params[2], params[3]).play
  648. end
  649.  
  650. def on_play_me_command(action, params)
  651. RPG::ME.new(params[0], params[1], params[2]).play
  652. end
  653.  
  654. def on_play_se_command(action, params)
  655. RPG::SE.new(params[0], params[1], params[2]).play
  656. end
  657.  
  658. def on_stop_bgm_command(action, params)
  659. Audio.bgm_stop
  660. end
  661.  
  662. def on_stop_bgs_command(action, params)
  663. Audio.bgs_stop
  664. end
  665.  
  666. def on_stop_me_command(action, params)
  667. Audio.me_stop
  668. end
  669.  
  670. def on_stop_se_command(action, params)
  671. Audio.se_stop
  672. end
  673.  
  674. def on_fade_bgm_command(action, params)
  675. Audio.bgm_fade(params[0])
  676. end
  677.  
  678. def on_fade_bgs_command(action, params)
  679. Audio.bgs_fade(params[0])
  680. end
  681.  
  682. def on_fade_me_command(action, params)
  683. Audio.me_fade(params[0])
  684. end
  685.  
  686. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement