61 protected void applyForce(CombatEntityAPI other,
float amount) {
62 float dist = Misc.getDistance(
source.getLocation(), other.getLocation());
63 dist -= other.getCollisionRadius();
64 if (dist >
range)
return;
67 float fDist = 0.25f + 0.75f * Math.min(1f, (1f - dist /
range));
68 float fConstant = 20f;
70 float acceleration =
maxForce / other.getMass() * fTime * fDist * fConstant;
72 Vector2f dir = Misc.getUnitVectorAtDegreeAngle(Misc.getAngleInDegrees(other.getLocation(),
source.getLocation()));
73 dir.scale(acceleration);
75 other.getVelocity().x += dir.x * amount;
76 other.getVelocity().y += dir.y * amount;