查看: 1231|回复: 0

改变装备的可装配方法

[复制链接]

闇吼者の災悪眷族

梦石
0
星屑
1366
在线时间
2881 小时
注册时间
2014-7-29
回帖
6408
发表于 2015-3-2 16:10:49 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 三途亚梦 于 2015-3-2 17:38 编辑

[pre lang="ruby"]#==============================================================================
# +++ 改变装备的装配方法 +++
#==============================================================================
# 作者 三途亚梦
# 如要使用此脚本,请署名。
# 脚本原地址:https://rpg.blue/thread-377080-1-1.html
#==============================================================================
# 本脚本的默认作用是让装备改成任意位置可装备,
# 然后通过在改变可更换列表的物品筛选方法来让装备限制装备在不正确的位置上。
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
#  管理角色的类。
#   本类在 Game_Actors 类 ($game_actors) 的内部使用。
#   具体使用请查看 Game_Party 类 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 更换装备
  #     slot_id : 装备栏 ID
  #     item    : 武器/护甲(为 nil 时装备解除)
  #--------------------------------------------------------------------------
  def change_equip(slot_id, item)
    return unless trade_item_with_party(item, equips[slot_id])
    @equips[slot_id].object = item
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 卸下无法装备的物品
  #     item_gain : 卸下的装备是否保留
  #--------------------------------------------------------------------------
  def release_unequippable_items(item_gain = true)
    @equips.each_with_index do |item, i|
      if !equippable?(item.object)
        trade_item_with_party(nil, item.object) if item_gain
        item.object = nil
      end
    end
  end
end
#==============================================================================
# ■ Window_EquipItem
#------------------------------------------------------------------------------
#  装备画面中,显示可替换装备的窗口。
#==============================================================================
class Window_EquipItem < Window_ItemList
  #--------------------------------------------------------------------------
  # ● 查询使用列表中是否含有此物品
  #--------------------------------------------------------------------------
  def include?(item)
    return true if item == nil
    return false if @slot_id == 0 && item.is_a?(RPG::Armor)
    return false unless item.is_a?(RPG::EquipItem)
    return false if @slot_id < 0
    return false if @slot_id != 0 && item.is_a?(RPG::Weapon)
    return @actor.equippable?(item)
  end
end[/pre]

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

在本发帖返回顶部