166 lines
5.8 KiB
Lua
166 lines
5.8 KiB
Lua
---@class BP_BossMoment_C:BP_MonsterBoss_C
|
|
---@field UAESkillManager UUAESkillManagerComponent
|
|
---@field Sphere USphereComponent
|
|
---@field ParticleSystem_StormWind UParticleSystemComponent
|
|
--Edit Below--
|
|
-- local BP_BossMoment = {
|
|
-- IsSkillStormWindEnable = false,
|
|
-- PawnClass = nil,
|
|
-- StormWindHurtHandle = nil
|
|
-- }
|
|
|
|
local MonsterBoss = require('Script.Blueprint.Monster.BP_MonsterBoss')
|
|
|
|
local BP_BossMoment = setmetatable(
|
|
{
|
|
IsSkillStormWindEnable = false,
|
|
PawnClass = nil,
|
|
StormWindHurtHandle = nil,
|
|
ID = 10003,
|
|
MonsterName = "Boss",
|
|
ReductionOfSpeedPlayers = {},
|
|
SkillStormWindDelay = 20,
|
|
LastSkillStormWindTime = 0,
|
|
},
|
|
{
|
|
__index = MonsterBoss,
|
|
__metatable = MonsterBoss
|
|
}
|
|
);
|
|
|
|
function BP_BossMoment:ReceiveBeginPlayEx()
|
|
MonsterBoss.ReceiveBeginPlayEx(self)
|
|
end
|
|
|
|
function BP_BossMoment:UpdateMonsterLevelEx(MonsterName, newLevel)
|
|
self:AddSkillStormKill()
|
|
end
|
|
|
|
function BP_BossMoment:ReceiveTickEx(DeltaTime)
|
|
MonsterBoss.ReceiveTickEx(self, DeltaTime);
|
|
if self:HasAuthority() then
|
|
self.LastSkillStormWindTime = self.LastSkillStormWindTime + DeltaTime
|
|
if self.LastSkillStormWindTime >= self.SkillStormWindDelay then
|
|
if UE.IsValid(self:GetController()) and UE.IsValid(self:GetController():GetBlackboardComponent()) then
|
|
self:GetController():GetBlackboardComponent():SetValueAsBool("CanPlayStormWind", true)
|
|
self.LastSkillStormWindTime = 0
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
--[[
|
|
function BP_BossMoment:GetReplicatedProperties()
|
|
return
|
|
end
|
|
--]]
|
|
|
|
--[[
|
|
function BP_BossMoment:GetAvailableServerRPCs()
|
|
return
|
|
end
|
|
--]]
|
|
|
|
|
|
|
|
-- function BP_BossMoment:AddSkillStormWind()
|
|
-- EventSystem.SetTimerLoop(self,
|
|
-- function()
|
|
-- self:EnableStormWind()
|
|
-- end,
|
|
-- 20.0
|
|
-- )
|
|
-- end
|
|
function BP_BossMoment:AddSkillStormKill()
|
|
UGCSimpleCharacterSystem.SetSpeedScale(self, (self.BaseMaxWalkSpeed + 180)/ 600)
|
|
self:AddAdditionalAttack(self.BaseAttackValue * 2)
|
|
end
|
|
|
|
function BP_BossMoment:SetOverlapPlayerScaleSpeed()
|
|
if not self.IsSkillStormWindEnable then return end
|
|
|
|
local OverlappingActors = self:GetSphereActors(self:K2_GetActorLocation(), 200, self:GetPawnClass())
|
|
local AllPlayer = GameplayStatics.GetAllActorsOfClass(self, self:GetPawnClass(), {})
|
|
if AllPlayer then
|
|
for _,Player in pairs(AllPlayer) do
|
|
if table.hasValue(OverlappingActors, Player) and not table.hasValue(self.ReductionOfSpeedPlayers, Player) then
|
|
UGCPawnAttrSystem.SetSpeedScale(Player, 0.6)
|
|
table.insert(self.ReductionOfSpeedPlayers, Player)
|
|
elseif not table.hasValue(OverlappingActors, Player) and table.hasValue(self.ReductionOfSpeedPlayers, Player) then
|
|
UGCPawnAttrSystem.SetSpeedScale(Player, 1)
|
|
table.removeValue(self.ReductionOfSpeedPlayers, Player)
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
function BP_BossMoment:EnableStormWind()
|
|
print("BP_BossMoment_Fun_" .. "EnableStormWind_" .. KismetSystemLibrary.GetGameTimeInSeconds(self))
|
|
|
|
self.IsSkillStormWindEnable = true
|
|
UnrealNetwork.CallUnrealRPC_Multicast(self, "MulticastRPC_SetParticleVisibility", true);
|
|
self:GetController():GetBlackboardComponent():SetValueAsBool("IsSkillStormWindEnable", true)
|
|
if self:GetPawnClass() then
|
|
self.StormWindHurtHandle = EventSystem.SetTimerLoop(
|
|
self,
|
|
function ()
|
|
local OverlappingActors = self:GetSphereActors(self:K2_GetActorLocation(), 200, self:GetPawnClass())
|
|
for k, TargetPawn in pairs(OverlappingActors) do
|
|
self:MonsterApplyDamage(TargetPawn, self:GetAttack())
|
|
self:SetOverlapPlayerScaleSpeed()
|
|
end
|
|
end,
|
|
0.2
|
|
)
|
|
|
|
self.DisableStormWindHurtHandle = EventSystem.SetTimer(self,
|
|
function()
|
|
self:DisableStormWind()
|
|
self.DisableStormWindHurtHandle = nil
|
|
end,
|
|
5.0
|
|
)
|
|
end
|
|
end
|
|
|
|
function BP_BossMoment:DisableStormWind()
|
|
print("BP_BossMoment_Fun_" .. "DisableStormWind_" .. KismetSystemLibrary.GetGameTimeInSeconds(self))
|
|
|
|
self.IsSkillStormWindEnable = false
|
|
UnrealNetwork.CallUnrealRPC_Multicast(self, "MulticastRPC_SetParticleVisibility", false)
|
|
self:GetController():GetBlackboardComponent():SetValueAsBool("CanPlayStormWind", false)
|
|
self:GetController():GetBlackboardComponent():SetValueAsBool("IsSkillStormWindEnable", false)
|
|
|
|
if self.PawnClass then
|
|
for k, TargetPawn in pairs(self.ReductionOfSpeedPlayers) do
|
|
if TargetPawn ~= self then
|
|
UGCPawnAttrSystem.SetSpeedScale(TargetPawn, 1)
|
|
end
|
|
end
|
|
self.ReductionOfSpeedPlayers = {}
|
|
if self.StormWindHurtHandle then
|
|
EventSystem.StopTimer(self.StormWindHurtHandle)
|
|
self.StormWindHurtHandle = nil
|
|
end
|
|
end
|
|
end
|
|
|
|
function BP_BossMoment:ServerOnDeathEx(DeadMonster, KillerController, DamageCauser, KillingHitInfo, KillingHitImpulseDir, KillingHitDamageTypeID, DamageTypeClass, IsHeadShotDamage)
|
|
MonsterBoss.ServerOnDeathEx(self, DeadMonster, KillerController, DamageCauser, KillingHitInfo, KillingHitImpulseDir, KillingHitDamageTypeID, DamageTypeClass, IsHeadShotDamage)
|
|
if DeadMonster == self then
|
|
if self.DisableStormWindHurtHandle then
|
|
EventSystem.StopTimer(self.DisableStormWindHurtHandle)
|
|
self.DisableStormWindHurtHandle = nil
|
|
end
|
|
if self.StormWindHurtHandle then
|
|
self:DisableStormWind()
|
|
end
|
|
end
|
|
end
|
|
|
|
function BP_BossMoment:MulticastRPC_SetParticleVisibility(NewVisibility)
|
|
if self:HasAuthority() then return end
|
|
self.ParticleSystem_StormWind:SetVisibility(NewVisibility)
|
|
end
|
|
return BP_BossMoment; |