Browse Source

sqrMagnitude not sqrRoot

mobile-class-refactor
MagicBot 1 year ago
parent
commit
7e5ed3efe5
  1. 2
      src/engine/mobileAI/utilities/CombatUtilities.java

2
src/engine/mobileAI/utilities/CombatUtilities.java

@ -48,7 +48,7 @@ public class CombatUtilities {
} }
public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) { public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) {
return entity1.getLoc().distance2D(entity2.getLoc()) < range; return entity1.getLoc().distanceSquared2D(entity2.getLoc()) < range * range;
} }
public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) { public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) {

Loading…
Cancel
Save