From 375f40f1bba62119eb0a7b25e67e6a09c4a9552b Mon Sep 17 00:00:00 2001 From: zhouhaihai Date: Fri, 5 Jun 2020 15:45:59 +0800 Subject: [PATCH] 可控制 提高生命上限回复血量 --- src/adv/AdvBuff.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/adv/AdvBuff.lua b/src/adv/AdvBuff.lua index 46c081b..45854e5 100644 --- a/src/adv/AdvBuff.lua +++ b/src/adv/AdvBuff.lua @@ -156,11 +156,15 @@ local BuffFactory = { [Buff.HP_MAX_CHANGE] = function(_Buff) _Buff._init = function(self) --初始化变化值 self._changeV = self:_calculate() + local old = self.owner.hpMax self.owner:reSetHpMax() + self:_addHpByMax(old) end _Buff._overlay = function(self) self._changeV = (self._changeV or 0) + self:_calculate() + local old = self.owner.hpMax self.owner:reSetHpMax() + self:_addHpByMax(old) end _Buff._uncover = function(self) @@ -173,7 +177,7 @@ local BuffFactory = { if self.buffData.effectValue1 == 0 then --固定值 curValue = self.buffData.effectValue2 elseif self.buffData.effectValue1 == 1 then - local baseOwner = self.buffData.effectValue4 == 1 and self.owner or self.release + local baseOwner = self.buffData.effectValue4 == 1 and self.owner or self.release local attrs = {[0] = "hp", [1] = "hpMax", [2] = "atk"} curValue = baseOwner[attrs[self.buffData.effectValue3]] * self.buffData.effectValue2 / 100 end @@ -184,6 +188,15 @@ local BuffFactory = { return self:doEffectChange(self._changeV) end + _Buff._addHpByMax = function(self, old) + if self.buffData.effectValue5 == "1" then + local change = self.owner.hpMax - old + if change > 0 then + self.owner:recover(change, self.release) -- 防止release不存在,地图点buff + end + end + end + _Buff._endBuff = function(self) self.owner:reSetHpMax() end -- libgit2 0.21.2