diff --git a/tank-frontend/src/PlayerInfo.tsx b/tank-frontend/src/PlayerInfo.tsx
index 92935d9..f20c800 100644
--- a/tank-frontend/src/PlayerInfo.tsx
+++ b/tank-frontend/src/PlayerInfo.tsx
@@ -65,13 +65,18 @@ export default function PlayerInfo({playerId}: { playerId: Guid }) {
;
diff --git a/tank-frontend/src/Scoreboard.tsx b/tank-frontend/src/Scoreboard.tsx
index 13e987f..93b8667 100644
--- a/tank-frontend/src/Scoreboard.tsx
+++ b/tank-frontend/src/Scoreboard.tsx
@@ -47,6 +47,16 @@ export default function Scoreboard({}: {}) {
field: 'walls',
visualize: p => p.scores.wallsDestroyed.toString(),
sorter: (a, b) => numberSorter(a.scores.wallsDestroyed, b.scores.wallsDestroyed)
+ },
+ {
+ field: 'bullets',
+ visualize: p => p.scores.shotsFired.toString(),
+ sorter: (a, b) => numberSorter(a.scores.shotsFired, b.scores.shotsFired)
+ },
+ {
+ field: 'score',
+ visualize: p => p.scores.overallScore.toString(),
+ sorter: (a, b) => numberSorter(a.scores.overallScore, b.scores.overallScore)
}
]}/>
}
diff --git a/tank-frontend/src/serverCalls.tsx b/tank-frontend/src/serverCalls.tsx
index 7281471..0a16c85 100644
--- a/tank-frontend/src/serverCalls.tsx
+++ b/tank-frontend/src/serverCalls.tsx
@@ -1,7 +1,7 @@
import {Guid} from './Guid.ts';
export function makeApiUrl(path: string, protocol: 'http' | 'ws' = 'http') {
- return new URL(`${protocol}://${window.location.hostname}${path}`);
+ return new URL(`${protocol}://${window.location.hostname}${path}`);
}
export type ServerResponse = {
@@ -16,6 +16,8 @@ export type Scores = {
readonly kills: number;
readonly deaths: number;
readonly wallsDestroyed: number;
+ readonly shotsFired: number;
+ readonly overallScore: number;
};
export type Player = {
diff --git a/tanks-backend/TanksServer/GameLogic/ShootFromTanks.cs b/tanks-backend/TanksServer/GameLogic/ShootFromTanks.cs
index 23f93ef..e816d5b 100644
--- a/tanks-backend/TanksServer/GameLogic/ShootFromTanks.cs
+++ b/tanks-backend/TanksServer/GameLogic/ShootFromTanks.cs
@@ -30,6 +30,7 @@ internal sealed class ShootFromTanks(
if (explosive)
tank.ExplosiveBullets--;
+ tank.Owner.Scores.ShotsFired++;
entityManager.SpawnBullet(tank.Owner, tank.Position, tank.Orientation / 16d, explosive);
}
}
diff --git a/tanks-backend/TanksServer/Models/Scores.cs b/tanks-backend/TanksServer/Models/Scores.cs
index afa730d..79063b6 100644
--- a/tanks-backend/TanksServer/Models/Scores.cs
+++ b/tanks-backend/TanksServer/Models/Scores.cs
@@ -19,4 +19,8 @@ internal sealed record class Scores
}
public int WallsDestroyed { get; set; }
+
+ public int ShotsFired { get; set; }
+
+ public int OverallScore => Math.Max(0, 10000 * Kills - 1000 * Deaths + 10 * ShotsFired + 10 * WallsDestroyed);
}