mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 09:04:08 +00:00
Add New Dash Directional
This commit is contained in:
1 parent
4dde214f94
commit
5b52c817d7
1 file changed
+19
-10
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user