Advertisement
Guest User

Untitled

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