如果需要添加多个这种类型的状态的话,是否复制一遍就可以了?
(就像这样)
def calc_hit(user, obj = nil)
if obj == nil # 普通攻击
hit = user.hit # 获取命中率
physical = true
elsif obj.is_a?(RPG::Skill) # 技能攻击
hit = obj.hit # 获取命中率
hit = 90 if obj.id == 技能ID and user.state?(状态ID) # 加上这一句,技能和状态的ID自己写...
hit = 90 if obj.id == 技能ID and user.state?(状态ID) # 加上这一句,技能和状态的ID自己写...
physical = obj.physical_attack
else # 物品攻击
hit = 100 # 设命中率为100%
physical = obj.physical_attack
end
if physical # 物理攻击
hit /= 4 if user.reduce_hit_ratio? # 中了暗黑状态时命中率降低为25%
end
return hit
end