| 赞 | 7 |
| VIP | |
| 好人卡 | |
| 积分 | 15 |
| 经验 | |
| 最后登录 | 2026-6-20 |
| 在线时间 | 815 小时 |
- 梦石
- 0
- 星屑
- 1461
- 在线时间
- 815 小时
- 注册时间
- 2013-8-3
- 回帖
- 355
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
限制物品使用次数
[pre lang="ruby"]#--------------------------------------------------------------------------
# ● 技能/物品的应用测试and
# 如果使用目标的 HP 或者 MP 全满时,禁止使用恢复道具。
#--------------------------------------------------------------------------
def item_test(user, item)
if item.is_a?(RPG::Item) and [13,14,15,16,17,18,19,20].include?(item.id) and item.is_a?(RPG::Item)
$使用次数 = [] if $使用次数 == nil
$使用次数[self.id] = 0 if $使用次数[self.id] == nil
return false if $使用次数[self.id] >99
end[/pre]
[pre lang="ruby"] #--------------------------------------------------------------------------
# ● 应用技能/物品的效果
#--------------------------------------------------------------------------
def item_apply(user, item)
$使用次数[self.id] += 1 if self.actor? and $使用次数[self.id] <= 100
@result.clear
@result.used = item_test(user, item)
@result.missed = (@result.used && rand >= item_hit(user, item))
@result.evaded = (!@result.missed && rand < item_eva(user, item))
if @result.hit?
unless item.damage.none?
@result.critical = (rand < item_cri(user, item))
make_damage_value(user, item)
execute_damage(user)
end
item.effects.each {|effect| item_effect_apply(user, item, effect) }
item_user_effect(user, item)
end
end[/pre]
这项会报错 $使用次数[self.id] += 1 if self.actor? and $使用次数[self.id] <= 100 |
|