查看: 2862|回复: 12

装备扩张脚本 为什么不能调用到自定义的物品函数哦

  [复制链接]
梦石
0
星屑
50
在线时间
1 小时
注册时间
2008-8-3
回帖
947
发表于 2008-9-14 06:52:46 | 显示全部楼层 |阅读模式

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

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

×
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

  2. /_/_/_/_/_/_/_/
  3. #_/    ◆ 装備拡張 - KGC_EquipExtension ◆ VX ◆
  4. #_/    ◇ Last update : 2008/02/10 ◇
  5. #_/------------------------------------------------------------

  6. ----------------
  7. #_/  装備関連の機能を拡張します。
  8. #_/=============================================================

  9. ===============
  10. #_/ 【メニュー】≪拡張装備画面≫ より下に導入してくだ

  11. さい。
  12. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

  13. /_/_/_/_/_/_/_/

  14. #===============================================================

  15. ===============
  16. # ★ カスタマイズ項目 - Customize ★
  17. #===============================================================

  18. ===============

  19. module KGC
  20. module EquipExtension
  21.   # ◆ 扩张的装备种类名称
  22.   #  从前面的皆下去4, 5, 6, ...
  23.   EXTRA_EQUIP_KIND = ["足", "技能書"]

  24.   # ◆ 装备的顺序
  25.   #  以这里设置的顺序接续在武器的下面
  26.   #  ※ 装备个数最低为1,否则二刀流会出错
  27.   #   ** 装备种类一览 **
  28.   #  0..盾  1..頭部  2..身体  3..装飾品  4~..↑所定義的种类
  29.   EQUIP_TYPE = [0, 1, 2, 4, 3, 3, 5]

  30.   # ◆ EP (装备点数) 制是否要使用
  31.   USE_EP_SYSTEM = true
  32.   # ◆ EP 的名称
  33.   VOCAB_EP   = "EP"
  34.   # ◆ EP 的名称 (略)
  35.   VOCAB_EP_A = "E"
  36.   # ◆ 是否在状态介面显示EP值
  37.   SHOW_STATUS_EP = true

  38.   # ◆ 装备预设 EP 消耗点数
  39.   #  没有设定EP消耗点数的装备自动加上的点数
  40.   DEFAULT_EP_COST   = 1
  41.   # ◆ 当消耗 EP 值为 0 时隐藏
  42.   HIDE_ZERO_EP_COST = true

  43.   # ◆ EP 上限
  44.   EP_MAX = 20
  45.   # ◆ EP 下限
  46.   EP_MIN = 5
  47.   # ◆ 最大 EP 公式
  48.   #   level..角色等级
  49.   #  计算後小数自动取整
  50.   EP_CALC_EXP = "level * 0.3 + 4"

  51.   # ◆ 消耗 EP 値的文字颜色 (接续在装备名称後面的文字)
  52.   #  数字  : 与 \C[n] 同样的颜色 (也就是在窗口外观设置的颜色色

  53. 号)
  54.   #  Color : 指定颜色。 ( Color.new(128, 255, 255))
  55.   EP_COST_COLOR        = 23
  56.   # ◆ EP 槽開始色
  57.   EP_GAUGE_START_COLOR = 28
  58.   # ◆ EP 槽结束色
  59.   EP_GAUGE_END_COLOR   = 29
  60. end
  61. end

  62. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  63. ☆★☆★☆★☆★

  64. $imported = {} if $imported == nil
  65. $imported["EquipExtension"] = true

  66. module KGC::EquipExtension
  67.   # EP 制を使用しない場合の設定
  68.   unless USE_EP_SYSTEM
  69.     SHOW_STATUS_EP = false
  70.     HIDE_ZERO_EP_COST = true
  71.   end

  72.   # 正規表現
  73.   module Regexp
  74.     # ベースアイテム
  75.     module BaseItem
  76.       # 消費 EP
  77.       EP_COST = /<EP\s*(\d+)>/i
  78.       # 装備タイプ
  79.       EQUIP_TYPE = /<(?:EQUIP_TYPE|装備タイプ)\s*(\d+

  80. (?:\s*,\s*\d+)*)>/
  81.     end

  82.     # 防具
  83.     module Armor
  84.       # 装備種別
  85.       EQUIP_KIND = /<(?:EQUIP_KIND|装備種別)\s*(.+)>/i
  86.     end
  87.   end
  88. end

  89. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  90. ☆★☆★☆★☆★

  91. #===============================================================

  92. ===============
  93. # □ KGC::Commands
  94. #===============================================================

  95. ===============

  96. module KGC::Commands
  97.   module_function
  98.   #------------------------------------------------------------

  99. --------------
  100.   # ○ アクターの装備を修復
  101.   #------------------------------------------------------------

  102. --------------
  103.   def restore_equip
  104.     (1...$data_actors.size).each { |i|
  105.       actor = $game_actors[i]
  106.       actor.restore_equip
  107.     }
  108.   end
  109.   #------------------------------------------------------------

  110. --------------
  111.   # ○ アクターの装備タイプを設定
  112.   #     actor_id   : アクター ID
  113.   #     equip_type : 装備タイプ
  114.   #------------------------------------------------------------

  115. --------------
  116.   def set_actor_equip_type(actor_id, equip_type = nil)
  117.     actor = $game_actors[actor_id]
  118.     return if actor == nil
  119.     actor.equip_type = equip_type
  120.   end
  121. end

  122. class Game_Interpreter
  123.   include KGC::Commands
  124. end

  125. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  126. ☆★☆★☆★☆★

  127. #===============================================================

  128. ===============
  129. # ■ Vocab
  130. #===============================================================

  131. ===============

  132. module Vocab
  133.   # EP
  134.   def self.ep
  135.     return KGC::EquipExtension::VOCAB_EP
  136.   end

  137.   # EP (略)
  138.   def self.ep_a
  139.     return KGC::EquipExtension::VOCAB_EP_A
  140.   end

  141.   # 拡張防具欄
  142.   def self.extra_armor(index)
  143.     return KGC::EquipExtension::EXTRA_EQUIP_KIND[index]
  144.   end
  145. end

  146. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  147. ☆★☆★☆★☆★

  148. #===============================================================

  149. ===============
  150. # ■ RPG::BaseItem
  151. #===============================================================

  152. ===============

  153. class RPG::BaseItem
  154.   #------------------------------------------------------------

  155. --------------
  156.   # ○ 装備拡張のキャッシュを作成
  157.   #------------------------------------------------------------

  158. --------------
  159.   def create_equip_extension_cache
  160.     @__ep_cost = KGC::EquipExtension::DEFAULT_EP_COST
  161.     @__equip_type = []

  162.     self.note.split(/[\r\n]+/).each { |line|
  163.       case line
  164.       when KGC::EquipExtension::Regexp::BaseItem::EP_COST
  165.         # 消費 EP
  166.         @__ep_cost = $1.to_i
  167.       when KGC::EquipExtension::Regexp::BaseItem::EQUIP_TYPE
  168.         # 装備タイプ
  169.         @__equip_type = []
  170.         $1.scan(/\d+/) { |num|
  171.           @__equip_type << num.to_i
  172.         }
  173.       end
  174.     }

  175.     # EP 制を使用しない場合は消費 EP = 0
  176.     @__ep_cost = 0 unless KGC::EquipExtension::USE_EP_SYSTEM
  177.   end
  178.   #------------------------------------------------------------

  179. --------------
  180.   # ○ 消費 EP
  181.   #------------------------------------------------------------

  182. --------------
  183.   def ep_cost
  184.     create_equip_extension_cache if @__ep_cost == nil
  185.     return @__ep_cost
  186.   end
  187.   #------------------------------------------------------------

  188. --------------
  189.   # ○ 装備タイプ
  190.   #------------------------------------------------------------

  191. --------------
  192.   def equip_type
  193.     create_equip_extension_cache if @__equip_type == nil
  194.     return @__equip_type
  195.   end
  196. end

  197. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  198. ☆★☆★☆★☆★

  199. #===============================================================

  200. ===============
  201. # ■ RPG::Armor
  202. #===============================================================

  203. ===============

  204. class RPG::Armor < RPG::BaseItem
  205.   #------------------------------------------------------------

  206. --------------
  207.   # ○ 装備拡張のキャッシュを作成
  208.   #------------------------------------------------------------

  209. --------------
  210.   def create_equip_extension_cache
  211.     super
  212.     @__kind = -1

  213.     self.note.split(/[\r\n]+/).each { |line|
  214.       if line =~ KGC::EquipExtension::Regexp::Armor::EQUIP_KIND
  215.         # 装備タイプ
  216.         e_index = KGC::EquipExtension::EXTRA_EQUIP_KIND.index

  217. ($1)
  218.         next if e_index == nil
  219.         @__kind = e_index + 4
  220.       end
  221.     }
  222.   end

  223. unless $@
  224.   #------------------------------------------------------------

  225. --------------
  226.   # ○ 種別
  227.   #------------------------------------------------------------

  228. --------------
  229.   alias kind_KGC_EquipExtension kind
  230.   def kind
  231.     create_equip_extension_cache if @__kind == nil
  232.     return (@__kind == -1 ? kind_KGC_EquipExtension : @__kind)
  233.   end
  234. end

  235. end

  236. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  237. ☆★☆★☆★☆★

  238. #===============================================================

  239. ===============
  240. # ■ Game_Actor
  241. #===============================================================

  242. ===============

  243. class Game_Actor < Game_Battler
  244.   #------------------------------------------------------------

  245. --------------
  246.   # ● 公開インスタンス変数
  247.   #------------------------------------------------------------

  248. --------------
  249.   attr_writer   :equip_type               # 装備タイプ
  250.   #------------------------------------------------------------

  251. --------------
  252.   # ● セットアップ
  253.   #     actor_id : アクター ID
  254.   #------------------------------------------------------------

  255. --------------
  256.   alias setup_KGC_EquipExtension setup
  257.   def setup(actor_id)
  258.     actor = $data_actors[actor_id]
  259.     @extra_armor_id = []

  260.     setup_KGC_EquipExtension(actor_id)

  261.     restore_equip
  262.   end
  263.   #------------------------------------------------------------

  264. --------------
  265.   # ○ MaxEP 取得
  266.   #------------------------------------------------------------

  267. --------------
  268.   def maxep
  269.     n = Integer(eval(KGC::EquipExtension::EP_CALC_EXP))
  270.     return [[n, ep_limit].min, KGC::EquipExtension::EP_MIN].max
  271.   end
  272.   #------------------------------------------------------------

  273. --------------
  274.   # ○ EP 取得
  275.   #------------------------------------------------------------

  276. --------------
  277.   def ep
  278.     n = 0
  279.     equips.compact.each { |item| n += item.ep_cost }
  280.     return [maxep - n, 0].max
  281.   end
  282.   #------------------------------------------------------------

  283. --------------
  284.   # ○ EP 上限取得
  285.   #------------------------------------------------------------

  286. --------------
  287.   def ep_limit
  288.     return KGC::EquipExtension::EP_MAX
  289.   end
  290.   #------------------------------------------------------------

  291. --------------
  292.   # ○ 防具欄の取得
  293.   #------------------------------------------------------------

  294. --------------
  295.   def equip_type
  296.     if @equip_type.is_a?(Array)
  297.       return @equip_type
  298.     else
  299.       return KGC::EquipExtension::EQUIP_TYPE
  300.     end
  301.   end
  302.   #------------------------------------------------------------

  303. --------------
  304.   # ○ 防具欄の数
  305.   #------------------------------------------------------------

  306. --------------
  307.   def armor_number
  308.     return equip_type.size
  309.   end
  310.   #------------------------------------------------------------

  311. --------------
  312.   # ○ 拡張防具欄の数
  313.   #------------------------------------------------------------

  314. --------------
  315.   def extra_armor_number
  316.     return [armor_number - 4, 0].max
  317.   end
  318.   #------------------------------------------------------------

  319. --------------
  320.   # ○ 防具 ID リストの取得
  321.   #------------------------------------------------------------

  322. --------------
  323.   def extra_armor_id
  324.     @extra_armor_id = [] if @extra_armor_id == nil
  325.     return @extra_armor_id
  326.   end
  327.   #------------------------------------------------------------

  328. --------------
  329.   # ● 防具オブジェクトの配列取得
  330.   #------------------------------------------------------------

  331. --------------
  332.   alias armors_KGC_EquipExtension armors
  333.   def armors
  334.     result = armors_KGC_EquipExtension

  335.     # 5番目以降の防具を追加
  336.     extra_armor_number.times { |i|
  337.       armor_id = extra_armor_id[i]
  338.       result << (armor_id == nil ? nil : $data_armors[armor_id])
  339.     }
  340.     return result
  341.   end
  342.   #------------------------------------------------------------

  343. --------------
  344.   # ● 装備の変更 (オブジェクトで指定)
  345.   #     equip_type : 装備部位
  346.   #     item       : 武器 or 防具 (nil なら装備解除)
  347.   #     test       : テストフラグ (戦闘テスト、または装備画面で

  348. の一時装備)
  349.   #------------------------------------------------------------

  350. --------------
  351.   alias change_equip_KGC_EquipExtension change_equip
  352.   def change_equip(equip_type, item, test = false)
  353.     change_equip_KGC_EquipExtension(equip_type, item, test)

  354.     # 拡張防具欄がある場合のみ
  355.     if extra_armor_number > 0
  356.       item_id = item == nil ? 0 : item.id
  357.       case equip_type
  358.       when 5..armor_number  # 拡張防具欄
  359.         @extra_armor_id = [] if @extra_armor_id == nil
  360.         @extra_armor_id[equip_type - 5] = item_id
  361.       end
  362.     end

  363.     restore_battle_skill if $imported["SkillCPSystem"]
  364.     restore_passive_rev  if $imported["PassiveSkill"]
  365.   end
  366.   #------------------------------------------------------------

  367. --------------
  368.   # ● 装備の破棄
  369.   #     item : 破棄する武器 or 防具
  370.   #    武器/防具の増減で「装備品も含める」のとき使用する。
  371.   #------------------------------------------------------------

  372. --------------
  373.   alias discard_equip_KGC_EquipExtension discard_equip
  374.   def discard_equip(item)
  375.     last_armors = [@armor1_id, @armor2_id, @armor3_id,

  376. @armor4_id]

  377.     discard_equip_KGC_EquipExtension(item)

  378.     curr_armors = [@armor1_id, @armor2_id, @armor3_id,

  379. @armor4_id]
  380.     return unless item.is_a?(RPG::Armor)  # 防具でない
  381.     return if last_armors != curr_armors  # 既に破棄された

  382.     # 拡張防具欄を検索
  383.     extra_armor_number.times { |i|
  384.       if extra_armor_id[i] == item.id
  385.         @extra_armor_id[i] = 0
  386.         break
  387.       end
  388.     }

  389.     restore_battle_skill if $imported["SkillCPSystem"]
  390.     restore_passive_rev  if $imported["PassiveSkill"]
  391.   end
  392.   #------------------------------------------------------------

  393. --------------
  394.   # ● 職業 ID の変更
  395.   #     class_id : 新しい職業 ID
  396.   #------------------------------------------------------------

  397. --------------
  398.   alias class_id_equal_KGC_EquipExtension class_id=
  399.   def class_id=(class_id)
  400.     class_id_equal_KGC_EquipExtension(class_id)

  401.     return if extra_armor_number == 0  # 拡張防具欄がない

  402.     # 装備できない拡張防具を外す
  403.     for i in 5..armor_number
  404.       change_equip(i, nil) unless equippable?(equips[i])
  405.     end
  406.   end
  407.   #------------------------------------------------------------

  408. --------------
  409.   # ○ EP 条件クリア判定
  410.   #     equip_type : 装備部位
  411.   #     item       : 武器 or 防具
  412.   #------------------------------------------------------------

  413. --------------
  414.   def ep_condition_clear?(equip_type, item)
  415.     return true if item == nil  # nil は解除なので OK

  416.     curr_item = equips[equip_type]
  417.     offset = (curr_item != nil ? curr_item.ep_cost : 0)
  418.     return false if self.ep < (item.ep_cost - offset)   # EP 不

  419. 足

  420.     return true
  421.   end
  422.   #------------------------------------------------------------

  423. --------------
  424.   # ○ 装備を修復
  425.   #------------------------------------------------------------

  426. --------------
  427.   def restore_equip
  428.     # 以前の装備品&#12539;パラメータを退避
  429.     last_equips = equips
  430.     last_hp = self.hp
  431.     last_mp = self.mp
  432.     if $imported["SkillCPSystem"]
  433.       last_battle_skill_ids = battle_skill_ids.clone
  434.     end

  435.     # 全装備解除
  436.     last_equips.each_index { |i| change_equip(i, nil) }

  437.     # 装備品&#12539;パラメータを復元
  438.     last_equips.compact.each { |item| equip_legal_slot(item) }
  439.     self.hp = last_hp
  440.     self.mp = last_mp
  441.     if $imported["SkillCPSystem"]
  442.       last_battle_skill_ids.each_with_index { |s, i|

  443. set_battle_skill(i, s) }
  444.     end
  445.     Graphics.frame_reset
  446.   end
  447.   #------------------------------------------------------------

  448. --------------
  449.   # ○ 装備品を正しい箇所にセット
  450.   #     item : 武器 or 防具
  451.   #------------------------------------------------------------

  452. --------------
  453.   def equip_legal_slot(item)
  454.     if item.is_a?(RPG::Weapon)
  455.       if @weapon_id == 0
  456.         # 武器 1
  457.         change_equip(0, item)
  458.       elsif two_swords_style && @armor1_id == 0
  459.         # 武器 2 (二刀流の場合)
  460.         change_equip(1, item)
  461.       end
  462.     elsif item.is_a?(RPG::Armor)
  463.       if !two_swords_style && item.kind == equip_type[0] &&

  464. @armor1_id == 0
  465.         # 先頭の防具 (二刀流でない場合)
  466.         change_equip(1, item)
  467.       else
  468.         # 装備箇所リストを作成
  469.         list = [-1, @armor2_id, @armor3_id, @armor4_id]
  470.         list += extra_armor_id
  471.         # 正しい、かつ空いている箇所にセット
  472.         equip_type.each_with_index { |kind, i|
  473.           if kind == item.kind && list[i] == 0
  474.             change_equip(i + 1, item)
  475.             break
  476.           end
  477.         }
  478.       end
  479.     end
  480.   end
  481. end

  482. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  483. ☆★☆★☆★☆★

  484. #===============================================================

  485. ===============
  486. # ■ Window_Base
  487. #===============================================================

  488. ===============

  489. class Window_Base < Window
  490.   #------------------------------------------------------------

  491. --------------
  492.   # ○ EP の文字色を取得
  493.   #     actor : アクター
  494.   #------------------------------------------------------------

  495. --------------
  496.   def ep_color(actor)
  497.     return knockout_color if actor.maxep > 0 && actor.ep == 0
  498.     return normal_color
  499.   end
  500.   #------------------------------------------------------------

  501. --------------
  502.   # ○ EP ゲージの色 1 の取得
  503.   #------------------------------------------------------------

  504. --------------
  505.   def ep_gauge_color1
  506.     color = KGC::EquipExtension::EP_GAUGE_START_COLOR
  507.     return (color.is_a?(Integer) ? text_color(color) : color)
  508.   end
  509.   #------------------------------------------------------------

  510. --------------
  511.   # ○ EP ゲージの色 2 の取得
  512.   #------------------------------------------------------------

  513. --------------
  514.   def ep_gauge_color2
  515.     color = KGC::EquipExtension::EP_GAUGE_END_COLOR
  516.     return (color.is_a?(Integer) ? text_color(color) : color)
  517.   end
  518.   #------------------------------------------------------------

  519. --------------
  520.   # ○ EP の描画
  521.   #     actor : アクター
  522.   #     x     : 描画先 X 座標
  523.   #     y     : 描画先 Y 座標
  524.   #     width : 幅
  525.   #------------------------------------------------------------

  526. --------------
  527.   def draw_actor_ep(actor, x, y, width = 120)
  528.     draw_actor_ep_gauge(actor, x, y, width)
  529.     self.contents.font.color = system_color
  530.     self.contents.draw_text(x, y, 30, WLH, Vocab::ep_a)
  531.     self.contents.font.color = ep_color(actor)
  532.     xr = x + width
  533.     if width < 120
  534.       self.contents.draw_text(xr - 40, y, 40, WLH, actor.ep, 2)
  535.     else
  536.       self.contents.draw_text(xr - 90, y, 40, WLH, actor.ep, 2)
  537.       self.contents.font.color = normal_color
  538.       self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
  539.       self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxep,

  540. 2)
  541.     end
  542.     self.contents.font.color = normal_color
  543.   end
  544.   #------------------------------------------------------------

  545. --------------
  546.   # ○ EP ゲージの描画
  547.   #     actor : アクター
  548.   #     x     : 描画先 X 座標
  549.   #     y     : 描画先 Y 座標
  550.   #     width : 幅
  551.   #------------------------------------------------------------

  552. --------------
  553.   def draw_actor_ep_gauge(actor, x, y, width = 120)
  554.     gw = width * actor.ep / [actor.maxep, 1].max
  555.     gc1 = ep_gauge_color1
  556.     gc2 = ep_gauge_color2
  557.     self.contents.fill_rect(x, y + WLH - 8, width, 6,

  558. gauge_back_color)
  559.     self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1,

  560. gc2)
  561.   end
  562.   #------------------------------------------------------------

  563. --------------
  564.   # ○ 消費 EP の描画
  565.   #     item    : 武器 or 防具
  566.   #     rect    : 描画する領域
  567.   #     enabled : 許可状態
  568.   #------------------------------------------------------------

  569. --------------
  570.   def draw_equipment_ep_cost(item, rect, enabled = true)
  571.     return if item == nil
  572.     # 消費 EP 0 を表示しない場合
  573.     return if KGC::EquipExtension::HIDE_ZERO_EP_COST &&

  574. item.ep_cost == 0

  575.     color = KGC::EquipExtension::EP_COST_COLOR
  576.     self.contents.font.color = (color.is_a?(Integer) ?
  577.       text_color(color) : color)
  578.     self.contents.font.color.alpha = enabled ? 255 : 128
  579.     self.contents.draw_text(rect, item.ep_cost, 2)
  580.   end
  581. end

  582. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  583. ☆★☆★☆★☆★

  584. #===============================================================

  585. ===============
  586. # ■ Window_Equip
  587. #===============================================================

  588. ===============

  589. class Window_Equip < Window_Selectable
  590.   #------------------------------------------------------------

  591. --------------
  592.   # ● リフレッシュ
  593.   #------------------------------------------------------------

  594. --------------
  595.   def refresh
  596.     self.contents.clear
  597.     @data = @actor.equips.clone
  598.     @item_max = [@data.size, @actor.armor_number + 1].min
  599.     create_contents

  600.     # 装備箇所を描画
  601.     self.contents.font.color = system_color
  602.     if @actor.two_swords_style
  603.       self.contents.draw_text(4, WLH * 0, 92, WLH,

  604. Vocab::weapon1)
  605.       self.contents.draw_text(4, WLH * 1, 92, WLH,

  606. Vocab::weapon2)
  607.     else
  608.       self.contents.draw_text(4, WLH * 0, 92, WLH,

  609. Vocab::weapon)
  610.       name = armor_slot_name(@actor.equip_type[0])
  611.       self.contents.draw_text(4, WLH * 1, 92, WLH, name)
  612.     end
  613.     for i in 1...@actor.armor_number
  614.       name = armor_slot_name(@actor.equip_type[i])
  615.       self.contents.draw_text(4, WLH * (i + 1), 92, WLH, name)
  616.     end

  617.     # 装備品を描画
  618.     rect = Rect.new(92, 0, self.width - 128, WLH)
  619.     @item_max.times { |i|
  620.       rect.y = WLH * i
  621.       draw_item_name(@data[i], rect.x, rect.y)
  622.       draw_equipment_ep_cost(@data[i], rect)
  623.     }
  624.   end
  625.   #------------------------------------------------------------

  626. --------------
  627.   # ○ 防具欄の名称を取得
  628.   #     kind : 種別
  629.   #------------------------------------------------------------

  630. --------------
  631.   def armor_slot_name(kind)
  632.     case kind
  633.     when 0..3
  634.       return eval("Vocab.armor#{kind + 1}")
  635.     else
  636.       return Vocab.extra_armor(kind - 4)
  637.     end
  638.   end

  639. unless $imported["ExtendedEquipScene"]
  640.   #------------------------------------------------------------

  641. --------------
  642.   # ● カーソルを 1 ページ後ろに移動
  643.   #------------------------------------------------------------

  644. --------------
  645.   def cursor_pagedown
  646.     return if Input.repeat?(Input::R)
  647.     super
  648.   end
  649.   #------------------------------------------------------------

  650. --------------
  651.   # ● カーソルを 1 ページ前に移動
  652.   #------------------------------------------------------------

  653. --------------
  654.   def cursor_pageup
  655.     return if Input.repeat?(Input::L)
  656.     super
  657.   end
  658.   #------------------------------------------------------------

  659. --------------
  660.   # ● フレーム更新
  661.   #------------------------------------------------------------

  662. --------------
  663.   def update
  664.     super
  665.     return unless self.active

  666.     if Input.repeat?(Input::RIGHT)
  667.       cursor_pagedown
  668.     elsif Input.repeat?(Input::LEFT)
  669.       cursor_pageup
  670.     end
  671.   end
  672. end

  673. end

  674. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  675. ☆★☆★☆★☆★

  676. #===============================================================

  677. ===============
  678. # ■ Window_EquipItem
  679. #===============================================================

  680. ===============

  681. class Window_EquipItem < Window_Item
  682.   #------------------------------------------------------------

  683. --------------
  684.   # ● リフレッシュ
  685.   #------------------------------------------------------------

  686. --------------
  687.   def refresh
  688.     @item_enabled = []
  689.     super
  690.     @data.each { |item| @item_enabled << enable?(item) }
  691.   end
  692.   #------------------------------------------------------------

  693. --------------
  694.   # ● アイテムをリストに含めるかどうか
  695.   #     item : アイテム
  696.   #------------------------------------------------------------

  697. --------------
  698.   def include?(item)
  699.     return true if item == nil
  700.     if @equip_type == 0
  701.       return false unless item.is_a?(RPG::Weapon)
  702.     else
  703.       return false unless item.is_a?(RPG::Armor)
  704.       return false unless item.kind == @equip_type - 1
  705.     end
  706.     return @actor.equippable?(item)
  707.   end
  708.   #------------------------------------------------------------

  709. --------------
  710.   # ● アイテムを許可状態で表示するかどうか
  711.   #     item : アイテム
  712.   #------------------------------------------------------------

  713. --------------
  714.   def enable?(item)
  715.     return false unless @actor.equippable?(item)                 

  716.      # 装備不可
  717.     return false unless @actor.ep_condition_clear?(@equip_type,

  718. item)  # EP 不足

  719.     return true
  720.   end
  721.   #------------------------------------------------------------

  722. --------------
  723.   # ● 項目の描画
  724.   #     index : 項目番号
  725.   #------------------------------------------------------------

  726. --------------
  727.   def draw_item(index)
  728.     super(index)   
  729.     rect = item_rect(index)
  730.     item = @data[index]

  731.     # 個数表示分の幅を削る
  732.     cw = self.contents.text_size(sprintf(":%2d", 0)).width
  733.     rect.width -= cw + 4
  734.     draw_equipment_ep_cost(item, rect, enable?(item))
  735.   end
  736.   #------------------------------------------------------------

  737. --------------
  738.   # ○ 簡易リフレッシュ
  739.   #     equip_type : 装備部位
  740.   #------------------------------------------------------------

  741. --------------
  742.   def simple_refresh(equip_type)
  743.     # 一時的に装備部位を変更
  744.     last_equip_type = @equip_type
  745.     @equip_type = equip_type

  746.     @data.each_with_index { |item, i|
  747.       # 許可状態が変化した項目のみ再描画
  748.       if enable?(item) != @item_enabled[i]
  749.         draw_item(i)
  750.         @item_enabled[i] = enable?(item)
  751.       end
  752.     }
  753.     # 装備部位を戻す
  754.     @equip_type = last_equip_type
  755.   end
  756. end

  757. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  758. ☆★☆★☆★☆★

  759. #===============================================================

  760. ===============
  761. # ■ Window_EquipStatus
  762. #===============================================================

  763. ===============

  764. class Window_EquipStatus < Window_Base
  765.   #------------------------------------------------------------

  766. --------------
  767.   # ● リフレッシュ
  768.   #------------------------------------------------------------

  769. --------------
  770.   alias refresh_KGC_EquipExtension refresh
  771.   def refresh
  772.     refresh_KGC_EquipExtension

  773.     draw_actor_ep(@actor, 120, 0, 56) if

  774. KGC::EquipExtension::USE_EP_SYSTEM
  775.   end
  776. end

  777. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  778. ☆★☆★☆★☆★

  779. #===============================================================

  780. ===============
  781. # ■ Window_Status
  782. #===============================================================

  783. ===============

  784. class Window_Status < Window_Base

  785. if KGC::EquipExtension::SHOW_STATUS_EP
  786.   #------------------------------------------------------------

  787. --------------
  788.   # ● 基本情報の描画
  789.   #     x : 描画先 X 座標
  790.   #     y : 描画先 Y 座標
  791.   #------------------------------------------------------------

  792. --------------
  793.   alias draw_basic_info_KGC_EquipExtension draw_basic_info
  794.   def draw_basic_info(x, y)
  795.     draw_basic_info_KGC_EquipExtension(x, y)

  796.     draw_actor_ep(@actor, x + 160, y + WLH * 4)
  797.   end
  798. end

  799.   #------------------------------------------------------------

  800. --------------
  801.   # ● 装備品の描画
  802.   #     x : 描画先 X 座標
  803.   #     y : 描画先 Y 座標
  804.   #------------------------------------------------------------

  805. --------------
  806.   def draw_equipments(x, y)
  807.     self.contents.font.color = system_color
  808.     self.contents.draw_text(x, y, 120, WLH, Vocab::equip)

  809.     item_number = [@actor.equips.size, @actor.armor_number +

  810. 1].min
  811.     item_number.times { |i|
  812.       draw_item_name(@actor.equips[i], x + 16, y + WLH * (i +

  813. 1))
  814.     }
  815.   end
  816. end

  817. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  818. ☆★☆★☆★☆★

  819. #===============================================================

  820. ===============
  821. # ■ Scene_Equip
  822. #===============================================================

  823. ===============

  824. class Scene_Equip < Scene_Base
  825.   #------------------------------------------------------------

  826. --------------
  827.   # ● 定数
  828.   #------------------------------------------------------------

  829. --------------
  830.   EQUIP_TYPE_MAX = KGC::EquipExtension::EXTRA_EQUIP_KIND.size +

  831. 5
  832.   #------------------------------------------------------------

  833. --------------
  834.   # ● オブジェクト初期化
  835.   #     actor_index : アクターインデックス
  836.   #     equip_index : 装備インデックス
  837.   #------------------------------------------------------------

  838. --------------
  839.   alias initialize_KGC_EquipExtension initialize
  840.   def initialize(actor_index = 0, equip_index = 0)
  841.     initialize_KGC_EquipExtension(actor_index, equip_index)

  842.     unit = ($imported["LargeParty"] ?
  843.       $game_party.all_members : $game_party.members)
  844.     actor = unit[actor_index]
  845.     @equip_index = [@equip_index, actor.armor_number].min
  846.   end
  847.   #------------------------------------------------------------

  848. --------------
  849.   # ● アイテムウィンドウの作成
  850.   #------------------------------------------------------------

  851. --------------
  852.   alias create_item_windows_KGC_EquipExtension

  853. create_item_windows
  854.   def create_item_windows
  855.     create_item_windows_KGC_EquipExtension

  856.     kind = equip_kind(@equip_index)
  857.     EQUIP_TYPE_MAX.times { |i|
  858.       @item_windows[i].visible = (kind == i)
  859.     }
  860.   end
  861.   #------------------------------------------------------------

  862. --------------
  863.   # ● アイテムウィンドウの更新
  864.   #------------------------------------------------------------

  865. --------------
  866.   def update_item_windows
  867.     kind = equip_kind(@equip_window.index)
  868.     for i in 0...EQUIP_TYPE_MAX
  869.       @item_windows[i].visible = (kind == i)
  870.       @item_windows[i].update
  871.     end
  872.     @item_window = @item_windows[kind]
  873.     @item_window.simple_refresh(@equip_window.index)
  874.   end
  875.   #------------------------------------------------------------

  876. --------------
  877.   # ○ 装備欄の種別を取得
  878.   #     index : 装備欄インデックス
  879.   #------------------------------------------------------------

  880. --------------
  881.   def equip_kind(index)
  882.     if index == 0
  883.       return 0
  884.     else
  885.       return @actor.equip_type[index - 1] + 1
  886.     end
  887.   end

  888. unless $imported["ExtendedEquipScene"]
  889.   #------------------------------------------------------------

  890. --------------
  891.   # ● ステータスウィンドウの更新
  892.   #------------------------------------------------------------

  893. --------------
  894.   def update_status_window
  895.     if @equip_window.active
  896.       @status_window.set_new_parameters(nil, nil, nil, nil)
  897.     elsif @item_window.active
  898.       temp_actor = Marshal.load(Marshal.dump(@actor))
  899.       temp_actor.change_equip(@equip_window.index,

  900. @item_window.item, true)
  901.       new_atk = temp_actor.atk
  902.       new_def = temp_actor.def
  903.       new_spi = temp_actor.spi
  904.       new_agi = temp_actor.agi
  905.       @status_window.set_new_parameters(new_atk, new_def,

  906. new_spi, new_agi)
  907.     end
  908.     @status_window.update
  909.   end
  910. end

  911.   #------------------------------------------------------------

  912. --------------
  913.   # ● アイテム選択の更新
  914.   #------------------------------------------------------------

  915. --------------
  916.   alias update_item_selection_KGC_EquipExtension

  917. update_item_selection
  918.   def update_item_selection
  919.     if Input.trigger?(Input::C)
  920.       # 装備不可能な場合
  921.       index = @equip_window.index
  922.       item = @item_window.item
  923.       unless item == nil ||
  924.           (@actor.equippable?(item) &&

  925. @actor.ep_condition_clear?(index, item))
  926.         Sound.play_buzzer
  927.         return
  928.       end
  929.     end

  930.     update_item_selection_KGC_EquipExtension
  931.   end
  932. end

  933. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  934. ☆★☆★☆★☆★

  935. #===============================================================

  936. ===============
  937. # ■ Scene_File
  938. #===============================
复制代码


这个脚本和我的装备等级能力限制脚本放一起就冲突

貌似新扩张的装备无法调用到自定义的函数,比如
class RPG::BaseItem

  def LVlimit
……
这样def 的东西无法使用,为什么啊……
偶脚本懂得太少,居然看不懂扩张脚本是具体以什么形式生成新装备的,难道不再是BaseItem了吗?
麻烦达人指教~~给个线索提示什么的也行啊~~~~~
此贴于 2008-10-10 12:20:54 被版主八云紫提醒,请楼主看到后对本贴做出回应。
版务信息:版主帮忙结贴~
头像被屏蔽
梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-9-14
回帖
57
发表于 2008-9-14 09:29:10 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

梦石
0
星屑
50
在线时间
1 小时
注册时间
2008-8-3
回帖
947
 楼主| 发表于 2008-9-15 00:12:51 | 显示全部楼层
以下引用弑宁雷于2008-9-14 1:29:10的发言:

装備拡張和装备等级能力
会冲突人物等级吧
因为装備拡張会使能力值上限
刚刚好就和装备等级能力的等级能力冲突


不是这个原因吧
能力限制是限制裸体能力
回复

使用道具 举报

kissye的宠物<

梦石
0
星屑
66
在线时间
1564 小时
注册时间
2008-8-11
回帖
6023

贵宾

发表于 2008-9-15 00:20:02 | 显示全部楼层
哈哈,某人也在头疼这个问题········
回复

使用道具 举报

名侦探小柯

梦石
10
星屑
4410
在线时间
3740 小时
注册时间
2006-9-6
回帖
36596

极短27获奖MZ评测员开拓者贵宾第3届短篇游戏大赛主流游戏组亚军第5届短篇游戏比赛亚军

发表于 2008-9-15 00:21:30 | 显示全部楼层
是因为都改了装备窗口吧?
不定期回归 ~ 游戏开发之旅
———————————————————————————————
回复

使用道具 举报

梦石
0
星屑
50
在线时间
1 小时
注册时间
2008-8-3
回帖
947
 楼主| 发表于 2008-9-15 00:26:37 | 显示全部楼层
以下引用越前リョーマ于2008-9-14 16:21:30的发言:

是因为都改了装备窗口吧?


貌似不是……

出错是在执行 判断是否可以装备(Equipable)函数时 找不到等级限制函数LVlimit
回复

使用道具 举报

天仙

梦石
0
星屑
720
在线时间
184 小时
注册时间
2008-4-15
回帖
4872

贵宾

发表于 2008-9-15 05:35:45 | 显示全部楼层
话说我也正在找这个问题
不过稍有差别
在我汉化的战棋脚本里
我新添加进去的类定义竟然会覆盖掉旧定义
照理来说,应该是追加而已才对{/fd}
VA脚本开工中...
偷窃脚本1.0 - 已完成
回复

使用道具 举报

梦石
0
星屑
50
在线时间
1 小时
注册时间
2008-8-3
回帖
947
 楼主| 发表于 2008-10-10 21:04:12 | 显示全部楼层
最终是KISSYE姐解决了这个问题


KISS姐进来啊……

回复

使用道具 举报

神隐的主犯

梦石
0
星屑
553
在线时间
271 小时
注册时间
2008-2-22
回帖
7534

贵宾

发表于 2008-10-10 21:06:44 | 显示全部楼层
以下引用drgdrg于2008-10-10 13:04:12的发言:

最终是KISSYE姐解决了这个问题


KISS姐进来啊……


嘛,是啥原因???

《天空之城 —— 破碎的命运》
回复

使用道具 举报

kissye的宠物<

梦石
0
星屑
66
在线时间
1564 小时
注册时间
2008-8-11
回帖
6023

贵宾

发表于 2008-10-10 21:12:21 | 显示全部楼层
是为了认可kiss姐姐吧………


其实咱是kiss姐的马甲…认可我吧……
(被抽飞…)
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部