设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1748|回复: 3
打印 上一主题 下一主题

[已经过期] 如何直接指定技能的命中率?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
170
在线时间
227 小时
注册时间
2011-5-19
帖子
736
跳转到指定楼层
1
发表于 2013-8-27 16:17:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
给每个技能强制单独指定,不用VA默认的算法。
休息中……

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1 小时
注册时间
2012-8-17
帖子
11
2
发表于 2013-8-27 18:25:56 | 只看该作者
我也在研究呀

评分

参与人数 1星屑 -50 收起 理由
Mic_洛洛 -50 灌水自重!

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
65
在线时间
84 小时
注册时间
2008-3-31
帖子
88
3
发表于 2013-8-27 19:30:27 | 只看该作者
本帖最后由 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

估计这样可以了吧...

点评

我再试试看。  发表于 2013-8-29 20:10
s_hit? = @result.hit?这一行报错。  发表于 2013-8-28 20:04
我也试过了...没事呢...你提示什么错误?  发表于 2013-8-28 18:30
加进去以后504行报错,求解。  发表于 2013-8-28 15:02
要避免 行动命令.道具名称.技能名称.重复  发表于 2013-8-27 19:34

评分

参与人数 1星屑 +6 收起 理由
xggzga117 + 6 糖。

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
170
在线时间
227 小时
注册时间
2011-5-19
帖子
736
4
 楼主| 发表于 2013-8-28 11:03:31 | 只看该作者
好的,我试试看。多谢。

点评

额...把 is_hit? 都改成 is_hit 吧....晕,变量不能带问号...  发表于 2013-8-28 21:55
提示是什么? 即跳错时,窗口内容...  发表于 2013-8-28 21:52
我也试过了...没事呢...你提示什么错误?  发表于 2013-8-28 18:29
休息中……
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-27 10:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表