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

32 lines
1.1 KiB
Lua

-- Script.Global.BuffSystem.BuffAction.BuffAction_DamageScale
local BuffActionBase = require('Script.Global.BuffSystem.BuffActionBase')
local BuffAction_DamageScale = setmetatable(
{
DamageScale = 1.
},
{ __index = BuffActionBase, __metatable = BuffActionBase }
);
function BuffAction_DamageScale:LuaDoAction()
BuffActionBase.LuaDoAction(self)
if not UGCGameSystem.IsServer() then return true end
UGCLogSystem.Log("[BuffAction_DamageScale_LuaDoAction]")
local OwnerPawn = self:GetOwnerPawn()
if UE.IsValid(OwnerPawn) and self.DamageScale then
OwnerPawn:SetDamageScale(OwnerPawn:GetDamageScale() * self.DamageScale)
end
end
function BuffAction_DamageScale:LuaUndoAction()
BuffActionBase.LuaUndoAction(self)
if not UGCGameSystem.IsServer() then return true end
UGCLogSystem.Log("[BuffAction_DamageScale_LuaUndoAction]")
local OwnerPawn = self:GetOwnerPawn()
if UE.IsValid(OwnerPawn) then
OwnerPawn:SetDamageScale(OwnerPawn:GetDamageScale() / self.DamageScale)
end
end
return BuffAction_DamageScale;