Eventers Lab & G+ Games (ELG+)
Olá, se você já é cadastrado no nosso fórum, faça seu login, se ainda não é, não perca tempo! Cadastre-se já!

Participe do fórum, é rápido e fácil

Eventers Lab & G+ Games (ELG+)
Olá, se você já é cadastrado no nosso fórum, faça seu login, se ainda não é, não perca tempo! Cadastre-se já!
Eventers Lab & G+ Games (ELG+)
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.
Entrar

Esqueci-me da senha

Últimos assuntos
» 2 Players no jogo (Backup RMB)
Sistema para uso e seleção de Habilidades EmptyDom Jul 31, 2011 5:39 pm por Rodrigo Vernaschi

» Chamar Bote
Sistema para uso e seleção de Habilidades EmptyDom Jul 31, 2011 5:16 pm por Rodrigo Vernaschi

» Caixa de Texto Acima do Personagem
Sistema para uso e seleção de Habilidades EmptyDom Jul 31, 2011 4:56 pm por Rodrigo Vernaschi

» Auto-Tile Speed
Sistema para uso e seleção de Habilidades EmptyDom Jul 31, 2011 4:49 pm por Rodrigo Vernaschi

» Apresentação Antes do Title
Sistema para uso e seleção de Habilidades EmptyDom Jul 31, 2011 4:35 pm por Rodrigo Vernaschi

» Anti-Hack System (Silver Link/Gold Link)
Sistema para uso e seleção de Habilidades EmptyDom Jul 31, 2011 4:26 pm por Rodrigo Vernaschi

» Anti Hack (AMIGO X)
Sistema para uso e seleção de Habilidades EmptyDom Jul 31, 2011 4:19 pm por Rodrigo Vernaschi

» Ajustar Volume Durante o Jogo
Sistema para uso e seleção de Habilidades EmptyDom Jul 31, 2011 3:58 pm por Rodrigo Vernaschi

» Músicas e poemas
Sistema para uso e seleção de Habilidades EmptyQua Out 20, 2010 8:19 pm por Memories


Sistema para uso e seleção de Habilidades

Ir para baixo

Sistema para uso e seleção de Habilidades Empty Sistema para uso e seleção de Habilidades

Mensagem por Vingador Ter Jan 05, 2010 1:48 am

Quando ganhar uma habilidade, vá em Menu > Tecnicas e 'equipe' a habilidade que quer usar na batalha.
Muito útil para quem curte fazer game de estratégia.
Você pode configurar no script a número máximo de tecnicas que quer usar.



Código:

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    KGC_SkillCPSystem VX
#_/    Last update : 2008/02/17
#_/----------------------------------------------------------------------------
#  Tradução por Vingador
#==============================================================================
#  Customize
#==============================================================================

module KGC
module SkillCPSystem
  # Aqui defina a quantidade de Habilidades que podem ser equipadas
  MAX_SKILLS = 15
  # CP
  VOCAB_CP  = "CP"
  # Nome da barra de CP
  VOCAB_CP_A = "CP"
  # Mostrar Barra de CP no Status ?
  SHOW_STATUS_CP = true

  # Quanto vale CP para uma Habilidade ?
 
  DEFAULT_CP_COST = 1
  # CP Máximo
  CP_MAX = 25
  # CP Mínimo
  CP_MIN = 0
  # Defina aqui com quantos CP o heroi vai começar e quanto vai aumentar quando
  #passar de nível
  CP_CALC_EXP = "level * 3.5"

  # ? ??????????
  #  true ???????????????????????
  DISABLE_IN_BATTLETEST  = false
  # ? ?????????????
  SHOW_UNUSABLE_SKILL    = true
  # ? ?? CP 0 ?????????????????
  USABLE_COST_ZERO_SKILL = true
  # ? ???????????????????
  #  «???????» ????????
  PASSIVE_NEED_TO_SET    = true

  # ? CP ???????
  #  ??  : \C[n] ?????
  #  Color : ?????? ( Color.new(255, 128, 128) ?? )
  GAUGE_START_COLOR = 13
  # ? CP ???????
  GAUGE_END_COLOR  = 5

  # ? ???????????????????????
  #  ???????????????????????
  #  ?????????????«????????????» ?????????
  USE_MENU_SET_SKILL_COMMAND = true
  # ? ?????????????????????
  VOCAB_MENU_SET_SKILL      = "Technical "
  # ? ???????????
  BLANK_TEXT  = "-  Vazio  -"
  # ? ??????????
  RELEASE_TEXT = "( Nada )"
end
end

#???????????????????????????????????????

$imported = {} if $imported == nil
$imported["SkillCPSystem"] = true

module KGC::SkillCPSystem
  # ????
  module Regexp
    # ???
    module Skill
      # ?? CP
      CP_COST = //i
    end
  end
end

#???????????????????????????????????????

#==============================================================================
# ? KGC::Commands
#==============================================================================

module KGC::Commands
  module_function
  #--------------------------------------------------------------------------
  # ? ?? CP ???
  #    actor_id : ???? ID
  #    own_cp  : ?? CP
  #--------------------------------------------------------------------------
  def set_own_cp(actor_id, own_cp)
    $game_actors[actor_id].own_cp = own_cp
  end
  #--------------------------------------------------------------------------
  # ? ???????????
  #    actor_id : ???? ID
  #    value    : ?????
  #--------------------------------------------------------------------------
  def set_battle_skill_max(actor_id, value = -1)
    $game_actors[actor_id].battle_skill_max = value
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #    actor_id : ???? ID
  #    index    : ????
  #    skill_id : ??????? ID (nil ???)
  #--------------------------------------------------------------------------
  def set_battle_skill(actor_id, index, skill_id = nil)
    actor = $game_actors[actor_id]
    if skill_id.is_a?(Integer)
      # ??
      skill = $data_skills[skill_id]
      return unless actor.battle_skill_settable?(index, skill)  # ?????

      actor.set_battle_skill(index, skill)
      actor.restore_battle_skill
    else
      # ??
      actor.remove_battle_skill(index)
    end
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #    actor_id : ???? ID
  #    skill_id : ??????? ID
  #--------------------------------------------------------------------------
  def add_battle_skill(actor_id, skill_id)
    actor = $game_actors[actor_id]
    skill = $data_skills[skill_id]
    skills = actor.battle_skill_ids
    return if skills.include?(skill_id)  # ????
    return if actor.cp < skill.cp_cost  # CP ??

    actor.battle_skill_max.times { |i|
      # ????????
      if skills[i] == nil &&
        actor.set_battle_skill(i, skill)
        break
      end
    }
    actor.restore_battle_skill
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #    actor_id : ???? ID
  #--------------------------------------------------------------------------
  def clear_battle_skill(actor_id)
    $game_actors[actor_id].clear_battle_skill
  end
  #--------------------------------------------------------------------------
  # ? ????????????
  #    actor_index : ??????????
  #--------------------------------------------------------------------------
  def call_set_battle_skill(actor_index = 0)
    return if $game_temp.in_battle
    $game_temp.next_scene = :set_battle_skill
    $game_temp.next_scene_actor_index = actor_index
  end
end

class Game_Interpreter
  include KGC::Commands
end

#???????????????????????????????????????

#==============================================================================
# ¦ Vocab
#==============================================================================

module Vocab
  # CP
  def self.cp
    return KGC::SkillCPSystem::VOCAB_CP
  end

  # CP (?)
  def self.cp_a
    return KGC::SkillCPSystem::VOCAB_CP_A
  end

  # ?????
  def self.set_battle_skill
    return KGC::SkillCPSystem::VOCAB_MENU_SET_SKILL
  end
end

#???????????????????????????????????????

#==============================================================================
# ¦ RPG::Skill
#==============================================================================

class RPG::Skill < RPG::UsableItem
  #--------------------------------------------------------------------------
  # ? ???CP??????????
  #--------------------------------------------------------------------------
  def create_skill_cp_system_cache
    @__cp_cost = KGC::SkillCPSystem::DEFAULT_CP_COST

    self.note.split(/[\r\n]+/).each { |line|
      case line
      when KGC::SkillCPSystem::Regexp::Skill::CP_COST
        # ?? CP
        @__cp_cost = $1.to_i
      end
    }
  end
  #--------------------------------------------------------------------------
  # ? ?? CP
  #--------------------------------------------------------------------------
  def cp_cost
    create_skill_cp_system_cache if @__cp_cost == nil
    return @__cp_cost
  end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Game_Battler
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # ? ?????????????
  #    skill : ???
  #--------------------------------------------------------------------------
  def battle_skill_set?(skill)
    return true
  end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  attr_writer  :own_cp                  # ?? CP
  #--------------------------------------------------------------------------
  # ? ??????
  #    actor_id : ???? ID
  #--------------------------------------------------------------------------
  alias setup_KGC_SkillCPSystem setup
  def setup(actor_id)
    setup_KGC_SkillCPSystem(actor_id)

    @battle_skills = []
    @own_cp = 0
    @battle_skill_max = -1
  end
  #--------------------------------------------------------------------------
  # ? MaxCP ??
  #--------------------------------------------------------------------------
  def maxcp
    n = Integer(eval(KGC::SkillCPSystem::CP_CALC_EXP))
    return [[n + own_cp, cp_limit].min, KGC::SkillCPSystem::CP_MIN].max
  end
  #--------------------------------------------------------------------------
  # ? CP ??
  #--------------------------------------------------------------------------
  def cp
    n = 0
    battle_skills.compact.each { |skill| n += skill.cp_cost }
    return [maxcp - n, 0].max
  end
  #--------------------------------------------------------------------------
  # ? CP ????
  #--------------------------------------------------------------------------
  def cp_limit
    return KGC::SkillCPSystem::CP_MAX
  end
  #--------------------------------------------------------------------------
  # ? ?? CP ??
  #--------------------------------------------------------------------------
  def own_cp
    @own_cp = 0 if @own_cp == nil
    return @own_cp
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  alias skills_KGC_SkillCPSystem skills
  def skills
    result = skills_KGC_SkillCPSystem

    # ??????????
    if skill_cp_restrict?
      result.each_with_index { |skill, i|
        # ?? CP > 0 ???????
        if !KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL || skill.cp_cost > 0
          result[i] = nil
        end
        # ??????????
        if $imported["PassiveSkill"] && KGC::SkillCPSystem::PASSIVE_NEED_TO_SET
          result[i] = nil if skill.passive
        end
      }
      result.compact!
      # ????????
      result |= battle_skills
      result.sort! { |a, b| a.id <=> b.id }
    end

    return result
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def skill_cp_restrict?
    if $game_temp.in_battle
      # ???????????????????????
      return true unless $BTEST && KGC::SkillCPSystem::DISABLE_IN_BATTLETEST
    end

    return false
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def all_skills
    # ???????????
    last_in_battle = $game_temp.in_battle
    $game_temp.in_battle = false

    result = skills_KGC_SkillCPSystem
    if $imported["EquipLearnSkill"]
      result |= (equipment_skills | full_ap_skills)
      result.sort! { |a, b| a.id <=> b.id }
    end

    # ?????????
    $game_temp.in_battle = last_in_battle

    return result
  end
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  def battle_skill_max
    @battle_skill_max = -1 if @battle_skill_max == nil
    if @battle_skill_max < 0
      return KGC::SkillCPSystem::MAX_SKILLS
    else
      return @battle_skill_max
    end
  end
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  def battle_skill_max=(value)
    @battle_skill_max = value
    if @battle_skills == nil
      @battle_skills = []
    else
      @battle_skills = @battle_skills[0...value]
    end
    restore_passive_rev if $imported["PassiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ? ?????? ID ??
  #--------------------------------------------------------------------------
  def battle_skill_ids
    @battle_skills = [] if @battle_skills == nil
    return @battle_skills
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def battle_skills
    result = []
    battle_skill_ids.each { |i|
      next if i == nil          # ?????????
      result << $data_skills[i]
    }
    return result
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #    index : ??
  #    skill : ???
  #--------------------------------------------------------------------------
  def set_battle_skill(index, skill)
    return unless skill.is_a?(RPG::Skill)  # ?????
    return if cp < skill.cp_cost          # CP ??

    @battle_skills[index] = skill.id
    restore_passive_rev if $imported["PassiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #    index : ??
  #--------------------------------------------------------------------------
  def remove_battle_skill(index)
    @battle_skills[index] = nil
    restore_passive_rev if $imported["PassiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def clear_battle_skill
    @battle_skills = []
    restore_passive_rev if $imported["PassiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ? ?????????????
  #    index : ??
  #    skill : ???
  #--------------------------------------------------------------------------
  def battle_skill_settable?(index, skill)
    return false if battle_skill_max <= index  # ???
    return true  if skill == nil              # nil ?????? OK

    return false if battle_skill_ids.include?(skill.id)  # ?????

    curr_skill = battle_skills[index]
    offset = (curr_skill != nil ? curr_skill.cp_cost : 0)
    return false if self.cp < (skill.cp_cost - offset)  # CP ??

    return true
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def restore_battle_skill
    result = battle_skill_ids.clone
    usable_skills = all_skills

    result.each_with_index { |n, i|
      next if n == nil
      # ?????????
      if (usable_skills.find { |s| s.id == n }) == nil
        result[i] = nil
      end
    }
    @battle_skills = result
  end
  #--------------------------------------------------------------------------
  # ? ????? (?????????)
  #    equip_type : ???? (0..4)
  #    item      : ?? or ?? (nil ??????)
  #    test      : ?????? (???????????????????)
  #--------------------------------------------------------------------------
  alias change_equip_KGC_SkillCPSystem change_equip
  def change_equip(equip_type, item, test = false)
    change_equip_KGC_SkillCPSystem(equip_type, item, test)

    unless test
      restore_battle_skill
      restore_passive_rev if $imported["PassiveSkill"]
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #    item : ?????? or ??
  #    ??/???????????????????????
  #--------------------------------------------------------------------------
  alias discard_equip_KGC_SkillCPSystem discard_equip
  def discard_equip(item)
    discard_equip_KGC_SkillCPSystem(item)

    restore_battle_skill
    restore_passive_rev if $imported["PassiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #    exp  : ??????
  #    show : ???????????
  #--------------------------------------------------------------------------
  alias change_exp_KGC_SkillCPSystem change_exp
  def change_exp(exp, show)
    # ????????????????????????????
    last_in_battle = $game_temp.in_battle
    $game_temp.in_battle = false

    change_exp_KGC_SkillCPSystem(exp, show)

    $game_temp.in_battle = last_in_battle
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #    skill_id : ??? ID
  #--------------------------------------------------------------------------
  alias forget_skill_KGC_SkillCPSystem forget_skill
  def forget_skill(skill_id)
    # ?????????????????
    battle_skill_ids.each_with_index { |s, i|
      remove_battle_skill(i) if s == skill_id
    }

    forget_skill_KGC_SkillCPSystem(skill_id)
  end
  #--------------------------------------------------------------------------
  # ? ?????????????
  #    skill : ???
  #--------------------------------------------------------------------------
  def battle_skill_set?(skill)
    return false unless skill.is_a?(RPG::Skill)  # ?????

    return battle_skill_ids.include?(skill.id)
  end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Window_Base
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ? CP ???????
  #    actor : ????
  #--------------------------------------------------------------------------
  def cp_color(actor)
    return knockout_color if actor.maxcp > 0 && actor.cp == 0
    return normal_color
  end
  #--------------------------------------------------------------------------
  # ? CP ????? 1 ???
  #--------------------------------------------------------------------------
  def cp_gauge_color1
    color = KGC::SkillCPSystem::GAUGE_START_COLOR
    return (color.is_a?(Integer) ? text_color(color) : color)
  end
  #--------------------------------------------------------------------------
  # ? CP ????? 2 ???
  #--------------------------------------------------------------------------
  def cp_gauge_color2
    color = KGC::SkillCPSystem::GAUGE_END_COLOR
    return (color.is_a?(Integer) ? text_color(color) : color)
  end
  #--------------------------------------------------------------------------
  # ? CP ???
  #    actor : ????
  #    x    : ??? X ??
  #    y    : ??? Y ??
  #    width : ?
  #--------------------------------------------------------------------------
  def draw_actor_cp(actor, x, y, width = 120)
    draw_actor_cp_gauge(actor, x, y, width)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 30, WLH, Vocab::cp_a)
    self.contents.font.color = cp_color(actor)
    xr = x + width
    if width < 120
      self.contents.draw_text(xr - 40, y, 40, WLH, actor.cp, 2)
    else
      self.contents.draw_text(xr - 90, y, 40, WLH, actor.cp, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
      self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxcp, 2)
    end
    self.contents.font.color = normal_color
  end
  #--------------------------------------------------------------------------
  # ? CP ??????
  #    actor : ????
  #    x    : ??? X ??
  #    y    : ??? Y ??
  #    width : ?
  #--------------------------------------------------------------------------
  def draw_actor_cp_gauge(actor, x, y, width = 120)
    gw = width * actor.cp / [actor.maxcp, 1].max
    gc1 = cp_gauge_color1
    gc2 = cp_gauge_color2
    self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
    self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Window_Command
#==============================================================================

class Window_Command < Window_Selectable
  unless method_defined?(:add_command)
  #--------------------------------------------------------------------------
  # ? ???????
  #    ?????????
  #--------------------------------------------------------------------------
  def add_command(command)
    @commands << command
    @item_max = @commands.size
    item_index = @item_max - 1
    refresh_command
    draw_item(item_index)
    return item_index
  end
  #--------------------------------------------------------------------------
  # ? ???????????
  #--------------------------------------------------------------------------
  def refresh_command
    buf = self.contents.clone
    self.height = [self.height, row_max * WLH + 32].max
    create_contents
    self.contents.blt(0, 0, buf, buf.rect)
    buf.dispose
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def insert_command(index, command)
    @commands.insert(index, command)
    @item_max = @commands.size
    refresh_command
    refresh
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def remove_command(command)
    @commands.delete(command)
    @item_max = @commands.size
    refresh
  end
  end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Window_Status
#==============================================================================

if KGC::SkillCPSystem::SHOW_STATUS_CP
class Window_Status < Window_Base
  #--------------------------------------------------------------------------
  # ? ???????
  #    x : ??? X ??
  #    y : ??? Y ??
  #--------------------------------------------------------------------------
  alias draw_basic_info_KGC_SkillCPSystem draw_basic_info
  def draw_basic_info(x, y)
    draw_basic_info_KGC_SkillCPSystem(x, y)

    draw_actor_cp(@actor, x, y + WLH * 4)
  end
end
end

#???????????????????????????????????????

#==============================================================================
# ? Window_BattleSkillStatus
#------------------------------------------------------------------------------
#  ?????????????????????????????????
#==============================================================================

class Window_BattleSkillStatus < Window_Base
  #--------------------------------------------------------------------------
  # ? ?????????
  #    x    : ?????? X ??
  #    y    : ?????? Y ??
  #    actor : ????
  #--------------------------------------------------------------------------
  def initialize(x, y, actor)
    super(x, y, Graphics.width, WLH + 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_name(@actor, 4, 0)
    draw_actor_level(@actor, 140, 0)
    draw_actor_cp(@actor, 240, 0)
  end
end

#???????????????????????????????????????

#==============================================================================
# ? Window_BattleSkillSlot
#------------------------------------------------------------------------------
#  ??????????????????????????????????
#==============================================================================

class Window_BattleSkillSlot < Window_Selectable
  #--------------------------------------------------------------------------
  # ? ?????????
  #    x      : ?????? X ??
  #    y      : ?????? Y ??
  #    width  : ???????
  #    height : ????????
  #    actor  : ????
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, actor)
    super(x, y, width, height)
    @actor = actor
    self.index = 0
    self.active = false
    refresh
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    skill_ids = @actor.battle_skill_ids
    @actor.battle_skill_max.times { |i|
      if skill_ids[i] != nil
        @data << $data_skills[skill_ids[i]]
      else
        @data << nil
      end
    }
    @item_max = @data.size
    create_contents
    @item_max.times { |i| draw_item(i) }
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #    index : ????
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    skill = @data[index]
    if skill != nil
      rect.width -= 4
      draw_item_name(skill, rect.x, rect.y)
      self.contents.draw_text(rect, skill.cp_cost, 2)
    else
      self.contents.draw_text(rect, KGC::SkillCPSystem::BLANK_TEXT, 1)
    end
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def update
    super
    return unless self.active

    if Input.repeat?(Input::RIGHT)
      cursor_pagedown
    elsif Input.repeat?(Input::LEFT)
      cursor_pageup
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(skill == nil ? "" : skill.description)
  end
end

#???????????????????????????????????????

#==============================================================================
# ? Window_BattleSkillList
#------------------------------------------------------------------------------
#  ???????????????????????????????????
#==============================================================================

class Window_BattleSkillList < Window_Selectable
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  attr_accessor :slot_index              # ??????
  #--------------------------------------------------------------------------
  # ? ?????????
  #    x      : ?????? X ??
  #    y      : ?????? Y ??
  #    width  : ???????
  #    height : ????????
  #    actor  : ????
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, actor)
    super(x, y, width, height)
    @actor = actor
    @slot_index = 0
    self.index = 0
    self.active = false
    refresh
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    @data = [nil]
    # ?????????????
    @actor.all_skills.each { |skill|
      @data.push(skill) if selectable?(skill)
    }

    @item_max = @data.size
    create_contents
    @item_max.times { |i| draw_item(i) }
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #    skill : ???
  #--------------------------------------------------------------------------
  def selectable?(skill)
    return false if skill == nil

    # ?? CP 0 ???????????
    if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0
      return false
    end
    # ??????????OK
    return true if skill.battle_ok?
    # ??????????????
    if KGC::SkillCPSystem::SHOW_UNUSABLE_SKILL && skill.occasion == 3
      return true
    end

    return false
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #    index : ????
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    skill = @data[index]
    if skill != nil
      rect.width -= 4
      enabled = @actor.battle_skill_settable?(@slot_index, skill)
      draw_item_name(skill, rect.x, rect.y, enabled)
      self.contents.draw_text(rect, skill.cp_cost, 2)
    else
      self.contents.draw_text(rect, KGC::SkillCPSystem::RELEASE_TEXT, 1)
    end
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def update
    super
    return unless self.active

    if Input.repeat?(Input::RIGHT)
      cursor_pagedown
    elsif Input.repeat?(Input::LEFT)
      cursor_pageup
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(skill == nil ? "" : skill.description)
  end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Scene_Map
#==============================================================================

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  alias update_scene_change_KGC_SkillCPSystem update_scene_change
  def update_scene_change
    return if $game_player.moving?    # ??????????

    if $game_temp.next_scene == :set_battle_skill
      call_set_battle_skill
      return
    end

    update_scene_change_KGC_SkillCPSystem
  end
  #--------------------------------------------------------------------------
  # ? ?????????????
  #--------------------------------------------------------------------------
  def call_set_battle_skill
    $game_temp.next_scene = nil
    $scene = Scene_SetBattleSkill.new(
      $game_temp.next_scene_actor_index,
      0,
      Scene_SetBattleSkill::HOST_MAP)
  end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Scene_Menu
#==============================================================================

class Scene_Menu < Scene_Base
  if KGC::SkillCPSystem::USE_MENU_SET_SKILL_COMMAND
  #--------------------------------------------------------------------------
  # ? ????????????
  #--------------------------------------------------------------------------
  alias create_command_window_KGC_SkillCPSystem create_command_window
  def create_command_window
    create_command_window_KGC_SkillCPSystem

    return if $imported["CustomMenuCommand"]

    @__command_set_battle_skill_index =
      @command_window.add_command(Vocab.set_battle_skill)
    if @command_window.oy > 0
      @command_window.oy -= Window_Base::WLH
    end
    @command_window.index = @menu_index
  end
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  alias update_command_selection_KGC_SkillCPSystem update_command_selection
  def update_command_selection
    call_set_battle_skill_flag = false
    if Input.trigger?(Input::C)
      case @command_window.index
      when @__command_set_battle_skill_index  # ?????
        call_set_battle_skill_flag = true
      end
    end

    # ??????????
    if call_set_battle_skill_flag
      if $game_party.members.size == 0
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      start_actor_selection
      return
    end

    update_command_selection_KGC_SkillCPSystem
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  alias update_actor_selection_KGC_SkillCPSystem update_actor_selection
  def update_actor_selection
    if Input.trigger?(Input::C)
      $game_party.last_actor_index = @status_window.index
      Sound.play_decision
      case @command_window.index
      when @__command_set_battle_skill_index  # ?????
        $scene = Scene_SetBattleSkill.new(
          @status_window.index,
          @__command_set_battle_skill_index,
          Scene_SetBattleSkill::HOST_MENU)
        return
      end
    end

    update_actor_selection_KGC_SkillCPSystem
  end
end

#???????????????????????????????????????

#==============================================================================
# ? Scene_SetBattleSkill
#------------------------------------------------------------------------------
#  ?????????????????????
#==============================================================================

class Scene_SetBattleSkill < Scene_Base
  #--------------------------------------------------------------------------
  # ? ??
  #--------------------------------------------------------------------------
  HOST_MENU  = 0  # ????? : ????
  HOST_MAP    = 1  # ????? : ???
  #--------------------------------------------------------------------------
  # ? ?????????
  #    actor_index : ??????????
  #    menu_index  : ?????????????
  #    host_scene  : ????? (0..????  1..???)
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0, menu_index = 0, host_scene = HOST_MENU)
    @actor_index = actor_index
    @menu_index = menu_index
    @host_scene = host_scene
  end
  #--------------------------------------------------------------------------
  # ? ????
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background

    @actor = $game_party.members[@actor_index]
    create_windows
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def create_windows
    @help_window = Window_Help.new
    if $imported["HelpExtension"]
      @help_window.row_max = KGC::HelpExtension::ROW_MAX
    end

    dy = @help_window.height
    @status_window = Window_BattleSkillStatus.new(0, dy, @actor)

    dy += @status_window.height
    @slot_window = Window_BattleSkillSlot.new(
      0,
      dy,
      Graphics.width / 2,
      Graphics.height - dy,
      @actor)
    @slot_window.help_window = @help_window
    @slot_window.active = true

    @list_window = Window_BattleSkillList.new(
      Graphics.width - @slot_window.width,
      dy,
      Graphics.width - @slot_window.width,
      Graphics.height - dy,
      @actor)
    @list_window.help_window = @help_window
  end
  #--------------------------------------------------------------------------
  # ? ????
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @help_window.dispose
    @status_window.dispose
    @slot_window.dispose
    @list_window.dispose
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def return_scene
    case @host_scene
    when HOST_MENU
      $scene = Scene_Menu.new(@menu_index)
    when HOST_MAP
      $scene = Scene_Map.new
    end
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    update_window
    if @slot_window.active
      update_slot
    elsif @list_window.active
      update_list
    end
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def update_window
    @help_window.update
    @status_window.update
    @slot_window.update
    @list_window.update
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def refresh_window
    @status_window.refresh
    @slot_window.refresh
    @list_window.refresh
  end
  #--------------------------------------------------------------------------
  # ? ??????????????
  #--------------------------------------------------------------------------
  def next_actor
    @actor_index += 1
    @actor_index %= $game_party.members.size
    $scene = Scene_SetBattleSkill.new(@actor_index, @menu_index, @host_scene)
  end
  #--------------------------------------------------------------------------
  # ? ??????????????
  #--------------------------------------------------------------------------
  def prev_actor
    @actor_index += $game_party.members.size - 1
    @actor_index %= $game_party.members.size
    $scene = Scene_SetBattleSkill.new(@actor_index, @menu_index, @host_scene)
  end
  #--------------------------------------------------------------------------
  # ? ?????? (??????????????????)
  #--------------------------------------------------------------------------
  def update_slot
    # ???????????
    if @last_slot_index != @slot_window.index
      @list_window.slot_index = @slot_window.index
      @list_window.refresh
      @last_slot_index = @slot_window.index
    end

    if Input.trigger?(Input::A)
      Sound.play_decision
      # ????????????
      @actor.remove_battle_skill(@slot_window.index)
      refresh_window
    elsif Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      # ?????????????
      @slot_window.active = false
      @list_window.active = true
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      next_actor
    elsif Input.trigger?(Input::L)
      Sound.play_cursor
      prev_actor
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????? (?????????????????)
  #--------------------------------------------------------------------------
  def update_list
    if Input.trigger?(Input::B)
      Sound.play_cancel
      # ??????????????
      @slot_window.active = true
      @list_window.active = false
    elsif Input.trigger?(Input::C)
      skill = @list_window.skill
      # ?????????
      unless @actor.battle_skill_settable?(@slot_window.index, skill)
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      set_skill(@slot_window.index, skill)
      # ??????????????
      @slot_window.active = true
      @list_window.active = false
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #    index : ??????
  #    skill : ???????
  #--------------------------------------------------------------------------
  def set_skill(index, skill)
    @actor.remove_battle_skill(index)
    if skill != nil
      @actor.set_battle_skill(index, skill)
    end
    refresh_window
  end
end
Vingador
Vingador
Iniciante
Iniciante

Número de Mensagens : 16
Idade : 35
Localização : Araguari
Premios : <br>Sistema para uso e seleção de Habilidades Medal_gold_3: 0 Sistema para uso e seleção de Habilidades Medal_silver_3: 0 Sistema para uso e seleção de Habilidades Medal_bronze_3: 0
Reputação : 13
Pontos : 90
Data de inscrição : 04/01/2010

Ficha do personagem
Raça: Lich
Nível Maker: Mestre
Mensagem Pessoal: Me dê as suas armas mágicas!!!

http://www.orkut.com.br/Main#Profile?uid=4395857722134662547

Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

 
Permissões neste sub-fórum
Não podes responder a tópicos