查看: 2444|回复: 4

[已经解决] 如何同时显示两个连续伤害的状态减掉的血

[复制链接]
梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

发表于 2014-10-14 20:09:30 | 显示全部楼层 |阅读模式

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

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

×
我设置了毒,又设置了烧伤.。都勾了连续伤害状态。
可是实际战斗的时候好象只有减掉毒伤害。烧伤就不显示,好象也没掉血。
梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

 楼主| 发表于 2014-10-14 21:58:54 | 显示全部楼层
找到一个多个减血的状态脚本。可是也只是输出伤害最高的而已,不能全部输出,也不能合计输出。
[pre lang="ruby" line="1"]def slip_damage_effect
    if self.state?(3) #默认的毒效果
      # 设置伤害
      self.damage = self.maxhp / 10
      # 分散
      if self.damage.abs > 0
        amp = [self.damage.abs * 15 / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      # HP 的伤害减法运算
      self.hp -= self.damage
    end
    # 过程结束
    return true
  end
  def slip_damage_effect
    if self.state?(32) #烧伤   
      # 设置伤害
      self.damage = self.hp / 2
      # HP 的伤害减法运算
      self.hp -= self.damage
    end
    # 过程结束
    return true
    end[/pre]
回复

使用道具 举报

梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

 楼主| 发表于 2014-10-14 22:43:40 | 显示全部楼层
我把脚本改成了这样。我发现HP是按照两个状态减的。但是显示只显示一条减HP。

[pre lang="ruby" line="1"]def slip_damage_effect
    xxxx = self.maxhp / 2
    yyyy = self.hp / 4
    if self.state?(3) and self.state?(34) #默认的毒效果
      self.damage = xxxx + yyyy
      self.hp -= self.damage
      end
    if self.state?(3) #默认的毒效果
      self.damage = xxxx
      self.hp -= self.damage
    end
    if self.state?(34) #烧伤
      self.damage = yyyy
      self.hp -= self.damage
    end
      self.damage = xxxx + yyyy
      self.hp -= self.damage
    # 过程结束
    return true
  end[/pre]

点评

弄不起来。怎么弄都只有一种状态减血,不能两种状态同时减血  发表于 2014-10-15 00:04
回复

使用道具 举报

梦石
0
星屑
50
在线时间
320 小时
注册时间
2014-9-2
回帖
244
发表于 2014-10-15 09:00:26 | 显示全部楼层
改这样看看
  1. def slip_damage_effect
  2.     xxxx = self.maxhp / 2
  3.     yyyy = self.hp / 4
  4.     if self.state?(3) and self.state?(34) #默认的毒效果
  5.       self.damage = xxxx + yyyy
  6.       self.hp -= self.damage
  7.       return true
  8.     end
  9.     if self.state?(3) #默认的毒效果
  10.       self.damage = xxxx
  11.       self.hp -= self.damage
  12.       return true
  13.     end
  14.     if self.state?(34) #烧伤
  15.       self.damage = yyyy
  16.       self.hp -= self.damage
  17.       return true
  18.     end
  19.     # 过程结束
  20.     return true
  21. end
复制代码

点评

一样,即使中两个状态也只有一个掉血。可能要改其他地方吧。我放弃了。  发表于 2014-10-15 22:38
把 and 换成 && 看看  发表于 2014-10-15 19:19
烧伤也可以掉血的,不过烧伤和毒同时存在的时候只有上面那个会掉血  发表于 2014-10-15 18:35
那你把毒的那段拿掉 测试看看 烧伤能不能扣血  发表于 2014-10-15 14:17
不行,这样只有毒有减血,不能两个一起减血  发表于 2014-10-15 11:52
回复

使用道具 举报

梦石
0
星屑
50
在线时间
320 小时
注册时间
2014-9-2
回帖
244
发表于 2014-10-15 19:22:56 | 显示全部楼层
还不行的话改成这样
  1. def slip_damage_effect
  2.   xxxx = self.maxhp / 2
  3.   yyyy = self.hp / 4
  4.   if self.state?(3) and self.state?(34) #默认的毒烧伤效果
  5.     self.damage = (xxxx + yyyy)   # (xxxx + yyyy)
  6.     self.hp -= self.damage
  7.     return true
  8.   end
  9.   if self.state?(3) #默认的毒效果
  10.     self.damage = xxxx
  11.     self.hp -= self.damage
  12.     return true
  13.   end
  14.   if self.state?(34) #烧伤
  15.     self.damage = yyyy
  16.     self.hp -= self.damage
  17.     return true
  18.   end
  19.   # 过程结束
  20.   return true
  21. end
复制代码

点评

可以了,这样两个状态都有减血了。感谢  发表于 2014-10-16 18:03
目测是这里没括号 self.damage = (xxxx + yyyy)  发表于 2014-10-16 07:35

评分

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

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部