UGCProjects/ProjectTemp_T/Script/Blueprint/BUFF/BuffAction/BuffAction_InfiniteBullets.lua

55 lines
2.5 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
local BuffAction_InfiniteBullets = {
-- 以下参数信息可以通过manager的 GetBuffDefaultParam(BuffPath, ParamName)来获取 --
-- 默认颜色信息,非必要参数
BuffColor = {R = 0.135, G = 0.17, B = 0.6, A = 1.};
BuffIconPath = UGCGameSystem.GetUGCResourcesFullPath('Asset/Texture/BUFFIcon/T_BulletInf.T_BulletInf');
BuffParticlePath = UGCGameSystem.GetUGCResourcesFullPath('Asset/FX/P_BulletInf.P_BulletInf');
BuffDesc = "将玩家当前背包的武器设置为无限子弹";
--------------------------------------------------------------------------------
PlayerKey = {};
}
BuffAction_InfiniteBullets.InfShootWeaponEnums = {
ESurviveWeaponPropSlot.SWPS_MainShootWeapon1,
ESurviveWeaponPropSlot.SWPS_MainShootWeapon2,
ESurviveWeaponPropSlot.SWPS_SubShootWeapon,
}
--- 必须包含ApplyBuff函数
---@param ValidPawn BP_PlayerPawn_C*
---@param FillType EFillBulletType 是否为需要换弹夹的无限子弹模式
---@param IgnoreWeaponID table<int32> 需要忽略的武器
---@return bool
function BuffAction_InfiniteBullets:ApplyBuff(BuffTag, ValidPawn, FillType, IgnoreWeaponID)
UGCLogSystem.Log("[BuffAction_InfiniteBullets:ApplyBuff] FillType = %s, ValidPawn = %s, IgnoreWeaponID = %s", tostring(FillType), UE.GetName(ValidPawn), tostring(IgnoreWeaponID));
for k, ShootWeaponEnum in pairs(BuffAction_InfiniteBullets.InfShootWeaponEnums) do
local Weapon = UGCWeaponManagerSystem.GetWeaponBySlot(ValidPawn, ShootWeaponEnum);
if UE.IsValid(Weapon) then
if IgnoreWeaponID == nil or (type(IgnoreWeaponID) == "table" and (not table.hasValue(IgnoreWeaponID, Weapon:GetWeaponItemID()))) then
if FillType == EFillBulletType.ClipInfinite then
UGCGunSystem.EnableClipInfiniteBullets(Weapon, true)
elseif FillType == EFillBulletType.Infinite then
UGCGunSystem.EnableInfiniteBullets(Weapon, true)
elseif FillType == EFillBulletType.Fill then
UGCGunSystem.SetMaxBulletNumInOneClip(Weapon, 150);
end
end
end
end
local PC = UGCGameSystem.GetPlayerControllerByPlayerKey(ValidPawn.PlayerKey)
PC:SetEnableInfiniteBulletsType(true, FillType);
self.PlayerKey = {
[1] = ValidPawn.PlayerKey;
}
return true;
end
function BuffAction_InfiniteBullets:GetBenefitPlayer()
return self.PlayerKey;
end
return BuffAction_InfiniteBullets