2025-01-04 23:00:19 +08:00

45 lines
1.6 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

local BuffActionBase = require('Script.Global.BuffSystem.BuffActionBase')
local BuffAction_Vampirism = setmetatable(
{
-- Param ---------------------------
-- 每秒恢复量
Vampirism = 0.2;
-- Param End -----------------------
},
{ __index = BuffActionBase, __metatable = BuffActionBase }
);
function BuffAction_Vampirism:LuaDoAction()
BuffActionBase.LuaDoAction(self)
if not UGCGameSystem.IsServer() then return true end
UGCLogSystem.Log("[BuffAction_Vampirism_LuaDoAction]Params:%s, %s", self.ReplyPerSecond, self.WaitAddHealthTime)
-- 绑定Event传入的self可能有点问题需要与存储OwnerPawn才能获取到正确的OwnerPawn
UGCEventSystem.AddListener(EventEnum.PlayerInjuryInfo, self.PlayerInjuryInfo, self)
end
function BuffAction_Vampirism:LuaUndoAction()
BuffActionBase.LuaUndoAction(self)
if not UGCGameSystem.IsServer() then return true end
UGCLogSystem.Log("[BuffAction_Vampirism_LuaUndoAction]")
UGCEventSystem.RemoveListener(EventEnum.PlayerInjuryInfo, self.PlayerInjuryInfo, self)
end
function BuffAction_Vampirism:PlayerInjuryInfo(VictimKey, CauserKey, WeaponID, DamageType, IsHeadShotDamage, Distance, DamageValue)
if UE.IsValid(self:GetOwnerPawn()) and self:GetOwnerPawn():IsAlive() then
if CauserKey == self:GetOwnerPawn().PlayerKey then
local AddHealth = DamageValue * self.Vampirism
UGCPawnAttrSystem.SetHealth(self:GetOwnerPawn(), UGCPawnAttrSystem.GetHealth(self:GetOwnerPawn()) + AddHealth)
UGCLogSystem.Log("[BuffAction_Vampirism_PlayerInjuryInfo] Succeed")
end
end
end
return BuffAction_Vampirism;