UGCProjects/GZJ/Script/Blueprint/Monster/BP_MonsterGradeBreakthrough.lua

88 lines
3.3 KiB
Lua
Raw Normal View History

2025-01-08 22:46:12 +08:00
---@class BP_MonsterGradeBreakthrough_C:BP_MonsterBreach_C
---@field UAESkillManager UUAESkillManagerComponent
---@field FuriousParticle UParticleSystem
---@field SuckBloodParticle UParticleSystem
--Edit Below--
--local BP_MonsterGradeBreakthrough = {};
local MonsterBreach = require('Script.Blueprint.Monster.BP_MonsterBreach')
local BP_MonsterGradeBreakthrough = setmetatable(
{
BaseAttackValue = 0;
EnableFuriousSkill = false;
ID = 1009;
MonsterName = "GradeBreakthrough",
},
{
__index = MonsterBreach,
__metatable = MonsterBreach
}
);
function BP_MonsterGradeBreakthrough:ReceiveBeginPlayEx()
MonsterBreach.ReceiveBeginPlayEx(self)
if self:HasAuthority() then
self:AddFuriousSkill()
end
end
function BP_MonsterGradeBreakthrough:UpdateSkillCount()
self.SkillCount = self.SkillCount + 1
if self.SkillCount >= 5 and self:HasAuthority() then
self.SkillCount = 0
self:AddHealth(self.BaseAttackValue)
UnrealNetwork.CallUnrealRPC_Multicast(self, "MulticastRPC_SpawnSuckBloodParticleSystemAttach")
end
end
function BP_MonsterGradeBreakthrough:AddFuriousSkill()
self:AddModifyDamageDelegationFun(
"AddFuriousSkill",
---@param DelegationFun fun(DamageAmount:float,DamageEvent:FDamageEvent,EventInstigator:AController,DamageCauser:AActor):float
function (DamageAmount, DamageEvent, EventInstigator, DamageCauser)
if self.EnableFuriousSkill then
return DamageAmount * 1.3
end
return DamageAmount
end
)
self.FuriousSkillHandle = EventSystem.SetTimerLoop(
self,
function ()
self.EnableFuriousSkill = true
UnrealNetwork.CallUnrealRPC_Multicast(self, "MulticastRPC_SpawnFuriousParticleSystemAttach")
self:AddAdditionalAttack(self.BaseAttackValue * 0.5)
EventSystem.SetTimer(
self,
function ()
self.EnableFuriousSkill = false
self:AddAdditionalAttack(-self.BaseAttackValue * 0.5)
end,
5.0
)
end,
15
)
end
function BP_MonsterGradeBreakthrough:MulticastRPC_SpawnFuriousParticleSystemAttach()
self.FuriousParticleInst = GameplayStatics.SpawnEmitterAttached(self.FuriousParticle, self.Mesh, "spine_03", VectorHelper.VectorZero(), VectorHelper.RotZero(), VectorHelper.ScaleOne(), EAttachLocation.SnapToTarget, true)
end
function BP_MonsterGradeBreakthrough:MulticastRPC_SpawnSuckBloodParticleSystemAttach()
self.SuckBloodParticleInst = GameplayStatics.SpawnEmitterAttached(self.SuckBloodParticle, self.Mesh, "", VectorHelper.VectorZero(), VectorHelper.RotZero(), VectorHelper.ScaleOne(), EAttachLocation.SnapToTarget, true)
end
function BP_MonsterGradeBreakthrough:ReceiveOnMonsterDeath()
MonsterBreach.ReceiveOnMonsterDeath(self)
if self:HasAuthority() then
if self.FuriousSkillHandle then EventSystem.StopTimer(self.FuriousSkillHandle) self.FuriousSkillHandle = nil return end
else
if UE.IsValid(self.FuriousParticleInst) then self.FuriousParticleInst:K2_DestroyComponent(self) end
if UE.IsValid(self.SuckBloodParticleInst) then self.SuckBloodParticleInst:K2_DestroyComponent(self) end
end
end
return BP_MonsterGradeBreakthrough;