format codebase with prettier

This commit is contained in:
Evan
2025-01-30 19:46:36 -08:00
parent cd121a5cd4
commit 4ee37323f9
98 changed files with 12191 additions and 10234 deletions
+39 -35
View File
@@ -1,49 +1,53 @@
import { EventBus, GameEvent } from "../EventBus"
import { Execution, Game, Player, PlayerID } from "../game/Game"
import { EventBus, GameEvent } from "../EventBus";
import { Execution, Game, Player, PlayerID } from "../game/Game";
export class WinEvent implements GameEvent {
constructor(public readonly winner: Player) { }
constructor(public readonly winner: Player) {}
}
export class WinCheckExecution implements Execution {
private active = true;
private active = true
private mg: Game;
private mg: Game
constructor() {}
constructor() {
init(mg: Game, ticks: number) {
this.mg = mg;
}
tick(ticks: number) {
if (ticks % 10 != 0) {
return;
}
init(mg: Game, ticks: number) {
this.mg = mg
const sorted = this.mg
.players()
.sort((a, b) => b.numTilesOwned() - a.numTilesOwned());
if (sorted.length == 0) {
return;
}
tick(ticks: number) {
if (ticks % 10 != 0) {
return
}
const sorted = this.mg.players().sort((a, b) => b.numTilesOwned() - a.numTilesOwned())
if (sorted.length == 0) {
return
}
const max = sorted[0]
const numTilesWithoutFallout = this.mg.numLandTiles() - this.mg.numTilesWithFallout()
if (max.numTilesOwned() / numTilesWithoutFallout * 100 > this.mg.config().percentageTilesOwnedToWin()) {
this.mg.setWinner(max)
console.log(`${max.name()} has won the game`)
this.active = false
}
const max = sorted[0];
const numTilesWithoutFallout =
this.mg.numLandTiles() - this.mg.numTilesWithFallout();
if (
(max.numTilesOwned() / numTilesWithoutFallout) * 100 >
this.mg.config().percentageTilesOwnedToWin()
) {
this.mg.setWinner(max);
console.log(`${max.name()} has won the game`);
this.active = false;
}
}
owner(): Player {
return null
}
owner(): Player {
return null;
}
isActive(): boolean {
return this.active
}
isActive(): boolean {
return this.active;
}
activeDuringSpawnPhase(): boolean {
return false
}
}
activeDuringSpawnPhase(): boolean {
return false;
}
}