Targeting bugfixes
This commit is contained in:
@@ -51,15 +51,15 @@ public class Predict{
|
||||
return sol;
|
||||
}
|
||||
|
||||
public static Vec2 intercept(Position src, Hitboxc dst, float v){
|
||||
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), dst.deltaX(), dst.deltaY(), v);
|
||||
}
|
||||
|
||||
public static Vec2 intercept(Position src, Position dst, float v){
|
||||
float ddx = 0, ddy = 0;
|
||||
if(dst instanceof Hitboxc){
|
||||
ddx = ((Hitboxc)dst).deltaX();
|
||||
ddy = ((Hitboxc)dst).deltaY();
|
||||
ddx += ((Hitboxc)dst).deltaX();
|
||||
ddy += ((Hitboxc)dst).deltaY();
|
||||
}
|
||||
if(src instanceof Hitboxc){
|
||||
ddx -= ((Hitboxc)src).deltaX()/(Time.delta());
|
||||
ddy -= ((Hitboxc)src).deltaY()/(Time.delta());
|
||||
}
|
||||
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), ddx, ddy, v);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Units{
|
||||
* @return whether the target is invalid
|
||||
*/
|
||||
public static boolean invalidateTarget(Posc target, Team team, float x, float y, float range){
|
||||
return target == null || !target.isAdded() || (range != Float.MAX_VALUE && !target.within(x, y, range)) || (target instanceof Teamc && ((Teamc)target).team() == team) || (target instanceof Healthc && !((Healthc)target).isValid());
|
||||
return target == null || (range != Float.MAX_VALUE && !target.within(x, y, range)) || (target instanceof Teamc && ((Teamc)target).team() == team) || (target instanceof Healthc && !((Healthc)target).isValid());
|
||||
}
|
||||
|
||||
/** See {@link #invalidateTarget(Posc, Team, float, float, float)} */
|
||||
|
||||
@@ -219,7 +219,7 @@ public abstract class BulletType extends Content{
|
||||
bullet.damage(damage < 0 ? this.damage : damage);
|
||||
bullet.add();
|
||||
|
||||
if(keepVelocity && owner instanceof Velc) bullet.vel().add(((Velc)owner).vel());
|
||||
if(keepVelocity && owner instanceof Hitboxc) bullet.vel().add(((Hitboxc)owner).deltaX(), ((Hitboxc)owner).deltaY());
|
||||
return bullet;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user