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

42 lines
1.6 KiB
Lua

local BuffAction_Regurgitation = {
BuffColor = {R = 0.4, G = 1., B = 0.1, A = 1.};
BuffDesc = "在施放技能的玩家一定范围内回血";
PlayerKey = {};
}
--- 半径两米之内添加血量
function BuffAction_Regurgitation:ApplyBuff(BuffTag, SelfPawn, InDis, SelfAdd)
local Pawns = UGCGameSystem.GetAllPlayerPawn();
local SelfLoc = SelfPawn:K2_GetActorLocation();
print(string.format('[BuffAction_Regurgitation:ApplyBuff] 执行'))
local TeamId = UGCPlayerStateSystem.GetTeamID(SelfPawn.PlayerKey);
self.PlayerKey = {};
for Index, Pawn in pairs(Pawns) do
local PawnLoc = Pawn:K2_GetActorLocation()
local PawnTeamId = UGCPlayerStateSystem.GetTeamID(Pawn.PlayerKey);
-- 给自己队伍加血量
if PawnTeamId == TeamId then
local Dis = VectorHelper.GetDistance(SelfLoc, PawnLoc);
if Dis <= InDis * 100 then
local AddVal = 0;
local PC = UGCGameSystem.GetPlayerControllerByPlayerKey(Pawn.PlayerKey);
AddVal = SelfAdd * UGCPawnAttrSystem.GetHealthMax(Pawn);
if Pawn ~= SelfPawn and PC:GetSoldierType() == SoldierConfig.ESoldierType.MedicalCorps then
AddVal = AddVal * 0.5;
end
AddVal = AddVal + UGCPawnAttrSystem.GetHealth(Pawn);
UGCPawnAttrSystem.SetHealth(Pawn, AddVal);
self.PlayerKey[#self.PlayerKey + 1] = Pawn.PlayerKey;
end
end
end
return true
end
function BuffAction_Regurgitation:GetBenefitPlayer()
return self.PlayerKey;
end
return BuffAction_Regurgitation;