| 
 
| 赞 | 0 |  
| VIP | 10 |  
| 好人卡 | 5 |  
| 积分 | 1 |  
| 经验 | 5623 |  
| 最后登录 | 2020-11-14 |  
| 在线时间 | 84 小时 |  
 Lv1.梦旅人 
	梦石0 星屑65 在线时间84 小时注册时间2008-3-31帖子88 | 
| 本帖最后由 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
 
 估计这样可以了吧...
 | 
 评分
查看全部评分
 |