Advertisement
bowei

Blitz Command

Oct 13th, 2019
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 28.66 KB | None | 0 0
  1.  
  2. #==============================================================================
  3. # +++ MOG - Blitz Commands (v1.6) +++
  4. #==============================================================================
  5. # By Moghunter
  6. # https://atelierrgss.wordpress.com/
  7. #==============================================================================
  8. # Permite ativar ações através de sequência de comandos.
  9. #==============================================================================
  10. # UTILIZAÇÃO
  11. #==============================================================================
  12. # No banco de dados de habilidades ou itens, coloque o seguinte comentário na
  13. # caixa de notas.
  14. #
  15. # <Blitz Command>
  16. #
  17. # * Lembre-se de definir a sequência de botões no editor de script antes de
  18. # usar a habilidade
  19. #
  20. # Para definir uma velocidade especifica na sequência de botões use o cometário
  21. # abaixo.
  22. #
  23. # <Blitz Speed = X>
  24. #
  25. #==============================================================================
  26. # Arquivos necessários. Graphics/System/
  27. #==============================================================================
  28. #
  29. # Blitz_Background.png
  30. # Blitz_Flash.png
  31. # Blitz_Layout.png
  32. # Blitz_Meter.png
  33. # Chain_Command.png
  34. #
  35. #==============================================================================
  36. # Histórico
  37. #==============================================================================
  38. # v1.6 - Melhoria na codificação.
  39. #==============================================================================
  40.  
  41. $imported = {} if $imported.nil?
  42. $imported[:mog_blitz_commands] = true
  43.  
  44. module MOG_BLITZ_COMMANDS
  45.   #Definição do tempo para inserir os comandos. (tempo X quantidade de comandos)
  46.   DEFAULT_INPUT_DURATION = 138  #
  47.  #==============================================================================
  48.  # BLITZ_INPUT = { SKILL_ID => [COMMAND] }
  49.  #
  50.  # SKILL_ID = ID da habilidade no banco de dados.
  51.  # COMMANDS = Defina aqui a sequência de botões.
  52.  #            (Para fazer a sequência use os comandos abaixo)  
  53.  #  
  54.  # "Down" ,"Up" ,"Left" ,"Right" ,"Shift" ,"D" ,"S" ,"A" ,"Z" ,"X" ,"Q" ,"W"
  55.  #
  56.  # Exemplo de utilização
  57.  #
  58.  # BLITZ_INPUT = {
  59.  # 25=>["Down","D","S","Right"],
  60.  # 59=>["Down","Up","Left","Right","Shift","D","S","A","Z","X","Q","W"],
  61.  # 80=>["Shift","D"]
  62.  # }  
  63.  #==============================================================================
  64.   BLITZ_INPUT = {
  65.  
  66. #    143=>["Random","Random","Random","Random","Random"],
  67. #    144=>["Random","Random","Random","Random","Random","Random"],
  68.     230=>["Random","Random","Random","Random","Random"],
  69.     231=>["Random","Random","Random","Random","Random","Random"],
  70.     232=>["Random","Random","Random","Random","Random","Random","Random"],
  71.     233=>["Random","Random","Random","Random","Random","Random","Random","Random"],
  72.     234=>["Random","Random","Random","Random","Random","Random","Random","Random","Random","Random","Random"],
  73.     235=>["Random","Random","Random","Random","Random","Random","Random","Random","Random","Random","Random","Random","Random","Random"],
  74.  
  75. #    149=>["Random","Random","Random","Random","Random"],
  76. #    150=>["Random","Random","Random","Random","Random","Random"],
  77. #    151=>["Random","Random","Random","Random","Random","Random","Random"],
  78.  
  79.  
  80. #    155=>["Random","Random","Random","Random","Random"],
  81. #    156=>["Random","Random","Random","Random","Random","Random"],
  82. #    157=>["Random","Random","Random","Random","Random","Random","Random"],
  83.  
  84.    
  85. #    161=>["Random","Random","Random","Random","Random"],
  86. #    162=>["Random","Random","Random","Random","Random","Random"],
  87. #    163=>["Random","Random","Random","Random","Random","Random","Random"],
  88.  
  89.    
  90. #    166=>["Random","Random","Random","Random","Random"],
  91. #    167=>["Random","Random","Random","Random","Random","Random"],
  92. #    168=>["Random","Random","Random","Random","Random","Random","Random"],
  93.    
  94.    
  95.    
  96.    
  97.    
  98. #   22=>["Left","Up","Right","Down","Up","Down","Left","Right","Z"],
  99. #   51=>["Up","Down","Left","Right","Z"],
  100. #   53=>["X","Z","A","S","D"],
  101. #   61=>["Z","D","X","Right","Left"],
  102. #   62=>["Right","Left","Right","Q","Z","Z","D","X","Right","Left"],
  103. #   66=>["Right","Up","Up","Z"],
  104. #   69=>["X","Right","Left","Z","Z"],
  105. #   74=>["Down","Right","Down","Right","A"],
  106. #   999=>["Left","Right","Left","Right","Left","Right","Q","Z","Up","A","S",
  107. #        "Down","D","Z","Right","Up","Up","Z","W","Left","Down","D","A","W"]
  108.  }  
  109.  #Ativar animação da imagem de fundo.
  110.  BACKGROUND_ENABLE = false   #false
  111.  #Velocidade de deslize da imagem de fundo.
  112.  BACKGROUND_SCROLL_SPEED = [30,0]
  113.  #Posição do layout.
  114.  BLITZ_POSITION = [0,0]
  115.  #Posição do botão.
  116.  BUTTON_POSITION = [295,190]    # [265,170]           #[307,205]
  117.  #Posição do medidor de tempo.
  118.  METER_POSITION = [66,284]  #[63,249]    
  119.  #Posição do sprite Flash.
  120.  FLASH_POSITION = [0,170]   # [0,146]
  121.  #Posição do ícone.
  122.  ICON_POSITION = [-15,2] # [0,0]
  123.  #Posição do nome da skill
  124.  SKILL_NAME_POSITION = [220,126]   # [180,140]    [226,168]
  125.  #Definição das palavras usadas no sistema blitz.
  126.  BLITZ_WORDS = ["Missed!", "Timeover", "Success!"]
  127.  #Configuração da fonte.
  128.  FONT_SIZE = 28  #22
  129.  FONT_COLOR = Color.new(255,255,255)
  130.  #Prioridade dos sprites.
  131.  BLITZ_Z = 10500
  132.  #Som ao acertar.
  133.  RIGHT_SE = "Chime2"  #Chime1
  134.  #Som ao errar.
  135.  WRONG_SE = "Buzzer1"  
  136.  #Definição do som ao ativar o sistema.
  137.  BLITZ_START_SE = "Saint9"
  138.  
  139.  
  140.  RANDOM_KEYS = ["Left","Right","Up","Down"]   #,"D","S","A","Z","X"
  141.  
  142.  
  143. end
  144.  
  145. #==============================================================================
  146. # ■ Game Temp
  147. #==============================================================================
  148. class Game_Temp
  149.   attr_accessor :blitz_commands
  150.   attr_accessor :blitz_commands_phase
  151.   #--------------------------------------------------------------------------
  152.   # ● Initialize
  153.   #--------------------------------------------------------------------------      
  154.   alias mog_blits_commands_initialize initialize
  155.   def initialize
  156.       @blitz_commands = [false,0] ; @blitz_commands_phase = false
  157.       mog_blits_commands_initialize
  158.   end
  159.  
  160. end
  161.  
  162. #==============================================================================
  163. # ■ Scene_Battle
  164. #==============================================================================
  165. class Scene_Battle < Scene_Base
  166.  
  167.   #--------------------------------------------------------------------------
  168.   # ● Use Item
  169.   #--------------------------------------------------------------------------  
  170.   alias mog_blitz_commands_use_item use_item
  171.   def use_item
  172.       if can_execute_blitz_input?
  173.          blitz_before_action
  174.          execute_blitz_input
  175.          blitz_after_action
  176.          unless $game_temp.blitz_commands[1] == nil
  177.              return if !$game_temp.blitz_commands[0]
  178.          end
  179.       end
  180.       mog_blitz_commands_use_item    
  181.   end
  182.  
  183.   #--------------------------------------------------------------------------
  184.   # ● Blitz Before Action
  185.   #--------------------------------------------------------------------------  
  186.   def blitz_before_action
  187.       record_window_data if $imported[:mog_atb_system]
  188.       if $imported[:mog_menu_cursor]    
  189.          @chain_curor_x = $game_temp.menu_cursor[2]
  190.          $game_temp.menu_cursor[2] = -999
  191.          force_cursor_visible(false)
  192.       end            
  193.   end      
  194.  
  195.   #--------------------------------------------------------------------------
  196.   # ● Blitz After ACtion
  197.   #--------------------------------------------------------------------------  
  198.   def blitz_after_action
  199.       restore_window_data if $imported[:mog_atb_system]
  200.       if $imported[:mog_menu_cursor] and @chain_curor_x != nil
  201.          $game_temp.menu_cursor[2] = @chain_curor_x
  202.          
  203.        end
  204.  
  205.   end    
  206.  
  207.   #--------------------------------------------------------------------------
  208.   # ● Can Execute Blitz Input
  209.   #--------------------------------------------------------------------------    
  210.   def can_execute_blitz_input?
  211.       return false if !@subject.is_a?(Game_Actor)
  212.       return false if @subject.restriction != 0
  213.       return true
  214.   end
  215.  
  216.   #--------------------------------------------------------------------------
  217.   # ● Execute Blitz Input
  218.   #--------------------------------------------------------------------------  
  219.   def execute_blitz_input
  220.       $game_temp.blitz_commands[0] = false
  221.       action_id = @subject.current_action.item.note =~ /<Blitz Command>/ ? @subject.current_action.item.id : nil
  222.       $game_temp.blitz_commands[1] = action_id
  223.       return if action_id == nil
  224.       blitz_command_sequence = MOG_BLITZ_COMMANDS::BLITZ_INPUT[action_id]
  225.       if $imported[:mog_menu_cursor]    
  226.          valor_x = $game_temp.menu_cursor[2] ; $game_temp.menu_cursor[2] = -999
  227.          force_cursor_visible(false)
  228.       end      
  229.       if blitz_command_sequence != nil  
  230.          blitz_sq = Blitz_Commands.new(blitz_command_sequence, @subject ,action_id)
  231.          loop do
  232.               $game_temp.blitz_commands_phase = true
  233.               (blitz_sq.update ; Input.update) unless @spriteset.animation?
  234.               @spriteset.update ; Graphics.update ; update_info_viewport
  235.               break if blitz_sq.phase == 9
  236.          end
  237.          blitz_sq.dispose
  238.       end        
  239.       $game_temp.menu_cursor[2] = valor_x if $imported[:mog_menu_cursor]
  240.       $game_temp.blitz_commands_phase = false
  241.   end
  242.  
  243. end
  244.  
  245. #==============================================================================
  246. # Game Temp
  247. #==============================================================================
  248. class Game_Temp
  249.  
  250.   attr_accessor :cache_blitz_command
  251.  
  252.   #--------------------------------------------------------------------------
  253.   # ● Initialize
  254.   #--------------------------------------------------------------------------
  255.   alias mog_blitz_command_initialize initialize  
  256.   def initialize
  257.       mog_blitz_command_initialize
  258.       cache_blt_cmd
  259.   end
  260.  
  261.   #--------------------------------------------------------------------------
  262.   # ● Cache Blt Cmd
  263.   #--------------------------------------------------------------------------  
  264.   def cache_blt_cmd
  265.       @cache_blitz_command = []
  266.       @cache_blitz_command.push(Cache.system("Blitz_Background"))
  267.       @cache_blitz_command.push(Cache.system("IconSet"))
  268.       @cache_blitz_command.push(Cache.system("Blitz_Flash"))
  269.       @cache_blitz_command.push(Cache.system("Blitz_Meter"))
  270.       @cache_blitz_command.push(Cache.system("Blitz_Layout"))
  271.       @cache_blitz_command.push(Cache.system("Chain_Battle_Command"))
  272.   end
  273.  
  274. end
  275.  
  276.  
  277. #==============================================================================
  278. # ■ Spriteset Battle
  279. #==============================================================================
  280. class Spriteset_Battle
  281.    
  282.   #--------------------------------------------------------------------------
  283.   # ● Initialize
  284.   #--------------------------------------------------------------------------    
  285.   alias mog_blitz_commands_initialize initialize
  286.   def initialize
  287.       $game_temp.cache_blt_cmd
  288.       mog_blitz_commands_initialize    
  289.   end
  290. end  
  291. #==============================================================================
  292. # Blitz Commands
  293. #==============================================================================
  294. class Blitz_Commands
  295.   include MOG_BLITZ_COMMANDS
  296.   attr_accessor :phase
  297.  
  298.   #--------------------------------------------------------------------------
  299.   # ● Initialize
  300.   #--------------------------------------------------------------------------      
  301.   def initialize(sequence, subject,action_id)
  302.      @chain_command_original = sequence       ##
  303.  
  304.       @phase = 0 ; @actor = subject ; @skill = $data_skills[action_id]
  305.       @skillname = @skill.name ; @action_id = action_id
  306.       @chain_command = sequence.dup  ; @end = false      ##
  307.       duration = @skill.note =~ /<Blitz Speed = (\d+)>/i ? $1.to_i : DEFAULT_INPUT_DURATION + $game_variables[160]
  308.  
  309.             random_sequence   ##
  310.  
  311.       @timer_max = duration     # * @chain_command.size ; @timer_max = 1 if @timer_max < 1
  312.       @timer = @timer_max ; @com = 0 ; @com_index = 0 ; @new_x = 0
  313.       Audio.se_play("Audio/SE/" + BLITZ_START_SE, 100, 100) rescue nil
  314.       create_sprites
  315.  
  316.   end
  317.    
  318.  
  319.  
  320.     def random_sequence
  321.       @chain_command_original.each_with_index do |c, i|
  322.       next if c != "Random"
  323.       k = rand(RANDOM_KEYS.size) ; @chain_command[i] = RANDOM_KEYS[k]
  324.       end
  325.   end
  326.  
  327.  
  328.  
  329.  
  330.   #--------------------------------------------------------------------------
  331.   # ● Create Sprites
  332.   #--------------------------------------------------------------------------        
  333.   def create_sprites
  334.       create_background ; create_layout ; create_buttons ; create_meter
  335.       create_flash ; create_skill_name ; create_icon      
  336.      
  337.  
  338.   end
  339.  
  340.   #--------------------------------------------------------------------------
  341.   # ● Create Background
  342.   #--------------------------------------------------------------------------        
  343.   def create_background
  344.       @background = Plane.new ; @background.opacity = 0
  345.       @background.bitmap = $game_temp.cache_blitz_command[0]
  346.       @background.z = BLITZ_Z ; @background.visible = BACKGROUND_ENABLE
  347.   end
  348.  
  349.   #--------------------------------------------------------------------------
  350.   # ● Create Icon
  351.   #--------------------------------------------------------------------------      
  352.   def create_icon
  353.       @icon_image = $game_temp.cache_blitz_command[1]
  354.       @icon_sprite = Sprite.new ; @icon_sprite.bitmap = Bitmap.new(24,24)
  355.       @icon_sprite.z = BLITZ_Z + 3
  356.       @org_x2 = 80 + ICON_POSITION[0] - @center + SKILL_NAME_POSITION[0]
  357.       @icon_sprite.x = @org_x2 ; @icon_sprite.opacity = 0
  358.       @icon_sprite.y = ICON_POSITION[1] + SKILL_NAME_POSITION[1]    
  359.       icon_rect = Rect.new(@skill.icon_index % 16 * 24, @skill.icon_index / 16 * 24, 24, 24)
  360.       @icon_sprite.bitmap.blt(0,0, @icon_image, icon_rect)
  361.   end  
  362.  
  363.   #--------------------------------------------------------------------------
  364.   # ● Initialize
  365.   #--------------------------------------------------------------------------      
  366.   def create_skill_name
  367.       @skill_name = Sprite.new ; @skill_name.bitmap = Bitmap.new(200,32)
  368.       @skill_name.bitmap.font.size = FONT_SIZE
  369.       @skill_name.z = BLITZ_Z + 3 ; @skill_name.y = SKILL_NAME_POSITION[1]
  370.       @skill_name.opacity = 0 ; refresh_skill_name
  371.   end
  372.  
  373.   #--------------------------------------------------------------------------
  374.   # ● Refresh Skill Name
  375.   #--------------------------------------------------------------------------        
  376.   def refresh_skill_name
  377.       cm = @skillname.to_s.split(//).size
  378.       @center = ((200 / @skill_name.bitmap.font.size) * cm / 2) + 5
  379.       @org_x = SKILL_NAME_POSITION[0] ; @skill_name.x = @org_x  
  380.       @skill_name.bitmap.font.color = Color.new(0,0,0)
  381.       @skill_name.bitmap.draw_text(1,1,200,32,@skillname.to_s,1)  
  382.       @skill_name.bitmap.font.color = FONT_COLOR
  383.       @skill_name.bitmap.draw_text(0,0,200,32,@skillname.to_s,1)  
  384.   end  
  385.  
  386.   #--------------------------------------------------------------------------
  387.   # ● Create Flash
  388.   #--------------------------------------------------------------------------          
  389.   def create_flash
  390.       @flash_type = 0 ; @flash_image = $game_temp.cache_blitz_command[2]
  391.       @flash_cw = @flash_image.width ; @flash_ch = @flash_image.height / 2
  392.       @flash = Sprite.new ; @flash.bitmap = Bitmap.new(@flash_cw,@flash_ch)
  393.       @flash.x = FLASH_POSITION[0] ; @flash.y = FLASH_POSITION[1]
  394.       @flash.z = BLITZ_Z + 2 ; @flash.opacity = 0 ; @flash.blend_type = 1
  395.       refresh_flash
  396.   end
  397.  
  398.   #--------------------------------------------------------------------------
  399.   # ● Refresh Flash
  400.   #--------------------------------------------------------------------------            
  401.   def refresh_flash
  402.       @flash.bitmap.clear
  403.       f_scr = Rect.new(0,@flash_type * @flash_ch,@flash_cw,@flash_ch)
  404.       @flash.bitmap.blt(0,0,@flash_image,f_scr)
  405.   end
  406.  
  407.   #--------------------------------------------------------------------------
  408.   # ● Create Meter
  409.   #--------------------------------------------------------------------------          
  410.   def create_meter
  411.       @meter_image = $game_temp.cache_blitz_command[3]
  412.       @meter_cw = @meter_image.width ; @meter_ch = @meter_image.height
  413.       @meter_sprite = Sprite.new
  414.       @meter_sprite.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  415.       @meter_sprite.x = METER_POSITION[0] ; @meter_sprite.y = METER_POSITION[1]
  416.       @meter_sprite.z = BLITZ_Z + 2 ; @meter_sprite.opacity = 0 ; update_meter
  417.   end
  418.  
  419.   #--------------------------------------------------------------------------
  420.   # ● Update Meter
  421.   #--------------------------------------------------------------------------            
  422.   def update_meter
  423.       return if @meter_sprite == nil
  424.       @meter_sprite.bitmap.clear ; m_width = @meter_cw * @timer / @timer_max
  425.       m_scr = Rect.new(0,0,m_width,@meter_ch)
  426.       @meter_sprite.bitmap.blt(0,0,@meter_image, m_scr)
  427.   end
  428.  
  429.   #--------------------------------------------------------------------------
  430.   # ● Create Layout
  431.   #--------------------------------------------------------------------------          
  432.   def create_layout
  433.       @layout = Sprite.new ; @layout.bitmap = $game_temp.cache_blitz_command[4]
  434.       @layout.x = BLITZ_POSITION[0] ; @layout.y = BLITZ_POSITION[1]
  435.       @layout.z = BLITZ_Z + 1 ; @layout.opacity = 0
  436.   end
  437.  
  438.   #--------------------------------------------------------------------------
  439.   # ● Create Buttons
  440.   #--------------------------------------------------------------------------      
  441.   def create_buttons  
  442.    
  443.     @image = $game_temp.cache_blitz_command[5]  
  444.     @image_cw = @image.width / 13 ; @image_ch = @image.height  
  445.     @image_cw_max = (@image_cw + 5) * @chain_command.size
  446.     @sprite = Sprite.new ; @sprite.bitmap = Bitmap.new(@image_cw_max,@image_ch * 2)
  447.  
  448.     if @chain_command.size <= 15
  449.         @sprite.x = (Graphics.width / 2) - ((@image_cw + 5) * @chain_command.size) / 2
  450.         @new_x = 0
  451.      else  
  452.         @sprite.x = (Graphics.width / 2) ; @new_x = @sprite.x
  453.      end  
  454.      @sprite.x =  BUTTON_POSITION[0]
  455.      @sprite.y = BUTTON_POSITION[1]
  456.      @sprite.z = BLITZ_Z + 1 ; @sprite.opacity = 0 ; refresh_button
  457.      
  458.  
  459.   end  
  460.  
  461.   #--------------------------------------------------------------------------
  462.   # ● Refresh Button
  463.   #--------------------------------------------------------------------------        
  464.   def refresh_button
  465.      return if @sprite == nil
  466.      @sprite.bitmap.clear
  467.      @chain_command.each_with_index do |i, index|
  468.         command_list_check(i)
  469.          bitmap_src_rect = Rect.new(@com * @image_cw, 0, @image_cw, @image_ch)
  470.          if @com_index == index
  471.             @sprite.bitmap.blt(index * (@image_cw + 5) , 0 , @image, bitmap_src_rect)
  472.          else
  473.             @sprite.bitmap.blt(index * (@image_cw + 5) , @image_ch - 15 , @image, bitmap_src_rect)    ##  @image_ch -15
  474.         end    
  475.      end  
  476.       @new_x = BUTTON_POSITION[0] - ((@image_cw + 5) * @com_index)  
  477.   end
  478.  
  479.   #--------------------------------------------------------------------------
  480.   # ● Dispose
  481.   #--------------------------------------------------------------------------        
  482.   def dispose
  483.       dispose_background ; dispose_layout ; dispose_buttons ; dispose_meter
  484.       dispose_flash ; dispose_name ; dispose_icon_sprite      
  485.   end
  486.  
  487.   #--------------------------------------------------------------------------
  488.   # ● Dispose Background
  489.   #--------------------------------------------------------------------------          
  490.   def dispose_background
  491.       return if @background == nil
  492.       @background.dispose ; @background = nil
  493.   end  
  494.  
  495.   #--------------------------------------------------------------------------
  496.   # ● Dispose Icon Sprite
  497.   #--------------------------------------------------------------------------        
  498.   def dispose_icon_sprite
  499.       return if @icon_sprite == nil
  500.       @icon_sprite.bitmap.dispose ; @icon_sprite.dispose ; @icon_sprite = nil
  501.   end  
  502.  
  503.   #--------------------------------------------------------------------------
  504.   # ● Dispose Name
  505.   #--------------------------------------------------------------------------        
  506.   def dispose_name
  507.       return if @skill_name == nil
  508.       @skill_name.bitmap.dispose ; @skill_name.dispose ; @skill_name = nil
  509.   end  
  510.  
  511.   #--------------------------------------------------------------------------
  512.   # ● Dispose Flash
  513.   #--------------------------------------------------------------------------            
  514.   def dispose_flash
  515.       return if @flash == nil
  516.       @flash.bitmap.dispose ; @flash.dispose ; @flash = nil
  517.   end    
  518.  
  519.   #--------------------------------------------------------------------------
  520.   # ● Dispose Meter
  521.   #--------------------------------------------------------------------------            
  522.   def dispose_meter
  523.       return if @meter_sprite == nil
  524.       @meter_sprite.bitmap.dispose ; @meter_sprite.dispose ; @meter_sprite = nil
  525.   end  
  526.  
  527.   #--------------------------------------------------------------------------
  528.   # ● Dispose Buttons
  529.   #--------------------------------------------------------------------------        
  530.   def dispose_buttons
  531.       return if @sprite == nil
  532.       @sprite.bitmap.dispose ; @sprite.dispose ; @sprite = nil
  533.   end  
  534.  
  535.   #--------------------------------------------------------------------------
  536.   # ● Dispose Layout
  537.   #--------------------------------------------------------------------------            
  538.   def dispose_layout
  539.       return if @layout == nil
  540.       @layout.dispose ; @layout = nil
  541.   end  
  542.  
  543.   #--------------------------------------------------------------------------
  544.   # ● Update
  545.   #--------------------------------------------------------------------------        
  546.   def update
  547.       if @end  and @sprite.x == @new_x
  548.          update_flash ; update_background ; update_end
  549.          return
  550.       end
  551.       update_background ; update_timer ; update_command ; update_slide_command
  552.       update_meter ; update_flash ; update_opacity
  553.  
  554.   end
  555.  
  556.   #--------------------------------------------------------------------------
  557.   # ● Update Opacity
  558.   #--------------------------------------------------------------------------          
  559.   def update_opacity
  560.       return if @sprite.opacity == nil
  561.       @sprite.opacity += 10 ; @layout.opacity += 50                    #10
  562.       @meter_sprite.opacity += 10 ; @skill_name.opacity += 10
  563.       @background.opacity += 10 ; @icon_sprite.opacity += 10  
  564.   end
  565.    
  566.   #--------------------------------------------------------------------------
  567.   # ● Update End
  568.   #--------------------------------------------------------------------------          
  569.   def update_end
  570.       fs = 6 ; @icon_sprite.opacity -= fs ; @background.opacity -= fs
  571.       @skill_name.opacity -= fs ; @sprite.opacity -= fs ; @layout.opacity -= fs
  572.       @meter_sprite.opacity -= fs ; @phase = 9 if @background.opacity == 0
  573.   end
  574.  
  575.   #--------------------------------------------------------------------------
  576.   # ● Update Background
  577.   #--------------------------------------------------------------------------          
  578.   def update_background
  579.       return if @background == nil
  580.       @background.ox += BACKGROUND_SCROLL_SPEED[0]
  581.       @background.oy += BACKGROUND_SCROLL_SPEED[1]
  582.   end    
  583.  
  584.   #--------------------------------------------------------------------------
  585.   # ● Update Flash
  586.   #--------------------------------------------------------------------------              
  587.   def update_flash
  588.       return if @flash == nil or @flash.opacity == 0
  589.       @flash.opacity -= 10
  590.   end  
  591.  
  592.   #--------------------------------------------------------------------------
  593.   # ● Update Timer
  594.   #--------------------------------------------------------------------------          
  595.   def update_timer
  596. #      return if @timer <= 0
  597.       return if @end
  598.       @timer -= 1 # ; @end = true if @timer <= 0  # wrong_command(1) if @timer == 0
  599.      
  600.       if @timer <= 0
  601.          @flash_type = 1
  602.          Audio.se_play("Audio/SE/" + WRONG_SE , 80, 100) ; @flash.opacity = 255   #
  603.           @skill_name.bitmap.clear
  604.           @end =true
  605.  #        wname = type == 0 ? BLITZ_WORDS[0] : BLITZ_WORDS[1]
  606.           $game_temp.blitz_commands[0] = false
  607.           @skill_name.bitmap.draw_text(0,0,200,32,BLITZ_WORDS[1].to_s,1)    #wname
  608.           @icon_sprite.visible = false ; refresh_flash
  609.      
  610.      end
  611.      
  612.   end
  613.  
  614.   #--------------------------------------------------------------------------
  615.   # ● Update Slide Command
  616.   #--------------------------------------------------------------------------          
  617.   def update_slide_command
  618.       return if @sprite == nil or @sprite.x == @new_x
  619.       slide_speed = 5 + ((@sprite.x - @new_x).abs / 5)      
  620.       @sprite.x -= slide_speed ; @sprite.x = @new_x if @sprite.x < @new_x
  621.   end
  622.  
  623. end
  624.  
  625. #==============================================================================
  626. # Blitz Commands
  627. #==============================================================================
  628. class Blitz_Commands
  629.  
  630.  #--------------------------------------------------------------------------
  631.  # ● Update Command
  632.  #--------------------------------------------------------------------------      
  633.  def update_command
  634.      return if @end
  635.      if Input.trigger?(Input::X) ; check_command(0)
  636.      elsif Input.trigger?(:Z) ; check_command(1)
  637.      elsif Input.trigger?(:Y) ; check_command(2)
  638.      elsif Input.trigger?(:A) ; check_command(3)
  639.      elsif Input.trigger?(:C) ; check_command(4)
  640.      elsif Input.trigger?(:B) ; check_command(5)
  641.      elsif Input.trigger?(:L) ; check_command(6)
  642.      elsif Input.trigger?(:R) ; check_command(7)        
  643.      elsif Input.trigger?(:RIGHT) ; check_command(8)
  644.      elsif Input.trigger?(:LEFT) ; check_command(9)
  645.      elsif Input.trigger?(:DOWN) ; check_command(10)
  646.      elsif Input.trigger?(:UP) ; check_command(11)
  647.      end  
  648.  end  
  649.    
  650.  #--------------------------------------------------------------------------
  651.  # ● command_list_check
  652.  #--------------------------------------------------------------------------      
  653.  def command_list_check(command)
  654.      case command
  655.          when "A" ; @com = 0  
  656.          when "D" ; @com = 1  
  657.          when "S" ; @com = 2
  658.          when "Shift" ; @com = 3
  659.          when "Z" ; @com = 4
  660.          when "X" ; @com = 5
  661.          when "Q" ; @com = 6
  662.          when "W" ; @com = 7            
  663.          when "Right" ; @com = 8
  664.          when "Left" ; @com = 9
  665.          when "Down" ; @com = 10
  666.          when "Up" ; @com = 11
  667.          else ; @com = 12          
  668.      end
  669.  end  
  670.  
  671.  #--------------------------------------------------------------------------
  672.  # ● check_command
  673.  #--------------------------------------------------------------------------            
  674.  def check_command(com)
  675.      if com != -1
  676.         right_input = false
  677.         @chain_command.each_with_index do |i, index|
  678.         if index == @com_index
  679.            command_list_check(i) ; right_input = true if @com == com
  680.         end end
  681.      else  
  682.        command_list_check(@com_index) ; right_input = true
  683.      end  
  684.      if right_input
  685.         next_command
  686.      else  
  687.         wrong_command(0)
  688.      end  
  689.  end  
  690.    
  691.  #--------------------------------------------------------------------------
  692.  # ● Next Command
  693.  #--------------------------------------------------------------------------            
  694.  def next_command  
  695.      @flash.opacity = 255 ; @flash_type = 2 ; @com_index += 1  
  696.      Audio.se_play("Audio/SE/" + RIGHT_SE, 80, 100)
  697.      refresh_button   ; refresh_flash
  698.      if @com_index == @chain_command.size
  699.  
  700.         @flash_type = 0
  701.         refresh_button   ; refresh_flash
  702.  
  703.         @end = true ; @skill_name.bitmap.clear
  704.         @skill_name.bitmap.draw_text(0,0,200,32,BLITZ_WORDS[2].to_s,1)
  705.         @icon_sprite.visible = false ; $game_temp.blitz_commands[0] = true
  706.      end
  707.  end    
  708.  
  709.  #--------------------------------------------------------------------------
  710.  # ● wrong_command
  711.  #--------------------------------------------------------------------------              
  712.  def wrong_command(type)
  713.      Audio.se_play("Audio/SE/" + "Parry", 70, 100) ; @flash.opacity = 255  #WRONG_SE
  714.      @flash_type = 1 ;    #@skill_name.bitmap.clear    ;   @end = true    
  715.      
  716.      
  717. #         @end =true
  718. #        wname = type == 0 ? BLITZ_WORDS[0] : BLITZ_WORDS[1]
  719. #        $game_temp.blitz_commands[0] = false
  720. #      @skill_name.bitmap.draw_text(0,0,200,32,wname.to_s,1)
  721. #        @icon_sprite.visible = false ; refresh_flash
  722.          
  723.           @timer -= 15
  724.           refresh_flash
  725.  
  726.  
  727.    end
  728.  
  729.  
  730.    
  731.    
  732.    
  733.  end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement