97 lines
3.6 KiB
Lua
97 lines
3.6 KiB
Lua
---@class BP_MonsterInherit_1_C:BP_MonsterBreach_C
|
|
---@field ParticleSystem UParticleSystemComponent
|
|
---@field Sphere USphereComponent
|
|
---@field UAESkillManager UUAESkillManagerComponent
|
|
--Edit Below--
|
|
-- local BP_MonsterInherit_1 = {};
|
|
|
|
local MonsterBreach = require('Script.Blueprint.Monster.BP_MonsterBreach')
|
|
|
|
local BP_MonsterInherit_1 = setmetatable(
|
|
{
|
|
IncreaseAttackMonsters = {};
|
|
ID = 1001;
|
|
CheckTargetPlayerKeyHandle = nil;
|
|
MonsterName = "MonsterInherit_1",
|
|
},
|
|
{
|
|
__index = MonsterBreach,
|
|
__metatable = MonsterBreach
|
|
}
|
|
);
|
|
|
|
function BP_MonsterInherit_1:ReceiveBeginPlayEx()
|
|
MonsterBreach.ReceiveBeginPlayEx(self)
|
|
if self:HasAuthority() then
|
|
self:AddMajinSkill()
|
|
self.Inherit_1SkillLoop = EventSystem.SetTimerLoop(self, function()
|
|
self:SetOverlapMonsterIncreaseAttack()
|
|
end, 1)
|
|
else
|
|
self.CheckTargetPlayerKeyHandle = EventSystem.SetTimerLoop(self, function()
|
|
if self.TargetPlayerKey ~= -1 then
|
|
EventSystem.StopTimer(self.CheckTargetPlayerKeyHandle)
|
|
local PC = GameDataManager.GetLocalPlayerController()
|
|
if PC.PlayerKey == self.TargetPlayerKey then
|
|
UIManager:ClosePanel(EUIType.Inherit)
|
|
else
|
|
end
|
|
else
|
|
end
|
|
end, 0.5)
|
|
end
|
|
end
|
|
|
|
function BP_MonsterInherit_1:ReceiveEndPlayEx()
|
|
MonsterBreach.ReceiveEndPlayEx(self)
|
|
if self.IncreaseAttackMonsters then
|
|
for _, Monster in pairs(self.IncreaseAttackMonsters) do
|
|
if UE.IsValid(Monster) then
|
|
Monster:AddAdditionalAttack(-self.BaseAttackValue)
|
|
end
|
|
end
|
|
end
|
|
self.IncreaseAttackMonsters = {}
|
|
end
|
|
|
|
function BP_MonsterInherit_1:SetOverlapMonsterIncreaseAttack()
|
|
|
|
local Monsters = GameplayStatics.GetAllActorsOfClass(self, self:GetMonsterClass(), {})
|
|
if Monsters then
|
|
print("MonstersLength: " .. #Monsters)
|
|
local SelfLocation = self:K2_GetActorLocation()
|
|
for k, Monster in pairs(Monsters) do
|
|
print("BP_MonsterInherit_1_SetOverlapMonsterIncreaseAttack" .. "ClassName: " .. KismetSystemLibrary.GetObjectName(Monster))
|
|
local MonsterLocation = Monster:K2_GetActorLocation()
|
|
|
|
if VectorHelper.GetDistance(SelfLocation, MonsterLocation) <= 500 then
|
|
if (not table.hasValue(self.IncreaseAttackMonsters, Monster)) and Monster.AttackValue ~= nil then
|
|
table.insert(self.IncreaseAttackMonsters, Monster)
|
|
Monster:AddAdditionalAttack(Monster.BaseAttackValue)
|
|
print("BP_MonsterInherit_1_BeginOtherActor.AttackValue : " .. Monster:GetAttack())
|
|
end
|
|
else
|
|
if table.hasValue(self.IncreaseAttackMonsters, Monster) then
|
|
Monster:AddAdditionalAttack(-Monster.BaseAttackValue)
|
|
print("BP_MonsterInherit_1_BeginOtherActor.AttackValue : " .. Monster:GetAttack())
|
|
table.removeValue(self.IncreaseAttackMonsters, Monster)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function BP_MonsterInherit_1:AddMajinSkill()
|
|
self:AddAdditionalAttack(self.BaseAttackValue * 0.2)
|
|
end
|
|
|
|
function BP_MonsterInherit_1:ReceiveOnMonsterDeath()
|
|
MonsterBreach.ReceiveOnMonsterDeath(self)
|
|
if self:HasAuthority() then
|
|
if self.Inherit_1SkillLoop then EventSystem.StopTimer(self.Inherit_1SkillLoop) self.Inherit_1SkillLoop = nil return end
|
|
else
|
|
if UE.IsValid(self.ParticleSystem) then self.ParticleSystem:SetVisibility(false) end
|
|
end
|
|
end
|
|
|
|
return BP_MonsterInherit_1; |