UGCProjects/GZJ/Script/SimpleSkill/Task/SimpleSkillTask_Seal.lua
2025-01-08 22:46:12 +08:00

67 lines
2.6 KiB
Lua

local SimpleSkillTask = require("Script.SimpleSkill.Task.SimpleSkillTask")
local SimpleSkillTask_Seal = LuaClass("SimpleSkillTask_Seal", SimpleSkillTask)
SimpleSkillTask_Seal.AdditionDamageRateTable = {2.0, 2.6, 3.2, 4.0}
SimpleSkillTask_Seal.StunDurationTable = {1.0, 1.2, 1.4, 2.0}
SimpleSkillTask_Seal.CurDamageRate = 0.0
SimpleSkillTask_Seal.CurStunDuration = 0.0
function SimpleSkillTask_Seal:ctor(OwnerSkill)
SimpleSkillTask_Seal.super.ctor(self, OwnerSkill)
end
function SimpleSkillTask_Seal:InitTaskFromData(TaskData, CasterPawn)
SimpleSkillTask.InitTaskFromData(self, TaskData, CasterPawn)
end
function SimpleSkillTask_Seal:UpdateSkillLevel(NewSkillLevel)
SimpleSkillTask.UpdateSkillLevel(self, NewSkillLevel)
self.CurStunDuration = self.StunDurationTable[NewSkillLevel]
self.CurDamageRate = self.AdditionDamageRateTable[NewSkillLevel]
end
function SimpleSkillTask_Seal:ActivateTask()
SimpleSkillTask.ActivateTask(self)
local TargetPawn = nil
local TargetPawns = self:GetTargetPawns()
if TargetPawns[1] ~= nil and UE.IsValid(TargetPawns[1]) then
TargetPawn = TargetPawns[1]
else
return
end
self:EnableEffectWithId(23, self.CasterPawn, {TargetPawn}, self.CurStunDuration, EEffectSpawnLocationType.Bottom)
local Radius = 150
local SphereLoc = TargetPawn:K2_GetActorLocation()
SphereLoc.Z = SphereLoc.Z - 88.0
local ObjectTypes = {}
local ActorClassFilter = UE.LoadClass(BPClassPath.MonsterBase)
local ActorsToIgnore = {self.CasterPawn}
local RetVal, OutActors = KismetSystemLibrary.SphereOverlapActors(self.CasterPawn, SphereLoc, Radius, ObjectTypes, ActorClassFilter, ActorsToIgnore)
if GlobalConfigs.OpenDebug then
UnrealNetwork.CallUnrealRPC_Multicast(self.CasterPawn, "DrawDebugSphere", VectorHelper.ToLuaTable(SphereLoc), {1,0,0,1}, Radius)
end
if RetVal then
local DamageAmount = 120 + UGCGameSystem.GetPlayerStateByPlayerKey(self.CasterPawn.PlayerKey).Attributes[AttributeType.Base].Base_Attack * self.CurDamageRate
local EventInstigator = UGCGameSystem.GetPlayerControllerByPlayerKey(self.CasterPawn.PlayerKey)
for i, Monster in pairs(OutActors) do
if Monster ~= nil and UE.IsValid(Monster) and UGCSimpleCharacterSystem.GetHealth(Monster) > 0 then
Monster:SetIsStun(true, self.CurStunDuration)
UGCGameSystem.ApplyDamage(Monster, DamageAmount, EventInstigator, self.CasterPawn, EDamageType.ShootDamage)
end
end
end
end
function SimpleSkillTask_Seal:DeactivateTask()
end
return SimpleSkillTask_Seal;