查看: 2873|回复: 4

[已经解决] 反弹的问题

[复制链接]
梦石
0
星屑
2245
在线时间
1015 小时
注册时间
2015-10-17
回帖
1077
发表于 2017-5-7 22:35:18 | 显示全部楼层 |阅读模式

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

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

×
在game_battler的
  #--------------------------------------------------------------------------
  # ● 处理伤害
  #    调用前需要设置好
  #    @result.hp_damage   @result.mp_damage
  #    @result.hp_drain    @result.mp_drain
  #--------------------------------------------------------------------------
  def execute_damage(user)
    on_damage(@result.hp_damage) if @result.hp_damage > 0
    self.hp -= @result.hp_damage
    self.mp -= @result.mp_damage
    user.hp += @result.hp_drain
    user.mp += @result.mp_drain
  end

的
self.hp -= @result.hp_damage


改成

if self.state(x)?#被击者有某个状态时
user-=@result.hp_damage#攻击者受到全额反弹,被击者不受伤害
else
self-=@result.hp_damage
end

后会报else错,帮忙看下哪里错误了
梦石
0
星屑
644
在线时间
830 小时
注册时间
2016-7-24
回帖
644

开拓者

发表于 2017-5-7 23:19:54 | 显示全部楼层
因為是user.hp和self.hp
漏寫了hp
2016/07/17 加入RPG製作,勿忘初衷!
回复

使用道具 举报

梦石
0
星屑
2245
在线时间
1015 小时
注册时间
2015-10-17
回帖
1077
 楼主| 发表于 2017-5-7 23:29:29 | 显示全部楼层
QQ蚊子湯 发表于 2017-5-7 23:19
因為是user.hp和self.hp
漏寫了hp

if self.state(x)?#被击者有某个状态时
user.hp-=@result.hp_damage#攻击者受到全额反弹,被击者不受伤害
else
self.hp-=@result.hp_damage
end

改成这样吗,试了下还是报错
回复

使用道具 举报

老鹰

梦石
40
星屑
37812
在线时间
7091 小时
注册时间
2012-5-26
回帖
3297

极短24评委极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

发表于 2017-5-8 00:32:02 | 显示全部楼层
是self.state?(id)………………

点评

fjm
感谢,现在可以用了  发表于 2017-5-8 09:04

评分

参与人数 2星屑 +206 收起 理由
RaidenInfinity + 200 认可答案
QQ蚊子湯 + 6 老鷹先生銳利的目光!

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部