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

51 lines
1.6 KiB
Lua

local BuffAction_IgnorePoison = {
BuffColor = {R = 0.4, G = 1., B = 0.1, A = 1.};
BuffDesc = "全队玩家收到安全区外伤害降低";
PlayerKey = {};
}
function BuffAction_IgnorePoison:ApplyBuff(BuffTag, ValidPawn, IsEnablePoison, InDefence)
local PC = UGCGameSystem.GetPlayerControllerByPlayerKey(ValidPawn.PlayerKey);
PC.EnablePoison = IsEnablePoison;
if IsEnablePoison then
self:ApplyFunc(ValidPawn, InDefence, true);
end
self.PlayerKey = {
[1] = ValidPawn.PlayerKey;
}
return true
end
function BuffAction_IgnorePoison:RemoveBuff(BuffTag, SelfPawn, IsEnablePoison, InDefence)
if not UE.IsValid(SelfPawn) then
return
end
local PC = UGCGameSystem.GetPlayerControllerByPlayerKey(SelfPawn.PlayerKey);
PC.EnablePoison = true;
if InDefence then
self:ApplyFunc(SelfPawn, InDefence, false);
end
end
function BuffAction_IgnorePoison:ApplyFunc(SelfPawn, InDefence, IsAdd)
local Pawns = UGCGameSystem.GetAllPlayerPawn();
local TeamId = UGCPlayerStateSystem.GetTeamID(SelfPawn.PlayerKey);
for Index, Pawn in pairs(Pawns) do
local PawnTeamId = UGCPlayerStateSystem.GetTeamID(Pawn.PlayerKey);
if PawnTeamId == TeamId then
if IsAdd then
Pawn:SetParam('Strong', InDefence * Pawn:GetParam('Strong'))
else
Pawn:SetParam('Strong', Pawn:GetParam('Strong') / InDefence);
end
end
end
end
function BuffAction_IgnorePoison:GetBenefitPlayer()
return self.PlayerKey;
end
return BuffAction_IgnorePoison;