42 lines
1.3 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
local BuffAction_Strengthen = {
BuffColor = { R = 0.4, G = 1., B = 0.1, A = 1. };
BuffIconPath = UGCGameSystem.GetUGCResourcesFullPath('Asset/Texture/BUFFIcon/T_AddHealth.T_AddHealth');
BuffParticlePath = UGCGameSystem.GetUGCResourcesFullPath('Asset/FX/P_AddHealth.P_AddHealth');
BuffDesc = "强化队友";
PlayerKey = {};
}
function BuffAction_Strengthen:ApplyBuff(BuffTag, SelfPawn, InStrength)
self.PlayerKey = {};
self:ApplyFunc(SelfPawn, InStrength, true);
return true
end
function BuffAction_Strengthen:RemoveBuff(BuffTag, SelfPawn, InStrength)
self:ApplyFunc(SelfPawn, InStrength, false);
end
function BuffAction_Strengthen:ApplyFunc(SelfPawn, InStrength, IsAdd)
local Pawns = UGCGameSystem.GetAllPlayerPawn();
local TeamId = UGCPlayerStateSystem.GetTeamID(SelfPawn.PlayerKey);
for Index, Pawn in pairs(Pawns) do
if Pawn ~= nil and UE.IsValid(Pawn) and Pawn:IsAlive() then
local PawnTeamId = UGCPlayerStateSystem.GetTeamID(Pawn.PlayerKey);
if PawnTeamId == TeamId then
if IsAdd then
Pawn:SetParam('Strong', Pawn:GetParam('Strong') * InStrength);
table.insert(self.PlayerKey, Pawn.PlayerKey);
else
Pawn:SetParam('Strong', Pawn:GetParam('Strong') / InStrength);
end
end
end
end
end
function BuffAction_Strengthen:GetBenefitPlayer()
return self.PlayerKey;
end
return BuffAction_Strengthen;