diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/Ability.java b/src/main/java/kamkeel/npcs/controllers/data/ability/Ability.java index 11ceffea8..9e2482fc6 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/Ability.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/Ability.java @@ -81,10 +81,12 @@ public abstract class Ability implements IAbility { // Animations (global animation IDs, -1 = none) protected int windUpAnimationId = -1; // Animation to play during wind up (user animations) protected int activeAnimationId = -1; // Animation to play during active phase (user animations) + protected int dazedAnimationId = -1; // Animation to play during dazed phase (user animations) // Built-in animation names (empty = none, takes priority over IDs if set) protected String windUpAnimationName = ""; // Built-in animation name for wind up protected String activeAnimationName = ""; // Built-in animation name for active phase + protected String dazedAnimationName = "Ability_Generic_Dazed"; // Built-in animation name for dazed phase // Telegraph configuration protected boolean showTelegraph = true; @@ -597,6 +599,10 @@ public abstract class Ability implements IAbility { this::getActiveAnimationId, this::setActiveAnimationId, this::getActiveAnimationName, this::setActiveAnimationName) .tab("Effects")); + defs.add(FieldDef.animSubGui("ability.dazedAnimation", + this::getDazedAnimationId, this::setDazedAnimationId, + this::getDazedAnimationName, this::setDazedAnimationName) + .tab("Effects")); TelegraphType tType = getTelegraphType(); if (tType != null && tType != TelegraphType.NONE) { @@ -1133,8 +1139,10 @@ public abstract class Ability implements IAbility { nbt.setString("activeSound", activeSound); nbt.setInteger("windUpAnimationId", windUpAnimationId); nbt.setInteger("activeAnimationId", activeAnimationId); + nbt.setInteger("dazedAnimationId", dazedAnimationId); nbt.setString("windUpAnimationName", windUpAnimationName); nbt.setString("activeAnimationName", activeAnimationName); + nbt.setString("dazedAnimationName", dazedAnimationName); nbt.setBoolean("showTelegraph", showTelegraph); nbt.setString("telegraphType", telegraphType.name()); nbt.setFloat("telegraphHeightOffset", telegraphHeightOffset); @@ -1192,8 +1200,10 @@ public abstract class Ability implements IAbility { activeSound = nbt.getString("activeSound"); windUpAnimationId = nbt.getInteger("windUpAnimationId"); activeAnimationId = nbt.getInteger("activeAnimationId"); + dazedAnimationId = nbt.getInteger("dazedAnimationId"); windUpAnimationName = nbt.getString("windUpAnimationName"); activeAnimationName = nbt.getString("activeAnimationName"); + dazedAnimationName = nbt.getString("dazedAnimationName"); showTelegraph = nbt.getBoolean("showTelegraph"); try { telegraphType = TelegraphType.valueOf(nbt.getString("telegraphType")); @@ -1614,6 +1624,36 @@ public abstract class Ability implements IAbility { this.activeAnimationName = activeAnimationName != null ? activeAnimationName : ""; } + public Animation getDazedAnimation() { + if (AnimationController.Instance == null) return null; + + // Built-in animation by name takes priority + if (dazedAnimationName != null && !dazedAnimationName.isEmpty()) { + return (Animation) AnimationController.Instance.get(dazedAnimationName, true); + } + // Fall back to user animation by ID + if (dazedAnimationId >= 0) { + return (Animation) AnimationController.Instance.get(dazedAnimationId); + } + return null; + } + + public int getDazedAnimationId() { + return dazedAnimationId; + } + + public void setDazedAnimationId(int dazedAnimationId) { + this.dazedAnimationId = dazedAnimationId; + } + + public String getDazedAnimationName() { + return dazedAnimationName; + } + + public void setDazedAnimationName(String dazedAnimationName) { + this.dazedAnimationName = dazedAnimationName != null ? dazedAnimationName : ""; + } + public boolean isShowTelegraph() { return showTelegraph; } diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityGuard.java b/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityGuard.java index dc1b075e7..331ed0de4 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityGuard.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityGuard.java @@ -373,7 +373,7 @@ public class AbilityGuard extends Ability implements IAbilityGuard { FieldDef.soundSubGui("ability.counterSound", this::getCounterSound, this::setCounterSound) .tab("Effects").visibleWhen(this::canCounter)); - FieldDef.insertAfter(defs, "ability.activeAnimation", + FieldDef.insertAfter(defs, "ability.dazedAnimation", FieldDef.animSubGui("ability.counterAnimation", this::getCounterAnimationId, this::setCounterAnimationId, this::getCounterAnimationName, this::setCounterAnimationName) diff --git a/src/main/java/noppes/npcs/DataAbilities.java b/src/main/java/noppes/npcs/DataAbilities.java index 78692162f..f71af949d 100644 --- a/src/main/java/noppes/npcs/DataAbilities.java +++ b/src/main/java/noppes/npcs/DataAbilities.java @@ -758,8 +758,8 @@ public class DataAbilities { // Remove telegraph early removeTelegraph(currentAbility); - // Stop any ability animation - stopAbilityAnimation(); + // Plays dazed animation + playAbilityAnimation(currentAbility.getDazedAnimation()); // Release locks releaseRotationControl(); diff --git a/src/main/java/noppes/npcs/controllers/data/PlayerAbilityData.java b/src/main/java/noppes/npcs/controllers/data/PlayerAbilityData.java index 60386b8bf..04dadc76f 100644 --- a/src/main/java/noppes/npcs/controllers/data/PlayerAbilityData.java +++ b/src/main/java/noppes/npcs/controllers/data/PlayerAbilityData.java @@ -579,6 +579,7 @@ public class PlayerAbilityData implements IPlayerAbilityData { currentAbility.interrupt(); stopAbilityAnimation(); + playAbilityAnimation(currentAbility.getDazedAnimation()); releaseRotationControl(); releaseLockedPosition(); currentAbility = null; diff --git a/src/main/resources/assets/customnpcs/lang/en_US.lang b/src/main/resources/assets/customnpcs/lang/en_US.lang index eaaf48a45..ece75624e 100644 --- a/src/main/resources/assets/customnpcs/lang/en_US.lang +++ b/src/main/resources/assets/customnpcs/lang/en_US.lang @@ -1694,6 +1694,7 @@ ability.activeSound=Active Sound ability.counterSound=Counter Sound ability.windUpAnimation=Wind Up Animation ability.activeAnimation=Active Animation +ability.dazedAnimation=Dazed Animation ability.counterAnimation=Counter Animation ability.showTelegraph=Show Telegraph ability.windUpColor=Wind Up Color