have Team be an enum instead of an object, this was causing equality problems.

This commit is contained in:
Evan
2025-04-05 21:39:12 -07:00
parent f620264ce3
commit c7356a7348
16 changed files with 72 additions and 93 deletions
+4 -11
View File
@@ -1,12 +1,5 @@
import { GameEvent } from "../EventBus";
import {
Execution,
Game,
GameMode,
Player,
Team,
TeamName,
} from "../game/Game";
import { Execution, Game, GameMode, Player, Team } from "../game/Game";
export class WinEvent implements GameEvent {
constructor(public readonly winner: Player) {}
@@ -73,9 +66,9 @@ export class WinCheckExecution implements Execution {
this.mg.numLandTiles() - this.mg.numTilesWithFallout();
const percentage = (max[1] / numTilesWithoutFallout) * 100;
if (percentage > this.mg.config().percentageTilesOwnedToWin()) {
if (max[0].name == TeamName.Bot) return;
this.mg.setWinner(max[0].name, this.mg.stats().stats());
console.log(`${max[0].name} has won the game`);
if (max[0] == Team.Bot) return;
this.mg.setWinner(max[0], this.mg.stats().stats());
console.log(`${max[0]} has won the game`);
this.active = false;
}
}