VX 스크립트

 이 스크립트를 사용하신다면 추가적인 능력치를 배분할 수 있게 됩니다.

 kgc 커스텀 메뉴 스크립트를 사용하신다면, 그 아래에 두십시오. 

 

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆ 파라미터 배분 - KGC_DistributeParameter ◆ VX ◆
#_/    ◇ Last update : 2009/07/25 ◇
#_/----------------------------------------------------------------------------
#_/  파라미터 배분 기능을 작성합니다.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ 커스터마이즈 항목 - Customize ★
#==============================================================================

module KGC
module DistributeParameter
  # ◆ 파라미터 증가량
  #  배분시의 증가량을
  #   :파라미터 => [소비 RP, 상승량, 회수 상한, 소비 RP 보정, 상승량 보정],
  #  이 서식에서 지정.
  #  「회수 상한」이외는 소수에서도OK.
  #  「소비 RP 보정」과「상승량 보정」은 생략가능.생략시는 0.
  #  배분 금지로 하는 파라미터는
  #   :파라미터 => nil,
  #  (이)라고 쓴다.
  GAIN_PARAMETER = {
    #:파라미터 => [RP, 상승량, 상한, 소비 RP 보정, 상승량 보정],
    :maxhp       => [1, 15, 0,  1.5, 25],  # MaxHP
    :maxmp       => [1, 10,  0,1.5, 12],  # MaxMP
    :atk         =>     [1, 1,  0,  1,  1],  # 공격력
    :def         =>     [1, 1,  0,  1,  1],  # 방어력
    :spi         =>     [1, 1,  0,  1,  1],  # 정신력
    :agi         =>     [1,  1, 0,  1,  1],  # 민첩성
    :hit         =>      [1,  1, 5, 1.5, 0],       # 명중율
    :eva         =>    [2,  1, 0, 3, 0],       # 회피율
    :cri         =>      [2,  1, 15, 3, 0],       # 위기율
    :skill_speed => nil,       # 스킬 속도 보정
    :item_speed  => nil,       # 아이템 속도 보정
    :odds        =>   [3,  1, 10,  1, 0],             # 표적이 되기 쉬움
  }  # ← 이 } (은)는 지우지 않는 것!

  # ◆ 액터 고유의 파라미터 증가량
  PERSONAL_GAIN_PARAMETER = []
  #  여기에서 아래로, 액터마다의 배분시의 증가량을
  #   PERSONAL_GAIN_PARAMETER[액터 ID] = { 증가량 }
  #  그렇다고 하는 서식에서 지정.
  #  「증가량」은 GAIN_PARAMETER (와)과 같은 서식.
  #  지정하지 않았던 파라미터/액터는 GAIN_PARAMETER (을)를 사용.
  #
  # <례> 액터 1의 MaxHP, ATK (을)를 개별적으로 지정.
  PERSONAL_GAIN_PARAMETER[1]  =
  {
    :maxhp    => [1, 15, 0, 1.5,  22],  # MaxHP
    :maxmp   => [1, 10,  0, 1.5, 15],  # MaxMP
    :atk         =>  [1, 1,  0,  1.2,  1.4],  # 공격력
    :def         =>  [1, 1,  0,  1.4,  1.3],  # 방어력
    :spi         =>  [1, 1,  0,  1.4,  1.3],  # 정신력
    :agi         =>  [1,  1, 0,  1.2,  1.4],  # 민첩성
    :cri         =>   [2,  1, 20,  2.6,  0],       # 위기율
  }
    # ◆ 직업 고유의 파라미터 증가량
  CLASS_GAIN_PARAMETER = []
  #  여기에서 아래로, 직업마다의 배분시의 증가량을
  #   CLASS_GAIN_PARAMETER[직업 ID] = { 증가량 }
  #  그렇다고 하는 서식에서 지정.
  #  그 외는 액터 고유의 설정과 같이.
  #  (우선도는  직업 > 액터 > 디폴트)


  # ◆ RP (Reinforce Point) 의 명칭
  VOCAB_RP   = "RP"
  # ◆ RP 의 명칭 (략)
  VOCAB_RP_A = "R"

  # ◆ MaxRP 계산식
  #   level .. 레벨
  #  결과가 소수가 되어도OK(자동으로 정수에 변환).
  MAXRP_EXP = "(level*level/8)+level*7/10"

  # ◆ 파라미터명
  #  ≪확장 장비 화면≫ (와)과 병용 했을 경우, 아래에 도입한 (분)편을 우선.
  VOCAB_PARAM = {
    :hit         => "명중",        # 명중율
    :eva         => "회피",        # 회피율
    :cri         => "크리티컬",  # 위기율
    :skill_speed => "캐스팅 속도",      # 스킬 속도 보정
    :item_speed  => "아이템 속도",  # 아이템 속도 보정
    :odds        => "표적율",  # 표적이 되기 쉬움
  }  # ← 이 } (은)는 지우지 않는 것!
  # ◆ 파라미터 배분 화면상부의 텍스트
  DISTRIBUTE_SCENE_CAPTION = "파라미터를 배분해 주세요."
  # ◆ 배분 회수가 무제한 때는 /--- (상한 표기) (을)를 숨긴다
  #  true  : 회수만 표시
  #  false : 회수/--- (와)과 표시
  HIDE_MAX_COUNT_INFINITE  = false

  # ◆ 배분 게이지의 개시색
  #  수치  : C[n] (와)과 같은 색.
  #  Color : 지정한 색. ( Color.new(255, 128, 128) 등 )
  GAUGE_START_COLOR = 28
  # ◆ 배분 게이지의 종료색
  GAUGE_END_COLOR   = 29

  # ◆ 메뉴 화면에 「파라미터 배분해」커멘드를 추가한다
  #  추가하는 장소는, 메뉴 커멘드의 최하부입니다.
  #  다른 부분에 추가하고 싶으면,≪커스텀 메뉴 커멘드≫ (을)를 이용하십시오.
  USE_MENU_DISTRIBUTE_PARAMETER_COMMAND = true
  # ◆ 메뉴 화면의 「파라미터 배분해」커멘드의 명칭
  VOCAB_MENU_DISTRIBUTE_PARAMETER       = "파라미터 배분"

  # ◆ 배분 해제를 허가
  #  true  : ← or A 버튼으로 파라미터를 내려RP (을)를 되찾을 수 있다.
  #  false : 한 번 배분하면 변경할 수 없다.
  ENABLE_REVERSE_DISTRIBUTE = false
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

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


module KGC::DistributeParameter
  # 배분 대상 파라미터
  PARAMS = [:maxhp, :maxmp, :atk, :def, :spi, :agi, :hit, :eva, :cri,
    :skill_speed, :item_speed, :odds]

  # 파라미터 증가량 구조체
  GainInfo = Struct.new("GainInfo",
    :rp_cost, :value, :max_count, :rp_rev, :value_rev)

  #--------------------------------------------------------------------------
  # ○ 파라미터 증가량을 구조체화
  #--------------------------------------------------------------------------
  def self.create_gain_param_structs(target)
    params = {}
    target.each { |k, v|
      next if v == nil
      info = GainInfo.new
      info.rp_cost   = v[0]
      info.value     = v[1]
      info.max_count = v[2]
      info.rp_rev    = v[3]
      info.value_rev = v[4]
      params[k] = info
    }
    return params
  end
  #--------------------------------------------------------------------------
  # ○ 파라미터 증가량을 구조체화 (고유 증가량용)
  #--------------------------------------------------------------------------
  def self.create_gain_param_structs_for_personal(target)
    params = []
    target.each_with_index { |gain_list, i|
      next if gain_list == nil
      params[i] = create_gain_param_structs(gain_list)
    }
    return params
  end

  # 파라미터 증가량을 구조체화
  GAIN_PARAMS = create_gain_param_structs(GAIN_PARAMETER)
  PERSONAL_GAIN_PARAMS =
    create_gain_param_structs_for_personal(PERSONAL_GAIN_PARAMETER)
  CLASS_GAIN_PARAMS =
    create_gain_param_structs_for_personal(CLASS_GAIN_PARAMETER)
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

  # 스킬 속도 보정
  def self.skill_speed
    return KGC::DistributeParameter::VOCAB_PARAM[:skill_speed]
  end

  # 아이템 속도 보정
  def self.item_speed
    return KGC::DistributeParameter::VOCAB_PARAM[:item_speed]
  end

  # 표적이 되기 쉬움
  def self.odds
    return KGC::DistributeParameter::VOCAB_PARAM[:odds]
  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
module Commands
  module_function
  #--------------------------------------------------------------------------
  # ○ 파라미터 배분해에 관한 값을 체크
  #--------------------------------------------------------------------------
  def check_distribution_values
    (1...$data_actors.size).each { |i|
      actor = $game_actors[i]
      actor.check_distribution_values
      actor.restore_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_id : 액터 ID
  #--------------------------------------------------------------------------
  def reset_distributed_count(actor_id)
    actor = $game_actors[actor_id]
    return if actor == nil
    actor.clear_distribution_values
    actor.restore_distribution_values
  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
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
    calc_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
  #--------------------------------------------------------------------------
  # ○ 각종 수정치를 계산
  #--------------------------------------------------------------------------
  def calc_distribution_values
    # 계승처에서 정의
  end
  #--------------------------------------------------------------------------
  # ○ 배분에 의한 상승치를 취득
  #     param : 파라미터의 Symbol
  #--------------------------------------------------------------------------
  def distributed_param(param)
    return 0
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_BattleAction
#==============================================================================

class Game_BattleAction
  #--------------------------------------------------------------------------
  # ● 행동 스피드의 결정
  #--------------------------------------------------------------------------
  alias make_speed_KGC_DistributeParameter make_speed
  def make_speed
    make_speed_KGC_DistributeParameter

    if skill? && skill.speed < 0
      n = [battler.distributed_param(:skill_speed), skill.speed].min
      @speed -= n
    end
    if item? && item.speed < 0
      n = [battler.distributed_param(:item_speed), item.speed].min
      @speed -= n
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #     actor_id : 액터 ID
  #--------------------------------------------------------------------------
  alias initialize_KGC_DistributeParameter initialize
  def initialize(actor_id)
    @actor_id = actor_id
    @class_id = $data_actors[actor_id].class_id

    initialize_KGC_DistributeParameter(actor_id)
  end
  #--------------------------------------------------------------------------
  # ○ 파라미터 증가량을 취득
  #--------------------------------------------------------------------------
  def gain_parameter_list
    result = KGC::DistributeParameter::GAIN_PARAMS
    # 액터 고유
    list = KGC::DistributeParameter::PERSONAL_GAIN_PARAMS[self.id]
    result = result.merge(list) if list != nil
    # 직업 고유
    list = KGC::DistributeParameter::CLASS_GAIN_PARAMS[self.class_id]
    result = result.merge(list) if list != nil

    return result
  end
  #--------------------------------------------------------------------------
  # ○ 각종 수정치를 계산
  #--------------------------------------------------------------------------
  def calc_distribution_values
    @rp_cost = 0
    @distributed_param = {}
    gain_parameter_list.each { |k, v|
      next if v == nil
      cost = 0
      param = 0
      distributed_count(k).times { |i|
        cost_plus   = v.rp_cost
        cost_plus  += v.rp_rev * i if v.rp_rev != nil
        param_plus  = v.value
        param_plus += v.value_rev * i if v.value_rev != nil
        cost  += Integer(cost_plus)
        param += Integer(param_plus)
      }
      @rp_cost += [cost, 0].max
      @distributed_param[k] = param
    }
  end
  #--------------------------------------------------------------------------
  # ○ 각종 수정치를 수복
  #--------------------------------------------------------------------------
  def restore_distribution_values
    calc_distribution_values
    self.hp = self.hp
    self.mp = self.mp
  end
  #--------------------------------------------------------------------------
  # ○ 배분에 의한 상승치를 취득
  #     param : 파라미터의 Symbol
  #--------------------------------------------------------------------------
  def distributed_param(param)
    return 0 if @distributed_param == nil
    return 0 if @distributed_param[param] == nil
    return @distributed_param[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
  #--------------------------------------------------------------------------
  # ● 표적이 되기 쉬움의 취득
  #--------------------------------------------------------------------------
  alias odds_KGC_DistributeParameter odds
  def odds
    n = odds_KGC_DistributeParameter + distributed_param(:odds)
    return n
  end
  #--------------------------------------------------------------------------
  # ○ MaxRP 의 취득
  #--------------------------------------------------------------------------
  def maxrp
    n = Integer(eval(KGC::DistributeParameter::MAXRP_EXP))
    return [n + maxrp_plus, 0].max
  end
  #--------------------------------------------------------------------------
  # ○ MaxRP 보정치의 취득
  #--------------------------------------------------------------------------
  def maxrp_plus
    @maxrp_plus = 0 if @maxrp_plus == nil
    return @maxrp_plus
  end
  #--------------------------------------------------------------------------
  # ○ RP 의 취득
  #--------------------------------------------------------------------------
  def rp
    return [maxrp - @rp_cost, 0].max
  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)
    @maxrp_plus = maxrp_plus + value
  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
  #--------------------------------------------------------------------------
  # ○ RP 배분에 의한 성장 효과 적용
  #     param   : 배분처 파라미터 (Symbol)
  #     reverse : 역가산 때는 true
  #--------------------------------------------------------------------------
  def rp_growth_effect(param, reverse = false)
    gain = gain_parameter_list[param]
    return if gain == nil  # 무효인 파라미터

    if reverse
      return if distributed_count(param) == 0  # 역가산 불가
    else
      return unless can_distribute?(param)
    end

    gain_distributed_count(param, reverse ? -1 : 1)
    restore_distribution_values
  end
  #--------------------------------------------------------------------------
  # ○ 파라미터 배분 가부 판정
  #     param : 배분처 파라미터 (Symbol)
  #--------------------------------------------------------------------------
  def can_distribute?(param)
    gain = gain_parameter_list[param]
    return false if gain == nil                        # 무효인 파라미터
    return false if self.rp < distribute_cost(param)   # RP 부족
    if gain.max_count > 0
      return false if gain.max_count <= distributed_count(param)  # 회수 상한
    end

    return true
  end
  #--------------------------------------------------------------------------
  # ○ 파라미터 배분 코스트 계산
  #     param : 배분처 파라미터 (Symbol)
  #--------------------------------------------------------------------------
  def distribute_cost(param)
    gain = gain_parameter_list[param]
    return 0 if gain == nil  # 무효인 파라미터

    n = gain.rp_cost
    if gain.rp_rev != nil
      count = distributed_count(param)
      count = [count, gain.max_count - 1].min if gain.max_count > 0
      n += gain.rp_rev * count
    end
    return [Integer(n), 0].max
  end
  #--------------------------------------------------------------------------
  # ○ 파라미터 배분시의 증가량 계산
  #     param : 배분처 파라미터 (Symbol)
  #--------------------------------------------------------------------------
  def distribute_gain(param)
    gain = gain_parameter_list[param]
    return 0 if gain == nil  # 무효인 파라미터

    n = gain.value
    if gain.value_rev != nil
      count = distributed_count(param)
      count = [count, gain.max_count - 1].min if gain.max_count > 0
      n += gain.value_rev * count
    end
    return Integer(n)
  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_a)
    self.contents.font.color = rp_color(actor)
    xr = x + width
    if width < 120
      self.contents.draw_text(xr - 40, y, 40, WLH, actor.rp, 2)
    else
      self.contents.draw_text(xr - 90, y, 40, WLH, actor.rp, 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.maxrp, 2)
    end
    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 = actor.gain_parameter_list[param]
    return if gain == nil || gain.max_count <= 0
    gw = width * actor.distributed_count(param) / gain.max_count
    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)
  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
  #--------------------------------------------------------------------------
  # ● 1 페이지에 표시할 수 있는 행수의 취득
  #--------------------------------------------------------------------------
  def page_row_max
    return super - 1
  end
  #--------------------------------------------------------------------------
  # ● 항목을 묘화 하는 구형의 취득
  #     index : 항목 번호
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = super(index)
    rect.y += WLH
    return rect
  end
  #--------------------------------------------------------------------------
  # ● 커서를 1 페이지 뒤로 이동
  #--------------------------------------------------------------------------
  def cursor_pagedown
    return if Input.repeat?(Input::R)
    super
  end
  #--------------------------------------------------------------------------
  # ● 커서를 1 페이지전에 이동
  #--------------------------------------------------------------------------
  def cursor_pageup
    return if Input.repeat?(Input::L)
    super
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    gain_params = @actor.gain_parameter_list
    KGC::DistributeParameter::PARAMS.each { |param|
      next if gain_params[param] == nil
      @data << param
    }
    @item_max = @data.size + 1
    create_contents
    @item_max -= 1
    draw_caption
    @item_max.times { |i| draw_item(i, @actor.can_distribute?(@data[i])) }
  end
  #--------------------------------------------------------------------------
  # ○ 표제의 묘화
  #--------------------------------------------------------------------------
  def draw_caption
    self.contents.font.color = system_color
    self.contents.draw_text(  4, 0, 96, WLH, "파라미터")
    self.contents.draw_text(120, 0, 40, WLH, Vocab.rp, 2)
    self.contents.draw_text(170, 0, 60, WLH, "상승량", 2)
    self.contents.draw_text(240, 0, 80, WLH, "회수", 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
    when :skill_speed
      name  = Vocab.skill_speed
    when :item_speed
      name  = Vocab.item_speed
    when :odds
      name  = Vocab.odds
    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 = @actor.gain_parameter_list[type]
    value = @actor.distribute_cost(type)
    self.contents.draw_text(x + 120, y, 40, WLH, value, 2)
    value = sprintf("%+d", @actor.distribute_gain(type))
    self.contents.draw_text(x + 190, y, 40, WLH, value, 2)
    if gain.max_count > 0
      value = sprintf("%3d/%3d", @actor.distributed_count(type), gain.max_count)
    else
      value = sprintf("%3d%s", @actor.distributed_count(type),
        KGC::DistributeParameter::HIDE_MAX_COUNT_INFINITE ? "" : "/---")
    end
    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
    original_height = self.height
    self.height = WLH * (existing_params.size + 1) + 32
    create_contents
    self.height = original_height

    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, width - 32, WLH, "파라미터", 1)
    self.contents.font.color = normal_color
    dy = WLH
    existing_params.each { |param|
      draw_parameter(0, dy, param)
      dy += WLH
    }
  end
  #--------------------------------------------------------------------------
  # ○ 존재하는 파라미터의 일람
  #--------------------------------------------------------------------------
  def existing_params
    result = []
    gain_params = @actor.gain_parameter_list
    KGC::DistributeParameter::PARAMS.each { |param|
      next if gain_params[param] == nil
      result << param
    }
    return result
  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
    when :skill_speed
      name  = Vocab.skill_speed
      value = @actor.distributed_param(type)
    when :item_speed
      name  = Vocab.item_speed
      value = @actor.distributed_param(type)
    when :odds
      name  = Vocab.odds
      value = @actor.odds
    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
    @status_window.oy = @parameter_window.oy

    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

Who's 시트르산

?

제작중인 게임 :

Midnight Blue  (미드나잇 블루) - RPGXP

 공동제작 : 휘파람개비님

 시스템 : 45%, 스토리 : 10%, 맵 : 3%, 제작 : 1%

 CG : 2%         총 진행도 : 3%

 

 이번 게임은 공동제작인 만큼 최선을 다하겠습니다 ^^

기다려주세요~~

Comment '13'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
44 메뉴 KGC - 커스텀 메뉴 커멘드 (번역) 1 듀란테 2015.07.27 1077
43 메뉴 Etude87's Menu Editor for VX 25 습작 2015.01.14 1461
42 메뉴 Etude87_Ace_Style_Formation_Change ver.1.01 습작 2014.10.05 757
41 메뉴 MOG - Scroll Bar for VX file 습작 2014.07.06 1114
40 메뉴 기본메인 메뉴 아이콘 추가 10 아방스 2010.12.11 4573
» 메뉴 kgc 파라미터 배분 09/07/25 13 시트르산 2010.09.24 2327
38 메뉴 자작 메뉴 스크립트 for VX(L's Simple Custom Menu VX ver.) 5 Alkaid 2010.09.02 4705
37 메뉴 스타일 크로노 트리거 메뉴 31 file 콩밥 2010.07.19 4536
36 메뉴 매우 간단명료한 메뉴. 32 file 비극ㆍ 2010.04.23 6618
35 메뉴 Final Fantasy VII Menu System 8 비극ㆍ 2010.04.19 3506
34 메뉴 몬스터도감(유즈미짱님의엘카르디아같은종류) 1 작은샛별 2010.03.07 4199
33 메뉴 윈도우 색변경 스크립트 7 file 비극ㆍ 2010.03.01 2598
32 메뉴 전투 결과 상세 표시 스크립트 (한글화) 15 file 강진수 2010.02.26 3344
31 메뉴 YERD - 커먼 이벤트 메뉴 4 file 훈덕 2009.11.08 3849
30 메뉴 YERD - 시스템 옵션 5 file 훈덕 2009.11.08 3135
29 메뉴 확장 스테이터스 화면 - KGC 23 file 카르와푸딩의아틀리에 2009.08.19 5057
28 메뉴 전투결과 상세 표시 스크립트 24 file 카르와푸딩의아틀리에 2009.07.07 4142
27 메뉴 전투 결과 팝업 스크립트 12 file 카르와푸딩의아틀리에 2009.06.30 3381
26 메뉴 몬스터도감 심플버전! 52 file 카르와푸딩의아틀리에 2009.06.30 6906
25 메뉴 전투승리시 아이템 경험치팝업창 스크립트 18 file 카르와푸딩의아틀리에 2009.06.23 3760
Board Pagination Prev 1 2 3 Next
/ 3