| 赞 | 72 |
| VIP | |
| 好人卡 | |
| 积分 | 23 |
| 经验 | |
| 最后登录 | 2022-3-9 |
| 在线时间 | 4033 小时 |
…あたしは天
- 梦石
- 0
- 星屑
- 2308
- 在线时间
- 4033 小时
- 注册时间
- 2010-10-4
- 回帖
- 10548
 
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 taroxd 于 2014-10-2 21:04 编辑
[pre lang="ruby" line="1"]
#--------------------------------------------------------------------------
# ● require Taroxd基础设置
# 使用方法:技能/道具备注以下内容
# <unusable x> 或 <usable -x> :当 x 号开关开启时,技能/道具禁止使用
# <usable x> 或 <unusable -x> :当 x 号开关关闭时,技能/道具禁止使用
#--------------------------------------------------------------------------
class RPG::UsableItem < RPG::BaseItem
#--------------------------------------------------------------------------
# ● 获取开关 ID 构成的数组
#--------------------------------------------------------------------------
def unusable_switches
@unusable_switches ||=
@note.scan(/<(UN)?USABLE\s+(-*\d+)>/i).map {|(un, id)|
un ? id.to_i : -id.to_i }.uniq
end
end
class Game_BattlerBase
#--------------------------------------------------------------------------
# ● 检查技能/物品的使用条件
#--------------------------------------------------------------------------
id_ok = ->(id) { (id > 0) ^ $game_switches[id.abs] }
ok = ->(old, item) { old && item.unusable_switches.all?(&id_ok) }
def_with :usable_item_conditions_met?, ok
end[/pre] |
|