XP 스크립트

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆ パラメータ振り分け - KGC_DistributeParameter ◆ XP ◆
#_/    ◇ Last update : 2008/12/21 ◇
#_/----------------------------------------------------------------------------
#_/  パラメータ振り分け機能を作成します。
#_/============================================================================
#_/  ≪入手経験値&金増加[ExpGoldIncrease]≫より下
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ カスタマイズ項目 - Customize ★
#==============================================================================

module KGC
module DistributeParameter
  # ◆ パラメータ増加量
  #  振り分け時の増加量を
  #   :パラメータ => [消費 RP, 上昇量, 回数上限, 消費 RP 補正, 上昇量補正],
  #  という書式で指定。
  #  「回数上限」以外は小数でもOK。
  #  「消費 RP 補正」と「上昇量補正」は省略可。省略時は 0。
  #  振り分け禁止パラメータには nil を指定。
  GAIN_PARAMETER = {
    :maxhp => [1,  2, 30, 1, 0],  # MaxHP
    :maxsp => [1,  1, 30, 1, 0],  # MaxSP
    :atk   => [1,  1, 30, 1, 0],  # 攻撃力
    :pdef  => [1,  1, 30, 1, 0],  # 物理防御
    :mdef  => [1,  1, 30, 1, 0],  # 魔法防御
    :str   => [1,  1, 30, 1, 0],  # 腕力
    :dex   => [1,  1, 30, 1, 0],  # 器用さ
    :agi   => [1,  1, 30, 1, 0],  # 素早さ
    :int   => [1,  1, 30, 1, 0],  # 魔力
    :hit   => [1,  1, 20, 1],       # 命中率
    :eva   => [1,  1, 20, 1],       # 回避率
  }  # ← この } は消さないこと!

  # ◆ アクター固有のパラメータ増加量
  PERSONAL_GAIN_PARAMETER = []
  #  ここから下に、アクターごとの振り分け時の増加量を
  #   PERSONAL_GAIN_PARAMETER[アクター ID] = { 増加量 }
  #  という書式で指定。
  #  「増加量」は GAIN_PARAMETER と同様の書式。
  #  指定しなかったパラメータ/アクターは GAIN_PARAMETER を使用。
  #
  # <例> アクター1の MaxHP, ATK を個別に指定。
#  PERSONAL_GAIN_PARAMETER[1] = {
#    :maxhp => [1, 50, 30, 0.4,   3],
#    :atk   => [1,  6, 30, 0.4, 0.6],
#  }

  # ◆ 職業固有のパラメータ増加量
  CLASS_GAIN_PARAMETER = []
  #  ここから下に、職業ごとの振り分け時の増加量を
  #   CLASS_GAIN_PARAMETER[職業 ID] = { 増加量 }
  #  という書式で指定。
  #  その他はアクター固有の設定と同様。
  #  (優先度は  職業 > アクター > デフォルト)

  # ◆ RP (Reinforce Point) の名称
  VOCAB_RP   = "S P "
  # ◆ RP の名称 (略)
  VOCAB_RP_A = "S P"

  # ◆ MaxRP 計算式
  #   level .. レベル
  #  結果が小数になってもOK(自動で整数に変換)。
  MAXRP_EXP = "(level ** 0.25 + 2.0) * level"

  # ◆ パラメータ名
  #  ≪拡張装備画面≫ と併用した場合、下に導入した方を優先。
  VOCAB_PARAM = {
    :hit => "명중률",        # 命中率
    :eva => "회피율",        # 回避率
  }  # ← この } は消さないこと!
  # ◆ パラメータ振り分け画面上部のテキスト
  DISTRIBUTE_SCENE_CAPTION = "스탯"
  # ◆ パラメータ振り分け画面背景透過
  DISTRIBUTE_SCENE_BACK_TRANSPARENT = true

  # ◆ 振り分け解除を許可
  #  true  : ← or A ボタンでパラメータを下げ、RP を取り戻せる。
  #  false : 一度振り分けたら変更できない。振り分けは C ボタンのみ。
  ENABLE_REVERSE_DISTRIBUTE = false
end
end

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

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

module KGC::DistributeParameter
  # 振り分け対象パラメータ
  PARAMS = [
    :maxhp, :maxsp, :atk, :pdef, :mdef,
    :str, :dex, :agi, :int, :hit, :eva
  ]
end

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

#==============================================================================
# □ KGC::Vocab
#==============================================================================

module KGC
module Vocab
  # 命中率
  def self.hit
    return KGC::DistributeParameter::VOCAB_PARAM[:hit]
  end

  # 回避率
  def self.eva
    return KGC::DistributeParameter::VOCAB_PARAM[:eva]
  end

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

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

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

#==============================================================================
# □ KGC::Commands
#==============================================================================

module KGC::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 : アクター index
  #--------------------------------------------------------------------------
  def call_distribute_parameter(actor_index = 0)
    $game_player.straighten
    $scene = Scene_DistributeParameter.new(
      actor_index,
      0,
      Scene_DistributeParameter::HOST_MAP)
  end
end

class Interpreter
  include KGC::Commands
end

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

#==============================================================================
# ■ Game_Battler (分割定義 1)
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_KGC_DistributeParameter_Game_Battler initialize
  def initialize
    initialize_KGC_DistributeParameter_Game_Battler

    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
  #--------------------------------------------------------------------------
  # ● 命中率の取得
  #--------------------------------------------------------------------------
  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
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
    @maxrp_plus = 0

    initialize_KGC_DistributeParameter(actor_id)
  end
  #--------------------------------------------------------------------------
  # ○ パラメータ増加量を取得
  #--------------------------------------------------------------------------
  def gain_parameter_list
    result = KGC::DistributeParameter::GAIN_PARAMETER
    # アクター固有
    list = KGC::DistributeParameter::PERSONAL_GAIN_PARAMETER[self.id]
    result = result.merge(list) if list != nil
    # クラス固有
    list = KGC::DistributeParameter::CLASS_GAIN_PARAMETER[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[0]
        cost_plus  += v[3] * i if v[3] != nil
        param_plus  = v[1]
        param_plus += v[4] * i if v[4] != 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.sp = self.sp
  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
  #--------------------------------------------------------------------------
  # ● 基本 MaxSP の取得
  #--------------------------------------------------------------------------
  alias base_maxsp_KGC_DistributeParameter base_maxsp
  def base_maxsp
    n = base_maxsp_KGC_DistributeParameter + distributed_param(:maxsp)
    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_pdef_KGC_DistributeParameter base_pdef
  def base_pdef
    n = base_pdef_KGC_DistributeParameter + distributed_param(:pdef)
    return n
  end
  #--------------------------------------------------------------------------
  # ● 基本魔法防御の取得
  #--------------------------------------------------------------------------
  alias base_mdef_KGC_DistributeParameter base_mdef
  def base_mdef
    n = base_mdef_KGC_DistributeParameter + distributed_param(:mdef)
    return n
  end
  #--------------------------------------------------------------------------
  # ● 基本腕力の取得
  #--------------------------------------------------------------------------
  alias base_str_KGC_DistributeParameter base_str
  def base_str
    n = base_str_KGC_DistributeParameter + distributed_param(:str)
    return n
  end
  #--------------------------------------------------------------------------
  # ● 基本器用さの取得
  #--------------------------------------------------------------------------
  alias base_dex_KGC_DistributeParameter base_dex
  def base_dex
    n = base_dex_KGC_DistributeParameter + distributed_param(:dex)
    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 base_int_KGC_DistributeParameter base_int
  def base_int
    n = base_int_KGC_DistributeParameter + distributed_param(:int)
    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 不足
    return false if gain[2] <= distributed_count(param)  # 回数上限

    return true
  end
  #--------------------------------------------------------------------------
  # ○ パラメータ振り分けコスト計算
  #     param : 振り分け先パラメータ (Symbol)
  #--------------------------------------------------------------------------
  def distribute_cost(param)
    gain = gain_parameter_list[param]
    return 0 if gain == nil  # 無効なパラメータ

    n = gain[0]
    n += gain[3] * distributed_count(param) if gain[3] != nil
    return [Integer(n), 0].max
  end
  #--------------------------------------------------------------------------
  # ○ パラメータ振り分け時の増加量計算
  #     param : 振り分け先パラメータ (Symbol)
  #--------------------------------------------------------------------------
  def distribute_gain(param)
    gain = gain_parameter_list[param]
    return 0 if gain == nil  # 無効なパラメータ

    n = gain[1]
    n += gain[4] * distributed_count(param) if gain[4] != nil
    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
  #--------------------------------------------------------------------------
  # ○ 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, 32, KGC::Vocab::rp)
    self.contents.font.color = rp_color(actor)
    xr = x + width
    self.contents.draw_text(xr - 40, y, 40, 32, actor.rp.to_s, 2)
    self.contents.font.color = normal_color
  end
end

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

#==============================================================================
# □ Window_DistributeParameterActor
#------------------------------------------------------------------------------
#   振り分け画面で、アクターの情報を表示するウィンドウです。
#==============================================================================

class Window_DistributeParameterActor < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     x     : ウィンドウの X 座標
  #     y     : ウィンドウの Y 座標
  #     actor : アクター
  #--------------------------------------------------------------------------
  def initialize(x, y, actor)
    super(x, y, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_name(@actor, 4, 0)
    draw_actor_level(@actor, 160, 0)
    draw_actor_rp(@actor, 280, 0, 80)
  end
end

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

#==============================================================================
# □ Window_DistributeParameterList
#------------------------------------------------------------------------------
#   振り分け画面で、成長させるパラメータを選択するウィンドウです。
#==============================================================================

class Window_DistributeParameterList < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     actor : アクター
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 128, 400, 352)
    @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

    self.contents.dispose if self.contents != nil
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    @item_max.times { |i| draw_item(i, @actor.can_distribute?(@data[i])) }
  end
  #--------------------------------------------------------------------------
  # ● 項目を描画する矩形の取得
  #     index : 項目番号
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = Rect.new(0, index * 32, width - 32, 32)
    return rect
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    return if Input.repeat?(Input::L) || Input.repeat?(Input::R)
    super
  end
  #--------------------------------------------------------------------------
  # ○ 項目の描画
  #     index   : 項目番号
  #     enabled : 有効フラグ
  #--------------------------------------------------------------------------
  def draw_item(index, enabled = true)
    rect = item_rect(index)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    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  = $data_system.words.hp
    when :maxsp
      name  = $data_system.words.sp
    when :atk
      name  = $data_system.words.atk
    when :pdef
      name  = $data_system.words.pdef
    when :mdef
      name  = $data_system.words.mdef
    when :str
      name  = $data_system.words.str
    when :dex
      name  = $data_system.words.dex
    when :agi
      name  = $data_system.words.agi
    when :int
      name  = $data_system.words.int
    when :hit
      name  = KGC::Vocab.hit
    when :eva
      name  = KGC::Vocab.eva
    else
      return
    end

    alpha = enabled ? 255 : 128
    self.contents.font.color = system_color
    self.contents.font.color.alpha = alpha
    self.contents.draw_text(x +   4, y, 120, 32, name)
    self.contents.draw_text(x + 128, y,  40, 32, KGC::Vocab::rp_a, 2)

    self.contents.font.color = normal_color
    self.contents.font.color.alpha = alpha
    gain = @actor.gain_parameter_list[type]
    value = @actor.distribute_cost(type)
    self.contents.draw_text(x + 168, y, 32, 32, value.to_s, 2)
    value = sprintf("%+d", @actor.distribute_gain(type))
    self.contents.draw_text(x + 208, y, 56, 32, value, 2)
    value = sprintf("%3d/%3d", @actor.distributed_count(type), gain[2])
    self.contents.draw_text(x + 268, y, 96, 32, value, 2)
    self.contents.font.color = normal_color
  end
end

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

#==============================================================================
# □ Window_DistributeParameterStatus
#------------------------------------------------------------------------------
#   振り分け画面で、アクターのステータスを表示するウィンドウです。
#==============================================================================

class Window_DistributeParameterStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     actor : アクター
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(400, 128, 240, 352)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    dy = 0
    gain_params = KGC::DistributeParameter::GAIN_PARAMETER
    KGC::DistributeParameter::PARAMS.each { |param|
      next if gain_params[param] == nil
      draw_parameter(0, dy, param)
      dy += 28
    }
  end
  #--------------------------------------------------------------------------
  # ○ 能力値の描画
  #     x    : 描画先 X 座標
  #     y    : 描画先 Y 座標
  #     type : 能力値の種類
  #--------------------------------------------------------------------------
  def draw_parameter(x, y, type)
    case type
    when :maxhp
      name  = $data_system.words.hp
      value = @actor.maxhp
    when :maxsp
      name  = $data_system.words.sp
      value = @actor.maxsp
    when :atk
      name  = $data_system.words.atk
      value = @actor.atk
    when :pdef
      name  = $data_system.words.pdef
      value = @actor.pdef
    when :mdef
      name  = $data_system.words.mdef
      value = @actor.mdef
    when :str
      name  = $data_system.words.str
      value = @actor.str
    when :dex
      name  = $data_system.words.dex
      value = @actor.dex
    when :agi
      name  = $data_system.words.agi
      value = @actor.agi
    when :int
      name  = $data_system.words.int
      value = @actor.int
    when :hit
      name  = KGC::Vocab.hit
      value = @actor.hit
    when :eva
      name  = KGC::Vocab.eva
      value = @actor.eva
    else
      return
    end

    self.contents.font.color = system_color
    self.contents.draw_text(x + 4, y, 96, 24, name)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 106, y, 64, 24, Integer(value).to_s, 2)
  end
end

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

#==============================================================================
# □ Scene_DistributeParameter
#------------------------------------------------------------------------------
#   パラメータ振り分け画面の処理を行うクラスです。
#==============================================================================

class Scene_DistributeParameter
  #--------------------------------------------------------------------------
  # ○ 定数
  #--------------------------------------------------------------------------
  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 main
    start
    # トランジション実行
    Graphics.transition
    # メインループ
    loop {
      Graphics.update
      Input.update
      update
      break if $scene != self
    }
    # トランジション準備
    Graphics.freeze
    terminate
  end
  #--------------------------------------------------------------------------
  # ○ 開始処理
  #--------------------------------------------------------------------------
  def start
    @actor = $game_party.actors[@actor_index]
    if KGC::DistributeParameter::DISTRIBUTE_SCENE_BACK_TRANSPARENT
      @spriteset = Spriteset_Map.new
    end
    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)
    if KGC::DistributeParameter::DISTRIBUTE_SCENE_BACK_TRANSPARENT
      @help_window.back_opacity = 160
      @actor_window.back_opacity = 160
      @parameter_window.back_opacity = 160
      @status_window.back_opacity = 160
    end
  end
  #--------------------------------------------------------------------------
  # ○ 終了処理
  #--------------------------------------------------------------------------
  def terminate
    @help_window.dispose
    @actor_window.dispose
    @parameter_window.dispose
    @status_window.dispose
    @spriteset.dispose if @spriteset != nil
  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
    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.actors.size
    $scene = Scene_DistributeParameter.new(@actor_index,
      @menu_index, @host_scene)
  end
  #--------------------------------------------------------------------------
  # ○ 前のアクターの画面に切り替え
  #--------------------------------------------------------------------------
  def prev_actor
    @actor_index += $game_party.actors.size - 1
    @actor_index %= $game_party.actors.size
    $scene = Scene_DistributeParameter.new(@actor_index,
      @menu_index, @host_scene)
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新 (パラメータウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  def update_parameter_list
    if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
      #return_scene
      $scene = Scene_Menu.new(4)
    elsif input_growth?
      # 加算
      param = @parameter_window.parameter_symbol
      unless @actor.can_distribute?(param)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if Input.repeat?(Input::C)
        $game_system.se_play($data_system.decision_se)
      else
        $game_system.se_play($data_system.cursor_se)
      end
      @actor.rp_growth_effect(param)
      refresh_window
    elsif input_reverse_growth?
      # 減算
      param = @parameter_window.parameter_symbol
      if @actor.distributed_count(param) == 0
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if Input.repeat?(Input::C)
        $game_system.se_play($data_system.decision_se)
      else
        $game_system.se_play($data_system.cursor_se)
      end
      @actor.rp_growth_effect(param, true)
      refresh_window
    elsif Input.trigger?(Input::R)
      $game_system.se_play($data_system.cursor_se)
      next_actor
    elsif Input.trigger?(Input::L)
      $game_system.se_play($data_system.cursor_se)
      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_Load
#==============================================================================

class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # ● セーブデータの読み込み
  #     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

 

:maxhp => [1,  2, 30, 1, 0], 

첫번째 숫자 - 초기 SP 소모량

두번째 숫자 - 초기 능력치 증가량

 

세번째 숫자 - 올릴 수 있는 스탯 횟수

 

네번째 숫자 - 스탯 1 올릴 시마다 늘어나는 SP 소모량

 

다섯번째 숫자 - 스탯 1 올릴 시마다 늘어나는 능력치 증가량

 


$scene = Scene_DistributeParameter.new

--- 화면 호출

TAG •
Comment '13'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
681 HUD 적의 남은 HP만큼 적의 이름 색깔 변하는 스크립트 6 file 백호 2009.02.21 2337
680 전투 CSSR6-스태미너 시스템 1 file 백호 2009.02.22 2336
679 HUD MOG_C_HUD. 6 file Bera 2010.09.11 2329
678 메뉴 자세한 캐릭터 정보표시 스크립트 버전2 5 아방스 2009.01.12 2328
677 저장 렉없은 자동 세이브 15 알피지GM 2010.03.07 2326
676 스크립트를 배우시기 전에..... 5 독도2005 2008.08.31 2326
675 장비 장비 착용 효과 스크립트 14 file 백호 2009.02.21 2322
674 상점 상점 메뉴 개조시킨 스크립트 9 file 백호 2009.02.21 2322
673 기타 스탯 13 file 이안 2010.01.17 2319
672 메뉴 제가 쓰는 메뉴 14 file 백호 2009.02.21 2318
671 온라인 멀티넷 스크립트 수정본 (약간 한글화) 7 백호 2009.02.22 2315
670 메시지 1문자식 표시랑 따랑소리 나는 스크립트 8 백호 2009.02.22 2303
669 아이템 아이템도감 14 키라링 2009.01.22 2299
668 키입력 [xp,vx]마우스 제스쳐 스크립트 2 클로시스 2013.09.26 2295
667 Run-Smoother! ( 렉 줄이는 스크립트 ) 12 file Bera 2010.10.16 2295
» KGC 스탯올리기 스크립트 (능력치 분배 스크립트) 13 카이어덱터 2010.02.26 2292
665 저장 심플 세이브&로드 개조(필요할 때 원하는 슬롯에 자동저장) 5 나렌시아 2011.02.24 2291
664 기타 rpgxp [체험판] 입니다. 6 file 인웅이 아부지 2010.01.12 2289
663 기타 명령어들 6 지존!! 2010.07.24 2288
662 타이틀/게임오버 타이틀 화면 연출 4 file 백호 2009.02.21 2286
Board Pagination Prev 1 ... 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ... 52 Next
/ 52