Advertisement
Raizen

Akea Team Battle Skill(English)

Mar 9th, 2015
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 14.99 KB | None | 0 0
  1. #=======================================================
  2. #        Akea Team Battle Skill
  3. # Author: Raizen
  4. # Community: http://www.centrorpg.com/
  5. # Compatibility: RMVXAce
  6. # Allows double, triple, quadruple... skills, similar function found on_skill_ok
  7. # Chrono Trigger
  8. #=======================================================
  9. $imported ||= Hash.new
  10. $imported[:akea_team_battle] = true
  11. module Akea_Team_Skill
  12. Team_Skill = []
  13. Data_Skill = []
  14. # Name of the word that seperates the battlers on battle Window
  15. Conj = ' and '
  16.  
  17.  
  18. #==============================================================================
  19.  
  20. # Here is configured the skills(double, triple....)
  21. # For configuration, follow the below example:
  22. #Data_Skill[id] = {
  23. #'Actors' => [actor1, actor2],
  24. #'Skills' => [id1, id2],
  25. # Where id is the id of the skill which will be a team skill
  26. # Where actor1 and actor2 are the id of the actors that participate on the skill
  27. # Where id1 and id2 are the ids of the skill that the respective actor1 and actor2 need to have learned.
  28.  
  29. # IMPORTANT: Add the team skill on the classes, it can be level 1, it will
  30. # only be shown when all the requirements are met.
  31.  
  32. #==============================================================================
  33. Data_Skill[54] = { #skill id
  34. 'Actors' => [1, 8], #actors involved
  35. 'Skills' => [51, 51], #id of skills necessary
  36. }
  37. Data_Skill[127] = { #skill id
  38. 'Actors' => [1, 2, 4], #actors involved
  39. 'Skills' => [3, 52, 89], #id of skills necessary
  40. }
  41. Data_Skill[128] = { #skill id
  42. 'Actors' => [2, 4], #actors involved
  43. 'Skills' => [56, 89], #id of skills necessary
  44. }
  45.  
  46.  
  47. #==============================================================================
  48. #------------------------------------------------------------------------------
  49. # -----------------------Animation Configuration --------------------------
  50. #------------------------------------------------------------------------------
  51. #==============================================================================
  52. # To configure the animation of the skills, use exactly the same notetags commands
  53. # that are used on Akea Animated Battle System, which are:
  54. # <movement>, <castskill>, <animation>, <move_hit>
  55.  
  56. # you can add as many lines as you want, always using the same template as below
  57. # [actor_id, 'movement_type'],
  58.  
  59. # To call this animation, put on notetags of the skill the following:
  60. # <teamskill id>
  61. # Where id is the number in front of Team_Skill[id]
  62.  
  63. # for example Team_Skill[3] you would call it like this:
  64. # <teamskill 3>
  65. #==============================================================================
  66. # Team_Skill[3] => Triple Vulcano Fist
  67. #==============================================================================
  68. Team_Skill[3] = [
  69. [1, '<movement 4>'],
  70. [1, '<movement 21>'],
  71. [1, '<movement 41>'],
  72. [1, '<castskill 95>'],
  73. [1, '<movement 41>'],
  74. [1, '<movement 2>'],
  75. [2, '<movement 4>'],
  76. [2, '<castskill 43>'],
  77. [2, '<movement 22>'],
  78. [2, '<castskill 43>'],
  79. [2, '<movement 22>'],
  80. [2, '<castskill 43>'],
  81. [2, '<movement 2>'],
  82. [4, '<movement 1>'],
  83. [4, '<movement 41>'],
  84. [4, '<movement 3>'],
  85. [4, '<castskill 95>'],
  86. [4, '<movement 46>'],
  87. [4, '<animation 2>'],
  88. [4, '<movement 2>'],
  89. ]
  90. #==============================================================================
  91. # Team_Skill[3] => Double Ice Combo
  92. #==============================================================================
  93. Team_Skill[4] = [
  94. [2, '<movement 4>'],
  95. [2, '<movement 22>'],
  96. [2, '<castskill 43>'],
  97. [2, '<movement 25>'],
  98. [2, '<movement 25>'],
  99. [2, '<movement 25>'],
  100. [2, '<movement 22>'],
  101. [2, '<castskill 43>'],
  102. [2, '<movement 2>'],
  103. [4, '<movement 4>'],
  104. [4, '<movement 4>'],
  105. [4, '<castskill 42>'],
  106. [4, '<movement 1>'],
  107. [4, '<movement 41>'],
  108. [4, '<movement 43>'],
  109. [4, '<movement 45>'],
  110. [4, '<animation 3>'],
  111. [4, '<movement 2>'],
  112. ]
  113. end
  114.  
  115. #==============================================================================
  116. # HERE STARTS THE SCRIPT!!!
  117. #==============================================================================
  118.  
  119.  
  120. #==============================================================================
  121. # ** Scene_Battle
  122. #------------------------------------------------------------------------------
  123. #  Esta classe executa o processamento da tela de batalha.
  124. #==============================================================================
  125. class Scene_Battle < Scene_Base
  126. alias :atbs_turn_start :turn_start
  127. alias :atbs_start :start
  128. alias :atbs_turn_start :turn_start
  129.   def start(*args, &block)
  130.     @force_team_skill = []
  131.     atbs_start(*args, &block)
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # * Início do turno
  135.   #--------------------------------------------------------------------------
  136.   def turn_start
  137.     atbs_turn_start
  138.     #@force_team_skill.sort! {|a, b| $game_actors[b].param(6) - $game_actors[a].param(6)}
  139.     #@force_team_skill.pop
  140.     for n in 0...@force_team_skill.size
  141.       BattleManager.remove_action(@force_team_skill[n])
  142.     end
  143.     @force_team_skill = []
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # * Verificação de notetags
  147.   #--------------------------------------------------------------------------
  148.   def atbs_team_skill(battle_notes)
  149.     @remember_old_user = @subject
  150.     @remember_old_target = @reuse_targets
  151.     for n in 0...battle_notes.size - 10
  152.       if battle_notes[n..n+10] == "<teamskill "
  153.         y = 0
  154.         y += 1 until battle_notes[n+11+y] == '>'
  155.         team_skill = battle_notes[n+11..n+10+y].to_i
  156.       end
  157.     end
  158.     for n in 0...Akea_Team_Skill::Team_Skill[team_skill].size
  159.       battle_notes = Akea_Team_Skill::Team_Skill[team_skill][n][1]
  160.       @subject = $game_actors[Akea_Team_Skill::Team_Skill[team_skill][n][0]]
  161.       @reuse_targets = @remember_old_target
  162.       if battle_notes[0..9] == "<movement "
  163.         y = 0
  164.         y += 1 until battle_notes[10+y] == '>'
  165.         insert_battle_commands(battle_notes[10..9+y].to_i)
  166.       elsif battle_notes[0..9] == "<make_hit "
  167.         y = 0
  168.         y += 1 until battle_notes[10+y] == '>'
  169.         insert_battle_damage(battle_notes[10..9+y].to_i)
  170.       elsif battle_notes[0..9] == "<move_hit "
  171.         y = 0
  172.         y += 1 until battle_notes[10+y] == '>'
  173.         old_sub = @subject
  174.         for z in 0...@reuse_targets.size
  175.           insert_battle_commands(battle_notes[10..9+y].to_i, @reuse_targets[z], old_sub)
  176.         end
  177.         @subject = old_sub
  178.           elsif battle_notes[0..10] == "<playmovie "
  179.             y = 0
  180.             y += 1 until battle_notes[11+y] == '>'
  181.             insert_battle_animations(battle_notes[11..11+y])
  182.       elsif battle_notes[0..10] == "<animation "
  183.         y = 0
  184.         y += 1 until battle_notes[11+y] == '>'
  185.         insert_battle_animations(battle_notes[11..11+y].to_i)
  186.       elsif battle_notes[0..10] == "<castskill "
  187.         y = 0
  188.         y += 1 until battle_notes[11+y] == '>'
  189.         insert_self_battle_animations(battle_notes[11..11+y].to_i)
  190.       elsif battle_notes[0..10] == "<condition "
  191.         y = 0
  192.         y += 1 until battle_notes[11+y] == '>'
  193.         all_battle_members[@subject.index].current_condition = battle_notes[11..11+y].to_i
  194.       end
  195.     end
  196.     @subject = @remember_old_user
  197.     @reuse_targets = @remember_old_target
  198.   end
  199.  
  200.   #--------------------------------------------------------------------------
  201.   # * Habilidade [Confirmação]
  202.   #--------------------------------------------------------------------------
  203.   def on_skill_ok
  204.     @skill = @skill_window.item
  205.     id = BattleManager.actor.id
  206.     BattleManager.actor.input.set_skill(@skill.id)
  207.     BattleManager.actor.last_skill.object = @skill
  208.     if !@skill.need_selection?
  209.       @skill_window.hide
  210.       next_command
  211.     elsif @skill.for_opponent?
  212.       select_enemy_selection
  213.     else
  214.       select_actor_selection
  215.     end
  216.     if Akea_Team_Skill::Data_Skill[@skill.id]
  217.       @force_team_skill << Akea_Team_Skill::Data_Skill[@skill.id]['Actors'].dup
  218.       @force_team_skill.last << @skill.id
  219.     end
  220.   end
  221. end
  222.  
  223.  
  224. #==============================================================================
  225. # ** Window_BattleSkill
  226. #------------------------------------------------------------------------------
  227. #  Esta janela para seleção de habilidades na tela de batalha.
  228. #==============================================================================
  229.  
  230. class Window_BattleSkill < Window_SkillList
  231. alias :atbs_include? :include?
  232.   #--------------------------------------------------------------------------
  233.   # * Inclusão do item na lista
  234.   #     item : item
  235.   #--------------------------------------------------------------------------
  236.   def include?(item)
  237.     return false if item.note.include?("<not_included>")
  238.     atbs_include?(item)
  239.   end
  240. end
  241. #==============================================================================
  242. # ** Game_Actor
  243. #------------------------------------------------------------------------------
  244. #  Esta classe gerencia os heróis. Ela é utilizada internamente pela classe
  245. # Game_Actors ($game_actors). A instância desta classe é referenciada
  246. # pela classe Game_Party ($game_party).
  247. #==============================================================================
  248.  
  249. class Game_Actor < Game_Battler
  250. alias :atbs_learn_skill :learn_skill
  251.   #--------------------------------------------------------------------------
  252.   # * Aprender habilidade
  253.   #     skill_id : ID da habilidade
  254.   #--------------------------------------------------------------------------
  255.   def learn_skill(skill_id)
  256.     atbs_learn_skill(skill_id)
  257.     for n in 0...Akea_Team_Skill::Data_Skill.size
  258.       if Akea_Team_Skill::Data_Skill[n]
  259.         for i in 0...Akea_Team_Skill::Data_Skill[n]['Actors'].size
  260.           atbs_learn_skill(n) if Akea_Team_Skill::Data_Skill[n]['Actors'][i] == @actor_id && skill_learn?($data_skills[Akea_Team_Skill::Data_Skill[n]['Skills'][i]])
  261.         end
  262.       end
  263.     end
  264.   end
  265. end
  266. #==============================================================================
  267. # ** Window_SkillList
  268. #------------------------------------------------------------------------------
  269. #  Esta janela exibe uma lista de habilidades usáveis na tela de habilidades.
  270. #==============================================================================
  271.  
  272. class Window_SkillList < Window_Selectable
  273. alias :atbs_include? :include?
  274.   #--------------------------------------------------------------------------
  275.   # * Inclusão do item na lista
  276.   #     item : item
  277.   #--------------------------------------------------------------------------
  278.   def include?(item)
  279.     if Akea_Team_Skill::Data_Skill[item.id]
  280.       check_inc = true
  281.       Akea_Team_Skill::Data_Skill[item.id]['Actors'].each{|member| check_inc = false unless $game_party.members.include?($game_actors[member])}
  282.       for n in 0...Akea_Team_Skill::Data_Skill[item.id]['Actors'].size
  283.        check_inc = false unless $game_actors[Akea_Team_Skill::Data_Skill[item.id]['Actors'][n]].skill_learn?($data_skills[Akea_Team_Skill::Data_Skill[item.id]['Skills'][n]])
  284.       end
  285.       atbs_include?(item) && check_inc
  286.     else
  287.       atbs_include?(item)
  288.     end
  289.   end
  290. end
  291.  
  292. #==============================================================================
  293. # ** BattleManager
  294. #------------------------------------------------------------------------------
  295. #  Este módulo gerencia o andamento da batalha.
  296. #==============================================================================
  297.  
  298. module BattleManager
  299.   #--------------------------------------------------------------------------
  300.   # * Forçar ação
  301.   #--------------------------------------------------------------------------
  302.   def self.remove_action(battler)
  303.     for i in 0...battler.size - 1
  304.       @action_battlers.delete($game_actors[battler[i]]) unless $game_actors[battler[i]].current_action.item == $data_skills[battler.last]
  305.     end
  306.   end
  307. end
  308. #==============================================================================
  309. # ** Game_Battler
  310. #------------------------------------------------------------------------------
  311. #  Esta classe gerencia os battlers. Controla a adição de sprites e ações
  312. # dos lutadores durante o combate.
  313. # É usada como a superclasse das classes Game_Enemy e Game_Actor.
  314. #==============================================================================
  315.  
  316. class Game_Battler < Game_BattlerBase
  317. alias :atbs_make_damage_value :make_damage_value
  318.   #--------------------------------------------------------------------------
  319.   # * Cálculo de dano
  320.   #     user : usuário
  321.   #     item : habilidade/item
  322.   #--------------------------------------------------------------------------
  323.   def make_damage_value(user, item)
  324.     unless Akea_Team_Skill::Data_Skill[item.id]
  325.       atbs_make_damage_value(user, item)
  326.       return
  327.     end
  328.     value = 0
  329.     for n in 0...Akea_Team_Skill::Data_Skill[item.id]['Actors'].size - 1
  330.       user = $game_actors[Akea_Team_Skill::Data_Skill[item.id]['Actors'][n]]
  331.       value += item.damage.eval(user, self, $game_variables)
  332.       value *= item_element_rate(user, item)
  333.       value *= pdr if item.physical?
  334.       value *= mdr if item.magical?
  335.       value *= rec if item.damage.recover?
  336.       value = apply_critical(value) if @result.critical
  337.       value = apply_variance(value, item.damage.variance)
  338.       value = apply_guard(value)
  339.     end
  340.     @result.make_damage(value.to_i, item)
  341.   end
  342. end
  343.  
  344. #==============================================================================
  345. # ** Window_BattleLog
  346. #------------------------------------------------------------------------------
  347. #  Esta janela exibe o progresso da luta. Não exibe o quadro da
  348. # janela, é tratado como uma janela por conveniência.
  349. #==============================================================================
  350.  
  351. class Window_BattleLog < Window_Selectable
  352. alias :atbs_display_use_item :display_use_item
  353.     #--------------------------------------------------------------------------
  354.   # * Exibição de uso de habilidade/item
  355.   #     subject : lutador
  356.   #     item    : habilidade/item
  357.   #--------------------------------------------------------------------------
  358.   def display_use_item(subject, item)
  359.     if item.is_a?(RPG::Skill)
  360.       unless Akea_Team_Skill::Data_Skill[item.id]
  361.         atbs_display_use_item(subject, item)
  362.         return
  363.       end
  364.       name = ''
  365.       for n in 0...Akea_Team_Skill::Data_Skill[item.id]['Actors'].size
  366.         next unless Akea_Team_Skill::Data_Skill[item.id]['Actors'][n]
  367.         if n == 0
  368.           name += $game_actors[Akea_Team_Skill::Data_Skill[item.id]['Actors'][n]].name
  369.         elsif n != Akea_Team_Skill::Data_Skill[item.id]['Actors'].size - 1
  370.           name += ', ' + $game_actors[Akea_Team_Skill::Data_Skill[item.id]['Actors'][n]].name
  371.         else
  372.           name += Akea_Team_Skill::Conj + $game_actors[Akea_Team_Skill::Data_Skill[item.id]['Actors'][n]].name
  373.         end
  374.       end
  375.       add_text(name + item.message1)
  376.       unless item.message2.empty?
  377.         wait
  378.         add_text(item.message2)
  379.       end
  380.     else
  381.       atbs_display_use_item(subject, item)
  382.     end
  383.   end
  384. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement