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

47 lines
2.1 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

local BuffAction_ScaleDamage = {
-- 以下参数信息可以通过manager的 GetBuffDefaultParam(BuffPath, ParamName)来获取 --
-- 默认颜色信息,非必要参数
BuffColor = {R = 1., G = 0., B = 0., A = 1.};
BuffIconPath = UGCGameSystem.GetUGCResourcesFullPath('Asset/Texture/BUFFIcon/T_UpDamage.T_UpDamage');
BuffParticlePath = UGCGameSystem.GetUGCResourcesFullPath('Asset/FX/P_AddDamage.P_AddDamage');
BuffDesc = "设置玩家伤害缩放";
--------------------------------------------------------------------------------
}
--- 必须包含ApplyBuff函数
---@param ValidPawn:BP_PlayerPawn_C*
---@param MulScale:float
---@return bool
function BuffAction_ScaleDamage:ApplyBuff(BuffTag, ValidPawn, MulScale)
-- 判断玩家是否有获取伤害Scale及设置伤害Scale的函数
if not self:CheckPlayerDamageModify(ValidPawn) then
return false
end
ValidPawn:SetPlayerDamageScale(ValidPawn:GetPlayerDamageScale() * MulScale)
return true
end
--- 可以包含RemoveBuff若包含该函数则玩家应用该Buff时会保存Buff信息缓存作为移除或者获取玩家当前Buff的备份信息
---@param ValidPawn:BP_PlayerPawn_C*
---@param MulScale:float
function BuffAction_ScaleDamage:RemoveBuff(BuffTag, ValidPawn, MulScale)
ValidPawn:SetPlayerDamageScale(ValidPawn:GetPlayerDamageScale() / MulScale)
end
function BuffAction_ScaleDamage:CheckPlayerDamageModify(ValidPawn)
if ValidPawn["GetPlayerDamageScale"] == nil and type(ValidPawn["GetPlayerDamageScale"]) ~= "function" then
UGCLogSystem.LogError("[BuffAction_ScaleDamage_CheckPlayerDamageModify] %s中没有 GetPlayerDamageScale 函数", KismetSystemLibrary.GetObjectName(ValidPawn))
return false
end
if ValidPawn["SetPlayerDamageScale"] == nil and type(ValidPawn["SetPlayerDamageScale"]) ~= "function" then
UGCLogSystem.LogError("[BuffAction_ScaleDamage_CheckPlayerDamageModify] %s中没有 SetPlayerDamageScale 函数", KismetSystemLibrary.GetObjectName(ValidPawn))
return false
end
return true
end
return BuffAction_ScaleDamage