赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 6 |
经验 | 0 |
最后登录 | 2024-11-27 |
在线时间 | 61 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 569
- 在线时间
- 61 小时
- 注册时间
- 2021-3-3
- 帖子
- 18
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
问一下各位大佬,我使用了升级加点的脚本。并且按照其脚本设置了不同职业的不同加点参数。
(默认一升级点加4点atk,骑士1升级点可以加3点atk,法师1升级点可以加2atk)
但是使用中,无论什么选择什么职业 都会使用默认的加点数值比例。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #_/ ◆ パラメータ振り分け - KMS_DistributeParameter ◆ VXAce ◆ #_/ ◇ Last update : 2012/08/05 (TOMY@Kamesoft) ◇ #_/---------------------------------------------------------------------------- #_/ パラメータ振り分け機能を作成します。 #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #============================================================================== # ★ 設定項目 - BEGIN Setting ★ #============================================================================== module KMS_DistributeParameter #◆参数分配部位 #分配部位及增加量 # { #:key=>键, #:name=>“名称”, #:limit=>上限次数, #:cost=>“消费RP,消费RP修正”, #:参数=>[上升量,上升量修正], ##或更高版本的参数 # }, #格式添加。 #在分配画面中,按添加的顺序显示。 #“键”指定不与其他部位覆盖的名称。 #(用于确定内部的分配位置。数字、字符串等都可以) #除“次数上限”以外,小数也可以。 #“次数上限”为0时,次数无限制。 #可省略“消耗RP修正”和“上升量修正”。省略时为0。 GAIN_PARAMETER = [ { :key => :health, :name => "体力", :limit => 100, :cost => [ 1, 0.1], :mhp => [30, 0.3], }, { :key => :magic, :name => "魔力", :limit => 100, :cost => [1, 0.05], :mat => [2, 0.05], }, { :key => :pow, :name => "力量", :limit => 100, :cost => [1, 0.1], :atk => [4, 0.1], :mhp => [10, 1] }, { :key => :dex, :name => "防御", :limit => 100, :cost => [1, 0.1], :mdf => [2, 0.5], :def => [2, 0.5], :eva => [0.001], }, { :key => :SPD, :name => "敏捷", :limit => 100, :cost => [1, 0.05], :agi => [2, 0.2], :mdf => [1, 0.1], :eva => [0.001], }, { :key => :luk, :name => "幸运", :limit => 20, :cost => [1], :luk => [1] }, { :key => :hit, :name => "命中率", :limit => 20, :cost => [1, 0.5], :hit => [0.01], }, { :key => :eva, :name => "回避率", :limit => 10, :cost => [1, 0.5], :eva => [0.01], }, { :key => :crt, :name => "暴击率", :limit => 10, :cost => [1, 0.7], :cri => [0.01], }, { :key => :chant, :name => "詠唱速度", :limit => 0, :cost => [1], :skill_speed => [1], }, { :key => :item, :name => "物品使用速度", :limit => 0, :cost => [1], :item_speed => [1], }, ] # ← この ] は消さないこと! # ◆ アクター固有のパラメータ増加量 PERSONAL_GAIN_PARAMETER = [] # ここから下に、アクターごとの振り分け時の増加量を # PERSONAL_GAIN_PARAMETER[アクター ID] = [ 振り分け箇所 ] # という書式で指定。 # 「振り分け箇所」は GAIN_PARAMETER と同様の書式。 # キーが GAIN_PARAMETER と同じ場合、GAIN_PARAMETER に上書き。 # 指定しなかったパラメータ/アクターは GAIN_PARAMETER を使用。 # # <例> アクター1の "体力" を個別に指定。 PERSONAL_GAIN_PARAMETER[1] = [ { :key => :health, :name => "体力", :limit => 30, :cost => [ 1, 0.4], :mhp => [50, 3], :def => [ 1, 0.3], }, ] # ◆ 職業固有のパラメータ増加量 CLASS_GAIN_PARAMETER = [] # ここから下に、職業ごとの振り分け時の増加量を # CLASS_GAIN_PARAMETER[職業 ID] = [ 振り分け箇所 ] # という書式で指定。 # その他はアクター固有の設定と同様。 # (優先度は 職業 > アクター > デフォルト) CLASS_GAIN_PARAMETER[3] = [ { :key => :health, :name => "体力", :limit => 150, :cost => [ 1, 0.1], :mhp => [30, 0.3], }, { :key => :magic, :name => "魔力", :limit => 30, :cost => [1, 0.05], :mat => [2, 0.05], }, { :key => :pow, :name => "力量", :limit => 150, :cost => [1, 0.1], :atk => [3, 0.1], :mhp => [10, 1] }, { :key => :dex, :name => "防御", :limit => 150, :cost => [1, 0.1], :mdf => [2, 0.5], :def => [2, 0.5], :eva => [0.001], }, { :key => :SPD, :name => "敏捷", :limit => 60, :cost => [1, 0.05], :agi => [2, 0.2], :mdf => [1, 0.1], :eva => [0.001], }, { :key => :luk, :name => "幸运", :limit => 30, :cost => [1], :luk => [1] }, { :key => :hit, :name => "命中率", :limit => 30, :cost => [1, 0.5], :hit => [0.01], }, { :key => :eva, :name => "回避率", :limit => 0, :cost => [1, 0.5], :eva => [0.01], }, { :key => :crt, :name => "暴击率", :limit => 10, :cost => [1, 0.7], :cri => [0.01], }, { :key => :chant, :name => "詠唱速度", :limit => 0, :cost => [1], :skill_speed => [1], }, { :key => :item, :name => "物品使用速度", :limit => 0, :cost => [1], :item_speed => [1], }, ] CLASS_GAIN_PARAMETER[4] = [ { :key => :health, :name => "体力", :limit => 60, :cost => [ 1, 0.1], :mhp => [50, 0.5], }, { :key => :magic, :name => "魔力", :limit => 20, :cost => [1, 0.05], :mat => [2, 0.05], }, { :key => :pow, :name => "力量", :limit => 100, :cost => [1, 0.1], :atk => [2, 0.1], :mhp => [10, 1] }, { :key => :dex, :name => "防御", :limit => 60, :cost => [1, 0.1], :mdf => [2, 0.5], :def => [2, 0.5], :eva => [0.001], }, { :key => :SPD, :name => "敏捷", :limit => 230, :cost => [1, 0.05], :agi => [2, 0.2], :mdf => [1, 0.1], :eva => [0.001], }, { :key => :luk, :name => "幸运", :limit => 40, :cost => [1], :luk => [1] }, { :key => :hit, :name => "命中率", :limit => 40, :cost => [1, 0.5], :hit => [0.01], }, { :key => :eva, :name => "回避率", :limit => 30, :cost => [1, 0.5], :eva => [0.01], }, { :key => :crt, :name => "暴击率", :limit => 30, :cost => [1, 0.7], :cri => [0.01], }, { :key => :chant, :name => "詠唱速度", :limit => 0, :cost => [1], :skill_speed => [1], }, { :key => :item, :name => "物品使用速度", :limit => 0, :cost => [1], :item_speed => [1], }, ] CLASS_GAIN_PARAMETER[5] = [ { :key => :health, :name => "体力", :limit => 100, :cost => [ 1, 0.1], :mhp => [30, 0.3], }, { :key => :magic, :name => "魔力", :limit => 100, :cost => [1, 0.05], :mat => [2, 0.05], }, { :key => :pow, :name => "力量", :limit => 100, :cost => [1, 0.1], :atk => [2, 0.1], :mhp => [10, 1] }, { :key => :dex, :name => "防御", :limit => 100, :cost => [1, 0.1], :mdf => [2, 0.5], :def => [2, 0.5], :eva => [0.001], }, { :key => :SPD, :name => "敏捷", :limit => 100, :cost => [1, 0.05], :agi => [2, 0.2], :mdf => [1, 0.1], :eva => [0.001], }, { :key => :luk, :name => "幸运", :limit => 20, :cost => [1], :luk => [1] }, { :key => :hit, :name => "命中率", :limit => 20, :cost => [1, 0.5], :hit => [0.01], }, { :key => :eva, :name => "回避率", :limit => 10, :cost => [1, 0.5], :eva => [0.01], }, { :key => :crt, :name => "暴击率", :limit => 10, :cost => [1, 0.7], :cri => [0.01], }, { :key => :chant, :name => "詠唱速度", :limit => 0, :cost => [1], :skill_speed => [1], }, { :key => :item, :name => "物品使用速度", :limit => 0, :cost => [1], :item_speed => [1], }, ] # ◆ RP (振り分け用ポイント) の名称 VOCAB_RP = "RP" # ◆ RP の名称 (略) VOCAB_RP_A = "灵魂" # ◆ MaxRP 計算式 # level .. レベル # 結果が小数になってもOK(自動で整数に変換)。 MAXRP_EXP = "5 * level" # ◆ パラメータ名 # ?拡張装備画面? と併用した場合、下に導入した方を優先。 VOCAB_PARAM = { :hit => "命中率", # 命中率 :eva => "回避率", # 回避率 :cri => "暴击率", # クリティカル率 :skill_speed => "詠唱速度修正", # スキル速度補正 :item_speed => "物品使用速度修正", # アイテム速度補正 } # ← この } は消さないこと! # ◆ 振り分け回数が無制限のときは /--- (上限表記) を隠す # true : 回数のみ表示 # false : 回数/--- と表示 HIDE_MAX_COUNT_INFINITE = false # ◆ 振り分けゲージの色 # 数値 : \C[n] と同じ色。 # Color : 指定した色。 ( Color.new(255, 128, 128) など ) GAUGE_START_COLOR = 28 # 開始色 GAUGE_END_COLOR = 29 # 終了色 # ◆ 振り分けゲージに汎用ゲージを使用する # ?汎用ゲージ描画? 導入時のみ有効。 ENABLE_GENERIC_GAUGE = true # ◆ 振り分け汎用ゲージ設定 # 画像は "Graphics/System" から読み込む。 GAUGE_IMAGE = "GaugeDist" # 画像 GAUGE_OFFSET = [-23, -2] # 位置補正 [x, y] GAUGE_LENGTH = -4 # 長さ補正 GAUGE_SLOPE = 30 # 傾き (-89 ~ 89) # ◆ 振り分け終了時の確認コマンド CONFIRM_COMMANDS = [ " 确定", # 振り分け確定 " 中止", # 振り分け中止 " 取消", # 振り分けを続ける ] # ← この ] は消さないこと! # ◆ 確認コマンドのヘルプ CONFIRM_COMMAND_HELP = [ "加点确认", # 振り分け確定 "取消加点", # 振り分け中止 "继续加点", # 振り分けを続ける ] # ← この ] は消さないこと! # ◆ 振り分け終了時の確認コマンドの幅 CONFIRM_WIDTH = 110 # ◆ メニュー画面に「パラメータ振り分け」コマンドを追加する # 追加する場所は、メニューコマンドの最下部です。 # 他の部分に追加したい場合は、?カスタムメニューコマンド? をご利用ください。 USE_MENU_DISTRIBUTE_PARAMETER_COMMAND = true # ◆ メニュー画面の「パラメータ振り分け」コマンドの名称 VOCAB_MENU_DISTRIBUTE_PARAMETER = "灵魂集束" # ◆ 振り分け解除を許可 # true : 振り分け確定後もパラメータを下げ、RP を取り戻せる。 # false : 一度確定したら下げられない。 ENABLE_REVERSE_DISTRIBUTE = true end #============================================================================== # ☆ 設定ここまで - END Setting ☆ #============================================================================== $kms_imported = {} if $kms_imported == nil $kms_imported["DistributeParameter"] = true module KMS_DistributeParameter # 振り分け対象パラメータ PARAMS = [:mhp, :mmp, :atk, :def, :mat, :mdf, :agi, :luk, :hit, :eva, :cri, :skill_speed, :item_speed, :tgr] PARAMS |= [:hit, :eva, :cri, :cev, :mev, :mrf, :cnt, :hrg, :mrg, :trg] PARAMS |= [:tgr, :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, :exr] # パラメータ増加量構造体 GainInfo = Struct.new(:key, :name, :limit, :cost, :cost_rev, :params) ParamInfo = Struct.new(:value, :value_rev) # 振り分け情報構造体 DistInfo = Struct.new(:count, :hp, :mp) #-------------------------------------------------------------------------- # ○ パラメータ増加量を構造体化 #-------------------------------------------------------------------------- def self.create_gain_param_structs(target) result = [] target.each { |v| info = GainInfo.new info.key = v[:key] info.name = v[:name] info.limit = v[:limit] info.cost = v[:cost][0] info.cost_rev = (v[:cost][1] == nil ? 0 : v[:cost][1]) info.params = {} PARAMS.each { |param| next unless v.has_key?(param) pinfo = ParamInfo.new pinfo.value = v[param][0] pinfo.value_rev = (v[param][1] == nil ? 0 : v[param][1]) info.params[param] = pinfo } result << info } return result end #-------------------------------------------------------------------------- # ○ パラメータ増加量を構造体化 (固有増加量用) #-------------------------------------------------------------------------- def self.create_gain_param_structs_for_personal(target) result = [] target.each { |list| next if list == nil result << create_gain_param_structs(list) } return result end #-------------------------------------------------------------------------- # ○ パラメータ増加量を併合 #-------------------------------------------------------------------------- def self.merge(list1, list2) result = list1.clone list2.each { |info2| overwrite = false list1.each_with_index { |info1, i| if info1.key == info2.key result[i] = info2 overwrite = true break end } result << info2 unless overwrite } return result 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 KMS_DistributeParameter::VOCAB_PARAM[:hit] end # 回避率 def self.eva return KMS_DistributeParameter::VOCAB_PARAM[:eva] end # クリティカル率 def self.cri return KMS_DistributeParameter::VOCAB_PARAM[:cri] end # スキル速度補正 def self.skill_speed return KMS_DistributeParameter::VOCAB_PARAM[:skill_speed] end # アイテム速度補正 def self.item_speed return KMS_DistributeParameter::VOCAB_PARAM[:item_speed] end # 狙われやすさ def self.tgr return KMS_DistributeParameter::VOCAB_PARAM[:tgr] end # RP def self.rp return KMS_DistributeParameter::VOCAB_RP end # RP (略) def self.rp_a return KMS_DistributeParameter::VOCAB_RP_A end # パラメータ振り分け def self.distribute_parameter return KMS_DistributeParameter::VOCAB_MENU_DISTRIBUTE_PARAMETER end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # ■ DataManager #============================================================================== module DataManager module_function #-------------------------------------------------------------------------- # ● セーブ内容の展開 #-------------------------------------------------------------------------- class << DataManager unless method_defined?(:extract_save_contents_KMS_DistributeParameter) alias extract_save_contents_KMS_DistributeParameter extract_save_contents end end def extract_save_contents(contents) extract_save_contents_KMS_DistributeParameter(contents) KMS_Commands.check_distribution_values Graphics.frame_reset end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # □ KMS_Commands #============================================================================== module KMS_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 # key : 対象パラメータのキー # num : 振り分け回数 #-------------------------------------------------------------------------- def distribute_param_actor(actor_id, key, num = 1) actor = $game_actors[actor_id] return if actor == nil # 逆加算判定 reverse = false if num < 0 reverse = true num = num.abs end # 適用 num.times { |i| actor.rp_growth_effect(key, reverse) } 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_party.in_battle $game_temp.call_distribute_parameter = true $game_party.menu_actor = $game_party.members[actor_index] end end class Game_Interpreter include KMS_Commands end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # ■ Game_Temp #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :call_distribute_parameter # 振り分け画面呼び出しフラグ attr_accessor :menu_actor_index # 各種メニュー画面用のアクター index #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias initialize_KMS_DistributeParameter initialize def initialize initialize_KMS_DistributeParameter @call_distribute_parameter = false @menu_actor_index = 0 end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # ■ Game_BattlerBase #============================================================================== class Game_BattlerBase #-------------------------------------------------------------------------- # ● 能力値に加算する値をクリア #-------------------------------------------------------------------------- alias clear_param_plus_KMS_DistributeParameter clear_param_plus def clear_param_plus clear_param_plus_KMS_DistributeParameter clear_distribution_values calc_distribution_values end #-------------------------------------------------------------------------- # ○ パラメータ振り分けに関する値をクリア #-------------------------------------------------------------------------- def clear_distribution_values @distributed_count = {} KMS_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 #-------------------------------------------------------------------------- # ○ 振り分けに関する情報を取得 #-------------------------------------------------------------------------- def distribution_info info = KMS_DistributeParameter::DistInfo.new info.count = @distributed_count.clone info.hp = self.hp info.mp = self.mp return info end #-------------------------------------------------------------------------- # ○ 振り分けに関する情報を設定 #-------------------------------------------------------------------------- def set_distribution_info(info) return unless info.is_a?(KMS_DistributeParameter::DistInfo) @distributed_count = info.count calc_distribution_values self.hp = info.hp self.mp = info.mp end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # ■ Game_Action #============================================================================== class Game_Action #-------------------------------------------------------------------------- # ● 行動速度の計算 #-------------------------------------------------------------------------- alias speed_KMS_DistributeParameter speed def speed speed = speed_KMS_DistributeParameter return speed if attack? if item.is_a?(RPG::Skill) && item.speed < 0 n = [subject.distributed_param(:skill_speed), item.speed.abs].min speed += n elsif item.is_a?(RPG::Item) && item.speed < 0 n = [subject.distributed_param(:item_speed), item.speed.abs].min speed += n end return speed end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # ■ Game_Actor #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ○ クラス変数 #-------------------------------------------------------------------------- @@__distribute_gain_params = {} #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor_id : アクター ID #-------------------------------------------------------------------------- alias initialize_KMS_DistributeParameter initialize def initialize(actor_id) @actor_id = actor_id @class_id = actor.class_id initialize_KMS_DistributeParameter(actor_id) end #-------------------------------------------------------------------------- # ○ パラメータ増加量一覧を取得 #-------------------------------------------------------------------------- def gain_parameter_list key = "#{@actor_id}_#{@class_id}" unless @@__distribute_gain_params.has_key?(key) result = KMS_DistributeParameter::GAIN_PARAMS # アクター固有 list = KMS_DistributeParameter::PERSONAL_GAIN_PARAMS[@actor_id] result = KMS_DistributeParameter.merge(result, list) if list != nil # 職業固有 list = KMS_DistributeParameter::CLASS_GAIN_PARAMS[@class_id] result = KMS_DistributeParameter.merge(result, list) if list != nil @@__distribute_gain_params[key] = result end return @@__distribute_gain_params[key] end #-------------------------------------------------------------------------- # ○ パラメータ増加量を取得 # key : 振り分けキー #-------------------------------------------------------------------------- def gain_parameter(key) return gain_parameter_list.find { |v| v.key == key } end #-------------------------------------------------------------------------- # ○ 各種修正値を計算 #-------------------------------------------------------------------------- def calc_distribution_values @rp_cost = 0 @distributed_param = {} KMS_DistributeParameter::PARAMS.each { |param| @distributed_param[param] = 0 } gain_parameter_list.each { |gain| next if gain == nil cost = 0 distributed_count(gain.key).times { |i| cost += Integer(gain.cost + gain.cost_rev * i) gain.params.each { |param, v| @distributed_param[param] += v.value + v.value_rev * i } } @rp_cost += [cost, 0].max } KMS_DistributeParameter::PARAMS.each { |param| @distributed_param[param] = @distributed_param[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 PARAM_SYMBOL = [:mhp, :mmp, :atk, :def, :mat, :mdf, :agi, :luk] XPARAM_SYMBOL = [:hit, :eva, :cri, :cev, :mev, :mrf, :cnt, :hrg, :mrg, :trg] SPARAM_SYMBOL = [:tgr, :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, :exr] #-------------------------------------------------------------------------- # ● 通常能力値の基本値取得 #-------------------------------------------------------------------------- alias param_base_KMS_DistributeParameter param_base def param_base(param_id) n = param_base_KMS_DistributeParameter(param_id) if PARAM_SYMBOL[param_id] != nil n += distributed_param(PARAM_SYMBOL[param_id]) end return Integer(n) end #-------------------------------------------------------------------------- # ● 命中率の取得 #-------------------------------------------------------------------------- alias hit_KMS_DistributeParameter hit def hit n = hit_KMS_DistributeParameter + distributed_param(:hit) return n end #-------------------------------------------------------------------------- # ● 回避率の取得 #-------------------------------------------------------------------------- alias eva_KMS_DistributeParameter eva def eva n = eva_KMS_DistributeParameter + distributed_param(:eva) return n end #-------------------------------------------------------------------------- # ● クリティカル率の取得 #-------------------------------------------------------------------------- alias cri_KMS_DistributeParameter cri def cri n = cri_KMS_DistributeParameter + distributed_param(:cri) return n end #-------------------------------------------------------------------------- # ● 狙われ率の取得 #-------------------------------------------------------------------------- alias tgr_KMS_DistributeParameter tgr def tgr n = tgr_KMS_DistributeParameter + distributed_param(:tgr) return n end #-------------------------------------------------------------------------- # ○ MaxRP の取得 #-------------------------------------------------------------------------- def mrp n = Integer(eval(KMS_DistributeParameter::MAXRP_EXP)) return [n + mrp_plus, 0].max end #-------------------------------------------------------------------------- # ○ MaxRP 補正値の取得 #-------------------------------------------------------------------------- def mrp_plus @mrp_plus = 0 if @mrp_plus == nil return @mrp_plus end #-------------------------------------------------------------------------- # ○ RP の取得 #-------------------------------------------------------------------------- def rp return [mrp - @rp_cost, 0].max end #-------------------------------------------------------------------------- # ○ 振り分け回数の取得 # param : 振り分け先パラメータ (キー) #-------------------------------------------------------------------------- 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) @mrp_plus = mrp_plus + value end #-------------------------------------------------------------------------- # ○ 振り分け回数の増減 # param : 振り分け先パラメータ (キー) # value : 増減量 #-------------------------------------------------------------------------- def gain_distributed_count(param, value = 1) n = distributed_count(param) @distributed_count[param] += value if n.is_a?(Integer) end #-------------------------------------------------------------------------- # ○ RP 振り分けによる成長効果適用 # param : 振り分け先パラメータ (キー) # reverse : 逆加算のときは true #-------------------------------------------------------------------------- def rp_growth_effect(param, reverse = false) gain = gain_parameter(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 : 振り分け先パラメータ (キー) #-------------------------------------------------------------------------- def can_distribute?(param) gain = gain_parameter(param) return false if gain == nil # 無効なパラメータ return false if self.rp < distribute_cost(param) # RP 不足 if gain.limit > 0 return false if gain.limit <= distributed_count(param) # 回数上限 end return true end #-------------------------------------------------------------------------- # ○ パラメータ振り分けコスト計算 # param : 振り分け先パラメータ (キー) #-------------------------------------------------------------------------- def distribute_cost(param) gain = gain_parameter(param) return 0 if gain == nil # 無効なパラメータ n = gain.cost count = distributed_count(param) count = [count, gain.limit - 1].min if gain.limit > 0 n += gain.cost_rev * count return [Integer(n), 0].max end #-------------------------------------------------------------------------- # ○ パラメータ振り分け後の増加量計算 # param : 振り分け先パラメータ (キー) # amt : 振り分け数 #-------------------------------------------------------------------------- def distribute_gain(param, amt = 1) gain = gain_parameter(param) # 無効なパラメータ return 0 if gain == nil result = {} KMS_DistributeParameter::PARAMS.each { |par| result[par] = distributed_param(par) } # 振り分け不可 if amt > 0 return result if gain.limit > 0 && gain.limit == distributed_count(param) else return result if distributed_count(param) + amt < 0 end last_hp = self.hp last_mp = self.mp last_count = distributed_count(param) rp_growth_effect(param) KMS_DistributeParameter::PARAMS.each { |par| result[par] = distributed_param(par) if gain.params.include?(par) } rp_growth_effect(param, true) if last_count < distributed_count(param) self.hp = last_hp self.mp = last_mp return result 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 = KMS_DistributeParameter::GAUGE_START_COLOR return (color.is_a?(Integer) ? text_color(color) : color) end #-------------------------------------------------------------------------- # ○ 振り分けゲージの色 2 の取得 #-------------------------------------------------------------------------- def distribute_gauge_color2 color = KMS_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 = 124) change_color(system_color) draw_text(x, y, 30, line_height, Vocab::rp_a) draw_current_and_max_values(x, y, width, actor.rp, actor.mrp, rp_color(actor), normal_color) change_color(normal_color) end #-------------------------------------------------------------------------- # ○ 振り分けゲージの描画 # actor : アクター # param : パラメータ # x : 描画先 X 座標 # y : 描画先 Y 座標 # width : 幅 #-------------------------------------------------------------------------- def draw_actor_distribute_gauge(actor, param, x, y, width = 124) gain = actor.gain_parameter(param) return if gain == nil || gain.limit <= 0 rate = actor.distributed_count(param) * 1.0 / gain.limit if $kms_imported["GenericGauge"] && KMS_DistributeParameter::ENABLE_GENERIC_GAUGE # 汎用ゲージ draw_generic_gauge(KMS_DistributeParameter::GAUGE_IMAGE, x, y, width, rate, KMS_DistributeParameter::GAUGE_OFFSET, KMS_DistributeParameter::GAUGE_LENGTH, KMS_DistributeParameter::GAUGE_SLOPE) else # デフォルトゲージ gc1 = distribute_gauge_color1 gc2 = distribute_gauge_color2 draw_gauge(x, y, width, rate, gc1, gc2) end end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # ■ Window_MenuCommand #============================================================================== class Window_MenuCommand < Window_Command if KMS_DistributeParameter::USE_MENU_DISTRIBUTE_PARAMETER_COMMAND && !$kms_imported["CustomMenuCommand"] #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- alias make_command_list_KMS_DistributeParameter make_command_list def make_command_list make_command_list_KMS_DistributeParameter add_distribute_parameter_command end end #-------------------------------------------------------------------------- # ○ 振り分けコマンドをリストに追加 #-------------------------------------------------------------------------- def add_distribute_parameter_command add_command(Vocab::distribute_parameter, :distribute_parameter, distribute_parameter_enabled) end #-------------------------------------------------------------------------- # ○ パラメータ振り分けの有効状態を取得 #-------------------------------------------------------------------------- def distribute_parameter_enabled return true end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # □ Window_DistributeParameterActor #------------------------------------------------------------------------------ # 振り分け画面で、アクターの情報を表示するウィンドウです。 #============================================================================== class Window_DistributeParameterActor < Window_Base #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :actor #-------------------------------------------------------------------------- # ● オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, actor) super(x, y, Graphics.width, line_height + 32) @actor = actor refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh 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 #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :actor #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor : アクター #-------------------------------------------------------------------------- def initialize(actor) off_h = line_height + 32 super(0, off_h, 286, Graphics.height - off_h) @actor = actor refresh self.index = 0 end #-------------------------------------------------------------------------- # ○ 選択中のパラメータの Symbol を取得 #-------------------------------------------------------------------------- def parameter_key return @data[self.index] end #-------------------------------------------------------------------------- # ● 項目数の取得 #-------------------------------------------------------------------------- def item_max return @data == nil ? 0 : @data.size end #-------------------------------------------------------------------------- # ● 1 ページに表示できる行数の取得 #-------------------------------------------------------------------------- def page_row_max return super - 1 end #-------------------------------------------------------------------------- # ● 項目を描画する矩形の取得 # index : 項目番号 #-------------------------------------------------------------------------- def item_rect(index) rect = super(index) rect.y += line_height 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 @gain_list = @actor.gain_parameter_list @data = [] @gain_list.each { |gain| @data << gain.key } @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 change_color(system_color) draw_text( 4, 0, 96, line_height, "属性") draw_text(120, 0, 40, line_height, "所需点数", 2) draw_text(170, 0, 80, line_height, "限界", 2) change_color(normal_color) end #-------------------------------------------------------------------------- # ○ 項目の描画 # index : 項目番号 # enabled : 有効フラグ #-------------------------------------------------------------------------- def draw_item(index, enabled = true) rect = item_rect(index) 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 座標 # param : 振り分け先 # enabled : 有効フラグ #-------------------------------------------------------------------------- def draw_parameter(x, y, param, enabled) gain = @gain_list.find { |v| v.key == param } return if gain == nil change_color(normal_color) contents.font.color.alpha = enabled ? 255 : 128 draw_text(x + 4, y, 96, line_height, gain.name) # コスト描画 value = @actor.distribute_cost(param) draw_text(x + 120, y, 40, line_height, value, 2) # 振り分け回数描画 if gain.limit > 0 value = sprintf("%3d/%3d", @actor.distributed_count(param), gain.limit) else value = sprintf("%3d%s", @actor.distributed_count(param), KMS_DistributeParameter::HIDE_MAX_COUNT_INFINITE ? "" : "/---") end draw_actor_distribute_gauge(@actor, param, x + 170, y, 80) draw_text(x + 170, y, 80, line_height, value, 2) change_color(normal_color) end #-------------------------------------------------------------------------- # ● 決定やキャンセルなどのハンドリング処理 #-------------------------------------------------------------------------- def process_handling super call_handler(:increase) if handle?(:increase) && Input.repeat?(:RIGHT) call_handler(:decrease) if handle?(:decrease) && Input.repeat?(:LEFT) call_handler(:up) if handle?(:up) && Input.repeat?(:UP) call_handler(:down) if handle?(:down) && Input.repeat?(:DOWN) end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # □ Window_DistributeParameterStatus #------------------------------------------------------------------------------ # 振り分け画面で、アクターのステータスを表示するウィンドウです。 #============================================================================== class Window_DistributeParameterStatus < Window_Base #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :actor #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor : アクター #-------------------------------------------------------------------------- def initialize(actor) dx = 286 off_h = line_height + 32 super(dx, off_h, Graphics.width - dx, Graphics.height - off_h) @actor = actor refresh(actor.gain_parameter_list[0].key) end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh(param = nil) @distribute_gain = nil if param != nil @distribute_gain = @actor.distribute_gain(param) end contents.clear # change_color(system_color) # draw_text(0, 0, width - 32, line_height, "パラメータ変化", 1) # change_color(normal_color) # # dy = line_height dy = 0 KMS_DistributeParameter::PARAMS.each { |param| draw_parameter(0, dy, param) dy += line_height } end #-------------------------------------------------------------------------- # ○ 能力値の描画 # x : 描画先 X 座標 # y : 描画先 Y 座標 # type : 能力値の種類 #-------------------------------------------------------------------------- def draw_parameter(x, y, type) is_float = false case type when :mhp name = Vocab.hp value = @actor.mhp when :mmp name = Vocab.mp value = @actor.mmp when :atk name = Vocab.param(2) value = @actor.atk when :def name = Vocab.param(3) value = @actor.def when :mat name = Vocab.param(4) value = @actor.mat when :mdf name = Vocab.param(5) value = @actor.mdf when :agi name = Vocab.param(6) value = @actor.agi when :luk name = Vocab.param(7) value = @actor.luk when :hit name = Vocab.hit value = @actor.hit is_float = true when :eva name = Vocab.eva value = @actor.eva is_float = true when :cri name = Vocab.cri value = @actor.cri is_float = true 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 :tgr name = Vocab.tgr value = @actor.tgr is_float = true else return end # パラメータ名 change_color(system_color) draw_text(x + 4, y, 96, line_height, name) change_color(normal_color) draw_text(x + 106, y, 48, line_height, convert_value(value, is_float), 2) return if @distribute_gain == nil # パラメータ変化 draw_text(x + 154, y, 16, line_height, "→", 1) curr = @actor.distributed_param(type) gain = @distribute_gain[type] change_color(gain > curr ? text_color(3) : gain < curr ? text_color(2) : normal_color) new_value = value + (gain - curr) draw_text(x + 174, y, 48, line_height, convert_value(new_value, is_float), 2) change_color(normal_color) end def convert_value(value, is_float) if is_float return sprintf("%.2f", value) else return value.to_i.to_s end end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # □ Window_DistributeParameterConfirm #------------------------------------------------------------------------------ # 振り分け画面で、振り分けの確定/中止を選択するウィンドウです。 #============================================================================== class Window_DistributeParameterConfirm < Window_Command #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width return KMS_DistributeParameter::CONFIRM_WIDTH end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list super add_command(KMS_DistributeParameter::CONFIRM_COMMANDS[0], :decide) add_command(KMS_DistributeParameter::CONFIRM_COMMANDS[1], :stop) add_command(KMS_DistributeParameter::CONFIRM_COMMANDS[2], :cancel) end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help text = index >= 0 ? KMS_DistributeParameter::CONFIRM_COMMAND_HELP[index] : nil @help_window.set_text(text) end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # ■ Scene_Map #============================================================================== class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # ● シーン遷移に関連する更新 #-------------------------------------------------------------------------- alias update_scene_KMS_DistributeParameter update_scene def update_scene update_scene_KMS_DistributeParameter update_call_distribute_parameter unless scene_changing? end #-------------------------------------------------------------------------- # ○ パラメータ振り分け画面呼び出し判定 #-------------------------------------------------------------------------- def update_call_distribute_parameter if $game_temp.call_distribute_parameter && !$game_player.moving? $game_temp.call_distribute_parameter = false call_distribute_parameter end end #-------------------------------------------------------------------------- # ○ パラメータ振り分け画面への切り替え #-------------------------------------------------------------------------- def call_distribute_parameter SceneManager.call(Scene_DistributeParameter) end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # ■ Scene_Menu #============================================================================== class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # ● コマンドウィンドウの作成 #-------------------------------------------------------------------------- alias create_command_window_KMS_DistributeParameter create_command_window def create_command_window create_command_window_KMS_DistributeParameter @command_window.set_handler(:distribute_parameter, method(:command_personal)) end #-------------------------------------------------------------------------- # ○ コマンド [パラメータ振り分け] #-------------------------------------------------------------------------- def command_distribute_parameter SceneManager.call(Scene_DistributeParameter) end #-------------------------------------------------------------------------- # ● 個人コマンド[決定] #-------------------------------------------------------------------------- alias on_personal_ok_KMS_DistributeParameter on_personal_ok def on_personal_ok on_personal_ok_KMS_DistributeParameter if @command_window.current_symbol == :distribute_parameter command_distribute_parameter end end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # □ Scene_DistributeParameter #------------------------------------------------------------------------------ # パラメータ振り分け画面の処理を行うクラスです。 #============================================================================== class Scene_DistributeParameter < Scene_MenuBase #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super @prev_actor = @actor @prev_info = @actor.distribution_info create_help_window create_actor_window create_parameter_window create_status_window create_confirm_window end #-------------------------------------------------------------------------- # ○ アクターウィンドウ作成 #-------------------------------------------------------------------------- def create_actor_window @actor_window = Window_DistributeParameterActor.new(0, 0, @actor) @actor_window.viewport = @viewport end #-------------------------------------------------------------------------- # ○ パラメータリストウィンドウ作成 #-------------------------------------------------------------------------- def create_parameter_window @parameter_window = Window_DistributeParameterList.new(@actor) @parameter_window.viewport = @viewport @parameter_window.activate @parameter_window.set_handler(:ok, method(:on_parameter_ok)) @parameter_window.set_handler(:cancel, method(:on_parameter_cancel)) @parameter_window.set_handler(:increase, method(:on_parameter_increase)) @parameter_window.set_handler(:decrease, method(:on_parameter_decrease)) @parameter_window.set_handler(:down, method(:update_status)) @parameter_window.set_handler(:up, method(:update_status)) @parameter_window.set_handler(:pagedown, method(:next_actor)) @parameter_window.set_handler(:pageup, method(:prev_actor)) end #-------------------------------------------------------------------------- # ○ 振り分けステータスウィンドウ作成 #-------------------------------------------------------------------------- def create_status_window @status_window = Window_DistributeParameterStatus.new(@actor) @status_window.viewport = @viewport @help_window.z = @status_window.z + 100 @help_window.openness = 0 end #-------------------------------------------------------------------------- # ○ 確認ウィンドウ作成 #-------------------------------------------------------------------------- def create_confirm_window @confirm_window = Window_DistributeParameterConfirm.new(0, 0) @confirm_window.x = (Graphics.width - @confirm_window.width) / 2 @confirm_window.y = (Graphics.height - @confirm_window.height) / 2 @confirm_window.z = @help_window.z @confirm_window.viewport = @viewport @confirm_window.help_window = @help_window @confirm_window.openness = 0 @confirm_window.deactivate @confirm_window.set_handler(:decide, method(:on_confirm_decide)) @confirm_window.set_handler(:stop, method(:on_confirm_stop)) @confirm_window.set_handler(:cancel, method(:on_confirm_cancel)) end #-------------------------------------------------------------------------- # ○ ウィンドウ再描画 #-------------------------------------------------------------------------- def refresh_window @actor_window.refresh @parameter_window.refresh @status_window.refresh(@parameter_window.parameter_key) Graphics.frame_reset end #-------------------------------------------------------------------------- # ○ パラメータ選択 [決定] #-------------------------------------------------------------------------- def on_parameter_ok command_confirm end #-------------------------------------------------------------------------- # ○ パラメータ選択 [キャンセル] #-------------------------------------------------------------------------- def on_parameter_cancel command_confirm end #-------------------------------------------------------------------------- # ○ パラメータ選択 [加算] #-------------------------------------------------------------------------- def on_parameter_increase param = @parameter_window.parameter_key unless @actor.can_distribute?(param) Sound.play_buzzer return end Sound.play_cursor @actor.rp_growth_effect(param) refresh_window end #-------------------------------------------------------------------------- # ○ パラメータ選択 [減算] #-------------------------------------------------------------------------- def on_parameter_decrease param = @parameter_window.parameter_key unless reversible?(param) Sound.play_buzzer return end Sound.play_cursor @actor.rp_growth_effect(param, true) refresh_window end #-------------------------------------------------------------------------- # ○ ステータス更新 #-------------------------------------------------------------------------- def update_status @status_window.refresh(@parameter_window.parameter_key) end #-------------------------------------------------------------------------- # ○ 減算可否判定 # param : 対象パラメータ #-------------------------------------------------------------------------- def reversible?(param) return false if @actor.distributed_count(param) == 0 return true if KMS_DistributeParameter::ENABLE_REVERSE_DISTRIBUTE # 前回より減らなければ OK base = @prev_info.count[param] return ( base < @actor.distributed_count(param) ) end #-------------------------------------------------------------------------- # ○ パラメータウィンドウに切り替え #-------------------------------------------------------------------------- def command_parameter @confirm_window.deactivate @confirm_window.close @help_window.close @parameter_window.activate end #-------------------------------------------------------------------------- # ○ 確認ウィンドウに切り替え #-------------------------------------------------------------------------- def command_confirm @status_window.refresh @confirm_window.index = 0 @confirm_window.activate @confirm_window.open @help_window.open @parameter_window.deactivate end #-------------------------------------------------------------------------- # ○ 確認 [確定] #-------------------------------------------------------------------------- def on_confirm_decide return_scene end #-------------------------------------------------------------------------- # ○ 確認 [中止] #-------------------------------------------------------------------------- def on_confirm_stop @actor.set_distribution_info(@prev_info) return_scene end #-------------------------------------------------------------------------- # ○ 確認 [キャンセル] #-------------------------------------------------------------------------- def on_confirm_cancel command_parameter end #-------------------------------------------------------------------------- # ● アクターの切り替え #-------------------------------------------------------------------------- def on_actor_change @prev_actor.set_distribution_info(@prev_info) @prev_info = @actor.distribution_info @prev_actor = @actor @actor_window.actor = @actor @parameter_window.actor = @actor @status_window.actor = @actor @parameter_window.activate refresh_window end end
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ パラメータ振り分け - KMS_DistributeParameter ◆ VXAce ◆
#_/ ◇ Last update : 2012/08/05 (TOMY@Kamesoft) ◇
#_/----------------------------------------------------------------------------
#_/ パラメータ振り分け機能を作成します。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#==============================================================================
# ★ 設定項目 - BEGIN Setting ★
#==============================================================================
module KMS_DistributeParameter
#◆参数分配部位
#分配部位及增加量
# {
#:key=>键,
#:name=>“名称”,
#:limit=>上限次数,
#:cost=>“消费RP,消费RP修正”,
#:参数=>[上升量,上升量修正],
##或更高版本的参数
# },
#格式添加。
#在分配画面中,按添加的顺序显示。
#“键”指定不与其他部位覆盖的名称。
#(用于确定内部的分配位置。数字、字符串等都可以)
#除“次数上限”以外,小数也可以。
#“次数上限”为0时,次数无限制。
#可省略“消耗RP修正”和“上升量修正”。省略时为0。
GAIN_PARAMETER = [
{
:key => :health,
:name => "体力",
:limit => 100,
:cost => [ 1, 0.1],
:mhp => [30, 0.3],
},
{
:key => :magic,
:name => "魔力",
:limit => 100,
:cost => [1, 0.05],
:mat => [2, 0.05],
},
{
:key => :pow,
:name => "力量",
:limit => 100,
:cost => [1, 0.1],
:atk => [4, 0.1],
:mhp => [10, 1]
},
{
:key => :dex,
:name => "防御",
:limit => 100,
:cost => [1, 0.1],
:mdf => [2, 0.5],
:def => [2, 0.5],
:eva => [0.001],
},
{
:key => :SPD,
:name => "敏捷",
:limit => 100,
:cost => [1, 0.05],
:agi => [2, 0.2],
:mdf => [1, 0.1],
:eva => [0.001],
},
{
:key => :luk,
:name => "幸运",
:limit => 20,
:cost => [1],
:luk => [1]
},
{
:key => :hit,
:name => "命中率",
:limit => 20,
:cost => [1, 0.5],
:hit => [0.01],
},
{
:key => :eva,
:name => "回避率",
:limit => 10,
:cost => [1, 0.5],
:eva => [0.01],
},
{
:key => :crt,
:name => "暴击率",
:limit => 10,
:cost => [1, 0.7],
:cri => [0.01],
},
{
:key => :chant,
:name => "詠唱速度",
:limit => 0,
:cost => [1],
:skill_speed => [1],
},
{
:key => :item,
:name => "物品使用速度",
:limit => 0,
:cost => [1],
:item_speed => [1],
},
] # ← この ] は消さないこと!
# ◆ アクター固有のパラメータ増加量
PERSONAL_GAIN_PARAMETER = []
# ここから下に、アクターごとの振り分け時の増加量を
# PERSONAL_GAIN_PARAMETER[アクター ID] = [ 振り分け箇所 ]
# という書式で指定。
# 「振り分け箇所」は GAIN_PARAMETER と同様の書式。
# キーが GAIN_PARAMETER と同じ場合、GAIN_PARAMETER に上書き。
# 指定しなかったパラメータ/アクターは GAIN_PARAMETER を使用。
#
# <例> アクター1の "体力" を個別に指定。
PERSONAL_GAIN_PARAMETER[1] = [
{
:key => :health,
:name => "体力",
:limit => 30,
:cost => [ 1, 0.4],
:mhp => [50, 3],
:def => [ 1, 0.3],
},
]
# ◆ 職業固有のパラメータ増加量
CLASS_GAIN_PARAMETER = []
# ここから下に、職業ごとの振り分け時の増加量を
# CLASS_GAIN_PARAMETER[職業 ID] = [ 振り分け箇所 ]
# という書式で指定。
# その他はアクター固有の設定と同様。
# (優先度は 職業 > アクター > デフォルト)
CLASS_GAIN_PARAMETER[3] = [
{
:key => :health,
:name => "体力",
:limit => 150,
:cost => [ 1, 0.1],
:mhp => [30, 0.3],
},
{
:key => :magic,
:name => "魔力",
:limit => 30,
:cost => [1, 0.05],
:mat => [2, 0.05],
},
{
:key => :pow,
:name => "力量",
:limit => 150,
:cost => [1, 0.1],
:atk => [3, 0.1],
:mhp => [10, 1]
},
{
:key => :dex,
:name => "防御",
:limit => 150,
:cost => [1, 0.1],
:mdf => [2, 0.5],
:def => [2, 0.5],
:eva => [0.001],
},
{
:key => :SPD,
:name => "敏捷",
:limit => 60,
:cost => [1, 0.05],
:agi => [2, 0.2],
:mdf => [1, 0.1],
:eva => [0.001],
},
{
:key => :luk,
:name => "幸运",
:limit => 30,
:cost => [1],
:luk => [1]
},
{
:key => :hit,
:name => "命中率",
:limit => 30,
:cost => [1, 0.5],
:hit => [0.01],
},
{
:key => :eva,
:name => "回避率",
:limit => 0,
:cost => [1, 0.5],
:eva => [0.01],
},
{
:key => :crt,
:name => "暴击率",
:limit => 10,
:cost => [1, 0.7],
:cri => [0.01],
},
{
:key => :chant,
:name => "詠唱速度",
:limit => 0,
:cost => [1],
:skill_speed => [1],
},
{
:key => :item,
:name => "物品使用速度",
:limit => 0,
:cost => [1],
:item_speed => [1],
},
]
CLASS_GAIN_PARAMETER[4] = [
{
:key => :health,
:name => "体力",
:limit => 60,
:cost => [ 1, 0.1],
:mhp => [50, 0.5],
},
{
:key => :magic,
:name => "魔力",
:limit => 20,
:cost => [1, 0.05],
:mat => [2, 0.05],
},
{
:key => :pow,
:name => "力量",
:limit => 100,
:cost => [1, 0.1],
:atk => [2, 0.1],
:mhp => [10, 1]
},
{
:key => :dex,
:name => "防御",
:limit => 60,
:cost => [1, 0.1],
:mdf => [2, 0.5],
:def => [2, 0.5],
:eva => [0.001],
},
{
:key => :SPD,
:name => "敏捷",
:limit => 230,
:cost => [1, 0.05],
:agi => [2, 0.2],
:mdf => [1, 0.1],
:eva => [0.001],
},
{
:key => :luk,
:name => "幸运",
:limit => 40,
:cost => [1],
:luk => [1]
},
{
:key => :hit,
:name => "命中率",
:limit => 40,
:cost => [1, 0.5],
:hit => [0.01],
},
{
:key => :eva,
:name => "回避率",
:limit => 30,
:cost => [1, 0.5],
:eva => [0.01],
},
{
:key => :crt,
:name => "暴击率",
:limit => 30,
:cost => [1, 0.7],
:cri => [0.01],
},
{
:key => :chant,
:name => "詠唱速度",
:limit => 0,
:cost => [1],
:skill_speed => [1],
},
{
:key => :item,
:name => "物品使用速度",
:limit => 0,
:cost => [1],
:item_speed => [1],
},
]
CLASS_GAIN_PARAMETER[5] = [
{
:key => :health,
:name => "体力",
:limit => 100,
:cost => [ 1, 0.1],
:mhp => [30, 0.3],
},
{
:key => :magic,
:name => "魔力",
:limit => 100,
:cost => [1, 0.05],
:mat => [2, 0.05],
},
{
:key => :pow,
:name => "力量",
:limit => 100,
:cost => [1, 0.1],
:atk => [2, 0.1],
:mhp => [10, 1]
},
{
:key => :dex,
:name => "防御",
:limit => 100,
:cost => [1, 0.1],
:mdf => [2, 0.5],
:def => [2, 0.5],
:eva => [0.001],
},
{
:key => :SPD,
:name => "敏捷",
:limit => 100,
:cost => [1, 0.05],
:agi => [2, 0.2],
:mdf => [1, 0.1],
:eva => [0.001],
},
{
:key => :luk,
:name => "幸运",
:limit => 20,
:cost => [1],
:luk => [1]
},
{
:key => :hit,
:name => "命中率",
:limit => 20,
:cost => [1, 0.5],
:hit => [0.01],
},
{
:key => :eva,
:name => "回避率",
:limit => 10,
:cost => [1, 0.5],
:eva => [0.01],
},
{
:key => :crt,
:name => "暴击率",
:limit => 10,
:cost => [1, 0.7],
:cri => [0.01],
},
{
:key => :chant,
:name => "詠唱速度",
:limit => 0,
:cost => [1],
:skill_speed => [1],
},
{
:key => :item,
:name => "物品使用速度",
:limit => 0,
:cost => [1],
:item_speed => [1],
},
]
# ◆ RP (振り分け用ポイント) の名称
VOCAB_RP = "RP"
# ◆ RP の名称 (略)
VOCAB_RP_A = "灵魂"
# ◆ MaxRP 計算式
# level .. レベル
# 結果が小数になってもOK(自動で整数に変換)。
MAXRP_EXP = "5 * level"
# ◆ パラメータ名
# ?拡張装備画面? と併用した場合、下に導入した方を優先。
VOCAB_PARAM = {
:hit => "命中率", # 命中率
:eva => "回避率", # 回避率
:cri => "暴击率", # クリティカル率
:skill_speed => "詠唱速度修正", # スキル速度補正
:item_speed => "物品使用速度修正", # アイテム速度補正
} # ← この } は消さないこと!
# ◆ 振り分け回数が無制限のときは /--- (上限表記) を隠す
# true : 回数のみ表示
# false : 回数/--- と表示
HIDE_MAX_COUNT_INFINITE = false
# ◆ 振り分けゲージの色
# 数値 : \C[n] と同じ色。
# Color : 指定した色。 ( Color.new(255, 128, 128) など )
GAUGE_START_COLOR = 28 # 開始色
GAUGE_END_COLOR = 29 # 終了色
# ◆ 振り分けゲージに汎用ゲージを使用する
# ?汎用ゲージ描画? 導入時のみ有効。
ENABLE_GENERIC_GAUGE = true
# ◆ 振り分け汎用ゲージ設定
# 画像は "Graphics/System" から読み込む。
GAUGE_IMAGE = "GaugeDist" # 画像
GAUGE_OFFSET = [-23, -2] # 位置補正 [x, y]
GAUGE_LENGTH = -4 # 長さ補正
GAUGE_SLOPE = 30 # 傾き (-89 ~ 89)
# ◆ 振り分け終了時の確認コマンド
CONFIRM_COMMANDS = [
" 确定", # 振り分け確定
" 中止", # 振り分け中止
" 取消", # 振り分けを続ける
] # ← この ] は消さないこと!
# ◆ 確認コマンドのヘルプ
CONFIRM_COMMAND_HELP = [
"加点确认", # 振り分け確定
"取消加点", # 振り分け中止
"继续加点", # 振り分けを続ける
] # ← この ] は消さないこと!
# ◆ 振り分け終了時の確認コマンドの幅
CONFIRM_WIDTH = 110
# ◆ メニュー画面に「パラメータ振り分け」コマンドを追加する
# 追加する場所は、メニューコマンドの最下部です。
# 他の部分に追加したい場合は、?カスタムメニューコマンド? をご利用ください。
USE_MENU_DISTRIBUTE_PARAMETER_COMMAND = true
# ◆ メニュー画面の「パラメータ振り分け」コマンドの名称
VOCAB_MENU_DISTRIBUTE_PARAMETER = "灵魂集束"
# ◆ 振り分け解除を許可
# true : 振り分け確定後もパラメータを下げ、RP を取り戻せる。
# false : 一度確定したら下げられない。
ENABLE_REVERSE_DISTRIBUTE = true
end
#==============================================================================
# ☆ 設定ここまで - END Setting ☆
#==============================================================================
$kms_imported = {} if $kms_imported == nil
$kms_imported["DistributeParameter"] = true
module KMS_DistributeParameter
# 振り分け対象パラメータ
PARAMS = [:mhp, :mmp, :atk, :def, :mat, :mdf, :agi, :luk,
:hit, :eva, :cri, :skill_speed, :item_speed, :tgr]
PARAMS |= [:hit, :eva, :cri, :cev, :mev, :mrf, :cnt, :hrg, :mrg, :trg]
PARAMS |= [:tgr, :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, :exr]
# パラメータ増加量構造体
GainInfo = Struct.new(:key, :name, :limit, :cost, :cost_rev, :params)
ParamInfo = Struct.new(:value, :value_rev)
# 振り分け情報構造体
DistInfo = Struct.new(:count, :hp, :mp)
#--------------------------------------------------------------------------
# ○ パラメータ増加量を構造体化
#--------------------------------------------------------------------------
def self.create_gain_param_structs(target)
result = []
target.each { |v|
info = GainInfo.new
info.key = v[:key]
info.name = v[:name]
info.limit = v[:limit]
info.cost = v[:cost][0]
info.cost_rev = (v[:cost][1] == nil ? 0 : v[:cost][1])
info.params = {}
PARAMS.each { |param|
next unless v.has_key?(param)
pinfo = ParamInfo.new
pinfo.value = v[param][0]
pinfo.value_rev = (v[param][1] == nil ? 0 : v[param][1])
info.params[param] = pinfo
}
result << info
}
return result
end
#--------------------------------------------------------------------------
# ○ パラメータ増加量を構造体化 (固有増加量用)
#--------------------------------------------------------------------------
def self.create_gain_param_structs_for_personal(target)
result = []
target.each { |list|
next if list == nil
result << create_gain_param_structs(list)
}
return result
end
#--------------------------------------------------------------------------
# ○ パラメータ増加量を併合
#--------------------------------------------------------------------------
def self.merge(list1, list2)
result = list1.clone
list2.each { |info2|
overwrite = false
list1.each_with_index { |info1, i|
if info1.key == info2.key
result[i] = info2
overwrite = true
break
end
}
result << info2 unless overwrite
}
return result
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 KMS_DistributeParameter::VOCAB_PARAM[:hit]
end
# 回避率
def self.eva
return KMS_DistributeParameter::VOCAB_PARAM[:eva]
end
# クリティカル率
def self.cri
return KMS_DistributeParameter::VOCAB_PARAM[:cri]
end
# スキル速度補正
def self.skill_speed
return KMS_DistributeParameter::VOCAB_PARAM[:skill_speed]
end
# アイテム速度補正
def self.item_speed
return KMS_DistributeParameter::VOCAB_PARAM[:item_speed]
end
# 狙われやすさ
def self.tgr
return KMS_DistributeParameter::VOCAB_PARAM[:tgr]
end
# RP
def self.rp
return KMS_DistributeParameter::VOCAB_RP
end
# RP (略)
def self.rp_a
return KMS_DistributeParameter::VOCAB_RP_A
end
# パラメータ振り分け
def self.distribute_parameter
return KMS_DistributeParameter::VOCAB_MENU_DISTRIBUTE_PARAMETER
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
module_function
#--------------------------------------------------------------------------
# ● セーブ内容の展開
#--------------------------------------------------------------------------
class << DataManager
unless method_defined?(:extract_save_contents_KMS_DistributeParameter)
alias extract_save_contents_KMS_DistributeParameter extract_save_contents
end
end
def extract_save_contents(contents)
extract_save_contents_KMS_DistributeParameter(contents)
KMS_Commands.check_distribution_values
Graphics.frame_reset
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ KMS_Commands
#==============================================================================
module KMS_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
# key : 対象パラメータのキー
# num : 振り分け回数
#--------------------------------------------------------------------------
def distribute_param_actor(actor_id, key, num = 1)
actor = $game_actors[actor_id]
return if actor == nil
# 逆加算判定
reverse = false
if num < 0
reverse = true
num = num.abs
end
# 適用
num.times { |i| actor.rp_growth_effect(key, reverse) }
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_party.in_battle
$game_temp.call_distribute_parameter = true
$game_party.menu_actor = $game_party.members[actor_index]
end
end
class Game_Interpreter
include KMS_Commands
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :call_distribute_parameter # 振り分け画面呼び出しフラグ
attr_accessor :menu_actor_index # 各種メニュー画面用のアクター index
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KMS_DistributeParameter initialize
def initialize
initialize_KMS_DistributeParameter
@call_distribute_parameter = false
@menu_actor_index = 0
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# ● 能力値に加算する値をクリア
#--------------------------------------------------------------------------
alias clear_param_plus_KMS_DistributeParameter clear_param_plus
def clear_param_plus
clear_param_plus_KMS_DistributeParameter
clear_distribution_values
calc_distribution_values
end
#--------------------------------------------------------------------------
# ○ パラメータ振り分けに関する値をクリア
#--------------------------------------------------------------------------
def clear_distribution_values
@distributed_count = {}
KMS_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
#--------------------------------------------------------------------------
# ○ 振り分けに関する情報を取得
#--------------------------------------------------------------------------
def distribution_info
info = KMS_DistributeParameter::DistInfo.new
info.count = @distributed_count.clone
info.hp = self.hp
info.mp = self.mp
return info
end
#--------------------------------------------------------------------------
# ○ 振り分けに関する情報を設定
#--------------------------------------------------------------------------
def set_distribution_info(info)
return unless info.is_a?(KMS_DistributeParameter::DistInfo)
@distributed_count = info.count
calc_distribution_values
self.hp = info.hp
self.mp = info.mp
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Action
#==============================================================================
class Game_Action
#--------------------------------------------------------------------------
# ● 行動速度の計算
#--------------------------------------------------------------------------
alias speed_KMS_DistributeParameter speed
def speed
speed = speed_KMS_DistributeParameter
return speed if attack?
if item.is_a?(RPG::Skill) && item.speed < 0
n = [subject.distributed_param(:skill_speed), item.speed.abs].min
speed += n
elsif item.is_a?(RPG::Item) && item.speed < 0
n = [subject.distributed_param(:item_speed), item.speed.abs].min
speed += n
end
return speed
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ○ クラス変数
#--------------------------------------------------------------------------
@@__distribute_gain_params = {}
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor_id : アクター ID
#--------------------------------------------------------------------------
alias initialize_KMS_DistributeParameter initialize
def initialize(actor_id)
@actor_id = actor_id
@class_id = actor.class_id
initialize_KMS_DistributeParameter(actor_id)
end
#--------------------------------------------------------------------------
# ○ パラメータ増加量一覧を取得
#--------------------------------------------------------------------------
def gain_parameter_list
key = "#{@actor_id}_#{@class_id}"
unless @@__distribute_gain_params.has_key?(key)
result = KMS_DistributeParameter::GAIN_PARAMS
# アクター固有
list = KMS_DistributeParameter::PERSONAL_GAIN_PARAMS[@actor_id]
result = KMS_DistributeParameter.merge(result, list) if list != nil
# 職業固有
list = KMS_DistributeParameter::CLASS_GAIN_PARAMS[@class_id]
result = KMS_DistributeParameter.merge(result, list) if list != nil
@@__distribute_gain_params[key] = result
end
return @@__distribute_gain_params[key]
end
#--------------------------------------------------------------------------
# ○ パラメータ増加量を取得
# key : 振り分けキー
#--------------------------------------------------------------------------
def gain_parameter(key)
return gain_parameter_list.find { |v| v.key == key }
end
#--------------------------------------------------------------------------
# ○ 各種修正値を計算
#--------------------------------------------------------------------------
def calc_distribution_values
@rp_cost = 0
@distributed_param = {}
KMS_DistributeParameter::PARAMS.each { |param|
@distributed_param[param] = 0
}
gain_parameter_list.each { |gain|
next if gain == nil
cost = 0
distributed_count(gain.key).times { |i|
cost += Integer(gain.cost + gain.cost_rev * i)
gain.params.each { |param, v|
@distributed_param[param] += v.value + v.value_rev * i
}
}
@rp_cost += [cost, 0].max
}
KMS_DistributeParameter::PARAMS.each { |param|
@distributed_param[param] = @distributed_param[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
PARAM_SYMBOL = [:mhp, :mmp, :atk, :def, :mat, :mdf, :agi, :luk]
XPARAM_SYMBOL = [:hit, :eva, :cri, :cev, :mev, :mrf, :cnt, :hrg, :mrg, :trg]
SPARAM_SYMBOL = [:tgr, :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, :exr]
#--------------------------------------------------------------------------
# ● 通常能力値の基本値取得
#--------------------------------------------------------------------------
alias param_base_KMS_DistributeParameter param_base
def param_base(param_id)
n = param_base_KMS_DistributeParameter(param_id)
if PARAM_SYMBOL[param_id] != nil
n += distributed_param(PARAM_SYMBOL[param_id])
end
return Integer(n)
end
#--------------------------------------------------------------------------
# ● 命中率の取得
#--------------------------------------------------------------------------
alias hit_KMS_DistributeParameter hit
def hit
n = hit_KMS_DistributeParameter + distributed_param(:hit)
return n
end
#--------------------------------------------------------------------------
# ● 回避率の取得
#--------------------------------------------------------------------------
alias eva_KMS_DistributeParameter eva
def eva
n = eva_KMS_DistributeParameter + distributed_param(:eva)
return n
end
#--------------------------------------------------------------------------
# ● クリティカル率の取得
#--------------------------------------------------------------------------
alias cri_KMS_DistributeParameter cri
def cri
n = cri_KMS_DistributeParameter + distributed_param(:cri)
return n
end
#--------------------------------------------------------------------------
# ● 狙われ率の取得
#--------------------------------------------------------------------------
alias tgr_KMS_DistributeParameter tgr
def tgr
n = tgr_KMS_DistributeParameter + distributed_param(:tgr)
return n
end
#--------------------------------------------------------------------------
# ○ MaxRP の取得
#--------------------------------------------------------------------------
def mrp
n = Integer(eval(KMS_DistributeParameter::MAXRP_EXP))
return [n + mrp_plus, 0].max
end
#--------------------------------------------------------------------------
# ○ MaxRP 補正値の取得
#--------------------------------------------------------------------------
def mrp_plus
@mrp_plus = 0 if @mrp_plus == nil
return @mrp_plus
end
#--------------------------------------------------------------------------
# ○ RP の取得
#--------------------------------------------------------------------------
def rp
return [mrp - @rp_cost, 0].max
end
#--------------------------------------------------------------------------
# ○ 振り分け回数の取得
# param : 振り分け先パラメータ (キー)
#--------------------------------------------------------------------------
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)
@mrp_plus = mrp_plus + value
end
#--------------------------------------------------------------------------
# ○ 振り分け回数の増減
# param : 振り分け先パラメータ (キー)
# value : 増減量
#--------------------------------------------------------------------------
def gain_distributed_count(param, value = 1)
n = distributed_count(param)
@distributed_count[param] += value if n.is_a?(Integer)
end
#--------------------------------------------------------------------------
# ○ RP 振り分けによる成長効果適用
# param : 振り分け先パラメータ (キー)
# reverse : 逆加算のときは true
#--------------------------------------------------------------------------
def rp_growth_effect(param, reverse = false)
gain = gain_parameter(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 : 振り分け先パラメータ (キー)
#--------------------------------------------------------------------------
def can_distribute?(param)
gain = gain_parameter(param)
return false if gain == nil # 無効なパラメータ
return false if self.rp < distribute_cost(param) # RP 不足
if gain.limit > 0
return false if gain.limit <= distributed_count(param) # 回数上限
end
return true
end
#--------------------------------------------------------------------------
# ○ パラメータ振り分けコスト計算
# param : 振り分け先パラメータ (キー)
#--------------------------------------------------------------------------
def distribute_cost(param)
gain = gain_parameter(param)
return 0 if gain == nil # 無効なパラメータ
n = gain.cost
count = distributed_count(param)
count = [count, gain.limit - 1].min if gain.limit > 0
n += gain.cost_rev * count
return [Integer(n), 0].max
end
#--------------------------------------------------------------------------
# ○ パラメータ振り分け後の増加量計算
# param : 振り分け先パラメータ (キー)
# amt : 振り分け数
#--------------------------------------------------------------------------
def distribute_gain(param, amt = 1)
gain = gain_parameter(param)
# 無効なパラメータ
return 0 if gain == nil
result = {}
KMS_DistributeParameter::PARAMS.each { |par|
result[par] = distributed_param(par)
}
# 振り分け不可
if amt > 0
return result if gain.limit > 0 && gain.limit == distributed_count(param)
else
return result if distributed_count(param) + amt < 0
end
last_hp = self.hp
last_mp = self.mp
last_count = distributed_count(param)
rp_growth_effect(param)
KMS_DistributeParameter::PARAMS.each { |par|
result[par] = distributed_param(par) if gain.params.include?(par)
}
rp_growth_effect(param, true) if last_count < distributed_count(param)
self.hp = last_hp
self.mp = last_mp
return result
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 = KMS_DistributeParameter::GAUGE_START_COLOR
return (color.is_a?(Integer) ? text_color(color) : color)
end
#--------------------------------------------------------------------------
# ○ 振り分けゲージの色 2 の取得
#--------------------------------------------------------------------------
def distribute_gauge_color2
color = KMS_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 = 124)
change_color(system_color)
draw_text(x, y, 30, line_height, Vocab::rp_a)
draw_current_and_max_values(x, y, width, actor.rp, actor.mrp,
rp_color(actor), normal_color)
change_color(normal_color)
end
#--------------------------------------------------------------------------
# ○ 振り分けゲージの描画
# actor : アクター
# param : パラメータ
# x : 描画先 X 座標
# y : 描画先 Y 座標
# width : 幅
#--------------------------------------------------------------------------
def draw_actor_distribute_gauge(actor, param, x, y, width = 124)
gain = actor.gain_parameter(param)
return if gain == nil || gain.limit <= 0
rate = actor.distributed_count(param) * 1.0 / gain.limit
if $kms_imported["GenericGauge"] &&
KMS_DistributeParameter::ENABLE_GENERIC_GAUGE
# 汎用ゲージ
draw_generic_gauge(KMS_DistributeParameter::GAUGE_IMAGE,
x, y, width, rate,
KMS_DistributeParameter::GAUGE_OFFSET,
KMS_DistributeParameter::GAUGE_LENGTH,
KMS_DistributeParameter::GAUGE_SLOPE)
else
# デフォルトゲージ
gc1 = distribute_gauge_color1
gc2 = distribute_gauge_color2
draw_gauge(x, y, width, rate, gc1, gc2)
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Command
if KMS_DistributeParameter::USE_MENU_DISTRIBUTE_PARAMETER_COMMAND &&
!$kms_imported["CustomMenuCommand"]
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
alias make_command_list_KMS_DistributeParameter make_command_list
def make_command_list
make_command_list_KMS_DistributeParameter
add_distribute_parameter_command
end
end
#--------------------------------------------------------------------------
# ○ 振り分けコマンドをリストに追加
#--------------------------------------------------------------------------
def add_distribute_parameter_command
add_command(Vocab::distribute_parameter,
:distribute_parameter,
distribute_parameter_enabled)
end
#--------------------------------------------------------------------------
# ○ パラメータ振り分けの有効状態を取得
#--------------------------------------------------------------------------
def distribute_parameter_enabled
return true
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ Window_DistributeParameterActor
#------------------------------------------------------------------------------
# 振り分け画面で、アクターの情報を表示するウィンドウです。
#==============================================================================
class Window_DistributeParameterActor < Window_Base
#--------------------------------------------------------------------------
# ○ 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :actor
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# x : ウィンドウの X 座標
# y : ウィンドウの Y 座標
# actor : アクター
#--------------------------------------------------------------------------
def initialize(x, y, actor)
super(x, y, Graphics.width, line_height + 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
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
#--------------------------------------------------------------------------
# ○ 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :actor
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
#--------------------------------------------------------------------------
def initialize(actor)
off_h = line_height + 32
super(0, off_h, 286, Graphics.height - off_h)
@actor = actor
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ○ 選択中のパラメータの Symbol を取得
#--------------------------------------------------------------------------
def parameter_key
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 項目数の取得
#--------------------------------------------------------------------------
def item_max
return @data == nil ? 0 : @data.size
end
#--------------------------------------------------------------------------
# ● 1 ページに表示できる行数の取得
#--------------------------------------------------------------------------
def page_row_max
return super - 1
end
#--------------------------------------------------------------------------
# ● 項目を描画する矩形の取得
# index : 項目番号
#--------------------------------------------------------------------------
def item_rect(index)
rect = super(index)
rect.y += line_height
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
@gain_list = @actor.gain_parameter_list
@data = []
@gain_list.each { |gain| @data << gain.key }
@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
change_color(system_color)
draw_text( 4, 0, 96, line_height, "属性")
draw_text(120, 0, 40, line_height, "所需点数", 2)
draw_text(170, 0, 80, line_height, "限界", 2)
change_color(normal_color)
end
#--------------------------------------------------------------------------
# ○ 項目の描画
# index : 項目番号
# enabled : 有効フラグ
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
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 座標
# param : 振り分け先
# enabled : 有効フラグ
#--------------------------------------------------------------------------
def draw_parameter(x, y, param, enabled)
gain = @gain_list.find { |v| v.key == param }
return if gain == nil
change_color(normal_color)
contents.font.color.alpha = enabled ? 255 : 128
draw_text(x + 4, y, 96, line_height, gain.name)
# コスト描画
value = @actor.distribute_cost(param)
draw_text(x + 120, y, 40, line_height, value, 2)
# 振り分け回数描画
if gain.limit > 0
value = sprintf("%3d/%3d", @actor.distributed_count(param), gain.limit)
else
value = sprintf("%3d%s", @actor.distributed_count(param),
KMS_DistributeParameter::HIDE_MAX_COUNT_INFINITE ? "" : "/---")
end
draw_actor_distribute_gauge(@actor, param, x + 170, y, 80)
draw_text(x + 170, y, 80, line_height, value, 2)
change_color(normal_color)
end
#--------------------------------------------------------------------------
# ● 決定やキャンセルなどのハンドリング処理
#--------------------------------------------------------------------------
def process_handling
super
call_handler(:increase) if handle?(:increase) && Input.repeat?(:RIGHT)
call_handler(:decrease) if handle?(:decrease) && Input.repeat?(:LEFT)
call_handler(:up) if handle?(:up) && Input.repeat?(:UP)
call_handler(:down) if handle?(:down) && Input.repeat?(:DOWN)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ Window_DistributeParameterStatus
#------------------------------------------------------------------------------
# 振り分け画面で、アクターのステータスを表示するウィンドウです。
#==============================================================================
class Window_DistributeParameterStatus < Window_Base
#--------------------------------------------------------------------------
# ○ 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :actor
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
#--------------------------------------------------------------------------
def initialize(actor)
dx = 286
off_h = line_height + 32
super(dx, off_h, Graphics.width - dx, Graphics.height - off_h)
@actor = actor
refresh(actor.gain_parameter_list[0].key)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(param = nil)
@distribute_gain = nil
if param != nil
@distribute_gain = @actor.distribute_gain(param)
end
contents.clear
# change_color(system_color)
# draw_text(0, 0, width - 32, line_height, "パラメータ変化", 1)
# change_color(normal_color)
#
# dy = line_height
dy = 0
KMS_DistributeParameter::PARAMS.each { |param|
draw_parameter(0, dy, param)
dy += line_height
}
end
#--------------------------------------------------------------------------
# ○ 能力値の描画
# x : 描画先 X 座標
# y : 描画先 Y 座標
# type : 能力値の種類
#--------------------------------------------------------------------------
def draw_parameter(x, y, type)
is_float = false
case type
when :mhp
name = Vocab.hp
value = @actor.mhp
when :mmp
name = Vocab.mp
value = @actor.mmp
when :atk
name = Vocab.param(2)
value = @actor.atk
when :def
name = Vocab.param(3)
value = @actor.def
when :mat
name = Vocab.param(4)
value = @actor.mat
when :mdf
name = Vocab.param(5)
value = @actor.mdf
when :agi
name = Vocab.param(6)
value = @actor.agi
when :luk
name = Vocab.param(7)
value = @actor.luk
when :hit
name = Vocab.hit
value = @actor.hit
is_float = true
when :eva
name = Vocab.eva
value = @actor.eva
is_float = true
when :cri
name = Vocab.cri
value = @actor.cri
is_float = true
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 :tgr
name = Vocab.tgr
value = @actor.tgr
is_float = true
else
return
end
# パラメータ名
change_color(system_color)
draw_text(x + 4, y, 96, line_height, name)
change_color(normal_color)
draw_text(x + 106, y, 48, line_height, convert_value(value, is_float), 2)
return if @distribute_gain == nil
# パラメータ変化
draw_text(x + 154, y, 16, line_height, "→", 1)
curr = @actor.distributed_param(type)
gain = @distribute_gain[type]
change_color(gain > curr ? text_color(3) : gain < curr ?
text_color(2) : normal_color)
new_value = value + (gain - curr)
draw_text(x + 174, y, 48, line_height, convert_value(new_value, is_float), 2)
change_color(normal_color)
end
def convert_value(value, is_float)
if is_float
return sprintf("%.2f", value)
else
return value.to_i.to_s
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ Window_DistributeParameterConfirm
#------------------------------------------------------------------------------
# 振り分け画面で、振り分けの確定/中止を選択するウィンドウです。
#==============================================================================
class Window_DistributeParameterConfirm < Window_Command
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
return KMS_DistributeParameter::CONFIRM_WIDTH
end
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
super
add_command(KMS_DistributeParameter::CONFIRM_COMMANDS[0], :decide)
add_command(KMS_DistributeParameter::CONFIRM_COMMANDS[1], :stop)
add_command(KMS_DistributeParameter::CONFIRM_COMMANDS[2], :cancel)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
text = index >= 0 ? KMS_DistributeParameter::CONFIRM_COMMAND_HELP[index] : nil
@help_window.set_text(text)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● シーン遷移に関連する更新
#--------------------------------------------------------------------------
alias update_scene_KMS_DistributeParameter update_scene
def update_scene
update_scene_KMS_DistributeParameter
update_call_distribute_parameter unless scene_changing?
end
#--------------------------------------------------------------------------
# ○ パラメータ振り分け画面呼び出し判定
#--------------------------------------------------------------------------
def update_call_distribute_parameter
if $game_temp.call_distribute_parameter && !$game_player.moving?
$game_temp.call_distribute_parameter = false
call_distribute_parameter
end
end
#--------------------------------------------------------------------------
# ○ パラメータ振り分け画面への切り替え
#--------------------------------------------------------------------------
def call_distribute_parameter
SceneManager.call(Scene_DistributeParameter)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# ● コマンドウィンドウの作成
#--------------------------------------------------------------------------
alias create_command_window_KMS_DistributeParameter create_command_window
def create_command_window
create_command_window_KMS_DistributeParameter
@command_window.set_handler(:distribute_parameter, method(:command_personal))
end
#--------------------------------------------------------------------------
# ○ コマンド [パラメータ振り分け]
#--------------------------------------------------------------------------
def command_distribute_parameter
SceneManager.call(Scene_DistributeParameter)
end
#--------------------------------------------------------------------------
# ● 個人コマンド[決定]
#--------------------------------------------------------------------------
alias on_personal_ok_KMS_DistributeParameter on_personal_ok
def on_personal_ok
on_personal_ok_KMS_DistributeParameter
if @command_window.current_symbol == :distribute_parameter
command_distribute_parameter
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ Scene_DistributeParameter
#------------------------------------------------------------------------------
# パラメータ振り分け画面の処理を行うクラスです。
#==============================================================================
class Scene_DistributeParameter < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
@prev_actor = @actor
@prev_info = @actor.distribution_info
create_help_window
create_actor_window
create_parameter_window
create_status_window
create_confirm_window
end
#--------------------------------------------------------------------------
# ○ アクターウィンドウ作成
#--------------------------------------------------------------------------
def create_actor_window
@actor_window = Window_DistributeParameterActor.new(0, 0, @actor)
@actor_window.viewport = @viewport
end
#--------------------------------------------------------------------------
# ○ パラメータリストウィンドウ作成
#--------------------------------------------------------------------------
def create_parameter_window
@parameter_window = Window_DistributeParameterList.new(@actor)
@parameter_window.viewport = @viewport
@parameter_window.activate
@parameter_window.set_handler(:ok, method(:on_parameter_ok))
@parameter_window.set_handler(:cancel, method(:on_parameter_cancel))
@parameter_window.set_handler(:increase, method(:on_parameter_increase))
@parameter_window.set_handler(:decrease, method(:on_parameter_decrease))
@parameter_window.set_handler(:down, method(:update_status))
@parameter_window.set_handler(:up, method(:update_status))
@parameter_window.set_handler(:pagedown, method(:next_actor))
@parameter_window.set_handler(:pageup, method(:prev_actor))
end
#--------------------------------------------------------------------------
# ○ 振り分けステータスウィンドウ作成
#--------------------------------------------------------------------------
def create_status_window
@status_window = Window_DistributeParameterStatus.new(@actor)
@status_window.viewport = @viewport
@help_window.z = @status_window.z + 100
@help_window.openness = 0
end
#--------------------------------------------------------------------------
# ○ 確認ウィンドウ作成
#--------------------------------------------------------------------------
def create_confirm_window
@confirm_window = Window_DistributeParameterConfirm.new(0, 0)
@confirm_window.x = (Graphics.width - @confirm_window.width) / 2
@confirm_window.y = (Graphics.height - @confirm_window.height) / 2
@confirm_window.z = @help_window.z
@confirm_window.viewport = @viewport
@confirm_window.help_window = @help_window
@confirm_window.openness = 0
@confirm_window.deactivate
@confirm_window.set_handler(:decide, method(:on_confirm_decide))
@confirm_window.set_handler(:stop, method(:on_confirm_stop))
@confirm_window.set_handler(:cancel, method(:on_confirm_cancel))
end
#--------------------------------------------------------------------------
# ○ ウィンドウ再描画
#--------------------------------------------------------------------------
def refresh_window
@actor_window.refresh
@parameter_window.refresh
@status_window.refresh(@parameter_window.parameter_key)
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ○ パラメータ選択 [決定]
#--------------------------------------------------------------------------
def on_parameter_ok
command_confirm
end
#--------------------------------------------------------------------------
# ○ パラメータ選択 [キャンセル]
#--------------------------------------------------------------------------
def on_parameter_cancel
command_confirm
end
#--------------------------------------------------------------------------
# ○ パラメータ選択 [加算]
#--------------------------------------------------------------------------
def on_parameter_increase
param = @parameter_window.parameter_key
unless @actor.can_distribute?(param)
Sound.play_buzzer
return
end
Sound.play_cursor
@actor.rp_growth_effect(param)
refresh_window
end
#--------------------------------------------------------------------------
# ○ パラメータ選択 [減算]
#--------------------------------------------------------------------------
def on_parameter_decrease
param = @parameter_window.parameter_key
unless reversible?(param)
Sound.play_buzzer
return
end
Sound.play_cursor
@actor.rp_growth_effect(param, true)
refresh_window
end
#--------------------------------------------------------------------------
# ○ ステータス更新
#--------------------------------------------------------------------------
def update_status
@status_window.refresh(@parameter_window.parameter_key)
end
#--------------------------------------------------------------------------
# ○ 減算可否判定
# param : 対象パラメータ
#--------------------------------------------------------------------------
def reversible?(param)
return false if @actor.distributed_count(param) == 0
return true if KMS_DistributeParameter::ENABLE_REVERSE_DISTRIBUTE
# 前回より減らなければ OK
base = @prev_info.count[param]
return ( base < @actor.distributed_count(param) )
end
#--------------------------------------------------------------------------
# ○ パラメータウィンドウに切り替え
#--------------------------------------------------------------------------
def command_parameter
@confirm_window.deactivate
@confirm_window.close
@help_window.close
@parameter_window.activate
end
#--------------------------------------------------------------------------
# ○ 確認ウィンドウに切り替え
#--------------------------------------------------------------------------
def command_confirm
@status_window.refresh
@confirm_window.index = 0
@confirm_window.activate
@confirm_window.open
@help_window.open
@parameter_window.deactivate
end
#--------------------------------------------------------------------------
# ○ 確認 [確定]
#--------------------------------------------------------------------------
def on_confirm_decide
return_scene
end
#--------------------------------------------------------------------------
# ○ 確認 [中止]
#--------------------------------------------------------------------------
def on_confirm_stop
@actor.set_distribution_info(@prev_info)
return_scene
end
#--------------------------------------------------------------------------
# ○ 確認 [キャンセル]
#--------------------------------------------------------------------------
def on_confirm_cancel
command_parameter
end
#--------------------------------------------------------------------------
# ● アクターの切り替え
#--------------------------------------------------------------------------
def on_actor_change
@prev_actor.set_distribution_info(@prev_info)
@prev_info = @actor.distribution_info
@prev_actor = @actor
@actor_window.actor = @actor
@parameter_window.actor = @actor
@status_window.actor = @actor
@parameter_window.activate
refresh_window
end
end
|
|