Advertisement
Raizen

Akea Battle Windows

May 4th, 2014
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 38.26 KB | None | 0 0
  1. #=======================================================
  2. #        Akea Battle Damage Pop-up
  3. # Autor: Raizen
  4. # Comunidade: http://www.centrorpg.com/
  5. # Compatibilidade: RMVXAce
  6. #
  7. # Plug n' Play, basta colocar o script acima do main e configurar
  8. # abaixo, o script permite exibição de dano nos inimigos e no personagem.
  9. #=======================================================
  10. # =========================Não modificar==============================
  11. $included ||= Hash.new
  12. $included[:akea_battlewindow] = true
  13. module Akea_Battle_Window
  14. Party = []
  15. Win_Pic = []
  16. # =========================Não modificar==============================
  17.  
  18. #==============================================================================
  19. #------------------------------------------------------------------------------
  20. #------------------------- CONFIGURAÇÃO DE IMAGENS ----------------------------
  21. #------------------------------------------------------------------------------
  22. #==============================================================================
  23.  
  24. # Imagem do Cursor
  25. Cursor_Name = 'Cursor'
  26.  
  27. # Imagens de Fundo das janelas, para usar a janela padrão sem imagem
  28. # basta colocar o nome como ''
  29. # Exemplo Win_Pic[0] = ''
  30.  
  31. Win_Pic[0] = 'Status_Pic'  # Janela de Status dos personagens
  32. Win_Pic[1] = 'Battle_Pic1' # Janela de comando do grupo
  33. Win_Pic[2] = 'Battle_Pic1' # Janela de comando dos personagens
  34. Win_Pic[3] = 'Status_Pic' # Janela dos inimigos
  35. Win_Pic[4] = 'Status_Pic' # Janela de Mensagens
  36. Win_Pic[5] = 'Skill_Pic' # Janela de Habilidades
  37. Win_Pic[6] = 'Skill_Pic' # Janela de Itens
  38. Win_Pic[7] = 'Help_Pic' # Janela de Ajuda
  39. Win_Pic[8] = 'Battle_Pic1' # Janela Adicional que mostra o rosto do personagem
  40.  
  41.  
  42. Correct_X = 16 # COrreção dos Textos em X
  43. Correct_Y = 7 # Correção dos Textos em Y
  44.  
  45. Cursor_X = 0 # Correção do Cursor em X
  46. Cursor_Y = 12 # Correção do Cursor em Y
  47.  
  48.  
  49. # Configure aqui a posição da janela de comandos do personagem
  50. # APENAS NECESSÁRIO caso não use scripts que usem battlers para os
  51. # personagens, seguindo esse modo.
  52. # Party[id] =  [x, y]
  53. # Aonde id é a posição do personagem na party,
  54. # começando a contagem de 0, x posição em x e y posição em y
  55. Party[0] = [0, 170]
  56. Party[1] = [136, 170]
  57. Party[2] = [272, 170]
  58. Party[3] = [408, 170]
  59.  
  60.  
  61. Column = 1 # Número de colunas para itens e magias (1 ou 2)
  62.  
  63. # Configure as correções de posição
  64. # APENAS NECESSÁRIO caso use scriptes que usem battlers para os
  65. # personagens
  66. Actor_Sprt_X = -160 # Correção em X para a posição dos personagens
  67. Actor_Sprt_Y = -120 # Correção em Y para a posição dos personagens
  68.  
  69.  
  70.  
  71. #==============================================================================
  72. #------------------------------------------------------------------------------
  73. #------------------------- CONFIGURAÇÃO DA HUD ----------------------------
  74. #------------------------------------------------------------------------------
  75. #==============================================================================
  76.  
  77. # Nome das imagens nessa ordem, na pasta Graphics/System
  78. # [Imagem de fundo da hud de vida, Barra de HP,
  79. # Imagem de fundo da hud de mana, Barra de MP,
  80. # Imagem de fundo da hud de TP, Barra de TP]
  81.  
  82. Pic = ['BACK_BAR', 'HP_BAR', 'BACK_BAR', 'MP_BAR', 'BACK_BAR', 'TP_BAR']
  83.  
  84. # Correção da posição em X
  85. # Modifique os valores, pode ser negativo, até as barras atingirem a posição ideal.
  86. Todos_X = -10
  87. HP_X = 1
  88. MP_X = 1
  89. TP_X = 1
  90. # Correção da posição em Y
  91. Todos_Y = 16
  92. HP_Y = 4
  93. MP_Y = 4
  94. TP_Y = 4
  95.  
  96. # Manter Texto de HP/MP?
  97.  
  98. Text = true
  99.  
  100. # Manter numeração? (Ex 100/253)
  101. Num = true
  102.  
  103. # Tamanho da fonte
  104. Fonte = 16
  105. end
  106.  
  107.  
  108. #==============================================================================
  109. #------------------------------------------------------------------------------
  110. #--------------------------- AQUI COMEÇA O SCRIPT -----------------------------
  111. #------------------------------------------------------------------------------
  112. #==============================================================================
  113. #==============================================================================
  114. # ** Scene_Battle
  115. #------------------------------------------------------------------------------
  116. #  Esta classe executa o processamento da tela de batalha.
  117. #==============================================================================
  118.  
  119. class Scene_Battle < Scene_Base
  120. alias :abw_start :start
  121. alias :abw_turn_start :turn_start
  122. alias :abw_turn_end :turn_end
  123. alias :abw_terminate :terminate
  124. alias :abw_start_actor_command_selection :start_actor_command_selection
  125.   #--------------------------------------------------------------------------
  126.   # * Inicialização do processo
  127.   #--------------------------------------------------------------------------
  128.   def start(*args, &block)
  129.     abw_start(*args, &block)
  130.     $abw_cursor_set = Sprite.new
  131.     $abw_cursor_set.bitmap = Cache.akea(Akea_Battle_Window::Cursor_Name)
  132.     $abw_cursor_set.z = 800
  133.     $abw_cursor_set.opacity = 0
  134.     @update_cur_position = false
  135.     @actor_command_window.viewport = nil
  136.     @actor_command_window.x = 0
  137.     @actor_command_window.y = 0
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # * Início do turno
  141.   #--------------------------------------------------------------------------
  142.   def turn_start
  143.     $abw_cursor_set.opacity = 0
  144.     @act_face_battle.close
  145.     abw_turn_start
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # * Inicialização da seleção de comandos do herói
  149.   #--------------------------------------------------------------------------
  150.   def start_actor_command_selection
  151.     @act_face_battle.contents_opacity = 255
  152.     $abw_cursor_set.opacity = 255
  153.     @act_face_battle.opacity = 255 if Akea_Battle_Window::Win_Pic[8] == ''
  154.     @act_face_battle.refresh(BattleManager.actor)
  155.     if BattleManager.actor.use_sprite?
  156.       @actor_command_window.x = BattleManager.actor.screen_x + Akea_Battle_Window::Actor_Sprt_X
  157.       @actor_command_window.y = BattleManager.actor.screen_y + Akea_Battle_Window::Actor_Sprt_Y
  158.     else
  159.       @actor_command_window.x = Akea_Battle_Window::Party[BattleManager.actor.index][0]
  160.       @actor_command_window.y = Akea_Battle_Window::Party[BattleManager.actor.index][1]
  161.     end
  162.     abw_start_actor_command_selection
  163.   end  
  164.   #--------------------------------------------------------------------------
  165.   # * Criação da janela de mensagem
  166.   #--------------------------------------------------------------------------
  167.   def create_message_window
  168.     @message_window = Window_Abw_Message.new
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # * Criação da janela de ajuda
  172.   #--------------------------------------------------------------------------
  173.   def create_help_window
  174.     @help_window = Window_Battle_Help.new
  175.     @help_window.visible = false
  176.     @act_face_battle = Window_Battle_Face.new(@actor_command_window.width, @actor_command_window.height, @info_viewport)
  177.     @act_face_battle.opacity = 0
  178.     @act_face_battle.contents_opacity = 0
  179.   end
  180.   #--------------------------------------------------------------------------
  181.   # * Final do turno
  182.   #--------------------------------------------------------------------------
  183.   def turn_end
  184.     abw_turn_end
  185.     @act_face_battle.open
  186.     $abw_cursor_set.opacity = 255
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # * Finalização do processo
  190.   #--------------------------------------------------------------------------
  191.   def terminate
  192.     abw_terminate
  193.     $abw_cursor_set.bitmap.dispose
  194.     $abw_cursor_set.dispose
  195.     $abw_cursor_set = nil
  196.   end
  197. end
  198.  
  199. class Window_Battle_Face < Window_Base
  200.   #--------------------------------------------------------------------------
  201.   # * Inicialização do objeto
  202.   #--------------------------------------------------------------------------
  203.   def initialize(width, height, viewport)
  204.     super(Graphics.width, 0, width, height)
  205.     self.viewport = viewport
  206.     self.opacity = 0 unless Akea_Battle_Window::Win_Pic[8] == ''
  207.     refresh($game_party.battle_members[0])
  208.   end
  209.   def refresh(actor)
  210.     contents.clear
  211.     create_back_picture
  212.     x = Akea_Battle_Window::Win_Pic[8] == '' ? 0 : 12
  213.     y = Akea_Battle_Window::Win_Pic[8] == '' ? 0 : 12
  214.     draw_face(actor.face_name, actor.face_index, x, y, enabled = true)
  215.   end
  216.  
  217.   def create_back_picture
  218.     return if Akea_Battle_Window::Win_Pic[8] == ''
  219.     bitmap = Cache.akea(Akea_Battle_Window::Win_Pic[8])
  220.     rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  221.     contents.blt(0, 0, bitmap, rect, 255)
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # * Espaçamento lateral padrão
  225.   #--------------------------------------------------------------------------
  226.   def standard_padding
  227.     Akea_Battle_Window::Win_Pic[8] == '' ? 12 : 0
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # * Aquisição da altura da janela
  231.   #--------------------------------------------------------------------------
  232.   def window_height
  233.     Akea_Battle_Window::Win_Pic[8] == '' ? fitting_height(visible_line_number) : (fitting_height(visible_line_number) + 24)
  234.   end
  235. end
  236. #==============================================================================
  237. # ** Window_Help
  238. #------------------------------------------------------------------------------
  239. #  Esta janela exibe explicação de habilidades e itens e outras informações.
  240. #==============================================================================
  241.  
  242. class Window_Battle_Help < Window_Help
  243.   #--------------------------------------------------------------------------
  244.   # * Inicialização do objeto
  245.   #     line_number : número de linhas
  246.   #--------------------------------------------------------------------------
  247.   def initialize(line_number = 2)
  248.     unless Akea_Battle_Window::Win_Pic[7] == ''
  249.       @abw_picture = Sprite.new
  250.       @abw_picture.bitmap = Cache.akea(Akea_Battle_Window::Win_Pic[7])
  251.       @abw_picture.opacity = 0
  252.     end
  253.     super(line_number = 2)
  254.     self.opacity = 0 unless Akea_Battle_Window::Win_Pic[7] == ''
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # * Exibição da janela
  258.   #--------------------------------------------------------------------------
  259.   def show
  260.     if @abw_picture
  261.       @abw_picture.opacity = 255
  262.       @abw_picture.x = self.x
  263.       @abw_picture.y = self.y
  264.     end
  265.     super
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # * Ocultação da janela
  269.   #--------------------------------------------------------------------------
  270.   def hide
  271.     @abw_picture.opacity = 0 if @abw_picture
  272.     super
  273.   end
  274.   #--------------------------------------------------------------------------
  275.   # * Desenho do texto
  276.   #     args : Bitmap.draw_text
  277.   #--------------------------------------------------------------------------
  278.   def draw_text(*args)
  279.     if args[0].is_a?(Integer) && Akea_Battle_Window::Win_Pic[7] != ''
  280.       args[0] += Akea_Battle_Window::Correct_X - 6
  281.       args[1] += Akea_Battle_Window::Correct_Y - 6
  282.     elsif Akea_Battle_Window::Win_Pic[7] != ''
  283.       args[0].x += Akea_Battle_Window::Correct_X - 6
  284.       args[0].y += Akea_Battle_Window::Correct_Y - 6
  285.     end
  286.     contents.draw_text(*args)
  287.   end
  288.   def dispose
  289.     super
  290.     @abw_picture.bitmap.dispose
  291.     @abw_picture.dispose
  292.   end
  293. end
  294.  
  295. #==============================================================================
  296. # ** Window_BattleItem
  297. #------------------------------------------------------------------------------
  298. #  Esta janela para seleção de itens na tela de batalha.
  299. #==============================================================================
  300.  
  301. class Window_BattleItem < Window_ItemList
  302. alias :abw_draw_all_items :draw_all_items
  303. alias :abw_show :show
  304. alias :abw_hide :hide
  305. alias :abw_update_cursor :update_cursor
  306.   #--------------------------------------------------------------------------
  307.   # * Inicialização do objeto
  308.   #     info_viewport : viewport para exibir informações
  309.   #--------------------------------------------------------------------------
  310.   def initialize(help_window, info_viewport)
  311.     unless Akea_Battle_Window::Win_Pic[5] == ''
  312.       @abw_picture = Sprite.new
  313.       @abw_picture.bitmap = Cache.akea(Akea_Battle_Window::Win_Pic[5])
  314.       @abw_picture.opacity = 0
  315.     end
  316.     y = help_window.height
  317.     width = Graphics.width/2 * Akea_Battle_Window::Column
  318.     super(0, y, Graphics.width, info_viewport.rect.y - y)
  319.     self.visible = false
  320.     @help_window = help_window
  321.     @info_viewport = info_viewport
  322.     self.opacity = 0 unless Akea_Battle_Window::Win_Pic[5] == ''
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # * Exibição da janela
  326.   #--------------------------------------------------------------------------
  327.   def show
  328.     if @abw_picture
  329.       @abw_picture.opacity = 255
  330.       @abw_picture.x = self.x
  331.       @abw_picture.y = self.y
  332.     end
  333.     abw_show
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # * Ocultação da janela
  337.   #--------------------------------------------------------------------------
  338.   def hide
  339.     @abw_picture.opacity = 0 if @abw_picture
  340.     abw_hide
  341.   end
  342.   #--------------------------------------------------------------------------
  343.   # * Aquisição do número de colunas
  344.   #--------------------------------------------------------------------------
  345.   def col_max
  346.     return Akea_Battle_Window::Column
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # * Desenho do texto
  350.   #     args : Bitmap.draw_text
  351.   #--------------------------------------------------------------------------
  352.   def draw_text(*args)
  353.     if args[0].is_a?(Integer) && Akea_Battle_Window::Win_Pic[5] != ''
  354.       args[0] += Akea_Battle_Window::Correct_X - 6
  355.       args[1] += Akea_Battle_Window::Correct_Y - 6
  356.     elsif Akea_Battle_Window::Win_Pic[5] != ''
  357.       args[0].x += Akea_Battle_Window::Correct_X - 6
  358.       args[0].y += Akea_Battle_Window::Correct_Y - 6
  359.     end
  360.     contents.draw_text(*args)
  361.   end
  362.   #--------------------------------------------------------------------------
  363.   # * Desenho do número de itens possuido
  364.   #     rect : retângulo
  365.   #     item : item
  366.   #--------------------------------------------------------------------------
  367.   def draw_item_number(rect, item)
  368.     rect.x -= Akea_Battle_Window::Correct_X
  369.     rect.width /= (2 / Akea_Battle_Window::Column)
  370.     draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
  371.   end
  372.   #--------------------------------------------------------------------------
  373.   # * Atualização do cursor
  374.   #--------------------------------------------------------------------------
  375.   def update_cursor
  376.     abw_update_cursor unless $abw_cursor_set
  377.     if $abw_cursor_set
  378.       $abw_cursor_set.x = self.x + item_rect(@index).x + Akea_Battle_Window::Cursor_X
  379.       $abw_cursor_set.y = self.y + item_rect(@index - self.top_row).y + Akea_Battle_Window::Cursor_Y
  380.     end
  381.   end
  382.   def dispose
  383.     super
  384.     @abw_picture.bitmap.dispose
  385.     @abw_picture.dispose
  386.   end
  387. end
  388.  
  389.  
  390. #==============================================================================
  391. # ** Window_BattleSkill
  392. #------------------------------------------------------------------------------
  393. #  Esta janela para seleção de habilidades na tela de batalha.
  394. #==============================================================================
  395.  
  396. class Window_BattleSkill < Window_SkillList
  397. alias :abw_draw_all_items :draw_all_items
  398. alias :abw_show :show
  399. alias :abw_hide :hide
  400. alias :abw_draw_skill_cost :draw_skill_cost
  401.   #--------------------------------------------------------------------------
  402.   # * Inicialização do objeto
  403.   #     info_viewport : viewport para exibir informações
  404.   #--------------------------------------------------------------------------
  405.   def initialize(help_window, info_viewport)
  406.     unless Akea_Battle_Window::Win_Pic[5] == ''
  407.       @abw_picture = Sprite.new
  408.       @abw_picture.bitmap = Cache.akea(Akea_Battle_Window::Win_Pic[5])
  409.       @abw_picture.opacity = 0
  410.     end
  411.     y = help_window.height
  412.     width = Graphics.width/2 * Akea_Battle_Window::Column
  413.     super(0, y, width, info_viewport.rect.y - y)
  414.     self.visible = false
  415.     @help_window = help_window
  416.     @info_viewport = info_viewport
  417.     self.opacity = 0 unless Akea_Battle_Window::Win_Pic[5] == ''
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # * Atualização do cursor
  421.   #--------------------------------------------------------------------------
  422.   def update_cursor
  423.     super
  424.     if $abw_cursor_set
  425.       $abw_cursor_set.x = self.x + item_rect(@index).x + Akea_Battle_Window::Cursor_X
  426.       $abw_cursor_set.y = self.y + item_rect(@index - self.top_row).y + Akea_Battle_Window::Cursor_Y
  427.     end
  428.   end
  429.   #--------------------------------------------------------------------------
  430.   # * Exibição da janela
  431.   #--------------------------------------------------------------------------
  432.   def show
  433.     if @abw_picture
  434.       @abw_picture.opacity = 255
  435.       @abw_picture.x = self.x
  436.       @abw_picture.y = self.y
  437.     end
  438.     abw_show
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # * Ocultação da janela
  442.   #--------------------------------------------------------------------------
  443.   def hide
  444.     @abw_picture.opacity = 0 if @abw_picture
  445.     abw_hide
  446.   end
  447.   #--------------------------------------------------------------------------
  448.   # * Aquisição do número de colunas
  449.   #--------------------------------------------------------------------------
  450.   def col_max
  451.     return Akea_Battle_Window::Column
  452.   end
  453.   #--------------------------------------------------------------------------
  454.   # * Desenho do texto
  455.   #     args : Bitmap.draw_text
  456.   #--------------------------------------------------------------------------
  457.   def draw_text(*args)
  458.     if args[0].is_a?(Integer) && Akea_Battle_Window::Win_Pic[2] != ''
  459.       args[0] += Akea_Battle_Window::Correct_X - 6
  460.       args[1] += Akea_Battle_Window::Correct_Y - 6
  461.     elsif Akea_Battle_Window::Win_Pic[2] != ''
  462.       args[0].x += Akea_Battle_Window::Correct_X - 6
  463.       args[0].y += Akea_Battle_Window::Correct_Y - 6
  464.     end
  465.     contents.draw_text(*args)
  466.   end
  467.   #--------------------------------------------------------------------------
  468.   # * Desenho do custo das habilidades
  469.   #     rect  : retângulo
  470.   #     skill : habilidade
  471.   #--------------------------------------------------------------------------
  472.   def draw_skill_cost(rect, skill)
  473.     rect.x -= Akea_Battle_Window::Correct_X/2
  474.     abw_draw_skill_cost(rect, skill)
  475.   end
  476.   def dispose
  477.     super
  478.     @abw_picture.bitmap.dispose
  479.     @abw_picture.dispose
  480.   end
  481. end
  482.  
  483.  
  484. #==============================================================================
  485. # ** Window_Message
  486. #------------------------------------------------------------------------------
  487. #  Esta janela de mensagem é usada para exibir textos.
  488. #==============================================================================
  489.  
  490. class Window_Abw_Message < Window_Message
  491.   #--------------------------------------------------------------------------
  492.   # * Inicialização do objeto
  493.   #--------------------------------------------------------------------------
  494.   def initialize
  495.     super
  496.   end
  497.   #--------------------------------------------------------------------------
  498.   # * Atualização do fundo da janela
  499.   #--------------------------------------------------------------------------
  500.   def update_background
  501.     Akea_Battle_Window::Win_Pic[4] == '' ? super : self.opacity = 0
  502.   end
  503.   #--------------------------------------------------------------------------
  504.   # * Definição de quebra de página
  505.   #     text : texto
  506.   #     pos  : posição
  507.   #--------------------------------------------------------------------------
  508.   def new_page(text, pos)
  509.     super(text, pos)
  510.     create_back_picture
  511.   end
  512.   def create_back_picture
  513.     return if Akea_Battle_Window::Win_Pic[4] == ''
  514.     bitmap = Cache.akea(Akea_Battle_Window::Win_Pic[4])
  515.     rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  516.     contents.blt(0, 0, bitmap, rect, 255)
  517.   end
  518.   #--------------------------------------------------------------------------
  519.   # * Espaçamento lateral padrão
  520.   #--------------------------------------------------------------------------
  521.   def standard_padding
  522.     Akea_Battle_Window::Win_Pic[4] == '' ? 12 : 0
  523.   end
  524.   #--------------------------------------------------------------------------
  525.   # * Aquisição da altura da janela
  526.   #--------------------------------------------------------------------------
  527.   def window_height
  528.     Akea_Battle_Window::Win_Pic[4] == '' ? fitting_height(visible_line_number) : (fitting_height(visible_line_number) + 24)
  529.   end
  530.   #--------------------------------------------------------------------------
  531.   # * Desenho do texto
  532.   #     args : Bitmap.draw_text
  533.   #--------------------------------------------------------------------------
  534.   def draw_text(*args)
  535.     if args[0].is_a?(Integer) && Akea_Battle_Window::Win_Pic[4] != ''
  536.       args[0] += Akea_Battle_Window::Correct_X
  537.       args[1] += Akea_Battle_Window::Correct_Y
  538.     elsif Akea_Battle_Window::Win_Pic[4] != ''
  539.       args[0].x += Akea_Battle_Window::Correct_X
  540.       args[0].y += Akea_Battle_Window::Correct_Y
  541.     end
  542.     contents.draw_text(*args)
  543.   end
  544. end
  545. #==============================================================================
  546. # ** Window_BattleEnemy
  547. #------------------------------------------------------------------------------
  548. #  Esta janela para seleção de inimigos na tela de batalha.
  549. #==============================================================================
  550.  
  551. class Window_BattleEnemy < Window_Selectable
  552. alias :abw_draw_all_items :draw_all_items
  553.   #--------------------------------------------------------------------------
  554.   # * Inicialização do objeto
  555.   #--------------------------------------------------------------------------
  556.   def initialize(info_viewport)
  557.     Akea_Battle_Window::Win_Pic[3] == '' ? y = 0 : y = 24
  558.     super(0, info_viewport.rect.y, window_width, fitting_height(4) + y)
  559.     refresh
  560.     self.visible = false
  561.     @info_viewport = info_viewport
  562.     self.opacity = 0 unless Akea_Battle_Window::Win_Pic[3] == ''
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # * Criação da lista de comandos
  566.   #--------------------------------------------------------------------------
  567.   def draw_all_items
  568.     create_back_picture
  569.     abw_draw_all_items
  570.   end
  571.   def create_back_picture
  572.     return if Akea_Battle_Window::Win_Pic[3] == ''
  573.     bitmap = Cache.akea(Akea_Battle_Window::Win_Pic[3])
  574.     rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  575.     contents.blt(0, 0, bitmap, rect, 255)
  576.   end
  577.   #--------------------------------------------------------------------------
  578.   # * Espaçamento lateral padrão
  579.   #--------------------------------------------------------------------------
  580.   def standard_padding
  581.     Akea_Battle_Window::Win_Pic[3] == '' ? 12 : 0
  582.   end
  583.   #--------------------------------------------------------------------------
  584.   # * Aquisição da altura da janela
  585.   #--------------------------------------------------------------------------
  586.   def window_height
  587.     Akea_Battle_Window::Win_Pic[3] == '' ? fitting_height(visible_line_number) : (fitting_height(visible_line_number) + 24)
  588.   end
  589.   #--------------------------------------------------------------------------
  590.   # * Desenho do texto
  591.   #     args : Bitmap.draw_text
  592.   #--------------------------------------------------------------------------
  593.   def draw_text(*args)
  594.     if args[0].is_a?(Integer) && Akea_Battle_Window::Win_Pic[3] != ''
  595.       args[0] += Akea_Battle_Window::Correct_X
  596.       args[1] += Akea_Battle_Window::Correct_Y
  597.     elsif Akea_Battle_Window::Win_Pic[3] != ''
  598.       args[0].x += Akea_Battle_Window::Correct_X
  599.       args[0].y += Akea_Battle_Window::Correct_Y
  600.     end
  601.     contents.draw_text(*args)
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # * Atualização do cursor
  605.   #--------------------------------------------------------------------------
  606.   def update_cursor
  607.     super
  608.     if $abw_cursor_set
  609.       $abw_cursor_set.x = self.x + item_rect(@index).x + Akea_Battle_Window::Cursor_X
  610.       $abw_cursor_set.y = self.y + item_rect(@index).y + Akea_Battle_Window::Cursor_Y
  611.       $abw_cursor_set.x = Graphics.width if $included[:akea_battlecursor]
  612.     end
  613.   end
  614. end
  615.  
  616. #==============================================================================
  617. # ** Window_ActorCommand
  618. #------------------------------------------------------------------------------
  619. #  Esta janela é usada para selecionar os comandos do herói na tela de batalha.
  620. #==============================================================================
  621.  
  622. class Window_ActorCommand < Window_Command
  623. alias :abw_initialize :initialize
  624. alias :abw_deactivate :deactivate
  625. alias :abw_activate :activate
  626.   #--------------------------------------------------------------------------
  627.   # * Inicialização do objeto
  628.   #--------------------------------------------------------------------------
  629.   def initialize
  630.     unless Akea_Battle_Window::Win_Pic[2] == ''
  631.       @abw_picture = Sprite.new
  632.       @abw_picture.bitmap = Cache.akea(Akea_Battle_Window::Win_Pic[2])
  633.     end
  634.     abw_initialize
  635.     self.opacity = 0 unless Akea_Battle_Window::Win_Pic[2] == ''
  636.   end
  637.   #--------------------------------------------------------------------------
  638.   # * Desenho do texto
  639.   #     args : Bitmap.draw_text
  640.   #--------------------------------------------------------------------------
  641.   def draw_text(*args)
  642.     if args[0].is_a?(Integer) && Akea_Battle_Window::Win_Pic[2] != ''
  643.       args[0] += Akea_Battle_Window::Correct_X - 6
  644.       args[1] += Akea_Battle_Window::Correct_Y - 6
  645.     elsif Akea_Battle_Window::Win_Pic[2] != ''
  646.       args[0].x += Akea_Battle_Window::Correct_X - 6
  647.       args[0].y += Akea_Battle_Window::Correct_Y - 6
  648.     end
  649.     contents.draw_text(*args)
  650.   end
  651.   #--------------------------------------------------------------------------
  652.   # * Exibição da janela
  653.   #--------------------------------------------------------------------------
  654.   def open
  655.     super
  656.     if @abw_picture
  657.       @abw_picture.opacity = 255
  658.       @abw_picture.x = self.x
  659.       @abw_picture.y = self.y
  660.     end
  661.   end
  662.   def close
  663.     super
  664.     @abw_picture.opacity = 0 if @abw_picture
  665.   end
  666.   #--------------------------------------------------------------------------
  667.   # * Atualização do cursor
  668.   #--------------------------------------------------------------------------
  669.   def update_cursor
  670.     super
  671.     if $abw_cursor_set
  672.       $abw_cursor_set.x = self.x + Akea_Battle_Window::Cursor_X
  673.       $abw_cursor_set.y = self.y + item_rect(@index - self.top_row).y + Akea_Battle_Window::Cursor_Y
  674.     end
  675.   end
  676.   def deactivate
  677.     abw_deactivate
  678.     self.arrows_visible = false
  679.     self.opacity = 0
  680.     self.contents_opacity = 0
  681.     @abw_picture.opacity = 0 unless Akea_Battle_Window::Win_Pic[2] == ''
  682.   end
  683.   def activate
  684.     abw_activate
  685.     self.arrows_visible = true
  686.     @abw_picture.opacity = 255 unless Akea_Battle_Window::Win_Pic[2] == ''
  687.     self.opacity = 255 if Akea_Battle_Window::Win_Pic[2] == ''
  688.     self.contents_opacity = 255
  689.   end
  690.   def dispose
  691.     super
  692.     @abw_picture.bitmap.dispose
  693.     @abw_picture.dispose
  694.   end
  695. end
  696.  
  697. #==============================================================================
  698. # ** Window_PartyCommand
  699. #------------------------------------------------------------------------------
  700. #  Esta janela é usada para se escolher se deseja lutar ou fugir na
  701. # tela de batalha.
  702. #==============================================================================
  703.  
  704. class Window_PartyCommand < Window_Command
  705. alias :abw_initialize :initialize
  706. alias :abw_draw_all_items :draw_all_items
  707.   #--------------------------------------------------------------------------
  708.   # * Inicialização do objeto
  709.   #--------------------------------------------------------------------------
  710.   def initialize
  711.     abw_initialize
  712.     self.opacity = 0 unless Akea_Battle_Window::Win_Pic[1] == ''
  713.   end
  714.   #--------------------------------------------------------------------------
  715.   # * Criação da lista de comandos
  716.   #--------------------------------------------------------------------------
  717.   def draw_all_items
  718.     create_back_picture
  719.     abw_draw_all_items
  720.   end
  721.   def create_back_picture
  722.     return if Akea_Battle_Window::Win_Pic[1] == ''
  723.     bitmap = Cache.akea(Akea_Battle_Window::Win_Pic[1])
  724.     rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  725.     contents.blt(0, 0, bitmap, rect, 255)
  726.   end
  727.   #--------------------------------------------------------------------------
  728.   # * Espaçamento lateral padrão
  729.   #--------------------------------------------------------------------------
  730.   def standard_padding
  731.     Akea_Battle_Window::Win_Pic[1] == '' ? 12 : 0
  732.   end
  733.   #--------------------------------------------------------------------------
  734.   # * Aquisição da altura da janela
  735.   #--------------------------------------------------------------------------
  736.   def window_height
  737.     Akea_Battle_Window::Win_Pic[1] == '' ? fitting_height(visible_line_number) : (fitting_height(visible_line_number) + 24)
  738.   end
  739.   #--------------------------------------------------------------------------
  740.   # * Desenho do texto
  741.   #     args : Bitmap.draw_text
  742.   #--------------------------------------------------------------------------
  743.   def draw_text(*args)
  744.     if args[0].is_a?(Integer) && Akea_Battle_Window::Win_Pic[1] != ''
  745.       args[0] += Akea_Battle_Window::Correct_X
  746.       args[1] += Akea_Battle_Window::Correct_Y
  747.     elsif Akea_Battle_Window::Win_Pic[1] != ''
  748.       args[0].x += Akea_Battle_Window::Correct_X
  749.       args[0].y += Akea_Battle_Window::Correct_Y
  750.     end
  751.     contents.draw_text(*args)
  752.   end
  753.   #--------------------------------------------------------------------------
  754.   # * Atualização do cursor
  755.   #--------------------------------------------------------------------------
  756.   def update_cursor
  757.     super
  758.     if $abw_cursor_set
  759.       $abw_cursor_set.x = self.x + Akea_Battle_Window::Cursor_X
  760.       $abw_cursor_set.y = self.viewport.rect.y + item_rect(@index).y + Akea_Battle_Window::Cursor_Y
  761.     end
  762.   end
  763. end
  764.  
  765.  
  766. #==============================================================================
  767. # ** Window_BattleStatus
  768. #------------------------------------------------------------------------------
  769. #  Esta janela exibe as condições de todos membros do grupo na tela de batalha.
  770. #==============================================================================
  771.  
  772. class Window_BattleStatus < Window_Selectable
  773. alias :abw_initialize :initialize
  774. alias :abw_draw_all_items :draw_all_items
  775.   #--------------------------------------------------------------------------
  776.   # * Inicialização do objeto
  777.   #--------------------------------------------------------------------------
  778.   def initialize
  779.     abw_initialize
  780.     self.opacity = 0 unless Akea_Battle_Window::Win_Pic[0] == ''
  781.   end
  782.   def create_back_picture
  783.     return if Akea_Battle_Window::Win_Pic[0] == ''
  784.     bitmap = Cache.akea(Akea_Battle_Window::Win_Pic[0])
  785.     rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  786.     contents.blt(0, 0, bitmap, rect, 255)
  787.   end
  788.   #--------------------------------------------------------------------------
  789.   # * Espaçamento lateral padrão
  790.   #--------------------------------------------------------------------------
  791.   def standard_padding
  792.     Akea_Battle_Window::Win_Pic[0] == '' ? 12 : 0
  793.   end
  794.   def draw_all_items
  795.     create_back_picture
  796.     abw_draw_all_items
  797.   end
  798.   #--------------------------------------------------------------------------
  799.   # * Aquisição da altura da janela
  800.   #--------------------------------------------------------------------------
  801.   def window_height
  802.     Akea_Battle_Window::Win_Pic[0] == '' ? fitting_height(visible_line_number) : (fitting_height(visible_line_number) + 24)
  803.   end
  804.   #--------------------------------------------------------------------------
  805.   # * Desenho do HP
  806.   #     actor  : herói
  807.   #     x      : coordenada X
  808.   #     y      : coordenada Y
  809.   #     width  : largura
  810.   #--------------------------------------------------------------------------
  811.   def draw_actor_hp(actor, x, y, width = 124)
  812.     if Akea_Battle_Window::Pic[1] == ''
  813.       super(actor, x, y, width = 124)
  814.       return
  815.     end
  816.     x += Akea_Battle_Window::Todos_X + Akea_Battle_Window::HP_X
  817.     y += Akea_Battle_Window::HP_Y + Akea_Battle_Window::Todos_Y
  818.     bitmap = Cache.akea(Akea_Battle_Window::Pic[1])
  819.     rect = Rect.new(0, 0, bitmap.width*actor.hp/actor.mhp, bitmap.height)
  820.     contents.blt(x, y, bitmap, rect, 255)
  821.     bitmap = Cache.akea(Akea_Battle_Window::Pic[0])
  822.     rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  823.     contents.blt(x - Akea_Battle_Window::HP_X, y-Akea_Battle_Window::HP_Y, bitmap, rect, 255)
  824.     x -= Akea_Battle_Window::Todos_X + Akea_Battle_Window::HP_X
  825.     y -= Akea_Battle_Window::HP_Y + Akea_Battle_Window::Todos_Y
  826.     change_color(system_color)
  827.     contents.font.size = Akea_Battle_Window::Fonte
  828.     draw_text(x, y, 30, line_height, Vocab::hp_a) if Akea_Battle_Window::Text
  829.     draw_current_and_max_values(x - 20, y, width, actor.hp, actor.mhp,
  830.     hp_color(actor), normal_color) if Akea_Battle_Window::Num
  831.     contents.font.size = Font.default_size
  832.   end
  833.   #--------------------------------------------------------------------------
  834.   # * Desenho do MP
  835.   #     actor  : herói
  836.   #     x      : coordenada X
  837.   #     y      : coordenada Y
  838.   #     width  : largura
  839.   #--------------------------------------------------------------------------
  840.   def draw_actor_mp(actor, x, y, width = 124)
  841.     if Akea_Battle_Window::Pic[3] == ''
  842.       super(actor, x, y, width = 124)
  843.       return
  844.     end
  845.     x += Akea_Battle_Window::Todos_X + Akea_Battle_Window::MP_X
  846.     y += Akea_Battle_Window::MP_Y + Akea_Battle_Window::Todos_Y
  847.     bitmap = Cache.akea(Akea_Battle_Window::Pic[3])
  848.     rect = Rect.new(0, 0, bitmap.width*actor.mp/actor.mmp, bitmap.height)
  849.     contents.blt(x, y, bitmap, rect, 255)
  850.     bitmap = Cache.akea(Akea_Battle_Window::Pic[2])
  851.     rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  852.     contents.blt(x - Akea_Battle_Window::MP_X, y-Akea_Battle_Window::MP_Y, bitmap, rect, 255)
  853.     x -= Akea_Battle_Window::Todos_X + Akea_Battle_Window::MP_X
  854.     y -= Akea_Battle_Window::MP_Y + Akea_Battle_Window::Todos_Y
  855.     change_color(system_color)
  856.     contents.font.size = Akea_Battle_Window::Fonte
  857.     draw_text(x, y, 30, line_height, Vocab::mp_a) if Akea_Battle_Window::Text
  858.     draw_current_and_max_values(x - 20, y, width, actor.mp, actor.mmp,
  859.     mp_color(actor), normal_color) if Akea_Battle_Window::Num
  860.     contents.font.size = Font.default_size
  861.   end
  862.   #--------------------------------------------------------------------------
  863.   # * Desenho do TP
  864.   #     actor  : herói
  865.   #     x      : coordenada X
  866.   #     y      : coordenada Y
  867.   #     width  : largura
  868.   #--------------------------------------------------------------------------
  869.   def draw_actor_tp(actor, x, y, width = 124)
  870.     if Akea_Battle_Window::Pic[5] == ''
  871.       super(actor, x, y, width = 124)
  872.       return
  873.     end
  874.     x += Akea_Battle_Window::Todos_X + Akea_Battle_Window::TP_X
  875.     y += Akea_Battle_Window::TP_Y + Akea_Battle_Window::Todos_Y
  876.     bitmap = Cache.akea(Akea_Battle_Window::Pic[5])
  877.     rect = Rect.new(0, 0, bitmap.width*actor.tp/100, bitmap.height)
  878.     contents.blt(x, y, bitmap, rect, 255)
  879.     bitmap = Cache.akea(Akea_Battle_Window::Pic[4])
  880.     rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  881.     contents.blt(x - Akea_Battle_Window::TP_X, y-Akea_Battle_Window::TP_Y, bitmap, rect, 255)
  882.     x -= Akea_Battle_Window::Todos_X + Akea_Battle_Window::TP_X
  883.     y -= Akea_Battle_Window::TP_Y + Akea_Battle_Window::Todos_Y
  884.     change_color(system_color)
  885.     contents.font.size = Akea_Battle_Window::Fonte
  886.     draw_text(x, y, 30, line_height, Vocab::tp_a) if Akea_Battle_Window::Text
  887.     draw_text(x + width - 62, y, 42, line_height, actor.tp.to_i, 2) if Akea_Battle_Window::Num
  888.     contents.font.size = Font.default_size
  889.   end
  890.   #--------------------------------------------------------------------------
  891.   # * Desenho do texto
  892.   #     args : Bitmap.draw_text
  893.   #--------------------------------------------------------------------------
  894.   def draw_text(*args)
  895.     if args[0].is_a?(Integer) && Akea_Battle_Window::Win_Pic[0] != ''
  896.       args[0] += Akea_Battle_Window::Correct_X
  897.       args[1] += Akea_Battle_Window::Correct_Y
  898.     elsif Akea_Battle_Window::Win_Pic[0] != ''
  899.       args[0].x += Akea_Battle_Window::Correct_X
  900.       args[0].y += Akea_Battle_Window::Correct_Y
  901.     end
  902.     contents.draw_text(*args)
  903.   end
  904.   #--------------------------------------------------------------------------
  905.   # * Atualização do cursor
  906.   #--------------------------------------------------------------------------
  907.   def update_cursor
  908.     super
  909.     if $abw_cursor_set
  910.       $abw_cursor_set.x = self.x + Akea_Battle_Window::Cursor_X
  911.       $abw_cursor_set.y = self.y + item_rect(@index - self.top_row).y + Akea_Battle_Window::Cursor_Y
  912.       $abw_cursor_set.x = Graphics.width if $included[:akea_battlecursor]
  913.     end
  914.   end
  915. end
  916.  
  917. #==============================================================================
  918. # ** Cache
  919. #------------------------------------------------------------------------------
  920. #  Este modulo carrega cada gráfico, cria um objeto de Bitmap e retém ele.
  921. # Para acelerar o carregamento e preservar memória, este módulo matém o
  922. # objeto de Bitmap em uma Hash interna, permitindo que retorne objetos
  923. # pré-existentes quando mesmo Bitmap é requerido novamente.
  924. #==============================================================================
  925.  
  926.  
  927. module Cache
  928.   #--------------------------------------------------------------------------
  929.   # * Carregamento dos gráficos de animação
  930.   #     filename : nome do arquivo
  931.   #     hue      : informações da alteração de tonalidade
  932.   #--------------------------------------------------------------------------
  933.   def self.akea(filename)
  934.     load_bitmap("Graphics/Akea/", filename)
  935.   end
  936. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement