From 01a5bf9e164ff628b0b72f7aa651d47220cc9f0e Mon Sep 17 00:00:00 2001 From: chenxi Date: Tue, 25 Apr 2023 11:58:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9C=80=E5=A4=A7=E8=A1=80?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/component/battle_unit_comp.lua | 7 +++++++ lua/app/module/battle/helper/battle_buff_handle.lua | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index 11264134..e732e494 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -1016,6 +1016,13 @@ function BattleUnitComp:updateNormalAttack(dt) end end +function BattleUnitComp:addMaxHp(percent) + self.unitEntity:addMaxHp(percent) + local hpPercent = self.unitEntity:getHpPercent() + local hp = self.unitEntity:getHp() + self.battleController:refreshHp(self.side, hp, hpPercent) +end + function BattleUnitComp:addBuff(buffEffect) self.team:addBuff(buffEffect) end diff --git a/lua/app/module/battle/helper/battle_buff_handle.lua b/lua/app/module/battle/helper/battle_buff_handle.lua index 90967341..74e9b46c 100644 --- a/lua/app/module/battle/helper/battle_buff_handle.lua +++ b/lua/app/module/battle/helper/battle_buff_handle.lua @@ -71,7 +71,7 @@ BattleBuffHandle.addAttribute = { target.unitEntity:addAttr(ATTR_NAME.NORMAL_ATTACK_COUNT, num, false) end, [BUFF_NAME.HPP_ADD] = function(target, num) - target.unitEntity:addMaxHp(num) + target:addMaxHp(num) end, }