Brasil G4mes
Registre-se para ter acesso total à todas as seções do fórum!
Jogue, brinque e o mais importante, divirta-se!

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

Brasil G4mes
Registre-se para ter acesso total à todas as seções do fórum!
Jogue, brinque e o mais importante, divirta-se!
Brasil G4mes
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

KGC Upgrade Point

Ir para baixo

KGC Upgrade Point Empty KGC Upgrade Point

Mensagem por Convidad Dom Nov 08, 2009 12:30 pm

Intro
Upgrade nos Status do personagem por pontos ganhos após Lvl Up.

Instrução

Cole acima de Main.Simples!

Código:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ? ????????? - KGC_DistributeParameter ? VX ?
#_/    ? Last update : 2008/02/23 ?
#_/    Criador:KGC Softwares
#_/    Traduzido por:NaRuToMaKer
#_/----------------------------------------------------------------------------
#_/  Cria uma opção no menu de upgrade de atributos
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# Customização
#==============================================================================

module KGC
module DistributeParameter
 
#~  Defina do seguinte modo
#~  :maxhp => [1, 30, 50]
#~  :maxhp => [RP que consome,quantidade do parametro que aumenta,maximo de pontos]
 
  GAIN_PARAMETER = {
    :maxhp => [1, 30, 50],  # MaxHP
    :maxmp => [1,  3, 50],  # MaxMP
    :atk  => [1,  2, 50],  # ???
    :def  => [1,  2, 50],  # ???
    :spi  => [1,  2, 50],  # ???
    :agi  => [1,  2, 50],  # ???
    :hit  => [3,  1, 20],  # ???
    :eva  => [3,  1, 20],  # ???
    :cri  => [3,  1, 20],  # ???????
  }  # ? ?? } ????????

  # ? RP (Reinforce Point) ???
  VOCAB_RP  = "RP"
  # ? RP ??? (?)
  VOCAB_RP_A = "RP"

#~  Pontos para distribuir
#~  ao aumentar de level
  GAIN_RP_EXP = "50"
  #  ????? 10% + 1 ???????
  # GAIN_RP_EXP = "level / 10 + 1"


#~  Vocabulario
  VOCAB_PARAM = {
    :hit => "Hit",        # ???
    :eva => "Evasão",        # ???
    :cri => "Critico",  # ???????
  } 
  DISTRIBUTE_SCENE_CAPTION = ""

#~  Cores para a barrinha
#~ 
#~  Quando estiver enchendo
  GAUGE_START_COLOR = 28
#~  Quando estiver cheia
  GAUGE_END_COLOR  = 29

#~  Vai pararecer no menu?
  USE_MENU_DISTRIBUTE_PARAMETER_COMMAND = true
  # ? ?????????????????????????
  VOCAB_MENU_DISTRIBUTE_PARAMETER      = "Upgrade"

#~  Pode retirar pontos?
  ENABLE_REVERSE_DISTRIBUTE = true
end
end

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

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

module KGC::DistributeParameter
  # ???????????
  PARAMS = [:maxhp, :maxmp, :atk, :def, :spi, :agi, :hit, :eva, :cri]
end

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

#==============================================================================
# ? Vocab
#==============================================================================

module Vocab
  # ???
  def self.hit
    return KGC::DistributeParameter::VOCAB_PARAM[:hit]
  end

  # ???
  def self.eva
    return KGC::DistributeParameter::VOCAB_PARAM[:eva]
  end

  # ???????
  def self.cri
    return KGC::DistributeParameter::VOCAB_PARAM[:cri]
  end

  # RP
  def self.rp
    return KGC::DistributeParameter::VOCAB_RP
  end

  # RP (?)
  def self.rp_a
    return KGC::DistributeParameter::VOCAB_RP_A
  end

  # ?????????
  def self.distribute_parameter
    return KGC::DistributeParameter::VOCAB_MENU_DISTRIBUTE_PARAMETER
  end
end

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

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

module KGC::Commands
  module_function
  #--------------------------------------------------------------------------
  # ? ???????????????????
  #--------------------------------------------------------------------------
  def check_distribution_values
    (1...$data_actors.size).each { |i|
      $game_actors[i].check_distribution_values
    }
  end
  #--------------------------------------------------------------------------
  # ? RP ???
  #    actor_id : ???? ID
  #    value    : ???
  #--------------------------------------------------------------------------
  def gain_rp(actor_id, value)
    actor = $game_actors[actor_id]
    return if actor == nil
    actor.gain_rp(value)
  end
  #--------------------------------------------------------------------------
  # ? ????????????????
  #    actor_index : ??????????
  #--------------------------------------------------------------------------
  def call_distribute_parameter(actor_index = 0)
    return if $game_temp.in_battle
    $game_temp.next_scene = :distribute_parameter
    $game_temp.next_scene_actor_index = actor_index
  end
end

class Game_Interpreter
  include KGC::Commands
end

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

#==============================================================================
# ? Game_Battler
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # ? ?????????????
  #--------------------------------------------------------------------------
  alias clear_extra_values_KGC_DistributeParameter clear_extra_values
  def clear_extra_values
    clear_extra_values_KGC_DistributeParameter

    clear_distribution_values
  end
  #--------------------------------------------------------------------------
  # ? ??????????????????
  #--------------------------------------------------------------------------
  def clear_distribution_values
    @distributed_count = {}
    KGC::DistributeParameter::PARAMS.each { |param|
      @distributed_count[param] = 0
    }
  end
  #--------------------------------------------------------------------------
  # ? ???????????????????
  #--------------------------------------------------------------------------
  def check_distribution_values
    last_distributed_count = @distributed_count

    clear_distribution_values

    @distributed_count = last_distributed_count if last_distributed_count != nil
  end
end

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

#==============================================================================
# ? Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ? ??????
  #    actor_id : ???? ID
  #--------------------------------------------------------------------------
  alias setup_KGC_DistributeParameter setup
  def setup(actor_id)
    setup_KGC_DistributeParameter(actor_id)

    @rp = calc_init_rp
  end
  #--------------------------------------------------------------------------
  # ? ?????????????
  #    param : ?????? Symbol
  #--------------------------------------------------------------------------
  def distributed_param(param)
    n = KGC::DistributeParameter::GAIN_PARAMETER[param][1]
    return n * distributed_count(param)
  end
  #--------------------------------------------------------------------------
  # ? ?? MaxHP ???
  #--------------------------------------------------------------------------
  alias base_maxhp_KGC_DistributeParameter base_maxhp
  def base_maxhp
    n = base_maxhp_KGC_DistributeParameter + distributed_param(:maxhp)
    return n
  end
  #--------------------------------------------------------------------------
  # ? ?? MaxMP ???
  #--------------------------------------------------------------------------
  alias base_maxmp_KGC_DistributeParameter base_maxmp
  def base_maxmp
    n = base_maxmp_KGC_DistributeParameter + distributed_param(:maxmp)
    return n
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  alias base_atk_KGC_DistributeParameter base_atk
  def base_atk
    n = base_atk_KGC_DistributeParameter + distributed_param(:atk)
    return n
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  alias base_def_KGC_DistributeParameter base_def
  def base_def
    n = base_def_KGC_DistributeParameter + distributed_param(:def)
    return n
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  alias base_spi_KGC_DistributeParameter base_spi
  def base_spi
    n = base_spi_KGC_DistributeParameter + distributed_param(:spi)
    return n
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  alias base_agi_KGC_DistributeParameter base_agi
  def base_agi
    n = base_agi_KGC_DistributeParameter + distributed_param(:agi)
    return n
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  alias hit_KGC_DistributeParameter hit
  def hit
    n = hit_KGC_DistributeParameter + distributed_param(:hit)
    return n
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  alias eva_KGC_DistributeParameter eva
  def eva
    n = eva_KGC_DistributeParameter + distributed_param(:eva)
    return n
  end
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  alias cri_KGC_DistributeParameter cri
  def cri
    n = cri_KGC_DistributeParameter + distributed_param(:cri)
    return n
  end
  #--------------------------------------------------------------------------
  # ? RP ???
  #--------------------------------------------------------------------------
  def rp
    @rp = calc_init_rp if @rp == nil
    return @rp
  end
  #--------------------------------------------------------------------------
  # ? RP ??????
  #--------------------------------------------------------------------------
  def calc_init_rp
    n = 0
    rp_exp = KGC::DistributeParameter::GAIN_RP_EXP.gsub(/level/) { "i" }
    (1...level).each { |i| n += [Integer(eval(rp_exp)), 0].max }
    return n
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #    param : ?????????? (Symbol)
  #--------------------------------------------------------------------------
  def distributed_count(param)
    clear_distribution_values if @distributed_count == nil
    @distributed_count[param] = 0 if @distributed_count[param] == nil
    return @distributed_count[param]
  end
  #--------------------------------------------------------------------------
  # ? RP ???
  #    value : ???
  #--------------------------------------------------------------------------
  def gain_rp(value)
    @rp = [self.rp + value, 0].max
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #    param : ?????????? (Symbol)
  #    value : ???
  #--------------------------------------------------------------------------
  def gain_distributed_count(param, value = 1)
    n = distributed_count(param)
    @distributed_count[param] += value if n.is_a?(Integer)
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  alias level_up_KGC_DistributeParameter level_up
  def level_up
    level_up_KGC_DistributeParameter

    gain_level_up_rp
  end
  #--------------------------------------------------------------------------
  # ? ????????? RP ???
  #--------------------------------------------------------------------------
  def gain_level_up_rp
    n = [Integer(eval(KGC::DistributeParameter::GAIN_RP_EXP)), 0].max
    gain_rp(n)
  end
  #--------------------------------------------------------------------------
  # ? RP ?????????????
  #    param  : ?????????? (Symbol)
  #    reverse : ??????? true
  #--------------------------------------------------------------------------
  def rp_growth_effect(param, reverse = false)
    gain = KGC::DistributeParameter::GAIN_PARAMETER[param]
    return if gain == nil  # ????????

    if reverse
      return if distributed_count(param) == 0  # ?????
    else
      return unless can_distribute?(param)
    end

    gain_rp(gain[0] * (reverse ? 1 : -1))
    gain_distributed_count(param, reverse ? -1 : 1)
  end
  #--------------------------------------------------------------------------
  # ? ?????????????
  #    param  : ?????????? (Symbol)
  #--------------------------------------------------------------------------
  def can_distribute?(param)
    gain = KGC::DistributeParameter::GAIN_PARAMETER[param]
    return false if gain == nil                          # ????????
    return false if self.rp < gain[0]                    # RP ??
    return false if gain[2] <= distributed_count(param)  # ????

    return true
  end
end

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

#==============================================================================
# ? Window_Base
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ? RP ???????
  #    actor : ????
  #--------------------------------------------------------------------------
  def rp_color(actor)
    return (actor.rp == 0 ? knockout_color : normal_color)
  end
  #--------------------------------------------------------------------------
  # ? ????????? 1 ???
  #--------------------------------------------------------------------------
  def distribute_gauge_color1
    color = KGC::DistributeParameter::GAUGE_START_COLOR
    return (color.is_a?(Integer) ? text_color(color) : color)
  end
  #--------------------------------------------------------------------------
  # ? ????????? 2 ???
  #--------------------------------------------------------------------------
  def distribute_gauge_color2
    color = KGC::DistributeParameter::GAUGE_END_COLOR
    return (color.is_a?(Integer) ? text_color(color) : color)
  end
  #--------------------------------------------------------------------------
  # ? RP ???
  #    actor : ????
  #    x    : ??? X ??
  #    y    : ??? Y ??
  #    width : ?
  #--------------------------------------------------------------------------
  def draw_actor_rp(actor, x, y, width = 120)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 40, WLH, Vocab::rp)
    self.contents.font.color = rp_color(actor)
    xr = x + width
    self.contents.draw_text(xr - 40, y, 40, WLH, actor.rp, 2)
    self.contents.font.color = normal_color
  end
  #--------------------------------------------------------------------------
  # ? ??????????
  #    actor : ????
  #    param : ?????
  #    x    : ??? X ??
  #    y    : ??? Y ??
  #    width : ?
  #--------------------------------------------------------------------------
  def draw_actor_distribute_gauge(actor, param, x, y, width = 120)
    gain = KGC::DistributeParameter::GAIN_PARAMETER[param]
    return if gain == nil
    gw = width * actor.distributed_count(param) / [gain[2], 1].max
    gc1 = distribute_gauge_color1
    gc2 = distribute_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_DistributeParameterActor
#------------------------------------------------------------------------------
#  ????????????????????????????
#==============================================================================

class Window_DistributeParameterActor < 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_rp(@actor, 240, 0, 80)
  end
end

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

#==============================================================================
# ? Window_DistributeParameterList
#------------------------------------------------------------------------------
#  ???????????????????????????????
#==============================================================================

class Window_DistributeParameterList < Window_Selectable
  #--------------------------------------------------------------------------
  # ? ?????????
  #    actor : ????
  #--------------------------------------------------------------------------
  def initialize(actor)
    off_h = (WLH + 32) * 2
    super(0, off_h, Graphics.width / 2 + 80, Graphics.height - off_h)
    @actor = actor
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ? ?????????? Symbol ???
  #--------------------------------------------------------------------------
  def parameter_symbol
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    gain_params = KGC::DistributeParameter::GAIN_PARAMETER
    KGC::DistributeParameter::PARAMS.each { |param|
      next if gain_params[param] == nil
      @data << param
    }
    @item_max = @data.size
    create_contents
    draw_caption
    @item_max.times { |i| draw_item(i, @actor.can_distribute?(@data[i])) }
  end
  #--------------------------------------------------------------------------
  # ? ????????????
  #    index : ????
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = super(index)
    rect.y += WLH
    return rect
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def draw_caption
    self.contents.font.color = system_color
    self.contents.draw_text(  4, 0, 96, WLH, "Parametro")
    self.contents.draw_text(120, 0, 40, WLH, Vocab.rp, 2)
    self.contents.draw_text(170, 0, 60, WLH, "Aumenta", 2)
    self.contents.draw_text(240, 0, 80, WLH, "Maximo", 2)
    self.contents.font.color = normal_color
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #    index  : ????
  #    enabled : ?????
  #--------------------------------------------------------------------------
  def draw_item(index, enabled = true)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index]
    if item != nil
      draw_parameter(rect.x, rect.y, @data[index], enabled)
    end
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #    x      : ??? X ??
  #    y      : ??? Y ??
  #    type    : ??????
  #    enabled : ?????
  #--------------------------------------------------------------------------
  def draw_parameter(x, y, type, enabled)
    case type
    when :maxhp
      name  = Vocab.hp
    when :maxmp
      name  = Vocab.mp
    when :atk
      name  = Vocab.atk
    when :def
      name  = Vocab.def
    when :spi
      name  = Vocab.spi
    when :agi
      name  = Vocab.agi
    when :hit
      name  = Vocab.hit
    when :eva
      name  = Vocab.eva
    when :cri
      name  = Vocab.cri
    else
      return
    end

    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(x + 4, y, 96, WLH, name)

    gain = KGC::DistributeParameter::GAIN_PARAMETER[type]
    self.contents.draw_text(x + 120, y, 40, WLH, gain[0], 2)
    value = sprintf("%+d", gain[1])
    self.contents.draw_text(x + 190, y, 40, WLH, value, 2)
    value = sprintf("%3d/%3d", @actor.distributed_count(type), gain[2])
    self.contents.draw_text(x + 236, y, 80, WLH, value, 2)
    self.contents.font.color = normal_color
  end
end

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

#==============================================================================
# ? Window_DistributeParameterStatus
#------------------------------------------------------------------------------
#  ???????????????????????????????
#==============================================================================

class Window_DistributeParameterStatus < Window_Base
  #--------------------------------------------------------------------------
  # ? ?????????
  #    actor : ????
  #--------------------------------------------------------------------------
  def initialize(actor)
    dx = Graphics.width / 2 + 80
    off_h = (WLH + 32) * 2
    super(dx, off_h, Graphics.width - dx, Graphics.height - off_h)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, width - 32, WLH, "Parametro", 1)
    self.contents.font.color = normal_color
    dy = WLH
    gain_params = KGC::DistributeParameter::GAIN_PARAMETER
    KGC::DistributeParameter::PARAMS.each { |param|
      next if gain_params[param] == nil
      draw_parameter(0, dy, param)
      dy += WLH
    }
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #    x    : ??? X ??
  #    y    : ??? Y ??
  #    type : ??????
  #--------------------------------------------------------------------------
  def draw_parameter(x, y, type)
    case type
    when :maxhp
      name  = Vocab.hp
      value = @actor.maxhp
    when :maxmp
      name  = Vocab.mp
      value = @actor.maxmp
    when :atk
      name  = Vocab.atk
      value = @actor.atk
    when :def
      name  = Vocab.def
      value = @actor.def
    when :spi
      name  = Vocab.spi
      value = @actor.spi
    when :agi
      name  = Vocab.agi
      value = @actor.agi
    when :hit
      name  = Vocab.hit
      value = @actor.hit
    when :eva
      name  = Vocab.eva
      value = @actor.eva
    when :cri
      name  = Vocab.cri
      value = @actor.cri
    else
      return
    end
    draw_actor_distribute_gauge(@actor, type, x + 106, y, 48)
    self.contents.font.color = system_color
    self.contents.draw_text(x + 4, y, 96, WLH, name)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 106, y, 48, WLH, value, 2)
  end
end

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

#==============================================================================
# ? Scene_Map
#==============================================================================

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

    if $game_temp.next_scene == :distribute_parameter
      call_distribute_parameter
      return
    end

    update_scene_change_KGC_DistributeParameter
  end
  #--------------------------------------------------------------------------
  # ? ?????????????????
  #--------------------------------------------------------------------------
  def call_distribute_parameter
    $game_temp.next_scene = nil
    $scene = Scene_DistributeParameter.new(
      $game_temp.next_scene_actor_index,
      0,
      Scene_DistributeParameter::HOST_MAP)
  end
end

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

#==============================================================================
# ? Scene_Menu
#==============================================================================

class Scene_Menu < Scene_Base
  if KGC::DistributeParameter::USE_MENU_DISTRIBUTE_PARAMETER_COMMAND
  #--------------------------------------------------------------------------
  # ? ????????????
  #--------------------------------------------------------------------------
  alias create_command_window_KGC_DistributeParameter create_command_window
  def create_command_window
    create_command_window_KGC_DistributeParameter

    return if $imported["CustomMenuCommand"]

    @__command_distribute_parameter_index =
      @command_window.add_command(Vocab.distribute_parameter)
    if @command_window.oy > 0
      @command_window.oy -= Window_Base::WLH
    end
    @command_window.index = @menu_index
  end
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  alias update_command_selection_KGC_DistributeParameter update_command_selection
  def update_command_selection
    call_distribute_parameter_flag = false
    if Input.trigger?(Input::C)
      case @command_window.index
      when @__command_distribute_parameter_index  # ?????????
        call_distribute_parameter_flag = true
      end
    end

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

    update_command_selection_KGC_DistributeParameter
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  alias update_actor_selection_KGC_DistributeParameter 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_distribute_parameter_index  # ?????????
        $scene = Scene_DistributeParameter.new(
          @status_window.index,
          @__command_distribute_parameter_index,
          Scene_DistributeParameter::HOST_MENU)
        return
      end
    end

    update_actor_selection_KGC_DistributeParameter
  end
end

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

#==============================================================================
# ? Scene_DistributeParameter
#------------------------------------------------------------------------------
#  ???????????????????????
#==============================================================================

class Scene_DistributeParameter < 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
    @help_window.set_text(KGC::DistributeParameter::DISTRIBUTE_SCENE_CAPTION)
    dy = @help_window.height
    @actor_window = Window_DistributeParameterActor.new(0, dy, @actor)
    @parameter_window = Window_DistributeParameterList.new(@actor)
    @status_window = Window_DistributeParameterStatus.new(@actor)
  end
  #--------------------------------------------------------------------------
  # ? ????
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @help_window.dispose
    @actor_window.dispose
    @parameter_window.dispose
    @status_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 @parameter_window.active
      update_parameter_list
    end
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def update_window
    @help_window.update
    @actor_window.update
    @parameter_window.update
    @status_window.update
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def refresh_window
    @actor_window.refresh
    @parameter_window.refresh
    @status_window.refresh
    Graphics.frame_reset
  end
  #--------------------------------------------------------------------------
  # ? ??????????????
  #--------------------------------------------------------------------------
  def next_actor
    @actor_index += 1
    @actor_index %= $game_party.members.size
    $scene = Scene_DistributeParameter.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_DistributeParameter.new(@actor_index,
      @menu_index, @host_scene)
  end
  #--------------------------------------------------------------------------
  # ? ?????? (???????????????????)
  #--------------------------------------------------------------------------
  def update_parameter_list
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif input_growth?
      # ??
      param = @parameter_window.parameter_symbol
      unless @actor.can_distribute?(param)
        Sound.play_buzzer
        return
      end
      Input.repeat?(Input::C) ? Sound.play_decision : Sound.play_cursor
      @actor.rp_growth_effect(param)
      refresh_window
    elsif input_reverse_growth?
      # ??
      param = @parameter_window.parameter_symbol
      if @actor.distributed_count(param) == 0
        Sound.play_buzzer
        return
      end
      Input.repeat?(Input::A) ? Sound.play_decision : Sound.play_cursor
      @actor.rp_growth_effect(param, true)
      refresh_window
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      next_actor
    elsif Input.trigger?(Input::L)
      Sound.play_cursor
      prev_actor
    end
  end
  #--------------------------------------------------------------------------
  # ? ????
  #--------------------------------------------------------------------------
  def input_growth?
    if KGC::DistributeParameter::ENABLE_REVERSE_DISTRIBUTE
      return Input.repeat?(Input::C) || Input.repeat?(Input::RIGHT)
    else
      return Input.trigger?(Input::C)
    end
  end
  #--------------------------------------------------------------------------
  # ? ????
  #--------------------------------------------------------------------------
  def input_reverse_growth?
    if KGC::DistributeParameter::ENABLE_REVERSE_DISTRIBUTE
      return Input.repeat?(Input::A) || Input.repeat?(Input::LEFT)
    else
      return false
    end
  end
end

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

#==============================================================================
# ? Scene_File
#==============================================================================

class Scene_File < Scene_Base
  #--------------------------------------------------------------------------
  # ? ???????????
  #    file : ??????????????? (??????)
  #--------------------------------------------------------------------------
  alias read_save_data_KGC_DistributeParameter read_save_data
  def read_save_data(file)
    read_save_data_KGC_DistributeParameter(file)

    KGC::Commands.check_distribution_values
    Graphics.frame_reset
  end
end

Convidad
Convidado


Ir para o topo Ir para baixo

Ir para o topo


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