From 81857669b0925a4a4530d28d9d88a646e7f4e53a Mon Sep 17 00:00:00 2001 From: Vidal Date: Wed, 25 Feb 2026 21:46:48 -0300 Subject: [PATCH] Changes to AbilityDash and AbilityLaser animations --- gradle-plugins | 2 +- .../data/ability/type/AbilityDash.java | 79 ++++- .../animations/Ability_Laser_Active.json | 252 ++++++++++++---- .../animations/Ability_Laser_Windup.json | 274 +----------------- .../assets/customnpcs/lang/en_US.lang | 17 +- 5 files changed, 291 insertions(+), 333 deletions(-) diff --git a/gradle-plugins b/gradle-plugins index 34cbba98f..6b643524c 160000 --- a/gradle-plugins +++ b/gradle-plugins @@ -1 +1 @@ -Subproject commit 34cbba98f1d3edf84e8c7d67216fe02a520a5cbc +Subproject commit 6b643524c151677b6b3c583edad14406f35b3843 diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityDash.java b/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityDash.java index af7e8fa7a..cf149a533 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityDash.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityDash.java @@ -55,7 +55,8 @@ public class AbilityDash extends AbilityMovement implements IAbilityDash { RIGHT(-90), DIAGONAL_BACK_LEFT(135), DIAGONAL_BACK_RIGHT(-135), - BACK(180); + BACK(180), + CUSTOM(0); private final float angleOffset; @@ -66,6 +67,40 @@ public class AbilityDash extends AbilityMovement implements IAbilityDash { public float getAngleOffset() { return angleOffset; } + + @Override + public String toString() { + switch (this) { + case FORWARD: + return "ability.dash.forward"; + case DIAGONAL_FORWARD_LEFT: + return "ability.dash.diagonalForwardLeft"; + case DIAGONAL_FORWARD_RIGHT: + return "ability.dash.diagonalForwardRight"; + case LEFT: + return "ability.dash.left"; + case RIGHT: + return "ability.dash.right"; + case DIAGONAL_BACK_LEFT: + return "ability.dash.diagonalBackLeft"; + case DIAGONAL_BACK_RIGHT: + return "ability.dash.diagonalBackRight"; + case BACK: + return "ability.dash.back"; + case CUSTOM: + return "ability.dash.custom"; + default: + return name(); + } + } + + public static DashDirection fromOrdinal(int ordinal) { + DashDirection[] values = values(); + if (ordinal >= 0 && ordinal < values.length) { + return values[ordinal]; + } + return DashDirection.FORWARD; + } } private static final Random RANDOM = new Random(); @@ -86,8 +121,10 @@ public class AbilityDash extends AbilityMovement implements IAbilityDash { // Type-specific parameters private DashMode dashMode = DashMode.DEFENSIVE; + private DashDirection dashDirection = DashDirection.FORWARD; private float dashDistance = 4.0f; private float dashSpeed = 0.5f; + private float dashAngle = 0.0f; // Type-specific runtime state private transient DashDirection chosenDirection; @@ -133,8 +170,11 @@ public class AbilityDash extends AbilityMovement implements IAbilityDash { if (dashMode == DashMode.DIRECTIONAL) { // Dash straight in the caster's look direction - chosenDirection = DashDirection.FORWARD; - setDirectionFromYaw(caster.rotationYaw); + chosenDirection = dashDirection; + float baseYaw = getBaseYaw(caster, target); + float angleOffset = chosenDirection == DashDirection.CUSTOM ? dashAngle : chosenDirection.getAngleOffset(); + float dashYaw = baseYaw + angleOffset; + setDirectionFromYaw(dashYaw); } else { // Choose random direction based on mode DashDirection[] directions = dashMode == DashMode.AGGRESSIVE @@ -241,8 +281,10 @@ public class AbilityDash extends AbilityMovement implements IAbilityDash { @Override public void writeTypeNBT(NBTTagCompound nbt) { nbt.setString("dashMode", dashMode.name()); + nbt.setString("dashDirection", dashDirection.name()); nbt.setFloat("dashDistance", dashDistance); nbt.setFloat("dashSpeed", dashSpeed); + nbt.setFloat("dashAngle", dashAngle); } @Override @@ -252,8 +294,16 @@ public class AbilityDash extends AbilityMovement implements IAbilityDash { } catch (Exception e) { this.dashMode = DashMode.DEFENSIVE; } + + try { + this.dashDirection = DashDirection.valueOf(nbt.getString("dashDirection")); + } catch (Exception e) { + this.dashDirection = DashDirection.FORWARD; + } + this.dashDistance = nbt.hasKey("dashDistance") ? nbt.getFloat("dashDistance") : 4.0f; this.dashSpeed = nbt.hasKey("dashSpeed") ? Math.max(0.01f, nbt.getFloat("dashSpeed")) : 0.5f; + this.dashAngle = nbt.hasKey("dashAngle") ? Math.max(0.01f, nbt.getFloat("dashAngle")) : 0.0f; } // Getters & Setters @@ -292,6 +342,22 @@ public class AbilityDash extends AbilityMovement implements IAbilityDash { this.dashSpeed = dashSpeed; } + public float getDashAngle() { + return dashAngle; + } + + public void setDashAngle(float dashAngle) { + this.dashAngle = dashAngle; + } + + public DashDirection getDashDirection() { + return dashDirection; + } + + public void setDashDirection(DashDirection dashDirection) { + this.dashDirection = dashDirection; + } + public DashDirection getChosenDirection() { return chosenDirection; } @@ -313,7 +379,12 @@ public class AbilityDash extends AbilityMovement implements IAbilityDash { FieldDef.row( FieldDef.floatField("ability.dashDistance", this::getDashDistance, this::setDashDistance), FieldDef.floatField("ability.dashSpeed", this::getDashSpeed, this::setDashSpeed) - ) + ), + FieldDef.row( + FieldDef.enumField("ability.dashDirection", DashDirection.class, this::getDashDirection, this::setDashDirection), + FieldDef.floatField("ability.dashAngle", this::getDashAngle, this::setDashAngle) + .visibleWhen(() -> getDashDirection() == DashDirection.CUSTOM) + ).visibleWhen(() -> this.getDashModeEnum() == DashMode.DIRECTIONAL) )); } } diff --git a/src/main/resources/assets/customnpcs/animations/Ability_Laser_Active.json b/src/main/resources/assets/customnpcs/animations/Ability_Laser_Active.json index 5cb4fc3be..f3117602a 100644 --- a/src/main/resources/assets/customnpcs/animations/Ability_Laser_Active.json +++ b/src/main/resources/assets/customnpcs/animations/Ability_Laser_Active.json @@ -2,69 +2,195 @@ "Loop": 0, "Speed": 1.0f, "Frames": [ - { - "ColorMarker": 16777215, - "Comment": "", - "Speed": 3.0f, - "FrameParts": [ - { - "Pivot2": 0.0f, - "Part": "LEFT_LEG", - "Rotation1": 0.0f, - "Rotation0": 0.0f, - "Pivot0": 0.0f, - "Pivot1": 0.0f, - "Rotation2": -18.0f - }, - { - "Pivot2": 5.0f, - "Part": "BODY", - "Rotation1": 0.0f, - "Rotation0": -25.0f, - "Pivot0": 0.0f, - "Pivot1": 2.0f, - "Rotation2": 0.0f - }, - { - "Pivot2": 0.0f, - "Part": "RIGHT_LEG", - "Rotation1": 0.0f, - "Rotation0": 0.0f, - "Pivot0": 0.0f, - "Pivot1": 0.0f, - "Rotation2": 18.0f - }, - { - "Pivot2": 2.0f, - "Part": "LEFT_ARM", - "Rotation1": 0.0f, - "Rotation0": -195.0f, - "Pivot0": -1.0f, - "Pivot1": -1.0f, - "Rotation2": -56.0f - }, - { - "Pivot2": 4.0f, - "Part": "RIGHT_ARM", - "Rotation1": 90.0f, - "Rotation0": -90.0f, - "Pivot0": 0.0f, - "Pivot1": -1.0f, - "Rotation2": 90.0f - }, - { - "Pivot2": 5.0f, - "Part": "HEAD", - "Rotation1": 0.0f, - "Rotation0": -37.0f, - "Pivot0": 0.0f, - "Pivot1": 2.0f, - "Rotation2": 0.0f - } - ], - "Smooth": 0b, - "Duration": 3 - } + { + "ColorMarker": 16777215, + "Comment": "", + "Speed": 3.0f, + "FrameParts": [ + { + "Pivot2": 0.0f, + "Part": "LEFT_LEG", + "Rotation1": 0.0f, + "Rotation0": 12.0f, + "Pivot0": 0.0f, + "Pivot1": 0.0f, + "Rotation2": -18.0f + }, + { + "Pivot2": 0.0f, + "Part": "LEFT_ARM", + "Rotation1": 50.0f, + "Rotation0": -82.0f, + "Pivot0": 0.0f, + "Pivot1": 0.0f, + "Rotation2": 0.0f + }, + { + "Pivot2": 0.0f, + "Part": "RIGHT_LEG", + "Rotation1": 0.0f, + "Rotation0": 12.0f, + "Pivot0": 0.0f, + "Pivot1": 0.0f, + "Rotation2": 18.0f + }, + { + "Pivot2": 0.0f, + "Part": "RIGHT_ARM", + "Rotation1": 2.0f, + "Rotation0": -88.0f, + "Pivot0": 1.0f, + "Pivot1": 2.0f, + "Rotation2": 86.0f + }, + { + "Pivot2": 3.0f, + "Part": "HEAD", + "Rotation1": 0.0f, + "Rotation0": 0.0f, + "Pivot0": 0.0f, + "Pivot1": 1.0f, + "Rotation2": 0.0f + }, + { + "Pivot2": 3.0f, + "Part": "BODY", + "Rotation1": 0.0f, + "Rotation0": -12.0f, + "Pivot0": 0.0f, + "Pivot1": 1.0f, + "Rotation2": 0.0f + } + ], + "Smooth": 0b, + "Duration": 3 + }, + { + "ColorMarker": 16777215, + "Comment": "", + "Speed": 3.0f, + "FrameParts": [ + { + "Pivot2": 0.0f, + "Part": "LEFT_LEG", + "Rotation1": 0.0f, + "Rotation0": 12.0f, + "Pivot0": 0.0f, + "Pivot1": 0.0f, + "Rotation2": -18.0f + }, + { + "Pivot2": 0.0f, + "Part": "LEFT_ARM", + "Rotation1": 50.0f, + "Rotation0": -82.0f, + "Pivot0": 0.0f, + "Pivot1": 0.0f, + "Rotation2": 0.0f + }, + { + "Pivot2": 0.0f, + "Part": "RIGHT_LEG", + "Rotation1": 0.0f, + "Rotation0": 12.0f, + "Pivot0": 0.0f, + "Pivot1": 0.0f, + "Rotation2": 18.0f + }, + { + "Pivot2": 0.0f, + "Part": "RIGHT_ARM", + "Rotation1": 0.0f, + "Rotation0": -92.0f, + "Pivot0": 1.0f, + "Pivot1": 2.0f, + "Rotation2": 94.0f + }, + { + "Pivot2": 3.0f, + "Part": "HEAD", + "Rotation1": 0.0f, + "Rotation0": 0.0f, + "Pivot0": 0.0f, + "Pivot1": 1.0f, + "Rotation2": 0.0f + }, + { + "Pivot2": 3.0f, + "Part": "BODY", + "Rotation1": 0.0f, + "Rotation0": -12.0f, + "Pivot0": 0.0f, + "Pivot1": 1.0f, + "Rotation2": 0.0f + } + ], + "Smooth": 0b, + "Duration": 3 + }, + { + "ColorMarker": 16777215, + "Comment": "", + "Speed": 3.0f, + "FrameParts": [ + { + "Pivot2": 0.0f, + "Part": "LEFT_LEG", + "Rotation1": 0.0f, + "Rotation0": 12.0f, + "Pivot0": 0.0f, + "Pivot1": 0.0f, + "Rotation2": -18.0f + }, + { + "Pivot2": 0.0f, + "Part": "LEFT_ARM", + "Rotation1": 50.0f, + "Rotation0": -82.0f, + "Pivot0": 0.0f, + "Pivot1": 0.0f, + "Rotation2": 0.0f + }, + { + "Pivot2": 0.0f, + "Part": "RIGHT_LEG", + "Rotation1": 0.0f, + "Rotation0": 12.0f, + "Pivot0": 0.0f, + "Pivot1": 0.0f, + "Rotation2": 18.0f + }, + { + "Pivot2": 0.0f, + "Part": "RIGHT_ARM", + "Rotation1": -2.0f, + "Rotation0": -90.0f, + "Pivot0": 1.0f, + "Pivot1": 2.0f, + "Rotation2": 80.0f + }, + { + "Pivot2": 3.0f, + "Part": "HEAD", + "Rotation1": 0.0f, + "Rotation0": 0.0f, + "Pivot0": 0.0f, + "Pivot1": 1.0f, + "Rotation2": 0.0f + }, + { + "Pivot2": 3.0f, + "Part": "BODY", + "Rotation1": 0.0f, + "Rotation0": -12.0f, + "Pivot0": 0.0f, + "Pivot1": 1.0f, + "Rotation2": 0.0f + } + ], + "Smooth": 0b, + "Duration": 3 + } ], "CurrentFrameTime": 0, "CurrentFrame": 3, diff --git a/src/main/resources/assets/customnpcs/animations/Ability_Laser_Windup.json b/src/main/resources/assets/customnpcs/animations/Ability_Laser_Windup.json index c445faca9..c12700304 100644 --- a/src/main/resources/assets/customnpcs/animations/Ability_Laser_Windup.json +++ b/src/main/resources/assets/customnpcs/animations/Ability_Laser_Windup.json @@ -7,15 +7,6 @@ "Comment": "", "Speed": 3.0f, "FrameParts": [ - { - "Pivot2": 3.0f, - "Part": "HEAD", - "Rotation1": 0.0f, - "Rotation0": 0.0f, - "Pivot0": 0.0f, - "Pivot1": 1.0f, - "Rotation2": 0.0f - }, { "Pivot2": 0.0f, "Part": "LEFT_LEG", @@ -25,15 +16,6 @@ "Pivot1": 0.0f, "Rotation2": -18.0f }, - { - "Pivot2": 0.0f, - "Part": "RIGHT_LEG", - "Rotation1": 0.0f, - "Rotation0": 12.0f, - "Pivot0": 0.0f, - "Pivot1": 0.0f, - "Rotation2": 18.0f - }, { "Pivot2": 0.0f, "Part": "LEFT_ARM", @@ -43,6 +25,15 @@ "Pivot1": 0.0f, "Rotation2": 0.0f }, + { + "Pivot2": 0.0f, + "Part": "RIGHT_LEG", + "Rotation1": 0.0f, + "Rotation0": 12.0f, + "Pivot0": 0.0f, + "Pivot1": 0.0f, + "Rotation2": 18.0f + }, { "Pivot2": 0.0f, "Part": "RIGHT_ARM", @@ -52,24 +43,6 @@ "Pivot1": 2.0f, "Rotation2": 90.0f }, - { - "Pivot2": 3.0f, - "Part": "BODY", - "Rotation1": 0.0f, - "Rotation0": -12.0f, - "Pivot0": 0.0f, - "Pivot1": 1.0f, - "Rotation2": 0.0f - } - ], - "Smooth": 0b, - "Duration": 3 - }, - { - "ColorMarker": 16777215, - "Comment": "", - "Speed": 3.0f, - "FrameParts": [ { "Pivot2": 3.0f, "Part": "HEAD", @@ -79,42 +52,6 @@ "Pivot1": 1.0f, "Rotation2": 0.0f }, - { - "Pivot2": 0.0f, - "Part": "LEFT_LEG", - "Rotation1": 0.0f, - "Rotation0": 12.0f, - "Pivot0": 0.0f, - "Pivot1": 0.0f, - "Rotation2": -18.0f - }, - { - "Pivot2": 0.0f, - "Part": "RIGHT_LEG", - "Rotation1": 0.0f, - "Rotation0": 12.0f, - "Pivot0": 0.0f, - "Pivot1": 0.0f, - "Rotation2": 18.0f - }, - { - "Pivot2": 0.0f, - "Part": "LEFT_ARM", - "Rotation1": 50.0f, - "Rotation0": -82.0f, - "Pivot0": 0.0f, - "Pivot1": 0.0f, - "Rotation2": 0.0f - }, - { - "Pivot2": 0.0f, - "Part": "RIGHT_ARM", - "Rotation1": 2.0f, - "Rotation0": -88.0f, - "Pivot0": 1.0f, - "Pivot1": 2.0f, - "Rotation2": 86.0f - }, { "Pivot2": 3.0f, "Part": "BODY", @@ -126,200 +63,11 @@ } ], "Smooth": 0b, - "Duration": 3 - }, - { - "ColorMarker": 16777215, - "Comment": "", - "Speed": 3.0f, - "FrameParts": [ - { - "Pivot2": 3.0f, - "Part": "HEAD", - "Rotation1": 0.0f, - "Rotation0": 0.0f, - "Pivot0": 0.0f, - "Pivot1": 1.0f, - "Rotation2": 0.0f - }, - { - "Pivot2": 0.0f, - "Part": "LEFT_LEG", - "Rotation1": 0.0f, - "Rotation0": 12.0f, - "Pivot0": 0.0f, - "Pivot1": 0.0f, - "Rotation2": -18.0f - }, - { - "Pivot2": 0.0f, - "Part": "RIGHT_LEG", - "Rotation1": 0.0f, - "Rotation0": 12.0f, - "Pivot0": 0.0f, - "Pivot1": 0.0f, - "Rotation2": 18.0f - }, - { - "Pivot2": 0.0f, - "Part": "LEFT_ARM", - "Rotation1": 50.0f, - "Rotation0": -82.0f, - "Pivot0": 0.0f, - "Pivot1": 0.0f, - "Rotation2": 0.0f - }, - { - "Pivot2": 0.0f, - "Part": "RIGHT_ARM", - "Rotation1": 0.0f, - "Rotation0": -92.0f, - "Pivot0": 1.0f, - "Pivot1": 2.0f, - "Rotation2": 94.0f - }, - { - "Pivot2": 3.0f, - "Part": "BODY", - "Rotation1": 0.0f, - "Rotation0": -12.0f, - "Pivot0": 0.0f, - "Pivot1": 1.0f, - "Rotation2": 0.0f - } - ], - "Smooth": 0b, - "Duration": 3 - }, - { - "ColorMarker": 16777215, - "Comment": "", - "Speed": 3.0f, - "FrameParts": [ - { - "Pivot2": 3.0f, - "Part": "HEAD", - "Rotation1": 0.0f, - "Rotation0": 0.0f, - "Pivot0": 0.0f, - "Pivot1": 1.0f, - "Rotation2": 0.0f - }, - { - "Pivot2": 0.0f, - "Part": "LEFT_LEG", - "Rotation1": 0.0f, - "Rotation0": 12.0f, - "Pivot0": 0.0f, - "Pivot1": 0.0f, - "Rotation2": -18.0f - }, - { - "Pivot2": 0.0f, - "Part": "RIGHT_LEG", - "Rotation1": 0.0f, - "Rotation0": 12.0f, - "Pivot0": 0.0f, - "Pivot1": 0.0f, - "Rotation2": 18.0f - }, - { - "Pivot2": 0.0f, - "Part": "LEFT_ARM", - "Rotation1": 50.0f, - "Rotation0": -82.0f, - "Pivot0": 0.0f, - "Pivot1": 0.0f, - "Rotation2": 0.0f - }, - { - "Pivot2": 0.0f, - "Part": "RIGHT_ARM", - "Rotation1": -2.0f, - "Rotation0": -90.0f, - "Pivot0": 1.0f, - "Pivot1": 2.0f, - "Rotation2": 80.0f - }, - { - "Pivot2": 3.0f, - "Part": "BODY", - "Rotation1": 0.0f, - "Rotation0": -12.0f, - "Pivot0": 0.0f, - "Pivot1": 1.0f, - "Rotation2": 0.0f - } - ], - "Smooth": 0b, - "Duration": 3 - }, - { - "ColorMarker": 16777215, - "Comment": "", - "Speed": 3.0f, - "FrameParts": [ - { - "Pivot2": 5.0f, - "Part": "HEAD", - "Rotation1": 0.0f, - "Rotation0": -37.0f, - "Pivot0": 0.0f, - "Pivot1": 2.0f, - "Rotation2": 0.0f - }, - { - "Pivot2": 0.0f, - "Part": "LEFT_LEG", - "Rotation1": 0.0f, - "Rotation0": 0.0f, - "Pivot0": 0.0f, - "Pivot1": 0.0f, - "Rotation2": -18.0f - }, - { - "Pivot2": 0.0f, - "Part": "RIGHT_LEG", - "Rotation1": 0.0f, - "Rotation0": 0.0f, - "Pivot0": 0.0f, - "Pivot1": 0.0f, - "Rotation2": 18.0f - }, - { - "Pivot2": 2.0f, - "Part": "LEFT_ARM", - "Rotation1": 0.0f, - "Rotation0": -195.0f, - "Pivot0": -1.0f, - "Pivot1": -1.0f, - "Rotation2": -56.0f - }, - { - "Pivot2": 4.0f, - "Part": "RIGHT_ARM", - "Rotation1": 90.0f, - "Rotation0": -90.0f, - "Pivot0": 0.0f, - "Pivot1": -1.0f, - "Rotation2": 90.0f - }, - { - "Pivot2": 5.0f, - "Part": "BODY", - "Rotation1": 0.0f, - "Rotation0": -25.0f, - "Pivot0": 0.0f, - "Pivot1": 2.0f, - "Rotation2": 0.0f - } - ], - "Smooth": 0b, - "Duration": 3 + "Duration": 15 } ], "CurrentFrameTime": 0, - "CurrentFrame": 3, + "CurrentFrame": 4, "Smooth": 0b, "ID": 12, "WhileAttacking": 1b, diff --git a/src/main/resources/assets/customnpcs/lang/en_US.lang b/src/main/resources/assets/customnpcs/lang/en_US.lang index 885947f0d..9caf6027a 100644 --- a/src/main/resources/assets/customnpcs/lang/en_US.lang +++ b/src/main/resources/assets/customnpcs/lang/en_US.lang @@ -1595,6 +1595,17 @@ ability.dash.aggressive=Aggressive ability.dash.defensive=Defensive ability.dash.directional=Directional +# Dash Direction +ability.dash.forward=Forward +ability.dash.diagonalForwardLeft=Diagonal Forward Left +ability.dash.diagonalForwardRight=Diagonal Forward Right +ability.dash.left=Left +ability.dash.right=Right +ability.dash.diagonalBackLeft=Diagonal Back Left +ability.dash.diagonalBackRight=Diagonal Back Right +ability.dash.back=Back +ability.dash.custom=Custom + # Counter Type ability.counter.flat=Flat ability.counter.percent=Percent @@ -1867,8 +1878,10 @@ ability.chargeSpeed=Charge Speed # Dash ability.dashMode=Dash Mode -ability.dashDistance=Dash Distance -ability.dashSpeed=Dash Speed +ability.dashDistance=Distance +ability.dashDirection=Direction +ability.dashSpeed=Speed +ability.dashAngle=Angle # Teleport ability.blinkRadius=Blink Radius