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

Project1

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

[已经解决] 有个很喜欢的VX脚本,想找VA的版本

[复制链接]

Lv2.观梦者

梦石
0
星屑
836
在线时间
159 小时
注册时间
2012-6-3
帖子
124
跳转到指定楼层
1
发表于 2014-8-14 15:35:34 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 白玉楼的台阶 于 2014-8-14 16:47 编辑

这个脚本的大致作用是主角有一类特殊技能,可以在菜单里面像选择装备一样挑选使用,不同的技能消耗不同的CP值,总和不能超过一定数量
http://www.tu265.com/di-bc7cc1115b64c2f457cce8110285a2ea.png
http://www.tu265.com/di-ae1e4c83c66d00517295e27b982a1b7b.png
这是游戏中实际使用的效果
http://www.tu265.com/di-6a1d34d769f0a640a4a5c860348f0ff6.png
这是数据库里面对应技能的设定

下面是完整的脚本

RUBY 代码复制
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆ スキルCP制 - KGC_SkillCPSystem ◆ VX ◆
  3. #_/    ◇ Last update : 2009/09/13 ◇
  4. #_/----------------------------------------------------------------------------
  5. #_/  戦闘中に使用可能なスキルを限定する機能を追加します。
  6. #_/============================================================================
  7. #_/ 【装備】≪スキル習得装備≫ より下に導入してください。
  8. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  9.  
  10. #==============================================================================
  11. # ★ カスタマイズ項目 - Customize ★
  12. #==============================================================================
  13.  
  14. module KGC
  15. module SkillCPSystem
  16.   # ◆ 登録スキル最大数
  17.   MAX_SKILLS = 3
  18.   # ◆ CP の名称
  19.   VOCAB_CP   = "CP"
  20.   # ◆ CP の名称 (略)
  21.   VOCAB_CP_A = "C"
  22.   # ◆ ステータス画面に CP を表示する
  23.   SHOW_STATUS_CP = true
  24.  
  25.   # ◆ 消費 CP 既定値
  26.   #  消費 CP 未指定のスキルで使用。
  27.   DEFAULT_CP_COST = 1
  28.   # ◆ CP 上限
  29.   #  (固有 CP などを除いた) 素の状態での CP 上限。
  30.   CP_MAX = 20
  31.   # ◆ CP 下限
  32.   CP_MIN = 1
  33.   # ◆ 補正後の CP 上限
  34.   #  固有 CP や装備品による変動を含めた上限。
  35.   REVISED_CP_MAX = 20
  36.   # ◆ 補正後の CP 下限
  37.   REVISED_CP_MIN = 0
  38.   # ◆ 最大 CP 算出式
  39.   #   level..現在のレベル
  40.   #  自動的に整数変換するので、結果が小数になってもOK。
  41.   CP_CALC_EXP = "level * 0.5 + 1.0"
  42.   # ◆ アクター毎の最大 CP 算出式
  43.   PERSONAL_CP_CALC_EXP = []
  44.   #  ここから下に、アクターごとの最大 CP を
  45.   #   PERSONAL_CP_CALC_EXP[アクター ID] = "計算式"
  46.   #  という書式で指定。
  47.   #  計算式は CP_CALC_EXP と同様の書式。
  48.   #  指定しなかったアクターは CP_CALC_EXP を使用。
  49.   #   <例> ラルフだけ優遇
  50.   # PERSONAL_CP_CALC_EXP[1] = "level * 0.8 + 2.0"
  51.  
  52.   # ◆ 戦闘テスト時は無効化
  53.   #  true  : 戦闘テスト時は全スキルを使用可能。
  54.   #  false : 戦闘テスト時は (セットしない限り) 使用不可。
  55.   DISABLE_IN_BATTLETEST  = false
  56.   # ◆ 使用不可スキルもセット可能
  57.   SHOW_UNUSABLE_SKILL    = true
  58.   # ◆ 消費 CP 0 のスキルはセットしなくても使用可能
  59.   USABLE_COST_ZERO_SKILL = true
  60.   # ◆ パッシブスキルはセットしないと効果なし
  61.   #  ≪パッシブスキル≫ 導入時のみ有効。
  62.   PASSIVE_NEED_TO_SET    = true
  63.   # ◆ 新規習得スキルを自動的にセット
  64.   #  true  : 習得したスキルを空きスロットにセット。
  65.   #           ※ ≪スキル習得装備≫ で習得したスキルは無効。
  66.   #  false : 習得しただけではセットされない (手動でセット)。
  67.   AUTO_SET_NEW_SKILL     = false
  68.   # ◆ 消費 CP 0 の場合も消費 CP を表示する
  69.   #  true  : 消費 CP 0 でも表示
  70.   #  false : 消費 CP 1 以上の場合のみ表示
  71.   SHOW_ZERO_COST         = false
  72.  
  73.   # ◆ CP ゲージの色
  74.   #  数値  : \C[n] と同じ色。
  75.   #  Color : 指定した色。 ( Color.new(255, 128, 128) など )
  76.   GAUGE_START_COLOR = 13  # 開始色
  77.   GAUGE_END_COLOR   =  5  # 終了色
  78.  
  79.   # ◆ CP ゲージに汎用ゲージを使用する
  80.   #  ≪汎用ゲージ描画≫ 導入時のみ有効。
  81.   ENABLE_GENERIC_GAUGE = true
  82.   # ◆ CP ゲージ設定
  83.   #  画像は "Graphics/System" から読み込む。
  84.   GAUGE_IMAGE  = "GaugeCP"  # 画像
  85.   GAUGE_OFFSET = [-23, -2]  # 位置補正 [x, y]
  86.   GAUGE_LENGTH = -4         # 長さ補正
  87.   GAUGE_SLOPE  = 30         # 傾き (-89 ~ 89)
  88.  
  89.   # ◆ メニュー画面に「スキル設定」コマンドを追加する
  90.   #  追加する場所は、メニューコマンドの最下部です。
  91.   #  他の部分に追加したければ、≪カスタムメニューコマンド≫ をご利用ください。
  92.   USE_MENU_SET_SKILL_COMMAND = true
  93.   # ◆ メニュー画面の「スキル設定」コマンドの名称
  94.   VOCAB_MENU_SET_SKILL       = "设定技能"
  95.  
  96.   # ◆ 未設定項目の表示文字列
  97.   BLANK_TEXT   = "-  EMPTY  -"
  98.   # ◆ 設定解除の表示文字列
  99.   RELEASE_TEXT = "( 設定解除 )"
  100. end
  101. end
  102.  
  103. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  104.  
  105. $imported = {} if $imported == nil
  106. $imported["SkillCPSystem"] = true
  107.  
  108. module KGC::SkillCPSystem
  109.   module Regexp
  110.     module BaseItem
  111.       # 最大 CP
  112.       MAXCP_PLUS = /<(?:MAX|最大)CP\s*([\-\+]?\d+)>/
  113.       # 登録スキル数
  114.       BATTLE_SKILL_MAX = /<(?:BATTLE_SKILL_MAX|登録スキル数)\s*([\-\+]?\d+)>/i
  115.     end
  116.  
  117.     module Skill
  118.       # 消費 CP
  119.       CP_COST = /<CP\s*(\d+)>/i
  120.       # 同時セット不可
  121.       EXCLUDE = /<(?:EXCLUDE|同時セット不可)\s*(\d+(?:\s*,\s*\d+)*)>/
  122.     end
  123.   end
  124. end
  125.  
  126. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  127.  
  128. #==============================================================================
  129. # □ KGC::Commands
  130. #==============================================================================
  131.  
  132. module KGC
  133. module Commands
  134.   module_function
  135.   #--------------------------------------------------------------------------
  136.   # ○ MaxCP 補正値の取得
  137.   #     actor_id    : アクター ID
  138.   #     variable_id : 取得した値を代入する変数の ID
  139.   #--------------------------------------------------------------------------
  140.   def get_actor_own_cp(actor_id, variable_id = 0)
  141.     value = $game_actors[actor_id].maxcp_plus
  142.     $game_variables[variable_id] = value if variable_id > 0
  143.     return value
  144.   end
  145.   alias get_own_cp get_actor_own_cp
  146.   #--------------------------------------------------------------------------
  147.   # ○ MaxCP 補正値の変更
  148.   #     actor_id : アクター ID
  149.   #     value    : MaxCP 補正値
  150.   #--------------------------------------------------------------------------
  151.   def set_actor_own_cp(actor_id, value)
  152.     $game_actors[actor_id].maxcp_plus = value
  153.   end
  154.   alias set_own_cp set_actor_own_cp
  155.   #--------------------------------------------------------------------------
  156.   # ○ アクターの MaxCP 補正値の増加
  157.   #     actor_id : アクター ID
  158.   #     value    : 増加量
  159.   #--------------------------------------------------------------------------
  160.   def gain_actor_cp(actor_id, value)
  161.     $game_actors[actor_id].maxcp_plus += value
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ○ 登録スキル最大数の取得
  165.   #     actor_id : アクター ID
  166.   #     variable_id : 取得した値を代入する変数の ID
  167.   #--------------------------------------------------------------------------
  168.   def get_battle_skill_max(actor_id, variable_id = 0)
  169.     value = $game_actors[actor_id].battle_skill_max
  170.     $game_variables[variable_id] = value if variable_id > 0
  171.     return value
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ○ 登録スキル最大数の変更
  175.   #     actor_id : アクター ID
  176.   #     value    : 登録可能数
  177.   #--------------------------------------------------------------------------
  178.   def set_battle_skill_max(actor_id, value = -1)
  179.     $game_actors[actor_id].battle_skill_max = value
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ○ スキルが登録されているか
  183.   #     actor_id : アクター ID
  184.   #     skill_id : 確認するスキル ID
  185.   #--------------------------------------------------------------------------
  186.   def battle_skill_set?(actor_id, skill_id)
  187.     return $game_actors[actor_id].battle_skill_ids.include?(skill_id)
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   # ○ スキルの登録
  191.   #     actor_id : アクター ID
  192.   #     index    : 登録箇所
  193.   #     skill_id : 登録するスキル ID (nil で解除)
  194.   #--------------------------------------------------------------------------
  195.   def set_battle_skill(actor_id, index, skill_id = nil)
  196.     actor = $game_actors[actor_id]
  197.     if skill_id.is_a?(Integer)
  198.       # 登録
  199.       skill = $data_skills[skill_id]
  200.       return unless actor.battle_skill_settable?(index, skill)  # セット不可
  201.  
  202.       actor.set_battle_skill(index, skill)
  203.       actor.restore_battle_skill
  204.     else
  205.       # 解除
  206.       actor.remove_battle_skill(index)
  207.     end
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # ○ スキルの追加登録
  211.   #     actor_id : アクター ID
  212.   #     skill_id : 登録するスキル ID
  213.   #--------------------------------------------------------------------------
  214.   def add_battle_skill(actor_id, skill_id)
  215.     actor = $game_actors[actor_id]
  216.     skill = $data_skills[skill_id]
  217.     return if actor == nil || skill == nil
  218.  
  219.     actor.add_battle_skill(skill)
  220.   end
  221.   #--------------------------------------------------------------------------
  222.   # ○ スキルの全解除
  223.   #     actor_id : アクター ID
  224.   #--------------------------------------------------------------------------
  225.   def clear_battle_skill(actor_id)
  226.     $game_actors[actor_id].clear_battle_skill
  227.   end
  228.   #--------------------------------------------------------------------------
  229.   # ○ スキル設定画面の呼び出し
  230.   #     actor_index : アクターインデックス
  231.   #--------------------------------------------------------------------------
  232.   def call_set_battle_skill(actor_index = 0)
  233.     return if $game_temp.in_battle
  234.     $game_temp.next_scene = :set_battle_skill
  235.     $game_temp.next_scene_actor_index = actor_index
  236.   end
  237. end
  238. end
  239.  
  240. class Game_Interpreter
  241.   include KGC::Commands
  242. end
  243.  
  244. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  245.  
  246. #==============================================================================
  247. # ■ Vocab
  248. #==============================================================================
  249.  
  250. module Vocab
  251.   # CP
  252.   def self.cp
  253.     return KGC::SkillCPSystem::VOCAB_CP
  254.   end
  255.  
  256.   # CP (略)
  257.   def self.cp_a
  258.     return KGC::SkillCPSystem::VOCAB_CP_A
  259.   end
  260.  
  261.   # スキル設定
  262.   def self.set_battle_skill
  263.     return KGC::SkillCPSystem::VOCAB_MENU_SET_SKILL
  264.   end
  265. end
  266.  
  267. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  268.  
  269. #==============================================================================
  270. # ■ RPG::BaseItem
  271. #==============================================================================
  272.  
  273. class RPG::BaseItem
  274.   #--------------------------------------------------------------------------
  275.   # ○ スキルCP制のキャッシュを生成
  276.   #--------------------------------------------------------------------------
  277.   def create_skill_cp_system_cache
  278.     @__maxcp_plus = 0
  279.     @__battle_skill_max_plus = 0
  280.  
  281.     self.note.each_line { |line|
  282.       case line
  283.       when KGC::SkillCPSystem::Regexp::BaseItem::MAXCP_PLUS
  284.         # 最大 CP
  285.         @__maxcp_plus += $1.to_i
  286.       when KGC::SkillCPSystem::Regexp::BaseItem::BATTLE_SKILL_MAX
  287.         # 登録スキル数
  288.         @__battle_skill_max_plus += $1.to_i
  289.       end
  290.     }
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ○ 最大 CP 補正
  294.   #--------------------------------------------------------------------------
  295.   def maxcp_plus
  296.     create_skill_cp_system_cache if @__maxcp_plus == nil
  297.     return @__maxcp_plus
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ○ 登録スキル数補正
  301.   #--------------------------------------------------------------------------
  302.   def battle_skill_max_plus
  303.     create_skill_cp_system_cache if @__battle_skill_max_plus == nil
  304.     return @__battle_skill_max_plus
  305.   end
  306. end
  307.  
  308. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  309.  
  310. #==============================================================================
  311. # ■ RPG::Skill
  312. #==============================================================================
  313.  
  314. class RPG::Skill < RPG::UsableItem
  315.   #--------------------------------------------------------------------------
  316.   # ○ スキルCP制のキャッシュを生成
  317.   #--------------------------------------------------------------------------
  318.   def create_skill_cp_system_cache
  319.     @__cp_cost = KGC::SkillCPSystem::DEFAULT_CP_COST
  320.     @__excluded_skills = []
  321.  
  322.     self.note.each_line { |line|
  323.       case line
  324.       when KGC::SkillCPSystem::Regexp::Skill::CP_COST
  325.         # 消費 CP
  326.         @__cp_cost = $1.to_i
  327.       when KGC::SkillCPSystem::Regexp::Skill::EXCLUDE
  328.         # 同時セット不可
  329.         $1.scan(/\d+/).each { |num| @__excluded_skills << num.to_i }
  330.         @__excluded_skills.uniq!
  331.       end
  332.     }
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   # ○ 消費 CP
  336.   #--------------------------------------------------------------------------
  337.   def cp_cost
  338.     create_skill_cp_system_cache if @__cp_cost == nil
  339.     return @__cp_cost
  340.   end
  341.   #--------------------------------------------------------------------------
  342.   # ○ 同時セット不可
  343.   #--------------------------------------------------------------------------
  344.   def excluded_skills
  345.     create_skill_cp_system_cache if @__excluded_skills == nil
  346.     return @__excluded_skills
  347.   end
  348. end
  349.  
  350. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  351.  
  352. #==============================================================================
  353. # ■ Game_Battler
  354. #==============================================================================
  355.  
  356. class Game_Battler
  357.   #--------------------------------------------------------------------------
  358.   # ○ 戦闘用スキルセット済み判定
  359.   #     skill : スキル
  360.   #--------------------------------------------------------------------------
  361.   def battle_skill_set?(skill)
  362.     return true
  363.   end
  364. end
  365.  
  366. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  367.  
  368. #==============================================================================
  369. # ■ Game_Actor
  370. #==============================================================================
  371.  
  372. class Game_Actor < Game_Battler
  373.   #--------------------------------------------------------------------------
  374.   # ● 公開インスタンス変数
  375.   #--------------------------------------------------------------------------
  376.   attr_writer   :maxcp_plus               # MaxCP 補正値
  377.   #--------------------------------------------------------------------------
  378.   # ○ MaxCP 取得
  379.   #--------------------------------------------------------------------------
  380.   def maxcp
  381.     calc_exp = KGC::SkillCPSystem::PERSONAL_CP_CALC_EXP[self.id]
  382.     if calc_exp == nil
  383.       calc_exp = KGC::SkillCPSystem::CP_CALC_EXP
  384.     end
  385.     n = Integer(eval(calc_exp))
  386.     n = [[n, cp_limit].min, KGC::SkillCPSystem::CP_MIN].max
  387.     n += maxcp_plus + maxcp_plus_equip
  388.     return [[n, revised_cp_limit].min, KGC::SkillCPSystem::REVISED_CP_MIN].max
  389.   end
  390.   #--------------------------------------------------------------------------
  391.   # ○ CP 取得
  392.   #--------------------------------------------------------------------------
  393.   def cp
  394.     return [maxcp - consumed_cp, 0].max
  395.   end
  396.   #--------------------------------------------------------------------------
  397.   # ○ CP 消費量取得
  398.   #--------------------------------------------------------------------------
  399.   def consumed_cp
  400.     n = 0
  401.     battle_skills.compact.each { |skill| n += skill.cp_cost }
  402.     return n
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # ○ CP 上限取得
  406.   #--------------------------------------------------------------------------
  407.   def cp_limit
  408.     return KGC::SkillCPSystem::CP_MAX
  409.   end
  410.   #--------------------------------------------------------------------------
  411.   # ○ 補正後の CP 上限取得
  412.   #--------------------------------------------------------------------------
  413.   def revised_cp_limit
  414.     return KGC::SkillCPSystem::REVISED_CP_MAX
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # ○ MaxCP 補正値取得
  418.   #--------------------------------------------------------------------------
  419.   def maxcp_plus
  420.     if @maxcp_plus == nil
  421.       if @own_cp != nil
  422.         @maxcp_plus = @own_cp
  423.         @own_cp = nil
  424.       else
  425.         @maxcp_plus = 0
  426.       end
  427.     end
  428.     return @maxcp_plus
  429.   end
  430.   #--------------------------------------------------------------------------
  431.   # ○ 装備品による MaxCP 補正値取得
  432.   #--------------------------------------------------------------------------
  433.   def maxcp_plus_equip
  434.     n = 0
  435.     equips.compact.each { |item| n += item.maxcp_plus }
  436.     return n
  437.   end
  438.   #--------------------------------------------------------------------------
  439.   # ● スキル取得
  440.   #--------------------------------------------------------------------------
  441.   alias skills_KGC_SkillCPSystem skills
  442.   def skills
  443.     return (skill_cp_restrict? ? restricted_skills : skills_KGC_SkillCPSystem)
  444.   end
  445.   #--------------------------------------------------------------------------
  446.   # ○ スキルを制限するか
  447.   #--------------------------------------------------------------------------
  448.   def skill_cp_restrict?
  449.     if $game_temp.in_battle
  450.       # 戦闘テストでないか、戦闘テストでも制限する場合
  451.       return true unless $BTEST && KGC::SkillCPSystem::DISABLE_IN_BATTLETEST
  452.     end
  453.  
  454.     return false
  455.   end
  456.   #--------------------------------------------------------------------------
  457.   # ○ スキルを制限
  458.   #--------------------------------------------------------------------------
  459.   def restricted_skills
  460.     result = all_skills
  461.     result.each_with_index { |skill, i|
  462.       # 消費 CP > 0 のスキルを除外
  463.       if !KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL || skill.cp_cost > 0
  464.         result[i] = nil
  465.       end
  466.       # パッシブスキルを除外
  467.       if $imported["PassiveSkill"] && KGC::SkillCPSystem::PASSIVE_NEED_TO_SET
  468.         if skill.passive &&
  469.             (!KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL || skill.cp_cost > 0)
  470.           result[i] = nil
  471.         end
  472.       end
  473.     }
  474.     result.compact!
  475.     # 戦闘スキルを追加
  476.     result |= battle_skills
  477.     result.sort! { |a, b| a.id <=> b.id }
  478.     return result
  479.   end
  480.   #--------------------------------------------------------------------------
  481.   # ○ 全スキル取得
  482.   #--------------------------------------------------------------------------
  483.   def all_skills
  484.     # 一時的に非戦闘中にする
  485.     last_in_battle = $game_temp.in_battle
  486.     $game_temp.in_battle = false
  487.  
  488.     result = skills_KGC_SkillCPSystem
  489.     if $imported["EquipLearnSkill"]
  490.       result |= (equipment_skills | full_ap_skills)
  491.       result.sort! { |a, b| a.id <=> b.id }
  492.     end
  493.  
  494.     # 戦闘中フラグを戻す
  495.     $game_temp.in_battle = last_in_battle
  496.  
  497.     return result
  498.   end
  499.   #--------------------------------------------------------------------------
  500.   # ○ 登録スキル最大数取得
  501.   #--------------------------------------------------------------------------
  502.   def battle_skill_max
  503.     @battle_skill_max = -1 if @battle_skill_max == nil
  504.     n = (@battle_skill_max < 0 ?
  505.       KGC::SkillCPSystem::MAX_SKILLS : @battle_skill_max)
  506.     n += equipment_battle_skill_max_plus
  507.     return [n, 0].max
  508.   end
  509.   #--------------------------------------------------------------------------
  510.   # ○ 装備品による登録スキル数補正
  511.   #--------------------------------------------------------------------------
  512.   def equipment_battle_skill_max_plus
  513.     n = 0
  514.     equips.compact.each { |item| n += item.battle_skill_max_plus }
  515.     return n
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # ○ 登録スキル最大数設定
  519.   #--------------------------------------------------------------------------
  520.   def battle_skill_max=(value)
  521.     @battle_skill_max = value
  522.     if @battle_skills == nil
  523.       @battle_skills = []
  524.     else
  525.       @battle_skills = @battle_skills[0...value]
  526.     end
  527.     restore_passive_rev if $imported["PassiveSkill"]
  528.   end
  529.   #--------------------------------------------------------------------------
  530.   # ○ 戦闘用スキル ID 取得
  531.   #--------------------------------------------------------------------------
  532.   def battle_skill_ids
  533.     @battle_skills = [] if @battle_skills == nil
  534.     return @battle_skills
  535.   end
  536.   #--------------------------------------------------------------------------
  537.   # ○ 戦闘用スキル取得
  538.   #--------------------------------------------------------------------------
  539.   def battle_skills
  540.     result = []
  541.     battle_skill_ids.each { |i|
  542.       next if i == nil           # 無効なスキルは無視
  543.       result << $data_skills[i]
  544.     }
  545.     return result
  546.   end
  547.   #--------------------------------------------------------------------------
  548.   # ○ 戦闘用スキル登録
  549.   #     index : 位置
  550.   #     skill : スキル (nil で解除)
  551.   #--------------------------------------------------------------------------
  552.   def set_battle_skill(index, skill)
  553.     if skill == nil
  554.       @battle_skills[index] = nil
  555.     else
  556.       return unless skill.is_a?(RPG::Skill)  # スキル以外
  557.       return if cp < skill.cp_cost           # CP 不足
  558.       return if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0
  559.  
  560.       @battle_skills[index] = skill.id
  561.     end
  562.     restore_passive_rev if $imported["PassiveSkill"]
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # ○ 戦闘用スキル追加登録
  566.   #     skill : スキル
  567.   #--------------------------------------------------------------------------
  568.   def add_battle_skill(skill)
  569.     return unless skill.is_a?(RPG::Skill)  # スキル以外
  570.     skills = battle_skill_ids
  571.     return if skills.include?(skill.id)    # 登録済み
  572.     return if cp < skill.cp_cost           # CP 不足
  573.     return if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0
  574.  
  575.     battle_skill_max.times { |i|
  576.       # 空きがあれば登録
  577.       if skills[i] == nil
  578.         set_battle_skill(i, skill)
  579.         break
  580.       end
  581.     }
  582.     restore_battle_skill
  583.   end
  584.   #--------------------------------------------------------------------------
  585.   # ○ 戦闘用スキル解除
  586.   #     index : 位置
  587.   #--------------------------------------------------------------------------
  588.   def remove_battle_skill(index)
  589.     @battle_skills[index] = nil
  590.     restore_passive_rev if $imported["PassiveSkill"]
  591.   end
  592.   #--------------------------------------------------------------------------
  593.   # ○ 戦闘用スキル全解除
  594.   #--------------------------------------------------------------------------
  595.   def clear_battle_skill
  596.     @battle_skills = []
  597.     restore_passive_rev if $imported["PassiveSkill"]
  598.   end
  599.   #--------------------------------------------------------------------------
  600.   # ○ 戦闘用スキルセット可否判定
  601.   #     index : 位置
  602.   #     skill : スキル
  603.   #--------------------------------------------------------------------------
  604.   def battle_skill_settable?(index, skill)
  605.     return false if battle_skill_max <= index  # 範囲外
  606.     return true  if skill == nil               # nil は解除なので OK
  607.  
  608.     return false if battle_skill_ids.include?(skill.id)  # セット済み
  609.  
  610.     curr_skill_id = battle_skill_ids[index]
  611.     curr_skill    = (curr_skill_id != nil ? $data_skills[curr_skill_id] : nil)
  612.  
  613.     # 同時セット不可
  614.     excluded  = excluded_battle_skill_ids
  615.     excluded -= curr_skill.excluded_skills if curr_skill != nil
  616.     return false if excluded.include?(skill.id)
  617.  
  618.     offset = (curr_skill != nil ? curr_skill.cp_cost : 0)
  619.     return false if self.cp < (skill.cp_cost - offset)  # CP 不足
  620.  
  621.     return true
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # ○ Exclude スキル ID 取得
  625.   #--------------------------------------------------------------------------
  626.   def excluded_battle_skill_ids
  627.     result = []
  628.     battle_skills.each { |skill| result |= skill.excluded_skills }
  629.     return result
  630.   end
  631.   #--------------------------------------------------------------------------
  632.   # ○ 戦闘用スキルを修復
  633.   #--------------------------------------------------------------------------
  634.   def restore_battle_skill
  635.     result = battle_skill_ids.clone
  636.     usable_skills = all_skills
  637.  
  638.     result.each_with_index { |n, i|
  639.       next if n == nil
  640.       # 未修得の場合は解除
  641.       if (usable_skills.find { |s| s.id == n }) == nil
  642.         result[i] = nil
  643.       end
  644.     }
  645.     @battle_skills = result[0...battle_skill_max]
  646.     # CP 不足のスキルを下から順に外す
  647.     (battle_skill_max - 1).downto(0) { |i|
  648.       @battle_skills[i] = nil if maxcp - consumed_cp < 0
  649.     }
  650.   end
  651.   #--------------------------------------------------------------------------
  652.   # ● 装備の変更 (オブジェクトで指定)
  653.   #     equip_type : 装備部位 (0..4)
  654.   #     item       : 武器 or 防具 (nil なら装備解除)
  655.   #     test       : テストフラグ (戦闘テスト、または装備画面での一時装備)
  656.   #--------------------------------------------------------------------------
  657.   alias change_equip_KGC_SkillCPSystem change_equip
  658.   def change_equip(equip_type, item, test = false)
  659.     change_equip_KGC_SkillCPSystem(equip_type, item, test)
  660.  
  661.     unless test
  662.       restore_battle_skill
  663.       restore_passive_rev if $imported["PassiveSkill"]
  664.     end
  665.   end
  666.   #--------------------------------------------------------------------------
  667.   # ● 装備の破棄
  668.   #     item : 破棄する武器 or 防具
  669.   #    武器/防具の増減で「装備品も含める」のとき使用する。
  670.   #--------------------------------------------------------------------------
  671.   alias discard_equip_KGC_SkillCPSystem discard_equip
  672.   def discard_equip(item)
  673.     discard_equip_KGC_SkillCPSystem(item)
  674.  
  675.     restore_battle_skill
  676.     restore_passive_rev if $imported["PassiveSkill"]
  677.   end
  678.   #--------------------------------------------------------------------------
  679.   # ● 経験値の変更
  680.   #     exp  : 新しい経験値
  681.   #     show : レベルアップ表示フラグ
  682.   #--------------------------------------------------------------------------
  683.   alias change_exp_KGC_SkillCPSystem change_exp
  684.   def change_exp(exp, show)
  685.     # 習得したスキルを表示するため、戦闘中フラグを一時的に解除
  686.     last_in_battle = $game_temp.in_battle
  687.     $game_temp.in_battle = false
  688.  
  689.     change_exp_KGC_SkillCPSystem(exp, show)
  690.  
  691.     $game_temp.in_battle = last_in_battle
  692.   end
  693.  
  694.   if KGC::SkillCPSystem::AUTO_SET_NEW_SKILL
  695.   #--------------------------------------------------------------------------
  696.   # ● スキルを覚える
  697.   #     skill_id : スキル ID
  698.   #--------------------------------------------------------------------------
  699.   alias learn_skill_KGC_SkillCPSystem learn_skill
  700.   def learn_skill(skill_id)
  701.     learn_skill_KGC_SkillCPSystem(skill_id)
  702.  
  703.     add_battle_skill($data_skills[skill_id])
  704.   end
  705.   end  # <- if KGC::SkillCPSystem::AUTO_SET_NEW_SKILL
  706.  
  707.   #--------------------------------------------------------------------------
  708.   # ● スキルを忘れる
  709.   #     skill_id : スキル ID
  710.   #--------------------------------------------------------------------------
  711.   alias forget_skill_KGC_SkillCPSystem forget_skill
  712.   def forget_skill(skill_id)
  713.     # 忘れるスキルを戦闘用スキルから削除
  714.     battle_skill_ids.each_with_index { |s, i|
  715.       remove_battle_skill(i) if s == skill_id
  716.     }
  717.  
  718.     forget_skill_KGC_SkillCPSystem(skill_id)
  719.   end
  720.   #--------------------------------------------------------------------------
  721.   # ○ 戦闘用スキルセット済み判定
  722.   #     skill : スキル
  723.   #--------------------------------------------------------------------------
  724.   def battle_skill_set?(skill)
  725.     return false unless skill.is_a?(RPG::Skill)  # スキル以外
  726.  
  727.     return battle_skill_ids.include?(skill.id)
  728.   end
  729. end
  730.  
  731. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  732.  
  733. #==============================================================================
  734. # ■ Window_Base
  735. #==============================================================================
  736.  
  737. class Window_Base < Window
  738.   #--------------------------------------------------------------------------
  739.   # ○ CP の文字色を取得
  740.   #     actor : アクター
  741.   #--------------------------------------------------------------------------
  742.   def cp_color(actor)
  743.     return knockout_color if actor.maxcp > 0 && actor.cp == 0
  744.     return normal_color
  745.   end
  746.   #--------------------------------------------------------------------------
  747.   # ○ CP ゲージの色 1 の取得
  748.   #--------------------------------------------------------------------------
  749.   def cp_gauge_color1
  750.     color = KGC::SkillCPSystem::GAUGE_START_COLOR
  751.     return (color.is_a?(Integer) ? text_color(color) : color)
  752.   end
  753.   #--------------------------------------------------------------------------
  754.   # ○ CP ゲージの色 2 の取得
  755.   #--------------------------------------------------------------------------
  756.   def cp_gauge_color2
  757.     color = KGC::SkillCPSystem::GAUGE_END_COLOR
  758.     return (color.is_a?(Integer) ? text_color(color) : color)
  759.   end
  760.   #--------------------------------------------------------------------------
  761.   # ○ CP の描画
  762.   #     actor : アクター
  763.   #     x     : 描画先 X 座標
  764.   #     y     : 描画先 Y 座標
  765.   #     width : 幅
  766.   #--------------------------------------------------------------------------
  767.   def draw_actor_cp(actor, x, y, width = 120)
  768.     draw_actor_cp_gauge(actor, x, y, width)
  769.     self.contents.font.color = system_color
  770.     self.contents.draw_text(x, y, 30, WLH, Vocab::cp_a)
  771.     self.contents.font.color = cp_color(actor)
  772.     xr = x + width
  773.     if width < 120
  774.       self.contents.draw_text(xr - 40, y, 40, WLH, actor.cp, 2)
  775.     else
  776.       self.contents.draw_text(xr - 90, y, 40, WLH, actor.cp, 2)
  777.       self.contents.font.color = normal_color
  778.       self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
  779.       self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxcp, 2)
  780.     end
  781.     self.contents.font.color = normal_color
  782.   end
  783.   #--------------------------------------------------------------------------
  784.   # ○ CP ゲージの描画
  785.   #     actor : アクター
  786.   #     x     : 描画先 X 座標
  787.   #     y     : 描画先 Y 座標
  788.   #     width : 幅
  789.   #--------------------------------------------------------------------------
  790.   def draw_actor_cp_gauge(actor, x, y, width = 120)
  791.     if KGC::SkillCPSystem::ENABLE_GENERIC_GAUGE && $imported["GenericGauge"]
  792.       # 汎用ゲージ
  793.       draw_gauge(KGC::SkillCPSystem::GAUGE_IMAGE,
  794.         x, y, width, actor.cp, [actor.maxcp, 1].max,
  795.         KGC::SkillCPSystem::GAUGE_OFFSET,
  796.         KGC::SkillCPSystem::GAUGE_LENGTH,
  797.         KGC::SkillCPSystem::GAUGE_SLOPE)
  798.     else
  799.       # デフォルトゲージ
  800.       gw = width * actor.cp / [actor.maxcp, 1].max
  801.       gc1 = cp_gauge_color1
  802.       gc2 = cp_gauge_color2
  803.       self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
  804.       self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  805.     end
  806.   end
  807. end
  808.  
  809. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  810.  
  811. #==============================================================================
  812. # ■ Window_Command
  813. #==============================================================================
  814.  
  815. class Window_Command < Window_Selectable
  816.   unless method_defined?(:add_command)
  817.   #--------------------------------------------------------------------------
  818.   # ○ コマンドを追加
  819.   #    追加した位置を返す
  820.   #--------------------------------------------------------------------------
  821.   def add_command(command)
  822.     @commands << command
  823.     @item_max = @commands.size
  824.     item_index = @item_max - 1
  825.     refresh_command
  826.     draw_item(item_index)
  827.     return item_index
  828.   end
  829.   #--------------------------------------------------------------------------
  830.   # ○ コマンドをリフレッシュ
  831.   #--------------------------------------------------------------------------
  832.   def refresh_command
  833.     buf = self.contents.clone
  834.     self.height = [self.height, row_max * WLH + 32].max
  835.     create_contents
  836.     self.contents.blt(0, 0, buf, buf.rect)
  837.     buf.dispose
  838.   end
  839.   #--------------------------------------------------------------------------
  840.   # ○ コマンドを挿入
  841.   #--------------------------------------------------------------------------
  842.   def insert_command(index, command)
  843.     @commands.insert(index, command)
  844.     @item_max = @commands.size
  845.     refresh_command
  846.     refresh
  847.   end
  848.   #--------------------------------------------------------------------------
  849.   # ○ コマンドを削除
  850.   #--------------------------------------------------------------------------
  851.   def remove_command(command)
  852.     @commands.delete(command)
  853.     @item_max = @commands.size
  854.     refresh
  855.   end
  856.   end
  857. end
  858.  
  859. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  860.  
  861. #==============================================================================
  862. # ■ Window_Status
  863. #==============================================================================
  864.  
  865. if KGC::SkillCPSystem::SHOW_STATUS_CP
  866. class Window_Status < Window_Base
  867.   #--------------------------------------------------------------------------
  868.   # ● 基本情報の描画
  869.   #     x : 描画先 X 座標
  870.   #     y : 描画先 Y 座標
  871.   #--------------------------------------------------------------------------
  872.   alias draw_basic_info_KGC_SkillCPSystem draw_basic_info
  873.   def draw_basic_info(x, y)
  874.     draw_basic_info_KGC_SkillCPSystem(x, y)
  875.  
  876.     draw_actor_cp(@actor, x, y + WLH * 4)
  877.   end
  878. end
  879. end
  880.  
  881. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  882.  
  883. #==============================================================================
  884. # □ Window_BattleSkillStatus
  885. #------------------------------------------------------------------------------
  886. #   戦闘スキル設定画面で、設定者のステータスを表示するウィンドウです。
  887. #==============================================================================
  888.  
  889. class Window_BattleSkillStatus < Window_Base
  890.   #--------------------------------------------------------------------------
  891.   # ● オブジェクト初期化
  892.   #     x     : ウィンドウの X 座標
  893.   #     y     : ウィンドウの Y 座標
  894.   #     actor : アクター
  895.   #--------------------------------------------------------------------------
  896.   def initialize(x, y, actor)
  897.     super(x, y, Graphics.width, WLH + 32)
  898.     @actor = actor
  899.     refresh
  900.   end
  901.   #--------------------------------------------------------------------------
  902.   # ● リフレッシュ
  903.   #--------------------------------------------------------------------------
  904.   def refresh
  905.     self.contents.clear
  906.     draw_actor_name(@actor, 4, 0)
  907.     draw_actor_level(@actor, 140, 0)
  908.     draw_actor_cp(@actor, 240, 0)
  909.   end
  910. end
  911.  
  912. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  913.  
  914. #==============================================================================
  915. # □ Window_BattleSkillSlot
  916. #------------------------------------------------------------------------------
  917. #   戦闘スキル選択画面で、設定したスキルの一覧を表示するウィンドウです。
  918. #==============================================================================
  919.  
  920. class Window_BattleSkillSlot < Window_Selectable
  921.   #--------------------------------------------------------------------------
  922.   # ● オブジェクト初期化
  923.   #     x      : ウィンドウの X 座標
  924.   #     y      : ウィンドウの Y 座標
  925.   #     width  : ウィンドウの幅
  926.   #     height : ウィンドウの高さ
  927.   #     actor  : アクター
  928.   #--------------------------------------------------------------------------
  929.   def initialize(x, y, width, height, actor)
  930.     super(x, y, width, height)
  931.     @actor = actor
  932.     self.index = 0
  933.     self.active = false
  934.     refresh
  935.   end
  936.   #--------------------------------------------------------------------------
  937.   # ○ スキルの取得
  938.   #--------------------------------------------------------------------------
  939.   def skill
  940.     return @data[self.index]
  941.   end
  942.   #--------------------------------------------------------------------------
  943.   # ● リフレッシュ
  944.   #--------------------------------------------------------------------------
  945.   def refresh
  946.     @data = []
  947.     skill_ids = @actor.battle_skill_ids
  948.     @actor.battle_skill_max.times { |i|
  949.       if skill_ids[i] != nil
  950.         @data << $data_skills[skill_ids[i]]
  951.       else
  952.         @data << nil
  953.       end
  954.     }
  955.     @item_max = @data.size
  956.     create_contents
  957.     @item_max.times { |i| draw_item(i) }
  958.   end
  959.   #--------------------------------------------------------------------------
  960.   # ○ 消費 CP 描画判定
  961.   #--------------------------------------------------------------------------
  962.   def cp_cost_show?(skill)
  963.     return true if KGC::SkillCPSystem::SHOW_ZERO_COST
  964.  
  965.     return (skill.cp_cost > 0)
  966.   end
  967.   #--------------------------------------------------------------------------
  968.   # ○ 項目の描画
  969.   #     index : 項目番号
  970.   #--------------------------------------------------------------------------
  971.   def draw_item(index)
  972.     rect = item_rect(index)
  973.     self.contents.clear_rect(rect)
  974.     skill = @data[index]
  975.     if skill != nil
  976.       rect.width -= 4
  977.       draw_item_name(skill, rect.x, rect.y)
  978.       self.contents.draw_text(rect, skill.cp_cost, 2) if cp_cost_show?(skill)
  979.     else
  980.       self.contents.draw_text(rect, KGC::SkillCPSystem::BLANK_TEXT, 1)
  981.     end
  982.   end
  983.   #--------------------------------------------------------------------------
  984.   # ● カーソルを 1 ページ後ろに移動
  985.   #--------------------------------------------------------------------------
  986.   def cursor_pagedown
  987.     return if Input.repeat?(Input::R)
  988.     super
  989.   end
  990.   #--------------------------------------------------------------------------
  991.   # ● カーソルを 1 ページ前に移動
  992.   #--------------------------------------------------------------------------
  993.   def cursor_pageup
  994.     return if Input.repeat?(Input::L)
  995.     super
  996.   end
  997.   #--------------------------------------------------------------------------
  998.   # ● フレーム更新
  999.   #--------------------------------------------------------------------------
  1000.   def update
  1001.     super
  1002.     return unless self.active
  1003.  
  1004.     if Input.repeat?(Input::RIGHT)
  1005.       Sound.play_cursor
  1006.       cursor_pagedown
  1007.     elsif Input.repeat?(Input::LEFT)
  1008.       Sound.play_cursor
  1009.       cursor_pageup
  1010.     end
  1011.   end
  1012.   #--------------------------------------------------------------------------
  1013.   # ● ヘルプテキスト更新
  1014.   #--------------------------------------------------------------------------
  1015.   def update_help
  1016.     @help_window.set_text(skill == nil ? "" : skill.description)
  1017.   end
  1018. end
  1019.  
  1020. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1021.  
  1022. #==============================================================================
  1023. # □ Window_BattleSkillList
  1024. #------------------------------------------------------------------------------
  1025. #   戦闘スキル選択画面で、設定できるスキルの一覧を表示するウィンドウです。
  1026. #==============================================================================
  1027.  
  1028. class Window_BattleSkillList < Window_Selectable
  1029.   #--------------------------------------------------------------------------
  1030.   # ● 公開インスタンス変数
  1031.   #--------------------------------------------------------------------------
  1032.   attr_accessor :slot_index               # スロット番号
  1033.   #--------------------------------------------------------------------------
  1034.   # ● オブジェクト初期化
  1035.   #     x      : ウィンドウの X 座標
  1036.   #     y      : ウィンドウの Y 座標
  1037.   #     width  : ウィンドウの幅
  1038.   #     height : ウィンドウの高さ
  1039.   #     actor  : アクター
  1040.   #--------------------------------------------------------------------------
  1041.   def initialize(x, y, width, height, actor)
  1042.     super(x, y, width, height)
  1043.     @actor = actor
  1044.     @slot_index = 0
  1045.     self.index = 0
  1046.     self.active = false
  1047.     refresh
  1048.   end
  1049.   #--------------------------------------------------------------------------
  1050.   # ○ スキルの取得
  1051.   #--------------------------------------------------------------------------
  1052.   def skill
  1053.     return @data[self.index]
  1054.   end
  1055.   #--------------------------------------------------------------------------
  1056.   # ● リフレッシュ
  1057.   #--------------------------------------------------------------------------
  1058.   def refresh
  1059.     @data = [nil]
  1060.     # 選択可能なスキルのみを取得
  1061.     @actor.all_skills.each { |skill|
  1062.       @data.push(skill) if selectable?(skill)
  1063.     }
  1064.  
  1065.     @item_max = @data.size
  1066.     create_contents
  1067.     @item_max.times { |i| draw_item(i) }
  1068.   end
  1069.   #--------------------------------------------------------------------------
  1070.   # ○ スキル選択可否判定
  1071.   #     skill : スキル
  1072.   #--------------------------------------------------------------------------
  1073.   def selectable?(skill)
  1074.     return false if skill == nil
  1075.  
  1076.     # 消費 CP 0 なら常に使用可能な場合
  1077.     if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0
  1078.       return false
  1079.     end
  1080.     # 戦闘時に使用可能ならOK
  1081.     return true if skill.battle_ok?
  1082.     # 使用不可でもセット可能な場合
  1083.     if KGC::SkillCPSystem::SHOW_UNUSABLE_SKILL && skill.occasion == 3
  1084.       return true
  1085.     end
  1086.  
  1087.     return false
  1088.   end
  1089.   #--------------------------------------------------------------------------
  1090.   # ○ 消費 CP 描画判定
  1091.   #--------------------------------------------------------------------------
  1092.   def cp_cost_show?(skill)
  1093.     return true if KGC::SkillCPSystem::SHOW_ZERO_COST
  1094.  
  1095.     return (skill.cp_cost > 0)
  1096.   end
  1097.   #--------------------------------------------------------------------------
  1098.   # ○ 項目の描画
  1099.   #     index : 項目番号
  1100.   #--------------------------------------------------------------------------
  1101.   def draw_item(index)
  1102.     rect = item_rect(index)
  1103.     self.contents.clear_rect(rect)
  1104.     skill = @data[index]
  1105.     if skill != nil
  1106.       rect.width -= 4
  1107.       enabled = @actor.battle_skill_settable?(@slot_index, skill)
  1108.       draw_item_name(skill, rect.x, rect.y, enabled)
  1109.       self.contents.draw_text(rect, skill.cp_cost, 2) if cp_cost_show?(skill)
  1110.     else
  1111.       self.contents.draw_text(rect, KGC::SkillCPSystem::RELEASE_TEXT, 1)
  1112.     end
  1113.   end
  1114.   #--------------------------------------------------------------------------
  1115.   # ● フレーム更新
  1116.   #--------------------------------------------------------------------------
  1117.   def update
  1118.     super
  1119.     return unless self.active
  1120.  
  1121.     if Input.repeat?(Input::RIGHT)
  1122.       cursor_pagedown
  1123.     elsif Input.repeat?(Input::LEFT)
  1124.       cursor_pageup
  1125.     end
  1126.   end
  1127.   #--------------------------------------------------------------------------
  1128.   # ● ヘルプテキスト更新
  1129.   #--------------------------------------------------------------------------
  1130.   def update_help
  1131.     @help_window.set_text(skill == nil ? "" : skill.description)
  1132.   end
  1133. end
  1134.  
  1135. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1136.  
  1137. #==============================================================================
  1138. # ■ Scene_Map
  1139. #==============================================================================
  1140.  
  1141. class Scene_Map < Scene_Base
  1142.   #--------------------------------------------------------------------------
  1143.   # ● 画面切り替えの実行
  1144.   #--------------------------------------------------------------------------
  1145.   alias update_scene_change_KGC_SkillCPSystem update_scene_change
  1146.   def update_scene_change
  1147.     return if $game_player.moving?    # プレイヤーの移動中?
  1148.  
  1149.     if $game_temp.next_scene == :set_battle_skill
  1150.       call_set_battle_skill
  1151.       return
  1152.     end
  1153.  
  1154.     update_scene_change_KGC_SkillCPSystem
  1155.   end
  1156.   #--------------------------------------------------------------------------
  1157.   # ○ スキル設定画面への切り替え
  1158.   #--------------------------------------------------------------------------
  1159.   def call_set_battle_skill
  1160.     $game_temp.next_scene = nil
  1161.     $scene = Scene_SetBattleSkill.new(
  1162.       $game_temp.next_scene_actor_index,
  1163.       0,
  1164.       Scene_SetBattleSkill::HOST_MAP)
  1165.   end
  1166. end
  1167.  
  1168. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1169.  
  1170. #==============================================================================
  1171. # ■ Scene_Menu
  1172. #==============================================================================
  1173.  
  1174. class Scene_Menu < Scene_Base
  1175.   if KGC::SkillCPSystem::USE_MENU_SET_SKILL_COMMAND
  1176.   #--------------------------------------------------------------------------
  1177.   # ● コマンドウィンドウの作成
  1178.   #--------------------------------------------------------------------------
  1179.   alias create_command_window_KGC_SkillCPSystem create_command_window
  1180.   def create_command_window
  1181.     create_command_window_KGC_SkillCPSystem
  1182.  
  1183.     return if $imported["CustomMenuCommand"]
  1184.  
  1185.     @__command_set_battle_skill_index =
  1186.       @command_window.add_command(Vocab.set_battle_skill)
  1187.     if @command_window.oy > 0
  1188.       @command_window.oy -= Window_Base::WLH
  1189.     end
  1190.     @command_window.index = @menu_index
  1191.   end
  1192.   end
  1193.   #--------------------------------------------------------------------------
  1194.   # ● コマンド選択の更新
  1195.   #--------------------------------------------------------------------------
  1196.   alias update_command_selection_KGC_SkillCPSystem update_command_selection
  1197.   def update_command_selection
  1198.     call_set_battle_skill_flag = false
  1199.     if Input.trigger?(Input::C)
  1200.       case @command_window.index
  1201.       when @__command_set_battle_skill_index  # スキル設定
  1202.         call_set_battle_skill_flag = true
  1203.       end
  1204.     end
  1205.  
  1206.     # スキル設定画面に移行
  1207.     if call_set_battle_skill_flag
  1208.       if $game_party.members.size == 0
  1209.         Sound.play_buzzer
  1210.         return
  1211.       end
  1212.       Sound.play_decision
  1213.       start_actor_selection
  1214.       return
  1215.     end
  1216.  
  1217.     update_command_selection_KGC_SkillCPSystem
  1218.   end
  1219.   #--------------------------------------------------------------------------
  1220.   # ● アクター選択の更新
  1221.   #--------------------------------------------------------------------------
  1222.   alias update_actor_selection_KGC_SkillCPSystem update_actor_selection
  1223.   def update_actor_selection
  1224.     if Input.trigger?(Input::C)
  1225.       $game_party.last_actor_index = @status_window.index
  1226.       Sound.play_decision
  1227.       case @command_window.index
  1228.       when @__command_set_battle_skill_index  # スキル設定
  1229.         $scene = Scene_SetBattleSkill.new(
  1230.           @status_window.index,
  1231.           @__command_set_battle_skill_index,
  1232.           Scene_SetBattleSkill::HOST_MENU)
  1233.         return
  1234.       end
  1235.     end
  1236.  
  1237.     update_actor_selection_KGC_SkillCPSystem
  1238.   end
  1239. end
  1240.  
  1241. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1242.  
  1243. #==============================================================================
  1244. # □ Scene_SetBattleSkill
  1245. #------------------------------------------------------------------------------
  1246. #   戦闘スキル設定画面の処理を行うクラスです。
  1247. #==============================================================================
  1248.  
  1249. class Scene_SetBattleSkill < Scene_Base
  1250.   #--------------------------------------------------------------------------
  1251.   # ○ 定数
  1252.   #--------------------------------------------------------------------------
  1253.   HOST_MENU   = 0  # 呼び出し元 : メニュー
  1254.   HOST_MAP    = 1  # 呼び出し元 : マップ
  1255.   #--------------------------------------------------------------------------
  1256.   # ● オブジェクト初期化
  1257.   #     actor_index : アクターインデックス
  1258.   #     menu_index  : コマンドのカーソル初期位置
  1259.   #     host_scene  : 呼び出し元 (0..メニュー  1..マップ)
  1260.   #--------------------------------------------------------------------------
  1261.   def initialize(actor_index = 0, menu_index = 0, host_scene = HOST_MENU)
  1262.     @actor_index = actor_index
  1263.     @menu_index = menu_index
  1264.     @host_scene = host_scene
  1265.   end
  1266.   #--------------------------------------------------------------------------
  1267.   # ● 開始処理
  1268.   #--------------------------------------------------------------------------
  1269.   def start
  1270.     super
  1271.     create_menu_background
  1272.  
  1273.     @actor = $game_party.members[@actor_index]
  1274.     create_windows
  1275.   end
  1276.   #--------------------------------------------------------------------------
  1277.   # ○ ウィンドウ作成
  1278.   #--------------------------------------------------------------------------
  1279.   def create_windows
  1280.     @help_window = Window_Help.new
  1281.     if $imported["HelpExtension"]
  1282.       @help_window.row_max = KGC::HelpExtension::ROW_MAX
  1283.     end
  1284.  
  1285.     dy = @help_window.height
  1286.     @status_window = Window_BattleSkillStatus.new(0, dy, @actor)
  1287.  
  1288.     dy += @status_window.height
  1289.     @slot_window = Window_BattleSkillSlot.new(
  1290.       0,
  1291.       dy,
  1292.       Graphics.width / 2,
  1293.       Graphics.height - dy,
  1294.       @actor)
  1295.     @slot_window.active = true
  1296.     @slot_window.help_window = @help_window
  1297.  
  1298.     @list_window = Window_BattleSkillList.new(
  1299.       Graphics.width - @slot_window.width,
  1300.       dy,
  1301.       Graphics.width - @slot_window.width,
  1302.       Graphics.height - dy,
  1303.       @actor)
  1304.     @list_window.help_window = @help_window
  1305.   end
  1306.   #--------------------------------------------------------------------------
  1307.   # ● 終了処理
  1308.   #--------------------------------------------------------------------------
  1309.   def terminate
  1310.     super
  1311.     dispose_menu_background
  1312.     @help_window.dispose
  1313.     @status_window.dispose
  1314.     @slot_window.dispose
  1315.     @list_window.dispose
  1316.   end
  1317.   #--------------------------------------------------------------------------
  1318.   # ○ 元の画面へ戻る
  1319.   #--------------------------------------------------------------------------
  1320.   def return_scene
  1321.     case @host_scene
  1322.     when HOST_MENU
  1323.       $scene = Scene_Menu.new(@menu_index)
  1324.     when HOST_MAP
  1325.       $scene = Scene_Map.new
  1326.     end
  1327.   end
  1328.   #--------------------------------------------------------------------------
  1329.   # ● フレーム更新
  1330.   #--------------------------------------------------------------------------
  1331.   def update
  1332.     super
  1333.     update_menu_background
  1334.     update_window
  1335.     if @slot_window.active
  1336.       update_slot
  1337.     elsif @list_window.active
  1338.       update_list
  1339.     end
  1340.   end
  1341.   #--------------------------------------------------------------------------
  1342.   # ○ ウィンドウ更新
  1343.   #--------------------------------------------------------------------------
  1344.   def update_window
  1345.     @help_window.update
  1346.     @status_window.update
  1347.     @slot_window.update
  1348.     @list_window.update
  1349.   end
  1350.   #--------------------------------------------------------------------------
  1351.   # ○ ウィンドウ再描画
  1352.   #--------------------------------------------------------------------------
  1353.   def refresh_window
  1354.     @status_window.refresh
  1355.     @slot_window.refresh
  1356.     @list_window.refresh
  1357.   end
  1358.   #--------------------------------------------------------------------------
  1359.   # ○ 次のアクターの画面に切り替え
  1360.   #--------------------------------------------------------------------------
  1361.   def next_actor
  1362.     @actor_index += 1
  1363.     @actor_index %= $game_party.members.size
  1364.     $scene = Scene_SetBattleSkill.new(@actor_index, @menu_index, @host_scene)
  1365.   end
  1366.   #--------------------------------------------------------------------------
  1367.   # ○ 前のアクターの画面に切り替え
  1368.   #--------------------------------------------------------------------------
  1369.   def prev_actor
  1370.     @actor_index += $game_party.members.size - 1
  1371.     @actor_index %= $game_party.members.size
  1372.     $scene = Scene_SetBattleSkill.new(@actor_index, @menu_index, @host_scene)
  1373.   end
  1374.   #--------------------------------------------------------------------------
  1375.   # ○ フレーム更新 (スロットウィンドウがアクティブの場合)
  1376.   #--------------------------------------------------------------------------
  1377.   def update_slot
  1378.     # 選択項目が変化した場合
  1379.     if @last_slot_index != @slot_window.index
  1380.       @list_window.slot_index = @slot_window.index
  1381.       @list_window.refresh
  1382.       @last_slot_index = @slot_window.index
  1383.     end
  1384.  
  1385.     if Input.trigger?(Input::A)
  1386.       Sound.play_decision
  1387.       # 選択しているスキルを外す
  1388.       @actor.remove_battle_skill(@slot_window.index)
  1389.       refresh_window
  1390.     elsif Input.trigger?(Input::B)
  1391.       Sound.play_cancel
  1392.       return_scene
  1393.     elsif Input.trigger?(Input::C)
  1394.       Sound.play_decision
  1395.       # リストウィンドウに切り替え
  1396.       @slot_window.active = false
  1397.       @list_window.active = true
  1398.     elsif Input.trigger?(Input::R)
  1399.       Sound.play_cursor
  1400.       next_actor
  1401.     elsif Input.trigger?(Input::L)
  1402.       Sound.play_cursor
  1403.       prev_actor
  1404.     end
  1405.   end
  1406.   #--------------------------------------------------------------------------
  1407.   # ○ フレーム更新 (リストウィンドウがアクティブの場合)
  1408.   #--------------------------------------------------------------------------
  1409.   def update_list
  1410.     if Input.trigger?(Input::B)
  1411.       Sound.play_cancel
  1412.       # スロットウィンドウに切り替え
  1413.       @slot_window.active = true
  1414.       @list_window.active = false
  1415.     elsif Input.trigger?(Input::C)
  1416.       skill = @list_window.skill
  1417.       # セットできない場合
  1418.       unless @actor.battle_skill_settable?(@slot_window.index, skill)
  1419.         Sound.play_buzzer
  1420.         return
  1421.       end
  1422.       Sound.play_decision
  1423.       set_skill(@slot_window.index, skill)
  1424.       # スロットウィンドウに切り替え
  1425.       @slot_window.active = true
  1426.       @list_window.active = false
  1427.     end
  1428.   end
  1429.   #--------------------------------------------------------------------------
  1430.   # ○ スキル設定
  1431.   #     index : 設定する場所
  1432.   #     skill : 設定するスキル
  1433.   #--------------------------------------------------------------------------
  1434.   def set_skill(index, skill)
  1435.     @actor.remove_battle_skill(index)
  1436.     if skill != nil
  1437.       @actor.set_battle_skill(index, skill)
  1438.     end
  1439.     refresh_window
  1440.   end
  1441. end



Lv2.观梦者

梦石
0
星屑
836
在线时间
159 小时
注册时间
2012-6-3
帖子
124
2
 楼主| 发表于 2014-8-14 15:37:05 | 只看该作者
本帖最后由 taroxd 于 2014-8-14 15:55 编辑

RUBY 代码复制
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆ スキル習得装備 - KGC_EquipLearnSkill ◆ VX ◆
  3. #_/    ◇ Last update : 2009/09/26 ◇
  4. #_/----------------------------------------------------------------------------
  5. #_/  スキルを習得する装備品を作成します。
  6. #_/============================================================================
  7. #_/ 【スキル】≪スキルCP制≫ より上に導入してください。
  8. #_/ 【メニュー】≪拡張装備画面≫ より上に導入してください。
  9. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  10.  
  11. $data_system = load_data("Data/System.rvdata") if $data_system == nil
  12.  
  13. #==============================================================================
  14. # ★ カスタマイズ項目 - Customize ★
  15. #==============================================================================
  16.  
  17. module KGC
  18. module EquipLearnSkill
  19.   # ◆ AP の名称
  20.   #  ゲーム中の表記のみ変化。
  21.   VOCAB_AP     = "AP"
  22.   # ◆ AP のデフォルト値
  23.   #  所持 AP を指定しなかったエネミーの AP。
  24.   DEFAULT_AP   = 1
  25.   # ◆ 装備しただけでは習得しない
  26.   #  true  : AP が溜まるまで使用不能
  27.   #  false : 装備するだけで使用可能
  28.   NEED_FULL_AP = false
  29.  
  30.   # ◆ リザルト画面での獲得 AP の表示
  31.   #  %s : 獲得した AP
  32.   VOCAB_RESULT_OBTAIN_AP         = "获得 %s 点#{VOCAB_AP} !"
  33.   # ◆ リザルト画面でスキルをマスターした際のメッセージ
  34.   #  %s : アクター名
  35.   VOCAB_RESULT_MASTER_SKILL      = "%sは"
  36.   # ◆ リザルト画面でマスターしたスキルの表示
  37.   #  %s : マスターしたスキルの名前
  38.   VOCAB_RESULT_MASTER_SKILL_NAME = "学得了%s!"
  39.  
  40.   # ◆ メニュー画面に「AP ビューア」コマンドを追加する
  41.   #  追加する場所は、メニューコマンドの最下部です。
  42.   #  他の部分に追加したければ、≪カスタムメニューコマンド≫ をご利用ください。
  43.   USE_MENU_AP_VIEWER_COMMAND = true
  44.   # ◆ メニュー画面の「AP ビューア」コマンドの名称
  45.   VOCAB_MENU_AP_VIEWER       = "#{VOCAB_AP} 查看"
  46.  
  47.   # ◆ マスター(完全習得)したスキルの AP 欄
  48.   VOCAB_MASTER_SKILL      = "- MASTER -"
  49.   # ◆ 蓄積 AP が 0 のスキルも AP ビューアに表示
  50.   SHOW_ZERO_AP_SKILL      = false
  51.   # ◆ 蓄積 AP が 0 のスキルの名前を隠す
  52.   MASK_ZERO_AP_SKILL_NAME = false
  53.   # ◆ 蓄積 AP が 0 のスキルに表示する名前
  54.   #  1文字だけ指定すると、スキル名と同じ長さに拡張されます。
  55.   ZERO_AP_NAME_MASK       = "?"
  56.   # ◆ 蓄積 AP が 0 のスキルのヘルプを隠す
  57.   HIDE_ZERO_AP_SKILL_HELP = true
  58.   # ◆ 蓄積 AP が 0 のスキルに表示するヘルプ
  59.   ZERO_AP_SKILL_HELP      = "????????"
  60.  
  61.   # ◆ 除外装備品配列
  62.   #  配列の添字がアクター ID に対応。
  63.   #  習得装備から除外する武器・防具の ID を配列に格納。
  64.   EXCLUDE_WEAPONS = []  # 武器
  65.   EXCLUDE_ARMORS  = []  # 防具
  66.   # ここから下に定義。
  67.   #  <例>
  68.   #  アクターID:1 は、武器ID:50 と 70 のスキルを習得できない。
  69.   # EXCLUDE_WEAPONS[1] = [50, 70]
  70.  
  71.   # ◆ 除外スキル配列
  72.   #  配列の添字がアクター ID と対応。
  73.   #  装備では習得不可能にするスキル ID を配列に格納。
  74.   EXCLUDE_SKILLS = []
  75.   #  <例>
  76.   #  アクターID:1 は、スキルID:30 を装備品で習得することはできない。
  77.   # EXCLUDE_SKILLS[1] = [30]
  78. end
  79. end
  80.  
  81. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  82.  
  83. $imported = {} if $imported == nil
  84. $imported["EquipLearnSkill"] = true
  85.  
  86. module KGC::EquipLearnSkill
  87.   module Regexp
  88.     module BaseItem
  89.       # 習得スキル
  90.       LEARN_SKILL = /<(?:LEARN_SKILL|スキル習得)\s*(\d+(?:\s*,\s*\d+)*)>/i
  91.     end
  92.  
  93.     module Skill
  94.       # 必要 AP
  95.       NEED_AP = /<(?:NEED_AP|必要AP)\s*(\d+)>/i
  96.     end
  97.  
  98.     module Enemy
  99.       # 所持 AP
  100.       AP = /<AP\s*(\d+)>/i
  101.     end
  102.   end
  103. end
  104.  
  105. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  106.  
  107. #==============================================================================
  108. # □ KGC::Commands
  109. #==============================================================================
  110.  
  111. module KGC
  112. module Commands
  113.   module_function
  114.   #--------------------------------------------------------------------------
  115.   # ○ AP の獲得
  116.   #     actor_id : アクター ID
  117.   #     ap       : 獲得 AP
  118.   #     show     : マスター表示フラグ
  119.   #--------------------------------------------------------------------------
  120.   def gain_actor_ap(actor_id, ap, show = false)
  121.     $game_actors[actor_id].gain_ap(ap, show)
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ○ AP の変更
  125.   #     actor_id : アクター ID
  126.   #     skill_id : スキル ID
  127.   #     ap       : AP
  128.   #--------------------------------------------------------------------------
  129.   def change_actor_ap(actor_id, skill_id, ap)
  130.     skill = $data_skills[skill_id]
  131.     return if skill == nil
  132.     $game_actors[actor_id].change_ap(skill, ap)
  133.  
  134.     $game_actors[actor_id].restore_passive_rev if $imported["PassiveSkill"]
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ○ AP ビューアの呼び出し
  138.   #     actor_index : アクターインデックス
  139.   #--------------------------------------------------------------------------
  140.   def call_ap_viewer(actor_index = 0)
  141.     return if $game_temp.in_battle
  142.     $game_temp.next_scene = :ap_viewer
  143.     $game_temp.next_scene_actor_index = actor_index
  144.   end
  145. end
  146. end
  147.  
  148. class Game_Interpreter
  149.   include KGC::Commands
  150. end
  151.  
  152. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  153.  
  154. #==============================================================================
  155. # ■ Vocab
  156. #==============================================================================
  157.  
  158. module Vocab
  159.   # 戦闘終了メッセージ
  160.   ObtainAP              = KGC::EquipLearnSkill::VOCAB_RESULT_OBTAIN_AP
  161.   ResultFullAPSkill     = KGC::EquipLearnSkill::VOCAB_RESULT_MASTER_SKILL
  162.   ResultFullAPSkillName = KGC::EquipLearnSkill::VOCAB_RESULT_MASTER_SKILL_NAME
  163.  
  164.   # AP
  165.   def self.ap
  166.     return KGC::EquipLearnSkill::VOCAB_AP
  167.   end
  168.  
  169.   # マスターしたスキル
  170.   def self.full_ap_skill
  171.     return KGC::EquipLearnSkill::VOCAB_MASTER_SKILL
  172.   end
  173.  
  174.   # AP ビューア
  175.   def self.ap_viewer
  176.     return KGC::EquipLearnSkill::VOCAB_MENU_AP_VIEWER
  177.   end
  178. end
  179.  
  180. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  181.  
  182. #==============================================================================
  183. # ■ RPG::BaseItem
  184. #==============================================================================
  185.  
  186. class RPG::BaseItem
  187.   #--------------------------------------------------------------------------
  188.   # ○ スキル習得装備のキャッシュ生成
  189.   #--------------------------------------------------------------------------
  190.   def create_equip_learn_skill_cache
  191.     @__learn_skills = []
  192.  
  193.     self.note.each_line { |line|
  194.       if line =~ KGC::EquipLearnSkill::Regexp::BaseItem::LEARN_SKILL
  195.         # スキル習得
  196.         $1.scan(/\d+/).each { |num|
  197.           skill_id = num.to_i
  198.           # 存在するスキルならリストに加える
  199.           @__learn_skills << skill_id if $data_skills[skill_id] != nil
  200.         }
  201.       end
  202.     }
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ○ 習得するスキル ID の配列
  206.   #--------------------------------------------------------------------------
  207.   def learn_skills
  208.     create_equip_learn_skill_cache if @__learn_skills == nil
  209.     return @__learn_skills
  210.   end
  211. end
  212.  
  213. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  214.  
  215. #==============================================================================
  216. # ■ RPG::Skill
  217. #==============================================================================
  218.  
  219. class RPG::Skill < RPG::UsableItem
  220.   #--------------------------------------------------------------------------
  221.   # ○ クラス変数
  222.   #--------------------------------------------------------------------------
  223.   @@__masked_name =
  224.     KGC::EquipLearnSkill::ZERO_AP_NAME_MASK  # マスク名
  225.   @@__expand_masked_name = false             # マスク名拡張表示フラグ
  226.  
  227.   if @@__expand_masked_name != nil
  228.     @@__expand_masked_name = (@@__masked_name.scan(/./).size == 1)
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ○ スキル習得装備のキャッシュ生成
  232.   #--------------------------------------------------------------------------
  233.   def create_equip_learn_skill_cache
  234.     @__need_ap = 0
  235.  
  236.     self.note.each_line { |line|
  237.       if line =~ KGC::EquipLearnSkill::Regexp::Skill::NEED_AP  # 必要 AP
  238.         @__need_ap = $1.to_i
  239.       end
  240.     }
  241.   end
  242.   #--------------------------------------------------------------------------
  243.   # ○ マスク名
  244.   #--------------------------------------------------------------------------
  245.   def masked_name
  246.     if KGC::EquipLearnSkill::MASK_ZERO_AP_SKILL_NAME
  247.       if @@__expand_masked_name
  248.         # マスク名を拡張して表示
  249.         return @@__masked_name * self.name.scan(/./).size
  250.       else
  251.         return @@__masked_name
  252.       end
  253.     else
  254.       return self.name
  255.     end
  256.   end
  257.   #--------------------------------------------------------------------------
  258.   # ○ 習得に必要な AP
  259.   #--------------------------------------------------------------------------
  260.   def need_ap
  261.     create_equip_learn_skill_cache if @__need_ap == nil
  262.     return @__need_ap
  263.   end
  264. end
  265.  
  266. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  267.  
  268. #==============================================================================
  269. # ■ RPG::Enemy
  270. #==============================================================================
  271.  
  272. class RPG::Enemy
  273.   #--------------------------------------------------------------------------
  274.   # ○ スキル習得装備のキャッシュ生成
  275.   #--------------------------------------------------------------------------
  276.   def create_equip_learn_skill_cache
  277.     @__ap = KGC::EquipLearnSkill::DEFAULT_AP
  278.  
  279.     self.note.each_line { |line|
  280.       if line =~ KGC::EquipLearnSkill::Regexp::Enemy::AP  # 所持 AP
  281.         @__ap = $1.to_i
  282.       end
  283.     }
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # ○ 所持 AP
  287.   #--------------------------------------------------------------------------
  288.   def ap
  289.     create_equip_learn_skill_cache if @__ap == nil
  290.     return @__ap
  291.   end
  292. end
  293.  
  294. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  295.  
  296. #==============================================================================
  297. # ■ Game_Temp
  298. #==============================================================================
  299.  
  300. unless $imported["CustomMenuCommand"]
  301. class Game_Temp
  302.   #--------------------------------------------------------------------------
  303.   # ● 公開インスタンス変数
  304.   #--------------------------------------------------------------------------
  305.   attr_accessor :next_scene_actor_index   # 次のシーンのアクターインデックス
  306.   #--------------------------------------------------------------------------
  307.   # ● オブジェクト初期化
  308.   #--------------------------------------------------------------------------
  309.   alias initialize_KGC_EquipLearnSkill initialize
  310.   def initialize
  311.     initialize_KGC_EquipLearnSkill
  312.  
  313.     @next_scene_actor_index = 0
  314.   end
  315. end
  316. end
  317.  
  318. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  319.  
  320. #==============================================================================
  321. # ■ Game_Actor
  322. #==============================================================================
  323.  
  324. class Game_Actor < Game_Battler
  325.   #--------------------------------------------------------------------------
  326.   # ● セットアップ
  327.   #     actor_id : アクター ID
  328.   #--------------------------------------------------------------------------
  329.   alias setup_KGC_EquipLearnSkill setup
  330.   def setup(actor_id)
  331.     setup_KGC_EquipLearnSkill(actor_id)
  332.  
  333.     @skill_ap = []
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ○ 指定スキルの AP 取得
  337.   #     skill_id : スキル ID
  338.   #--------------------------------------------------------------------------
  339.   def skill_ap(skill_id)
  340.     @skill_ap = [] if @skill_ap == nil
  341.     return (@skill_ap[skill_id] != nil ? @skill_ap[skill_id] : 0)
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # ○ AP 変更
  345.   #     skill : スキル
  346.   #     ap    : 新しい AP
  347.   #--------------------------------------------------------------------------
  348.   def change_ap(skill, ap)
  349.     @skill_ap = [] if @skill_ap == nil
  350.     @skill_ap[skill.id] = [[ap, skill.need_ap].min, 0].max
  351.   end
  352.   #--------------------------------------------------------------------------
  353.   # ○ マスターしたスキルの表示
  354.   #     new_skills : 新しくマスターしたスキルの配列
  355.   #--------------------------------------------------------------------------
  356.   def display_full_ap_skills(new_skills)
  357.     $game_message.new_page
  358.     text = sprintf(Vocab::ResultFullAPSkill, name)
  359.     $game_message.texts.push(text)
  360.     new_skills.each { |skill|
  361.       text = sprintf(Vocab::ResultFullAPSkillName, skill.name)
  362.       $game_message.texts.push(text)
  363.     }
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # ○ AP 獲得
  367.   #     ap   : AP の増加量
  368.   #     show : マスタースキル表示フラグ
  369.   #--------------------------------------------------------------------------
  370.   def gain_ap(ap, show)
  371.     last_full_ap_skills = full_ap_skills
  372.  
  373.     # 装備品により習得しているスキルに AP を加算
  374.     equipment_skills(true).each { |skill|
  375.       change_ap(skill, skill_ap(skill.id) + ap)
  376.     }
  377.     restore_passive_rev if $imported["PassiveSkill"]
  378.  
  379.     # マスターしたスキルを表示
  380.     if show && last_full_ap_skills != full_ap_skills
  381.       display_full_ap_skills(full_ap_skills - last_full_ap_skills)
  382.     end
  383.   end
  384.   #--------------------------------------------------------------------------
  385.   # ● スキルオブジェクトの配列取得
  386.   #--------------------------------------------------------------------------
  387.   alias skills_KGC_EquipLearnSkill skills
  388.   def skills
  389.     result = skills_KGC_EquipLearnSkill
  390.  
  391.     # 装備品と AP 蓄積済みのスキルを追加
  392.     additional_skills = equipment_skills | full_ap_skills
  393.     return (result | additional_skills).sort_by { |s| s.id }
  394.   end
  395.   #--------------------------------------------------------------------------
  396.   # ○ 装備品の習得スキル取得
  397.   #     all : 使用不可能なスキルも含める
  398.   #--------------------------------------------------------------------------
  399.   def equipment_skills(all = false)
  400.     result = []
  401.     equips.compact.each { |item|
  402.       next unless include_learnable_equipment?(item)        # 除外装備は無視
  403.  
  404.       item.learn_skills.each { |i|
  405.         skill = $data_skills[i]
  406.         next unless include_equipment_skill?(skill)          # 除外スキルは無視
  407.         if !all && KGC::EquipLearnSkill::NEED_FULL_AP        # 要蓄積の場合
  408.           next unless skill.need_ap == 0 || ap_full?(skill)    # 未達成なら無視
  409.         end
  410.         result << skill
  411.       }
  412.     }
  413.     return result
  414.   end
  415.   #--------------------------------------------------------------------------
  416.   # ○ スキル習得装備除外判定
  417.   #     item : 判定装備
  418.   #--------------------------------------------------------------------------
  419.   def include_learnable_equipment?(item)
  420.     return false unless item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
  421.     return false unless equippable?(item)
  422.  
  423.     case item
  424.     when RPG::Weapon  # 武器
  425.       # 除外武器に含まれている場合
  426.       if KGC::EquipLearnSkill::EXCLUDE_WEAPONS[id] != nil &&
  427.           KGC::EquipLearnSkill::EXCLUDE_WEAPONS[id].include?(item.id)
  428.         return false
  429.       end
  430.     when RPG::Armor   # 防具
  431.       # 除外防具に含まれている場合
  432.       if KGC::EquipLearnSkill::EXCLUDE_ARMORS[id] != nil &&
  433.           KGC::EquipLearnSkill::EXCLUDE_ARMORS[id].include?(item.id)
  434.         return false
  435.       end
  436.     end
  437.  
  438.     return true
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ○ 装備品による習得スキル除外判定
  442.   #     skill : スキル
  443.   #--------------------------------------------------------------------------
  444.   def include_equipment_skill?(skill)
  445.     # 自身が除外されている場合
  446.     if KGC::EquipLearnSkill::EXCLUDE_SKILLS[id] != nil &&
  447.         KGC::EquipLearnSkill::EXCLUDE_SKILLS[id].include?(skill.id)
  448.       return false
  449.     end
  450.  
  451.     return true
  452.   end
  453.   #--------------------------------------------------------------------------
  454.   # ○ AP 蓄積済みのスキルを取得
  455.   #--------------------------------------------------------------------------
  456.   def full_ap_skills
  457.     result = []
  458.     (1...$data_skills.size).each { |i|
  459.       skill = $data_skills[i]
  460.       result << skill if ap_full?(skill) && include_equipment_skill?(skill)
  461.     }
  462.     return result
  463.   end
  464.   #--------------------------------------------------------------------------
  465.   # ○ AP 蓄積可能なスキルを取得
  466.   #--------------------------------------------------------------------------
  467.   def can_gain_ap_skills
  468.     result = []
  469.     equips.compact.each { |item|
  470.       next unless include_learnable_equipment?(item)  # 除外装備なら無視
  471.  
  472.       item.learn_skills.each { |i|
  473.         skill = $data_skills[i]
  474.         next unless include_equipment_skill?(skill)   # 除外スキルなら無視
  475.         result << skill
  476.       }
  477.     }
  478.     return (result - full_ap_skills)              # マスターしたものを除く
  479.   end
  480.   #--------------------------------------------------------------------------
  481.   # ○ AP 蓄積済み判定
  482.   #     skill : スキル
  483.   #--------------------------------------------------------------------------
  484.   def ap_full?(skill)
  485.     return false unless skill.is_a?(RPG::Skill)   # スキル以外
  486.     return false if skill.need_ap == 0            # 必要 AP が 0
  487.     return true  if @skills.include?(skill.id)    # 習得済み
  488.  
  489.     return (skill_ap(skill.id) >= skill.need_ap)
  490.   end
  491.   #--------------------------------------------------------------------------
  492.   # ● スキルの使用可能判定
  493.   #     skill : スキル
  494.   #--------------------------------------------------------------------------
  495.   def skill_can_use?(skill)
  496.     return super
  497.   end
  498. end
  499.  
  500. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  501.  
  502. #==============================================================================
  503. # ■ Game_Enemy
  504. #==============================================================================
  505.  
  506. class Game_Enemy < Game_Battler
  507.   #--------------------------------------------------------------------------
  508.   # ○ AP の取得
  509.   #--------------------------------------------------------------------------
  510.   def ap
  511.     return enemy.ap
  512.   end
  513. end
  514.  
  515. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  516.  
  517. #==============================================================================
  518. # ■ Game_Troop
  519. #==============================================================================
  520.  
  521. class Game_Troop < Game_Unit
  522.   #--------------------------------------------------------------------------
  523.   # ○ AP の合計計算
  524.   #--------------------------------------------------------------------------
  525.   def ap_total
  526.     ap = 0
  527.     for enemy in dead_members
  528.       ap += enemy.ap unless enemy.hidden
  529.     end
  530.     return ap
  531.   end
  532. end
  533.  
  534. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  535.  
  536. #==============================================================================
  537. # ■ Window_Command
  538. #==============================================================================
  539.  
  540. class Window_Command < Window_Selectable
  541.   unless method_defined?(:add_command)
  542.   #--------------------------------------------------------------------------
  543.   # ○ コマンドを追加
  544.   #    追加した位置を返す
  545.   #--------------------------------------------------------------------------
  546.   def add_command(command)
  547.     @commands << command
  548.     @item_max = @commands.size
  549.     item_index = @item_max - 1
  550.     refresh_command
  551.     draw_item(item_index)
  552.     return item_index
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # ○ コマンドをリフレッシュ
  556.   #--------------------------------------------------------------------------
  557.   def refresh_command
  558.     buf = self.contents.clone
  559.     self.height = [self.height, row_max * WLH + 32].max
  560.     create_contents
  561.     self.contents.blt(0, 0, buf, buf.rect)
  562.     buf.dispose
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # ○ コマンドを挿入
  566.   #--------------------------------------------------------------------------
  567.   def insert_command(index, command)
  568.     @commands.insert(index, command)
  569.     @item_max = @commands.size
  570.     refresh_command
  571.     refresh
  572.   end
  573.   #--------------------------------------------------------------------------
  574.   # ○ コマンドを削除
  575.   #--------------------------------------------------------------------------
  576.   def remove_command(command)
  577.     @commands.delete(command)
  578.     @item_max = @commands.size
  579.     refresh
  580.   end
  581.   end
  582. end
  583.  
  584. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  585.  
  586. #==============================================================================
  587. # □ Window_APViewer
  588. #------------------------------------------------------------------------------
  589. #  AP ビューアでスキルを表示するウィンドウです。
  590. #==============================================================================
  591.  
  592. class Window_APViewer < Window_Selectable
  593.   #--------------------------------------------------------------------------
  594.   # ● オブジェクト初期化
  595.   #     x      : ウィンドウの X 座標
  596.   #     y      : ウィンドウの Y 座標
  597.   #     width  : ウィンドウの幅
  598.   #     height : ウィンドウの高さ
  599.   #     actor  : アクター
  600.   #--------------------------------------------------------------------------
  601.   def initialize(x, y, width, height, actor)
  602.     super(x, y, width, height)
  603.     @actor = actor
  604.     @can_gain_ap_skills = []
  605.     @equipment_skills   = []
  606.     self.index = 0
  607.     refresh
  608.   end
  609.   #--------------------------------------------------------------------------
  610.   # ○ スキルの取得
  611.   #--------------------------------------------------------------------------
  612.   def skill
  613.     return @data[self.index]
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # ○ リフレッシュ
  617.   #--------------------------------------------------------------------------
  618.   def refresh
  619.     @data = []
  620.     @can_gain_ap_skills = @actor.can_gain_ap_skills
  621.     @equipment_skills   = @actor.equipment_skills(true)
  622.  
  623.     (1...$data_skills.size).each { |i|
  624.       skill = $data_skills[i]
  625.       @data << skill if include?(skill)
  626.     }
  627.     @item_max = @data.size
  628.     create_contents
  629.     @item_max.times { |i| draw_item(i) }
  630.   end
  631.   #--------------------------------------------------------------------------
  632.   # ○ 項目の描画
  633.   #     index : 項目番号
  634.   #--------------------------------------------------------------------------
  635.   def draw_item(index)
  636.     rect = item_rect(index)
  637.     self.contents.clear_rect(rect)
  638.     skill = @data[index]
  639.     if skill != nil
  640.       rect.width -= 4
  641.       draw_item_name(skill, rect.x, rect.y, enable?(skill))
  642.       if @actor.ap_full?(skill) || @actor.skill_learn?(skill)
  643.         # マスター
  644.         text = Vocab.full_ap_skill
  645.       else
  646.         # AP 蓄積中
  647.         text = sprintf("%s %4d/%4d",
  648.           Vocab.ap, @actor.skill_ap(skill.id), skill.need_ap)
  649.       end
  650.       # AP を描画
  651.       self.contents.font.color = normal_color
  652.       self.contents.draw_text(rect, text, 2)
  653.     end
  654.   end
  655.   #--------------------------------------------------------------------------
  656.   # ○ スキルをリストに含めるか
  657.   #     skill : スキル
  658.   #--------------------------------------------------------------------------
  659.   def include?(skill)
  660.     return false if skill.need_ap == 0
  661.     unless KGC::EquipLearnSkill::SHOW_ZERO_AP_SKILL
  662.       # AP が 0 、かつ装備品で習得していない
  663.       if @actor.skill_ap(skill.id) == 0 && !@equipment_skills.include?(skill)
  664.         return false
  665.       end
  666.     end
  667.  
  668.     return true
  669.   end
  670.   #--------------------------------------------------------------------------
  671.   # ○ スキルを有効状態で表示するかどうか
  672.   #     skill : スキル
  673.   #--------------------------------------------------------------------------
  674.   def enable?(skill)
  675.     return true if @actor.skill_learn?(skill)           # 習得済み
  676.     return true if @actor.ap_full?(skill)               # マスター
  677.     return true if @can_gain_ap_skills.include?(skill)  # AP 蓄積可能
  678.  
  679.     return false
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   # ○ スキルをマスク表示するかどうか
  683.   #     skill : スキル
  684.   #--------------------------------------------------------------------------
  685.   def mask?(skill)
  686.     return false if @actor.skill_learn?(skill)           # 習得済み
  687.     return false if @actor.skill_ap(skill.id) > 0        # AP が 1 以上
  688.     return false if @can_gain_ap_skills.include?(skill)  # AP 蓄積可能
  689.  
  690.     return true
  691.   end
  692.   #--------------------------------------------------------------------------
  693.   # ● アイテム名の描画
  694.   #     item    : アイテム (スキル、武器、防具でも可)
  695.   #     x       : 描画先 X 座標
  696.   #     y       : 描画先 Y 座標
  697.   #     enabled : 有効フラグ。false のとき半透明で描画
  698.   #--------------------------------------------------------------------------
  699.   def draw_item_name(item, x, y, enabled = true)
  700.     draw_icon(item.icon_index, x, y, enabled)
  701.     self.contents.font.color = normal_color
  702.     self.contents.font.color.alpha = enabled ? 255 : 128
  703.     self.contents.draw_text(x + 24, y, 172, WLH,
  704.       mask?(item) ? item.masked_name : item.name)
  705.   end
  706.   #--------------------------------------------------------------------------
  707.   # ● カーソルを 1 ページ後ろに移動
  708.   #--------------------------------------------------------------------------
  709.   def cursor_pagedown
  710.     return if Input.repeat?(Input::R)
  711.     super
  712.   end
  713.   #--------------------------------------------------------------------------
  714.   # ● カーソルを 1 ページ前に移動
  715.   #--------------------------------------------------------------------------
  716.   def cursor_pageup
  717.     return if Input.repeat?(Input::L)
  718.     super
  719.   end
  720.   #--------------------------------------------------------------------------
  721.   # ● フレーム更新
  722.   #--------------------------------------------------------------------------
  723.   def update
  724.     last_index = @index
  725.     super
  726.     return unless self.active
  727.  
  728.     if Input.repeat?(Input::RIGHT)
  729.       cursor_pagedown
  730.     elsif Input.repeat?(Input::LEFT)
  731.       cursor_pageup
  732.     end
  733.     if @index != last_index
  734.       Sound.play_cursor
  735.     end
  736.   end
  737.   #--------------------------------------------------------------------------
  738.   # ● ヘルプテキスト更新
  739.   #--------------------------------------------------------------------------
  740.   def update_help
  741.     if KGC::EquipLearnSkill::HIDE_ZERO_AP_SKILL_HELP && mask?(skill)
  742.       @help_window.set_text(KGC::EquipLearnSkill::ZERO_AP_SKILL_HELP)
  743.     else
  744.       @help_window.set_text(skill == nil ? "" : skill.description)
  745.     end
  746.   end
  747. end
  748.  
  749. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  750.  
  751. #==============================================================================
  752. # ■ Scene_Map
  753. #==============================================================================
  754.  
  755. class Scene_Map < Scene_Base
  756.   #--------------------------------------------------------------------------
  757.   # ● 画面切り替えの実行
  758.   #--------------------------------------------------------------------------
  759.   alias update_scene_change_KGC_EquipLearnSkill update_scene_change
  760.   def update_scene_change
  761.     return if $game_player.moving?    # プレイヤーの移動中?
  762.  
  763.     if $game_temp.next_scene == :ap_viewer
  764.       call_ap_viewer
  765.       return
  766.     end
  767.  
  768.     update_scene_change_KGC_EquipLearnSkill
  769.   end
  770.   #--------------------------------------------------------------------------
  771.   # ○ AP ビューアへの切り替え
  772.   #--------------------------------------------------------------------------
  773.   def call_ap_viewer
  774.     $game_temp.next_scene = nil
  775.     $scene = Scene_APViewer.new($game_temp.next_scene_actor_index,
  776.       0, Scene_APViewer::HOST_MAP)
  777.   end
  778. end
  779.  
  780. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  781.  
  782. #==============================================================================
  783. # ■ Scene_Menu
  784. #==============================================================================
  785.  
  786. class Scene_Menu < Scene_Base
  787.   if KGC::EquipLearnSkill::USE_MENU_AP_VIEWER_COMMAND
  788.   #--------------------------------------------------------------------------
  789.   # ● コマンドウィンドウの作成
  790.   #--------------------------------------------------------------------------
  791.   alias create_command_window_KGC_EquipLearnSkill create_command_window
  792.   def create_command_window
  793.     create_command_window_KGC_EquipLearnSkill
  794.  
  795.     return if $imported["CustomMenuCommand"]
  796.  
  797.     @__command_ap_viewer_index = @command_window.add_command(Vocab.ap_viewer)
  798.     if @command_window.oy > 0
  799.       @command_window.oy -= Window_Base::WLH
  800.     end
  801.     @command_window.index = @menu_index
  802.   end
  803.   end
  804.   #--------------------------------------------------------------------------
  805.   # ● コマンド選択の更新
  806.   #--------------------------------------------------------------------------
  807.   alias update_command_selection_KGC_EquipLearnSkill update_command_selection
  808.   def update_command_selection
  809.     call_ap_viewer_flag = false
  810.     if Input.trigger?(Input::C)
  811.       case @command_window.index
  812.       when @__command_ap_viewer_index  # AP ビューア
  813.         call_ap_viewer_flag = true
  814.       end
  815.     end
  816.  
  817.     # AP ビューアに移行
  818.     if call_ap_viewer_flag
  819.       if $game_party.members.size == 0
  820.         Sound.play_buzzer
  821.         return
  822.       end
  823.       Sound.play_decision
  824.       start_actor_selection
  825.       return
  826.     end
  827.  
  828.     update_command_selection_KGC_EquipLearnSkill
  829.   end
  830.   #--------------------------------------------------------------------------
  831.   # ● アクター選択の更新
  832.   #--------------------------------------------------------------------------
  833.   alias update_actor_selection_KGC_EquipLearnSkill update_actor_selection
  834.   def update_actor_selection
  835.     if Input.trigger?(Input::C)
  836.       $game_party.last_actor_index = @status_window.index
  837.       Sound.play_decision
  838.       case @command_window.index
  839.       when @__command_ap_viewer_index  # AP ビューア
  840.         $scene = Scene_APViewer.new(@status_window.index,
  841.           @__command_ap_viewer_index, Scene_APViewer::HOST_MENU)
  842.         return
  843.       end
  844.     end
  845.  
  846.     update_actor_selection_KGC_EquipLearnSkill
  847.   end
  848. end
  849.  
  850. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  851.  
  852. #==============================================================================
  853. # □ Scene_APViewer
  854. #------------------------------------------------------------------------------
  855. #   AP ビューアの処理を行うクラスです。
  856. #==============================================================================
  857.  
  858. class Scene_APViewer < Scene_Base
  859.   HOST_MENU   = 0
  860.   HOST_MAP    = 1
  861.   #--------------------------------------------------------------------------
  862.   # ● オブジェクト初期化
  863.   #     actor_index : アクターインデックス
  864.   #     menu_index  : コマンドのカーソル初期位置
  865.   #     host_scene  : 呼び出し元 (0..メニュー  1..マップ)
  866.   #--------------------------------------------------------------------------
  867.   def initialize(actor_index = 0, menu_index = 0, host_scene = HOST_MENU)
  868.     @actor_index = actor_index
  869.     @menu_index = menu_index
  870.     @host_scene = host_scene
  871.   end
  872.   #--------------------------------------------------------------------------
  873.   # ● 開始処理
  874.   #--------------------------------------------------------------------------
  875.   def start
  876.     super
  877.     create_menu_background
  878.     @actor = $game_party.members[@actor_index]
  879.     @help_window = Window_Help.new
  880.     if $imported["HelpExtension"]
  881.       @help_window.row_max = KGC::HelpExtension::ROW_MAX
  882.     end
  883.     @status_window = Window_SkillStatus.new(0, @help_window.height, @actor)
  884.     dy = @help_window.height + @status_window.height
  885.     @skill_window = Window_APViewer.new(0, dy,
  886.       Graphics.width, Graphics.height - dy, @actor)
  887.     @skill_window.help_window = @help_window
  888.   end
  889.   #--------------------------------------------------------------------------
  890.   # ● 終了処理
  891.   #--------------------------------------------------------------------------
  892.   def terminate
  893.     super
  894.     dispose_menu_background
  895.     @help_window.dispose
  896.     @status_window.dispose
  897.     @skill_window.dispose
  898.   end
  899.   #--------------------------------------------------------------------------
  900.   # ○ 元の画面へ戻る
  901.   #--------------------------------------------------------------------------
  902.   def return_scene
  903.     case @host_scene
  904.     when HOST_MENU
  905.       $scene = Scene_Menu.new(@menu_index)
  906.     when HOST_MAP
  907.       $scene = Scene_Map.new
  908.     end
  909.   end
  910.   #--------------------------------------------------------------------------
  911.   # ○ 次のアクターの画面に切り替え
  912.   #--------------------------------------------------------------------------
  913.   def next_actor
  914.     @actor_index += 1
  915.     @actor_index %= $game_party.members.size
  916.     $scene = Scene_APViewer.new(@actor_index, @menu_index, @host_scene)
  917.   end
  918.   #--------------------------------------------------------------------------
  919.   # ○ 前のアクターの画面に切り替え
  920.   #--------------------------------------------------------------------------
  921.   def prev_actor
  922.     @actor_index += $game_party.members.size - 1
  923.     @actor_index %= $game_party.members.size
  924.     $scene = Scene_APViewer.new(@actor_index, @menu_index, @host_scene)
  925.   end
  926.   #--------------------------------------------------------------------------
  927.   # ● フレーム更新
  928.   #--------------------------------------------------------------------------
  929.   def update
  930.     super
  931.     update_menu_background
  932.     @help_window.update
  933.     @skill_window.update
  934.     @status_window.update
  935.     if @skill_window.active
  936.       update_skill_selection
  937.     end
  938.   end
  939.   #--------------------------------------------------------------------------
  940.   # ○ スキル選択の更新
  941.   #--------------------------------------------------------------------------
  942.   def update_skill_selection
  943.     if Input.trigger?(Input::B)
  944.       Sound.play_cancel
  945.       return_scene
  946.     elsif Input.trigger?(Input::R)
  947.       Sound.play_cursor
  948.       next_actor
  949.     elsif Input.trigger?(Input::L)
  950.       Sound.play_cursor
  951.       prev_actor
  952.     end
  953.   end
  954. end
  955.  
  956. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  957.  
  958. #==============================================================================
  959. # ■ Scene_Battle
  960. #==============================================================================
  961.  
  962. class Scene_Battle < Scene_Base
  963.   #--------------------------------------------------------------------------
  964.   # ● メッセージ表示が終わるまでウェイト
  965.   #--------------------------------------------------------------------------
  966.   alias wait_for_message_KGC_EquipLearnSkill wait_for_message
  967.   def wait_for_message
  968.     return if @ignore_wait_for_message  # メッセージ終了までのウェイトを無視
  969.  
  970.     wait_for_message_KGC_EquipLearnSkill
  971.   end
  972.   #--------------------------------------------------------------------------
  973.   # ● 獲得した経験値とお金の表示
  974.   #--------------------------------------------------------------------------
  975.   alias display_exp_and_gold_KGC_EquipLearnSkill display_exp_and_gold
  976.   def display_exp_and_gold
  977.     @ignore_wait_for_message = true
  978.  
  979.     display_exp_and_gold_KGC_EquipLearnSkill
  980.  
  981.     display_ap
  982.     @ignore_wait_for_message = false
  983.     wait_for_message
  984.   end
  985.   #--------------------------------------------------------------------------
  986.   # ● レベルアップの表示
  987.   #--------------------------------------------------------------------------
  988.   alias display_level_up_KGC_EquipLearnSkill display_level_up
  989.   def display_level_up
  990.     display_level_up_KGC_EquipLearnSkill
  991.  
  992.     display_master_equipment_skill
  993.   end
  994.   #--------------------------------------------------------------------------
  995.   # ○ 獲得 AP の表示
  996.   #--------------------------------------------------------------------------
  997.   def display_ap
  998.     ap = $game_troop.ap_total
  999.     if ap > 0
  1000.       text = sprintf(Vocab::ObtainAP, ap)
  1001.       $game_message.texts.push('\.' + text)
  1002.     end
  1003.     wait_for_message
  1004.   end
  1005.   #--------------------------------------------------------------------------
  1006.   # ○ マスターしたスキルの表示
  1007.   #--------------------------------------------------------------------------
  1008.   def display_master_equipment_skill
  1009.     ap = $game_troop.ap_total
  1010.     $game_party.existing_members.each { |actor|
  1011.       last_skills = actor.skills
  1012.       actor.gain_ap(ap, true)
  1013.     }
  1014.     wait_for_message
  1015.   end
  1016. end
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
836
在线时间
159 小时
注册时间
2012-6-3
帖子
124
3
 楼主| 发表于 2014-8-14 15:40:41 | 只看该作者
白玉楼的台阶 发表于 2014-8-14 15:37
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆ スキル習得 ...

对了,这里是和上面的脚本一起的,技能通过消耗AP值获取……其实这个功能有没有无所谓,不过好像原脚本要搭配这个使用………………我想实现的功能只要有【一类可装备的特殊技能,每个消耗的CP不同,总CP和总共能装备的技能是有限的】即可
如果能在游戏进程中增减技能栏位和CP就更完美了

点评

用脚本框&&善用编辑  发表于 2014-8-14 15:55
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
250
在线时间
233 小时
注册时间
2013-8-2
帖子
587
4
发表于 2014-8-14 16:14:46 | 只看该作者
首先,图片失效,,,
其次,请简单说明这是什么脚本有什么用
然后,
如果能在游戏进程中增减技能栏位和CP就更完美了

zhe ge ke yi zhao zhe ge ren ---------@VIPArcher  

点评

矮油,找你给他写那个什么增减技能栏什么的  发表于 2014-8-14 16:45
找我做甚?1000+行的脚本。。。我不会做移植啦。  发表于 2014-8-14 16:24
我忘了,我要怎么遗忘。
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
836
在线时间
159 小时
注册时间
2012-6-3
帖子
124
5
 楼主| 发表于 2014-8-14 16:52:18 | 只看该作者
千夙 发表于 2014-8-14 16:14
首先,图片失效,,,
其次,请简单说明这是什么脚本有什么用
然后,

嗯……这个脚本本身的功能很多,不过我想要的只有:
1.在菜单中增加一个类似【编辑能力】的选项
2.通过【编辑能力】的选项,可以装备若干个技能,这些技能装备的限制条件是“每个技能装备时需要占用一定的cost,总cost不能超过某个数字;能装备的总技能数量也不能超过某个数字”
3.如果可以的话,希望可以在游戏流程中增减能装备的技能总数和cost总数
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
250
在线时间
233 小时
注册时间
2013-8-2
帖子
587
6
发表于 2014-8-14 17:00:59 | 只看该作者
白玉楼的台阶 发表于 2014-8-14 16:52
嗯……这个脚本本身的功能很多,不过我想要的只有:
1.在菜单中增加一个类似【编辑能力】的选项
2.通过【 ...

是不是让技能有一个空间.然后你有一个总空间.装备技能的空间不能超过总空间.只要在总空间的范围内就可以装备多个技能而且玩家还可以自己编辑已有的技能把它放到总空间里面....?
我忘了,我要怎么遗忘。
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
836
在线时间
159 小时
注册时间
2012-6-3
帖子
124
7
 楼主| 发表于 2014-8-14 17:18:16 | 只看该作者
千夙 发表于 2014-8-14 17:00
是不是让技能有一个空间.然后你有一个总空间.装备技能的空间不能超过总空间.只要在总空间的范围内就可以 ...

嗯,可以
不过我是希望用这个脚本实现类似于可选择的【特性】【能力】【插件】【符文】【称号】……的效果,
比方说,主角获得了【新兵】【坚毅】【勇猛】【不屈】等等几个特性技能,我用其他脚本让这些技能拥有“习得即可增加能力值”(这个脚本已经搞定了),但是玩家不能同时使用这些特性,只能选择一部分装备上
所以装备在这个空间里面的技能和通常的技能最好区分开来



咱曾经想过几个用事件达成这个目的的方法……但是灰常麻烦,因为那些技能都是“习得即增长能力”,所以不装备的技能不能处于习得状态,必须在开辟一些事件/开关/变量来记录那些技能是可以选择的,然后用一大堆的选择支套选择支,对玩家太不友善了……
或者用第二货币加商店购买,打开商店的时候自动卖出所有特性技能转化为cost……但是商店不能直接卖技能只能卖道具,这样玩家调整装备都要重新使用买到的道具来学习……
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
22713
在线时间
8623 小时
注册时间
2011-12-31
帖子
3367
8
发表于 2014-8-14 17:30:04 | 只看该作者
本帖最后由 tseyik 于 2014-8-14 17:38 编辑

Ace改版
http://mitsu-evo.6.ql.bz/RGSS3_16.html

RUBY 代码复制
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆ スキルCP制 - KGC_SkillCPSystem ◆ VX Ace ◆
  3. #_/    ◇ Last update : 2009/09/13 ◇
  4. #_/----------------------------------------------------------------------------
  5. #_/  戦闘中に使用可能なスキルを限定する機能を追加します。
  6. #_/============================================================================
  7. #_/ 【装備】≪スキル習得装備≫ より下に導入してください。
  8. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  9. #==============================================================================
  10. #    ☆VXAce RGSS3 「スキルCP制」☆
  11. #      EnDlEss DREamER
  12. #     URL:[url]http://mitsu-evo.6.ql.bz/[/url]
  13. #     製作者 mitsu-evo
  14. #     Last:2014/5/8
  15. #   KGC様のスキルCP制RGSS3移植版
  16. #     ▼ 素材よりも下に。
  17. #==============================================================================
  18. =begin
  19. 5/8:ステータス画面のCPゲージ位置を修正。
  20. メニューコマンドからの挙動を修正。
  21.  
  22.  
  23.  
  24. =end
  25. #==============================================================================
  26. # ★ カスタマイズ項目 - Customize ★
  27. #==============================================================================
  28.  
  29. module KGC
  30. module SkillCPSystem
  31.   # ◆ 登録スキル最大数
  32.   MAX_SKILLS = 9
  33.   # ◆ CP の名称
  34.   VOCAB_CP   = "CP"
  35.   # ◆ CP の名称 (略)
  36.   VOCAB_CP_A = "C"
  37.   # ◆ ステータス画面に CP を表示する
  38.   SHOW_STATUS_CP = true
  39.  
  40.   # ◆ 消費 CP 既定値
  41.   #  消費 CP 未指定のスキルで使用。
  42.   DEFAULT_CP_COST = 1
  43.   # ◆ CP 上限
  44.   #  (固有 CP などを除いた) 素の状態での CP 上限。
  45.   CP_MAX = 15
  46.   # ◆ CP 下限
  47.   CP_MIN = 1
  48.   # ◆ 補正後の CP 上限
  49.   #  固有 CP や装備品による変動を含めた上限。
  50.   REVISED_CP_MAX = 20
  51.   # ◆ 補正後の CP 下限
  52.   REVISED_CP_MIN = 0
  53.   # ◆ 最大 CP 算出式
  54.   #   level..現在のレベル
  55.   #  自動的に整数変換するので、結果が小数になってもOK。
  56.   CP_CALC_EXP = "level * 0.6 + 1.0"
  57.   # ◆ アクター毎の最大 CP 算出式
  58.   PERSONAL_CP_CALC_EXP = []
  59.   #  ここから下に、アクターごとの最大 CP を
  60.   #   PERSONAL_CP_CALC_EXP[アクター ID] = "計算式"
  61.   #  という書式で指定。
  62.   #  計算式は CP_CALC_EXP と同様の書式。
  63.   #  指定しなかったアクターは CP_CALC_EXP を使用。
  64.   #   <例> ラルフだけ優遇
  65.   # PERSONAL_CP_CALC_EXP[1] = "level * 0.8 + 2.0"
  66.  
  67.   # ◆ 戦闘テスト時は無効化
  68.   #  true  : 戦闘テスト時は全スキルを使用可能。
  69.   #  false : 戦闘テスト時は (セットしない限り) 使用不可。
  70.   DISABLE_IN_BATTLETEST  = true
  71.   # ◆ 使用不可スキルもセット可能
  72.   SHOW_UNUSABLE_SKILL    = true
  73.   # ◆ 消費 CP 0 のスキルはセットしなくても使用可能
  74.   USABLE_COST_ZERO_SKILL = true
  75.   # ◆ パッシブスキルはセットしないと効果なし
  76.   #  ≪パッシブスキル≫ 導入時のみ有効。
  77.   PASSIVE_NEED_TO_SET    = true
  78.   # ◆ 新規習得スキルを自動的にセット
  79.   #  true  : 習得したスキルを空きスロットにセット。
  80.   #           ※ ≪スキル習得装備≫ で習得したスキルは無効。
  81.   #  false : 習得しただけではセットされない (手動でセット)。
  82.   AUTO_SET_NEW_SKILL     = true
  83.   # ◆ 消費 CP 0 の場合も消費 CP を表示する
  84.   #  true  : 消費 CP 0 でも表示
  85.   #  false : 消費 CP 1 以上の場合のみ表示
  86.   SHOW_ZERO_COST         = false
  87.  
  88.   # ◆ CP ゲージの色
  89.   #  数値  : \C[n] と同じ色。
  90.   #  Color : 指定した色。 ( Color.new(255, 128, 128) など )
  91.   GAUGE_START_COLOR = 13  # 開始色
  92.   GAUGE_END_COLOR   =  5  # 終了色
  93.  
  94.   # ◆ CP ゲージに汎用ゲージを使用する
  95.   #  ≪汎用ゲージ描画≫ 導入時のみ有効。
  96.   ENABLE_GENERIC_GAUGE = true
  97.   # ◆ CP ゲージ設定
  98.   #  画像は "Graphics/System" から読み込む。
  99.   GAUGE_IMAGE  = "GaugeCP"  # 画像
  100.   GAUGE_OFFSET = [-23, -2]  # 位置補正 [x, y]
  101.   GAUGE_LENGTH = -4         # 長さ補正
  102.   GAUGE_SLOPE  = 30         # 傾き (-89 ~ 89)
  103.  
  104.   # ◆ メニュー画面に「スキル設定」コマンドを追加する
  105.   #  追加する場所は、メニューコマンドの最下部です。
  106.   #  他の部分に追加したければ、≪カスタムメニューコマンド≫ をご利用ください。
  107.   USE_MENU_SET_SKILL_COMMAND = true
  108.   # ◆ メニュー画面の「スキル設定」コマンドの名称
  109.   VOCAB_MENU_SET_SKILL       = "スキル設定"
  110.  
  111.   # ◆ 未設定項目の表示文字列
  112.   BLANK_TEXT   = "-  EMPTY  -"
  113.   # ◆ 設定解除の表示文字列
  114.   RELEASE_TEXT = "( 設定解除 )"
  115. end
  116. end
  117.  
  118. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  119.  
  120. $imported = {} if $imported == nil
  121. $imported["SkillCPSystem"] = true
  122.  
  123. module KGC::SkillCPSystem
  124.   module Regexp
  125.     module BaseItem
  126.       # 最大 CP
  127.       MAXCP_PLUS = /<(?:MAX|最大)CP\s*([\-\+]?\d+)>/
  128.       # 登録スキル数
  129.       BATTLE_SKILL_MAX = /<(?:BATTLE_SKILL_MAX|登録スキル数)\s*([\-\+]?\d+)>/i
  130.     end
  131.  
  132.     module Skill
  133.       # 消費 CP
  134.       CP_COST = /<CP\s*(\d+)>/i
  135.       # 同時セット不可
  136.       EXCLUDE = /<(?:EXCLUDE|同時セット不可)\s*(\d+(?:\s*,\s*\d+)*)>/
  137.     end
  138.   end
  139. end
  140.  
  141. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  142.  
  143. #==============================================================================
  144. # □ KGC::Commands
  145. #==============================================================================
  146.  
  147. module KGC
  148. module Commands
  149.   module_function
  150.   #--------------------------------------------------------------------------
  151.   # ○ MaxCP 補正値の取得
  152.   #     actor_id    : アクター ID
  153.   #     variable_id : 取得した値を代入する変数の ID
  154.   #--------------------------------------------------------------------------
  155.   def get_actor_own_cp(actor_id, variable_id = 0)
  156.     value = $game_actors[actor_id].maxcp_plus
  157.     $game_variables[variable_id] = value if variable_id > 0
  158.     return value
  159.   end
  160.   alias get_own_cp get_actor_own_cp
  161.   #--------------------------------------------------------------------------
  162.   # ○ MaxCP 補正値の変更
  163.   #     actor_id : アクター ID
  164.   #     value    : MaxCP 補正値
  165.   #--------------------------------------------------------------------------
  166.   def set_actor_own_cp(actor_id, value)
  167.     $game_actors[actor_id].maxcp_plus = value
  168.   end
  169.   alias set_own_cp set_actor_own_cp
  170.   #--------------------------------------------------------------------------
  171.   # ○ アクターの MaxCP 補正値の増加
  172.   #     actor_id : アクター ID
  173.   #     value    : 増加量
  174.   #--------------------------------------------------------------------------
  175.   def gain_actor_cp(actor_id, value)
  176.     $game_actors[actor_id].maxcp_plus += value
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ○ 登録スキル最大数の取得
  180.   #     actor_id : アクター ID
  181.   #     variable_id : 取得した値を代入する変数の ID
  182.   #--------------------------------------------------------------------------
  183.   def get_battle_skill_max(actor_id, variable_id = 0)
  184.     value = $game_actors[actor_id].battle_skill_max
  185.     $game_variables[variable_id] = value if variable_id > 0
  186.     return value
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ○ 登録スキル最大数の変更
  190.   #     actor_id : アクター ID
  191.   #     value    : 登録可能数
  192.   #--------------------------------------------------------------------------
  193.   def set_battle_skill_max(actor_id, value = -1)
  194.     $game_actors[actor_id].battle_skill_max = value
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ○ スキルが登録されているか
  198.   #     actor_id : アクター ID
  199.   #     skill_id : 確認するスキル ID
  200.   #--------------------------------------------------------------------------
  201.   def battle_skill_set?(actor_id, skill_id)
  202.     return $game_actors[actor_id].battle_skill_ids.include?(skill_id)
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ○ スキルの登録
  206.   #     actor_id : アクター ID
  207.   #     index    : 登録箇所
  208.   #     skill_id : 登録するスキル ID (nil で解除)
  209.   #--------------------------------------------------------------------------
  210.   def set_battle_skill(actor_id, index, skill_id = nil)
  211.     actor = $game_actors[actor_id]
  212.     if skill_id.is_a?(Integer)
  213.       # 登録
  214.       skill = $data_skills[skill_id]
  215.       return unless actor.battle_skill_settable?(index, skill)  # セット不可
  216.  
  217.       actor.set_battle_skill(index, skill)
  218.       actor.restore_battle_skill
  219.     else
  220.       # 解除
  221.       actor.remove_battle_skill(index)
  222.     end
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # ○ スキルの追加登録
  226.   #     actor_id : アクター ID
  227.   #     skill_id : 登録するスキル ID
  228.   #--------------------------------------------------------------------------
  229.   def add_battle_skill(actor_id, skill_id)
  230.     actor = $game_actors[actor_id]
  231.     skill = $data_skills[skill_id]
  232.     return if actor == nil || skill == nil
  233.  
  234.     actor.add_battle_skill(skill)
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # ○ スキルの全解除
  238.   #     actor_id : アクター ID
  239.   #--------------------------------------------------------------------------
  240.   def clear_battle_skill(actor_id)
  241.     $game_actors[actor_id].clear_battle_skill
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ○ スキル設定画面の呼び出し
  245.   #     actor_index : アクターインデックス
  246.   #--------------------------------------------------------------------------
  247.   def call_set_battle_skill(actor_index = 0)
  248.     #return if $game_party.in_battle
  249.     #$game_temp.next_scene = :set_battle_skill
  250.     #$game_temp.next_scene_actor_index = actor_index
  251.     SceneManager.call(Scene_SetBattleSkill)
  252.     Fiber.yield
  253.   end
  254. end
  255. end
  256.  
  257. class Game_Interpreter
  258.   include KGC::Commands
  259. end
  260.  
  261. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  262.  
  263. #==============================================================================
  264. # ■ Vocab
  265. #==============================================================================
  266.  
  267. module Vocab
  268.   # CP
  269.   def self.cp
  270.     return KGC::SkillCPSystem::VOCAB_CP
  271.   end
  272.  
  273.   # CP (略)
  274.   def self.cp_a
  275.     return KGC::SkillCPSystem::VOCAB_CP_A
  276.   end
  277.  
  278.   # スキル設定
  279.   def self.set_battle_skill
  280.     return KGC::SkillCPSystem::VOCAB_MENU_SET_SKILL
  281.   end
  282. end
  283.  
  284. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  285.  
  286. #==============================================================================
  287. # ■ RPG::BaseItem
  288. #==============================================================================
  289.  
  290. class RPG::BaseItem
  291.   #--------------------------------------------------------------------------
  292.   # ○ スキルCP制のキャッシュを生成
  293.   #--------------------------------------------------------------------------
  294.   def create_skill_cp_system_cache
  295.     @__maxcp_plus = 0
  296.     @__battle_skill_max_plus = 0
  297.  
  298.     self.note.each_line { |line|
  299.       case line
  300.       when KGC::SkillCPSystem::Regexp::BaseItem::MAXCP_PLUS
  301.         # 最大 CP
  302.         @__maxcp_plus += $1.to_i
  303.       when KGC::SkillCPSystem::Regexp::BaseItem::BATTLE_SKILL_MAX
  304.         # 登録スキル数
  305.         @__battle_skill_max_plus += $1.to_i
  306.       end
  307.     }
  308.   end
  309.   #--------------------------------------------------------------------------
  310.   # ○ 最大 CP 補正
  311.   #--------------------------------------------------------------------------
  312.   def maxcp_plus
  313.     create_skill_cp_system_cache if @__maxcp_plus == nil
  314.     return @__maxcp_plus
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ○ 登録スキル数補正
  318.   #--------------------------------------------------------------------------
  319.   def battle_skill_max_plus
  320.     create_skill_cp_system_cache if @__battle_skill_max_plus == nil
  321.     return @__battle_skill_max_plus
  322.   end
  323. end
  324.  
  325. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  326.  
  327. #==============================================================================
  328. # ■ RPG::Skill
  329. #==============================================================================
  330.  
  331. class RPG::Skill < RPG::UsableItem
  332.   #--------------------------------------------------------------------------
  333.   # ○ スキルCP制のキャッシュを生成
  334.   #--------------------------------------------------------------------------
  335.   def create_skill_cp_system_cache
  336.     @__cp_cost = KGC::SkillCPSystem::DEFAULT_CP_COST
  337.     # 攻撃・防御設定スキルならコスト0
  338.     @__cp_cost = 0 if @id == 1 or @id == 2
  339.     @__excluded_skills = []
  340.  
  341.     self.note.each_line { |line|
  342.       case line
  343.       when KGC::SkillCPSystem::Regexp::Skill::CP_COST
  344.         # 消費 CP
  345.         @__cp_cost = $1.to_i
  346.       when KGC::SkillCPSystem::Regexp::Skill::EXCLUDE
  347.         # 同時セット不可
  348.         $1.scan(/\d+/).each { |num| @__excluded_skills << num.to_i }
  349.         @__excluded_skills.uniq!
  350.       end
  351.     }
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ○ 消費 CP
  355.   #--------------------------------------------------------------------------
  356.   def cp_cost
  357.     create_skill_cp_system_cache if @__cp_cost == nil
  358.     return @__cp_cost
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # ○ 同時セット不可
  362.   #--------------------------------------------------------------------------
  363.   def excluded_skills
  364.     create_skill_cp_system_cache if @__excluded_skills == nil
  365.     return @__excluded_skills
  366.   end
  367. end
  368.  
  369. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  370.  
  371. #==============================================================================
  372. # ■ Game_Battler
  373. #==============================================================================
  374.  
  375. class Game_Battler
  376.   #--------------------------------------------------------------------------
  377.   # ○ 戦闘用スキルセット済み判定
  378.   #     skill : スキル
  379.   #--------------------------------------------------------------------------
  380.   def battle_skill_set?(skill)
  381.     return true
  382.   end
  383. end
  384.  
  385. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  386.  
  387. #==============================================================================
  388. # ■ Game_Actor
  389. #==============================================================================
  390.  
  391. class Game_Actor < Game_Battler
  392.   #--------------------------------------------------------------------------
  393.   # ● 公開インスタンス変数
  394.   #--------------------------------------------------------------------------
  395.   attr_writer   :maxcp_plus               # MaxCP 補正値
  396.   #--------------------------------------------------------------------------
  397.   # ○ MaxCP 取得
  398.   #--------------------------------------------------------------------------
  399.   def maxcp
  400.     calc_exp = KGC::SkillCPSystem::PERSONAL_CP_CALC_EXP[self.id]
  401.     if calc_exp == nil
  402.       calc_exp = KGC::SkillCPSystem::CP_CALC_EXP
  403.     end
  404.     n = Integer(eval(calc_exp))
  405.     n = [[n, cp_limit].min, KGC::SkillCPSystem::CP_MIN].max
  406.     n += maxcp_plus + maxcp_plus_equip
  407.     return [[n, revised_cp_limit].min, KGC::SkillCPSystem::REVISED_CP_MIN].max
  408.   end
  409.   #--------------------------------------------------------------------------
  410.   # ○ CP 取得
  411.   #--------------------------------------------------------------------------
  412.   def cp
  413.     return [maxcp - consumed_cp, 0].max
  414.   end
  415.   #--------------------------------------------------------------------------
  416.   # ○ CP 消費量取得
  417.   #--------------------------------------------------------------------------
  418.   def consumed_cp
  419.     n = 0
  420.     battle_skills.compact.each { |skill| n += skill.cp_cost }
  421.     return n
  422.   end
  423.   #--------------------------------------------------------------------------
  424.   # ○ CP 上限取得
  425.   #--------------------------------------------------------------------------
  426.   def cp_limit
  427.     return KGC::SkillCPSystem::CP_MAX
  428.   end
  429.   #--------------------------------------------------------------------------
  430.   # ○ 補正後の CP 上限取得
  431.   #--------------------------------------------------------------------------
  432.   def revised_cp_limit
  433.     return KGC::SkillCPSystem::REVISED_CP_MAX
  434.   end
  435.   #--------------------------------------------------------------------------
  436.   # ○ MaxCP 補正値取得
  437.   #--------------------------------------------------------------------------
  438.   def maxcp_plus
  439.     if @maxcp_plus == nil
  440.       if @own_cp != nil
  441.         @maxcp_plus = @own_cp
  442.         @own_cp = nil
  443.       else
  444.         @maxcp_plus = 0
  445.       end
  446.     end
  447.     return @maxcp_plus
  448.   end
  449.   #--------------------------------------------------------------------------
  450.   # ○ 装備品による MaxCP 補正値取得
  451.   #--------------------------------------------------------------------------
  452.   def maxcp_plus_equip
  453.     n = 0
  454.     equips.compact.each { |item| n += item.maxcp_plus }
  455.     return n
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   # ● スキル取得
  459.   #--------------------------------------------------------------------------
  460.   alias skills_KGC_SkillCPSystem skills
  461.   def skills
  462.     return (skill_cp_restrict? ? restricted_skills : skills_KGC_SkillCPSystem)
  463.   end
  464.   #--------------------------------------------------------------------------
  465.   # ● スキルの習得済み判定
  466.   #--------------------------------------------------------------------------
  467.   def skill_learn?(skill)
  468.     skill.is_a?(RPG::Skill) && @skills.include?(skill.id)
  469.   end
  470.   #--------------------------------------------------------------------------
  471.   # ○ スキルを制限するか
  472.   #--------------------------------------------------------------------------
  473.   def skill_cp_restrict?
  474.     if $game_party.in_battle
  475.       # 戦闘テストでないか、戦闘テストでも制限する場合
  476.       return true unless $BTEST && KGC::SkillCPSystem::DISABLE_IN_BATTLETEST
  477.     end
  478.  
  479.     return false
  480.   end
  481.   #--------------------------------------------------------------------------
  482.   # ○ スキルを制限
  483.   #--------------------------------------------------------------------------
  484.   def restricted_skills
  485.     result = all_skills
  486.     result.each_with_index { |skill, i|
  487.       # 消費 CP > 0 のスキルを除外
  488.       if !KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL || skill.cp_cost > 0
  489.         result[i] = nil
  490.       end
  491.       # パッシブスキルを除外
  492.       if $imported["PassiveSkill"] && KGC::SkillCPSystem::PASSIVE_NEED_TO_SET
  493.         if skill.passive &&
  494.             (!KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL || skill.cp_cost > 0)
  495.           result[i] = nil
  496.         end
  497.       end
  498.     }
  499.     result.compact!
  500.     # 戦闘スキルを追加
  501.     result |= battle_skills
  502.     result.sort! { |a, b| a.id <=> b.id }
  503.     return result
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # ○ 全スキル取得
  507.   #--------------------------------------------------------------------------
  508.   def all_skills
  509.     # 一時的に非戦闘中にする
  510.     #last_in_battle = $game_party.in_battle
  511.     #$game_party.on_battle_end
  512.  
  513.     result = skills_KGC_SkillCPSystem
  514.     if $imported["EquipLearnSkill"]
  515.       result |= (equipment_skills | full_ap_skills)
  516.       result.sort! { |a, b| a.id <=> b.id }
  517.     end
  518.  
  519.     # 戦闘中フラグを戻す
  520.     #$game_party.on_battle_start#in_battle = last_in_battle
  521.  
  522.     return result
  523.   end
  524.  
  525.   #--------------------------------------------------------------------------
  526.   # ○ 登録スキル最大数取得
  527.   #--------------------------------------------------------------------------
  528.   def battle_skill_max
  529.     @battle_skill_max = -1 if @battle_skill_max == nil
  530.     n = (@battle_skill_max < 0 ?
  531.       KGC::SkillCPSystem::MAX_SKILLS : @battle_skill_max)
  532.     n += equipment_battle_skill_max_plus
  533.     return [n, 0].max
  534.   end
  535.   #--------------------------------------------------------------------------
  536.   # ○ 装備品による登録スキル数補正
  537.   #--------------------------------------------------------------------------
  538.   def equipment_battle_skill_max_plus
  539.     n = 0
  540.     equips.compact.each { |item| n += item.battle_skill_max_plus }
  541.     return n
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # ○ 登録スキル最大数設定
  545.   #--------------------------------------------------------------------------
  546.   def battle_skill_max=(value)
  547.     @battle_skill_max = value
  548.     if @battle_skills == nil
  549.       @battle_skills = []
  550.     else
  551.       @battle_skills = @battle_skills[0...value]
  552.     end
  553.     restore_passive_rev if $imported["PassiveSkill"]
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # ○ 戦闘用スキル ID 取得
  557.   #--------------------------------------------------------------------------
  558.   def battle_skill_ids
  559.     @battle_skills = [] if @battle_skills == nil
  560.     return @battle_skills
  561.   end
  562.   #--------------------------------------------------------------------------
  563.   # ○ 戦闘用スキル取得
  564.   #--------------------------------------------------------------------------
  565.   def battle_skills
  566.     result = []
  567.     battle_skill_ids.each { |i|
  568.       next if i == nil           # 無効なスキルは無視
  569.       result << $data_skills[i]
  570.     }
  571.     return result
  572.   end
  573.   #--------------------------------------------------------------------------
  574.   # ○ 戦闘用スキル登録
  575.   #     index : 位置
  576.   #     skill : スキル (nil で解除)
  577.   #--------------------------------------------------------------------------
  578.   def set_battle_skill(index, skill)
  579.     if skill == nil
  580.       @battle_skills[index] = nil
  581.     else
  582.       return unless skill.is_a?(RPG::Skill)  # スキル以外
  583.       return if cp < skill.cp_cost           # CP 不足
  584.       if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0
  585.         return
  586.       end
  587.  
  588.       @battle_skills[index] = skill.id
  589.     end
  590.     restore_passive_rev if $imported["PassiveSkill"]
  591.   end
  592.   #--------------------------------------------------------------------------
  593.   # ○ 戦闘用スキル追加登録
  594.   #     skill : スキル
  595.   #--------------------------------------------------------------------------
  596.   def add_battle_skill(skill)
  597.     return unless skill.is_a?(RPG::Skill)  # スキル以外
  598.     skills = battle_skill_ids
  599.     return if skills.include?(skill.id)    # 登録済み
  600.     return if cp < skill.cp_cost           # CP 不足
  601.     return if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0
  602.  
  603.     battle_skill_max.times { |i|
  604.       # 空きがあれば登録
  605.       if skills[i] == nil
  606.         set_battle_skill(i, skill)
  607.         break
  608.       end
  609.     }
  610.     restore_battle_skill
  611.   end
  612.   #--------------------------------------------------------------------------
  613.   # ○ 戦闘用スキル解除
  614.   #     index : 位置
  615.   #--------------------------------------------------------------------------
  616.   def remove_battle_skill(index)
  617.     @battle_skills[index] = nil
  618.     restore_passive_rev if $imported["PassiveSkill"]
  619.   end
  620.   #--------------------------------------------------------------------------
  621.   # ○ 戦闘用スキル全解除
  622.   #--------------------------------------------------------------------------
  623.   def clear_battle_skill
  624.     @battle_skills = []
  625.     restore_passive_rev if $imported["PassiveSkill"]
  626.   end
  627.   #--------------------------------------------------------------------------
  628.   # ○ 戦闘用スキルセット可否判定
  629.   #     index : 位置
  630.   #     skill : スキル
  631.   #--------------------------------------------------------------------------
  632.   def battle_skill_settable?(index, skill)
  633.     return false if battle_skill_max <= index  # 範囲外
  634.     return true  if skill == nil               # nil は解除なので OK
  635.  
  636.     return false if battle_skill_ids.include?(skill.id)  # セット済み
  637.  
  638.     curr_skill_id = battle_skill_ids[index]
  639.     curr_skill    = (curr_skill_id != nil ? $data_skills[curr_skill_id] : nil)
  640.  
  641.     # 同時セット不可
  642.     excluded  = excluded_battle_skill_ids
  643.     excluded -= curr_skill.excluded_skills if curr_skill != nil
  644.     return false if excluded.include?(skill.id)
  645.  
  646.     offset = (curr_skill != nil ? curr_skill.cp_cost : 0)
  647.     return false if self.cp < (skill.cp_cost - offset)  # CP 不足
  648.  
  649.     return true
  650.   end
  651.   #--------------------------------------------------------------------------
  652.   # ○ Exclude スキル ID 取得
  653.   #--------------------------------------------------------------------------
  654.   def excluded_battle_skill_ids
  655.     result = []
  656.     battle_skills.each { |skill| result |= skill.excluded_skills }
  657.     return result
  658.   end
  659.   #--------------------------------------------------------------------------
  660.   # ○ 戦闘用スキルを修復
  661.   #--------------------------------------------------------------------------
  662.   def restore_battle_skill
  663.     return
  664. =begin
  665.     result = battle_skill_ids.clone
  666.     usable_skills = all_skills
  667.  
  668.     result.each_with_index { |n, i|
  669.       next if n == nil
  670.       # 未修得の場合は解除
  671.       if (usable_skills.find { |s| s.id == n }) == nil
  672.         result[i] = nil
  673.       end
  674.     }
  675.     @battle_skills = result[0...battle_skill_max]
  676.     # CP 不足のスキルを下から順に外す
  677.     (battle_skill_max - 1).downto(0) { |i|
  678.       @battle_skills[i] = nil if maxcp - consumed_cp < 0
  679.     }
  680. =end
  681.   end
  682.   #--------------------------------------------------------------------------
  683.   # ● 装備の破棄
  684.   #     item : 破棄する武器 or 防具
  685.   #    武器/防具の増減で「装備品も含める」のとき使用する。
  686.   #--------------------------------------------------------------------------
  687.   alias discard_equip_KGC_SkillCPSystem discard_equip
  688.   def discard_equip(item)
  689.     discard_equip_KGC_SkillCPSystem(item)
  690.  
  691.     restore_battle_skill
  692.     restore_passive_rev if $imported["PassiveSkill"]
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # ● 経験値の変更
  696.   #     exp  : 新しい経験値
  697.   #     show : レベルアップ表示フラグ
  698.   #--------------------------------------------------------------------------
  699.   alias change_exp_KGC_SkillCPSystem change_exp
  700.   def change_exp(exp, show)
  701.     # 習得したスキルを表示するため、戦闘中フラグを一時的に解除
  702.     #last_in_battle = $game_party.in_battle
  703.     #$game_party.on_battle_end#in_battle = false
  704.  
  705.     change_exp_KGC_SkillCPSystem(exp, show)
  706.  
  707.     #$game_party.on_battle_start#in_battle = last_in_battle
  708.   end
  709.   if KGC::SkillCPSystem::AUTO_SET_NEW_SKILL
  710.   #--------------------------------------------------------------------------
  711.   # ● スキルを覚える
  712.   #     skill_id : スキル ID
  713.   #--------------------------------------------------------------------------
  714.   alias learn_skill_KGC_SkillCPSystem learn_skill
  715.   def learn_skill(skill_id)
  716.     unless skill_learn?($data_skills[skill_id])
  717.       learn_skill_KGC_SkillCPSystem(skill_id)
  718.       add_battle_skill($data_skills[skill_id])
  719.     end
  720.   end
  721.   end  # <- if KGC::SkillCPSystem::AUTO_SET_NEW_SKILL
  722.   #--------------------------------------------------------------------------
  723.   # ● スキルを忘れる
  724.   #     skill_id : スキル ID
  725.   #--------------------------------------------------------------------------
  726.   alias forget_skill_KGC_SkillCPSystem forget_skill
  727.   def forget_skill(skill_id)
  728.     # 忘れるスキルを戦闘用スキルから削除
  729.     battle_skill_ids.each_with_index { |s, i|
  730.       remove_battle_skill(i) if s == skill_id
  731.     }
  732.  
  733.     forget_skill_KGC_SkillCPSystem(skill_id)
  734.   end
  735.   #--------------------------------------------------------------------------
  736.   # ○ 戦闘用スキルセット済み判定
  737.   #     skill : スキル
  738.   #--------------------------------------------------------------------------
  739.   def battle_skill_set?(skill)
  740.     return false unless skill.is_a?(RPG::Skill)  # スキル以外
  741.  
  742.     return battle_skill_ids.include?(skill.id)
  743.   end
  744. end
  745.  
  746. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  747.  
  748. #==============================================================================
  749. # ■ Window_Base
  750. #==============================================================================
  751.  
  752. class Window_Base < Window
  753.   #--------------------------------------------------------------------------
  754.   # ○ CP の文字色を取得
  755.   #     actor : アクター
  756.   #--------------------------------------------------------------------------
  757.   def cp_color(actor)
  758.     return knockout_color if actor.maxcp > 0 && actor.cp == 0
  759.     return normal_color
  760.   end
  761.   #--------------------------------------------------------------------------
  762.   # ○ CP ゲージの色 1 の取得
  763.   #--------------------------------------------------------------------------
  764.   def cp_gauge_color1
  765.     color = KGC::SkillCPSystem::GAUGE_START_COLOR
  766.     return (color.is_a?(Integer) ? text_color(color) : color)
  767.   end
  768.   #--------------------------------------------------------------------------
  769.   # ○ CP ゲージの色 2 の取得
  770.   #--------------------------------------------------------------------------
  771.   def cp_gauge_color2
  772.     color = KGC::SkillCPSystem::GAUGE_END_COLOR
  773.     return (color.is_a?(Integer) ? text_color(color) : color)
  774.   end
  775.   #--------------------------------------------------------------------------
  776.   # ○ CP の描画
  777.   #     actor : アクター
  778.   #     x     : 描画先 X 座標
  779.   #     y     : 描画先 Y 座標
  780.   #     width : 幅
  781.   #--------------------------------------------------------------------------
  782.   def draw_actor_cp(actor, x, y, width = 120)
  783.     draw_actor_cp_gauge(actor, x, y, width)
  784.     self.contents.font.color = system_color
  785.     self.contents.draw_text(x, y, 30, line_height, Vocab::cp_a)
  786.     self.contents.font.color = cp_color(actor)
  787.     xr = x + width
  788.     if width < 120
  789.       self.contents.draw_text(xr - 40, y, 40, line_height, actor.cp, 2)
  790.     else
  791.       self.contents.draw_text(xr - 90, y, 40, line_height, actor.cp, 2)
  792.       self.contents.font.color = normal_color
  793.       self.contents.draw_text(xr - 50, y, 10, line_height, "/", 2)
  794.       self.contents.draw_text(xr - 40, y, 40, line_height, actor.maxcp, 2)
  795.     end
  796.     self.contents.font.color = normal_color
  797.   end
  798.   #--------------------------------------------------------------------------
  799.   # ○ CP ゲージの描画
  800.   #     actor : アクター
  801.   #     x     : 描画先 X 座標
  802.   #     y     : 描画先 Y 座標
  803.   #     width : 幅
  804.   #--------------------------------------------------------------------------
  805.   def draw_actor_cp_gauge(actor, x, y, width = 120)
  806.     if KGC::SkillCPSystem::ENABLE_GENERIC_GAUGE && $imported["GenericGauge"]
  807.       # 汎用ゲージ
  808.       draw_gauge(KGC::SkillCPSystem::GAUGE_IMAGE,
  809.         x, y, width, actor.cp, [actor.maxcp, 1].max,
  810.         KGC::SkillCPSystem::GAUGE_OFFSET,
  811.         KGC::SkillCPSystem::GAUGE_LENGTH,
  812.         KGC::SkillCPSystem::GAUGE_SLOPE)
  813.     else
  814.       # デフォルトゲージ
  815.       gw = width * actor.cp / [actor.maxcp, 1].max
  816.       gc1 = cp_gauge_color1
  817.       gc2 = cp_gauge_color2
  818.       self.contents.fill_rect(x, y + line_height - 8, width, 6, gauge_back_color)
  819.       self.contents.gradient_fill_rect(x, y + line_height - 8, gw, 6, gc1, gc2)
  820.     end
  821.   end
  822. end
  823.  
  824.  
  825. #==============================================================================
  826. # ■ Window_MenuCommand
  827. #------------------------------------------------------------------------------
  828. #  メニュー画面で表示するコマンドウィンドウです。
  829. #==============================================================================
  830.  
  831. class Window_MenuCommand < Window_Command
  832.   #--------------------------------------------------------------------------
  833.   # ● 独自コマンドの追加用
  834.   #--------------------------------------------------------------------------
  835.   alias add_original_commands_KGC_SkillCPSystem add_original_commands
  836.   def add_original_commands
  837.     add_original_commands_KGC_SkillCPSystem
  838.     add_command(Vocab.set_battle_skill, :battle_skill, battle_skill_enabled)
  839.   end
  840.   #--------------------------------------------------------------------------
  841.   # ● スキル設定の有効状態を取得
  842.   #--------------------------------------------------------------------------
  843.   def battle_skill_enabled
  844.     KGC::SkillCPSystem::USE_MENU_SET_SKILL_COMMAND  
  845.   end
  846. end
  847. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  848.  
  849. #==============================================================================
  850. # ■ Window_Status
  851. #==============================================================================
  852.  
  853. if KGC::SkillCPSystem::SHOW_STATUS_CP
  854. class Window_Status < Window_Selectable
  855.   #--------------------------------------------------------------------------
  856.   # ● 基本情報の描画
  857.   #     x : 描画先 X 座標
  858.   #     y : 描画先 Y 座標
  859.   #--------------------------------------------------------------------------
  860.   alias draw_basic_info_KGC_SkillCPSystem draw_basic_info
  861.   def draw_basic_info(x, y)
  862.     draw_basic_info_KGC_SkillCPSystem(x, y)
  863.  
  864.     draw_actor_cp(@actor, x, y + line_height * 1)
  865.   end
  866. end
  867. end
  868.  
  869. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  870.  
  871. #==============================================================================
  872. # □ Window_BattleSkillStatus
  873. #------------------------------------------------------------------------------
  874. #   戦闘スキル設定画面で、設定者のステータスを表示するウィンドウです。
  875. #==============================================================================
  876.  
  877. class Window_BattleSkillStatus < Window_Base
  878.   #--------------------------------------------------------------------------
  879.   # ● オブジェクト初期化
  880.   #     x     : ウィンドウの X 座標
  881.   #     y     : ウィンドウの Y 座標
  882.   #     actor : アクター
  883.   #--------------------------------------------------------------------------
  884.   def initialize(x, y, actor)
  885.     super(x, y, Graphics.width, line_height + 32)
  886.     @actor = actor
  887.     refresh
  888.   end
  889.   #--------------------------------------------------------------------------
  890.   # ● リフレッシュ
  891.   #--------------------------------------------------------------------------
  892.   def refresh
  893.     self.contents.clear
  894.     draw_actor_name(@actor, 4, 0)
  895.     draw_actor_level(@actor, 140, 0)
  896.     draw_actor_cp(@actor, 240, 0)
  897.   end
  898.   #--------------------------------------------------------------------------
  899.   # ● アクターの設定
  900.   #--------------------------------------------------------------------------
  901.   def actor=(actor)
  902.     return if @actor == actor
  903.     @actor = actor
  904.     refresh
  905.   end
  906. end
  907.  
  908. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  909.  
  910. #==============================================================================
  911. # □ Window_BattleSkillSlot
  912. #------------------------------------------------------------------------------
  913. #   戦闘スキル選択画面で、設定したスキルの一覧を表示するウィンドウです。
  914. #==============================================================================
  915.  
  916. class Window_BattleSkillSlot < Window_Selectable
  917.   #--------------------------------------------------------------------------
  918.   # ● オブジェクト初期化
  919.   #     x      : ウィンドウの X 座標
  920.   #     y      : ウィンドウの Y 座標
  921.   #     width  : ウィンドウの幅
  922.   #     height : ウィンドウの高さ
  923.   #     actor  : アクター
  924.   #--------------------------------------------------------------------------
  925.   def initialize(x, y, width, height, actor)
  926.     super(x, y, width, height)
  927.     @actor = actor
  928.     self.index = 0
  929.     self.active = false
  930.     refresh
  931.   end
  932.   #--------------------------------------------------------------------------
  933.   # ○ スキルの取得
  934.   #--------------------------------------------------------------------------
  935.   def skill
  936.     return @data[self.index]
  937.   end
  938.   #--------------------------------------------------------------------------
  939.   # ● リフレッシュ
  940.   #--------------------------------------------------------------------------
  941.   def refresh
  942.     @data = []
  943.     skill_ids = @actor.battle_skill_ids
  944.     @actor.battle_skill_max.times { |i|
  945.       if skill_ids[i] != nil
  946.         @data << $data_skills[skill_ids[i]]
  947.       else
  948.         @data << nil
  949.       end
  950.     }
  951.     @item_max = @data.size
  952.     create_contents
  953.     @item_max.times { |i| draw_item(i) }
  954.   end
  955.   #--------------------------------------------------------------------------
  956.   # ● 桁数の取得
  957.   #--------------------------------------------------------------------------
  958.   def col_max
  959.     return 1
  960.   end
  961.   #--------------------------------------------------------------------------
  962.   # ● 項目数の取得
  963.   #--------------------------------------------------------------------------
  964.   def item_max
  965.     @data ? @data.size : 1
  966.   end
  967.   #--------------------------------------------------------------------------
  968.   # ● 前回の選択位置を復帰
  969.   #--------------------------------------------------------------------------
  970.   def select_last
  971.     select(@data.index(@actor.last_skill.object) || 0)
  972.   end
  973.   #--------------------------------------------------------------------------
  974.   # ● アクターの設定
  975.   #--------------------------------------------------------------------------
  976.   def actor=(actor)
  977.     return if @actor == actor
  978.     @actor = actor
  979.     refresh
  980.   end
  981.   #--------------------------------------------------------------------------
  982.   # ● 決定やキャンセルなどのハンドリング処理
  983.   #--------------------------------------------------------------------------
  984.   alias process_handling_KGC_SkillCPSystem process_handling
  985.   def process_handling
  986.     process_handling_KGC_SkillCPSystem
  987.     return unless open? && active
  988.     return call_handler(:remove_slot) if handle?(:remove_slot) && Input.trigger?(:A)
  989.   end
  990.   #--------------------------------------------------------------------------
  991.   # ● 決定処理の有効状態を取得
  992.   #--------------------------------------------------------------------------
  993.   def ok_enabled?
  994.     handle?(:ok)
  995.   end
  996.   #--------------------------------------------------------------------------
  997.   # ● キャンセル処理の有効状態を取得
  998.   #--------------------------------------------------------------------------
  999.   def cancel_enabled?
  1000.     handle?(:cancel)
  1001.   end
  1002.   #--------------------------------------------------------------------------
  1003.   # ○ 消費 CP 描画判定
  1004.   #--------------------------------------------------------------------------
  1005.   def cp_cost_show?(skill)
  1006.     return true if KGC::SkillCPSystem::SHOW_ZERO_COST
  1007.  
  1008.     return (skill.cp_cost > 0)
  1009.   end
  1010.   #--------------------------------------------------------------------------
  1011.   # ○ 項目の描画
  1012.   #     index : 項目番号
  1013.   #--------------------------------------------------------------------------
  1014.   def draw_item(index)
  1015.     rect = item_rect(index)
  1016.     self.contents.clear_rect(rect)
  1017.     skill = @data[index]
  1018.     if skill != nil
  1019.       rect.width -= 4
  1020.       draw_item_name(skill, rect.x, rect.y)
  1021.       self.contents.draw_text(rect, skill.cp_cost, 2) if cp_cost_show?(skill)
  1022.     else
  1023.       self.contents.draw_text(rect, KGC::SkillCPSystem::BLANK_TEXT, 1)
  1024.     end
  1025.   end
  1026.   #--------------------------------------------------------------------------
  1027.   # ● ヘルプテキスト更新
  1028.   #--------------------------------------------------------------------------
  1029.   def update_help
  1030.     @help_window.set_item(skill)
  1031.     #@help_window.set_text(skill == nil ? "" : skill.description)
  1032.   end
  1033. end
  1034.  
  1035. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1036.  
  1037. #==============================================================================
  1038. # □ Window_BattleSkillList
  1039. #------------------------------------------------------------------------------
  1040. #   戦闘スキル選択画面で、設定できるスキルの一覧を表示するウィンドウです。
  1041. #==============================================================================
  1042.  
  1043. class Window_BattleSkillList < Window_Selectable
  1044.   #--------------------------------------------------------------------------
  1045.   # ● 公開インスタンス変数
  1046.   #--------------------------------------------------------------------------
  1047.   attr_accessor :slot_index               # スロット番号
  1048.   #--------------------------------------------------------------------------
  1049.   # ● オブジェクト初期化
  1050.   #     x      : ウィンドウの X 座標
  1051.   #     y      : ウィンドウの Y 座標
  1052.   #     width  : ウィンドウの幅
  1053.   #     height : ウィンドウの高さ
  1054.   #     actor  : アクター
  1055.   #--------------------------------------------------------------------------
  1056.   def initialize(x, y, width, height, actor)
  1057.     super(x, y, width, height)
  1058.     @actor = actor
  1059.     @slot_index = 0
  1060.     self.index = 0
  1061.     self.active = false
  1062.     refresh
  1063.   end
  1064.   #--------------------------------------------------------------------------
  1065.   # ○ スキルの取得
  1066.   #--------------------------------------------------------------------------
  1067.   def skill
  1068.     return @data[self.index]
  1069.   end
  1070.   #--------------------------------------------------------------------------
  1071.   # ● アクターの設定
  1072.   #--------------------------------------------------------------------------
  1073.   def actor=(actor)
  1074.     return if @actor == actor
  1075.     @actor = actor
  1076.     refresh
  1077.   end
  1078.   #--------------------------------------------------------------------------
  1079.   # ● 前回の選択位置を復帰
  1080.   #--------------------------------------------------------------------------
  1081.   def select_last
  1082.     select(@data.index(@actor.last_skill.object) || 0)
  1083.   end
  1084.   #--------------------------------------------------------------------------
  1085.   # ● 桁数の取得
  1086.   #--------------------------------------------------------------------------
  1087.   def col_max
  1088.     return 1
  1089.   end
  1090.   #--------------------------------------------------------------------------
  1091.   # ● 項目数の取得
  1092.   #--------------------------------------------------------------------------
  1093.   def item_max
  1094.     @data ? @data.size : 1
  1095.   end
  1096.   #--------------------------------------------------------------------------
  1097.   # ● リフレッシュ
  1098.   #--------------------------------------------------------------------------
  1099.   def refresh
  1100.     @data = []
  1101.     # 選択可能なスキルのみを取得
  1102.     @actor.all_skills.each { |skill|
  1103.       @data.push(skill) if selectable?(skill)
  1104.     }
  1105.     @item_max = @data.size
  1106.     create_contents
  1107.     @item_max.times { |i| draw_item(i) }
  1108.   end
  1109.   #--------------------------------------------------------------------------
  1110.   # ○ スキル選択可否判定
  1111.   #     skill : スキル
  1112.   #--------------------------------------------------------------------------
  1113.   def selectable?(skill)
  1114.     return false if skill == nil
  1115.  
  1116.     # 消費 CP 0 なら常に使用可能な場合
  1117.     if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0
  1118.       return false
  1119.     end
  1120.     # 戦闘時に使用可能ならOK
  1121.     return true if skill.battle_ok?
  1122.     # 使用不可でもセット可能な場合
  1123.     if KGC::SkillCPSystem::SHOW_UNUSABLE_SKILL && skill.occasion == 3
  1124.       return true
  1125.     end
  1126.  
  1127.     return false
  1128.   end
  1129.   #--------------------------------------------------------------------------
  1130.   # ○ 消費 CP 描画判定
  1131.   #--------------------------------------------------------------------------
  1132.   def cp_cost_show?(skill)
  1133.     return true if KGC::SkillCPSystem::SHOW_ZERO_COST
  1134.  
  1135.     return (skill.cp_cost > 0)
  1136.   end
  1137.   #--------------------------------------------------------------------------
  1138.   # ○ 項目の描画
  1139.   #     index : 項目番号
  1140.   #--------------------------------------------------------------------------
  1141.   def draw_item(index)
  1142.     rect = item_rect(index)
  1143.     self.contents.clear_rect(rect)
  1144.     skill = @data[index]
  1145.     if skill != nil
  1146.       rect.width -= 4
  1147.       enabled = @actor.battle_skill_settable?(@slot_index, skill)
  1148.       draw_item_name(skill, rect.x, rect.y, enabled)
  1149.       self.contents.draw_text(rect, skill.cp_cost, 2) if cp_cost_show?(skill)
  1150.     else
  1151.       self.contents.draw_text(rect, KGC::SkillCPSystem::RELEASE_TEXT, 1)
  1152.     end
  1153.   end
  1154.  
  1155.   #--------------------------------------------------------------------------
  1156.   # ● ヘルプテキスト更新
  1157.   #--------------------------------------------------------------------------
  1158.   def update_help
  1159.     @help_window.set_item(skill)
  1160.     #@help_window.set_text(skill == nil ? "" : skill.description)
  1161.   end
  1162. end
  1163.  
  1164. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1165.  
  1166. #==============================================================================
  1167. # ■ Scene_Menu
  1168. #==============================================================================
  1169.  
  1170. class Scene_Menu < Scene_MenuBase
  1171.  
  1172.   #--------------------------------------------------------------------------
  1173.   # ● コマンドウィンドウの作成
  1174.   #--------------------------------------------------------------------------
  1175.   alias create_command_window_KGC_SkillCPSystem create_command_window
  1176.   def create_command_window
  1177.     create_command_window_KGC_SkillCPSystem
  1178.     if KGC::SkillCPSystem::USE_MENU_SET_SKILL_COMMAND  
  1179.       @command_window.set_handler(:battle_skill,    method(:command_personal))
  1180.     end
  1181.   end
  1182.   #--------------------------------------------------------------------------
  1183.   # ● 個人コマンド[決定]
  1184.   #--------------------------------------------------------------------------
  1185.   alias on_personal_ok_KGC_SkillCPSystem on_personal_ok
  1186.   def on_personal_ok
  1187.     on_personal_ok_KGC_SkillCPSystem
  1188.     case @command_window.current_symbol
  1189.     when :battle_skill
  1190.       SceneManager.call(Scene_SetBattleSkill)
  1191.     end
  1192.   end
  1193.   #--------------------------------------------------------------------------
  1194.   # ● コマンド[スキル設定]
  1195.   #--------------------------------------------------------------------------
  1196.   def command_set_battle_skill
  1197.     SceneManager.call(Scene_SetBattleSkill)
  1198.   end
  1199. end
  1200.  
  1201. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1202.  
  1203. #==============================================================================
  1204. # □ Scene_SetBattleSkill
  1205. #------------------------------------------------------------------------------
  1206. #   戦闘スキル設定画面の処理を行うクラスです。
  1207. #==============================================================================
  1208.  
  1209. class Scene_SetBattleSkill < Scene_MenuBase
  1210.   #--------------------------------------------------------------------------
  1211.   # ○ 定数
  1212.   #--------------------------------------------------------------------------
  1213.   HOST_MENU   = 0  # 呼び出し元 : メニュー
  1214.   HOST_MAP    = 1  # 呼び出し元 : マップ
  1215.   #--------------------------------------------------------------------------
  1216.   # ● 開始処理
  1217.   #--------------------------------------------------------------------------
  1218.   def start
  1219.     super
  1220.     create_background
  1221.     create_help_window
  1222.     create_status_window
  1223.     create_slot_window
  1224.     create_list_window
  1225.   end
  1226.   #--------------------------------------------------------------------------
  1227.   # ● ヘルプウィンドウの作成
  1228.   #--------------------------------------------------------------------------
  1229.   def create_help_window
  1230.     @help_window = Window_Help.new
  1231.     @help_window.viewport = @viewport
  1232.   end
  1233.   #--------------------------------------------------------------------------
  1234.   # ● ステータスウィンドウの作成
  1235.   #--------------------------------------------------------------------------
  1236.   def create_status_window
  1237.     dy = @help_window.height
  1238.     @status_window = Window_BattleSkillStatus.new(0, dy, @actor)
  1239.   end
  1240.   #--------------------------------------------------------------------------
  1241.   # ● スロットウィンドウの作成
  1242.   #--------------------------------------------------------------------------
  1243.   def create_slot_window
  1244.     dy = @help_window.height + @status_window.height
  1245.     @slot_window = Window_BattleSkillSlot.new(
  1246.       0,
  1247.       dy,
  1248.       Graphics.width / 2,
  1249.       Graphics.height - dy,
  1250.       @actor)
  1251.     @slot_window.activate
  1252.     @slot_window.help_window = @help_window
  1253.     @slot_window.set_handler(:ok,    method(:on_slot_skill))
  1254.     @slot_window.set_handler(:remove_slot,    method(:remove_skill))
  1255.     @slot_window.set_handler(:cancel,   method(:return_scene))
  1256.     @slot_window.set_handler(:pagedown, method(:next_actor))
  1257.     @slot_window.set_handler(:pageup,   method(:prev_actor))
  1258.     @slot_window.select_last
  1259.   end
  1260.   #--------------------------------------------------------------------------
  1261.   # ● アクターの切り替え
  1262.   #--------------------------------------------------------------------------
  1263.   def on_actor_change
  1264.     @status_window.actor = @actor
  1265.     @slot_window.actor = @actor
  1266.     @list_window.actor = @actor
  1267.     @slot_window.activate
  1268.     refresh_window
  1269.   end
  1270.   #--------------------------------------------------------------------------
  1271.   # ● スキルの選択
  1272.   #--------------------------------------------------------------------------
  1273.   def on_slot_skill
  1274.     Sound.play_ok
  1275.     # リストウィンドウに切り替え
  1276.     @slot_window.deactivate
  1277.     @list_window.activate
  1278.   end
  1279.   #--------------------------------------------------------------------------
  1280.   # ● スキルを外す
  1281.   #--------------------------------------------------------------------------
  1282.   def remove_skill
  1283.     # 選択しているスキルを外す
  1284.     Sound.play_ok
  1285.     @actor.remove_battle_skill(@slot_window.index)
  1286.     refresh_window
  1287.   end
  1288.   #--------------------------------------------------------------------------
  1289.   # ● リストウィンドウの作成
  1290.   #--------------------------------------------------------------------------
  1291.   def create_list_window
  1292.     dy = @help_window.height + @status_window.height
  1293.     @list_window = Window_BattleSkillList.new(
  1294.       Graphics.width - @slot_window.width,
  1295.       dy,
  1296.       Graphics.width - @slot_window.width,
  1297.       Graphics.height - dy,
  1298.       @actor)
  1299.     @list_window.help_window = @help_window
  1300.     @list_window.set_handler(:ok,    method(:on_set_list_skill))
  1301.     @list_window.set_handler(:cancel,   method(:cancel_list_window))
  1302.     @list_window.select_last
  1303.   end
  1304.   #--------------------------------------------------------------------------
  1305.   # ● スキルリストからの選択
  1306.   #--------------------------------------------------------------------------
  1307.   def on_set_list_skill
  1308.     skill = @list_window.skill
  1309.     # セットできない場合
  1310.     unless @actor.battle_skill_settable?(@slot_window.index, skill)
  1311.       Sound.play_buzzer
  1312.       @slot_window.activate
  1313.       @list_window.deactivate
  1314.       return
  1315.     end
  1316.     Sound.play_ok
  1317.     set_skill(@slot_window.index, skill)
  1318.     # スロットウィンドウに切り替え
  1319.     @slot_window.activate
  1320.     @list_window.deactivate
  1321.   end
  1322.   #--------------------------------------------------------------------------
  1323.   # ● スキルリストから戻る
  1324.   #--------------------------------------------------------------------------
  1325.   def cancel_list_window
  1326.     Sound.play_cancel
  1327.     # スロットウィンドウに切り替え
  1328.     @slot_window.activate
  1329.     @list_window.deactivate
  1330.   end
  1331.  
  1332.   #--------------------------------------------------------------------------
  1333.   # ● 終了処理
  1334.   #--------------------------------------------------------------------------
  1335.   def terminate
  1336.     super
  1337.     dispose_background
  1338.     @help_window.dispose
  1339.     @status_window.dispose
  1340.     @slot_window.dispose
  1341.     @list_window.dispose
  1342.   end
  1343.   #--------------------------------------------------------------------------
  1344.   # ○ ウィンドウ再描画
  1345.   #--------------------------------------------------------------------------
  1346.   def refresh_window
  1347.     @status_window.refresh
  1348.     @slot_window.refresh
  1349.     @list_window.refresh
  1350.   end
  1351.  
  1352.   #--------------------------------------------------------------------------
  1353.   # ○ スキル設定
  1354.   #     index : 設定する場所
  1355.   #     skill : 設定するスキル
  1356.   #--------------------------------------------------------------------------
  1357.   def set_skill(index, skill)
  1358.     @actor.remove_battle_skill(index)
  1359.     if skill != nil
  1360.       @actor.set_battle_skill(index, skill)
  1361.     end
  1362.     refresh_window
  1363.   end
  1364.  
  1365. end

评分

参与人数 1梦石 +1 收起 理由
taroxd + 1 楼主@你

查看全部评分

回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
250
在线时间
233 小时
注册时间
2013-8-2
帖子
587
9
发表于 2014-8-14 17:33:21 | 只看该作者
但是玩家不能同时使用这些特性,只能选择一部分装备上
所以装备在这个空间里面的技能和通常的技能最好区分开来

这个可以设置两种技能类型貌似可以做到
咱曾经想过几个用事件达成这个目的的方法……但是灰常麻烦,因为那些技能都是“习得即增长能力”

你考虑过称号脚本吗?或者你说搞定了的那个脚本就是称号脚本。。
或者用第二货币加商店购买,打开商店的时候自动卖出所有特性技能转化为cost……但是商店不能直接卖技能只能卖道具,这样玩家调整装备都要重新使用买到的道具来学习……

↑↑我越来越听不懂lz说的什么了。。。。
图片已挂,,,你可以用“附件”来上传图片,,,,,,,
我忘了,我要怎么遗忘。
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
836
在线时间
159 小时
注册时间
2012-6-3
帖子
124
10
 楼主| 发表于 2014-8-14 18:54:55 | 只看该作者
tseyik 发表于 2014-8-14 17:30
Ace改版
http://mitsu-evo.6.ql.bz/RGSS3_16.html

不好意思,能不能把使用说明也发上来,就是备注栏写什么东西的那段话……

点评

設定在行30至行90左右  发表于 2014-8-14 19:50
备注栏不用写东西,全写在脚本上。见脚本注释(如果你看得懂的话)  发表于 2014-8-14 19:00
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-25 23:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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