Project1

标题: 帮帮忙,本想做一把破灭君主。。。 [打印本页]

作者: 1390959782    时间: 2016-12-11 16:08
标题: 帮帮忙,本想做一把破灭君主。。。
本帖最后由 1390959782 于 2016-12-11 16:19 编辑

      为什么不行?伤害附加敌方当前生命的8%
  # 破败技能单独计算
      if skill.id == 1
        self.damage = [battler.maxhp - battler.hp*0.03].max
      end
作者: yang1zhi    时间: 2016-12-11 21:23
self.damage =battler.hp*0.03不行吗
作者: jiushiainilip19    时间: 2016-12-12 10:09

  1. if skill.id == 1
  2. self.damage+=self.hp*8/100
  3. end
复制代码

作者: 1390959782    时间: 2016-12-17 12:51
jiushiainilip19 发表于 2016-12-12 10:09

成功了,谢谢,怎么才能得到这个技能后普通攻击附加目标当前生命值8%的伤害?
作者: jiushiainilip19    时间: 2016-12-18 16:22
本帖最后由 jiushiainilip19 于 2016-12-18 16:23 编辑
1390959782 发表于 2016-12-17 12:51
成功了,谢谢,怎么才能得到这个技能后普通攻击附加目标当前生命值8%的伤害? ...

  1.         
  2.   def attack_effect(attacker)
  3.     # 清除会心一击标志
  4.     self.critical = false
  5.     # 第一命中判定
  6.     hit_result = (rand(100) < attacker.hit)
  7.     # 命中的情况下
  8.     if hit_result == true
  9.       # 计算基本伤害
  10.       atk = [attacker.atk - self.pdef / 2, 0].max
  11.       self.damage = atk * (20 + attacker.str) / 20
  12.       #=======下面 这段代码插入到这里就好了
  13.         # 角色学会57号技能的话 攻击附带对方当前8%的生命伤害
  14.        if attacker.is_a?(Game_Actor)  && attacker.skill_learn?(57)
  15.          self.damage += self.hp*8/100
  16.        end
  17.      #=======上面 这段代码插入到这里就好了
  18.       # 属性修正
  19.       self.damage *= elements_correct(attacker.element_set)
  20.       self.damage /= 100

复制代码





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1