Fix NPCs getting stuck after using one ability

The terminal DAZED to IDLE transition was swallowed before the completion
switch ran, so the finished ability stayed set as the current one and the NPC
never started another until it died and reset. Guard abilities compounded it:
NPCs reuse a single ability instance and onExecute left pendingCompletion set,
ending every later activation on its first tick.
This commit is contained in:
KAMKEEL committed 2026-08-11 03:25:51 -04:00
1 parent abd1c7cbeb
commit 6af66b8883
2 files changed
+15 -1

No files matched your search

@@ -786,7 +786,15 @@ public abstract class AbstractDataAbilities {
fireTickEvent(currentAbility, target);
// Script may have completed/cancelled the ability during the tick event
if (currentAbility == null || !currentAbility.isExecuting()) return;
if (currentAbility == null) return;
if (!currentAbility.isExecuting()) {
// tick() itself can end the ability (DAZED -> IDLE). Run its completion here,
// otherwise it stays the current ability forever and nothing else can start.
if (phaseChanged && currentAbility.getPhase() == AbilityPhase.IDLE) {
handleAbilityCompletion(target);
}
return;
}
// Fire extender tick hook (e.g., per-tick resource drain)
if (!AbilityController.Instance.fireOnAbilityTick(currentAbility, entity, target,