Skip to content

Commit

Permalink
Some more bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aehmttw committed Nov 24, 2024
1 parent 04e6dca commit d0b6c58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/main/java/tanks/bullet/BulletArc.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class BulletArc extends Bullet
@Property(id = "min_range", minValue = 0.0, name = "Minimum range", category = BulletPropertyCategory.firing, desc = "The minimum distance this bullet may land from the tank that fired it \n \n 1 tile = 50 units")
public double minRange = 0;

@Property(id = "max_range", minValue = 0.0, name = "Maximum range", category = BulletPropertyCategory.firing, desc = "The maximum distance this bullet may land from the tank that fired it \n \n 1 tile = 50 units")
@Property(id = "max_range", minValue = 0.0, name = "Maximum range", category = BulletPropertyCategory.firing, desc = "The maximum distance this bullet may land from the tank that fired it. Set to 0 for unlimited. \n \n 1 tile = 50 units")
public double maxRange = 0;

@Property(id = "accuracy_spread_circle", minValue = 0.0, name = "Landing accuracy spread", category = BulletPropertyCategory.firing, desc = "The maximum distance between the target aim location and where the bullet actually lands, relative to the distance traveled by the bullet. Larger values are less accurate. \n \n A value of 1 corresponds to the bullet landing off by up to one tile per tile traveled.")
Expand Down Expand Up @@ -66,6 +66,7 @@ public void update()
double gravMod = this.getAttributeValue(AttributeModifier.velocity, 1);

this.vZ -= gravity * Panel.frameFrequency * gravMod;
this.posZ -= gravity * gravMod * Panel.frameFrequency * Panel.frameFrequency * 0.5;

if (this.posZ < Game.tile_size / 2 && !this.destroy)
{
Expand Down Expand Up @@ -155,7 +156,6 @@ public void setTargetLocation(double x, double y)
double dx = x - this.posX;
double dy = y - this.posY;
double d = Math.sqrt(dx * dx + dy * dy);
double offset = Math.random() * this.accuracySpreadCircle * d;
double s = Math.abs(this.speed);

if (d > this.maxRange && this.maxRange > 0)
Expand All @@ -172,6 +172,8 @@ public void setTargetLocation(double x, double y)
d = this.minRange;
}

double offset = Math.random() * this.accuracySpreadCircle * d;

double f = 1;
if (d / s < this.minAirTime)
f = d / (s * this.minAirTime);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tanks/tankson/TanksON.java
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ else if (o instanceof Item)

if (o instanceof TankAIControlled && equals(f.get(o), f.get(defaultTank)))
id = null;
else if ((o instanceof Bullet || o instanceof Mine) && equals(f.get(o), f.get(getDefault(o.getClass()))))
else if ((o instanceof Bullet || o instanceof Mine || o instanceof Explosion) && equals(f.get(o), f.get(getDefault(o.getClass()))))
id = null;

if (id != null)
Expand Down

0 comments on commit d0b6c58

Please sign in to comment.