UGCProjects/GZJ/Script/Blueprint/AI/AIC_TyrantMonster.lua

133 lines
4.6 KiB
Lua
Raw Normal View History

2025-01-08 22:46:12 +08:00
---@class AIC_TyrantMonster_C:MobAIController
--Edit Below--
local AIC_TyrantMonster = {};
function AIC_TyrantMonster:ReceiveBeginPlay()
self.SuperClass.ReceiveBeginPlay(self);
-- if self:GetBlackboardComponent() and self:HasAuthority() then
-- print("BlackboardComponent is not nil")
-- self:GetBlackboardComponent():SetValueAsBool("IsSpeedIncrease", true)
-- print("IsSpeedIncrease : " .. tostring(self:GetBlackboardComponent():GetValueAsBool("IsSpeedIncrease")))
-- end
-- EventSystem.SetTimer(self,
-- function ()
-- if self:GetBlackboardComponent() and self:HasAuthority() then
-- print("Delay 0.5s BlackboardComponent is not nil")
-- self:GetBlackboardComponent():SetValueAsBool("IsSpeedIncrease", true)
-- print("Delay 0.5s IsSpeedIncrease : " .. tostring(self:GetBlackboardComponent():GetValueAsBool("IsSpeedIncrease")))
-- end
-- end
-- ,0.5
-- )
-- if UAIBlueprintHelperLibrary.GetBlackboard() and self:HasAuthority() then
-- print("BlackboardComponent is not nil")
-- UAIBlueprintHelperLibrary.GetBlackboard():SetValueAsBool("IsSpeedIncrease", true)
-- print("IsSpeedIncrease : " .. tostring(UAIBlueprintHelperLibrary.GetBlackboard():GetValueAsBool("IsSpeedIncrease")))
-- end
-- AddSkill
end
function AIC_TyrantMonster:OnPossess(PossessedPawn)
--self.SuperClass.OnPossess(PossessedPawn)
if self:HasAuthority() then
EventSystem.SetTimer(self,
function ()
self:SkillBloodthirsty()
self:SkillShield()
end,
0.5
)
end
end
function AIC_TyrantMonster:SkillBloodthirsty()
EventSystem.SetTimerLoop(self,
function ()
if (self:GetBlackboardComponent() and self:HasAuthority()) then
self:GetBlackboardComponent():SetValueAsBool("IsSpeedIncrease", true)
if not self:GetBlackboardComponent():GetValueAsBool("IsSpeedIncrease") then
print("[SKYERROR] IsSpeedIncrease Setting Failed [true] : " .. tostring(self:GetBlackboardComponent():GetValueAsBool("IsSpeedIncrease")))
else
EventSystem.SetTimer(self,
function ()
self:GetBlackboardComponent():SetValueAsBool("IsSpeedIncrease", false)
if self:GetBlackboardComponent():GetValueAsBool("IsSpeedIncrease") then
print("[SKYERROR] IsSpeedIncrease Setting Failed [false] : " .. tostring(self:GetBlackboardComponent():GetValueAsBool("IsSpeedIncrease")))
end
end,
MonsterParam.TyrantMonster.SkillParam.bloodthirsty.duration
)
end
end
end,
MonsterParam.TyrantMonster.SkillParam.bloodthirsty.delay
)
end
function AIC_TyrantMonster:SkillShield()
if not self:K2_GetPawn() then
return
end
self:K2_GetPawn():AddModifyDamageDelegationFun(
"SkillShield",
function (DamageAmount, DamageEvent, EventInstigator, DamageCauser)
if self:K2_GetPawn().ShieldValue > 0 then
self:K2_GetPawn().ShieldValue = self:K2_GetPawn().ShieldValue - DamageAmount
if self:K2_GetPawn().ShieldValue > 0 then
return 0
else
self:K2_GetPawn().SphereShield:SetVisibility(false)
local GivePawnDamage = self:K2_GetPawn().AttackValue / 2
UGCGameSystem.ApplyDamage(EventInstigator:K2_GetPawn(), GivePawnDamage, self,self, EDamageType.ShootDamage)
return -self:K2_GetPawn().ShieldValue
end
else
return DamageAmount
end
end
)
EventSystem.SetTimerLoop(
self,
function ()
print("AddSield")
self:K2_GetPawn().SphereShield:SetVisibility(true)
--self:K2_GetPawn().ShieldValue = self:K2_GetPawn().MaxHealth / 2
self:K2_GetPawn().ShieldValue = 200
end,
MonsterParam.TyrantMonster.SkillParam.Shield.delay
)
end
--[[
function AIC_TyrantMonster:ReceiveTick(DeltaTime)
self.SuperClass.ReceiveTick(self, DeltaTime);
end
--]]
--[[
function AIC_TyrantMonster:ReceiveEndPlay()
self.SuperClass.ReceiveEndPlay(self);
end
--]]
--[[
function AIC_TyrantMonster:GetReplicatedProperties()
return
end
--]]
--[[
function AIC_TyrantMonster:GetAvailableServerRPCs()
return
end
--]]
return AIC_TyrantMonster;