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

Project1

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

[已经解决] 技能CP制装备附加CP问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
29 小时
注册时间
2013-8-23
帖子
69
跳转到指定楼层
1
发表于 2015-10-28 22:59:58 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
在装备备注里写某个语句可以增加CP上限,然而忘了是什么。。。

请帮忙看一下

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

Lv2.观梦者

梦石
0
星屑
898
在线时间
421 小时
注册时间
2015-7-5
帖子
131
2
发表于 2015-10-30 09:33:03 | 只看该作者
<最大CP XX> or <MAXCP XX>

点评

多谢了!  发表于 2015-10-31 19:06

评分

参与人数 1星屑 +100 收起 理由
丿梁丶小柒 + 100 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-27 22:13

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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