Guest User

Action Command thingy

a guest
Jan 7th, 2016
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.58 KB | None | 0 0
  1. #==============================================================================
  2. # +++ MOG - Active Chain Commands (v3.3) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # https://atelierrgss.wordpress.com/
  6. #==============================================================================
  7. # Permite combinar (Linkar) ataques consecutivos através do uso de
  8. # sequência de botões.
  9. #==============================================================================
  10. # Arquivos necessários. Graphics/System/
  11. #
  12. # Chain_Command.png
  13. # Chain_Battle_Layout.png
  14. # Chain_Battle_Meter.png
  15. #
  16. #==============================================================================
  17. # UTILIZAÇÃO
  18. #==============================================================================
  19. # No banco de dados use o sequinte comentário para linkar as ações.
  20. #
  21. # <Chain Action = X>
  22. #
  23. # X - ID da habilidade.
  24. #==============================================================================
  25.  
  26. #==============================================================================
  27. # ● Histórico (Version History)
  28. #==============================================================================
  29. # v3.3 - Melhoria na compatibilidade com MOG Battle Camera
  30. # v3.2 - Compatibilidade com MOG Sprite Actor.
  31. # v3.1 - Compatibilidade com MOG Battle Camera.
  32. # v3.0 - Adição de comandos aleatórios.
  33. # v2.9 - Correção do bug de não ocultar a janela com MOG ATB.
  34. # v2.8 - Melhoria na codificação.
  35. #==============================================================================
  36.  
  37. $imported = {} if $imported.nil?
  38. $imported[:mog_active_chain] = true
  39.  
  40. module MOG_CHAIN_ACTIONS
  41. #=============================================================================
  42. # CHAIN_ACTIONS = { SKILL_ID => [COMMAND] }
  43. #
  44. # SKILL_ID = ID da habilidade no banco de dados.
  45. # COMMANDS = Defina aqui a sequência de botões.
  46. # (Para fazer a sequência use os comandos abaixo)
  47. #
  48. # "Down" ,"Up" ,"Left" ,"Right" ,"Shift" ,"D" ,"S" ,"A" ,"Z" ,"X" ,"Q" ,"W",
  49. # "Random"
  50. #
  51. # Exemplo de utilização
  52. #
  53. # CHAIN_SWITCH_COMMAND = {
  54. # 25=>["Down","D","S","Right"],
  55. # 59=>["Down","Up","Left","Right","Shift","D","S","A","Z","X","Q","W"],
  56. # 80=>["Shift","D"]
  57. # }
  58. #==============================================================================
  59. CHAIN_ACTIONS = {
  60. 29=>["Random","Random","Random","Random","Random","Random","Random"],
  61. 52=>["Up","Down","Left","Right","Z"],
  62. 70=>["X","Right","Left","Z","Z"],
  63. 135=>["Random"],
  64. 167=>["Random","Random"],
  65. 168=>["Random","Random","Random","Random"],
  66. 1=>["Random","Random","Random","Random"],
  67. 139=>["Up","Up","Down","Down","Left","Right","Left","Right","X","Z"],
  68. 140=>["Random","Random","Random","Random","Z"],
  69. 141=>["Up","Down"],
  70. 142=>["Left","Right","Z"],
  71. 999=>["Left","Right","Left","Right","Left","Right","Q","Z","Up","A","S",
  72. "Down","D","Z","Right","Up","Up","Z","W","Left","Down","D","A","W"]
  73. }
  74. #Definição dos comandos aleatórios.
  75. RANDOM_KEYS = ["Left","Right","Up","Down","D","S","A","Z","X","Shift"]
  76. #Definição padrão do tempo limite para pressionar o botão.
  77. CHAIN_DEFAULT_INPUT_DURATION = 60 #60 = 1s
  78. #Definição do tempo limite para pressionar o botão.
  79. CHAIN_INPUT_DURATION = {
  80. 138=>60,
  81. 139=>40,
  82. 140=>30
  83. #141=>160,
  84. #240=>2000
  85. }
  86.  
  87. #Som ao acertar.
  88. CHAIN_RIGHT_SE = "052-Cannon01"
  89. #Som ao errar.
  90. CHAIN_WRONG_SE = "Buzzer1"
  91. #Definição do som ao ativar o sistema de chain.
  92. CHAIN_START_SE = "Open1"
  93. #Definição da posição do botão.
  94. CHAIN_SPRITE_POSITION = [0,-15]
  95. #Posição do layout do medidor.
  96. CHAIN_LAYOUT_POSITION = [1,-7]
  97. #Posição do medidor de tempo.
  98. CHAIN_METER_POSITION = [0,-6]
  99. #Posição do Ícone
  100. CHAIN_ICON_POSITION = [0,-32]
  101. #Definição da palavra Chain.
  102. CHAIN_COMMAND_WORD = "Chain Action!"
  103. #Definição das palavras de erro.
  104. CHAIN_MISSED_WORDS = ["Missed!", "Timeover"]
  105. #Definição da posição da palavra.
  106. CHAIN_COMMAND_WORD_POSITION = [0,0]
  107. #Definição do tamanho da fonte
  108. CHAIN_WORD_FONT_SIZE = 20
  109. #Definição da cor da fonte
  110. CHAIN_WORD_FONT_COLOR = Color.new(255,255,255)
  111. #Prioridade do sprite.
  112. CHAIN_SPRITE_Z = 150
  113. end
  114.  
  115. #==============================================================================
  116. # ■ Game Temp
  117. #==============================================================================
  118. class Game_Temp
  119. attr_accessor :chain_actions
  120. attr_accessor :active_chain
  121. attr_accessor :chain_ot
  122. attr_accessor :chain_action_phase
  123. #--------------------------------------------------------------------------
  124. # ● Initialize
  125. #--------------------------------------------------------------------------
  126. alias mog_chain_actions_initialize initialize
  127. def initialize
  128. @chain_actions = [0,0,0,false] ; @active_chain = false
  129. @chain_action_phase = false
  130. mog_chain_actions_initialize
  131. end
  132.  
  133. end
  134.  
  135. #==============================================================================
  136. # ■ Scene_Battle
  137. #==============================================================================
  138. class Scene_Battle < Scene_Base
  139.  
  140. #--------------------------------------------------------------------------
  141. # ● Use Item
  142. #--------------------------------------------------------------------------
  143. alias mog_chain_actions_use_item use_item
  144. def use_item
  145. prepare_chain_command if can_use_chain_commands?
  146. mog_chain_actions_use_item
  147. execute_chain_actions if can_use_chain_commands?
  148. end
  149.  
  150. #--------------------------------------------------------------------------
  151. # ● Can Use Chain Commands
  152. #--------------------------------------------------------------------------
  153. def can_use_chain_commands?
  154. return false if @subject == nil
  155. return false if [email protected]_a?(Game_Actor)
  156. return false if @subject.restriction != 0
  157. return true
  158. end
  159.  
  160. #--------------------------------------------------------------------------
  161. # ● Prepare Chain Commands
  162. #--------------------------------------------------------------------------
  163. def prepare_chain_command
  164. @chain_skill_original = @subject.current_action.item rescue nil
  165. if $game_temp.chain_ot == nil and @subject.is_a?(Game_Actor)
  166. targets = @subject.current_action.make_targets.compact
  167. $game_temp.chain_ot = targets[0]
  168. end
  169. check_chain_targets
  170. end
  171.  
  172. #--------------------------------------------------------------------------
  173. # ● Check Chain Command Position
  174. #--------------------------------------------------------------------------
  175. def check_chain_command_position
  176. scx = $game_temp.chain_ot.screen_x rescue nil
  177. return if scx == nil
  178. if $game_temp.chain_ot != nil and !$game_temp.chain_ot.dead?
  179. $game_temp.chain_actions = [$game_temp.chain_ot.screen_x,$game_temp.chain_ot.screen_y,true]
  180. end
  181. end
  182.  
  183. #--------------------------------------------------------------------------
  184. # ● Check Chain Targets
  185. #--------------------------------------------------------------------------
  186. def check_chain_targets
  187. return if @subject == nil or $game_temp.chain_ot == nil
  188. if [1,7,9,10,11].include?(@subject.current_action.item.scope)
  189. @pre_target = $game_temp.chain_ot ; @pre_target_hp = $game_temp.chain_ot.hp
  190. else
  191. @pre_target = nil ; @pre_target_hp = nil
  192. end
  193. end
  194.  
  195. #--------------------------------------------------------------------------
  196. # ● Execute Chain Actions
  197. #--------------------------------------------------------------------------
  198. def execute_chain_actions
  199. $game_temp.active_chain = false
  200. return if !can_execute_chain_actions_base?
  201. check_chain_command_position
  202. skill = @subject.current_action.item rescue nil
  203. skill = @chain_skill_original rescue nil
  204. action_id = skill.note =~ /<Chain Action = (\d+)>/i ? $1.to_i : nil rescue nil
  205. return if action_id == nil or action_id < 1
  206. chain_command_sequence = MOG_CHAIN_ACTIONS::CHAIN_ACTIONS[action_id].dup rescue nil
  207. $game_temp.chain_actions[2] = action_id
  208. if can_execute_chain_sequence?(chain_command_sequence,action_id)
  209. chain_act_before_action if @chain_command == nil
  210. chain_sq = Chain_Actions.new(chain_command_sequence,$game_temp.chain_actions)
  211. loop do
  212. $game_temp.chain_action_phase = true
  213. (chain_sq.update($game_temp.chain_ot) ; Input.update) unless @spriteset.animation?
  214. $game_temp.active_chain = true ; chain_sq.update_skill_name
  215. @spriteset.update ; Graphics.update ; update_info_viewport
  216. break if chain_sq.phase == 9
  217. end
  218. @subject.wp_animation = [true,chain_sq.success] if $imported[:mog_sprite_actor]
  219. action_id = nil if !chain_sq.success or $game_temp.chain_ot.dead?
  220. chain_sq.dispose ; set_chain_skill(action_id) if action_id != nil
  221. end
  222. $game_temp.active_chain = false ; $game_temp.chain_ot = nil
  223. $game_temp.chain_action_phase = false
  224. end
  225.  
  226. #--------------------------------------------------------------------------
  227. # ● Chain Act Before Action
  228. #--------------------------------------------------------------------------
  229. def chain_act_before_action
  230. @chain_command = true ; @bb_cursor
  231. if $imported[:mog_battle_cursor]
  232. @bb_cursor = $game_temp.battle_cursor[2]
  233. $game_temp.battle_cursor[2] = false
  234. end
  235. if $imported[:mog_menu_cursor]
  236. @chain_curor_x = $game_temp.menu_cursor[2]
  237. $game_temp.menu_cursor[2] = -999
  238. force_cursor_visible(false)
  239. end
  240. if $imported[:mog_atb_system]
  241. record_window_data if @wd_rec.nil?
  242. hide_base_window
  243. @wd_rec = true
  244. end
  245. end
  246.  
  247. #--------------------------------------------------------------------------
  248. # ● Turn End
  249. #--------------------------------------------------------------------------
  250. alias mog_chain_command_process_action_end process_action_end
  251. def process_action_end
  252. mog_chain_command_process_action_end
  253. chain_act_after_action
  254. end
  255.  
  256. #--------------------------------------------------------------------------
  257. # ● Chain Act After ACtion
  258. #--------------------------------------------------------------------------
  259. def chain_act_after_action
  260. @chain_skill_original = nil
  261. $game_temp.chain_ot = nil
  262. return if @chain_command == nil
  263. restore_window_data if $imported[:mog_atb_system]
  264. $game_temp.menu_cursor[2] = @chain_curor_x if $imported[:mog_menu_cursor]
  265. $game_temp.battle_cursor[2] = @bb_cursor if @bb_cursor != nil
  266. @chain_command = nil
  267. end
  268.  
  269. #--------------------------------------------------------------------------
  270. # ● Set Chain Skill
  271. #--------------------------------------------------------------------------
  272. def set_chain_skill(action_id)
  273. return if action_id == nil
  274. @subject.input.set_skill(action_id)
  275. $game_temp.chain_actions = [0,0,0,false] ; execute_action
  276. end
  277.  
  278. #--------------------------------------------------------------------------
  279. # ● Can Execute Chain Sequence?
  280. #--------------------------------------------------------------------------
  281. def can_execute_chain_sequence?(chain_command_sequence = nil,action_id = nil)
  282. return false if chain_command_sequence == nil
  283. skill = $data_skills[action_id] rescue nil
  284. return false if skill == nil
  285. return false if $game_temp.chain_ot == nil or $game_temp.chain_ot.dead?
  286. if [9,10].include?(skill.scope)
  287. $game_party.battle_members.each do |i| return true if i.dead? end
  288. return false
  289. end
  290. return true
  291. end
  292.  
  293. #--------------------------------------------------------------------------
  294. # ● Can Execute Chain Actions Base
  295. #--------------------------------------------------------------------------
  296. def can_execute_chain_actions_base?
  297. return false if @subject == nil or @subject.dead?
  298. return false if $game_temp.chain_ot == nil or $game_temp.chain_ot.dead?
  299. return false if @subject.is_a?(Game_Enemy)
  300. return false if @subject.current_action == nil
  301. @subject.states.each do |i| return false if i.restriction > 0 end
  302. return false if $game_party.members.empty?
  303. return false if $game_party.all_dead?
  304. return false if $game_troop.all_dead?
  305. if @pre_target != nil and $game_temp.chain_ot.hp == @pre_target_hp
  306. return false if $game_temp.chain_ot.result.missed
  307. return false if $game_temp.chain_ot.result.evaded
  308. end
  309. return true
  310. end
  311.  
  312. #--------------------------------------------------------------------------
  313. # ● Turn End
  314. #--------------------------------------------------------------------------
  315. alias mog_chain_command_turn_end turn_end
  316. def turn_end
  317. mog_chain_command_turn_end
  318. @wd_rec = nil
  319. end
  320.  
  321. end
  322.  
  323. #==============================================================================
  324. # ■ Game Temp
  325. #==============================================================================
  326. class Game_Temp
  327.  
  328. attr_accessor :cache_active_chain
  329.  
  330. #--------------------------------------------------------------------------
  331. # ● Initialize
  332. #--------------------------------------------------------------------------
  333. alias mog_active_chain_initialize initialize
  334. def initialize
  335. mog_active_chain_initialize
  336. cache_act_chain
  337. end
  338.  
  339. #--------------------------------------------------------------------------
  340. # ● Cache Act Chain
  341. #--------------------------------------------------------------------------
  342. def cache_act_chain
  343. @cache_active_chain = []
  344. @cache_active_chain.push(Cache.system("IconSet"))
  345. @cache_active_chain.push(Cache.system("Chain_Battle_Layout"))
  346. @cache_active_chain.push(Cache.system("Chain_Battle_Meter"))
  347. @cache_active_chain.push(Cache.system("Chain_Battle_Command"))
  348. end
  349.  
  350. end
  351.  
  352. #==============================================================================
  353. # ■ Spriteset Battle
  354. #==============================================================================
  355. class Spriteset_Battle
  356.  
  357. #--------------------------------------------------------------------------
  358. # ● Initialize
  359. #--------------------------------------------------------------------------
  360. alias mog_active_chain_commands_initialize initialize
  361. def initialize
  362. $game_temp.cache_act_chain ; $game_temp.active_chain = false
  363. $game_temp.chain_ot = nil
  364. mog_active_chain_commands_initialize
  365. end
  366. end
  367.  
  368. #==============================================================================
  369. # ■ Chain Actions
  370. #==============================================================================
  371. class Chain_Actions
  372.  
  373. include MOG_CHAIN_ACTIONS
  374.  
  375. attr_accessor :phase
  376. attr_accessor :success
  377.  
  378. #--------------------------------------------------------------------------
  379. # ● Initialize
  380. #--------------------------------------------------------------------------
  381. def initialize(sequence,chain_temp)
  382. $game_temp.chain_actions[3] = true
  383. @chain_command_original = sequence.dup
  384. @chain_command = sequence
  385. random_sequence
  386. @x = chain_temp[0] + CHAIN_SPRITE_POSITION[0]
  387. @y = chain_temp[1] + CHAIN_SPRITE_POSITION[1]
  388. @y = (Graphics.height - 36) if @y > (Graphics.height - 36)
  389. @y = 0 if @y < 0
  390. @skill = $data_skills[chain_temp[2]]
  391. @skillname = @skill.name
  392.  
  393. if CHAIN_INPUT_DURATION[chain_temp[2]] != nil
  394. @duration = [CHAIN_INPUT_DURATION[chain_temp[2]],CHAIN_INPUT_DURATION[chain_temp[2]]]
  395. else
  396. @duration = [CHAIN_DEFAULT_INPUT_DURATION, CHAIN_DEFAULT_INPUT_DURATION]
  397. end
  398. @phase = 0 ; @success = false ; @com = 0 ; @com_index = 0
  399. @initial_wait = 1 ; @wrong_commnad = [false,0,0]
  400. Audio.se_play("Audio/SE/" + CHAIN_START_SE, 100, 100) rescue nil
  401. create_button_sprite ; create_skill_name ; create_icon ; create_meter
  402. set_opacity(0)
  403. end
  404.  
  405. #--------------------------------------------------------------------------
  406. # ● Random Sequence
  407. #--------------------------------------------------------------------------
  408. def random_sequence
  409. @chain_command_original.each_with_index do |c, i|
  410. next if c != "Random"
  411. k = rand(RANDOM_KEYS.size) ; @chain_command[i] = RANDOM_KEYS[k]
  412. end
  413. end
  414.  
  415. #--------------------------------------------------------------------------
  416. # ● Create Icon
  417. #--------------------------------------------------------------------------
  418. def create_icon
  419. @icon_image = $game_temp.cache_active_chain[0]
  420. @icon_sprite = Sprite.new ; @icon_sprite.bitmap = Bitmap.new(24,24)
  421. @icon_sprite.z = CHAIN_SPRITE_Z + 1
  422. @org_x2 = @x - 12 + CHAIN_ICON_POSITION[0] - @center
  423. @icon_sprite.x = @org_x2 - 50
  424. @icon_sprite.y = @y + CHAIN_ICON_POSITION[1]
  425. icon_rect = Rect.new(@skill.icon_index % 16 * 24, @skill.icon_index / 16 * 24, 24, 24)
  426. @icon_sprite.bitmap.blt(0,0, @icon_image, icon_rect)
  427. end
  428.  
  429. #--------------------------------------------------------------------------
  430. # ● Create Meter
  431. #--------------------------------------------------------------------------
  432. def create_meter
  433. @meter_layout = Sprite.new
  434. @meter_layout.bitmap = $game_temp.cache_active_chain[1]
  435. @meter_layout.z = CHAIN_SPRITE_Z
  436. @meter_layout.x = @x - (@meter_layout.width / 2) + CHAIN_LAYOUT_POSITION[0]
  437. @meter_layout.y = @y + CHAIN_LAYOUT_POSITION[1]
  438. @meter_image = $game_temp.cache_active_chain[2]
  439. @meter_cw = @meter_image.width ; @meter_ch = @meter_image.height
  440. @meter = Sprite.new
  441. @meter.bitmap = Bitmap.new(@meter_image.width, @meter_image.height)
  442. @meter.z = CHAIN_SPRITE_Z + 1
  443. @meter.x = @x - (@meter_image.width / 2) + CHAIN_METER_POSITION[0]
  444. @meter.y = @y + CHAIN_METER_POSITION[1]
  445. @meter.visible = false ; @meter_layout.visible = false ; update_meter
  446. end
  447.  
  448. #--------------------------------------------------------------------------
  449. # ● Update Meter
  450. #--------------------------------------------------------------------------
  451. def update_meter
  452. return if @meter == nil
  453. @meter.bitmap.clear ; range = @meter_cw * @duration[0] / @duration[1]
  454. m_scr = Rect.new(0,0,range,@meter_ch )
  455. @meter.bitmap.blt(0,0, @meter_image ,m_scr)
  456. end
  457.  
  458. #--------------------------------------------------------------------------
  459. # ● Initialize
  460. #--------------------------------------------------------------------------
  461. def create_skill_name
  462. @skill_name = Sprite.new ; @skill_name.bitmap = Bitmap.new(200,32)
  463. @skill_name.bitmap.font.size = CHAIN_WORD_FONT_SIZE
  464. @skill_name.bitmap.font.color = CHAIN_WORD_FONT_COLOR
  465. @skill_name.z = CHAIN_SPRITE_Z
  466. @skill_name.y = @y - 32 + CHAIN_COMMAND_WORD_POSITION[1]
  467. refresh_skill_name
  468. end
  469.  
  470. #--------------------------------------------------------------------------
  471. # ● Refresh Skill Name
  472. #--------------------------------------------------------------------------
  473. def refresh_skill_name
  474. cm = @skillname.to_s.split(//).size
  475. @center = ((200 / @skill_name.bitmap.font.size) * cm / 2) + 5
  476. @org_x = @x - (@button_cw / 2) - 85 + CHAIN_COMMAND_WORD_POSITION[0]
  477. @skill_name.x = @org_x - 50
  478. @skill_name.bitmap.draw_text(0,0,200,32,@skillname.to_s,1)
  479. end
  480.  
  481. #--------------------------------------------------------------------------
  482. # ● Create Button Sprite
  483. #--------------------------------------------------------------------------
  484. def create_button_sprite
  485. @button_image = $game_temp.cache_active_chain[3]
  486. @button_cw = @button_image.width / 13 ; @button_ch = @button_image.height
  487. @button_sprite = Sprite.new
  488. @button_sprite.bitmap = Bitmap.new(@button_cw,@button_ch)
  489. @button_sprite.z = CHAIN_SPRITE_Z + 1
  490. @button_sprite.ox = @button_cw / 2 ; @button_sprite.oy = @button_ch / 2
  491. @button_sprite_oxy = [@button_sprite.ox,@button_sprite.oy]
  492. @button_sprite.x = @x + @button_sprite.ox - (@button_cw / 2)
  493. @button_sprite.y = @y + @button_sprite.oy
  494. end
  495.  
  496. #--------------------------------------------------------------------------
  497. # ● Refresh Button Command
  498. #--------------------------------------------------------------------------
  499. def refresh_button_command
  500. return if @button_sprite == nil
  501. @duration[0] = @duration[1]
  502. command_list_check(@chain_command[@com_index])
  503. @button_sprite.bitmap.clear
  504. button_scr = Rect.new(@com * @button_cw , 0,@button_cw,@button_ch)
  505. @button_sprite.bitmap.blt(0,0,@button_image,button_scr)
  506. @button_sprite.zoom_x = 1.3 ; @button_sprite.zoom_y = 1.3
  507. @button_sprite.opacity = 255
  508. end
  509.  
  510. #--------------------------------------------------------------------------
  511. # ● Dispose
  512. #--------------------------------------------------------------------------
  513. def dispose
  514. dispose_button ; dispose_meter ; dispose_name ; dispose_icon_sprite
  515. $game_temp.chain_actions[3] = false ; $game_temp.active_chain = false
  516. end
  517.  
  518. #--------------------------------------------------------------------------
  519. # ● Dispose Icon Sprite
  520. #--------------------------------------------------------------------------
  521. def dispose_icon_sprite
  522. return if @icon_sprite == nil
  523. @icon_sprite.bitmap.dispose ; @icon_sprite.dispose ; @icon_sprite = nil
  524. end
  525.  
  526. #--------------------------------------------------------------------------
  527. # ● Dispose Name
  528. #--------------------------------------------------------------------------
  529. def dispose_name
  530. return if @skill_name == nil
  531. @skill_name.bitmap.dispose ; @skill_name.dispose ; @skill_name = nil
  532. end
  533.  
  534. #--------------------------------------------------------------------------
  535. # ● Dispose Button
  536. #--------------------------------------------------------------------------
  537. def dispose_button
  538. return if @button_sprite == nil
  539. @button_sprite.bitmap.dispose ; @button_sprite.dispose ; @button_sprite = nil
  540. end
  541.  
  542. #--------------------------------------------------------------------------
  543. # ● Dispose Meter
  544. #--------------------------------------------------------------------------
  545. def dispose_meter
  546. return if @meter_layout == nil
  547. @meter_layout.dispose ; @meter_layout = nil
  548. @meter.bitmap.dispose ; @meter.dispose
  549. end
  550.  
  551. #--------------------------------------------------------------------------
  552. # ● Update
  553. #--------------------------------------------------------------------------
  554. def update(battler)
  555. if @initial_wait > 0
  556. @initial_wait -= 1
  557. if @initial_wait == 0
  558. refresh_button_command ; @meter.visible = true
  559. @meter_layout.visible = true
  560. set_opacity(0)
  561. end
  562. return
  563. end
  564. if @wrong_commnad[0]
  565. update_fade_command
  566. return
  567. else
  568. update_opacity
  569. end
  570. update_command ; update_sprite_button ; update_time ; update_meter
  571. update_battle_camera if oxy_camera?(battler)
  572. end
  573.  
  574. #--------------------------------------------------------------------------
  575. # ● OXY_CAMERA
  576. #--------------------------------------------------------------------------
  577. def oxy_camera?(battler)
  578. return false if battler == nil
  579. return false if $imported[:mog_battle_camera] == nil
  580. if battler.is_a?(Game_Actor)
  581. return false if $imported[:mog_battle_hud_ex] and SceneManager.face_battler?
  582. end
  583. return true
  584. end
  585.  
  586. #--------------------------------------------------------------------------
  587. # ● Update Battle Camera
  588. #--------------------------------------------------------------------------
  589. def update_battle_camera
  590. @meter_layout.ox = $game_temp.viewport_oxy[0]
  591. @meter_layout.oy = $game_temp.viewport_oxy[1]
  592. @meter.ox = $game_temp.viewport_oxy[0]
  593. @meter.oy = $game_temp.viewport_oxy[1]
  594. @skill_name.ox = $game_temp.viewport_oxy[0]
  595. @skill_name.oy = $game_temp.viewport_oxy[1]
  596. @button_sprite.ox = $game_temp.viewport_oxy[0] + @button_sprite_oxy[0]
  597. @button_sprite.oy = $game_temp.viewport_oxy[1] + @button_sprite_oxy[1]
  598. @icon_sprite.ox = $game_temp.viewport_oxy[0]
  599. @icon_sprite.oy = $game_temp.viewport_oxy[1]
  600. end
  601.  
  602. #--------------------------------------------------------------------------
  603. # ● Set Opacity
  604. #--------------------------------------------------------------------------
  605. def set_opacity(opc)
  606. @meter_layout.opacity = opc
  607. @meter.opacity = opc
  608. @skill_name.opacity = opc
  609. @button_sprite.opacity = opc
  610. @icon_sprite.opacity = opc
  611. end
  612.  
  613. #--------------------------------------------------------------------------
  614. # ● Update Opacity
  615. #--------------------------------------------------------------------------
  616. def update_opacity
  617. @meter_layout.opacity += 75
  618. @meter.opacity += 75
  619. @skill_name.opacity += 75
  620. @button_sprite.opacity += 75
  621. @icon_sprite.opacity += 75
  622. end
  623.  
  624.  
  625. #--------------------------------------------------------------------------
  626. # ● Update Skill Name
  627. #--------------------------------------------------------------------------
  628. def update_fade_command
  629. fade_speed = 6
  630. @skill_name.opacity -= fade_speed ; @meter.opacity -= fade_speed
  631. @meter_layout.opacity -= fade_speed ; @icon_sprite.opacity -= fade_speed
  632. @button_sprite.opacity -= fade_speed * 2 ; missed if @meter.opacity == 0
  633. end
  634.  
  635. #--------------------------------------------------------------------------
  636. # ● Update Skill Name
  637. #--------------------------------------------------------------------------
  638. def update_skill_name
  639. return if @skill_name == nil
  640. if @skill_name.x < @org_x
  641. @skill_name.x += 3 ; @icon_sprite.x += 3
  642. if @skill_name.x > @org_x
  643. @skill_name.x = @org_x ; @icon_sprite.x = @org_x2
  644. end
  645. end
  646. end
  647.  
  648. #--------------------------------------------------------------------------
  649. # ● Update Time
  650. #--------------------------------------------------------------------------
  651. def update_time
  652. return if @button_sprite == nil
  653. @duration[0] -= 1 if @duration[0] > 0
  654. wrong_command(1) if @duration[0] == 0
  655. end
  656.  
  657. #--------------------------------------------------------------------------
  658. # ● Update Sprite Button
  659. #--------------------------------------------------------------------------
  660. def update_sprite_button
  661. return if @button_sprite == nil
  662. if @button_sprite.zoom_x > 1.00
  663. @button_sprite.zoom_x -= 0.05
  664. @button_sprite.zoom_x = 1.00 if @button_sprite.zoom_x < 1.00
  665. end
  666. @button_sprite.zoom_y = @button_sprite.zoom_x
  667. end
  668.  
  669. #--------------------------------------------------------------------------
  670. # ● Update Command
  671. #--------------------------------------------------------------------------
  672. def update_command
  673. if Input.trigger?(:X) ; check_command(0)
  674. elsif Input.trigger?(:Z) ; check_command(1)
  675. elsif Input.trigger?(:Y) ; check_command(2)
  676. elsif Input.trigger?(:A) ; check_command(3)
  677. elsif Input.trigger?(:C) ; check_command(4)
  678. elsif Input.trigger?(:B) ; check_command(5)
  679. elsif Input.trigger?(:L) ; check_command(6)
  680. elsif Input.trigger?(:R) ; check_command(7)
  681. elsif Input.trigger?(:RIGHT) ; check_command(8)
  682. elsif Input.trigger?(:LEFT) ; check_command(9)
  683. elsif Input.trigger?(:DOWN) ; check_command(10)
  684. elsif Input.trigger?(:UP) ; check_command(11)
  685. end
  686. end
  687.  
  688. #--------------------------------------------------------------------------
  689. # ● command_list_check
  690. #--------------------------------------------------------------------------
  691. def command_list_check(command)
  692. case command
  693. when "A" ; @com = 0
  694. when "D" ; @com = 1
  695. when "S" ; @com = 2
  696. when "Shift" ; @com = 3
  697. when "Z" ; @com = 4
  698. when "X" ; @com = 5
  699. when "Q" ; @com = 6
  700. when "W" ; @com = 7
  701. when "Right" ; @com = 8
  702. when "Left" ; @com = 9
  703. when "Down" ; @com = 10
  704. when "Up" ; @com = 11
  705. else ; @com = 12
  706. end
  707. end
  708.  
  709. #--------------------------------------------------------------------------
  710. # ● check_command
  711. #--------------------------------------------------------------------------
  712. def check_command(com)
  713. if com != -1
  714. right_input = false
  715. @chain_command.each_with_index do |i, index|
  716. if index == @com_index
  717. command_list_check(i) ; right_input = true if @com == com
  718. end
  719. end
  720. else
  721. command_list_check(@com_index) ; right_input = true
  722. end
  723. if right_input
  724. next_command
  725. else
  726. wrong_command(0)
  727. end
  728. end
  729.  
  730. #--------------------------------------------------------------------------
  731. # ● Next Command
  732. #--------------------------------------------------------------------------
  733. def next_command
  734. @com_index += 1
  735. Audio.se_play("Audio/SE/" + CHAIN_RIGHT_SE, 100, 100)
  736. if @com_index == @chain_command.size
  737. @phase = 9 ; @success = true
  738. return
  739. end
  740. refresh_button_command
  741. end
  742.  
  743. #--------------------------------------------------------------------------
  744. # ● wrong_command
  745. #--------------------------------------------------------------------------
  746. def wrong_command(type = 0)
  747. @wrong_commnad[0] = true ; @wrong_commnad[1] = type
  748. @skill_name.bitmap.clear
  749. Audio.se_play("Audio/SE/" + CHAIN_WRONG_SE, 100, 100)
  750. wname = type == 0 ? CHAIN_MISSED_WORDS[0] : CHAIN_MISSED_WORDS[1]
  751. @skill_name.bitmap.draw_text(0,0,200,32,wname.to_s,1)
  752. end
  753.  
  754. #--------------------------------------------------------------------------
  755. # ● missed
  756. #--------------------------------------------------------------------------
  757. def missed
  758. @success = false ; @phase = 9
  759. end
  760.  
  761. end
Advertisement
Add Comment
Please, Sign In to add comment