UGCProjects/GZJ/Script/SimpleSkill/Task/SimpleSkillTask_Puncture.lua

41 lines
1.7 KiB
Lua
Raw Normal View History

2025-01-08 22:46:12 +08:00
local SimpleSkillTask = require("Script.SimpleSkill.Task.SimpleSkillTask")
local SimpleSkillTask_Puncture = LuaClass("SimpleSkillTask_Puncture", SimpleSkillTask)
SimpleSkillTask_Puncture.AdditionDamageRateTable = {1.5, 2.5, 3.5, 5.0}
SimpleSkillTask_Puncture.StunDurationTable = {2, 2.2, 2.5, 3}
SimpleSkillTask_Puncture.CurDamageRate = 0.0
SimpleSkillTask_Puncture.CurStunDuration = 0.0
function SimpleSkillTask_Puncture:ctor(OwnerSkill)
SimpleSkillTask_Puncture.super.ctor(self, OwnerSkill)
end
function SimpleSkillTask_Puncture:InitTaskFromData(TaskData, CasterPawn)
SimpleSkillTask.InitTaskFromData(self, TaskData, CasterPawn)
self.TaskName = "Puncture"
end
function SimpleSkillTask_Puncture:UpdateSkillLevel(NewSkillLevel)
SimpleSkillTask.UpdateSkillLevel(self, NewSkillLevel)
self.CurDamageRate = self.AdditionDamageRateTable[self.SkillLevel]
self.CurStunDuration = self.StunDurationTable[self.SkillLevel]
end
function SimpleSkillTask_Puncture:ActivateTask()
SimpleSkillTask.ActivateTask(self)
self:EnableSkillEffect(self.CasterPawn, nil, EEffectSpawnLocationType.Bottom)
local Base_Attack = UGCGameSystem.GetPlayerStateByPlayerKey(self.CasterPawn.PlayerKey).Attributes[AttributeType.Base].Base_Attack
local DamageAmount = 150 + Base_Attack * self.CurDamageRate
local EventInstigator = UGCGameSystem.GetPlayerControllerByPlayerKey(self.CasterPawn.PlayerKey)
local TargetPawns = self:GetTargetPawns()
for _, TargetPawn in pairs(TargetPawns) do
TargetPawn:SetIsStun(true, self.CurStunDuration)
UGCGameSystem.ApplyDamage(TargetPawn, DamageAmount, EventInstigator, self.CasterPawn, EDamageType.ShootDamage)
end
end
return SimpleSkillTask_Puncture;