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

Project1

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

[已经解决] 技能CP制(设技)脚本出现问题,是不是要搭配其他脚本?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
191
在线时间
835 小时
注册时间
2012-9-16
帖子
1811
跳转到指定楼层
1
 楼主| 发表于 2013-1-22 18:00:52 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
【抱歉我又来问问题了~{:2_258:} 】这次的问题是脚本问题,出现冲突!!!

上错误画面



上脚本
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆ 技能CP制 - KGC_SkillCPSystem ◆ VX ◆
  3. #_/    ◇ Last update : 2009/01/18 ◇
  4. #_/----------------------------------------------------------------------------
  5. #_/  戦闘中に使用可能なスキルを限定する機能を追加します。
  6. #_/============================================================================
  7. #_/ 【装備】≪スキル習得装備≫ より下に導入してください。
  8. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

  9. #==============================================================================
  10. # ★ カスタマイズ項目 - Customize ★
  11. #==============================================================================

  12. module KGC
  13. module SkillCPSystem
  14.   # ◆ 登録スキル最大数
  15.   MAX_SKILLS = 20
  16.   # ◆ CP の名称
  17.   VOCAB_CP   = "SP"
  18.   # ◆ CP の名称 (略)
  19.   VOCAB_CP_A = "SP"
  20.   # ◆ ステータス画面に CP を表示する
  21.   SHOW_STATUS_CP = false

  22.   # ◆ 消費 CP 既定値
  23.   #  消費 CP 未指定のスキルで使用。
  24.   DEFAULT_CP_COST = 1
  25.   # ◆ CP 上限
  26.   #  (固有 CP などを除いた) 素の状態での CP 上限。
  27.   CP_MAX = 100
  28.   # ◆ CP 下限
  29.   CP_MIN = 1
  30.   # ◆ 補正後の CP 上限
  31.   #  固有 CP や装備品による変動を含めた上限。
  32.   REVISED_CP_MAX = 200
  33.   # ◆ 補正後の CP 下限
  34.   REVISED_CP_MIN = 0
  35.   # ◆ 最大 CP 算出式
  36.   #   level..現在のレベル
  37.   #  自動的に整数変換するので、結果が小数になってもOK。
  38.   CP_CALC_EXP = "level * 1 + 2"
  39.   # ◆ アクター毎の最大 CP 算出式
  40.   PERSONAL_CP_CALC_EXP = []
  41.   #  ここから下に、アクターごとの最大 CP を
  42.   #   PERSONAL_CP_CALC_EXP[アクター ID] = "計算式"
  43.   #  という書式で指定。
  44.   #  計算式は CP_CALC_EXP と同様の書式。
  45.   #  指定しなかったアクターは CP_CALC_EXP を使用。
  46.   #   <例> ラルフだけ優遇
  47.   # PERSONAL_CP_CALC_EXP[1] = "level * 0.8 + 2.0"

  48.   # ◆ 戦闘テスト時は無効化
  49.   #  true  : 戦闘テスト時は全スキルを使用可能。
  50.   #  false : 戦闘テスト時は (セットしない限り) 使用不可。
  51.   DISABLE_IN_BATTLETEST  = true
  52.   # ◆ 使用不可スキルもセット可能
  53.   SHOW_UNUSABLE_SKILL    = true
  54.   # ◆ 消費 CP 0 のスキルはセットしなくても使用可能
  55.   USABLE_COST_ZERO_SKILL = true
  56.   # ◆ パッシブスキルはセットしないと効果なし
  57.   #  ≪パッシブスキル≫ 導入時のみ有効。
  58.   PASSIVE_NEED_TO_SET    = true
  59.   # ◆ 新学会的技能自动装备。
  60.   #  true  : 習得したスキルを空きスロットにセット。
  61.   #           ※ ≪スキル習得装備≫ で習得したスキルは無効。
  62.   #  false : 習得しただけではセットされない (手动装备)。
  63.   AUTO_SET_NEW_SKILL     = false

  64.   # ◆ CP ゲージの開始色
  65.   #  数値  : \C[n] と同じ色。
  66.   #  Color : 指定した色。 ( Color.new(255, 128, 128) など )
  67.   GAUGE_START_COLOR = 13
  68.   # ◆ CP ゲージの終了色
  69.   GAUGE_END_COLOR   = 5

  70.   # ◆ メニュー画面に「スキル設定」コマンドを追加する
  71.   #  追加する場所は、メニューコマンドの最下部です。
  72.   #  他の部分に追加したければ、≪カスタムメニューコマンド≫ をご利用ください。
  73.   USE_MENU_SET_SKILL_COMMAND = true
  74.   # ◆ メニュー画面の「スキル設定」コマンドの名称
  75.   VOCAB_MENU_SET_SKILL       = "设技"

  76.   # ◆ 未設定項目の表示文字列
  77.   BLANK_TEXT   = "-未设置-"
  78.   # ◆ 設定解除の表示文字列
  79.   RELEASE_TEXT = "-(回收技能)-"
  80. end
  81. end

  82. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  83. $imported = {} if $imported == nil
  84. $imported["SkillCPSystem"] = true

  85. module KGC::SkillCPSystem
  86.   module Regexp
  87.     module BaseItem
  88.       # 最大 CP
  89.       MAXCP_PLUS = /<(?:MAX|最大)CP\s*([\-\+]?\d+)>/
  90.       # 登録スキル数
  91.       BATTLE_SKILL_MAX = /<(?:BATTLE_SKILL_MAX|登録スキル数)\s*([\-\+]?\d+)>/i
  92.     end

  93.     module Skill
  94.       # 消費 CP
  95.       CP_COST = /<CP\s*(\d+)>/i
  96.     end
  97.   end
  98. end

  99. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  100. #==============================================================================
  101. # □ KGC::Commands
  102. #==============================================================================

  103. module KGC
  104. module Commands
  105.   module_function
  106.   #--------------------------------------------------------------------------
  107.   # ○ MaxCP 補正値の取得
  108.   #     actor_id    : アクター ID
  109.   #     variable_id : 取得した値を代入する変数の ID
  110.   #--------------------------------------------------------------------------
  111.   def get_actor_own_cp(actor_id, variable_id = 0)
  112.     value = $game_actors[actor_id].maxcp_plus
  113.     $game_variables[variable_id] = value if variable_id > 0
  114.     return value
  115.   end
  116.   alias get_own_cp get_actor_own_cp
  117.   #--------------------------------------------------------------------------
  118.   # ○ MaxCP 補正値の変更
  119.   #     actor_id : アクター ID
  120.   #     value    : MaxCP 補正値
  121.   #--------------------------------------------------------------------------
  122.   def set_actor_own_cp(actor_id, value)
  123.     $game_actors[actor_id].maxcp_plus = value
  124.   end
  125.   alias set_own_cp set_actor_own_cp
  126.   #--------------------------------------------------------------------------
  127.   # ○ アクターの MaxCP 補正値の増加
  128.   #     actor_id : アクター ID
  129.   #     value    : 増加量
  130.   #--------------------------------------------------------------------------
  131.   def gain_actor_cp(actor_id, value)
  132.     $game_actors[actor_id].maxcp_plus += value
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # ○ 登録スキル最大数の取得
  136.   #     actor_id : アクター ID
  137.   #     variable_id : 取得した値を代入する変数の ID
  138.   #--------------------------------------------------------------------------
  139.   def get_battle_skill_max(actor_id, variable_id = 0)
  140.     value = $game_actors[actor_id].battle_skill_max
  141.     $game_variables[variable_id] = value if variable_id > 0
  142.     return value
  143.   end
  144.   #--------------------------------------------------------------------------
  145.   # ○ 登録スキル最大数の変更
  146.   #     actor_id : アクター ID
  147.   #     value    : 登録可能数
  148.   #--------------------------------------------------------------------------
  149.   def set_battle_skill_max(actor_id, value = -1)
  150.     $game_actors[actor_id].battle_skill_max = value
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ○ スキルが登録されているか
  154.   #     actor_id : アクター ID
  155.   #     skill_id : 確認するスキル ID
  156.   #--------------------------------------------------------------------------
  157.   def battle_skill_set?(actor_id, skill_id)
  158.     return $game_actors[actor_id].battle_skill_ids.include?(skill_id)
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ○ スキルの登録
  162.   #     actor_id : アクター ID
  163.   #     index    : 登録箇所
  164.   #     skill_id : 登録するスキル ID (nil で解除)
  165.   #--------------------------------------------------------------------------
  166.   def set_battle_skill(actor_id, index, skill_id = nil)
  167.     actor = $game_actors[actor_id]
  168.     if skill_id.is_a?(Integer)
  169.       # 登録
  170.       skill = $data_skills[skill_id]
  171.       return unless actor.battle_skill_settable?(index, skill)  # セット不可

  172.       actor.set_battle_skill(index, skill)
  173.       actor.restore_battle_skill
  174.     else
  175.       # 解除
  176.       actor.remove_battle_skill(index)
  177.     end
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ○ スキルの追加登録
  181.   #     actor_id : アクター ID
  182.   #     skill_id : 登録するスキル ID
  183.   #--------------------------------------------------------------------------
  184.   def add_battle_skill(actor_id, skill_id)
  185.     actor = $game_actors[actor_id]
  186.     skill = $data_skills[skill_id]
  187.     return if actor == nil || skill == nil

  188.     actor.add_battle_skill(skill)
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # ○ スキルの全解除
  192.   #     actor_id : アクター ID
  193.   #--------------------------------------------------------------------------
  194.   def clear_battle_skill(actor_id)
  195.     $game_actors[actor_id].clear_battle_skill
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ○ スキル設定画面の呼び出し
  199.   #     actor_index : アクターインデックス
  200.   #--------------------------------------------------------------------------
  201.   def call_set_battle_skill(actor_index = 0)
  202.     return if $game_temp.in_battle
  203.     $game_temp.next_scene = :set_battle_skill
  204.     $game_temp.next_scene_actor_index = actor_index
  205.   end
  206. end
  207. end

  208. class Game_Interpreter
  209.   include KGC::Commands
  210. end

  211. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  212. #==============================================================================
  213. # ■ Vocab
  214. #==============================================================================

  215. module Vocab
  216.   # CP
  217.   def self.cp
  218.     return KGC::SkillCPSystem::VOCAB_CP
  219.   end

  220.   # CP (略)
  221.   def self.cp_a
  222.     return KGC::SkillCPSystem::VOCAB_CP_A
  223.   end

  224.   # スキル設定
  225.   def self.set_battle_skill
  226.     return KGC::SkillCPSystem::VOCAB_MENU_SET_SKILL
  227.   end
  228. end

  229. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  230. #==============================================================================
  231. # ■ RPG::BaseItem
  232. #==============================================================================

  233. class RPG::BaseItem
  234.   #--------------------------------------------------------------------------
  235.   # ○ スキルCP制のキャッシュを生成
  236.   #--------------------------------------------------------------------------
  237.   def create_skill_cp_system_cache
  238.     @__maxcp_plus = 0
  239.     @__battle_skill_max_plus = 0

  240.     self.note.each_line { |line|
  241.       case line
  242.       when KGC::SkillCPSystem::Regexp::BaseItem::MAXCP_PLUS
  243.         # 最大 CP
  244.         @__maxcp_plus += $1.to_i
  245.       when KGC::SkillCPSystem::Regexp::BaseItem::BATTLE_SKILL_MAX
  246.         # 登録スキル数
  247.         @__battle_skill_max_plus += $1.to_i
  248.       end
  249.     }
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # ○ 最大 CP 補正
  253.   #--------------------------------------------------------------------------
  254.   def maxcp_plus
  255.     create_skill_cp_system_cache if @__maxcp_plus == nil
  256.     return @__maxcp_plus
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # ○ 登録スキル数補正
  260.   #--------------------------------------------------------------------------
  261.   def battle_skill_max_plus
  262.     create_skill_cp_system_cache if @__battle_skill_max_plus == nil
  263.     return @__battle_skill_max_plus
  264.   end
  265. end

  266. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  267. #==============================================================================
  268. # ■ RPG::Skill
  269. #==============================================================================

  270. class RPG::Skill < RPG::UsableItem
  271.   #--------------------------------------------------------------------------
  272.   # ○ スキルCP制のキャッシュを生成
  273.   #--------------------------------------------------------------------------
  274.   def create_skill_cp_system_cache
  275.     @__cp_cost = KGC::SkillCPSystem::DEFAULT_CP_COST

  276.     self.note.each_line { |line|
  277.       case line
  278.       when KGC::SkillCPSystem::Regexp::Skill::CP_COST
  279.         # 消費 CP
  280.         @__cp_cost = $1.to_i
  281.       end
  282.     }
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # ○ 消費 CP
  286.   #--------------------------------------------------------------------------
  287.   def cp_cost
  288.     create_skill_cp_system_cache if @__cp_cost == nil
  289.     return @__cp_cost
  290.   end
  291. end

  292. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  293. #==============================================================================
  294. # ■ Game_Battler
  295. #==============================================================================

  296. class Game_Battler
  297.   #--------------------------------------------------------------------------
  298.   # ○ 戦闘用スキルセット済み判定
  299.   #     skill : スキル
  300.   #--------------------------------------------------------------------------
  301.   def battle_skill_set?(skill)
  302.     return true
  303.   end
  304. end

  305. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  306. #==============================================================================
  307. # ■ Game_Actor
  308. #==============================================================================

  309. class Game_Actor < Game_Battler
  310.   #--------------------------------------------------------------------------
  311.   # ● 公開インスタンス変数
  312.   #--------------------------------------------------------------------------
  313.   attr_writer   :maxcp_plus               # MaxCP 補正値
  314.   #--------------------------------------------------------------------------
  315.   # ○ MaxCP 取得
  316.   #--------------------------------------------------------------------------
  317.   def maxcp
  318.     calc_exp = KGC::SkillCPSystem::PERSONAL_CP_CALC_EXP[self.id]
  319.     if calc_exp == nil
  320.       calc_exp = KGC::SkillCPSystem::CP_CALC_EXP
  321.     end
  322.     n = Integer(eval(calc_exp))
  323.     n = [[n, cp_limit].min, KGC::SkillCPSystem::CP_MIN].max
  324.     n += maxcp_plus + maxcp_plus_equip
  325.     return [[n, revised_cp_limit].min, KGC::SkillCPSystem::REVISED_CP_MIN].max
  326.   end
  327.   #--------------------------------------------------------------------------
  328.   # ○ CP 取得
  329.   #--------------------------------------------------------------------------
  330.   def cp
  331.     return [maxcp - consumed_cp, 0].max
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # ○ CP 消費量取得
  335.   #--------------------------------------------------------------------------
  336.   def consumed_cp
  337.     n = 0
  338.     battle_skills.compact.each { |skill| n += skill.cp_cost }
  339.     return n
  340.   end
  341.   #--------------------------------------------------------------------------
  342.   # ○ CP 上限取得
  343.   #--------------------------------------------------------------------------
  344.   def cp_limit
  345.     return KGC::SkillCPSystem::CP_MAX
  346.   end
  347.   #--------------------------------------------------------------------------
  348.   # ○ 補正後の CP 上限取得
  349.   #--------------------------------------------------------------------------
  350.   def revised_cp_limit
  351.     return KGC::SkillCPSystem::REVISED_CP_MAX
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ○ MaxCP 補正値取得
  355.   #--------------------------------------------------------------------------
  356.   def maxcp_plus
  357.     if @maxcp_plus == nil
  358.       if @own_cp != nil
  359.         @maxcp_plus = @own_cp
  360.         @own_cp = nil
  361.       else
  362.         @maxcp_plus = 0
  363.       end
  364.     end
  365.     return @maxcp_plus
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # ○ 装備品による MaxCP 補正値取得
  369.   #--------------------------------------------------------------------------
  370.   def maxcp_plus_equip
  371.     n = 0
  372.     equips.compact.each { |item| n += item.maxcp_plus }
  373.     return n
  374.   end
  375.   #--------------------------------------------------------------------------
  376.   # ● スキル取得
  377.   #--------------------------------------------------------------------------
  378.   alias skills_KGC_SkillCPSystem skills
  379.   def skills
  380.     return (skill_cp_restrict? ? restricted_skills : skills_KGC_SkillCPSystem)
  381.   end
  382.   #--------------------------------------------------------------------------
  383.   # ○ スキルを制限するか
  384.   #--------------------------------------------------------------------------
  385.   def skill_cp_restrict?
  386.     if $game_temp.in_battle
  387.       # 戦闘テストでないか、戦闘テストでも制限する場合
  388.       return true unless $BTEST && KGC::SkillCPSystem::DISABLE_IN_BATTLETEST
  389.     end

  390.     return false
  391.   end
  392.   #--------------------------------------------------------------------------
  393.   # ○ スキルを制限
  394.   #--------------------------------------------------------------------------
  395.   def restricted_skills
  396.     result = all_skills
  397.     result.each_with_index { |skill, i|
  398.       # 消費 CP > 0 のスキルを除外
  399.       if !KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL || skill.cp_cost > 0
  400.         result[i] = nil
  401.       end
  402.       # パッシブスキルを除外
  403.       if $imported["PassiveSkill"] && KGC::SkillCPSystem::PASSIVE_NEED_TO_SET
  404.         if skill.passive &&
  405.             (!KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL || skill.cp_cost > 0)
  406.           result[i] = nil
  407.         end
  408.       end
  409.     }
  410.     result.compact!
  411.     # 戦闘スキルを追加
  412.     result |= battle_skills
  413.     result.sort! { |a, b| a.id <=> b.id }
  414.     return result
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # ○ 全スキル取得
  418.   #--------------------------------------------------------------------------
  419.   def all_skills
  420.     # 一時的に非戦闘中にする
  421.     last_in_battle = $game_temp.in_battle
  422.     $game_temp.in_battle = false

  423.     result = skills_KGC_SkillCPSystem
  424.     if $imported["EquipLearnSkill"]
  425.       result |= (equipment_skills | full_ap_skills)
  426.       result.sort! { |a, b| a.id <=> b.id }
  427.     end

  428.     # 戦闘中フラグを戻す
  429.     $game_temp.in_battle = last_in_battle

  430.     return result
  431.   end
  432.   #--------------------------------------------------------------------------
  433.   # ○ 登録スキル最大数取得
  434.   #--------------------------------------------------------------------------
  435.   def battle_skill_max
  436.     @battle_skill_max = -1 if @battle_skill_max == nil
  437.     n = (@battle_skill_max < 0 ?
  438.       KGC::SkillCPSystem::MAX_SKILLS : @battle_skill_max)
  439.     n += equipment_battle_skill_max_plus
  440.     return [n, 0].max
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # ○ 装備品による登録スキル数補正
  444.   #--------------------------------------------------------------------------
  445.   def equipment_battle_skill_max_plus
  446.     n = 0
  447.     equips.compact.each { |item| n += item.battle_skill_max_plus }
  448.     return n
  449.   end
  450.   #--------------------------------------------------------------------------
  451.   # ○ 登録スキル最大数設定
  452.   #--------------------------------------------------------------------------
  453.   def battle_skill_max=(value)
  454.     @battle_skill_max = value
  455.     if @battle_skills == nil
  456.       @battle_skills = []
  457.     else
  458.       @battle_skills = @battle_skills[0...value]
  459.     end
  460.     restore_passive_rev if $imported["PassiveSkill"]
  461.   end
  462.   #--------------------------------------------------------------------------
  463.   # ○ 戦闘用スキル ID 取得
  464.   #--------------------------------------------------------------------------
  465.   def battle_skill_ids
  466.     @battle_skills = [] if @battle_skills == nil
  467.     return @battle_skills
  468.   end
  469.   #--------------------------------------------------------------------------
  470.   # ○ 戦闘用スキル取得
  471.   #--------------------------------------------------------------------------
  472.   def battle_skills
  473.     result = []
  474.     battle_skill_ids.each { |i|
  475.       next if i == nil           # 無効なスキルは無視
  476.       result << $data_skills[i]
  477.     }
  478.     return result
  479.   end
  480.   #--------------------------------------------------------------------------
  481.   # ○ 戦闘用スキル登録
  482.   #     index : 位置
  483.   #     skill : スキル (nil で解除)
  484.   #--------------------------------------------------------------------------
  485.   def set_battle_skill(index, skill)
  486.     if skill == nil
  487.       @battle_skills[index] = nil
  488.     else
  489.       return unless skill.is_a?(RPG::Skill)  # スキル以外
  490.       return if cp < skill.cp_cost           # CP 不足
  491.       return if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0

  492.       @battle_skills[index] = skill.id
  493.     end
  494.     restore_passive_rev if $imported["PassiveSkill"]
  495.   end
  496.   #--------------------------------------------------------------------------
  497.   # ○ 戦闘用スキル追加登録
  498.   #     skill : スキル
  499.   #--------------------------------------------------------------------------
  500.   def add_battle_skill(skill)
  501.     return unless skill.is_a?(RPG::Skill)  # スキル以外
  502.     skills = battle_skill_ids
  503.     return if skills.include?(skill.id)    # 登録済み
  504.     return if cp < skill.cp_cost           # CP 不足
  505.     return if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0

  506.     battle_skill_max.times { |i|
  507.       # 空きがあれば登録
  508.       if skills[i] == nil
  509.         set_battle_skill(i, skill)
  510.         break
  511.       end
  512.     }
  513.     restore_battle_skill
  514.   end
  515.   #--------------------------------------------------------------------------
  516.   # ○ 戦闘用スキル解除
  517.   #     index : 位置
  518.   #--------------------------------------------------------------------------
  519.   def remove_battle_skill(index)
  520.     @battle_skills[index] = nil
  521.     restore_passive_rev if $imported["PassiveSkill"]
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ○ 戦闘用スキル全解除
  525.   #--------------------------------------------------------------------------
  526.   def clear_battle_skill
  527.     @battle_skills = []
  528.     restore_passive_rev if $imported["PassiveSkill"]
  529.   end
  530.   #--------------------------------------------------------------------------
  531.   # ○ 戦闘用スキルセット可否判定
  532.   #     index : 位置
  533.   #     skill : スキル
  534.   #--------------------------------------------------------------------------
  535.   def battle_skill_settable?(index, skill)
  536.     return false if battle_skill_max <= index  # 範囲外
  537.     return true  if skill == nil               # nil は解除なので OK

  538.     return false if battle_skill_ids.include?(skill.id)  # セット済み

  539.     skill_id = battle_skill_ids[index]
  540.     curr_skill = (skill_id != nil ? $data_skills[skill_id] : nil)
  541.     offset = (curr_skill != nil ? curr_skill.cp_cost : 0)
  542.     return false if self.cp < (skill.cp_cost - offset)  # CP 不足

  543.     return true
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # ○ 戦闘用スキルを修復
  547.   #--------------------------------------------------------------------------
  548.   def restore_battle_skill
  549.     result = battle_skill_ids.clone
  550.     usable_skills = all_skills

  551.     result.each_with_index { |n, i|
  552.       next if n == nil
  553.       # 未修得の場合は解除
  554.       if (usable_skills.find { |s| s.id == n }) == nil
  555.         result[i] = nil
  556.       end
  557.     }
  558.     @battle_skills = result[0...battle_skill_max]
  559.     # CP 不足のスキルを下から順に外す
  560.     (battle_skill_max - 1).downto(0) { |i|
  561.       @battle_skills[i] = nil if maxcp - consumed_cp < 0
  562.     }
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # ● 装備の変更 (オブジェクトで指定)
  566.   #     equip_type : 装備部位 (0..4)
  567.   #     item       : 武器 or 防具 (nil なら装備解除)
  568.   #     test       : テストフラグ (戦闘テスト、または装備画面での一時装備)
  569.   #--------------------------------------------------------------------------
  570.   alias change_equip_KGC_SkillCPSystem change_equip
  571.   def change_equip(equip_type, item, test = false)
  572.     change_equip_KGC_SkillCPSystem(equip_type, item, test)

  573.     unless test
  574.       restore_battle_skill
  575.       restore_passive_rev if $imported["PassiveSkill"]
  576.     end
  577.   end
  578.   #--------------------------------------------------------------------------
  579.   # ● 装備の破棄
  580.   #     item : 破棄する武器 or 防具
  581.   #    武器/防具の増減で「装備品も含める」のとき使用する。
  582.   #--------------------------------------------------------------------------
  583.   alias discard_equip_KGC_SkillCPSystem discard_equip
  584.   def discard_equip(item)
  585.     discard_equip_KGC_SkillCPSystem(item)

  586.     restore_battle_skill
  587.     restore_passive_rev if $imported["PassiveSkill"]
  588.   end
  589.   #--------------------------------------------------------------------------
  590.   # ● 経験値の変更
  591.   #     exp  : 新しい経験値
  592.   #     show : レベルアップ表示フラグ
  593.   #--------------------------------------------------------------------------
  594.   alias change_exp_KGC_SkillCPSystem change_exp
  595.   def change_exp(exp, show)
  596.     # 習得したスキルを表示するため、戦闘中フラグを一時的に解除
  597.     last_in_battle = $game_temp.in_battle
  598.     $game_temp.in_battle = false

  599.     change_exp_KGC_SkillCPSystem(exp, show)

  600.     $game_temp.in_battle = last_in_battle
  601.   end

  602.   if KGC::SkillCPSystem::AUTO_SET_NEW_SKILL
  603.   #--------------------------------------------------------------------------
  604.   # ● スキルを覚える
  605.   #     skill_id : スキル ID
  606.   #--------------------------------------------------------------------------
  607.   alias learn_skill_KGC_SkillCPSystem learn_skill
  608.   def learn_skill(skill_id)
  609.     learn_skill_KGC_SkillCPSystem(skill_id)

  610.     add_battle_skill($data_skills[skill_id])
  611.   end
  612.   end  # <- if KGC::SkillCPSystem::AUTO_SET_NEW_SKILL

  613.   #--------------------------------------------------------------------------
  614.   # ● スキルを忘れる
  615.   #     skill_id : スキル ID
  616.   #--------------------------------------------------------------------------
  617.   alias forget_skill_KGC_SkillCPSystem forget_skill
  618.   def forget_skill(skill_id)
  619.     # 忘れるスキルを戦闘用スキルから削除
  620.     battle_skill_ids.each_with_index { |s, i|
  621.       remove_battle_skill(i) if s == skill_id
  622.     }

  623.     forget_skill_KGC_SkillCPSystem(skill_id)
  624.   end
  625.   #--------------------------------------------------------------------------
  626.   # ○ 戦闘用スキルセット済み判定
  627.   #     skill : スキル
  628.   #--------------------------------------------------------------------------
  629.   def battle_skill_set?(skill)
  630.     return false unless skill.is_a?(RPG::Skill)  # スキル以外

  631.     return battle_skill_ids.include?(skill.id)
  632.   end
  633. end

  634. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  635. #==============================================================================
  636. # ■ Window_Base
  637. #==============================================================================

  638. class Window_Base < Window
  639.   #--------------------------------------------------------------------------
  640.   # ○ CP の文字色を取得
  641.   #     actor : アクター
  642.   #--------------------------------------------------------------------------
  643.   def cp_color(actor)
  644.     return knockout_color if actor.maxcp > 0 && actor.cp == 0
  645.     return normal_color
  646.   end
  647.   #--------------------------------------------------------------------------
  648.   # ○ CP ゲージの色 1 の取得
  649.   #--------------------------------------------------------------------------
  650.   def cp_gauge_color1
  651.     color = KGC::SkillCPSystem::GAUGE_START_COLOR
  652.     return (color.is_a?(Integer) ? text_color(color) : color)
  653.   end
  654.   #--------------------------------------------------------------------------
  655.   # ○ CP ゲージの色 2 の取得
  656.   #--------------------------------------------------------------------------
  657.   def cp_gauge_color2
  658.     color = KGC::SkillCPSystem::GAUGE_END_COLOR
  659.     return (color.is_a?(Integer) ? text_color(color) : color)
  660.   end
  661.   #--------------------------------------------------------------------------
  662.   # ○ CP の描画
  663.   #     actor : アクター
  664.   #     x     : 描画先 X 座標
  665.   #     y     : 描画先 Y 座標
  666.   #     width : 幅
  667.   #--------------------------------------------------------------------------
  668.   def draw_actor_cp(actor, x, y, width = 120)
  669.     draw_actor_cp_gauge(actor, x, y, width)
  670.     self.contents.font.color = system_color
  671.     self.contents.draw_text(x, y, 30, WLH, Vocab::cp_a)
  672.     self.contents.font.color = cp_color(actor)
  673.     xr = x + width
  674.     if width < 120
  675.       self.contents.draw_text(xr - 40, y, 40, WLH, actor.cp, 2)
  676.     else
  677.       self.contents.draw_text(xr - 90, y, 40, WLH, actor.cp, 2)
  678.       self.contents.font.color = normal_color
  679.       self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
  680.       self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxcp, 2)
  681.     end
  682.     self.contents.font.color = normal_color
  683.   end
  684.   #--------------------------------------------------------------------------
  685.   # ○ CP ゲージの描画
  686.   #     actor : アクター
  687.   #     x     : 描画先 X 座標
  688.   #     y     : 描画先 Y 座標
  689.   #     width : 幅
  690.   #--------------------------------------------------------------------------
  691.   def draw_actor_cp_gauge(actor, x, y, width = 120)
  692.     draw_gauge_base(x, y, width)
  693.     gw = width * actor.cp / [actor.maxcp, 1].max
  694.     gc1 = cp_gauge_color2
  695.     gc2 = cp_gauge_color1
  696.     self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
  697.     self.contents.gradient_fill_rect(x+1, y+WLH-8+1, gw-2, 6-2, gc1, gc2, true)
  698.   end
  699. #    gc1 = cp_gauge_color1
  700. #    gc2 = cp_gauge_color2
  701. #    self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
  702. #    self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  703. #  end
  704. end

  705. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  706. #==============================================================================
  707. # ■ Window_Command
  708. #==============================================================================

  709. class Window_Command < Window_Selectable
  710.   unless method_defined?(:add_command)
  711.   #--------------------------------------------------------------------------
  712.   # ○ コマンドを追加
  713.   #    追加した位置を返す
  714.   #--------------------------------------------------------------------------
  715.   def add_command(command)
  716.     @commands << command
  717.     @item_max = @commands.size
  718.     item_index = @item_max - 1
  719.     refresh_command
  720.     draw_item(item_index)
  721.     return item_index
  722.   end
  723.   #--------------------------------------------------------------------------
  724.   # ○ コマンドをリフレッシュ
  725.   #--------------------------------------------------------------------------
  726.   def refresh_command
  727.     buf = self.contents.clone
  728.     self.height = [self.height, row_max * WLH + 32].max
  729.     create_contents
  730.     self.contents.blt(0, 0, buf, buf.rect)
  731.     buf.dispose
  732.   end
  733.   #--------------------------------------------------------------------------
  734.   # ○ コマンドを挿入
  735.   #--------------------------------------------------------------------------
  736.   def insert_command(index, command)
  737.     @commands.insert(index, command)
  738.     @item_max = @commands.size
  739.     refresh_command
  740.     refresh
  741.   end
  742.   #--------------------------------------------------------------------------
  743.   # ○ コマンドを削除
  744.   #--------------------------------------------------------------------------
  745.   def remove_command(command)
  746.     @commands.delete(command)
  747.     @item_max = @commands.size
  748.     refresh
  749.   end
  750.   end
  751. end

  752. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  753. #==============================================================================
  754. # ■ Window_Status
  755. #==============================================================================

  756. if KGC::SkillCPSystem::SHOW_STATUS_CP
  757. class Window_Status < Window_Base
  758.   #--------------------------------------------------------------------------
  759.   # ● 基本情報の描画
  760.   #     x : 描画先 X 座標
  761.   #     y : 描画先 Y 座標
  762.   #--------------------------------------------------------------------------
  763.   alias draw_basic_info_KGC_SkillCPSystem draw_basic_info
  764.   def draw_basic_info(x, y)
  765.     draw_basic_info_KGC_SkillCPSystem(x, y)

  766.     draw_actor_cp(@actor, x, y + WLH * 4)
  767.   end
  768. end
  769. end

  770. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  771. #==============================================================================
  772. # □ Window_BattleSkillStatus
  773. #------------------------------------------------------------------------------
  774. #   戦闘スキル設定画面で、設定者のステータスを表示するウィンドウです。
  775. #==============================================================================

  776. class Window_BattleSkillStatus < Window_Base
  777.   #--------------------------------------------------------------------------
  778.   # ● オブジェクト初期化
  779.   #     x     : ウィンドウの X 座標
  780.   #     y     : ウィンドウの Y 座標
  781.   #     actor : アクター
  782.   #--------------------------------------------------------------------------
  783.   def initialize(x, y, actor)
  784.     super(x, y, Graphics.width, WLH + 32)
  785.     [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  786.     refresh
  787.   end
  788.   #--------------------------------------------------------------------------
  789.   # ● リフレッシュ
  790.   #--------------------------------------------------------------------------
  791.   def refresh
  792.     self.contents.clear
  793.     draw_actor_name(@actor, 4, 0)
  794.     draw_actor_level(@actor, 140, 0)
  795.     draw_actor_cp(@actor, 240, 0)
  796.   end
  797. end

  798. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  799. #==============================================================================
  800. # □ Window_BattleSkillSlot
  801. #------------------------------------------------------------------------------
  802. #   戦闘スキル選択画面で、設定したスキルの一覧を表示するウィンドウです。
  803. #==============================================================================

  804. class Window_BattleSkillSlot < Window_Selectable
  805.   #--------------------------------------------------------------------------
  806.   # ● オブジェクト初期化
  807.   #     x      : ウィンドウの X 座標
  808.   #     y      : ウィンドウの Y 座標
  809.   #     width  : ウィンドウの幅
  810.   #     height : ウィンドウの高さ
  811.   #     actor  : アクター
  812.   #--------------------------------------------------------------------------
  813.   def initialize(x, y, width, height, actor)
  814.     super(x, y, width, height)
  815.     @actor = actor
  816.     self.index = 0
  817.     self.active = false
  818.     refresh
  819.   end
  820.   #--------------------------------------------------------------------------
  821.   # ○ スキルの取得
  822.   #--------------------------------------------------------------------------
  823.   def skill
  824.     return @data[self.index]
  825.   end
  826.   #--------------------------------------------------------------------------
  827.   # ● リフレッシュ
  828.   #--------------------------------------------------------------------------
  829.   def refresh
  830.     @data = []
  831.     skill_ids = @actor.battle_skill_ids
  832.     @actor.battle_skill_max.times { |i|
  833.       if skill_ids[i] != nil
  834.         @data << $data_skills[skill_ids[i]]
  835.       else
  836.         @data << nil
  837.       end
  838.     }
  839.     @item_max = @data.size
  840.     create_contents
  841.     @item_max.times { |i| draw_item(i) }
  842.   end
  843.   #--------------------------------------------------------------------------
  844.   # ○ 項目の描画
  845.   #     index : 項目番号
  846.   #--------------------------------------------------------------------------
  847.   def draw_item(index)
  848.     rect = item_rect(index)
  849.     self.contents.clear_rect(rect)
  850.     skill = @data[index]
  851.     if skill != nil
  852.       rect.width -= 4
  853.       draw_item_name(skill, rect.x, rect.y)
  854.       self.contents.draw_text(rect, skill.cp_cost, 2)
  855.     else
  856.       self.contents.draw_text(rect, KGC::SkillCPSystem::BLANK_TEXT, 1)
  857.     end
  858.   end
  859.   #--------------------------------------------------------------------------
  860.   # ● カーソルを 1 ページ後ろに移動
  861.   #--------------------------------------------------------------------------
  862.   def cursor_pagedown
  863.     return if Input.repeat?(Input::R)
  864.     super
  865.   end
  866.   #--------------------------------------------------------------------------
  867.   # ● カーソルを 1 ページ前に移動
  868.   #--------------------------------------------------------------------------
  869.   def cursor_pageup
  870.     return if Input.repeat?(Input::L)
  871.     super
  872.   end
  873.   #--------------------------------------------------------------------------
  874.   # ● フレーム更新
  875.   #--------------------------------------------------------------------------
  876.   def update
  877.     super
  878.     return unless self.active

  879.     if Input.repeat?(Input::RIGHT)
  880.       Sound.play_cursor
  881.       cursor_pagedown
  882.     elsif Input.repeat?(Input::LEFT)
  883.       Sound.play_cursor
  884.       cursor_pageup
  885.     end
  886.   end
  887.   #--------------------------------------------------------------------------
  888.   # ● ヘルプテキスト更新
  889.   #--------------------------------------------------------------------------
  890.   def update_help
  891.     @help_window.set_text(skill == nil ? "" : skill.description)
  892.   end
  893. end

  894. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  895. #==============================================================================
  896. # □ Window_BattleSkillList
  897. #------------------------------------------------------------------------------
  898. #   戦闘スキル選択画面で、設定できるスキルの一覧を表示するウィンドウです。
  899. #==============================================================================

  900. class Window_BattleSkillList < Window_Selectable
  901.   #--------------------------------------------------------------------------
  902.   # ● 公開インスタンス変数
  903.   #--------------------------------------------------------------------------
  904.   attr_accessor :slot_index               # スロット番号
  905.   #--------------------------------------------------------------------------
  906.   # ● オブジェクト初期化
  907.   #     x      : ウィンドウの X 座標
  908.   #     y      : ウィンドウの Y 座標
  909.   #     width  : ウィンドウの幅
  910.   #     height : ウィンドウの高さ
  911.   #     actor  : アクター
  912.   #--------------------------------------------------------------------------
  913.   def initialize(x, y, width, height, actor)
  914.     super(x, y, width, height)
  915.     @actor = actor
  916.     @slot_index = 0
  917.     self.index = 0
  918.     self.active = false
  919.     refresh
  920.   end
  921.   #--------------------------------------------------------------------------
  922.   # ○ スキルの取得
  923.   #--------------------------------------------------------------------------
  924.   def skill
  925.     return @data[self.index]
  926.   end
  927.   #--------------------------------------------------------------------------
  928.   # ● リフレッシュ
  929.   #--------------------------------------------------------------------------
  930.   def refresh
  931.     @data = [nil]
  932.     # 選択可能なスキルのみを取得
  933.     @actor.all_skills.each { |skill|
  934.       @data.push(skill) if selectable?(skill)
  935.     }

  936.     @item_max = @data.size
  937.     create_contents
  938.     @item_max.times { |i| draw_item(i) }
  939.   end
  940.   #--------------------------------------------------------------------------
  941.   # ○ スキル選択可否判定
  942.   #     skill : スキル
  943.   #--------------------------------------------------------------------------
  944.   def selectable?(skill)
  945.     return false if skill == nil

  946.     # 消費 CP 0 なら常に使用可能な場合
  947.     if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0
  948.       return false
  949.     end
  950.     # 戦闘時に使用可能ならOK
  951.     return true if skill.battle_ok?
  952.     # 使用不可でもセット可能な場合
  953.     if KGC::SkillCPSystem::SHOW_UNUSABLE_SKILL && skill.occasion == 3
  954.       return true
  955.     end

  956.     return false
  957.   end
  958.   #--------------------------------------------------------------------------
  959.   # ○ 項目の描画
  960.   #     index : 項目番号
  961.   #--------------------------------------------------------------------------
  962.   def draw_item(index)
  963.     rect = item_rect(index)
  964.     self.contents.clear_rect(rect)
  965.     skill = @data[index]
  966.     if skill != nil
  967.       rect.width -= 4
  968.       enabled = @actor.battle_skill_settable?(@slot_index, skill)
  969.       draw_item_name(skill, rect.x, rect.y, enabled)
  970.       self.contents.draw_text(rect, skill.cp_cost, 2)
  971.     else
  972.       self.contents.draw_text(rect, KGC::SkillCPSystem::RELEASE_TEXT, 1)
  973.     end
  974.   end
  975.   #--------------------------------------------------------------------------
  976.   # ● フレーム更新
  977.   #--------------------------------------------------------------------------
  978.   def update
  979.     super
  980.     return unless self.active

  981.     if Input.repeat?(Input::RIGHT)
  982.       cursor_pagedown
  983.     elsif Input.repeat?(Input::LEFT)
  984.       cursor_pageup
  985.     end
  986.   end
  987.   #--------------------------------------------------------------------------
  988.   # ● ヘルプテキスト更新
  989.   #--------------------------------------------------------------------------
  990.   def update_help
  991.     @help_window.set_text(skill == nil ? "" : skill.description)
  992.   end
  993. end

  994. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  995. #==============================================================================
  996. # ■ Scene_Map
  997. #==============================================================================

  998. class Scene_Map < Scene_Base
  999.   #--------------------------------------------------------------------------
  1000.   # ● 画面切り替えの実行
  1001.   #--------------------------------------------------------------------------
  1002.   alias update_scene_change_KGC_SkillCPSystem update_scene_change
  1003.   def update_scene_change
  1004.     return if $game_player.moving?    # プレイヤーの移動中?

  1005.     if $game_temp.next_scene == :set_battle_skill
  1006.       call_set_battle_skill
  1007.       return
  1008.     end

  1009.     update_scene_change_KGC_SkillCPSystem
  1010.   end
  1011.   #--------------------------------------------------------------------------
  1012.   # ○ スキル設定画面への切り替え
  1013.   #--------------------------------------------------------------------------
  1014.   def call_set_battle_skill
  1015.     $game_temp.next_scene = nil
  1016.     $scene = Scene_SetBattleSkill.new(
  1017.       $game_temp.next_scene_actor_index,
  1018.       0,
  1019.       Scene_SetBattleSkill::HOST_MAP)
  1020.   end
  1021. end

  1022. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  1023. #==============================================================================
  1024. # ■ Scene_Menu
  1025. #==============================================================================

  1026. class Scene_Menu < Scene_Base
  1027.   if KGC::SkillCPSystem::USE_MENU_SET_SKILL_COMMAND
  1028.   #--------------------------------------------------------------------------
  1029.   # ● コマンドウィンドウの作成
  1030.   #--------------------------------------------------------------------------
  1031.   alias create_command_window_KGC_SkillCPSystem create_command_window
  1032.   def create_command_window
  1033.     create_command_window_KGC_SkillCPSystem

  1034.     return if $imported["CustomMenuCommand"]

  1035.     @__command_set_battle_skill_index =
  1036.       @command_window.add_command(Vocab.set_battle_skill)
  1037.     if @command_window.oy > 0
  1038.       @command_window.oy -= Window_Base::WLH
  1039.     end
  1040.     @command_window.index = @menu_index
  1041.   end
  1042.   end
  1043.   #--------------------------------------------------------------------------
  1044.   # ● コマンド選択の更新
  1045.   #--------------------------------------------------------------------------
  1046.   alias update_command_selection_KGC_SkillCPSystem update_command_selection
  1047.   def update_command_selection
  1048.     call_set_battle_skill_flag = false
  1049.     if Input.trigger?(Input::C)
  1050.       case @command_window.index
  1051.       when @__command_set_battle_skill_index  # スキル設定
  1052.         call_set_battle_skill_flag = true
  1053.       end
  1054.     end

  1055.     # スキル設定画面に移行
  1056.     if call_set_battle_skill_flag
  1057.       if $game_party.members.size == 0
  1058.         Sound.play_buzzer
  1059.         return
  1060.       end
  1061.       Sound.play_decision
  1062.       start_actor_selection
  1063.       return
  1064.     end

  1065.     update_command_selection_KGC_SkillCPSystem
  1066.   end
  1067.   #--------------------------------------------------------------------------
  1068.   # ● アクター選択の更新
  1069.   #--------------------------------------------------------------------------
  1070.   alias update_actor_selection_KGC_SkillCPSystem update_actor_selection
  1071.   def update_actor_selection
  1072.     if Input.trigger?(Input::C)
  1073.       $game_party.last_actor_index = @status_window.index
  1074.       Sound.play_decision
  1075.       case @command_window.index
  1076.       when @__command_set_battle_skill_index  # スキル設定
  1077.         $scene = Scene_SetBattleSkill.new(
  1078.           @status_window.index,
  1079.           @__command_set_battle_skill_index,
  1080.           Scene_SetBattleSkill::HOST_MENU)
  1081.         return
  1082.       end
  1083.     end

  1084.     update_actor_selection_KGC_SkillCPSystem
  1085.   end
  1086. end

  1087. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  1088. #==============================================================================
  1089. # □ Scene_SetBattleSkill
  1090. #------------------------------------------------------------------------------
  1091. #   戦闘スキル設定画面の処理を行うクラスです。
  1092. #==============================================================================

  1093. class Scene_SetBattleSkill < Scene_Base
  1094.   #--------------------------------------------------------------------------
  1095.   # ○ 定数
  1096.   #--------------------------------------------------------------------------
  1097.   HOST_MENU   = 3  # 呼び出し元 : メニュー
  1098.   HOST_MAP    = 1  # 呼び出し元 : マップ
  1099.   #--------------------------------------------------------------------------
  1100.   # ● オブジェクト初期化
  1101.   #     actor_index : アクターインデックス
  1102.   #     menu_index  : コマンドのカーソル初期位置
  1103.   #     host_scene  : 呼び出し元 (0..メニュー  1..マップ)
  1104.   #--------------------------------------------------------------------------
  1105.   def initialize(actor_index = 0, menu_index = 0, host_scene = HOST_MENU)
  1106.     @actor_index = actor_index
  1107.     @menu_index = menu_index
  1108.     @host_scene = host_scene
  1109.   end
  1110.   #--------------------------------------------------------------------------
  1111.   # ● 開始処理
  1112.   #--------------------------------------------------------------------------
  1113.   def start
  1114.     super
  1115.     create_menu_background

  1116.     @actor = $game_party.members[@actor_index]
  1117.     create_windows
  1118.   end
  1119.   #--------------------------------------------------------------------------
  1120.   # ○ ウィンドウ作成
  1121.   #--------------------------------------------------------------------------
  1122.   def create_windows
  1123.     @help_window = Window_Help.new
  1124.     if $imported["HelpExtension"]
  1125.       @help_window.row_max = KGC::HelpExtension::ROW_MAX
  1126.     end

  1127.     dy = @help_window.height
  1128.     @status_window = Window_BattleSkillStatus.new(0, dy, @actor)

  1129.     dy += @status_window.height
  1130.     @slot_window = Window_BattleSkillSlot.new(
  1131.       0,
  1132.       dy,
  1133.       Graphics.width / 2,
  1134.       Graphics.height - dy,
  1135.       @actor)
  1136.     @slot_window.help_window = @help_window
  1137.     @slot_window.active = true

  1138.     @list_window = Window_BattleSkillList.new(
  1139.       Graphics.width - @slot_window.width,
  1140.       dy,
  1141.       Graphics.width - @slot_window.width,
  1142.       Graphics.height - dy,
  1143.       @actor)
  1144.     @list_window.help_window = @help_window
  1145.   end
  1146.   #--------------------------------------------------------------------------
  1147.   # ● 終了処理
  1148.   #--------------------------------------------------------------------------
  1149.   def terminate
  1150.     super
  1151.     dispose_menu_background
  1152.     @help_window.dispose
  1153.     @status_window.dispose
  1154.     @slot_window.dispose
  1155.     @list_window.dispose
  1156.   end
  1157.   #--------------------------------------------------------------------------
  1158.   # ○ 元の画面へ戻る
  1159.   #--------------------------------------------------------------------------
  1160. def return_scene
  1161.     $scene = Scene_Menu.new(4)
  1162.   end
  1163.   #--------------------------------------------------------------------------
  1164.   # ● フレーム更新
  1165.   #--------------------------------------------------------------------------
  1166.   def update
  1167.     super
  1168.     update_menu_background
  1169.     update_window
  1170.     if @slot_window.active
  1171.       update_slot
  1172.     elsif @list_window.active
  1173.       update_list
  1174.     end
  1175.   end
  1176.   #--------------------------------------------------------------------------
  1177.   # ○ ウィンドウ更新
  1178.   #--------------------------------------------------------------------------
  1179.   def update_window
  1180.     @help_window.update
  1181.     @status_window.update
  1182.     @slot_window.update
  1183.     @list_window.update
  1184.   end
  1185.   #--------------------------------------------------------------------------
  1186.   # ○ ウィンドウ再描画
  1187.   #--------------------------------------------------------------------------
  1188.   def refresh_window
  1189.     @status_window.refresh
  1190.     @slot_window.refresh
  1191.     @list_window.refresh
  1192.   end
  1193.   #--------------------------------------------------------------------------
  1194.   # ○ 次のアクターの画面に切り替え
  1195.   #--------------------------------------------------------------------------
  1196.   def next_actor
  1197.     @actor_index += 1
  1198.     @actor_index %= $game_party.members.size
  1199.     $scene = Scene_SetBattleSkill.new(@actor_index, @menu_index, @host_scene)
  1200.   end
  1201.   #--------------------------------------------------------------------------
  1202.   # ○ 前のアクターの画面に切り替え
  1203.   #--------------------------------------------------------------------------
  1204.   def prev_actor
  1205.     @actor_index += $game_party.members.size - 1
  1206.     @actor_index %= $game_party.members.size
  1207.     $scene = Scene_SetBattleSkill.new(@actor_index, @menu_index, @host_scene)
  1208.   end
  1209.   #--------------------------------------------------------------------------
  1210.   # ○ フレーム更新 (スロットウィンドウがアクティブの場合)
  1211.   #--------------------------------------------------------------------------
  1212.   def update_slot
  1213.     # 選択項目が変化した場合
  1214.     if @last_slot_index != @slot_window.index
  1215.       @list_window.slot_index = @slot_window.index
  1216.       @list_window.refresh
  1217.       @last_slot_index = @slot_window.index
  1218.     end

  1219.     if Input.trigger?(Input::A)
  1220.       Sound.play_decision
  1221.       # 選択しているスキルを外す
  1222.       @actor.remove_battle_skill(@slot_window.index)
  1223.       refresh_window
  1224.     elsif Input.trigger?(Input::B)
  1225.       Sound.play_cancel
  1226.       return_scene
  1227.     elsif Input.trigger?(Input::C)
  1228.       Sound.play_decision
  1229.       # リストウィンドウに切り替え
  1230.       @slot_window.active = false
  1231.       @list_window.active = true
  1232.     elsif Input.trigger?(Input::R)
  1233.       Sound.play_cursor
  1234.       next_actor
  1235.     elsif Input.trigger?(Input::L)
  1236.       Sound.play_cursor
  1237.       prev_actor
  1238.     end
  1239.   end
  1240.   #--------------------------------------------------------------------------
  1241.   # ○ フレーム更新 (リストウィンドウがアクティブの場合)
  1242.   #--------------------------------------------------------------------------
  1243.   def update_list
  1244.     if Input.trigger?(Input::B)
  1245.       Sound.play_cancel
  1246.       # スロットウィンドウに切り替え
  1247.       @slot_window.active = true
  1248.       @list_window.active = false
  1249.     elsif Input.trigger?(Input::C)
  1250.       skill = @list_window.skill
  1251.       # セットできない場合
  1252.       unless @actor.battle_skill_settable?(@slot_window.index, skill)
  1253.         Sound.play_buzzer
  1254.         return
  1255.       end
  1256.       Sound.play_decision
  1257.       set_skill(@slot_window.index, skill)
  1258.       # スロットウィンドウに切り替え
  1259.       @slot_window.active = true
  1260.       @list_window.active = false
  1261.     end
  1262.   end
  1263.   #--------------------------------------------------------------------------
  1264.   # ○ スキル設定
  1265.   #     index : 設定する場所
  1266.   #     skill : 設定するスキル
  1267.   #--------------------------------------------------------------------------
  1268.   def set_skill(index, skill)
  1269.     @actor.remove_battle_skill(index)
  1270.     if skill != nil
  1271.       @actor.set_battle_skill(index, skill)
  1272.     end
  1273.     refresh_window
  1274.   end
  1275. end
复制代码
再上貌似是那个效果

备注说明:范例里的脚本太多了,我看到这个就随手一抓来,范例里还有什么横版战斗、影子系统等脚本的。


——旧坑欢迎戳

Lv1.梦旅人

梦石
0
星屑
191
在线时间
835 小时
注册时间
2012-9-16
帖子
1811
2
 楼主| 发表于 2013-1-22 18:03:06 | 只看该作者
补充:
1、如果图片查看不了,请下载附件.

——旧坑欢迎戳
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
48
在线时间
2459 小时
注册时间
2011-12-18
帖子
1484
3
发表于 2013-1-22 18:25:47 | 只看该作者
把会出错的地方通通注释掉,那几个语句是用来描绘值槽外面的框用的。

点评

↓湛蓝的  发表于 2013-1-22 19:02
砖头只是奇怪这又是从哪伸来的范例,不出错才怪呢  发表于 2013-1-22 18:54

评分

参与人数 1星屑 +50 收起 理由
咕噜 + 50 认可答案

查看全部评分

这是一个深不见底的坑,这是一个广袤无边的坑,我才刚刚放上了一抔泥土……

《六道·陈国篇》开坑了……↓点我
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-6-16 19:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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