mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 17:47:32 +00:00
Added dazed animation
This commit is contained in:
1 parent
cbc2b73625
commit
7ed68b7efe
5 files changed
+45
-3
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -579,6 +579,7 @@ public class PlayerAbilityData implements IPlayerAbilityData {
|
||||
|
||||
currentAbility.interrupt();
|
||||
stopAbilityAnimation();
|
||||
playAbilityAnimation(currentAbility.getDazedAnimation());
|
||||
releaseRotationControl();
|
||||
releaseLockedPosition();
|
||||
currentAbility = null;
|
||||
|
||||
Reference in new issue
Block a user