#============================================================================== # 防御装備が種類による制限がなくなるスクリプト。 # 装飾品は何種類でも装備できますが、 # 他の装備は重ねて装備する事はできません。 # # Ver1.01 ショップのステータス欄が同じ種類の装備が表示されるように修正 # 以下、競合チェック用。 # 再定義一覧 # Window_EquipItem の include? # Window_ShopStatus の draw_actor_parameter_change # # 新しく定義したメソ一覧 # Game_Actor の equippable_type? # Game_Actor の gain_kind_armor #============================================================================== class Window_EquipItem < Window_Item #-------------------------------------------------------------------------- # ● アイテムをリストに含めるかどうか # item : アイテム #  ※再定義 #-------------------------------------------------------------------------- def include?(item) return true if item == nil if @equip_type == 0 return false unless item.is_a?(RPG::Weapon) else return false unless item.is_a?(RPG::Armor) #return false unless item.kind == @equip_type - 1#種類制限をコメントアウト end return @actor.equippable?(item) end #-------------------------------------------------------------------------- # ● アイテムを許可状態で表示するかどうか # item : アイテム #-------------------------------------------------------------------------- alias enb enable? def enable?(item) if not @actor.equippable_type?(item,@equip_type) return false end return enb(item) end end class Game_Actor def equippable_type?(item,equip_type)#装備タイプがかぶらないかチェック return true if item.is_a?(RPG::Weapon) or item == nil #武器等は弾く return true if item.kind == 3 #無制限装備可能な防具 armors = [@armor1_id,@armor2_id,@armor3_id,@armor4_id] armors.delete_at(equip_type-1) #変更する装備は除去 for equip_id in armors equip = $data_armors[equip_id] next if equip == nil return false if equip.kind == item.kind end return true end def gain_kind_armor(equip_type) result = armors.compact return nil if result.size == 0 return result.find{|a|a.kind == equip_type} end end class Scene_Equip < Scene_Base #-------------------------------------------------------------------------- #装備種類が被った場合は、あらかじめ本処理の前に弾く。 alias uis update_item_selection def update_item_selection if Input.trigger?(Input::C) if not @actor.equippable_type?(@item_window.item,@equip_window.index) Sound.play_buzzer return end end uis end end class Window_ShopStatus < Window_Base #-------------------------------------------------------------------------- # ● アクターの現装備と能力値変化の描画 ※再定義 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_actor_parameter_change(actor, x, y) return if @item.is_a?(RPG::Item) enabled = actor.equippable?(@item) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x, y, 200, WLH, actor.name) if @item.is_a?(RPG::Weapon) item1 = weaker_weapon(actor) elsif actor.two_swords_style and @item.kind == 0 item1 = nil else item1 = actor.gain_kind_armor(@item.kind) #actor.equips[1 + @item.kind] end if enabled if @item.is_a?(RPG::Weapon) atk1 = item1 == nil ? 0 : item1.atk atk2 = @item == nil ? 0 : @item.atk change = atk2 - atk1 else def1 = item1 == nil ? 0 : item1.def def2 = @item == nil ? 0 : @item.def change = def2 - def1 end self.contents.draw_text(x, y, 200, WLH, sprintf("%+d", change), 2) end draw_item_name(item1, x, y + WLH, enabled) end end