69 lines
2.7 KiB
Lua
69 lines
2.7 KiB
Lua
local SimpleSkillTask = require("Script.SimpleSkill.Task.SimpleSkillTask")
|
|
local SimpleSkillTask_StarFall = LuaClass("SimpleSkillTask_StarFall", SimpleSkillTask)
|
|
local SimpleSkillSelectorFactory = require("Script.SimpleSkill.Factory.SimpleSkillSelectorFactory")
|
|
|
|
SimpleSkillTask_StarFall.AdditionAttackRateTable = {0.36, 0.48, 0.63, 0.9} --威力值加成
|
|
SimpleSkillTask_StarFall.TargetLimitNumTable = {2, 3, 4, 5} --目标个数
|
|
|
|
SimpleSkillTask_StarFall.CurAdditionAttackRate = 0.0
|
|
SimpleSkillTask_StarFall.CurTargetLimitNum = 0
|
|
|
|
function SimpleSkillTask_StarFall:ctor(OwnerSkill)
|
|
SimpleSkillTask_StarFall.super.ctor(self, OwnerSkill)
|
|
end
|
|
|
|
function SimpleSkillTask_StarFall:InitTaskFromData(TaskData, CasterPawn)
|
|
SimpleSkillTask.InitTaskFromData(self, TaskData, CasterPawn)
|
|
|
|
self.TaskName = "StarFall"
|
|
|
|
end
|
|
|
|
function SimpleSkillTask_StarFall:UpdateSkillLevel(NewSkillLevel)
|
|
SimpleSkillTask.UpdateSkillLevel(self, NewSkillLevel)
|
|
|
|
self.CurAdditionAttackRate = self.AdditionAttackRateTable[self.SkillLevel]
|
|
self.CurTargetLimitNum = self.TargetLimitNumTable[self.SkillLevel]
|
|
|
|
if self.TaskSelector ~= nil then
|
|
self.TaskSelector = nil
|
|
end
|
|
local SelectorData = {
|
|
LimitNum = self.CurTargetLimitNum,
|
|
ForwardOffset = 0,
|
|
Param_Float = 200,
|
|
Param_Vector = VectorHelper.VectorZero(),
|
|
}
|
|
local SelectorClass = SimpleSkillSelectorFactory.GetSelectorByType(ESkillSelectorType.CircleRange)
|
|
self.TaskSelector = SelectorClass.New()
|
|
self.TaskSelector:InitSelectorFromData(SelectorData, self.CasterPawn)
|
|
end
|
|
|
|
function SimpleSkillTask_StarFall:ActivateTask()
|
|
SimpleSkillTask.ActivateTask(self)
|
|
|
|
self.TaskLoopHandle = EventSystem.SetTimerLoop(self.CasterPawn,
|
|
function()
|
|
local Base_Attack = UGCGameSystem.GetPlayerStateByPlayerKey(self.CasterPawn.PlayerKey).Attributes[AttributeType.Base].Base_Attack
|
|
local DamageAmount = 240 + Base_Attack * self.CurAdditionAttackRate
|
|
local EventInstigator = UGCGameSystem.GetPlayerControllerByPlayerKey(self.CasterPawn.PlayerKey)
|
|
|
|
local TargetMonsters = self.TaskSelector:GetTargetPawns()
|
|
for _, Monster in pairs(TargetMonsters) do
|
|
UGCGameSystem.ApplyDamage(Monster, DamageAmount, EventInstigator, self.CasterPawn, EDamageType.ShootDamage)
|
|
end
|
|
|
|
if not table.isEmpty(TargetMonsters) then
|
|
self:EnableSkillEffect(self.CasterPawn, TargetMonsters, EEffectSpawnLocationType.Bottom)
|
|
end
|
|
end, 3.0)
|
|
end
|
|
|
|
function SimpleSkillTask_StarFall:DeactivateTask()
|
|
if self.TaskLoopHandle then
|
|
EventSystem.StopTimer(self.TaskLoopHandle)
|
|
end
|
|
end
|
|
|
|
|
|
return SimpleSkillTask_StarFall; |