185 lines
6.7 KiB
Lua
185 lines
6.7 KiB
Lua
---@class BP_BossSpring_C:BP_MonsterBoss_C
|
|
---@field ParticleSystem UParticleSystemComponent
|
|
---@field UAESkillManager UUAESkillManagerComponent
|
|
---@field SpringThingsParticle UParticleSystem
|
|
--Edit Below--
|
|
--local BP_BossSpring = {};
|
|
local MonsterBoss = require('Script.Blueprint.Monster.BP_MonsterBoss')
|
|
|
|
local BP_BossSpring = setmetatable(
|
|
{
|
|
SpringMagicCount = 0,
|
|
Damage_Multipler = 1,
|
|
RainMarshs = {},
|
|
SpringThingsHandle = nil,
|
|
SurvivalTime = 0,
|
|
RainMarshsParticleInst = {},
|
|
ID = 10004,
|
|
MonsterName = "Boss",
|
|
SpringThingsDelayTime = 20,
|
|
|
|
},
|
|
{
|
|
__index = MonsterBoss,
|
|
__metatable = MonsterBoss
|
|
}
|
|
);
|
|
|
|
function BP_BossSpring:ReceiveBeginPlayEx()
|
|
MonsterBoss.ReceiveBeginPlayEx(self)
|
|
if self:HasAuthority() then
|
|
self:AddSpringMagicSkill()
|
|
end
|
|
end
|
|
|
|
function BP_BossSpring:ReceiveTick(DeltaTime)
|
|
print("BP_BossSpring_Fun" .. "ReceiveTick")
|
|
self.SuperClass.ReceiveTick(self, DeltaTime);
|
|
if self:HasAuthority() then
|
|
self.SurvivalTime = self.SurvivalTime + DeltaTime
|
|
if self.SurvivalTime >= self.SpringThingsDelayTime then
|
|
self.SurvivalTime = 0
|
|
self:AddSpringThingsSkill()
|
|
end
|
|
self:TickExeSpringThingsSkill()
|
|
else
|
|
if (self.RainMarshsParticleInst) then
|
|
local RemoveParticle = {}
|
|
for TempParticle, Time in pairs( self.RainMarshsParticleInst) do
|
|
if KismetSystemLibrary.GetGameTimeInSeconds(self) - Time >= 1.5 then
|
|
table.insert(RemoveParticle,TempParticle)
|
|
end
|
|
end
|
|
for k, TempParticle in pairs( RemoveParticle ) do
|
|
TempParticle:K2_DestroyComponent(self)
|
|
self.RainMarshsParticleInst[TempParticle] = nil
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function BP_BossSpring:AddSpringMagicSkill()
|
|
print("BP_BossSpring_Fun" .. "AddSpringMagicSkill")
|
|
|
|
EventSystem.SetTimerLoop(
|
|
self,
|
|
function ()
|
|
self.SpringMagicCount = self.SpringMagicCount + 1
|
|
local SelfHealth = UGCSimpleCharacterSystem.GetHealthMax(self)
|
|
self:AddHealth(SelfHealth * 0.06)
|
|
--UGCSimpleCharacterSystem.SetHealth(self, SelfHealth + SelfHealth * 0.06)
|
|
if self.SpringMagicCount >= 20 then
|
|
self.Damage_Multipler = 5
|
|
end
|
|
end,
|
|
1.0
|
|
)
|
|
return
|
|
end
|
|
|
|
-------------------------------SpringThingsSkill-----------------------------
|
|
function BP_BossSpring:AddSpringThingsSkill()
|
|
if self:GetController() and self:GetController():GetBlackboardComponent() then
|
|
self:GetController():GetBlackboardComponent():SetValueAsBool("CanPlaySpringThingsSkill", true)
|
|
end
|
|
end
|
|
|
|
function BP_BossSpring:SpringThingsSkillExe()
|
|
print("BP_BossSpring_Fun" .. "AddSpringThingsSkill")
|
|
|
|
if self.SpringThingsHandle then
|
|
EventSystem.StopTimer(self.SpringThingsHandle)
|
|
end
|
|
self.SpringThingsHandle = EventSystem.SetTimerLoop(
|
|
self,
|
|
function ()
|
|
local ArenaPlayers = UGCGameSystem.GameState:GetPlayersInArena()
|
|
if ArenaPlayers then
|
|
for k, TempPawn in pairs(ArenaPlayers) do
|
|
local TempRainMarsh = {
|
|
Time = KismetSystemLibrary.GetGameTimeInSeconds(self),
|
|
Location = TempPawn:K2_GetActorLocation()
|
|
}
|
|
|
|
table.insert(self.RainMarshs, TempRainMarsh)
|
|
local TempLocal = TempPawn:K2_GetActorLocation()
|
|
local DropLocation = UGCGameSystem.GameState:GetDropLocation(TempLocal)
|
|
DropLocation.Z = DropLocation.Z + 5
|
|
UnrealNetwork.CallUnrealRPC_Multicast(self, "MulticastRPC_SpawnParticleSystem", VectorHelper.ToLuaTable(DropLocation))
|
|
end
|
|
end
|
|
end,
|
|
0.5
|
|
)
|
|
EventSystem.SetTimer(
|
|
self,
|
|
function ()
|
|
if self.SpringThingsHandle then
|
|
EventSystem.StopTimer(self.SpringThingsHandle)
|
|
self.SpringThingsHandle = nil
|
|
end
|
|
end,
|
|
5.0
|
|
)
|
|
end
|
|
|
|
|
|
function BP_BossSpring:TickExeSpringThingsSkill()
|
|
print("BP_BossSpring_Fun" .. "TickExeSpringThingsSkill")
|
|
|
|
if self.RainMarshs then
|
|
local RemoveRainMarshList = {}
|
|
for TempRainMarsh, Local_Time in pairs(self.RainMarshs) do
|
|
if KismetSystemLibrary.GetGameTimeInSeconds(self) - Local_Time.Time >= 1 then
|
|
table.insert(RemoveRainMarshList,TempRainMarsh)
|
|
local TargetPawns = self:GetSphereActors(Local_Time.Location, 150, self:GetPawnClass())
|
|
for k, TargetPawn in pairs(TargetPawns) do
|
|
self:MonsterApplyDamage(TargetPawn, UGCSimpleCharacterSystem.GetHealth(self) * self.Damage_Multipler)
|
|
end
|
|
end
|
|
end
|
|
if RemoveRainMarshList then
|
|
for k, v in pairs(RemoveRainMarshList) do
|
|
self.RainMarshs[v] = nil
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function BP_BossSpring:MulticastRPC_SpawnParticleSystem(TempLocation)
|
|
print("BP_BossSpring_Fun" .. "MulticastRPC_SpawnParticleSystem")
|
|
|
|
if TempLocation then
|
|
local ObjectTypes = {EObjectTypeQuery.ObjectTypeQuery1}
|
|
local TempLocationEnd = Vector.New(TempLocation.X, TempLocation.Y, TempLocation.Z - 200)
|
|
local bHit, HitResult = KismetSystemLibrary.LineTraceSingleForObjects(self, TempLocation, TempLocationEnd, ObjectTypes, false, nil, EDrawDebugTrace.None, nil, true, nil, nil, nil)
|
|
print("LineTraceSingleForObjects is Hit" .. tostring(bHit))
|
|
if (bHit) then
|
|
TempLocation.Z = HitResult.ImpactPoint.Z + 5
|
|
else
|
|
TempLocation.Z = TempLocation.Z - 80
|
|
end
|
|
self.RainMarshsParticleInst[GameplayStatics.SpawnEmitterAtLocation(self, self.SpringThingsParticle, TempLocation, Rotator.New(0, 0, 0), Vector.New(1, 1, 1), true)] = KismetSystemLibrary.GetGameTimeInSeconds(self)
|
|
|
|
else
|
|
print("MulticastRPC_SpawnParticleSystem_Fun Position is nil type: " .. type(TempLocation))
|
|
end
|
|
end
|
|
-------------------------------SpringThingsSkillEnd------------------------
|
|
|
|
function BP_BossSpring:ReceiveOnMonsterDeath()
|
|
MonsterBoss.ReceiveOnMonsterDeath(self)
|
|
if self:HasAuthority() then
|
|
if self.SpringThingsHandle then EventSystem.StopTimer(self.SpringThingsHandle) self.SpringThingsHandle = nil return end
|
|
else
|
|
if self.RainMarshsParticleInst then
|
|
for TempParticle, T in pairs(self.RainMarshsParticleInst) do
|
|
TempParticle:K2_DestroyComponent(self)
|
|
end
|
|
self.RainMarshsParticleInst = {}
|
|
end
|
|
if self.ParticleSystem then self.ParticleSystem:SetVisibility(false) end
|
|
end
|
|
end
|
|
|
|
return BP_BossSpring; |