Skip to content

Commit

Permalink
Changelogs and a few other changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aehmttw committed Mar 19, 2023
1 parent 018b43a commit 77f86bb
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 62 deletions.
35 changes: 35 additions & 0 deletions src/main/java/tanks/gui/screen/ScreenChangelog.java
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,41 @@ public static void setupLogs()
"A ton of bug fixes and other minor improvements\n"
});

new Changelog("v1.5.0", new String[]
{
"*What's new in Tanks v1.5.0:\n\n" +
"*New arcade mode minigame:\n\n" +
"Point system based on tank kills\n" +
"Continuously spawning enemy tank waves\n" +
"Respawn if you die\n" +
"Time limit of 2 minutes and 12 seconds\n" +
"A rampage system for destroying tanks in a row\n" +
"Tanks drop items that you can use to your advantage\n" +
"Frenzy mode: destroy all you can when time runs out!\n" +
"Point bonuses judging your performance at the end\n\n",
"*Crusades:\n\n" +
"Font is now varied across statistics for readability\n" +
"Added crusade descriptions for built-in crusades\n" +
"Built-in crusades now track your best completion time,\n" +
"which you can see directly from the crusade screen\n" +
"Completed crusade runs can be compared to your best run\n\n" +
"*Options:\n\n" +
"Reorganized options screens\n" +
"Added new profile customization section to options\n" +
"You can now use a custom tank color in singleplayer\n" +
"Added option to show bullets under terrain\n" +
"Added 30 FPS deterministic mode\n\n",
"*More:\n\n" +
"Updated menu music\n" +
"Added item switching indicator on tank\n" +
"Updated tutorial to be more exciting\n" +
"Removed laser from versus mode\n" +
"Tanks will not explode on death if killed right after spawning\n" +
"Changed fireworks appearance\n" +
"Bug fixes and other minor improvements\n"
}
);

}
}
}
129 changes: 67 additions & 62 deletions src/main/java/tanks/tank/TankAIControlled.java
Original file line number Diff line number Diff line change
Expand Up @@ -1071,92 +1071,97 @@ public void updateIdleMotion()

if (!this.currentlySeeking && this.enablePathfinding && this.random.nextDouble() < this.seekChance * Panel.frameFrequency && this.posX > 0 && this.posX < Game.currentSizeX * Game.tile_size && this.posY > 0 && this.posY < Game.currentSizeY * Game.tile_size)
{
Tile[][] tiles = new Tile[Game.currentSizeX][Game.currentSizeY];
this.pathfind();
}

this.seekPause = Math.max(0, this.seekPause - Panel.frameFrequency);

for (int i = 0; i < tiles.length; i++)
if (this.parent != null && !seesTargetEnemy && this.stayNearParent)
{
if (!this.parent.destroy && Math.sqrt(Math.pow(this.posX - this.parent.posX, 2) + Math.pow(this.posY - this.parent.posY, 2)) > this.maxDistanceFromParent)
{
for (int j = 0; j < tiles[i].length; j++)
{
tiles[i][j] = new Tile(this.random, i, j);
}
this.overrideDirection = true;
this.setAccelerationInDirection(this.parent.posX, this.parent.posY, this.acceleration);
}
}
}

for (Obstacle o: Game.obstacles)
public void pathfind()
{
Tile[][] tiles = new Tile[Game.currentSizeX][Game.currentSizeY];

for (int i = 0; i < tiles.length; i++)
{
for (int j = 0; j < tiles[i].length; j++)
{
if (o.posX >= 0 && o.posY >= 0 && o.posX <= Game.currentSizeX * Game.tile_size && o.posY <= Game.currentSizeY * Game.tile_size)
{
Tile.Type t = Tile.Type.solid;
tiles[i][j] = new Tile(this.random, i, j);
}
}

if (!o.tankCollision && !(o instanceof ObstacleTeleporter))
t = Tile.Type.empty;
else if (o.destructible && this.enableMineLaying)
t = Tile.Type.destructible;
for (Obstacle o: Game.obstacles)
{
if (o.posX >= 0 && o.posY >= 0 && o.posX <= Game.currentSizeX * Game.tile_size && o.posY <= Game.currentSizeY * Game.tile_size)
{
Tile.Type t = Tile.Type.solid;

if (!o.tankCollision && !(o instanceof ObstacleTeleporter))
t = Tile.Type.empty;
else if (o.destructible && this.enableMineLaying)
t = Tile.Type.destructible;

int x = (int) (o.posX / Game.tile_size);
int y = (int) (o.posY / Game.tile_size);
Tile tile = tiles[x][y];
tile.type = t;
tile.unfavorability = Math.min(tile.unfavorability, 10);
int x = (int) (o.posX / Game.tile_size);
int y = (int) (o.posY / Game.tile_size);
Tile tile = tiles[x][y];
tile.type = t;
tile.unfavorability = Math.min(tile.unfavorability, 10);

for (int i = -1; i <= 1; i++)
for (int i = -1; i <= 1; i++)
{
for (int j = -1; j <= 1; j++)
{
for (int j = -1; j <= 1; j++)
{
if (x + i > 0 && x + i < tiles.length && y + j > 0 && y + j < tiles[0].length)
tiles[x + i][y + j].unfavorability = Math.max(tile.unfavorability, 1);
}
if (x + i > 0 && x + i < tiles.length && y + j > 0 && y + j < tiles[0].length)
tiles[x + i][y + j].unfavorability = Math.max(tile.unfavorability, 1);
}
}
}
}

for (Movable m: Game.movables)
{
if (this.isInterestingPathTarget(m))
tiles[Math.min(Game.currentSizeX - 1, Math.max(0, (int) (m.posX / Game.tile_size)))][Math.min(Game.currentSizeY - 1, Math.max(0, (int) (m.posY / Game.tile_size)))].interesting = true;
}
for (Movable m: Game.movables)
{
if (this.isInterestingPathTarget(m))
tiles[Math.min(Game.currentSizeX - 1, Math.max(0, (int) (m.posX / Game.tile_size)))][Math.min(Game.currentSizeY - 1, Math.max(0, (int) (m.posY / Game.tile_size)))].interesting = true;
}

ArrayList<Tile> queue = new ArrayList<>();
ArrayList<Tile> queue = new ArrayList<>();

Tile t = tiles[(int)(this.posX / Game.tile_size)][(int)(this.posY / Game.tile_size)];
t.explored = true;
queue.add(t);
Tile t = tiles[(int)(this.posX / Game.tile_size)][(int)(this.posY / Game.tile_size)];
t.explored = true;
queue.add(t);

Tile current = null;
boolean found = false;
Tile current = null;
boolean found = false;

while (!queue.isEmpty())
{
current = queue.remove(0);

if (current.search(queue, tiles))
{
found = true;
break;
}
}
while (!queue.isEmpty())
{
current = queue.remove(0);

if (found)
if (current.search(queue, tiles))
{
this.seekTimer = this.seekTimerBase;
this.currentlySeeking = true;
this.path = new ArrayList<>();

while (current.parent != null)
{
this.path.add(0, current);
current = current.parent;
}
found = true;
break;
}
}

this.seekPause = Math.max(0, this.seekPause - Panel.frameFrequency);

if (this.parent != null && !seesTargetEnemy && this.stayNearParent)
if (found)
{
if (!this.parent.destroy && Math.sqrt(Math.pow(this.posX - this.parent.posX, 2) + Math.pow(this.posY - this.parent.posY, 2)) > this.maxDistanceFromParent)
this.seekTimer = this.seekTimerBase;
this.currentlySeeking = true;
this.path = new ArrayList<>();

while (current.parent != null)
{
this.overrideDirection = true;
this.setAccelerationInDirection(this.parent.posX, this.parent.posY, this.acceleration);
this.path.add(0, current);
current = current.parent;
}
}
}
Expand Down

0 comments on commit 77f86bb

Please sign in to comment.