Project1
标题:
如何直接指定技能的命中率?
[打印本页]
作者:
xggzga117
时间:
2013-8-27 16:17
标题:
如何直接指定技能的命中率?
给每个技能强制单独指定,不用VA默认的算法。
作者:
z330843564
时间:
2013-8-27 18:25
我也在研究呀
作者:
490832999
时间:
2013-8-27 19:30
本帖最后由 490832999 于 2013-8-28 21:56 编辑
原脚本如下:
class Game_Battler
#--------------------------------------------------------------------------
# ● 应用技能/物品的效果
#--------------------------------------------------------------------------
def item_apply(user, item)
@result.clear
@result.used = item_test(user, item)
@result.missed = (@result.used && rand >= item_hit(user, item))
@result.evaded = (
[email protected]
&& 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
end
可以改成:
class Game_Battler
#--------------------------------------------------------------------------
# ● 应用技能/物品的效果
#--------------------------------------------------------------------------
def item_apply(user, item)
@result.clear
@result.used = item_test(user, item)
@result.missed = (@result.used && rand >= item_hit(user, item))
@result.evaded = (
[email protected]
&& rand < item_eva(user, item))
is_hit = @result.hit?
# 判断 item(这是一个RPG::Skill)
# 判断 item.name
# 1.使用默认命中,则is_hit = @result.hit?
# 2.使用自定义命中
# 3.在使用默认命中的基础上增加自定义命中,is_hit = (is_hit and/or 算定义命中)
case item.name
when "攻击","伤害类道具名称"
is_hit = (rand(100) < 50) #将 "攻击","伤害类道具名称" 的命中设为 50%
when "强击","火球","电击"
is_hit = (is_hit and (rand(100) < 50)) #将 "强击","火球","电击" 的命中设为 默认命中的一半
when "龙卷风"
is_hit = (is_hit or (user.agi > 100)) #将 "龙卷风" 的命中设为 若敏捷大于100则必中,否则按默认命中计算
end
# 以上没有提及的情况,全部按默认命中计算
if is_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
end
估计这样可以了吧...
作者:
xggzga117
时间:
2013-8-28 11:03
好的,我试试看。多谢。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1