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

Project1

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

怎样增加装备栏?

 关闭 [复制链接]

Lv3.寻梦者

贝鲁耶的依叶森林
持镰的苍色水野

梦石
2
星屑
659
在线时间
563 小时
注册时间
2007-4-8
帖子
1304

第4届短篇游戏比赛季军短篇八RM组亚军

跳转到指定楼层
1
发表于 2008-3-28 21:16:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
1、让装饰品变成2个。
2、新增加一个装备栏  例如“脚部”
版务信息:本贴由楼主自主结贴~
水野的主页><
头像来自于游戏《龙背上的骑兵3》主角——Zero

Lv2.观梦者

神隐的主犯

梦石
0
星屑
278
在线时间
271 小时
注册时间
2008-2-22
帖子
7691

贵宾

2
发表于 2008-3-28 21:36:20 | 只看该作者
嘛,这个。

  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆ 装備拡張 - KGC_EquipExtension ◆ VX ◆
  3. #_/    ◇ Last update : 2008/02/10 ◇
  4. #_/----------------------------------------------------------------------------
  5. #_/  装備関連の機能を拡張します。
  6. #_/============================================================================
  7. #_/ 【メニュー】≪拡張装備画面≫ より下に導入してください。
  8. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

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

  12. module KGC
  13. module EquipExtension
  14.   # ◆ 拡張装備種別
  15.   #  先頭から順に 4, 5, 6, ... が割り当てられる。
  16.   EXTRA_EQUIP_KIND = ["足", "技能書"]

  17.   # ◆ 装備箇所リスト
  18.   #  武器の後に、ここで指定した順番で並ぶ。
  19.   #  ※ 装備箇所が最低一つないと、二刀流がバグる可能性があります。
  20.   #   ** 装備種別一覧 **
  21.   #  0..盾  1..頭  2..身体  3..装飾品  4~..↑で定義
  22.   EQUIP_TYPE = [0, 1, 2, 4, 3, 3, 5]

  23.   # ◆ EP (Equip Point) 制を使用する
  24.   USE_EP_SYSTEM = false
  25.   # ◆ EP の名前
  26.   VOCAB_EP   = "EP"
  27.   # ◆ EP の名前 (略)
  28.   VOCAB_EP_A = "E"
  29.   # ◆ ステータス画面に EP を表示する
  30.   SHOW_STATUS_EP = false

  31.   # ◆ 消費 EP 既定値
  32.   #  消費 EP が指定されていない装備品で使用。
  33.   DEFAULT_EP_COST   = 1
  34.   # ◆ 消費 EP 0 は表示しない
  35.   HIDE_ZERO_EP_COST = false

  36.   # ◆ EP 上限
  37.   EP_MAX = 20
  38.   # ◆ EP 下限
  39.   EP_MIN = 5
  40.   # ◆ 最大 EP 算出式
  41.   #   level..アクターのレベル
  42.   #  自動的に整数変換されるので、結果が小数になってもOK。
  43.   EP_CALC_EXP = "level * 0.3 + 4"

  44.   # ◆ 消費 EP 値の色 (アイテム名の末尾に付く数値)
  45.   #  数値  : \C[n] と同じ色。
  46.   #  Color : 指定した色。 ( Color.new(128, 255, 255) など )
  47.   EP_COST_COLOR        = 23
  48.   # ◆ EP ゲージの開始色
  49.   EP_GAUGE_START_COLOR = 28
  50.   # ◆ EP ゲージの終了色
  51.   EP_GAUGE_END_COLOR   = 29
  52. end
  53. end

  54. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  55. $imported = {} if $imported == nil
  56. $imported["EquipExtension"] = true

  57. module KGC::EquipExtension
  58.   # EP 制を使用しない場合の設定
  59.   unless USE_EP_SYSTEM
  60.     SHOW_STATUS_EP = false
  61.     HIDE_ZERO_EP_COST = true
  62.   end

  63.   # 正規表現
  64.   module Regexp
  65.     # ベースアイテム
  66.     module BaseItem
  67.       # 消費 EP
  68.       EP_COST = /<EP\s*(\d+)>/i
  69.       # 装備タイプ
  70.       EQUIP_TYPE = /<(?:EQUIP_TYPE|装備タイプ)\s*(\d+(?:\s*,\s*\d+)*)>/
  71.     end

  72.     # 防具
  73.     module Armor
  74.       # 装備種別
  75.       EQUIP_KIND = /<(?:EQUIP_KIND|装備種別)\s*(.+)>/i
  76.     end
  77.   end
  78. end

  79. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  80. #==============================================================================
  81. # □ KGC::Commands
  82. #==============================================================================

  83. module KGC::Commands
  84.   module_function
  85.   #--------------------------------------------------------------------------
  86.   # ○ アクターの装備を修復
  87.   #--------------------------------------------------------------------------
  88.   def restore_equip
  89.     (1...$data_actors.size).each { |i|
  90.       actor = $game_actors[i]
  91.       actor.restore_equip
  92.     }
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ○ アクターの装備タイプを設定
  96.   #     actor_id   : アクター ID
  97.   #     equip_type : 装備タイプ
  98.   #--------------------------------------------------------------------------
  99.   def set_actor_equip_type(actor_id, equip_type = nil)
  100.     actor = $game_actors[actor_id]
  101.     return if actor == nil
  102.     actor.equip_type = equip_type
  103.   end
  104. end

  105. class Game_Interpreter
  106.   include KGC::Commands
  107. end

  108. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  109. #==============================================================================
  110. # ■ Vocab
  111. #==============================================================================

  112. module Vocab
  113.   # EP
  114.   def self.ep
  115.     return KGC::EquipExtension::VOCAB_EP
  116.   end

  117.   # EP (略)
  118.   def self.ep_a
  119.     return KGC::EquipExtension::VOCAB_EP_A
  120.   end

  121.   # 拡張防具欄
  122.   def self.extra_armor(index)
  123.     return KGC::EquipExtension::EXTRA_EQUIP_KIND[index]
  124.   end
  125. end

  126. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  127. #==============================================================================
  128. # ■ RPG::BaseItem
  129. #==============================================================================

  130. class RPG::BaseItem
  131.   #--------------------------------------------------------------------------
  132.   # ○ 装備拡張のキャッシュを作成
  133.   #--------------------------------------------------------------------------
  134.   def create_equip_extension_cache

  135.     @__ep_cost = KGC::EquipExtension::DEFAULT_EP_COST
  136.     @__equip_type = []

  137.     self.note.split(/[\r\n]+/).each { |line|
  138.       case line
  139.       when KGC::EquipExtension::Regexp::BaseItem::EP_COST
  140.         # 消費 EP
  141.         @__ep_cost = $1.to_i
  142.       when KGC::EquipExtension::Regexp::BaseItem::EQUIP_TYPE
  143.         # 装備タイプ
  144.         @__equip_type = []
  145.         $1.scan(/\d+/) { |num|
  146.           @__equip_type << num.to_i
  147.         }
  148.       end
  149.     }

  150.     # EP 制を使用しない場合は消費 EP = 0
  151.     @__ep_cost = 0 unless KGC::EquipExtension::USE_EP_SYSTEM
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ○ 消費 EP
  155.   #--------------------------------------------------------------------------
  156.   def ep_cost
  157.     create_equip_extension_cache if @__ep_cost == nil
  158.     return @__ep_cost
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ○ 装備タイプ
  162.   #--------------------------------------------------------------------------
  163.   def equip_type
  164.     create_equip_extension_cache if @__equip_type == nil
  165.     return @__equip_type
  166.   end
  167. end

  168. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  169. #==============================================================================
  170. # ■ RPG::Armor
  171. #==============================================================================

  172. class RPG::Armor < RPG::BaseItem
  173.   #--------------------------------------------------------------------------
  174.   # ○ 装備拡張のキャッシュを作成
  175.   #--------------------------------------------------------------------------
  176.   def create_equip_extension_cache
  177.     super
  178.     @__kind = -1

  179.     self.note.split(/[\r\n]+/).each { |line|
  180.       if line =~ KGC::EquipExtension::Regexp::Armor::EQUIP_KIND
  181.         # 装備タイプ
  182.         e_index = KGC::EquipExtension::EXTRA_EQUIP_KIND.index($1)
  183.         next if e_index == nil
  184.         @__kind = e_index + 4
  185.       end
  186.     }
  187.   end

  188. unless $@
  189.   #--------------------------------------------------------------------------
  190.   # ○ 種別
  191.   #--------------------------------------------------------------------------
  192.   alias kind_KGC_EquipExtension kind
  193.   def kind
  194.     create_equip_extension_cache if @__kind == nil
  195.     return (@__kind == -1 ? kind_KGC_EquipExtension : @__kind)
  196.   end
  197. end

  198. end

  199. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  200. #==============================================================================
  201. # ■ Game_Actor
  202. #==============================================================================

  203. class Game_Actor < Game_Battler
  204.   #--------------------------------------------------------------------------
  205.   # ● 公開インスタンス変数
  206.   #--------------------------------------------------------------------------
  207.   attr_writer   :equip_type               # 装備タイプ
  208.   #--------------------------------------------------------------------------
  209.   # ● セットアップ
  210.   #     actor_id : アクター ID
  211.   #--------------------------------------------------------------------------
  212.   alias setup_KGC_EquipExtension setup
  213.   def setup(actor_id)
  214.     actor = $data_actors[actor_id]
  215.     @extra_armor_id = []

  216.     setup_KGC_EquipExtension(actor_id)

  217.     restore_equip
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ○ MaxEP 取得
  221.   #--------------------------------------------------------------------------
  222.   def maxep
  223.     n = Integer(eval(KGC::EquipExtension::EP_CALC_EXP))
  224.     return [[n, ep_limit].min, KGC::EquipExtension::EP_MIN].max
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ○ EP 取得
  228.   #--------------------------------------------------------------------------
  229.   def ep
  230.     n = 0
  231.     equips.compact.each { |item| n += item.ep_cost }
  232.     return [maxep - n, 0].max
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   # ○ EP 上限取得
  236.   #--------------------------------------------------------------------------
  237.   def ep_limit
  238.     return KGC::EquipExtension::EP_MAX
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ○ 防具欄の取得
  242.   #--------------------------------------------------------------------------
  243.   def equip_type
  244.     if @equip_type.is_a?(Array)
  245.       return @equip_type
  246.     else
  247.       return KGC::EquipExtension::EQUIP_TYPE
  248.     end
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ○ 防具欄の数
  252.   #--------------------------------------------------------------------------
  253.   def armor_number
  254.     return equip_type.size
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # ○ 拡張防具欄の数
  258.   #--------------------------------------------------------------------------
  259.   def extra_armor_number
  260.     return [armor_number - 4, 0].max
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ○ 防具 ID リストの取得
  264.   #--------------------------------------------------------------------------
  265.   def extra_armor_id
  266.     @extra_armor_id = [] if @extra_armor_id == nil
  267.     return @extra_armor_id
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● 防具オブジェクトの配列取得
  271.   #--------------------------------------------------------------------------
  272.   alias armors_KGC_EquipExtension armors
  273.   def armors
  274.     result = armors_KGC_EquipExtension

  275.     # 5番目以降の防具を追加
  276.     extra_armor_number.times { |i|
  277.       armor_id = extra_armor_id[i]
  278.       result << (armor_id == nil ? nil : $data_armors[armor_id])
  279.     }
  280.     return result
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ● 装備の変更 (オブジェクトで指定)
  284.   #     equip_type : 装備部位
  285.   #     item       : 武器 or 防具 (nil なら装備解除)
  286.   #     test       : テストフラグ (戦闘テスト、または装備画面での一時装備)
  287.   #--------------------------------------------------------------------------
  288.   alias change_equip_KGC_EquipExtension change_equip
  289.   def change_equip(equip_type, item, test = false)
  290.     change_equip_KGC_EquipExtension(equip_type, item, test)

  291.     # 拡張防具欄がある場合のみ
  292.     if extra_armor_number > 0
  293.       item_id = item == nil ? 0 : item.id
  294.       case equip_type
  295.       when 5..armor_number  # 拡張防具欄
  296.         @extra_armor_id = [] if @extra_armor_id == nil
  297.         @extra_armor_id[equip_type - 5] = item_id
  298.       end
  299.     end

  300.     restore_battle_skill if $imported["SkillCPSystem"]
  301.     restore_passive_rev  if $imported["PassiveSkill"]
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ● 装備の破棄
  305.   #     item : 破棄する武器 or 防具
  306.   #    武器/防具の増減で「装備品も含める」のとき使用する。
  307.   #--------------------------------------------------------------------------
  308.   alias discard_equip_KGC_EquipExtension discard_equip
  309.   def discard_equip(item)
  310.     last_armors = [@armor1_id, @armor2_id, @armor3_id, @armor4_id]

  311.     discard_equip_KGC_EquipExtension(item)

  312.     curr_armors = [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
  313.     return unless item.is_a?(RPG::Armor)  # 防具でない
  314.     return if last_armors != curr_armors  # 既に破棄された

  315.     # 拡張防具欄を検索
  316.     extra_armor_number.times { |i|
  317.       if extra_armor_id[i] == item.id
  318.         @extra_armor_id[i] = 0
  319.         break
  320.       end
  321.     }

  322.     restore_battle_skill if $imported["SkillCPSystem"]
  323.     restore_passive_rev  if $imported["PassiveSkill"]
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # ● 職業 ID の変更
  327.   #     class_id : 新しい職業 ID
  328.   #--------------------------------------------------------------------------
  329.   alias class_id_equal_KGC_EquipExtension class_id=
  330.   def class_id=(class_id)
  331.     class_id_equal_KGC_EquipExtension(class_id)

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

  333.     # 装備できない拡張防具を外す
  334.     for i in 5..armor_number
  335.       change_equip(i, nil) unless equippable?(equips[i])
  336.     end
  337.   end
  338.   #--------------------------------------------------------------------------
  339.   # ○ EP 条件クリア判定
  340.   #     equip_type : 装備部位
  341.   #     item       : 武器 or 防具
  342.   #--------------------------------------------------------------------------
  343.   def ep_condition_clear?(equip_type, item)
  344.     return true if item == nil  # nil は解除なので OK

  345.     curr_item = equips[equip_type]
  346.     offset = (curr_item != nil ? curr_item.ep_cost : 0)
  347.     return false if self.ep < (item.ep_cost - offset)   # EP 不足

  348.     return true
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ○ 装備を修復
  352.   #--------------------------------------------------------------------------
  353.   def restore_equip
  354.     return if @__last_equip_type == equip_type

  355.     # 以前の装備品・パラメータを退避
  356.     last_equips = equips
  357.     last_hp = self.hp
  358.     last_mp = self.mp
  359.     if $imported["SkillCPSystem"]
  360.       last_battle_skill_ids = battle_skill_ids.clone
  361.     end

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

  364.     # 装備品・パラメータを復元
  365.     last_equips.compact.each { |item| equip_legal_slot(item) }
  366.     self.hp = last_hp
  367.     self.mp = last_mp
  368.     if $imported["SkillCPSystem"]
  369.       last_battle_skill_ids.each_with_index { |s, i| set_battle_skill(i, s) }
  370.     end
  371.     @__last_equip_type = equip_type.clone
  372.     Graphics.frame_reset
  373.   end
  374.   #--------------------------------------------------------------------------
  375.   # ○ 装備品を正しい箇所にセット
  376.   #     item : 武器 or 防具
  377.   #--------------------------------------------------------------------------
  378.   def equip_legal_slot(item)
  379.     if item.is_a?(RPG::Weapon)
  380.       if @weapon_id == 0
  381.         # 武器 1
  382.         change_equip(0, item)
  383.       elsif two_swords_style && @armor1_id == 0
  384.         # 武器 2 (二刀流の場合)
  385.         change_equip(1, item)
  386.       end
  387.     elsif item.is_a?(RPG::Armor)
  388.       if !two_swords_style && item.kind == equip_type[0] && @armor1_id == 0
  389.         # 先頭の防具 (二刀流でない場合)
  390.         change_equip(1, item)
  391.       else
  392.         # 装備箇所リストを作成
  393.         list = [-1, @armor2_id, @armor3_id, @armor4_id]
  394.         list += extra_armor_id
  395.         # 正しい、かつ空いている箇所にセット
  396.         equip_type.each_with_index { |kind, i|
  397.           if kind == item.kind && list[i] == 0
  398.             change_equip(i + 1, item)
  399.             break
  400.           end
  401.         }
  402.       end
  403.     end
  404.   end
  405. end

  406. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  407. #==============================================================================
  408. # ■ Window_Base
  409. #==============================================================================

  410. class Window_Base < Window
  411.   #--------------------------------------------------------------------------
  412.   # ○ EP の文字色を取得
  413.   #     actor : アクター
  414.   #--------------------------------------------------------------------------
  415.   def ep_color(actor)
  416.     return knockout_color if actor.maxep > 0 && actor.ep == 0
  417.     return normal_color
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # ○ EP ゲージの色 1 の取得
  421.   #--------------------------------------------------------------------------
  422.   def ep_gauge_color1
  423.     color = KGC::EquipExtension::EP_GAUGE_START_COLOR
  424.     return (color.is_a?(Integer) ? text_color(color) : color)
  425.   end
  426.   #--------------------------------------------------------------------------
  427.   # ○ EP ゲージの色 2 の取得
  428.   #--------------------------------------------------------------------------
  429.   def ep_gauge_color2
  430.     color = KGC::EquipExtension::EP_GAUGE_END_COLOR
  431.     return (color.is_a?(Integer) ? text_color(color) : color)
  432.   end
  433.   #--------------------------------------------------------------------------
  434.   # ○ EP の描画
  435.   #     actor : アクター
  436.   #     x     : 描画先 X 座標
  437.   #     y     : 描画先 Y 座標
  438.   #     width : 幅
  439.   #--------------------------------------------------------------------------
  440.   def draw_actor_ep(actor, x, y, width = 120)
  441.     draw_actor_ep_gauge(actor, x, y, width)
  442.     self.contents.font.color = system_color
  443.     self.contents.draw_text(x, y, 30, WLH, Vocab::ep_a)
  444.     self.contents.font.color = ep_color(actor)
  445.     xr = x + width
  446.     if width < 120
  447.       self.contents.draw_text(xr - 40, y, 40, WLH, actor.ep, 2)
  448.     else
  449.       self.contents.draw_text(xr - 90, y, 40, WLH, actor.ep, 2)
  450.       self.contents.font.color = normal_color
  451.       self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
  452.       self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxep, 2)
  453.     end
  454.     self.contents.font.color = normal_color
  455.   end
  456.   #--------------------------------------------------------------------------
  457.   # ○ EP ゲージの描画
  458.   #     actor : アクター
  459.   #     x     : 描画先 X 座標
  460.   #     y     : 描画先 Y 座標
  461.   #     width : 幅
  462.   #--------------------------------------------------------------------------
  463.   def draw_actor_ep_gauge(actor, x, y, width = 120)
  464.     gw = width * actor.ep / [actor.maxep, 1].max
  465.     gc1 = ep_gauge_color1
  466.     gc2 = ep_gauge_color2
  467.     self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
  468.     self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  469.   end
  470.   #--------------------------------------------------------------------------
  471.   # ○ 消費 EP の描画
  472.   #     item    : 武器 or 防具
  473.   #     rect    : 描画する領域
  474.   #     enabled : 許可状態
  475.   #--------------------------------------------------------------------------
  476.   def draw_equipment_ep_cost(item, rect, enabled = true)
  477.     return if item == nil
  478.     # 消費 EP 0 を表示しない場合
  479.     return if KGC::EquipExtension::HIDE_ZERO_EP_COST && item.ep_cost == 0

  480.     color = KGC::EquipExtension::EP_COST_COLOR
  481.     self.contents.font.color = (color.is_a?(Integer) ?
  482.       text_color(color) : color)
  483.     self.contents.font.color.alpha = enabled ? 255 : 128
  484.     self.contents.draw_text(rect, item.ep_cost, 2)
  485.   end
  486. end

  487. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  488. #==============================================================================
  489. # ■ Window_Equip
  490. #==============================================================================

  491. class Window_Equip < Window_Selectable
  492.   #--------------------------------------------------------------------------
  493.   # ● リフレッシュ
  494.   #--------------------------------------------------------------------------
  495.   def refresh
  496.     self.contents.clear
  497.     @data = @actor.equips.clone
  498.     @item_max = [@data.size, @actor.armor_number + 1].min
  499.     create_contents

  500.     # 装備箇所を描画
  501.     self.contents.font.color = system_color
  502.     if @actor.two_swords_style
  503.       self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon1)
  504.       self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::weapon2)
  505.     else
  506.       self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon)
  507.       name = armor_slot_name(@actor.equip_type[0])
  508.       self.contents.draw_text(4, WLH * 1, 92, WLH, name)
  509.     end
  510.     for i in [email protected]_number
  511.       name = armor_slot_name(@actor.equip_type[i])
  512.       self.contents.draw_text(4, WLH * (i + 1), 92, WLH, name)
  513.     end

  514.     # 装備品を描画
  515.     rect = Rect.new(92, 0, self.width - 128, WLH)
  516.     @item_max.times { |i|
  517.       rect.y = WLH * i
  518.       draw_item_name(@data[i], rect.x, rect.y)
  519.       draw_equipment_ep_cost(@data[i], rect)
  520.     }
  521.   end
  522.   #--------------------------------------------------------------------------
  523.   # ○ 防具欄の名称を取得
  524.   #     kind : 種別
  525.   #--------------------------------------------------------------------------
  526.   def armor_slot_name(kind)
  527.     case kind
  528.     when 0..3
  529.       return eval("Vocab.armor#{kind + 1}")
  530.     else
  531.       return Vocab.extra_armor(kind - 4)
  532.     end
  533.   end

  534. unless $imported["ExtendedEquipScene"]
  535.   #--------------------------------------------------------------------------
  536.   # ● カーソルを 1 ページ後ろに移動
  537.   #--------------------------------------------------------------------------
  538.   def cursor_pagedown
  539.     return if Input.repeat?(Input::R)
  540.     super
  541.   end
  542.   #--------------------------------------------------------------------------
  543.   # ● カーソルを 1 ページ前に移動
  544.   #--------------------------------------------------------------------------
  545.   def cursor_pageup
  546.     return if Input.repeat?(Input::L)
  547.     super
  548.   end
  549.   #--------------------------------------------------------------------------
  550.   # ● フレーム更新
  551.   #--------------------------------------------------------------------------
  552.   def update
  553.     super
  554.     return unless self.active

  555.     if Input.repeat?(Input::RIGHT)
  556.       cursor_pagedown
  557.     elsif Input.repeat?(Input::LEFT)
  558.       cursor_pageup
  559.     end
  560.   end
  561. end

  562. end

  563. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  564. #==============================================================================
  565. # ■ Window_EquipItem
  566. #==============================================================================

  567. class Window_EquipItem < Window_Item
  568.   #--------------------------------------------------------------------------
  569.   # ● リフレッシュ
  570.   #--------------------------------------------------------------------------
  571.   def refresh
  572.     @item_enabled = []
  573.     super
  574.     @data.each { |item| @item_enabled << enable?(item) }
  575.   end
  576.   #--------------------------------------------------------------------------
  577.   # ● アイテムをリストに含めるかどうか
  578.   #     item : アイテム
  579.   #--------------------------------------------------------------------------
  580.   def include?(item)
  581.     return true if item == nil
  582.     if @equip_type == 0
  583.       return false unless item.is_a?(RPG::Weapon)
  584.     else
  585.       return false unless item.is_a?(RPG::Armor)
  586.       return false unless item.kind == @equip_type - 1
  587.     end
  588.     return @actor.equippable?(item)
  589.   end
  590.   #--------------------------------------------------------------------------
  591.   # ● アイテムを許可状態で表示するかどうか
  592.   #     item : アイテム
  593.   #--------------------------------------------------------------------------
  594.   def enable?(item)
  595.     return false unless @actor.equippable?(item)                      # 装備不可
  596.     return false unless @actor.ep_condition_clear?(@equip_type, item)  # EP 不足

  597.     return true
  598.   end
  599.   #--------------------------------------------------------------------------
  600.   # ● 項目の描画
  601.   #     index : 項目番号
  602.   #--------------------------------------------------------------------------
  603.   def draw_item(index)
  604.     super(index)   
  605.     rect = item_rect(index)
  606.     item = @data[index]

  607.     # 個数表示分の幅を削る
  608.     cw = self.contents.text_size(sprintf(":%2d", 0)).width
  609.     rect.width -= cw + 4
  610.     draw_equipment_ep_cost(item, rect, enable?(item))
  611.   end
  612.   #--------------------------------------------------------------------------
  613.   # ○ 簡易リフレッシュ
  614.   #     equip_type : 装備部位
  615.   #--------------------------------------------------------------------------
  616.   def simple_refresh(equip_type)
  617.     # 一時的に装備部位を変更
  618.     last_equip_type = @equip_type
  619.     @equip_type = equip_type

  620.     @data.each_with_index { |item, i|
  621.       # 許可状態が変化した項目のみ再描画
  622.       if enable?(item) != @item_enabled[i]
  623.         draw_item(i)
  624.         @item_enabled[i] = enable?(item)
  625.       end
  626.     }
  627.     # 装備部位を戻す
  628.     @equip_type = last_equip_type
  629.   end
  630. end

  631. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  632. #==============================================================================
  633. # ■ Window_EquipStatus
  634. #==============================================================================

  635. class Window_EquipStatus < Window_Base
  636.   #--------------------------------------------------------------------------
  637.   # ● リフレッシュ
  638.   #--------------------------------------------------------------------------
  639.   alias refresh_KGC_EquipExtension refresh
  640.   def refresh
  641.     refresh_KGC_EquipExtension

  642.     draw_actor_ep(@actor, 120, 0, 56) if KGC::EquipExtension::USE_EP_SYSTEM
  643.   end
  644. end

  645. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  646. #==============================================================================
  647. # ■ Window_Status
  648. #==============================================================================

  649. class Window_Status < Window_Base

  650. if KGC::EquipExtension::SHOW_STATUS_EP
  651.   #--------------------------------------------------------------------------
  652.   # ● 基本情報の描画
  653.   #     x : 描画先 X 座標
  654.   #     y : 描画先 Y 座標
  655.   #--------------------------------------------------------------------------
  656.   alias draw_basic_info_KGC_EquipExtension draw_basic_info
  657.   def draw_basic_info(x, y)
  658.     draw_basic_info_KGC_EquipExtension(x, y)

  659.     draw_actor_ep(@actor, x + 160, y + WLH * 4)
  660.   end
  661. end

  662.   #--------------------------------------------------------------------------
  663.   # ● 装備品の描画
  664.   #     x : 描画先 X 座標
  665.   #     y : 描画先 Y 座標
  666.   #--------------------------------------------------------------------------
  667.   def draw_equipments(x, y)
  668.     self.contents.font.color = system_color
  669.     self.contents.draw_text(x, y, 120, WLH, Vocab::equip)

  670.     item_number = [@actor.equips.size, @actor.armor_number + 1].min
  671.     item_number.times { |i|
  672.       draw_item_name(@actor.equips[i], x + 16, y + WLH * (i + 1))
  673.     }
  674.   end
  675. end

  676. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  677. #==============================================================================
  678. # ■ Scene_Equip
  679. #==============================================================================

  680. class Scene_Equip < Scene_Base
  681.   #--------------------------------------------------------------------------
  682.   # ● 定数
  683.   #--------------------------------------------------------------------------
  684.   EQUIP_TYPE_MAX = KGC::EquipExtension::EXTRA_EQUIP_KIND.size + 5
  685.   #--------------------------------------------------------------------------
  686.   # ● オブジェクト初期化
  687.   #     actor_index : アクターインデックス
  688.   #     equip_index : 装備インデックス
  689.   #--------------------------------------------------------------------------
  690.   alias initialize_KGC_EquipExtension initialize
  691.   def initialize(actor_index = 0, equip_index = 0)
  692.     initialize_KGC_EquipExtension(actor_index, equip_index)

  693.     unit = ($imported["LargeParty"] ?
  694.       $game_party.all_members : $game_party.members)
  695.     actor = unit[actor_index]
  696.     @equip_index = [@equip_index, actor.armor_number].min
  697.   end
  698.   #--------------------------------------------------------------------------
  699.   # ● アイテムウィンドウの作成
  700.   #--------------------------------------------------------------------------
  701.   alias create_item_windows_KGC_EquipExtension create_item_windows
  702.   def create_item_windows
  703.     create_item_windows_KGC_EquipExtension

  704.     kind = equip_kind(@equip_index)
  705.     EQUIP_TYPE_MAX.times { |i|
  706.       @item_windows[i].visible = (kind == i)
  707.     }
  708.   end
  709.   #--------------------------------------------------------------------------
  710.   # ● アイテムウィンドウの更新
  711.   #--------------------------------------------------------------------------
  712.   def update_item_windows
  713.     kind = equip_kind(@equip_window.index)
  714.     for i in 0...EQUIP_TYPE_MAX
  715.       @item_windows[i].visible = (kind == i)
  716.       @item_windows[i].update
  717.     end
  718.     @item_window = @item_windows[kind]
  719.     @item_window.simple_refresh(@equip_window.index)
  720.   end
  721.   #--------------------------------------------------------------------------
  722.   # ○ 装備欄の種別を取得
  723.   #     index : 装備欄インデックス
  724.   #--------------------------------------------------------------------------
  725.   def equip_kind(index)
  726.     if index == 0
  727.       return 0
  728.     else
  729.       return @actor.equip_type[index - 1] + 1
  730.     end
  731.   end

  732. unless $imported["ExtendedEquipScene"]
  733.   #--------------------------------------------------------------------------
  734.   # ● ステータスウィンドウの更新
  735.   #--------------------------------------------------------------------------
  736.   def update_status_window
  737.     if @equip_window.active
  738.       @status_window.set_new_parameters(nil, nil, nil, nil)
  739.     elsif @item_window.active
  740.       temp_actor = Marshal.load(Marshal.dump(@actor))
  741.       temp_actor.change_equip(@equip_window.index, @item_window.item, true)
  742.       new_atk = temp_actor.atk
  743.       new_def = temp_actor.def
  744.       new_spi = temp_actor.spi
  745.       new_agi = temp_actor.agi
  746.       @status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)
  747.     end
  748.     @status_window.update
  749.   end
  750. end

  751.   #--------------------------------------------------------------------------
  752.   # ● アイテム選択の更新
  753.   #--------------------------------------------------------------------------
  754.   alias update_item_selection_KGC_EquipExtension update_item_selection
  755.   def update_item_selection
  756.     if Input.trigger?(Input::C)
  757.       # 装備不可能な場合
  758.       index = @equip_window.index
  759.       item = @item_window.item
  760.       unless item == nil ||
  761.           (@actor.equippable?(item) && @actor.ep_condition_clear?(index, item))
  762.         Sound.play_buzzer
  763.         return
  764.       end
  765.     end

  766.     update_item_selection_KGC_EquipExtension
  767.   end
  768. end

  769. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  770. #==============================================================================
  771. # ■ Scene_File
  772. #==============================================================================

  773. class Scene_File < Scene_Base
  774.   #--------------------------------------------------------------------------
  775.   # ● セーブデータの読み込み
  776.   #     file : 読み込み用ファイルオブジェクト (オープン済み)
  777.   #--------------------------------------------------------------------------
  778.   alias read_save_data_KGC_EquipExtension read_save_data
  779.   def read_save_data(file)
  780.     read_save_data_KGC_EquipExtension(file)

  781.     KGC::Commands.restore_equip
  782.     Graphics.frame_reset
  783.   end
  784. end
复制代码

用法是,在装备的备注上写上<EQUIP_KIND 足>等等。
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~

《天空之城 —— 破碎的命运》
回复 支持 反对

使用道具 举报

Lv1.梦旅人

很傻很天真

梦石
0
星屑
55
在线时间
3 小时
注册时间
2007-3-13
帖子
3667
3
发表于 2008-3-28 21:51:41 | 只看该作者
LS还有一行要改吧
  #   ** 装備種別一覧 **
  #  0..盾  1..頭  2..身体  3..装飾品  4~..↑で定義
  EQUIP_TYPE = [0, 1, 3, 4, ]   #这样是改装备位置  显示位置
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-28 06:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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