KGC_DistributeParameter 란, 스크립트에 대한 질문입니다.
스텟 분배 스크립트로써, 제 게임에 딱 알맞은데요.
스텟포인트를 줄때, 레벨에 따라 막 달라집니다.
저는 일정하게 5 정도로 고정하고 싶은데...
어떻게 하면 될까요?
- 스크립트 내용 -
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ パラメ?タ振り分け - 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