Mundo Maker
¡Bienvenid@ a Mundo Maker!

¿Quieres aprender todo sobre el RPG Maker?



Regístrate y forma parte de Mundo Maker.
Conectarse

Recuperar mi contraseña

Temas importantes
----------------------------------------
Páginas con recursos RPG Maker
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
Afiliados
Estadísticas
Tenemos 3763 miembros registrados.
El último usuario registrado es Carlos Rodriguez.

Nuestros miembros han publicado un total de 85780 mensajes en 12216 argumentos.

[XP] Attack skills

Ver el tema anterior Ver el tema siguiente Ir abajo

RPG Maker XP [XP] Attack skills

Mensaje por Wecoc el 2017-04-09, 23:21

Viendo que PTG tenía problemas con un script que hiciera esa función (y también que planteó algunas cosas que yo hubiera planteado algo distintas), os pongo aquí mi versión.
Lo que hace éste script es definir algunas skills como ataques, de modo que al pulsar Ataque se abrirá una ventana similar a la de Habilidades.

Tal que así:


Como veis la única diferencia (a parte de que no salen las skills normales) es que no sale el coste de SP.
Por desgracia no es compatible con el script Skill Groups, aunque se podría adaptar.

Aquí tenéis los parámetros para el ataque típico, para que los uséis de referencia. Los hice basándome en la fórmula de ataque, creo que no me equivoqué en ningún punto:

Spoiler:

Las skills que se consideran ataque se definen justo al principio del script, dentro de la array ATTACK_IDS.

Aquí lo tenéis:

Código:
#==============================================================================
# ** [XP] Attack skills
#------------------------------------------------------------------------------
#  Los ataques normales ahora estan definidos como habilidad.
#  Son habilidades que se seleccionan desde el comando Atacar y además
#  hacen daño físico, no daño mágico.
#------------------------------------------------------------------------------
#  Autor: Wecoc (no requiere créditos)
#==============================================================================

module Skill_Groups
  
  # IDs de las skills que estan en la ventana de Atacar
  ATTACK_IDS = [81, 82, 83, 84, 85]

  # Poner SP cost a los ataques
  ATTACK_SP_COST =  false
end

#==============================================================================
# ** Window_Skill
#==============================================================================

class Window_Skill < Window_Selectable
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias attack_mode_ini initialize unless $@
  def initialize(actor, attack_mode=false)
    @attack_mode = attack_mode
    attack_mode_ini(actor)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...@actor.skills.size
      skill = $data_skills[@actor.skills[i]]
      if skill != nil
        if Skill_Groups::ATTACK_IDS.include?(skill.id)
          @data.push(skill) if @attack_mode == true
        else
          @data.push(skill) if @attack_mode == false
        end
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
    if @attack_mode == false || Skill_Groups::ATTACK_SP_COST
      self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
    end
  end
end

#==============================================================================
# ** Game_Battler
#==============================================================================

class Game_Battler
  def skill_effect(user, skill)
    self.critical = false
    if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
       ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
      return false
    end
    effective = false
    effective |= skill.common_event_id > 0
    hit = skill.hit
    if skill.atk_f > 0
      hit *= user.hit / 100
    end
    hit_result = (rand(100) < hit)
    effective |= hit < 100
    if hit_result == true
      power = skill.power + user.atk * skill.atk_f / 100
      if power > 0
        power -= self.pdef * skill.pdef_f / 200
        power -= self.mdef * skill.mdef_f / 200
        power = [power, 0].max
      end
      rate = 20
      rate += (user.str * skill.str_f / 100)
      rate += (user.dex * skill.dex_f / 100)
      rate += (user.agi * skill.agi_f / 100)
      rate += (user.int * skill.int_f / 100)
      self.damage = power * rate / 20
      self.damage *= elements_correct(user.element_set)
      self.damage /= 100
      self.damage *= elements_correct(skill.element_set)
      self.damage /= 100
      if self.damage > 0
        if rand(100) < 4 * user.dex / self.agi
          self.damage *= 2
          self.critical = true
        end
        if self.guarding?
          self.damage /= 2
        end
      end
      if skill.variance > 0 and self.damage.abs > 0
        amp = [self.damage.abs * skill.variance / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      eva = 8 * self.agi / user.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
      effective |= hit < 100
    end
    if hit_result == true
      if skill.power != 0 and skill.atk_f > 0
        remove_states_shock
        effective = true
      end
      last_hp = self.hp
      self.hp -= self.damage
      effective |= self.hp != last_hp
      @state_changed = false
      effective |= states_plus(user.plus_state_set)
      effective |= states_minus(user.minus_state_set)
      effective |= states_plus(skill.plus_state_set)
      effective |= states_minus(skill.minus_state_set)
      if skill.power == 0
        self.damage = ""
        unless @state_changed
          self.damage = "Miss"
          self.critical = false
        end
      end
    else
      self.damage = "Miss"
      self.critical = false
    end
    unless $game_temp.in_battle
      self.damage = nil
    end
    return effective
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    $game_temp.in_battle = true
    $game_temp.battle_turn = 0
    $game_temp.battle_event_flags.clear
    $game_temp.battle_abort = false
    $game_temp.battle_main_phase = false
    $game_temp.battleback_name = $game_map.battleback_name
    $game_temp.forcing_battler = nil
    $game_system.battle_interpreter.setup(nil, 0)
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
    @actor_command_window.y = 160
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    @party_command_window = Window_PartyCommand.new
    @help_window = Window_Help.new
    @help_window.back_opacity = 160
    @help_window.visible = false
    @status_window = Window_BattleStatus.new
    @message_window = Window_Message.new
    @spriteset = Spriteset_Battle.new
    @wait_count = 0
    if $data_system.battle_transition == ""
      Graphics.transition(20)
    else
      Graphics.transition(40, "Graphics/Transitions/" +
        $data_system.battle_transition)
    end
    start_phase1
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    $game_map.refresh
    Graphics.freeze
    @actor_command_window.dispose
    @party_command_window.dispose
    @help_window.dispose
    @status_window.dispose
    @message_window.dispose
    if @attack_window != nil
      @attack_window.dispose
    end
    if @skill_window != nil
      @skill_window.dispose
    end
    if @item_window != nil
      @item_window.dispose
    end
    if @result_window != nil
      @result_window.dispose
    end
    @spriteset.dispose
    if $scene.is_a?(Scene_Title)
      Graphics.transition
      Graphics.freeze
    end
    if $BTEST and not $scene.is_a?(Scene_Gameover)
      $scene = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase)
  #--------------------------------------------------------------------------
  def update_phase3
    if @enemy_arrow != nil
      update_phase3_enemy_select
    elsif @actor_arrow != nil
      update_phase3_actor_select
    elsif @attack_window != nil
      update_phase3_attack_select
    elsif @skill_window != nil
      update_phase3_skill_select
    elsif @item_window != nil
      update_phase3_item_select
    elsif @actor_command_window.active
      update_phase3_basic_command
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : basic command)
  #--------------------------------------------------------------------------
  def update_phase3_basic_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      phase3_prior_actor
      return
    end
    if Input.trigger?(Input::C)
      case @actor_command_window.index
      when 0  # attack
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 1
        start_attack_select
      when 1  # skill
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 1
        start_skill_select
      when 2  # guard
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 1
        phase3_next_actor
      when 3  # item
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 2
        start_item_select
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : attack selection)
  #--------------------------------------------------------------------------
  def update_phase3_attack_select
    @attack_window.visible = true
    @attack_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      end_attack_select
      return
    end
    if Input.trigger?(Input::C)
      @skill = @attack_window.skill
      if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      @active_battler.current_action.skill_id = @skill.id
      @attack_window.visible = false
      if @skill.scope == 1
        start_enemy_select
      elsif @skill.scope == 3 or @skill.scope == 5
        start_actor_select
      else
        end_attack_select
        phase3_next_actor
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Start Attack Selection
  #--------------------------------------------------------------------------
  def start_attack_select
    @attack_window = Window_Skill.new(@active_battler, true)
    @attack_window.help_window = @help_window
    @actor_command_window.active = false
    @actor_command_window.visible = false
  end
  #--------------------------------------------------------------------------
  # * End Attack Selection
  #--------------------------------------------------------------------------
  def end_attack_select
    @attack_window.dispose
    @attack_window = nil
    @help_window.visible = false
    @actor_command_window.active = true
    @actor_command_window.visible = true
  end
  #--------------------------------------------------------------------------
  # * Frame Updat (actor command phase : enemy selection)
  #--------------------------------------------------------------------------
  def update_phase3_enemy_select
    @enemy_arrow.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      end_enemy_select
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @active_battler.current_action.target_index = @enemy_arrow.index
      end_enemy_select
      if @skill_window != nil
        end_skill_select
      end
      if @attack_window != nil
        end_attack_select
      end
      if @item_window != nil
        end_item_select
      end
      phase3_next_actor
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : actor selection)
  #--------------------------------------------------------------------------
  def update_phase3_actor_select
    @actor_arrow.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      end_actor_select
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @active_battler.current_action.target_index = @actor_arrow.index
      end_actor_select
      if @skill_window != nil
        end_skill_select
      end
      if @attack_window != nil
        end_attack_select
      end
      if @item_window != nil
        end_item_select
      end
      phase3_next_actor
    end
  end
end

Usando Eventos comunes ligados a esas skills se puede hacer que otros efectos básicos (como defenderse) también sean una skill seleccionable desde allí, de modo similar a como funciona eso a partir de VX, donde por defecto los ataques básicos se definen como skills. Hay varias formas de plantear éste script, se puede editar para lograr otros efectos. Si tenéis alguna sugerencia al respecto decidla en éste post.


Última edición por Wecoc el 2017-04-09, 23:27, editado 1 vez
avatar
Wecoc
Administrador
Administrador



Créditos 9370

Gracias : 517

Volver arriba Ir abajo

RPG Maker XP Re: [XP] Attack skills

Mensaje por Producciones The Golden el 2017-04-09, 23:25

Si bien aquí solucionaste mi "Error" creo que deberías implementar el gasto de SP, cosa que en mi Ataque por skills está, respecto al script... me encantó, lo que yo hice fue un pedido, y ahora mismo voy a recomendarle tu script al que me hizo el pedido :3 muchas gracias por enfocarte en el tema. Hasta pronto Wecoc!
avatar
Producciones The Golden
Veterano
Veterano

0/3

Créditos 637

Gracias : 60

Volver arriba Ir abajo

RPG Maker XP Re: [XP] Attack skills

Mensaje por Wecoc el 2017-04-09, 23:29

Buena idea, ya lo he añadido. Esa opción ahora se configura al principio del script, con la global ATTACK_SP_COST.
¡Me alegra haber ayudado!
avatar
Wecoc
Administrador
Administrador



Créditos 9370

Gracias : 517

Volver arriba Ir abajo

RPG Maker XP Re: [XP] Attack skills

Mensaje por Producciones The Golden el 2017-04-09, 23:32

Bien, gracias por tener en cuenta este pedido desde el comienzo, ya le envié tu script a @marconando90 y no voy a comentar más para no desviar el tema. Te llevas +1 gracias sin dudarlo, esto con tu script de Skill Groups debe ser GENIAL X3.
Eso fue todo... me voy.
avatar
Producciones The Golden
Veterano
Veterano

0/3

Créditos 637

Gracias : 60

Volver arriba Ir abajo

RPG Maker XP Re: [XP] Attack skills

Mensaje por marconando90 el 2017-04-10, 00:04

Wecoc, tu script es perfecto, justo lo que necesitaba, y te lo agradezco, pero tengo un problema de compatibilidad con otro de los scripts que utilizo. Es muy parecido al tuyo de Skill Groups, hecho por KCG, y ya que tu tienes más idea, ¿Podrías echarle un ojo?

mediafire.com file/p6bsnwr38v1e1a2/Project1.rar

He estado buscando otros scripts para probar, pero el más parecido es el tuyo, y dices que no es compatible. En el caso de que no pudieras hacer nada para solucionarlo, ¿podrías adaptarlo al tuyo de Skill Groups, por favor?

De nuevo muchas gracias por tu ayuda. notworthy
avatar
marconando90
Iniciado
Iniciado

0/3

Créditos 26

Gracias : 6

Volver arriba Ir abajo

RPG Maker XP Re: [XP] Attack skills

Mensaje por Wecoc el 2017-04-10, 02:50

Vaya, pues resulta que no, no logro hacer KGC Skill Grouping y Attack Skills compatibles. Hay demasiadas incompatibilidades, y no solo errores de script sinó también se me hace demasiado difícil integrar los dos sistemas de modo que no se vean momentos sin la ventana de ayuda donde debería estar, o montones de cosas así...

Te lo he adaptado al Skill Groups, o mejor dicho juntados ámbos en uno, que eso sí ha sido posible sin demasiada dificultad.

Código:
#==============================================================================
# ** [XP] Skill Groups v1.0 + Attack skills
#------------------------------------------------------------------------------
#  Autor: Wecoc (no requiere créditos)
#==============================================================================

#==============================================================================
# ** Skill_Groups
#==============================================================================

module Skill_Groups
 
  # ID skill principal => [[IDs secundarias], iconos, SP cost, align]
  DATA = {81 => [[82, 83, 84], true, true, 0]}
 
  # Opción: Mostrar skills pese a que el actor no pueda usarlas (desactivadas)
  SHOW_DISABLED_SKILLS = false
 
  # Opción: Si afecta a todos no se abre la ventana Window_Target
  TARGET_ALL_AUTO = true
 
  # Opción: Quitar ventana cuando se selecciona el target
  DISPOSE_WHEN_TARGET = true
 
  # IDs de las skills que estan en la ventana de Atacar
  ATTACK_IDS = [81, 82, 83, 84, 85]

  # Poner SP cost a los ataques
  ATTACK_SP_COST =  false
 
end

#==============================================================================
# ** Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  alias subgroup_can_use? skill_can_use? unless $@
  def skill_can_use?(skill_id)
    result = subgroup_can_use?(skill_id)
    if result == true
      if Skill_Groups::DATA.keys.include?(skill_id)
        for i in 0...Skill_Groups::DATA[skill_id][0].size
          subskill = Skill_Groups::DATA[skill_id][0][i]
          return true if subgroup_can_use?(subskill)
        end
        return false
      end
    end
    return result
  end
end

#==============================================================================
# ** Game_Battler
#==============================================================================

class Game_Battler
  def skill_effect(user, skill)
    self.critical = false
    if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
      ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
      return false
    end
    effective = false
    effective |= skill.common_event_id > 0
    hit = skill.hit
    if skill.atk_f > 0
      hit *= user.hit / 100
    end
    hit_result = (rand(100) < hit)
    effective |= hit < 100
    if hit_result == true
      power = skill.power + user.atk * skill.atk_f / 100
      if power > 0
        power -= self.pdef * skill.pdef_f / 200
        power -= self.mdef * skill.mdef_f / 200
        power = [power, 0].max
      end
      rate = 20
      rate += (user.str * skill.str_f / 100)
      rate += (user.dex * skill.dex_f / 100)
      rate += (user.agi * skill.agi_f / 100)
      rate += (user.int * skill.int_f / 100)
      self.damage = power * rate / 20
      self.damage *= elements_correct(user.element_set)
      self.damage /= 100
      self.damage *= elements_correct(skill.element_set)
      self.damage /= 100
      if self.damage > 0
        if rand(100) < 4 * user.dex / self.agi
          self.damage *= 2
          self.critical = true
        end
        if self.guarding?
          self.damage /= 2
        end
      end
      if skill.variance > 0 and self.damage.abs > 0
        amp = [self.damage.abs * skill.variance / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      eva = 8 * self.agi / user.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
      effective |= hit < 100
    end
    if hit_result == true
      if skill.power != 0 and skill.atk_f > 0
        remove_states_shock
        effective = true
      end
      last_hp = self.hp
      self.hp -= self.damage
      effective |= self.hp != last_hp
      @state_changed = false
      effective |= states_plus(user.plus_state_set)
      effective |= states_minus(user.minus_state_set)
      effective |= states_plus(skill.plus_state_set)
      effective |= states_minus(skill.minus_state_set)
      if skill.power == 0
        self.damage = ""
        unless @state_changed
          self.damage = "Miss"
          self.critical = false
        end
      end
    else
      self.damage = "Miss"
      self.critical = false
    end
    unless $game_temp.in_battle
      self.damage = nil
    end
    return effective
  end
end

#==============================================================================
# ** Window_Skill
#==============================================================================

class Window_Skill < Window_Selectable
  attr_reader :data
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias attack_mode_ini initialize unless $@
  def initialize(actor, attack_mode=false)
    @attack_mode = attack_mode
    attack_mode_ini(actor)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    @skill = nil
    for i in 0...@actor.skills.size
      skill = $data_skills[@actor.skills[i]]
      sub_skill = false
      if skill != nil
        for d in Skill_Groups::DATA.values
          if d[0].include?(skill.id)
            sub_skill = true
            break d
          end
        end
        if sub_skill == false
          if Skill_Groups::ATTACK_IDS.include?(skill.id)
            @data.push(skill) if @attack_mode == true
          else
            @data.push(skill) if @attack_mode == false
          end
        end
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Get current Skill
  #--------------------------------------------------------------------------
  def skill
    return @skill
  end
  #--------------------------------------------------------------------------
  # * Set current Skill
  #--------------------------------------------------------------------------
  def skill=(skill)
    @skill = skill
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #    index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
    if @attack_mode == false || Skill_Groups::ATTACK_SP_COST
      if skill.sp_cost > 0
        self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
      end
    end
  end
end

#==============================================================================
# ** Window_SubSkill
#==============================================================================

class Window_SubSkill < Window_Selectable
  attr_reader :data
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  def initialize(actor, skill_id)
    width  = 280
    height = (Skill_Groups::DATA[skill_id][0].size + 1) * 32
    x = (640 / 2) - (width / 2)
    y = (480 / 2) - (height / 2)
    @actor = actor
    @skill_id = skill_id
    super(x, y, width, height)
    self.back_opacity = 160
    self.z = 1000
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Get current Skill
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    skills = Skill_Groups::DATA[@skill_id][0]
    for i in 0...skills.size
      skill = $data_skills[skills[i]]
      if Skill_Groups::SHOW_DISABLED_SKILLS == false
        next if !@actor.skills.include?(skill.id)
      end
      if skill != nil
        @data.push(skill)
      end
    end
    @item_max = @data.size
    if Skill_Groups::SHOW_DISABLED_SKILLS == false
      self.height = (@item_max + 1) * 32
      self.y = (480 / 2) - (height / 2)
    end
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    align = Skill_Groups::DATA[@skill_id][3]
    if Skill_Groups::DATA[@skill_id][1]
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(x + 28, y, 204, 32, skill.name, align)
    else
      self.contents.draw_text(x, y, self.width - 48, 32, skill.name, align)
    end
    if Skill_Groups::DATA[@skill_id][2]
      if skill.sp_cost > 0
        sx = x + self.width - 96 + 4
        self.contents.draw_text(sx, y, 48, 32, skill.sp_cost.to_s, 2)
      end
    end
  end
end

#==============================================================================
# ** Scene_Skill
#==============================================================================

class Scene_Skill
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    @help_window.update
    @status_window.update
    @skill_window.update
    @target_window.update
    unless @subskill_window.nil?
      @subskill_window.update
      if @subskill_window.active
        update_subskill
        return
      end
    end
    if @skill_window.active
      update_skill
      return
    end
    if @target_window.active
      update_target
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (if skill window is active)
  #--------------------------------------------------------------------------
  def update_skill
    @skill_window.skill = @skill_window.data[@skill_window.index]
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(1)
      return
    end
    if Input.trigger?(Input::C)
      @skill = @skill_window.skill
      if @skill == nil or not @actor.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if Skill_Groups::DATA.keys.include?(@skill.id)
        $game_system.se_play($data_system.decision_se)
        @subskill_window = Window_SubSkill.new(@actor, @skill.id)
        @skill_window.active = false
        return
      end
      if @skill.scope >= 3
        if @skill.scope == 4 || @skill.scope == 6
          if Skill_Groups::TARGET_ALL_AUTO == true
            used = false
            for i in $game_party.actors
              used |= i.skill_effect(@actor, @skill)
            end
            if used
              $game_system.se_play(@skill.menu_se)
              @actor.sp -= @skill.sp_cost
              @status_window.refresh
              @skill_window.refresh
              @target_window.refresh
              if $game_party.all_dead?
                $scene = Scene_Gameover.new
                return
              end
              if @skill.common_event_id > 0
                $game_temp.common_event_id = @skill.common_event_id
                $scene = Scene_Map.new
                return
              end
            end
            unless used
              $game_system.se_play($data_system.buzzer_se)
            end
            return
          end
        end
        $game_system.se_play($data_system.decision_se)
        @skill_window.active = false
        @target_window.x = (@skill_window.index + 1) % 2 * 304
        @target_window.z = 2000
        @target_window.visible = true
        @target_window.active = true
        if @skill.scope == 4 || @skill.scope == 6
          @target_window.index = -1
        elsif @skill.scope == 7
          @target_window.index = @actor_index - 10
        else
          @target_window.index = 0
        end
      else
        if @skill.common_event_id > 0
          $game_temp.common_event_id = @skill.common_event_id
          $game_system.se_play(@skill.menu_se)
          @actor.sp -= @skill.sp_cost
          @status_window.refresh
          @skill_window.refresh
          @target_window.refresh
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
    if Input.trigger?(Input::R)
      if $game_party.actors.size == 1
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      actor_index = @actor_index
      loop do
        @actor_index += 1
        @actor_index %= $game_party.actors.size
        break unless $game_party.actors[@actor_index].restriction >= 1
        break if @actor_index == actor_index
      end
      if @actor_index == actor_index
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.cursor_se)
      $scene = Scene_Skill.new(@actor_index)
      return
    end
    if Input.trigger?(Input::L)
      if $game_party.actors.size == 1
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      actor_index = @actor_index
      loop do
        @actor_index -= 1
        @actor_index %= $game_party.actors.size
        break unless $game_party.actors[@actor_index].restriction >= 1
        break if @actor_index == actor_index
      end
      if @actor_index == actor_index
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.cursor_se)
      $scene = Scene_Skill.new(@actor_index)
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (if subskill window is active)
  #--------------------------------------------------------------------------
  def update_subskill
    @skill_window.skill = @subskill_window.skill
    @skill_window.update_help
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @subskill_window.dispose
      @subskill_window = nil
      @skill_window.active = true
      return
    end
    if Input.trigger?(Input::C)
      @skill = @subskill_window.skill
      if @skill == nil or not @actor.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if @skill.scope >= 3
        if @skill.scope == 4 || @skill.scope == 6
          if Skill_Groups::TARGET_ALL_AUTO == true
            used = false
            for i in $game_party.actors
              used |= i.skill_effect(@actor, @skill)
            end
            if used
              $game_system.se_play(@skill.menu_se)
              @actor.sp -= @skill.sp_cost
              @status_window.refresh
              @skill_window.refresh
              @target_window.refresh
              if $game_party.all_dead?
                @subskill_window.dispose
                @subskill_window = nil
                $scene = Scene_Gameover.new
                return
              end
              if @skill.common_event_id > 0
                @subskill_window.dispose
                @subskill_window = nil
                $game_temp.common_event_id = @skill.common_event_id
                $scene = Scene_Map.new
                return
              end
            end
            unless used
              $game_system.se_play($data_system.buzzer_se)
            end
            return
          end
        end
        $game_system.se_play($data_system.decision_se)
        @subskill_window.active = false
        @target_window.x = (@skill_window.index + 1) % 2 * 304
        @target_window.z = 2000
        @target_window.visible = true
        @target_window.active = true
        if Skill_Groups::DISPOSE_WHEN_TARGET
          @subskill_window.visible = false
        end
        if @skill.scope == 4 || @skill.scope == 6
          @target_window.index = -1
        elsif @skill.scope == 7
          @target_window.index = @actor_index - 10
        else
          @target_window.index = 0
        end
      else
        if @skill.common_event_id > 0
          $game_temp.common_event_id = @skill.common_event_id
          $game_system.se_play(@skill.menu_se)
          @actor.sp -= @skill.sp_cost
          @status_window.refresh
          @skill_window.refresh
          @target_window.refresh
          @subskill_window.dispose
          @subskill_window = nil
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when target window is active)
  #--------------------------------------------------------------------------
  def update_target
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      unless @subskill_window.nil?
        @subskill_window.dispose
        @subskill_window = nil
      end
      @skill_window.active = true
      @target_window.visible = false
      @target_window.active = false
      return
    end
    if Input.trigger?(Input::C)
      unless @actor.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if @target_window.index == -1
        used = false
        for i in $game_party.actors
          used |= i.skill_effect(@actor, @skill)
        end
      end
      if @target_window.index <= -2
        target = $game_party.actors[@target_window.index + 10]
        used = target.skill_effect(@actor, @skill)
      end
      if @target_window.index >= 0
        target = $game_party.actors[@target_window.index]
        used = target.skill_effect(@actor, @skill)
      end
      if used
        $game_system.se_play(@skill.menu_se)
        @actor.sp -= @skill.sp_cost
        @status_window.refresh
        @skill_window.refresh
        @target_window.refresh
        if $game_party.all_dead?
          $scene = Scene_Gameover.new
          return
        end
        if @skill.common_event_id > 0
          $game_temp.common_event_id = @skill.common_event_id
          $scene = Scene_Map.new
          return
        end
      end
      unless used
        $game_system.se_play($data_system.buzzer_se)
      end
      return
    end
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    $game_temp.in_battle = true
    $game_temp.battle_turn = 0
    $game_temp.battle_event_flags.clear
    $game_temp.battle_abort = false
    $game_temp.battle_main_phase = false
    $game_temp.battleback_name = $game_map.battleback_name
    $game_temp.forcing_battler = nil
    $game_system.battle_interpreter.setup(nil, 0)
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
    @actor_command_window.y = 160
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    @party_command_window = Window_PartyCommand.new
    @help_window = Window_Help.new
    @help_window.back_opacity = 160
    @help_window.visible = false
    @status_window = Window_BattleStatus.new
    @message_window = Window_Message.new
    @spriteset = Spriteset_Battle.new
    @wait_count = 0
    if $data_system.battle_transition == ""
      Graphics.transition(20)
    else
      Graphics.transition(40, "Graphics/Transitions/" +
        $data_system.battle_transition)
    end
    start_phase1
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    $game_map.refresh
    Graphics.freeze
    @actor_command_window.dispose
    @party_command_window.dispose
    @help_window.dispose
    @status_window.dispose
    @message_window.dispose
    if @attack_window != nil
      @attack_window.dispose
    end
    if @skill_window != nil
      @skill_window.dispose
    end
    if @item_window != nil
      @item_window.dispose
    end
    if @result_window != nil
      @result_window.dispose
    end
    @spriteset.dispose
    if $scene.is_a?(Scene_Title)
      Graphics.transition
      Graphics.freeze
    end
    if $BTEST and not $scene.is_a?(Scene_Gameover)
      $scene = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase)
  #--------------------------------------------------------------------------
  def update_phase3
    if @enemy_arrow != nil
      update_phase3_enemy_select
    elsif @actor_arrow != nil
      update_phase3_actor_select
    elsif @attack_window != nil
      update_phase3_attack_select
    elsif @skill_window != nil
      update_phase3_skill_select
    elsif @item_window != nil
      update_phase3_item_select
    elsif @actor_command_window.active
      update_phase3_basic_command
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : basic command)
  #--------------------------------------------------------------------------
  def update_phase3_basic_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      phase3_prior_actor
      return
    end
    if Input.trigger?(Input::C)
      case @actor_command_window.index
      when 0  # attack
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 1
        start_attack_select
      when 1  # skill
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 1
        start_skill_select
      when 2  # guard
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 1
        phase3_next_actor
      when 3  # item
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 2
        start_item_select
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : attack selection)
  #--------------------------------------------------------------------------
  def update_phase3_attack_select
    @attack_window.visible = true
    @attack_window.update
    @attack_window.skill = @attack_window.data[@attack_window.index]
    unless @subattack_window.nil?
      @subattack_window.update
      update_phase3_subattack_select
      return
    end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      end_attack_select
      return
    end
    if Input.trigger?(Input::C)
      @skill = @attack_window.skill
      if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      if Skill_Groups::DATA.keys.include?(@skill.id)
        @subattack_window = Window_SubSkill.new(@active_battler, @skill.id)
        @attack_window.active = false
        return
      end
      @active_battler.current_action.skill_id = @skill.id
      @attack_window.visible = false
      if @skill.scope == 1
        start_enemy_select
      elsif @skill.scope == 3 or @skill.scope == 5
        start_actor_select
      else
        end_attack_select
        phase3_next_actor
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : skill selection)
  #--------------------------------------------------------------------------
  def update_phase3_subattack_select
    @attack_window.skill = @subattack_window.skill
    @attack_window.update_help
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @subattack_window.dispose
      @subattack_window = nil
      @attack_window.active = true
      return
    end
    if Input.trigger?(Input::C)
      @skill = @subattack_window.skill
      if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      @active_battler.current_action.skill_id = @skill.id
      @subattack_window.dispose
      @subattack_window = nil
      @attack_window.visible = false
      if @skill.scope == 1
        start_enemy_select
      elsif @skill.scope == 3 or @skill.scope == 5
        start_actor_select
      else
        end_attack_select
        phase3_next_actor
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : skill selection)
  #--------------------------------------------------------------------------
  def update_phase3_skill_select
    @skill_window.visible = true
    @skill_window.update
    @skill_window.skill = @skill_window.data[@skill_window.index]
    unless @subskill_window.nil?
      @subskill_window.update
      update_phase3_subskill_select
      return
    end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      end_skill_select
      return
    end
    if Input.trigger?(Input::C)
      @skill = @skill_window.skill
      if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      if Skill_Groups::DATA.keys.include?(@skill.id)
        @subskill_window = Window_SubSkill.new(@active_battler, @skill.id)
        @skill_window.active = false
        return
      end
      @active_battler.current_action.skill_id = @skill.id
      @skill_window.visible = false
      if @skill.scope == 1
        start_enemy_select
      elsif @skill.scope == 3 or @skill.scope == 5
        start_actor_select
      else
        end_skill_select
        phase3_next_actor
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : skill selection)
  #--------------------------------------------------------------------------
  def update_phase3_subskill_select
    @skill_window.skill = @subskill_window.skill
    @skill_window.update_help
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @subskill_window.dispose
      @subskill_window = nil
      @skill_window.active = true
      return
    end
    if Input.trigger?(Input::C)
      @skill = @subskill_window.skill
      if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      @active_battler.current_action.skill_id = @skill.id
      @subskill_window.dispose
      @subskill_window = nil
      @skill_window.visible = false
      if @skill.scope == 1
        start_enemy_select
      elsif @skill.scope == 3 or @skill.scope == 5
        start_actor_select
      else
        end_skill_select
        phase3_next_actor
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Start Attack Selection
  #--------------------------------------------------------------------------
  def start_attack_select
    @attack_window = Window_Skill.new(@active_battler, true)
    @attack_window.help_window = @help_window
    @actor_command_window.active = false
    @actor_command_window.visible = false
  end
  #--------------------------------------------------------------------------
  # * End Attack Selection
  #--------------------------------------------------------------------------
  def end_attack_select
    @attack_window.dispose
    @attack_window = nil
    @help_window.visible = false
    @actor_command_window.active = true
    @actor_command_window.visible = true
  end
  #--------------------------------------------------------------------------
  # * Frame Updat (actor command phase : enemy selection)
  #--------------------------------------------------------------------------
  def update_phase3_enemy_select
    @enemy_arrow.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      end_enemy_select
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @active_battler.current_action.target_index = @enemy_arrow.index
      end_enemy_select
      if @skill_window != nil
        end_skill_select
      end
      if @attack_window != nil
        end_attack_select
      end
      if @item_window != nil
        end_item_select
      end
      phase3_next_actor
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : actor selection)
  #--------------------------------------------------------------------------
  def update_phase3_actor_select
    @actor_arrow.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      end_actor_select
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @active_battler.current_action.target_index = @actor_arrow.index
      end_actor_select
      if @skill_window != nil
        end_skill_select
      end
      if @attack_window != nil
        end_attack_select
      end
      if @item_window != nil
        end_item_select
      end
      phase3_next_actor
    end
  end
end

Suerte.
avatar
Wecoc
Administrador
Administrador



Créditos 9370

Gracias : 517

Volver arriba Ir abajo

RPG Maker XP Re: [XP] Attack skills

Mensaje por marconando90 el 2017-04-10, 16:42

Por lo que parece me va perfectamente, sin errores y es fácil de editar. Baile  Very Happy  Mil gracias a ambos por la ayuda. Warrior notworthy
avatar
marconando90
Iniciado
Iniciado

0/3

Créditos 26

Gracias : 6

Volver arriba Ir abajo

RPG Maker XP Re: [XP] Attack skills

Mensaje por Wecoc el 2017-04-11, 17:55

Aquí te lo he adaptado como he podido al sistema BP system que estás usando.
Ahora estan los tres en uno. Quizá tendras que cambiar algún parámetro de alguna ventana o algo porque como está seguro que queda más que justo, pero eso ya será cosa tuya.

Código:
#==============================================================================
# ** [XP] Skill Groups v1.0 + Attack skills + BP System
#------------------------------------------------------------------------------
#  Autores:
#  - Wecoc (Skill Grups, Attack Skills)
#  - Claimh (BP System)
#==============================================================================

#==============================================================================
# ** Skill_Groups
#==============================================================================

module Skill_Groups
  
  # ID skill principal => [[IDs secundarias], iconos, SP cost, align]
  DATA = {179 => [[1, 2, 3, 4, 5, 6, 83, 84, 100, 106, 120, 121, 151, 174],
          true, true, 0],
          
          180 => [[7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
            22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], true, true, 0],
            
          181 => [[33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
            48, 49, 50, 51, 52, 53, 54, 55, 56, 81, 82, 86, 87, 89, 90, 91, 92,
            93, 94, 95, 96, 97, 98, 101, 102, 103, 104, 107, 108, 110, 122, 123,
            124, 125, 126, 127, 128, 129, 137, 139, 140, 141, 142, 143, 144, 148,
            164, 165, 166, 167, 171, 172, 173, 176, 177, 178], true, true, 0],
          
          182 => [[57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
            72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 88, 99, 105, 109, 130, 131,
            132, 133, 134, 135, 136, 169, 170], true, true, 0],
            
          183 => [[94, 111, 112, 113, 114, 115, 116, 117, 118, 119, 138, 145,
            146, 147, 149, 150, 152, 153, 154, 155, 156, 157, 158, 159, 160,
            161, 162, 163, 168, 175], true, true, 0]}
  
  # Opción: Mostrar skills pese a que el actor no pueda usarlas (desactivadas)
  SHOW_DISABLED_SKILLS = false
  
  # Opción: Si afecta a todos no se abre la ventana Window_Target
  TARGET_ALL_AUTO = true
  
  # Opción: Quitar ventana cuando se selecciona el target
  DISPOSE_WHEN_TARGET = true
  
  # IDs de las skills que estan en la ventana de Atacar
  ATTACK_IDS = [170, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
    195, 196, 197, 198, 199, 190]

  # Poner SP cost o BP cost a los ataques
  ATTACK_SP_COST = false
  ATTACK_BP_COST = false
  
end

#==============================================================================
# ** SysSkill_BP
#==============================================================================

module SysSkill_BP
  # Usar o custo SP.
  BATTLE_SP_USE = true    
  # Ativar a janela de BP.
  WINDOW_BP_USE = false  
  # Ativar o valor do BP por ícones.
  USE_BP_ICON = false    
  # Nome do arquivo BP.
  BP_ICON = "034-Item04"
  SKILL_BP = {
  # Definição do custo de BP para cada habilidade.
  #
  # A => B
  #----------------------------------
  # A = ID da habilidade.
  # B = Custo de BP.
  #----------------------------------
    1 => 0, 2 => 0, 3 =>0,
    4 => 0, 5 => 0,
    6 => 0,
    7 => 0, 8 => 0, 9 => 0,
    10 => 0, 11 => 0, 12 => 0,
    13 => 0, 14 => 0, 15 => 0,
    16 => 0, 17 => 0, 18 => 0,
    19 => 0, 20 => 0, 21 => 0,
    22 => 0, 23 => 0, 24 => 0,
    25 => 0, 26 => 0, 27 => 0,
    28 => 0, 29 => 0, 30 => 0,
    31 => 0, 32 => 0,
    33 => 0, 34 => 0,
    35 => 0, 36 => 0,
    37 => 0, 38 => 0,
    39 => 0, 40 => 0,
    41 => 0, 42 => 0,
    43 => 0, 44 => 0,
    45 => 0, 46 => 0,
    47 => 0, 48 => 0,
    49 => 0, 50 => 0,
    51 => 0, 52 => 0,
    53 => 0, 54 => 0, 55 => 0, 56 => 0,
    57 => 5, 58 => 7, 59 => 20, 60 => 15,
    61 => 5, 62 => 7, 63 => 10, 64 => 15,
    65 => 5, 66 => 7, 67 => 10, 68 => 15,
    69 => 5, 70 => 7, 71 => 10, 72 => 15,
    73 => 5, 74 => 7, 75 => 10, 76 => 15,
    77 => 20, 78 => 20, 79 => 20, 80 => 15,
    85 => 6, 88 => 15, 99 => 20, 109 => 15,
    111 => 25, 112 => 25, 113 => 25, 114 => 25,
    115 => 25, 116 => 25, 117 => 25, 118 => 25,
    125 => 20, 126 => 20, 130 => 5, 131 => 5,
    132 => 5, 133 => 10, 134 => 10, 135 => 15,
    136 => 20, 138 => 30, 144 => 10, 145 => 0,
    146 => 25, 147 => 30, 149 => 30, 150 => 30,
    152 => 20, 153 => 20, 154 => 30, 155 => 20,
    163 => 25, 168 => 30, 169 => 15, 170 => 15,
    174 => 15, 175 => 20, 179 => 0, 180 => 0,
    181 => 0, 182 => 0, 183 => 0,
  }
  # Definição dos parí¢metros iniciais de BP para cada personagem.
    ACT_BP = {
  #------------------------------------------------------
  # A => [B, C, D]
  #------------------------------------------------------
  # A = ID do personagem.
  # B = Valor de BP inicial do personagem.
  # C = Valor de BP maximo do personagem.
  # D = Valor de BP recuperado a cada turno.
  #------------------------------------------------------
    1 => [2, 10, 1],
    2 => [4, 12, 2],
    3 => [3, 10, 2],
    4 => [10, 25, 7],
    5 => [20, 40, 20],
    6 => [9, 30, 8],
    7 => [20, 40, 15],
    8 => [20, 40, 15],
    9 => [20, 40, 10],
    10 => [20, 40, 15],
    11 => [50, 99, 10],
    12 => [2, 10, 1]
  }
  # Definindo em que Level o personagem aumentará o valor inicial de BP.
  ACT_INIT_BP_LVUP = {
  #------------------------------------------------------
  # A  => [B,B,B,B,B,B],
  #------------------------------------------------------
  # A = ID do personagem.
  # B = Level
    1 => [6,10,15,20,25,30],
    2 => [6,10,15,20,25,30],
    3 => [6,10,15,20,25,30],
    4 => [6,10,15,20,25,30],
    5 => [6,10,15,20,25,30],
    6 => [6,10,15,20,25,30],
    7 => [6,10,15,20,25,30],
    8 => [6,10,15,20,25,30],
    9 => [6,10,15,20,25,30],
    10 => [6,10,15,20,25,30],
    11 => [6,10,15,20,25,30],
    12 => [6,10,15,20,25,30]
  }
  # Definindo em que Level o personagem aumentará o valor maximo de BP.
  ACT_MAX_BP_LVUP = {
  #------------------------------------------------------
  # A  => [B,B,B,B,B,B],
  #------------------------------------------------------
  # A = ID do personagem.
  # B = Level
    1 => [6,10,15,20,25,30],
    2 => [6,10,15,20,25,30],
    3 => [6,10,15,20,25,30],
    4 => [6,10,15,20,25,30],
    5 => [6,10,15,20,25,30],
    6 => [6,10,15,20,25,30],
    7 => [6,10,15,20,25,30],
    8 => [6,10,15,20,25,30],
    9 => [6,10,15,20,25,30],
    10 => [6,10,15,20,25,30],
    11 => [6,10,15,20,25,30],
    12 => [6,10,15,20,25,30]
  }
  # Definindo em que Level o personagem aumentará o valor de BP ganho por turno.
  ACT_REST_BP_LVUP = {
  #------------------------------------------------------
  # A  => [B,B,B,B,B,B],
  #------------------------------------------------------
  # A = ID do personagem.
  # B = Level

    1 => [6,10,15,20,25,30],
    2 => [6,10,15,20,25,30],
    3 => [6,10,15,20,25,30],
    4 => [6,10,15,20,25,30],
    5 => [6,10,15,20,25,30],
    6 => [6,10,15,20,25,30],
    7 => [6,10,15,20,25,30],
    8 => [6,10,15,20,25,30],
    9 => [6,10,15,20,25,30],
    10 => [6,10,15,20,25,30],
    11 => [6,10,15,20,25,30],
    12 => [6,10,15,20,25,30]
  }
end

#==============================================================================
# ** Game_Battler
#==============================================================================

class Game_Battler
  alias skill_limit_can_use? skill_can_use? unless $@
  def skill_can_use?(skill_id)
    ret = skill_limit_can_use?(skill_id)
    if self.is_a?(Game_Actor) and $scene.is_a?(Scene_Battle)
      bp = SysSkill_BP::SKILL_BP[skill_id]
      skill_bp = ( bp == nil ? 1 : bp)
      if ret  
        if self.bp < skill_bp
          return false
        end
      else
        if !SysSkill_BP::BATTLE_SP_USE
          if $data_skills[skill_id].sp_cost > self.sp
            cp_sp = $data_skills[skill_id].sp_cost.dup
            $data_skills[skill_id].sp_cost = 0
            ret_sp = skill_limit_can_use?(skill_id)
            $data_skills[skill_id].sp_cost = cp_sp
            if ret_sp
              if self.bp < skill_bp
                # if FlashSystem::FLASH_COST and self.flash_flg
                #  return true
                # end
                return false
              end
            end
          end
        end
      end
    end
    return ret
  end
  
  def skill_effect(user, skill)
    self.critical = false
    if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
      ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
      return false
    end
    effective = false
    effective |= skill.common_event_id > 0
    hit = skill.hit
    if skill.atk_f > 0
      hit *= user.hit / 100
    end
    hit_result = (rand(100) < hit)
    effective |= hit < 100
    if hit_result == true
      power = skill.power + user.atk * skill.atk_f / 100
      if power > 0
        power -= self.pdef * skill.pdef_f / 200
        power -= self.mdef * skill.mdef_f / 200
        power = [power, 0].max
      end
      rate = 20
      rate += (user.str * skill.str_f / 100)
      rate += (user.dex * skill.dex_f / 100)
      rate += (user.agi * skill.agi_f / 100)
      rate += (user.int * skill.int_f / 100)
      self.damage = power * rate / 20
      self.damage *= elements_correct(user.element_set)
      self.damage /= 100
      self.damage *= elements_correct(skill.element_set)
      self.damage /= 100
      if self.damage > 0
        if rand(100) < 4 * user.dex / self.agi
          self.damage *= 2
          self.critical = true
        end
        if self.guarding?
          self.damage /= 2
        end
      end
      if skill.variance > 0 and self.damage.abs > 0
        amp = [self.damage.abs * skill.variance / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      eva = 8 * self.agi / user.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
      effective |= hit < 100
    end
    if hit_result == true
      if skill.power != 0 and skill.atk_f > 0
        remove_states_shock
        effective = true
      end
      last_hp = self.hp
      self.hp -= self.damage
      effective |= self.hp != last_hp
      @state_changed = false
      effective |= states_plus(user.plus_state_set)
      effective |= states_minus(user.minus_state_set)
      effective |= states_plus(skill.plus_state_set)
      effective |= states_minus(skill.minus_state_set)
      if skill.power == 0
        self.damage = ""
        unless @state_changed
          self.damage = "Miss"
          self.critical = false
        end
      end
    else
      self.damage = "Miss"
      self.critical = false
    end
    unless $game_temp.in_battle
      self.damage = nil
    end
    return effective
  end
end

#==============================================================================
# ** Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  
  attr_accessor  :bp
  attr_accessor  :init_bp
  attr_accessor  :max_bp
  attr_accessor  :rest_bp
  
  alias initialize_use_limit initialize unless $@
  def initialize(actor_id)
    initialize_use_limit(actor_id)
    act_bp = SysSkill_BP::ACT_BP[actor_id]
    @bp = act_bp[0]
    @init_bp = act_bp[0]
    @max_bp = act_bp[1]
    @rest_bp = act_bp[2]
  end
  
  alias exp_bp= exp= unless $@
  def exp=(exp)
    cp_level = @level  
    self.exp_bp = exp
    if cp_level < @level  
      counter_num = 4
    elsif cp_level > @level
      counter_num = -1
    else                  
      return
    end
    for lv_index in cp_level...@level
      if SysSkill_BP::ACT_INIT_BP_LVUP[self.id].include?(lv_index)
        @init_bp += counter_num
      end
      if SysSkill_BP::ACT_MAX_BP_LVUP[self.id].include?(lv_index)
        @max_bp += counter_num
      end
      if SysSkill_BP::ACT_REST_BP_LVUP[self.id].include?(lv_index)
        @rest_bp += counter_num
      end
    end
  end
  
  alias subgroup_can_use? skill_can_use? unless $@
  def skill_can_use?(skill_id)
    result = subgroup_can_use?(skill_id)
    if result == true
      if Skill_Groups::DATA.keys.include?(skill_id)
        for i in 0...Skill_Groups::DATA[skill_id][0].size
          subskill = Skill_Groups::DATA[skill_id][0][i]
          return true if subgroup_can_use?(subskill)
        end
        return false
      end
    end
    return result
  end
end

#==============================================================================
# ** Window_Base
#==============================================================================

class Window_Base < Window
  def draw_actor_bp(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 32, 32, "Aura")
    width = 144
    if width - 32 >= 108
      sp_x = x + width - 124
      flag = true
    elsif width - 32 >= 48
      sp_x = x + width - 48
      flag = false
    end
    self.contents.font.color = actor.bp == 0 ? knockout_color :
      actor.bp <= actor.max_bp / 4 ? crisis_color : normal_color
    self.contents.draw_text(sp_x, y, 36, 32, actor.bp.to_s, 2)
    if flag
      self.contents.font.color = normal_color
      self.contents.draw_text(sp_x + 36, y, 12, 32, "/", 1)
      self.contents.draw_text(sp_x + 48, y, 48, 32, actor.max_bp.to_s)
      self.contents.font.color = knockout_color
      self.contents.draw_text(sp_x + 72, y, 12, 32, "+", 1)
      self.contents.draw_text(sp_x + 84, y, 48, 32, actor.rest_bp.to_s)
      self.contents.font.color = normal_color
    end
  end
  def draw_actor_bp_icon(actor, x, y)
    bitmap = RPG::Cache.icon(SysSkill_BP::BP_ICON)
    cw = bitmap.width
    ch = bitmap.height
    src_rect = Rect.new(0, 0, cw, ch)
    for i in 0...actor.bp
      self.contents.blt(x + cw - bitmap.width, y - ch + 30, bitmap, src_rect)
      cw += bitmap.width
    end
  end
end

#==============================================================================
# ** Window_Battle_Point
#==============================================================================

class Window_Battle_Point < Window_Base
  def initialize
    super(0, 0, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
  end
  def set_actor_bp(actor)
    if SysSkill_BP::USE_BP_ICON
      draw_actor_bp_icon(actor, 4, 0)
    else
      draw_actor_bp(actor, 4, 0)
    end
  end
end

#==============================================================================
# ** Window_Skill
#==============================================================================

class Window_Skill < Window_Selectable
  
  attr_reader :data
  
  alias attack_mode_ini initialize unless $@
  def initialize(actor, attack_mode=false)
    @attack_mode = attack_mode
    attack_mode_ini(actor)
  end

  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    @skill = nil
    for i in 0...@actor.skills.size
      skill = $data_skills[@actor.skills[i]]
      sub_skill = false
      if skill != nil
        for d in Skill_Groups::DATA.values
          if d[0].include?(skill.id)
            sub_skill = true
            break d
          end
        end
        if sub_skill == false
          if Skill_Groups::ATTACK_IDS.include?(skill.id)
            @data.push(skill) if @attack_mode == true
          else
            @data.push(skill) if @attack_mode == false
          end
        end
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end

  def skill
    return @skill
  end

  def skill=(skill)
    @skill = skill
  end

  def draw_item(index)
    skill = @data[index]
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
    if SysSkill_BP::BATTLE_SP_USE
      if @attack_mode == false || Skill_Groups::ATTACK_SP_COST
        #if skill.sp_cost > 0
        self.contents.draw_text(x + 196, y, 48, 32, skill.sp_cost.to_s, 2)
        #end
      end
    end
    bp = SysSkill_BP::SKILL_BP[skill.id]
    skill_bp = (bp == nil ? 1 : bp)
    self.contents.font.color = crisis_color
    if @attack_mode == false || Skill_Groups::ATTACK_BP_COST
      #if skill_bp > 0
      self.contents.draw_text(x + 232, y, 48, 32, skill_bp.to_s, 2)
      #end
    end
  end
end

#==============================================================================
# ** Window_SubSkill
#==============================================================================

class Window_SubSkill < Window_Selectable
  
  attr_reader :data

  def initialize(actor, skill_id)
    width  = 280
    height = (Skill_Groups::DATA[skill_id][0].size + 1) * 32
    x = (640 / 2) - (width / 2)
    y = (480 / 2) - (height / 2)
    @actor = actor
    @skill_id = skill_id
    super(x, y, width, height)
    self.back_opacity = 160
    self.z = 1000
    refresh
    self.index = 0
  end

  def skill
    return @data[self.index]
  end

  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    skills = Skill_Groups::DATA[@skill_id][0]
    for i in 0...skills.size
      skill = $data_skills[skills[i]]
      if Skill_Groups::SHOW_DISABLED_SKILLS == false
        next if !@actor.skills.include?(skill.id)
      end
      if skill != nil
        @data.push(skill)
      end
    end
    @item_max = @data.size
    if Skill_Groups::SHOW_DISABLED_SKILLS == false
      self.height = (@item_max + 1) * 32
      self.y = (480 / 2) - (height / 2)
    end
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end

  def draw_item(index)
    skill = @data[index]
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    align = Skill_Groups::DATA[@skill_id][3]
    if Skill_Groups::DATA[@skill_id][1]
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(x + 28, y, 204, 32, skill.name, align)
    else
      self.contents.draw_text(x, y, self.width - 48, 32, skill.name, align)
    end
    if Skill_Groups::DATA[@skill_id][2]
      if SysSkill_BP::BATTLE_SP_USE
        if @attack_mode == false || Skill_Groups::ATTACK_SP_COST
          #if skill.sp_cost > 0
          sx = x + self.width - 96 + 4 - 48
          self.contents.draw_text(sx, y, 48, 32, skill.sp_cost.to_s, 2)
          #end
        end
      end
      bp = SysSkill_BP::SKILL_BP[skill.id]
      skill_bp = (bp == nil ? 1 : bp)
      self.contents.font.color = crisis_color
      if @attack_mode == false || Skill_Groups::ATTACK_BP_COST
        #if skill_bp > 0
        sx = x + self.width - 96 + 4
        self.contents.draw_text(sx, y, 48, 32, skill_bp.to_s, 2)
        #end
      end
    end
  end
end

#==============================================================================
# ** Window_BattleStatus
#==============================================================================

class Window_BattleStatus < Window_Base
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_x = i * 160 + 4
      draw_actor_name(actor, actor_x, 0)
      if SysSkill_BP::BATTLE_SP_USE
        draw_actor_hp(actor, actor_x, 30, 120)
        draw_actor_sp(actor, actor_x, 50, 120)
      else
        draw_actor_hp(actor, actor_x, 32, 120)
      end
      if SysSkill_BP::BATTLE_SP_USE
        bp_y = 70
      else
        bp_y = 64
      end
      if SysSkill_BP::USE_BP_ICON
        draw_actor_bp_icon(actor, actor_x, bp_y)
      else
        draw_actor_bp(actor, actor_x, bp_y)
      end
      if @level_up_flags[i]
        self.contents.font.color = normal_color
        self.contents.draw_text(actor_x, 96, 120, 32, "¡Sube de nivel!")
      else
        draw_actor_state(actor, actor_x, 96)
      end
    end
  end
end

#==============================================================================
# ** Scene_Skill
#==============================================================================

class Scene_Skill
  def update
    @help_window.update
    @status_window.update
    @skill_window.update
    @target_window.update
    unless @subskill_window.nil?
      @subskill_window.update
      if @subskill_window.active
        update_subskill
        return
      end
    end
    if @skill_window.active
      update_skill
      return
    end
    if @target_window.active
      update_target
      return
    end
  end

  def update_skill
    @skill_window.skill = @skill_window.data[@skill_window.index]
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(1)
      return
    end
    if Input.trigger?(Input::C)
      @skill = @skill_window.skill
      if @skill == nil or not @actor.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if Skill_Groups::DATA.keys.include?(@skill.id)
        $game_system.se_play($data_system.decision_se)
        @subskill_window = Window_SubSkill.new(@actor, @skill.id)
        @skill_window.active = false
        return
      end
      if @skill.scope >= 3
        if @skill.scope == 4 || @skill.scope == 6
          if Skill_Groups::TARGET_ALL_AUTO == true
            used = false
            for i in $game_party.actors
              used |= i.skill_effect(@actor, @skill)
            end
            if used
              $game_system.se_play(@skill.menu_se)
              @actor.sp -= @skill.sp_cost
              @status_window.refresh
              @skill_window.refresh
              @target_window.refresh
              if $game_party.all_dead?
                $scene = Scene_Gameover.new
                return
              end
              if @skill.common_event_id > 0
                $game_temp.common_event_id = @skill.common_event_id
                $scene = Scene_Map.new
                return
              end
            end
            unless used
              $game_system.se_play($data_system.buzzer_se)
            end
            return
          end
        end
        $game_system.se_play($data_system.decision_se)
        @skill_window.active = false
        @target_window.x = (@skill_window.index + 1) % 2 * 304
        @target_window.z = 2000
        @target_window.visible = true
        @target_window.active = true
        if @skill.scope == 4 || @skill.scope == 6
          @target_window.index = -1
        elsif @skill.scope == 7
          @target_window.index = @actor_index - 10
        else
          @target_window.index = 0
        end
      else
        if @skill.common_event_id > 0
          $game_temp.common_event_id = @skill.common_event_id
          $game_system.se_play(@skill.menu_se)
          @actor.sp -= @skill.sp_cost
          @status_window.refresh
          @skill_window.refresh
          @target_window.refresh
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
    if Input.trigger?(Input::R)
      if $game_party.actors.size == 1
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      actor_index = @actor_index
      loop do
        @actor_index += 1
        @actor_index %= $game_party.actors.size
        break unless $game_party.actors[@actor_index].restriction >= 1
        break if @actor_index == actor_index
      end
      if @actor_index == actor_index
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.cursor_se)
      $scene = Scene_Skill.new(@actor_index)
      return
    end
    if Input.trigger?(Input::L)
      if $game_party.actors.size == 1
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      actor_index = @actor_index
      loop do
        @actor_index -= 1
        @actor_index %= $game_party.actors.size
        break unless $game_party.actors[@actor_index].restriction >= 1
        break if @actor_index == actor_index
      end
      if @actor_index == actor_index
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.cursor_se)
      $scene = Scene_Skill.new(@actor_index)
      return
    end
  end

  def update_subskill
    @skill_window.skill = @subskill_window.skill
    @skill_window.update_help
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @subskill_window.dispose
      @subskill_window = nil
      @skill_window.active = true
      return
    end
    if Input.trigger?(Input::C)
      @skill = @subskill_window.skill
      if @skill == nil or not @actor.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if @skill.scope >= 3
        if @skill.scope == 4 || @skill.scope == 6
          if Skill_Groups::TARGET_ALL_AUTO == true
            used = false
            for i in $game_party.actors
              used |= i.skill_effect(@actor, @skill)
            end
            if used
              $game_system.se_play(@skill.menu_se)
              @actor.sp -= @skill.sp_cost
              @status_window.refresh
              @skill_window.refresh
              @target_window.refresh
              if $game_party.all_dead?
                @subskill_window.dispose
                @subskill_window = nil
                $scene = Scene_Gameover.new
                return
              end
              if @skill.common_event_id > 0
                @subskill_window.dispose
                @subskill_window = nil
                $game_temp.common_event_id = @skill.common_event_id
                $scene = Scene_Map.new
                return
              end
            end
            unless used
              $game_system.se_play($data_system.buzzer_se)
            end
            return
          end
        end
        $game_system.se_play($data_system.decision_se)
        @subskill_window.active = false
        @target_window.x = (@skill_window.index + 1) % 2 * 304
        @target_window.z = 2000
        @target_window.visible = true
        @target_window.active = true
        if Skill_Groups::DISPOSE_WHEN_TARGET
          @subskill_window.visible = false
        end
        if @skill.scope == 4 || @skill.scope == 6
          @target_window.index = -1
        elsif @skill.scope == 7
          @target_window.index = @actor_index - 10
        else
          @target_window.index = 0
        end
      else
        if @skill.common_event_id > 0
          $game_temp.common_event_id = @skill.common_event_id
          $game_system.se_play(@skill.menu_se)
          @actor.sp -= @skill.sp_cost
          @status_window.refresh
          @skill_window.refresh
          @target_window.refresh
          @subskill_window.dispose
          @subskill_window = nil
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
  end

  def update_target
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      unless @subskill_window.nil?
        @subskill_window.dispose
        @subskill_window = nil
      end
      @skill_window.active = true
      @target_window.visible = false
      @target_window.active = false
      return
    end
    if Input.trigger?(Input::C)
      unless @actor.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if @target_window.index == -1
        used = false
        for i in $game_party.actors
          used |= i.skill_effect(@actor, @skill)
        end
      end
      if @target_window.index <= -2
        target = $game_party.actors[@target_window.index + 10]
        used = target.skill_effect(@actor, @skill)
      end
      if @target_window.index >= 0
        target = $game_party.actors[@target_window.index]
        used = target.skill_effect(@actor, @skill)
      end
      if used
        $game_system.se_play(@skill.menu_se)
        @actor.sp -= @skill.sp_cost
        @status_window.refresh
        @skill_window.refresh
        @target_window.refresh
        if $game_party.all_dead?
          $scene = Scene_Gameover.new
          return
        end
        if @skill.common_event_id > 0
          $game_temp.common_event_id = @skill.common_event_id
          $scene = Scene_Map.new
          return
        end
      end
      unless used
        $game_system.se_play($data_system.buzzer_se)
      end
      return
    end
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================

class Scene_Battle
  def main
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor.bp = actor.init_bp
    end
    $game_temp.in_battle = true
    $game_temp.battle_turn = 0
    $game_temp.battle_event_flags.clear
    $game_temp.battle_abort = false
    $game_temp.battle_main_phase = false
    $game_temp.battleback_name = $game_map.battleback_name
    $game_temp.forcing_battler = nil
    $game_system.battle_interpreter.setup(nil, 0)
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
    @actor_command_window.y = 160
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    @party_command_window = Window_PartyCommand.new
    @help_window = Window_Help.new
    @help_window.back_opacity = 160
    @help_window.visible = false
    @status_window = Window_BattleStatus.new
    @message_window = Window_Message.new
    @spriteset = Spriteset_Battle.new
    @wait_count = 0
    if $data_system.battle_transition == ""
      Graphics.transition(20)
    else
      Graphics.transition(40, "Graphics/Transitions/" +
        $data_system.battle_transition)
    end
    start_phase1
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    $game_map.refresh
    Graphics.freeze
    @actor_command_window.dispose
    @party_command_window.dispose
    @help_window.dispose
    @status_window.dispose
    @message_window.dispose
    if @attack_window != nil
      @attack_window.dispose
    end
    if @skill_window != nil
      @skill_window.dispose
    end
    if @item_window != nil
      @item_window.dispose
    end
    if @result_window != nil
      @result_window.dispose
    end
    @spriteset.dispose
    if $scene.is_a?(Scene_Title)
      Graphics.transition
      Graphics.freeze
    end
    if $BTEST and not $scene.is_a?(Scene_Gameover)
      $scene = nil
    end
  end

  def update_phase3
    if @enemy_arrow != nil
      update_phase3_enemy_select
    elsif @actor_arrow != nil
      update_phase3_actor_select
    elsif @attack_window != nil
      update_phase3_attack_select
    elsif @skill_window != nil
      update_phase3_skill_select
    elsif @item_window != nil
      update_phase3_item_select
    elsif @actor_command_window.active
      update_phase3_basic_command
    end
  end

  def update_phase3_basic_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      phase3_prior_actor
      return
    end
    if Input.trigger?(Input::C)
      case @actor_command_window.index
      when 0  # attack
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 1
        start_attack_select
      when 1  # skill
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 1
        start_skill_select
      when 2  # guard
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 1
        phase3_next_actor
      when 3  # item
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 2
        start_item_select
      end
      return
    end
  end

  def update_phase3_attack_select
    @attack_window.visible = true
    @attack_window.update
    @attack_window.skill = @attack_window.data[@attack_window.index]
    unless @subattack_window.nil?
      @subattack_window.update
      update_phase3_subattack_select
      return
    end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      end_attack_select
      return
    end
    if Input.trigger?(Input::C)
      @skill = @attack_window.skill
      if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      if Skill_Groups::DATA.keys.include?(@skill.id)
        @subattack_window = Window_SubSkill.new(@active_battler, @skill.id)
        @attack_window.active = false
        return
      end
      @active_battler.current_action.skill_id = @skill.id
      @attack_window.visible = false
      if @skill.scope == 1
        start_enemy_select
      elsif @skill.scope == 3 or @skill.scope == 5
        start_actor_select
      else
        end_attack_select
        phase3_next_actor
      end
      return
    end
  end

  def update_phase3_subattack_select
    @attack_window.skill = @subattack_window.skill
    @attack_window.update_help
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @subattack_window.dispose
      @subattack_window = nil
      @attack_window.active = true
      return
    end
    if Input.trigger?(Input::C)
      @skill = @subattack_window.skill
      if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      @active_battler.current_action.skill_id = @skill.id
      @subattack_window.dispose
      @subattack_window = nil
      @attack_window.visible = false
      if @skill.scope == 1
        start_enemy_select
      elsif @skill.scope == 3 or @skill.scope == 5
        start_actor_select
      else
        end_attack_select
        phase3_next_actor
      end
      return
    end
  end

  def update_phase3_skill_select
    @skill_window.visible = true
    @skill_window.update
    @skill_window.skill = @skill_window.data[@skill_window.index]
    unless @subskill_window.nil?
      @subskill_window.update
      update_phase3_subskill_select
      return
    end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      end_skill_select
      return
    end
    if Input.trigger?(Input::C)
      @skill = @skill_window.skill
      if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      if Skill_Groups::DATA.keys.include?(@skill.id)
        @subskill_window = Window_SubSkill.new(@active_battler, @skill.id)
        @skill_window.active = false
        return
      end
      @active_battler.current_action.skill_id = @skill.id
      @skill_window.visible = false
      if @skill.scope == 1
        start_enemy_select
      elsif @skill.scope == 3 or @skill.scope == 5
        start_actor_select
      else
        end_skill_select
        phase3_next_actor
      end
      return
    end
  end

  def update_phase3_subskill_select
    @skill_window.skill = @subskill_window.skill
    @skill_window.update_help
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @subskill_window.dispose
      @subskill_window = nil
      @skill_window.active = true
      return
    end
    if Input.trigger?(Input::C)
      @skill = @subskill_window.skill
      if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      @active_battler.current_action.skill_id = @skill.id
      @subskill_window.dispose
      @subskill_window = nil
      @skill_window.visible = false
      if @skill.scope == 1
        start_enemy_select
      elsif @skill.scope == 3 or @skill.scope == 5
        start_actor_select
      else
        end_skill_select
        phase3_next_actor
      end
      return
    end
  end

  def start_attack_select
    @attack_window = Window_Skill.new(@active_battler, true)
    @attack_window.help_window = @help_window
    @actor_command_window.active = false
    @actor_command_window.visible = false
    if SysSkill_BP::WINDOW_BP_USE
      @actor_bp_window = Window_Battle_Point.new
      @actor_bp_window.x = @actor_index * 160
      @actor_bp_window.y = 300
      @actor_bp_window.back_opacity =160
      @actor_bp_window.set_actor_bp(@active_battler)
    end
  end

  def end_attack_select
    @attack_window.dispose
    @attack_window = nil
    if SysSkill_BP::WINDOW_BP_USE
      @actor_bp_window.dispose
      @actor_bp_window = nil
    end
    @help_window.visible = false
    @actor_command_window.active = true
    @actor_command_window.visible = true
  end

  alias start_skill_select_limit start_skill_select unless $@
  def start_skill_select
    start_skill_select_limit
    if SysSkill_BP::WINDOW_BP_USE
      @actor_bp_window = Window_Battle_Point.new
      @actor_bp_window.x = @actor_index * 160
      @actor_bp_window.y = 300
      @actor_bp_window.back_opacity =160
      @actor_bp_window.set_actor_bp(@active_battler)
    end
  end

  alias end_skill_select_limit end_skill_select unless $@
  def end_skill_select
    if SysSkill_BP::WINDOW_BP_USE
      @actor_bp_window.dispose
      @actor_bp_window = nil
    end
    end_skill_select_limit
  end

  def update_phase3_enemy_select
    @enemy_arrow.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      end_enemy_select
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @active_battler.current_action.target_index = @enemy_arrow.index
      end_enemy_select
      if @skill_window != nil
        end_skill_select
      end
      if @attack_window != nil
        end_attack_select
      end
      if @item_window != nil
        end_item_select
      end
      phase3_next_actor
    end
  end

  def update_phase3_actor_select
    @actor_arrow.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      end_actor_select
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @active_battler.current_action.target_index = @actor_arrow.index
      end_actor_select
      if @skill_window != nil
        end_skill_select
      end
      if @attack_window != nil
        end_attack_select
      end
      if @item_window != nil
        end_item_select
      end
      phase3_next_actor
    end
  end
  
  alias make_skill_action_result_limit make_skill_action_result unless $@
  def make_skill_action_result
    make_skill_action_result_limit
    if @active_battler.is_a?(Game_Actor)
      bp = SysSkill_BP::SKILL_BP[@skill.id]
      skill_bp = (bp==nil ? 1 : bp)
      @active_battler.bp -= skill_bp
      if !SysSkill_BP::BATTLE_SP_USE
        @active_battler.sp += @skill.sp_cost
      end
    end
  end
  
  alias update_phase4_step6_limit update_phase4_step6 unless $@
  def update_phase4_step6
    update_phase4_step6_limit
    if @active_battler.is_a?(Game_Actor)
      @active_battler.bp += @active_battler.rest_bp
      if @active_battler.bp > @active_battler.max_bp
        @active_battler.bp = @active_battler.max_bp
      end
    end
  end
end

No uses más sistemas de skill a la vez, sería una locura.
avatar
Wecoc
Administrador
Administrador



Créditos 9370

Gracias : 517

Volver arriba Ir abajo

RPG Maker XP Re: [XP] Attack skills

Mensaje por Contenido patrocinado


Contenido patrocinado


Volver arriba Ir abajo

Ver el tema anterior Ver el tema siguiente Volver arriba


Permisos de este foro:
No puedes responder a temas en este foro.