local BuffAction_DefenceChange = { 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_DefenceChange:ApplyBuff(BuffTag, ValidPawn, IsEnablePoison, InDefence) local PC = UGCGameSystem.GetPlayerControllerByPlayerKey(ValidPawn.PlayerKey); PC.EnablePoison = IsEnablePoison; if IsEnablePoison then self:ApplyFunc(ValidPawn, InDefence, true); self.PlayerKey = {}; local Pawns = UGCGameSystem.GetAllPlayerPawn(); for i, v in pairs(Pawns) do if UE.IsValid(v) and v:IsAlive() then self.PlayerKey[#self.PlayerKey + 1] = v.PlayerKey; end end end return true end function BuffAction_DefenceChange: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_DefenceChange: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_DefenceChange:GetBenefitPlayer() return self.PlayerKey; end return BuffAction_DefenceChange;