Commit 375f40f1bba62119eb0a7b25e67e6a09c4a9552b
1 parent
6a323693
可控制 提高生命上限回复血量
Showing
1 changed file
with
14 additions
and
1 deletions
Show diff stats
src/adv/AdvBuff.lua
| ... | ... | @@ -156,11 +156,15 @@ local BuffFactory = { |
| 156 | 156 | [Buff.HP_MAX_CHANGE] = function(_Buff) |
| 157 | 157 | _Buff._init = function(self) --初始化变化值 |
| 158 | 158 | self._changeV = self:_calculate() |
| 159 | + local old = self.owner.hpMax | |
| 159 | 160 | self.owner:reSetHpMax() |
| 161 | + self:_addHpByMax(old) | |
| 160 | 162 | end |
| 161 | 163 | _Buff._overlay = function(self) |
| 162 | 164 | self._changeV = (self._changeV or 0) + self:_calculate() |
| 165 | + local old = self.owner.hpMax | |
| 163 | 166 | self.owner:reSetHpMax() |
| 167 | + self:_addHpByMax(old) | |
| 164 | 168 | end |
| 165 | 169 | |
| 166 | 170 | _Buff._uncover = function(self) |
| ... | ... | @@ -173,7 +177,7 @@ local BuffFactory = { |
| 173 | 177 | if self.buffData.effectValue1 == 0 then --固定值 |
| 174 | 178 | curValue = self.buffData.effectValue2 |
| 175 | 179 | elseif self.buffData.effectValue1 == 1 then |
| 176 | - local baseOwner = self.buffData.effectValue4 == 1 and self.owner or self.release | |
| 180 | + local baseOwner = self.buffData.effectValue4 == 1 and self.owner or self.release | |
| 177 | 181 | local attrs = {[0] = "hp", [1] = "hpMax", [2] = "atk"} |
| 178 | 182 | curValue = baseOwner[attrs[self.buffData.effectValue3]] * self.buffData.effectValue2 / 100 |
| 179 | 183 | end |
| ... | ... | @@ -184,6 +188,15 @@ local BuffFactory = { |
| 184 | 188 | return self:doEffectChange(self._changeV) |
| 185 | 189 | end |
| 186 | 190 | |
| 191 | + _Buff._addHpByMax = function(self, old) | |
| 192 | + if self.buffData.effectValue5 == "1" then | |
| 193 | + local change = self.owner.hpMax - old | |
| 194 | + if change > 0 then | |
| 195 | + self.owner:recover(change, self.release) -- 防止release不存在,地图点buff | |
| 196 | + end | |
| 197 | + end | |
| 198 | + end | |
| 199 | + | |
| 187 | 200 | _Buff._endBuff = function(self) |
| 188 | 201 | self.owner:reSetHpMax() |
| 189 | 202 | end | ... | ... |