解决了狐狸大招冷却和消耗的问题

This commit is contained in:
2025-10-18 17:30:58 +08:00
parent e0d7329905
commit ddde270ad5
11 changed files with 65 additions and 31 deletions

View File

@ -11,12 +11,18 @@ function FoxUltimate:ctor()
self.ultimate_phase = 1 -- 大招阶段
self.active_recast_handle = nil
self.active_accelerate_handle = nil
self.tag_add_or_remove_delegate = nil
end
function FoxUltimate:K2_ActivateAbilityFromEvent(EventData)
print("FoxUltimate:K2_ActivateAbilityFromEvent", self.ultimate_phase)
if not self:K2_CommitAbilityCost(false) then
return self:K2_EndAbility()
end
local owner = self:GetOwningActorFromActorInfo()
self.movement = owner.MovementComponent
self.animation = owner.SpineAnimationComponent
@ -25,8 +31,17 @@ function FoxUltimate:K2_ActivateAbilityFromEvent(EventData)
local asc = self.asc
if self.tag_add_or_remove_delegate == nil then
self.tag_add_or_remove_delegate = slua.createDelegate(function(tag, is_add)
if is_add == 0 and not self.bIsActive then
self.ultimate_phase = 1
self:K2_CommitAbilityCooldown(false, false)
end
end)
owner:BindGameplayTagAddOrRemove(self.recast_tag, self.tag_add_or_remove_delegate)
end
if self.ultimate_phase == 1 or asc:HasMatchingGameplayTag(self.recast_tag) then
print("triggered")
self:TriggerUltimate(asc)
else
self:K2_EndAbility()
@ -134,7 +149,19 @@ end
function FoxUltimate:OnAnimationComplete(entry)
self.ultimate_phase = self.ultimate_phase + 1
local new_phase = self.ultimate_phase + 1
if new_phase > 3 then
self.ultimate_phase = 1
else
self.ultimate_phase = new_phase
end
print("FoxUltimate:OnAnimationComplete", self.ultimate_phase)
if not self.asc:HasMatchingGameplayTag(self.recast_tag) then
self.ultimate_phase = 1
self:K2_CommitAbilityCooldown(false, false)
end
entry.AnimationComplete:Clear()
entry.AnimationEvent:Clear()
self:K2_EndAbility()