标题: 命中率更改问题。 [打印本页] 作者: 逆天RPG 时间: 2011-7-22 17:14 标题: 命中率更改问题。 def calc_hit(user, obj = nil)
if obj == nil # for a normal attack
hit = user.hit + user.agi - self.agi # get hit ratio
physical = true
elsif obj.is_a?(RPG::Skill) # for a skill
if obj.hit = 100
hit = 100
else
hit = obj.hit + user.agi - self.agi # 获取命中率
end # get success rate
physical = obj.physical_attack
else # for an item
hit = 100 # the hit ratio is made 100%
physical = obj.physical_attack
end
if physical # for a physical attack
hit /= 4 if user.reduce_hit_ratio? # when the user is blinded
end
return hit
end