Advertisement
Raizen

Akea Battle Cry(English)

Mar 26th, 2015
993
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 9.79 KB | None | 0 0
  1. #=======================================================
  2. #        Akea Battle Cry
  3. # Author: Raizen
  4. # Comuninity: http://www.centrorpg.com/
  5. # Compatibility: RMVXAce
  6. #
  7. #=======================================================
  8. # =========================Don't Modify==============================
  9. $included ||= Hash.new
  10. $included[:akea_battlecry] = true
  11. module Akea_BattleCry
  12. Cry = []
  13. Actors = []
  14. Enemies = []
  15. # =========================Don't Modify==============================
  16.  
  17.  
  18.  
  19. #==============================================================================
  20. #------------------------------------------------------------------------------
  21. # Actors - Here is configured the sound of each actor,
  22. # The numbers are defined in the cry configuration right below.
  23. # You can add as many lines as you want for actors and as many
  24. # cries as you want.
  25.  
  26. # The Sound files must be on the folder Audio/SE and the name is put inside []
  27. # and separated by commas, example [sound1, sound2, sound3]
  28. #------------------------------------------------------------------------------
  29. #==============================================================================
  30.  
  31.  
  32. #==============================================================================
  33. # Actors[1]  1 == Actor's id on database
  34. #==============================================================================
  35.  
  36. Actors[1] = {
  37. 1 => ['1-Attack1', '1-Attack2'], # Normal Attack
  38. 2 => ['1-Skill1'], # Skills
  39. 3 => ['1-Start1'], # Entrance Sound
  40. 4 => ['1-Hit1'], # Sound when hit
  41. 5 => ['1-Dead1', '1-Dead2'], # Sound when down
  42. 6 => ['1-Victory1'], #Victory Sound
  43. 7 => ['1-Healed1'], # Recovering Life Sound
  44. }
  45. #==============================================================================
  46. # Actors[8] 8 == Actor's id on database
  47. #==============================================================================
  48. Actors[8] = {
  49. 1 => ['8-Attack1', '8-Attack2'], # Normal Attack
  50. 2 => ['8-Skill1'], # Skills
  51. 3 => ['8-Start1'], # Entrance Sound
  52. 4 => ['8-Hit1', '8-Hit2'], # Sound when hit
  53. 5 => ['8-Dead1'], # Sound when down
  54. 6 => ['8-Victory1'], #Victory Sound
  55. 7 => ['8-Healed1'], # Recovering Life Sound
  56. }
  57. #==============================================================================
  58. #------------------------------------------------------------------------------
  59. # Enemies same as with actors
  60. #------------------------------------------------------------------------------
  61. #==============================================================================
  62. #==============================================================================
  63. # Enemies[1] 1 == Enemy ID on database
  64. #==============================================================================
  65. Enemies[1] = {
  66. 1 => ['8-Attack1', '8-Attack2'], # Normal Attack
  67. 2 => ['8-Skill1'], # Skills
  68. 3 => ['8-Start1'], # Entrance Sound
  69. 4 => ['8-Hit1', '8-Hit2'], # Sound when hit
  70. 5 => ['8-Dead1'], # Sound when down
  71. 6 => ['8-Victory1'], #Victory Sound
  72. }
  73.  
  74. #==============================================================================
  75. #------------------------------------------------------------------------------
  76. # Cry - Here is configured the battle cries, you can add them following the
  77. # default pattern
  78. # Cry[cry_id] = [
  79. #sound that will be played, configured above for actors and enemies]
  80.  
  81. # To add skill sound, just put on notetags of the database the following,
  82. # <cry id>, where the id you replace with one of the ids configured below
  83. # For example <cry 5>
  84. #------------------------------------------------------------------------------
  85. #==============================================================================
  86. Cry[1] = [ # By default it is the Entrance Sound in battle
  87. 3, # Id Sound that will be played on Actors/Enemies
  88. 100] # Chance to be played in percentage
  89. Cry[2] = [ # Sound when getting hit
  90. 4, # Id Sound that will be played on Actors/Enemies
  91. 100] # Chance to be played in percentage
  92. Cry[3] = [ # Sound when down
  93. 5, # Id Sound that will be played on Actors/Enemies
  94. 100] # Chance to be played in percentage
  95. Cry[4] = [ # Victory Sound
  96. 6, # Id Sound that will be played on Actors/Enemies
  97. 100] # Chance to be played in percentage
  98. Cry[5] = [ # Recovering Life Sound
  99. 7, # Id Sound that will be played on Actors/Enemies
  100. 100] # Chance to be played in percentage
  101.  
  102. Cry[6] = [
  103. 1, # Id Sound that will be played on Actors/Enemies
  104. 100] # Chance to be played in percentage
  105.  
  106. Cry[7] = [
  107. 2, # Id Sound that will be played on Actors/Enemies
  108. 100] # Chance to be played in percentage
  109.  
  110. end
  111. #==============================================================================
  112. # ** Scene_Battle
  113. #------------------------------------------------------------------------------
  114. #  Esta classe executa o processamento da tela de batalha.
  115. #==============================================================================
  116.  
  117. class Scene_Battle < Scene_Base
  118. alias :akea_bcry_process_action :process_action
  119. alias :akea_bcry_start :start
  120. alias :akea_bcry_use_item :use_item
  121.   #--------------------------------------------------------------------------
  122.   # * Inicialização do processo
  123.   #--------------------------------------------------------------------------
  124.   def start
  125.     akea_bcry_start
  126.     @random_anim = rand($game_party.battle_members.size) unless @random_anim
  127.     battle_cry($game_party.battle_members[@random_anim] , 1)
  128.   end
  129.  
  130.   #--------------------------------------------------------------------------
  131.   # * Processamento de ações
  132.   #--------------------------------------------------------------------------
  133.   def process_action
  134.     unless $included[:lune_animated_battle]
  135.       if !@subject || !@subject.current_action
  136.         @subject = BattleManager.next_subject
  137.       end
  138.       if @subject && @subject.current_action
  139.         battle_notes = @subject.current_action.item.note
  140.         for n in 0...battle_notes.size - 3
  141.           if battle_notes[n..n+4] == "<cry "
  142.             y = 0
  143.             y += 1 until battle_notes[n+4+y] == '>'
  144.             battle_cry(@subject,  battle_notes[n+4..n+4+y].to_i)
  145.           end
  146.         end
  147.       end
  148.       akea_bcry_process_action
  149.     else
  150.       akea_bcry_process_action
  151.       if @subject && @subject.current_action
  152.         battle_notes = @subject.current_action.item.note
  153.         for n in 0...battle_notes.size - 3
  154.           if battle_notes[n..n+4] == "<cry "
  155.             y = 0
  156.             y += 1 until battle_notes[n+4+y] == '>'
  157.             battle_cry(@subject,  battle_notes[n+4..n+4+y].to_i)
  158.           end
  159.         end
  160.       end
  161.     end
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # * Criar chance de som
  165.   #--------------------------------------------------------------------------
  166.   def make_random_cry(n)
  167.     rand(100) < n ? true : false
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # * Chamada Principal
  171.   #--------------------------------------------------------------------------
  172.   def battle_cry(n, cry_id)
  173.     if n.actor? && Akea_BattleCry::Actors[n.id] && Akea_BattleCry::Actors[n.id][Akea_BattleCry::Cry[cry_id][0]]
  174.       sound = Akea_BattleCry::Actors[n.id][Akea_BattleCry::Cry[cry_id][0]].shuffle.first
  175.       RPG::SE.new(sound).play if make_random_cry(Akea_BattleCry::Cry[cry_id][1])
  176.     elsif n.enemy? && Akea_BattleCry::Enemies[n.enemy_id] && Akea_BattleCry::Enemies[n.enemy_id][Akea_BattleCry::Cry[cry_id][0]]
  177.       sound = Akea_BattleCry::Enemies[n.enemy_id][Akea_BattleCry::Cry[cry_id][0]].shuffle.first
  178.       RPG::SE.new(sound).play if make_random_cry(Akea_BattleCry::Cry[cry_id][1])
  179.     end
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # * Usar Item
  183.   #--------------------------------------------------------------------------
  184.   def use_item
  185.     akea_bcry_use_item
  186.     if $game_troop.all_dead?
  187.       if @subject && @subject.actor?
  188.         @random_anim = @subject.index
  189.       else
  190.         @random_anim = rand($game_party.alive_members.size)
  191.       end
  192.       battle_cry($game_party.alive_members[@random_anim] , 4)
  193.     end
  194.   end
  195. end
  196. #==============================================================================
  197. # ** Game_Battler
  198. #------------------------------------------------------------------------------
  199. #  Esta classe gerencia os battlers. Controla a adição de sprites e ações
  200. # dos lutadores durante o combate.
  201. # É usada como a superclasse das classes Game_Enemy e Game_Actor.
  202. #==============================================================================
  203.  
  204. class Game_Battler < Game_BattlerBase
  205. alias :akea_bcry_execute_damage :execute_damage
  206.   #--------------------------------------------------------------------------
  207.   # * Processamento do dano
  208.   #     user : usuário
  209.   #--------------------------------------------------------------------------
  210.   def execute_damage(user)
  211.     akea_bcry_execute_damage(user)
  212.     @result.hp_damage > 0 ? nu = 2 : nu = 5
  213.     nu = 0 if @result.hp_damage == 0
  214.     self.hp == 0 ? n = 3 : n = nu
  215.     if Akea_BattleCry::Cry[n] && self.actor? && Akea_BattleCry::Actors[self.id] && Akea_BattleCry::Actors[self.id][Akea_BattleCry::Cry[n][0]]
  216.       sound = Akea_BattleCry::Actors[self.id][Akea_BattleCry::Cry[n][0]].shuffle.first
  217.       RPG::SE.new(sound).play if make_random_cry(Akea_BattleCry::Cry[n][1])
  218.     elsif Akea_BattleCry::Cry[n] && self.enemy? && Akea_BattleCry::Enemies[self.enemy_id] && Akea_BattleCry::Enemies[self.enemy_id][Akea_BattleCry::Cry[n][0]]
  219.       sound = Akea_BattleCry::Enemies[self.enemy_id][Akea_BattleCry::Cry[n][0]].shuffle.first
  220.       RPG::SE.new(sound).play if make_random_cry(Akea_BattleCry::Cry[n][1])
  221.     end
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # * Criar chance de som
  225.   #--------------------------------------------------------------------------
  226.   def make_random_cry(n)
  227.     rand(100) < n ? true : false
  228.   end
  229. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement