查看: 2830|回复: 3

[已经解决] 物理反击、魔法反射

[复制链接]
梦石
0
星屑
1461
在线时间
815 小时
注册时间
2013-8-3
回帖
355
发表于 2017-4-29 22:54:29 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 小小西 于 2017-4-30 13:48 编辑

很久以前把反击脚本改动了,默认反击是没受到伤害反击敌人,现在状况是:受到物理攻击受伤后再反击敌人,魔法反射也是先受伤再反射回去。
物理反击和魔法反射用的是同一个公式吗?

问题已解决。
[pre lang="ruby"] #--------------------------------------------------------------------------
    # ● 发动技能/物品
    #--------------------------------------------------------------------------

  def invoke_item(target, item)

    if rand < target.item_cnt(@subject, item)

      apply_item_effects(apply_substitute(target, item), item)  #如果删掉这行,触发物理反击时不会受伤

      invoke_counter_attack(target, item) if !(target.state?(1))  

    elsif rand < target.item_mrf(@subject, item)

      #apply_item_effects(apply_substitute(target, item), item)#如果删掉这行,触发魔法反射时不会受伤

      invoke_magic_reflection(target, item) if !(target.state?(1))

    else

      apply_item_effects(apply_substitute(target, item), item)

    end

    @subject.last_target_index = target.index

  end[/pre]

【同人游戏】勇者斗恶龙TG
欢迎加入游戏测试群333599798
如有需私聊请加QQ:516425000
梦石
0
星屑
644
在线时间
830 小时
注册时间
2016-7-24
回帖
644

开拓者

发表于 2017-4-30 00:19:59 | 显示全部楼层
上面都沒貼到核心方法我也不知道你改成怎樣(小聲)
[pre lang="ruby"]class Game_Battler < Game_BattlerBase
  def invoke_item(target, item)
    if rand < target.item_tct(@subject, item)
      apply_item_effects(apply_substitute(target, item), item)
      invoke_counter_attack(target, item)
    elsif rand < target.item_mrf(@subject, item)
      invoke_magic_reflection(target, item)
    else
      apply_item_effects(apply_substitute(target, item), item)
    end
    @subject.last_target_index = target.index
  end
end[/pre]

点评

隨便放代碼是新招嗎wwww  发表于 2017-4-30 21:13
我不知道在哪随便放了个代码,原来是多了一项,被我#屏蔽了  发表于 2017-4-30 13:44

评分

参与人数 1梦石 +1 收起 理由
RaidenInfinity + 1 认可答案

查看全部评分

2016/07/17 加入RPG製作,勿忘初衷!
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部