From 5b52c817d788f5d29e144cea1f8d1787913ff3c6 Mon Sep 17 00:00:00 2001 From: Kam Date: Sat, 21 Feb 2026 04:11:39 -0500 Subject: [PATCH] Add New Dash Directional --- .../data/ability/type/AbilityDash.java | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) 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 fffbf6ca5..b5342e3d8 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 @@ -26,7 +26,8 @@ public class AbilityDash extends AbilityMovement implements IAbilityDash { */ public enum DashMode { AGGRESSIVE, - DEFENSIVE; + DEFENSIVE, + DIRECTIONAL; @Override public String toString() { @@ -35,6 +36,8 @@ public class AbilityDash extends AbilityMovement implements IAbilityDash { return "ability.dash.aggressive"; case DEFENSIVE: return "ability.dash.defensive"; + case DIRECTIONAL: + return "ability.dash.directional"; default: return name(); } @@ -124,16 +127,22 @@ public class AbilityDash extends AbilityMovement implements IAbilityDash { public void onExecute(EntityLivingBase caster, EntityLivingBase target) { initMovement(caster, dashDistance, dashSpeed); - // Choose random direction based on mode - DashDirection[] directions = dashMode == DashMode.AGGRESSIVE - ? AGGRESSIVE_DIRECTIONS - : DEFENSIVE_DIRECTIONS; - chosenDirection = directions[RANDOM.nextInt(directions.length)]; + if (dashMode == DashMode.DIRECTIONAL) { + // Dash straight in the caster's look direction + chosenDirection = DashDirection.FORWARD; + setDirectionFromYaw(caster.rotationYaw); + } else { + // Choose random direction based on mode + DashDirection[] directions = dashMode == DashMode.AGGRESSIVE + ? AGGRESSIVE_DIRECTIONS + : DEFENSIVE_DIRECTIONS; + chosenDirection = directions[RANDOM.nextInt(directions.length)]; - // Calculate direction: base yaw (toward target or look dir) + direction offset - float baseYaw = getBaseYaw(caster, target); - float dashYaw = baseYaw + chosenDirection.getAngleOffset(); - setDirectionFromYaw(dashYaw); + // Calculate direction: base yaw (toward target or look dir) + direction offset + float baseYaw = getBaseYaw(caster, target); + float dashYaw = baseYaw + chosenDirection.getAngleOffset(); + setDirectionFromYaw(dashYaw); + } // Small upward impulse for a skip/hop arc (gravity handles the descent) caster.motionY = 0.2;