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

Project1

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

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

[复制链接]

Lv4.逐梦者

梦石
0
星屑
12157
在线时间
4435 小时
注册时间
2014-4-11
帖子
5955

开拓者

跳转到指定楼层
1
发表于 2014-10-14 20:09:30 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

x
我设置了毒,又设置了烧伤.。都勾了连续伤害状态。
可是实际战斗的时候好象只有减掉毒伤害。烧伤就不显示,好象也没掉血。

Lv1.梦旅人

梦石
0
星屑
50
在线时间
320 小时
注册时间
2014-9-2
帖子
267
5
发表于 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 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
320 小时
注册时间
2014-9-2
帖子
267
4
发表于 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
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
12157
在线时间
4435 小时
注册时间
2014-4-11
帖子
5955

开拓者

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

RUBY 代码复制
  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.       end
  8.     if self.state?(3) #默认的毒效果
  9.       self.damage = xxxx
  10.       self.hp -= self.damage
  11.     end
  12.     if self.state?(34) #烧伤
  13.       self.damage = yyyy
  14.       self.hp -= self.damage
  15.     end
  16.       self.damage = xxxx + yyyy
  17.       self.hp -= self.damage
  18.     # 过程结束
  19.     return true
  20.   end

点评

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

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
12157
在线时间
4435 小时
注册时间
2014-4-11
帖子
5955

开拓者

2
 楼主| 发表于 2014-10-14 21:58:54 | 只看该作者
找到一个多个减血的状态脚本。可是也只是输出伤害最高的而已,不能全部输出,也不能合计输出。
RUBY 代码复制
  1. def slip_damage_effect
  2.     if self.state?(3) #默认的毒效果
  3.       # 设置伤害
  4.       self.damage = self.maxhp / 10
  5.       # 分散
  6.       if self.damage.abs > 0
  7.         amp = [self.damage.abs * 15 / 100, 1].max
  8.         self.damage += rand(amp+1) + rand(amp+1) - amp
  9.       end
  10.       # HP 的伤害减法运算
  11.       self.hp -= self.damage
  12.     end
  13.     # 过程结束
  14.     return true
  15.   end
  16.   def slip_damage_effect
  17.     if self.state?(32) #烧伤   
  18.       # 设置伤害
  19.       self.damage = self.hp / 2
  20.       # HP 的伤害减法运算
  21.       self.hp -= self.damage
  22.     end
  23.     # 过程结束
  24.     return true
  25.     end
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 17:50

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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