设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 226|回复: 0
打印 上一主题 下一主题

[有事请教] ACE速度加点没反应,脚本附工程,麻烦大佬谢谢

[复制链接]

Lv2.观梦者

梦石
0
星屑
791
在线时间
71 小时
注册时间
2023-12-26
帖子
105
跳转到指定楼层
1
发表于 2024-2-20 09:30:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
ACE速度加点没反应,脚本附工程,麻烦大佬谢谢
RUBY 代码复制
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆ パラメータ振り分け - KMS_DistributeParameter ◆ VXAce ◆
  3. #_/    ◇ Last update : 2012/08/05 (TOMY@Kamesoft) ◇
  4. #_/----------------------------------------------------------------------------
  5. #_/  パラメータ振り分け機能を作成します。
  6. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  7.  
  8. #==============================================================================
  9. # ★ 設定項目 - BEGIN Setting ★
  10. #==============================================================================
  11.  
  12. module KMS_DistributeParameter
  13.   # ◆ パラメータ振り分け箇所
  14.   #  振り分け箇所および増加量を
  15.   #   {
  16.   #     :key        => キー,
  17.   #     :name       => "名称",
  18.   #     :limit      => 回数上限,
  19.   #     :cost       => [消費 RP, 消費 RP 補正],
  20.   #     :パラメータ => [上昇量, 上昇量補正],
  21.   #     # 以降、パラメータを必要なだけ記述
  22.   #   },
  23.   #  という書式で追加。
  24.   #  振り分け画面では、追加した順に表示。
  25.   #  「キー」には、他の箇所と被らない名称を指定。
  26.   #  (内部で振り分け箇所を特定するために使用。数値、文字列など何でもOK)
  27.   #  「回数上限」以外は小数でもOK。
  28.   #  「回数上限」を 0 にすると回数無制限。
  29.   #  「消費 RP 補正」と「上昇量補正」は省略可。省略時は 0。
  30.   GAIN_PARAMETER = [
  31.     {
  32.       :key   => :health,
  33.       :name  => "生命",
  34.       :limit => 99,
  35.       :cost  => [ 1, 0.4],
  36.       :mhp   => [3],
  37.     },
  38.     {
  39.       :key   => :magic,
  40.       :name  => "能量",
  41.       :limit => 99,
  42.       :cost  => [1, 0.4],
  43.       :mmp   => [2],
  44.     },
  45.     {
  46.       :key   => :pow,
  47.       :name  => "攻击",
  48.       :limit => 99,
  49.       :cost  => [1, 0.4],
  50.       :atk   => [2],
  51.     },
  52.     {
  53.       :key   => :def,
  54.       :name  => "防御",
  55.       :limit => 99,
  56.       :cost  => [1, 0.4],
  57.       :def   => [1],
  58.     },
  59.     {
  60.       :key   => :dex,
  61.       :name  => "速度",
  62.       :limit => 99,
  63.       :cost  => [1, 0.4],
  64.       :agi   => [2],
  65.     },
  66.     {
  67.       :key   => :hit,
  68.       :name  => "命中",
  69.       :limit => 99,
  70.       :cost  => [1, 0.5],
  71.       :hit   => [0.01],
  72.     },
  73.     {
  74.       :key   => :eva,
  75.       :name  => "闪避",
  76.       :limit => 99,
  77.       :cost  => [1, 0.5],
  78.       :eva   => [0.005],  #0.01
  79.     },
  80.     {
  81.       :key   => :crt,
  82.       :name  => "暴击",
  83.       :limit => 99,
  84.       :cost  => [1, 0.6],
  85.       :cri   => [0.01],
  86.    # },
  87.    # {
  88.    #   :key         => :chant,
  89.    #   :name        => "詠唱速度",
  90.    #   :limit       => 0,
  91.     #  :cost        => [1, 0.5],
  92.     #  :skill_speed => [1],
  93.    # },
  94.    # {
  95.     #  :key        => :item,
  96.     #  :name       => "アイテム速度",
  97.     #  :limit      => 0,
  98.      # :cost       => [1, 0.5],
  99.      # :item_speed => [1],
  100.    # },
  101.    # {
  102.    #   :key   => :tgr,
  103.     #  :name  => "狙われやすさ",
  104.     #  :limit => 5,
  105.     #  :cost  => [1],
  106.     #  :tgr   => [0.2],
  107.     }
  108.   ]  # ← この ] は消さないこと!
  109.  
  110.   # ◆ アクター固有のパラメータ増加量
  111.   PERSONAL_GAIN_PARAMETER = []
  112.   #  ここから下に、アクターごとの振り分け時の増加量を
  113.   #   PERSONAL_GAIN_PARAMETER[アクター ID] = [ 振り分け箇所 ]
  114.   #  という書式で指定。
  115.   #  「振り分け箇所」は GAIN_PARAMETER と同様の書式。
  116.   #  キーが GAIN_PARAMETER と同じ場合、GAIN_PARAMETER に上書き。
  117.   #  指定しなかったパラメータ/アクターは GAIN_PARAMETER を使用。
  118.   #
  119.   # <例> アクター1の "体力" を個別に指定。
  120. # PERSONAL_GAIN_PARAMETER[1] = [
  121.   #  {
  122.   #    :key   => :health,
  123.   #    :name  => "体力",
  124.   # #   :limit => 30,
  125. #      :cost  => [ 1, 0.4],
  126.   #    :mhp   => [50, 3],
  127.   #    :def   => [ 1, 0.3],
  128.   #  },
  129. # ]
  130.  
  131.   # ◆ 職業固有のパラメータ増加量
  132.   CLASS_GAIN_PARAMETER = []
  133.   #  ここから下に、職業ごとの振り分け時の増加量を
  134.   #   CLASS_GAIN_PARAMETER[職業 ID] = [ 振り分け箇所 ]
  135.   #  という書式で指定。
  136.   #  その他はアクター固有の設定と同様。
  137.   #  (優先度は  職業 > アクター > デフォルト)
  138.  
  139.   # ◆ RP (振り分け用ポイント) の名称
  140.   VOCAB_RP   = "点"
  141.   # ◆ RP の名称 (略)
  142.   VOCAB_RP_A = "赋点"
  143.  
  144.   # ◆ MaxRP 計算式
  145.   #   level .. レベル
  146.   #  結果が小数になってもOK(自動で整数に変換)。
  147.   MAXRP_EXP = "(level ** 0.25 + 2.0) * level"
  148.  
  149.   # ◆ パラメータ名
  150.   #  ≪拡張装備画面≫ と併用した場合、下に導入した方を優先。
  151.   VOCAB_PARAM = {
  152.     :hit         => "命中",        # 命中率
  153.     :eva         => "回避",        # 回避率
  154.     :cri         => "暴击",  # クリティカル率
  155.   #  :skill_speed => "詠唱速度",      # スキル速度補正
  156.   #  :item_speed  => "アイテム速度",  # アイテム速度補正
  157.   #  :tgr         => "狙われやすさ",  # 狙われやすさ
  158.   }  # ← この } は消さないこと!
  159.  
  160.   # ◆ 振り分け回数が無制限のときは /--- (上限表記) を隠す
  161.   #  true  : 回数のみ表示
  162.   #  false : 回数/--- と表示
  163.   HIDE_MAX_COUNT_INFINITE  = false
  164.  
  165.   # ◆ 振り分けゲージの色
  166.   #  数値  : \C[n] と同じ色。
  167.   #  Color : 指定した色。 ( Color.new(255, 128, 128) など )
  168.   GAUGE_START_COLOR = 28  # 開始色
  169.   GAUGE_END_COLOR   = 29  # 終了色
  170.  
  171.   # ◆ 振り分けゲージに汎用ゲージを使用する
  172.   #  ≪汎用ゲージ描画≫ 導入時のみ有効。
  173.   ENABLE_GENERIC_GAUGE = true
  174.   # ◆ 振り分け汎用ゲージ設定
  175.   #  画像は "Graphics/System" から読み込む。
  176.   GAUGE_IMAGE  = "GaugeDist"  # 画像
  177.   GAUGE_OFFSET = [-23, -2]    # 位置補正 [x, y]
  178.   GAUGE_LENGTH = -4           # 長さ補正
  179.   GAUGE_SLOPE  = 30           # 傾き (-89 ~ 89)
  180.  
  181.   # ◆ 振り分け終了時の確認コマンド
  182.   CONFIRM_COMMANDS = [
  183.     " 决定",  # 振り分け確定
  184.     " 取消",  # 振り分け中止
  185.     " 继续",  # 振り分けを続ける
  186.   ]  # ← この ] は消さないこと!
  187.  
  188.   # ◆ 確認コマンドのヘルプ
  189.   CONFIRM_COMMAND_HELP = [
  190.     "战力天赋调整确定。",        # 振り分け確定
  191.     "取消这次战力天赋调整。",  # 振り分け中止
  192.     "战力天赋调整继续。",              # 振り分けを続ける
  193.   ]  # ← この ] は消さないこと!
  194.  
  195.   # ◆ 振り分け終了時の確認コマンドの幅
  196.   CONFIRM_WIDTH = 112
  197.  
  198.   # ◆ メニュー画面に「パラメータ振り分け」コマンドを追加する
  199.   #  追加する場所は、メニューコマンドの最下部です。
  200.   #  他の部分に追加したい場合は、≪カスタムメニューコマンド≫ をご利用ください。
  201.   USE_MENU_DISTRIBUTE_PARAMETER_COMMAND = false
  202.  
  203.   # ◆ メニュー画面の「パラメータ振り分け」コマンドの名称
  204.   VOCAB_MENU_DISTRIBUTE_PARAMETER       = "战力天赋"
  205.  
  206.   # ◆ 振り分け解除を許可
  207.   #  true  : 振り分け確定後もパラメータを下げ、RP を取り戻せる。
  208.   #  false : 一度確定したら下げられない。
  209.   ENABLE_REVERSE_DISTRIBUTE = true
  210. end
  211.  
  212. #==============================================================================
  213. # ☆ 設定ここまで - END Setting ☆
  214. #==============================================================================
  215.  
  216. $kms_imported = {} if $kms_imported == nil
  217. $kms_imported["DistributeParameter"] = true
  218.  
  219.  
  220. module KMS_DistributeParameter
  221.   # 振り分け対象パラメータ
  222.   PARAMS = [:mhp, :mmp, :atk, :def, :agi,
  223.     :hit, :eva, :cri]#, :skill_speed, :item_speed, :tgr]
  224.   PARAMS |= [:hit, :eva, :cri, :cev, :mev, :mrf, :cnt, :hrg, :mrg, :trg]
  225.   PARAMS |= [ :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, :exr]#, :tgr]
  226.  
  227.   # パラメータ増加量構造体
  228.   GainInfo  = Struct.new(:key, :name, :limit, :cost, :cost_rev, :params)
  229.   ParamInfo = Struct.new(:value, :value_rev)
  230.  
  231.   # 振り分け情報構造体
  232.   DistInfo = Struct.new(:count, :hp, :mp)
  233.  
  234.   #--------------------------------------------------------------------------
  235.   # ○ パラメータ増加量を構造体化
  236.   #--------------------------------------------------------------------------
  237.   def self.create_gain_param_structs(target)
  238.     result = []
  239.     target.each { |v|
  240.       info = GainInfo.new
  241.       info.key      = v[:key]
  242.       info.name     = v[:name]
  243.       info.limit    = v[:limit]
  244.       info.cost     = v[:cost][0]
  245.       info.cost_rev = (v[:cost][1] == nil ? 0 : v[:cost][1])
  246.       info.params   = {}
  247.  
  248.       PARAMS.each { |param|
  249.         next unless v.has_key?(param)
  250.         pinfo = ParamInfo.new
  251.         pinfo.value     = v[param][0]
  252.         pinfo.value_rev = (v[param][1] == nil ? 0 : v[param][1])
  253.         info.params[param] = pinfo
  254.       }
  255.       result << info
  256.     }
  257.     return result
  258.   end
  259.   #--------------------------------------------------------------------------
  260.   # ○ パラメータ増加量を構造体化 (固有増加量用)
  261.   #--------------------------------------------------------------------------
  262.   def self.create_gain_param_structs_for_personal(target)
  263.     result = []
  264.     target.each { |list|
  265.       next if list == nil
  266.       result << create_gain_param_structs(list)
  267.     }
  268.     return result
  269.   end
  270.   #--------------------------------------------------------------------------
  271.   # ○ パラメータ増加量を併合
  272.   #--------------------------------------------------------------------------
  273.   def self.merge(list1, list2)
  274.     result = list1.clone
  275.     list2.each { |info2|
  276.       overwrite = false
  277.       list1.each_with_index { |info1, i|
  278.         if info1.key == info2.key
  279.           result[i] = info2
  280.           overwrite = true
  281.           break
  282.         end
  283.       }
  284.       result << info2 unless overwrite
  285.     }
  286.     return result
  287.   end
  288.  
  289.   # パラメータ増加量を構造体化
  290.   GAIN_PARAMS = create_gain_param_structs(GAIN_PARAMETER)
  291.   PERSONAL_GAIN_PARAMS =
  292.     create_gain_param_structs_for_personal(PERSONAL_GAIN_PARAMETER)
  293.   CLASS_GAIN_PARAMS =
  294.     create_gain_param_structs_for_personal(CLASS_GAIN_PARAMETER)
  295. end
  296.  
  297. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  298.  
  299. #==============================================================================
  300. # ■ Vocab
  301. #==============================================================================
  302.  
  303. module Vocab
  304.   # 命中率
  305.   def self.hit
  306.     return KMS_DistributeParameter::VOCAB_PARAM[:hit]
  307.   end
  308.  
  309.   # 回避率
  310.   def self.eva
  311.     return KMS_DistributeParameter::VOCAB_PARAM[:eva]
  312.   end
  313.  
  314.   # クリティカル率
  315.   def self.cri
  316.     return KMS_DistributeParameter::VOCAB_PARAM[:cri]
  317.   end
  318.  
  319.   # スキル速度補正
  320.   def self.skill_speed
  321.     return KMS_DistributeParameter::VOCAB_PARAM[:skill_speed]
  322.   end
  323.  
  324.   # アイテム速度補正
  325.   def self.item_speed
  326.     return KMS_DistributeParameter::VOCAB_PARAM[:item_speed]
  327.   end
  328.  
  329.   # 狙われやすさ
  330.   def self.tgr
  331.     return KMS_DistributeParameter::VOCAB_PARAM[:tgr]
  332.   end
  333.  
  334.   # RP
  335.   def self.rp
  336.     return KMS_DistributeParameter::VOCAB_RP
  337.   end
  338.  
  339.   # RP (略)
  340.   def self.rp_a
  341.     return KMS_DistributeParameter::VOCAB_RP_A
  342.   end
  343.  
  344.   # パラメータ振り分け
  345.   def self.distribute_parameter
  346.     return KMS_DistributeParameter::VOCAB_MENU_DISTRIBUTE_PARAMETER
  347.   end
  348. end
  349.  
  350. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  351.  
  352. #==============================================================================
  353. # ■ DataManager
  354. #==============================================================================
  355.  
  356. module DataManager
  357.   module_function
  358.   #--------------------------------------------------------------------------
  359.   # ● セーブ内容の展開
  360.   #--------------------------------------------------------------------------
  361.   class << DataManager
  362.     unless method_defined?(:extract_save_contents_KMS_DistributeParameter)
  363.       alias extract_save_contents_KMS_DistributeParameter extract_save_contents
  364.     end
  365.   end
  366.   def extract_save_contents(contents)
  367.     extract_save_contents_KMS_DistributeParameter(contents)
  368.  
  369.     KMS_Commands.check_distribution_values
  370.     Graphics.frame_reset
  371.   end
  372. end
  373.  
  374. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  375.  
  376. #==============================================================================
  377. # □ KMS_Commands
  378. #==============================================================================
  379.  
  380. module KMS_Commands
  381.   module_function
  382.   #--------------------------------------------------------------------------
  383.   # ○ パラメータ振り分けに関する値をチェック
  384.   #--------------------------------------------------------------------------
  385.   def check_distribution_values
  386.     (1...$data_actors.size).each { |i|
  387.       actor = $game_actors[i]
  388.       actor.check_distribution_values
  389.       actor.restore_distribution_values
  390.     }
  391.   end
  392.   #--------------------------------------------------------------------------
  393.   # ○ RP の増減
  394.   #     actor_id : アクター ID
  395.   #     value    : 増減量
  396.   #--------------------------------------------------------------------------
  397.   def gain_rp(actor_id, value)
  398.     actor = $game_actors[actor_id]
  399.     return if actor == nil
  400.     actor.gain_rp(value)
  401.   end
  402.   #--------------------------------------------------------------------------
  403.   # ○ 振り分けの実行
  404.   #     actor_id : アクター ID
  405.   #     key      : 対象パラメータのキー
  406.   #     num      : 振り分け回数
  407.   #--------------------------------------------------------------------------
  408.   def distribute_param_actor(actor_id, key, num = 1)
  409.     actor = $game_actors[actor_id]
  410.     return if actor == nil
  411.  
  412.     # 逆加算判定
  413.     reverse = false
  414.     if num < 0
  415.       reverse = true
  416.       num = num.abs
  417.     end
  418.  
  419.     # 適用
  420.     num.times { |i| actor.rp_growth_effect(key, reverse) }
  421.   end
  422.   #--------------------------------------------------------------------------
  423.   # ○ 振り分け回数をリセット
  424.   #     actor_id : アクター ID
  425.   #--------------------------------------------------------------------------
  426.   def reset_distributed_count(actor_id)
  427.     actor = $game_actors[actor_id]
  428.     return if actor == nil
  429.     actor.clear_distribution_values
  430.     actor.restore_distribution_values
  431.   end
  432.   #--------------------------------------------------------------------------
  433.   # ○ パラメータ振り分け画面の呼び出し
  434.   #     actor_index : アクターインデックス
  435.   #--------------------------------------------------------------------------
  436.   def call_distribute_parameter(actor_index = 0)
  437.     return if $game_party.in_battle
  438.     $game_temp.call_distribute_parameter = true
  439.     $game_party.menu_actor = $game_party.members[actor_index]
  440.   end
  441. end
  442.  
  443. class Game_Interpreter
  444.   include KMS_Commands
  445. end
  446.  
  447. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  448.  
  449. #==============================================================================
  450. # ■ Game_Temp
  451. #==============================================================================
  452.  
  453. class Game_Temp
  454.   #--------------------------------------------------------------------------
  455.   # ● 公開インスタンス変数
  456.   #--------------------------------------------------------------------------
  457.   attr_accessor :call_distribute_parameter  # 振り分け画面呼び出しフラグ
  458.   attr_accessor :menu_actor_index           # 各種メニュー画面用のアクター index
  459.   #--------------------------------------------------------------------------
  460.   # ● オブジェクト初期化
  461.   #--------------------------------------------------------------------------
  462.   alias initialize_KMS_DistributeParameter initialize
  463.   def initialize
  464.     initialize_KMS_DistributeParameter
  465.  
  466.     @call_distribute_parameter = false
  467.     @menu_actor_index = 0
  468.   end
  469. end
  470.  
  471. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  472.  
  473. #==============================================================================
  474. # ■ Game_BattlerBase
  475. #==============================================================================
  476.  
  477. class Game_BattlerBase
  478.   #--------------------------------------------------------------------------
  479.   # ● 能力値に加算する値をクリア
  480.   #--------------------------------------------------------------------------
  481.   alias clear_param_plus_KMS_DistributeParameter clear_param_plus
  482.   def clear_param_plus
  483.     clear_param_plus_KMS_DistributeParameter
  484.  
  485.     clear_distribution_values
  486.     calc_distribution_values
  487.   end
  488.   #--------------------------------------------------------------------------
  489.   # ○ パラメータ振り分けに関する値をクリア
  490.   #--------------------------------------------------------------------------
  491.   def clear_distribution_values
  492.     @distributed_count = {}
  493.     KMS_DistributeParameter::PARAMS.each { |param|
  494.       @distributed_count[param] = 0
  495.     }
  496.   end
  497.   #--------------------------------------------------------------------------
  498.   # ○ パラメータ振り分けに関する値をチェック
  499.   #--------------------------------------------------------------------------
  500.   def check_distribution_values
  501.     last_distributed_count = @distributed_count
  502.  
  503.     clear_distribution_values
  504.  
  505.     @distributed_count = last_distributed_count if last_distributed_count != nil
  506.   end
  507.   #--------------------------------------------------------------------------
  508.   # ○ 各種修正値を計算
  509.   #--------------------------------------------------------------------------
  510.   def calc_distribution_values
  511.     # 継承先で定義
  512.   end
  513.   #--------------------------------------------------------------------------
  514.   # ○ 振り分けによる上昇値を取得
  515.   #     param : パラメータの Symbol
  516.   #--------------------------------------------------------------------------
  517.   def distributed_param(param)
  518.     return 0
  519.   end
  520.   #--------------------------------------------------------------------------
  521.   # ○ 振り分けに関する情報を取得
  522.   #--------------------------------------------------------------------------
  523.   def distribution_info
  524.     info = KMS_DistributeParameter::DistInfo.new
  525.     info.count = @distributed_count.clone
  526.     info.hp    = self.hp
  527.     info.mp    = self.mp
  528.     return info
  529.   end
  530.   #--------------------------------------------------------------------------
  531.   # ○ 振り分けに関する情報を設定
  532.   #--------------------------------------------------------------------------
  533.   def set_distribution_info(info)
  534.     return unless info.is_a?(KMS_DistributeParameter::DistInfo)
  535.  
  536.     @distributed_count = info.count
  537.     calc_distribution_values
  538.     self.hp = info.hp
  539.     self.mp = info.mp
  540.   end
  541. end
  542.  
  543. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  544.  
  545. #==============================================================================
  546. # ■ Game_Action
  547. #==============================================================================
  548.  
  549. class Game_Action
  550.   #--------------------------------------------------------------------------
  551.   # ● 行動速度の計算
  552.   #--------------------------------------------------------------------------
  553.   alias speed_KMS_DistributeParameter speed
  554.   def speed
  555.     speed = speed_KMS_DistributeParameter
  556.     return speed if attack?
  557.  
  558.     if item.is_a?(RPG::Skill) && item.speed < 0
  559.       n = [subject.distributed_param(:skill_speed), item.speed.abs].min
  560.       speed += n
  561.     elsif item.is_a?(RPG::Item) && item.speed < 0
  562.       n = [subject.distributed_param(:item_speed), item.speed.abs].min
  563.       speed += n
  564.     end
  565.  
  566.     return speed
  567.   end
  568. end
  569.  
  570. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  571.  
  572. #==============================================================================
  573. # ■ Game_Actor
  574. #==============================================================================
  575.  
  576. class Game_Actor < Game_Battler
  577.   #--------------------------------------------------------------------------
  578.   # ○ クラス変数
  579.   #--------------------------------------------------------------------------
  580.   @@__distribute_gain_params = {}
  581.   #--------------------------------------------------------------------------
  582.   # ● オブジェクト初期化
  583.   #     actor_id : アクター ID
  584.   #--------------------------------------------------------------------------
  585.   alias initialize_KMS_DistributeParameter initialize
  586.   def initialize(actor_id)
  587.     @actor_id = actor_id
  588.     @class_id = actor.class_id
  589.  
  590.     initialize_KMS_DistributeParameter(actor_id)
  591.   end
  592.   #--------------------------------------------------------------------------
  593.   # ○ パラメータ増加量一覧を取得
  594.   #--------------------------------------------------------------------------
  595.   def gain_parameter_list
  596.     key = "#{@actor_id}_#{@class_id}"
  597.     unless @@__distribute_gain_params.has_key?(key)
  598.       result = KMS_DistributeParameter::GAIN_PARAMS
  599.  
  600.       # アクター固有
  601.       list   = KMS_DistributeParameter::PERSONAL_GAIN_PARAMS[@actor_id]
  602.       result = KMS_DistributeParameter.merge(result, list) if list != nil
  603.  
  604.       # 職業固有
  605.       list   = KMS_DistributeParameter::CLASS_GAIN_PARAMS[@class_id]
  606.       result = KMS_DistributeParameter.merge(result, list) if list != nil
  607.  
  608.       @@__distribute_gain_params[key] = result
  609.     end
  610.  
  611.     return @@__distribute_gain_params[key]
  612.   end
  613.   #--------------------------------------------------------------------------
  614.   # ○ パラメータ増加量を取得
  615.   #     key : 振り分けキー
  616.   #--------------------------------------------------------------------------
  617.   def gain_parameter(key)
  618.     return gain_parameter_list.find { |v| v.key == key }
  619.   end
  620.   #--------------------------------------------------------------------------
  621.   # ○ 各種修正値を計算
  622.   #--------------------------------------------------------------------------
  623.   def calc_distribution_values
  624.     @rp_cost = 0
  625.     @distributed_param = {}
  626.     KMS_DistributeParameter::PARAMS.each { |param|
  627.       @distributed_param[param] = 0
  628.     }
  629.  
  630.     gain_parameter_list.each { |gain|
  631.       next if gain == nil
  632.       cost = 0
  633.       distributed_count(gain.key).times { |i|
  634.         cost += Integer(gain.cost + gain.cost_rev * i)
  635.         gain.params.each { |param, v|
  636.           @distributed_param[param] += v.value + v.value_rev * i
  637.         }
  638.       }
  639.       @rp_cost += [cost, 0].max
  640.     }
  641.  
  642.     KMS_DistributeParameter::PARAMS.each { |param|
  643.       @distributed_param[param] = @distributed_param[param]
  644.     }
  645.   end
  646.   #--------------------------------------------------------------------------
  647.   # ○ 各種修正値を修復
  648.   #--------------------------------------------------------------------------
  649.   def restore_distribution_values
  650.     calc_distribution_values
  651.     self.hp = self.hp
  652.     self.mp = self.mp
  653.   end
  654.   #--------------------------------------------------------------------------
  655.   # ○ 振り分けによる上昇値を取得
  656.   #     param : パラメータの Symbol
  657.   #--------------------------------------------------------------------------
  658.   def distributed_param(param)
  659.     return 0 if @distributed_param == nil
  660.     return 0 if @distributed_param[param] == nil
  661.     return @distributed_param[param]
  662.   end
  663.   PARAM_SYMBOL  = [:mhp, :mmp, :atk, :def, :agi]
  664.   XPARAM_SYMBOL = [:hit, :eva, :cri, :cev, :mev, :mrf, :cnt, :hrg, :mrg, :trg]
  665.   SPARAM_SYMBOL = [:tgr, :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, :exr]
  666.   #--------------------------------------------------------------------------
  667.   # ● 通常能力値の基本値取得
  668.   #--------------------------------------------------------------------------
  669.   alias param_base_KMS_DistributeParameter param_base
  670.   def param_base(param_id)
  671.     n = param_base_KMS_DistributeParameter(param_id)
  672.     if PARAM_SYMBOL[param_id] != nil
  673.       n += distributed_param(PARAM_SYMBOL[param_id])
  674.     end
  675.  
  676.     return Integer(n)
  677.   end
  678.   #--------------------------------------------------------------------------
  679.   # ● 命中率の取得
  680.   #--------------------------------------------------------------------------
  681.   alias hit_KMS_DistributeParameter hit
  682.   def hit
  683.     n = hit_KMS_DistributeParameter + distributed_param(:hit)
  684.     return n
  685.   end
  686.   #--------------------------------------------------------------------------
  687.   # ● 回避率の取得
  688.   #--------------------------------------------------------------------------
  689.   alias eva_KMS_DistributeParameter eva
  690.   def eva
  691.     n = eva_KMS_DistributeParameter + distributed_param(:eva)
  692.     return n
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # ● クリティカル率の取得
  696.   #--------------------------------------------------------------------------
  697.   alias cri_KMS_DistributeParameter cri
  698.   def cri
  699.     n = cri_KMS_DistributeParameter + distributed_param(:cri)
  700.     return n
  701.   end
  702.   #--------------------------------------------------------------------------
  703.   # ● 狙われ率の取得
  704.   #--------------------------------------------------------------------------
  705.   alias tgr_KMS_DistributeParameter tgr
  706.   def tgr
  707.     n = tgr_KMS_DistributeParameter + distributed_param(:tgr)
  708.     return n
  709.   end
  710.   #--------------------------------------------------------------------------
  711.   # ○ MaxRP の取得
  712.   #--------------------------------------------------------------------------
  713.   def mrp
  714.     n = Integer(eval(KMS_DistributeParameter::MAXRP_EXP))
  715.     return [n + mrp_plus, 0].max
  716.   end
  717.   #--------------------------------------------------------------------------
  718.   # ○ MaxRP 補正値の取得
  719.   #--------------------------------------------------------------------------
  720.   def mrp_plus
  721.     @mrp_plus = 0 if @mrp_plus == nil
  722.     return @mrp_plus
  723.   end
  724.   #--------------------------------------------------------------------------
  725.   # ○ RP の取得
  726.   #--------------------------------------------------------------------------
  727.   def rp
  728.     return [mrp - @rp_cost, 0].max
  729.   end
  730.   #--------------------------------------------------------------------------
  731.   # ○ 振り分け回数の取得
  732.   #     param : 振り分け先パラメータ (キー)
  733.   #--------------------------------------------------------------------------
  734.   def distributed_count(param)
  735.     clear_distribution_values     if @distributed_count == nil
  736.     @distributed_count[param] = 0 if @distributed_count[param] == nil
  737.     return @distributed_count[param]
  738.   end
  739.   #--------------------------------------------------------------------------
  740.   # ○ RP の増減
  741.   #     value : 増減量
  742.   #--------------------------------------------------------------------------
  743.   def gain_rp(value)
  744.     @mrp_plus = mrp_plus + value
  745.   end
  746.   #--------------------------------------------------------------------------
  747.   # ○ 振り分け回数の増減
  748.   #     param : 振り分け先パラメータ (キー)
  749.   #     value : 増減量
  750.   #--------------------------------------------------------------------------
  751.   def gain_distributed_count(param, value = 1)
  752.     n = distributed_count(param)
  753.     @distributed_count[param] += value if n.is_a?(Integer)
  754.   end
  755.   #--------------------------------------------------------------------------
  756.   # ○ RP 振り分けによる成長効果適用
  757.   #     param   : 振り分け先パラメータ (キー)
  758.   #     reverse : 逆加算のときは true
  759.   #--------------------------------------------------------------------------
  760.   def rp_growth_effect(param, reverse = false)
  761.     gain = gain_parameter(param)
  762.     return if gain == nil  # 無効なパラメータ
  763.  
  764.     if reverse
  765.       return if distributed_count(param) == 0  # 逆加算不可
  766.     else
  767.       return unless can_distribute?(param)
  768.     end
  769.  
  770.     gain_distributed_count(param, reverse ? -1 : 1)
  771.     restore_distribution_values
  772.   end
  773.   #--------------------------------------------------------------------------
  774.   # ○ パラメータ振り分け可否判定
  775.   #     param : 振り分け先パラメータ (キー)
  776.   #--------------------------------------------------------------------------
  777.   def can_distribute?(param)
  778.     gain = gain_parameter(param)
  779.     return false if gain == nil                        # 無効なパラメータ
  780.     return false if self.rp < distribute_cost(param)   # RP 不足
  781.     if gain.limit > 0
  782.       return false if gain.limit <= distributed_count(param)  # 回数上限
  783.     end
  784.  
  785.     return true
  786.   end
  787.   #--------------------------------------------------------------------------
  788.   # ○ パラメータ振り分けコスト計算
  789.   #     param : 振り分け先パラメータ (キー)
  790.   #--------------------------------------------------------------------------
  791.   def distribute_cost(param)
  792.     gain = gain_parameter(param)
  793.     return 0 if gain == nil  # 無効なパラメータ
  794.  
  795.     n = gain.cost
  796.     count = distributed_count(param)
  797.     count = [count, gain.limit - 1].min if gain.limit > 0
  798.     n += gain.cost_rev * count
  799.     return [Integer(n), 0].max
  800.   end
  801.   #--------------------------------------------------------------------------
  802.   # ○ パラメータ振り分け後の増加量計算
  803.   #     param : 振り分け先パラメータ (キー)
  804.   #     amt   : 振り分け数
  805.   #--------------------------------------------------------------------------
  806.   def distribute_gain(param, amt = 1)
  807.     gain = gain_parameter(param)
  808.  
  809.     # 無効なパラメータ
  810.     return 0 if gain == nil
  811.  
  812.     result = {}
  813.     KMS_DistributeParameter::PARAMS.each { |par|
  814.       result[par] = distributed_param(par)
  815.     }
  816.  
  817.     # 振り分け不可
  818.     if amt > 0
  819.       return result if gain.limit > 0 && gain.limit == distributed_count(param)
  820.     else
  821.       return result if distributed_count(param) + amt < 0
  822.     end
  823.  
  824.     last_hp = self.hp
  825.     last_mp = self.mp
  826.     last_count = distributed_count(param)
  827.     rp_growth_effect(param)
  828.     KMS_DistributeParameter::PARAMS.each { |par|
  829.       result[par] = distributed_param(par) if gain.params.include?(par)
  830.     }
  831.     rp_growth_effect(param, true) if last_count < distributed_count(param)
  832.     self.hp = last_hp
  833.     self.mp = last_mp
  834.  
  835.     return result
  836.   end
  837. end
  838.  
  839. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  840.  
  841. #==============================================================================
  842. # ■ Window_Base
  843. #==============================================================================
  844.  
  845. class Window_Base < Window
  846.   #--------------------------------------------------------------------------
  847.   # ○ RP の文字色を取得
  848.   #     actor : アクター
  849.   #--------------------------------------------------------------------------
  850.   def rp_color(actor)
  851.     return (actor.rp == 0 ? knockout_color : normal_color)
  852.   end
  853.   #--------------------------------------------------------------------------
  854.   # ○ 振り分けゲージの色 1 の取得
  855.   #--------------------------------------------------------------------------
  856.   def distribute_gauge_color1
  857.     color = KMS_DistributeParameter::GAUGE_START_COLOR
  858.     return (color.is_a?(Integer) ? text_color(color) : color)
  859.   end
  860.   #--------------------------------------------------------------------------
  861.   # ○ 振り分けゲージの色 2 の取得
  862.   #--------------------------------------------------------------------------
  863.   def distribute_gauge_color2
  864.     color = KMS_DistributeParameter::GAUGE_END_COLOR
  865.     return (color.is_a?(Integer) ? text_color(color) : color)
  866.   end
  867.   #--------------------------------------------------------------------------
  868.   # ○ RP の描画
  869.   #     actor : アクター
  870.   #     x     : 描画先 X 座標
  871.   #     y     : 描画先 Y 座標
  872.   #     width : 幅
  873.   #--------------------------------------------------------------------------
  874.   def draw_actor_rp(actor, x, y, width = 124)
  875.     change_color(system_color)
  876.     draw_text(x, y, 30+50, line_height, Vocab::rp_a)
  877.     draw_current_and_max_values(x, y, width, actor.rp, actor.mrp,
  878.       rp_color(actor), normal_color)
  879.     change_color(normal_color)
  880.   end
  881.   #--------------------------------------------------------------------------
  882.   # ○ 振り分けゲージの描画
  883.   #     actor : アクター
  884.   #     param : パラメータ
  885.   #     x     : 描画先 X 座標
  886.   #     y     : 描画先 Y 座標
  887.   #     width : 幅
  888.   #--------------------------------------------------------------------------
  889.   def draw_actor_distribute_gauge(actor, param, x, y, width = 124)
  890.     gain = actor.gain_parameter(param)
  891.     return if gain == nil || gain.limit <= 0
  892.  
  893.     rate = actor.distributed_count(param) * 1.0 / gain.limit
  894.     if $kms_imported["GenericGauge"] &&
  895.         KMS_DistributeParameter::ENABLE_GENERIC_GAUGE
  896.       # 汎用ゲージ
  897.       draw_generic_gauge(KMS_DistributeParameter::GAUGE_IMAGE,
  898.         x, y, width, rate,
  899.         KMS_DistributeParameter::GAUGE_OFFSET,
  900.         KMS_DistributeParameter::GAUGE_LENGTH,
  901.         KMS_DistributeParameter::GAUGE_SLOPE)
  902.     else
  903.       # デフォルトゲージ
  904.       gc1  = distribute_gauge_color1
  905.       gc2  = distribute_gauge_color2
  906.       draw_gauge(x, y, width, rate, gc1, gc2)
  907.     end
  908.   end
  909. end
  910.  
  911. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  912.  
  913. #==============================================================================
  914. # ■ Window_MenuCommand
  915. #==============================================================================
  916.  
  917. class Window_MenuCommand < Window_Command
  918.   if KMS_DistributeParameter::USE_MENU_DISTRIBUTE_PARAMETER_COMMAND &&
  919.       !$kms_imported["CustomMenuCommand"]
  920.     #--------------------------------------------------------------------------
  921.     # ● コマンドリストの作成
  922.     #--------------------------------------------------------------------------
  923.     alias make_command_list_KMS_DistributeParameter make_command_list
  924.     def make_command_list
  925.       make_command_list_KMS_DistributeParameter
  926.  
  927.       add_distribute_parameter_command
  928.     end
  929.   end
  930.   #--------------------------------------------------------------------------
  931.   # ○ 振り分けコマンドをリストに追加
  932.   #--------------------------------------------------------------------------
  933.   def add_distribute_parameter_command
  934.     add_command(Vocab::distribute_parameter,
  935.       :distribute_parameter,
  936.       distribute_parameter_enabled)
  937.   end
  938.   #--------------------------------------------------------------------------
  939.   # ○ パラメータ振り分けの有効状態を取得
  940.   #--------------------------------------------------------------------------
  941.   def distribute_parameter_enabled
  942.     return true
  943.   end
  944. end
  945.  
  946. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  947.  
  948. #==============================================================================
  949. # □ Window_DistributeParameterActor
  950. #------------------------------------------------------------------------------
  951. #   振り分け画面で、アクターの情報を表示するウィンドウです。
  952. #==============================================================================
  953.  
  954. class Window_DistributeParameterActor < Window_Base
  955.   #--------------------------------------------------------------------------
  956.   # ○ 公開インスタンス変数
  957.   #--------------------------------------------------------------------------
  958.   attr_accessor :actor
  959.   #--------------------------------------------------------------------------
  960.   # ● オブジェクト初期化
  961.   #     x     : ウィンドウの X 座標
  962.   #     y     : ウィンドウの Y 座標
  963.   #     actor : アクター
  964.   #--------------------------------------------------------------------------
  965.   def initialize(x, y, actor)
  966.     super(x, y, Graphics.width, line_height + 32)
  967.     @actor = actor
  968.     refresh
  969.   end
  970.   #--------------------------------------------------------------------------
  971.   # ● リフレッシュ
  972.   #--------------------------------------------------------------------------
  973.   def refresh
  974.     contents.clear
  975.     draw_actor_name(@actor, 4, 0)
  976.     draw_actor_level(@actor, 140, 0)
  977.     draw_actor_rp(@actor, 240+100, 0)
  978.   end
  979. end
  980.  
  981. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  982.  
  983. #==============================================================================
  984. # □ Window_DistributeParameterList
  985. #------------------------------------------------------------------------------
  986. #   振り分け画面で、成長させるパラメータを選択するウィンドウです。
  987. #==============================================================================
  988.  
  989. class Window_DistributeParameterList < Window_Selectable
  990.   #--------------------------------------------------------------------------
  991.   # ○ 公開インスタンス変数
  992.   #--------------------------------------------------------------------------
  993.   attr_accessor :actor
  994.   #--------------------------------------------------------------------------
  995.   # ● オブジェクト初期化
  996.   #     actor : アクター
  997.   #--------------------------------------------------------------------------
  998.   def initialize(actor)
  999.     off_h = line_height + 32
  1000.     super(0, off_h, 286, Graphics.height - off_h)
  1001.     @actor = actor
  1002.     refresh
  1003.     self.index = 0
  1004.   end
  1005.   #--------------------------------------------------------------------------
  1006.   # ○ 選択中のパラメータの Symbol を取得
  1007.   #--------------------------------------------------------------------------
  1008.   def parameter_key
  1009.     return @data[self.index]
  1010.   end
  1011.   #--------------------------------------------------------------------------
  1012.   # ● 項目数の取得
  1013.   #--------------------------------------------------------------------------
  1014.   def item_max
  1015.     return @data == nil ? 0 : @data.size
  1016.   end
  1017.   #--------------------------------------------------------------------------
  1018.   # ● 1 ページに表示できる行数の取得
  1019.   #--------------------------------------------------------------------------
  1020.   def page_row_max
  1021.     return super - 1
  1022.   end
  1023.   #--------------------------------------------------------------------------
  1024.   # ● 項目を描画する矩形の取得
  1025.   #     index : 項目番号
  1026.   #--------------------------------------------------------------------------
  1027.   def item_rect(index)
  1028.     rect = super(index)
  1029.     rect.y += line_height
  1030.     return rect
  1031.   end
  1032.   #--------------------------------------------------------------------------
  1033.   # ● カーソルを 1 ページ後ろに移動
  1034.   #--------------------------------------------------------------------------
  1035.   def cursor_pagedown
  1036.     return if Input.repeat?(Input::R)
  1037.     super
  1038.   end
  1039.   #--------------------------------------------------------------------------
  1040.   # ● カーソルを 1 ページ前に移動
  1041.   #--------------------------------------------------------------------------
  1042.   def cursor_pageup
  1043.     return if Input.repeat?(Input::L)
  1044.     super
  1045.   end
  1046.   #--------------------------------------------------------------------------
  1047.   # ● リフレッシュ
  1048.   #--------------------------------------------------------------------------
  1049.   def refresh
  1050.     @gain_list = @actor.gain_parameter_list
  1051.     @data = []
  1052.     @gain_list.each { |gain| @data << gain.key }
  1053.     @item_max = @data.size + 1
  1054.     create_contents
  1055.     @item_max -= 1
  1056.     draw_caption
  1057.     @item_max.times { |i| draw_item(i, @actor.can_distribute?(@data[i])) }
  1058.   end
  1059.   #--------------------------------------------------------------------------
  1060.   # ○ 見出しの描画
  1061.   #--------------------------------------------------------------------------
  1062.   def draw_caption
  1063.     change_color(system_color)
  1064.     draw_text(  4, 0, 96, line_height, "属性")
  1065.     draw_text(120-40, 0, 40+50, line_height, Vocab.rp, 2)
  1066.     draw_text(170, 0, 80, line_height, "次数", 2)
  1067.     change_color(normal_color)
  1068.   end
  1069.   #--------------------------------------------------------------------------
  1070.   # ○ 項目の描画
  1071.   #     index   : 項目番号
  1072.   #     enabled : 有効フラグ
  1073.   #--------------------------------------------------------------------------
  1074.   def draw_item(index, enabled = true)
  1075.     rect = item_rect(index)
  1076.     contents.clear_rect(rect)
  1077.     item = @data[index]
  1078.     if item != nil
  1079.       draw_parameter(rect.x, rect.y, @data[index], enabled)
  1080.     end
  1081.   end
  1082.   #--------------------------------------------------------------------------
  1083.   # ○ 能力値の描画
  1084.   #     x       : 描画先 X 座標
  1085.   #     y       : 描画先 Y 座標
  1086.   #     param   : 振り分け先
  1087.   #     enabled : 有効フラグ
  1088.   #--------------------------------------------------------------------------
  1089.   def draw_parameter(x, y, param, enabled)
  1090.     gain = @gain_list.find { |v| v.key == param }
  1091.     return if gain == nil
  1092.  
  1093.     change_color(normal_color)
  1094.     contents.font.color.alpha = enabled ? 255 : 128
  1095.     draw_text(x + 4, y, 96, line_height, gain.name)
  1096.  
  1097.     # コスト描画
  1098.     value = @actor.distribute_cost(param)
  1099.     draw_text(x + 120, y, 40, line_height, value, 2)
  1100.  
  1101.     # 振り分け回数描画
  1102.     if gain.limit > 0
  1103.       value = sprintf("%3d/%3d", @actor.distributed_count(param), gain.limit)
  1104.     else
  1105.       value = sprintf("%3d%s", @actor.distributed_count(param),
  1106.         KMS_DistributeParameter::HIDE_MAX_COUNT_INFINITE ? "" : "/---")
  1107.     end
  1108.     draw_actor_distribute_gauge(@actor, param, x + 170, y, 80)
  1109.     draw_text(x + 170, y, 80, line_height, value, 2)
  1110.  
  1111.     change_color(normal_color)
  1112.   end
  1113.   #--------------------------------------------------------------------------
  1114.   # ● 決定やキャンセルなどのハンドリング処理
  1115.   #--------------------------------------------------------------------------
  1116.   def process_handling
  1117.     super
  1118.     call_handler(:increase) if handle?(:increase) && Input.repeat?(:RIGHT)
  1119.     call_handler(:decrease) if handle?(:decrease) && Input.repeat?(:LEFT)
  1120.     call_handler(:up)       if handle?(:up)       && Input.repeat?(:UP)
  1121.     call_handler(:down)     if handle?(:down)     && Input.repeat?(:DOWN)
  1122.   end
  1123. end
  1124.  
  1125. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1126.  
  1127. #==============================================================================
  1128. # □ Window_DistributeParameterStatus
  1129. #------------------------------------------------------------------------------
  1130. #   振り分け画面で、アクターのステータスを表示するウィンドウです。
  1131. #==============================================================================
  1132.  
  1133. class Window_DistributeParameterStatus < Window_Base
  1134.   #--------------------------------------------------------------------------
  1135.   # ○ 公開インスタンス変数
  1136.   #--------------------------------------------------------------------------
  1137.   attr_accessor :actor
  1138.   #--------------------------------------------------------------------------
  1139.   # ● オブジェクト初期化
  1140.   #     actor : アクター
  1141.   #--------------------------------------------------------------------------
  1142.   def initialize(actor)
  1143.     dx = 286
  1144.     off_h = line_height + 32
  1145.     super(dx, off_h, Graphics.width - dx, Graphics.height - off_h)
  1146.     @actor = actor
  1147.     refresh(actor.gain_parameter_list[0].key)
  1148.   end
  1149.   #--------------------------------------------------------------------------
  1150.   # ● リフレッシュ
  1151.   #--------------------------------------------------------------------------
  1152.   def refresh(param = nil)
  1153.     @distribute_gain = nil
  1154.     if param != nil
  1155.       @distribute_gain = @actor.distribute_gain(param)
  1156.     end
  1157.  
  1158.     contents.clear
  1159. #    change_color(system_color)
  1160. #    draw_text(0, 0, width - 32, line_height, "パラメータ変化", 1)
  1161. #    change_color(normal_color)
  1162. #
  1163. #    dy = line_height
  1164.     dy = 0
  1165.     KMS_DistributeParameter::PARAMS.each { |param|
  1166.       draw_parameter(0, dy, param)
  1167.       dy += line_height
  1168.     }
  1169.   end
  1170.   #--------------------------------------------------------------------------
  1171.   # ○ 能力値の描画
  1172.   #     x    : 描画先 X 座標
  1173.   #     y    : 描画先 Y 座標
  1174.   #     type : 能力値の種類
  1175.   #--------------------------------------------------------------------------
  1176.   def draw_parameter(x, y, type)
  1177.     is_float = false
  1178.  
  1179.     case type
  1180.     when :mhp
  1181.       name  = Vocab.hp
  1182.       value = @actor.mhp
  1183.     when :mmp
  1184.       name  = Vocab.mp
  1185.       value = @actor.mmp
  1186.     when :atk
  1187.       name  = Vocab.param(2)
  1188.       value = @actor.atk
  1189.     when :def
  1190.       name  = Vocab.param(3)
  1191.       value = @actor.def
  1192.     when :mat
  1193.       name  = Vocab.param(4)
  1194.       value = @actor.mat
  1195.     when :mdf
  1196.       name  = Vocab.param(5)
  1197.       value = @actor.mdf
  1198.     when :agi
  1199.       name  = Vocab.param(6)
  1200.       value = @actor.agi
  1201.     when :luk
  1202.       name  = Vocab.param(7)
  1203.       value = @actor.luk
  1204.     when :hit
  1205.       name  = Vocab.hit
  1206.       value = @actor.hit
  1207.       is_float = true
  1208.     when :eva
  1209.       name  = Vocab.eva
  1210.       value = @actor.eva
  1211.       is_float = true
  1212.     when :cri
  1213.       name  = Vocab.cri
  1214.       value = @actor.cri
  1215.       is_float = true
  1216.     when :skill_speed
  1217.       name  = Vocab.skill_speed
  1218.       value = @actor.distributed_param(type)
  1219.     when :item_speed
  1220.       name  = Vocab.item_speed
  1221.       value = @actor.distributed_param(type)
  1222.     when :tgr
  1223.       name  = Vocab.tgr
  1224.       value = @actor.tgr
  1225.       is_float = true
  1226.     else
  1227.       return
  1228.     end
  1229.  
  1230.     # パラメータ名
  1231.     change_color(system_color)
  1232.     draw_text(x + 4, y, 96, line_height, name)
  1233.     change_color(normal_color)
  1234.     draw_text(x + 106, y, 48, line_height, convert_value(value, is_float), 2)
  1235.  
  1236.     return if @distribute_gain == nil
  1237.  
  1238.     # パラメータ変化
  1239.     draw_text(x + 154, y, 16, line_height, "→", 1)
  1240.  
  1241.     curr = @actor.distributed_param(type)
  1242.     gain = @distribute_gain[type]
  1243.     change_color(gain > curr ? text_color(3) : gain < curr ?
  1244.         text_color(2) : normal_color)
  1245.     new_value = value + (gain - curr)
  1246.     draw_text(x + 174, y, 48, line_height, convert_value(new_value, is_float), 2)
  1247.  
  1248.     change_color(normal_color)
  1249.   end
  1250.   def convert_value(value, is_float)
  1251.     if is_float
  1252.       return sprintf("%.2f", value)
  1253.     else
  1254.       return value.to_i.to_s
  1255.     end
  1256.   end
  1257. end
  1258.  
  1259. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1260.  
  1261. #==============================================================================
  1262. # □ Window_DistributeParameterConfirm
  1263. #------------------------------------------------------------------------------
  1264. #   振り分け画面で、振り分けの確定/中止を選択するウィンドウです。
  1265. #==============================================================================
  1266.  
  1267. class Window_DistributeParameterConfirm < Window_Command
  1268.   #--------------------------------------------------------------------------
  1269.   # ● ウィンドウ幅の取得
  1270.   #--------------------------------------------------------------------------
  1271.   def window_width
  1272.     return KMS_DistributeParameter::CONFIRM_WIDTH
  1273.   end
  1274.   #--------------------------------------------------------------------------
  1275.   # ● コマンドリストの作成
  1276.   #--------------------------------------------------------------------------
  1277.   def make_command_list
  1278.     super
  1279.     add_command(KMS_DistributeParameter::CONFIRM_COMMANDS[0], :decide)
  1280.     add_command(KMS_DistributeParameter::CONFIRM_COMMANDS[1], :stop)
  1281.     add_command(KMS_DistributeParameter::CONFIRM_COMMANDS[2], :cancel)
  1282.   end
  1283.   #--------------------------------------------------------------------------
  1284.   # ● ヘルプテキスト更新
  1285.   #--------------------------------------------------------------------------
  1286. #~   def update_help
  1287. #~     text = index >= 0 ? KMS_DistributeParameter::CONFIRM_COMMAND_HELP[index] : nil
  1288. #~     @help_window.set_text(text)
  1289. #~   end
  1290. end
  1291.  
  1292. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1293.  
  1294. #==============================================================================
  1295. # ■ Scene_Map
  1296. #==============================================================================
  1297.  
  1298. class Scene_Map < Scene_Base
  1299.   #--------------------------------------------------------------------------
  1300.   # ● シーン遷移に関連する更新
  1301.   #--------------------------------------------------------------------------
  1302.   alias update_scene_KMS_DistributeParameter update_scene
  1303.   def update_scene
  1304.     update_scene_KMS_DistributeParameter
  1305.  
  1306.     update_call_distribute_parameter unless scene_changing?
  1307.   end
  1308.   #--------------------------------------------------------------------------
  1309.   # ○ パラメータ振り分け画面呼び出し判定
  1310.   #--------------------------------------------------------------------------
  1311.   def update_call_distribute_parameter
  1312.     if $game_temp.call_distribute_parameter && !$game_player.moving?
  1313.       $game_temp.call_distribute_parameter = false
  1314.       call_distribute_parameter
  1315.     end
  1316.   end
  1317.   #--------------------------------------------------------------------------
  1318.   # ○ パラメータ振り分け画面への切り替え
  1319.   #--------------------------------------------------------------------------
  1320.   def call_distribute_parameter
  1321.     SceneManager.call(Scene_DistributeParameter)
  1322.   end
  1323. end
  1324.  
  1325. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1326.  
  1327. #==============================================================================
  1328. # ■ Scene_Menu
  1329. #==============================================================================
  1330.  
  1331. class Scene_Menu < Scene_MenuBase
  1332.   #--------------------------------------------------------------------------
  1333.   # ● コマンドウィンドウの作成
  1334.   #--------------------------------------------------------------------------
  1335.   alias create_command_window_KMS_DistributeParameter create_command_window
  1336.   def create_command_window
  1337.     create_command_window_KMS_DistributeParameter
  1338.  
  1339.     @command_window.set_handler(:distribute_parameter, method(:command_personal))
  1340.   end
  1341.   #--------------------------------------------------------------------------
  1342.   # ○ コマンド [パラメータ振り分け]
  1343.   #--------------------------------------------------------------------------
  1344.   def command_distribute_parameter
  1345.     SceneManager.call(Scene_DistributeParameter)
  1346.   end
  1347.   #--------------------------------------------------------------------------
  1348.   # ● 個人コマンド[決定]
  1349.   #--------------------------------------------------------------------------
  1350.   alias on_personal_ok_KMS_DistributeParameter on_personal_ok
  1351.   def on_personal_ok
  1352.     on_personal_ok_KMS_DistributeParameter
  1353.  
  1354.     if @command_window.current_symbol == :distribute_parameter
  1355.       command_distribute_parameter
  1356.     end
  1357.   end
  1358. end
  1359.  
  1360. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1361.  
  1362. #==============================================================================
  1363. # □ Scene_DistributeParameter
  1364. #------------------------------------------------------------------------------
  1365. #   パラメータ振り分け画面の処理を行うクラスです。
  1366. #==============================================================================
  1367.  
  1368. class Scene_DistributeParameter < Scene_MenuBase
  1369.   #--------------------------------------------------------------------------
  1370.   # ● 開始処理
  1371.   #--------------------------------------------------------------------------
  1372.   def start
  1373.     super
  1374.     @prev_actor = @actor
  1375.     @prev_info  = @actor.distribution_info
  1376. #~     create_help_window
  1377.     create_actor_window
  1378.     create_parameter_window
  1379.     create_status_window
  1380.     create_confirm_window
  1381.   end
  1382.   #--------------------------------------------------------------------------
  1383.   # ○ アクターウィンドウ作成
  1384.   #--------------------------------------------------------------------------
  1385.   def create_actor_window
  1386.     @actor_window = Window_DistributeParameterActor.new(0, 0, @actor)
  1387.     @actor_window.viewport = @viewport
  1388.   end
  1389.   #--------------------------------------------------------------------------
  1390.   # ○ パラメータリストウィンドウ作成
  1391.   #--------------------------------------------------------------------------
  1392.   def create_parameter_window
  1393.     @parameter_window = Window_DistributeParameterList.new(@actor)
  1394.     @parameter_window.viewport = @viewport
  1395.     @parameter_window.activate
  1396.     @parameter_window.set_handler(:ok,       method(:on_parameter_ok))
  1397.     @parameter_window.set_handler(:cancel,   method(:on_parameter_cancel))
  1398.     @parameter_window.set_handler(:increase, method(:on_parameter_increase))
  1399.     @parameter_window.set_handler(:decrease, method(:on_parameter_decrease))
  1400.     @parameter_window.set_handler(:down,     method(:update_status))
  1401.     @parameter_window.set_handler(:up,       method(:update_status))
  1402.     @parameter_window.set_handler(:pagedown, method(:next_actor))
  1403.     @parameter_window.set_handler(:pageup,   method(:prev_actor))
  1404.   end
  1405.   #--------------------------------------------------------------------------
  1406.   # ○ 振り分けステータスウィンドウ作成
  1407.   #--------------------------------------------------------------------------
  1408.   def create_status_window
  1409.     @status_window = Window_DistributeParameterStatus.new(@actor)
  1410.     @status_window.viewport = @viewport
  1411.  
  1412. #~     @help_window.z = @status_window.z + 100
  1413. #~     @help_window.openness = 0  
  1414.   end
  1415.   #--------------------------------------------------------------------------
  1416.   # ○ 確認ウィンドウ作成
  1417.   #--------------------------------------------------------------------------
  1418.   def create_confirm_window
  1419.     @confirm_window = Window_DistributeParameterConfirm.new(0, 0)
  1420.     @confirm_window.x = (Graphics.width  - @confirm_window.width)  / 2
  1421.     @confirm_window.y = (Graphics.height - @confirm_window.height) / 2
  1422. #~     @confirm_window.z = @help_window.z
  1423.     @confirm_window.viewport    = @viewport
  1424.     @confirm_window.help_window = @help_window
  1425.     @confirm_window.openness    = 0
  1426.     @confirm_window.deactivate
  1427.     @confirm_window.set_handler(:decide, method(:on_confirm_decide))
  1428.     @confirm_window.set_handler(:stop,   method(:on_confirm_stop))
  1429.     @confirm_window.set_handler(:cancel, method(:on_confirm_cancel))
  1430.   end
  1431.   #--------------------------------------------------------------------------
  1432.   # ○ ウィンドウ再描画
  1433.   #--------------------------------------------------------------------------
  1434.   def refresh_window
  1435.     @actor_window.refresh
  1436.     @parameter_window.refresh
  1437.     @status_window.refresh(@parameter_window.parameter_key)
  1438.     Graphics.frame_reset
  1439.   end
  1440.   #--------------------------------------------------------------------------
  1441.   # ○ パラメータ選択 [決定]
  1442.   #--------------------------------------------------------------------------
  1443.   def on_parameter_ok
  1444.     command_confirm
  1445.   end
  1446.   #--------------------------------------------------------------------------
  1447.   # ○ パラメータ選択 [キャンセル]
  1448.   #--------------------------------------------------------------------------
  1449.   def on_parameter_cancel
  1450.     command_confirm
  1451.   end
  1452.   #--------------------------------------------------------------------------
  1453.   # ○ パラメータ選択 [加算]
  1454.   #--------------------------------------------------------------------------
  1455.   def on_parameter_increase
  1456.     param = @parameter_window.parameter_key
  1457.     unless @actor.can_distribute?(param)
  1458.       Sound.play_buzzer
  1459.       return
  1460.     end
  1461.     Sound.play_cursor
  1462.     @actor.rp_growth_effect(param)
  1463.     refresh_window
  1464.   end
  1465.   #--------------------------------------------------------------------------
  1466.   # ○ パラメータ選択 [減算]
  1467.   #--------------------------------------------------------------------------
  1468.   def on_parameter_decrease
  1469.     param = @parameter_window.parameter_key
  1470.     unless reversible?(param)
  1471.       Sound.play_buzzer
  1472.       return
  1473.     end
  1474.     Sound.play_cursor
  1475.     @actor.rp_growth_effect(param, true)
  1476.     refresh_window
  1477.   end
  1478.   #--------------------------------------------------------------------------
  1479.   # ○ ステータス更新
  1480.   #--------------------------------------------------------------------------
  1481.   def update_status
  1482.     @status_window.refresh(@parameter_window.parameter_key)
  1483.   end
  1484.   #--------------------------------------------------------------------------
  1485.   # ○ 減算可否判定
  1486.   #     param : 対象パラメータ
  1487.   #--------------------------------------------------------------------------
  1488.   def reversible?(param)
  1489.     return false if @actor.distributed_count(param) == 0
  1490.     return true  if KMS_DistributeParameter::ENABLE_REVERSE_DISTRIBUTE
  1491.  
  1492.     # 前回より減らなければ OK
  1493.     base = @prev_info.count[param]
  1494.     return ( base < @actor.distributed_count(param) )
  1495.   end
  1496.   #--------------------------------------------------------------------------
  1497.   # ○ パラメータウィンドウに切り替え
  1498.   #--------------------------------------------------------------------------
  1499.   def command_parameter
  1500.     @confirm_window.deactivate
  1501.     @confirm_window.close
  1502. #~     @help_window.close
  1503.     @parameter_window.activate
  1504.   end
  1505.   #--------------------------------------------------------------------------
  1506.   # ○ 確認ウィンドウに切り替え
  1507.   #--------------------------------------------------------------------------
  1508.   def command_confirm
  1509.     @status_window.refresh
  1510.     @confirm_window.index  = 0
  1511.     @confirm_window.activate
  1512.     @confirm_window.open
  1513. #~     @help_window.open
  1514.     @parameter_window.deactivate
  1515.   end
  1516.   #--------------------------------------------------------------------------
  1517.   # ○ 確認 [確定]
  1518.   #--------------------------------------------------------------------------
  1519.   def on_confirm_decide
  1520.     return_scene
  1521.   end
  1522.   #--------------------------------------------------------------------------
  1523.   # ○ 確認 [中止]
  1524.   #--------------------------------------------------------------------------
  1525.   def on_confirm_stop
  1526.     @actor.set_distribution_info(@prev_info)
  1527.     return_scene
  1528.   end
  1529.   #--------------------------------------------------------------------------
  1530.   # ○ 確認 [キャンセル]
  1531.   #--------------------------------------------------------------------------
  1532.   def on_confirm_cancel
  1533.     command_parameter
  1534.   end
  1535.   #--------------------------------------------------------------------------
  1536.   # ● アクターの切り替え
  1537.   #--------------------------------------------------------------------------
  1538.   def on_actor_change
  1539.     @prev_actor.set_distribution_info(@prev_info)
  1540.     @prev_info  = @actor.distribution_info
  1541.     @prev_actor = @actor
  1542.  
  1543.     @actor_window.actor     = @actor
  1544.     @parameter_window.actor = @actor
  1545.     @status_window.actor    = @actor
  1546.     @parameter_window.activate
  1547.     refresh_window
  1548.   end
  1549. end

速度加点没反应怎么回事脚本.zip

1.55 MB, 下载次数: 0

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 06:01

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表