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

71 lines
2.1 KiB
Lua

local Buff_BombExplosion = {};
--- 下面的可以直接用,就能获取到值
Buff_BombExplosion.PlayerKey = nil;
Buff_BombExplosion.BuffType = nil;
Buff_BombExplosion.Owner = nil;
Buff_BombExplosion.BuffName = nil;
function Buff_BombExplosion:Init(Params)
return true;
end
function Buff_BombExplosion:AddBuff(Location)
-- 执行
Location = VectorHelper.Add(Location, VectorHelper.MakeVector(0, 0, 20));
-- 产生一个爆炸伤害
if IsServer then
local DamageChannel = ECollisionChannel.ECC_Visibility;
local Pawn = UGCGameSystem.GetPlayerPawnByPlayerKey(self.PlayerKey);
local Weapon = UGCWeaponManagerSystem.GetCurrentWeapon(Pawn);
local ItemId = -1;
if UE.IsValid(Weapon) then
ItemId = Weapon:GetWeaponItemID();
end
local bTakeDamage = UGCGameSystem.ApplyRadialDamage(
self.BaseDamage,
20,
Location,
self.InnerRadius,
self.OuterRadius,
self.Falloff,
EDamageType.RadialDamage,
{},
UGCWeaponManagerSystem.GetCurrentWeapon(UGCGameSystem.GetPlayerPawnByPlayerKey(self.PlayerKey)),
UGCGameSystem.GetPlayerControllerByPlayerKey(self.PlayerKey),
DamageChannel,
ItemId
);
if not bTakeDamage then
UGCLogSystem.Log("[Buff_BombExplosion:AddBuff] 没有产生伤害:%s", tostring(ItemId));
return false;
end
else
ObjectPath.AddFunc("P_AH6_baozha_01", function(TargetClass)
UGCLogSystem.Log("[Skill_Bolt_Explosion:Add] 执行")
self.EmitterObj = GameplayStatics.SpawnEmitterAtLocation(GameState, TargetClass, Location, VectorHelper.RotZero(), VectorHelper.ScaleOne(), true);
if self.EmitterObj then
UGCSoundManagerSystem.PlaySoundAtLocation(ObjectPath.Play_RPG_Explosion, Location, VectorHelper.RotZero());
end
end);
end
return true;
end
Buff_BombExplosion.EmitterObj = nil;
function Buff_BombExplosion:RemoveBuff(...)
UGCLogSystem.Log("[Buff_BombExplosion:RemoveBuff] 执行")
return true;
end
function Buff_BombExplosion:UpdateBuff(...)
end
function Buff_BombExplosion:Reset(Params)
-- 默认使用初始化重置,也可以不用
self:Init(Params);
end
return Buff_BombExplosion;