format codebase with prettier

This commit is contained in:
Evan
2025-02-01 12:05:11 -08:00
parent cd121a5cd4
commit 4ee37323f9
98 changed files with 12190 additions and 10233 deletions
+56 -46
View File
@@ -1,58 +1,68 @@
import { Cell, Execution, Game, Player, PlayerInfo, PlayerType } from "../game/Game"
import { TileRef } from "../game/GameMap"
import { BotExecution } from "./BotExecution"
import { PlayerExecution } from "./PlayerExecution"
import { getSpawnTiles } from "./Util"
import {
Cell,
Execution,
Game,
Player,
PlayerInfo,
PlayerType,
} from "../game/Game";
import { TileRef } from "../game/GameMap";
import { BotExecution } from "./BotExecution";
import { PlayerExecution } from "./PlayerExecution";
import { getSpawnTiles } from "./Util";
export class SpawnExecution implements Execution {
active: boolean = true;
private mg: Game;
active: boolean = true
private mg: Game
constructor(
private playerInfo: PlayerInfo,
private tile: TileRef,
) {}
constructor(
private playerInfo: PlayerInfo,
private tile: TileRef
) { }
init(mg: Game, ticks: number) {
this.mg = mg;
}
init(mg: Game, ticks: number) {
this.mg = mg
tick(ticks: number) {
this.active = false;
if (!this.mg.inSpawnPhase()) {
return;
}
tick(ticks: number) {
this.active = false
if (!this.mg.inSpawnPhase()) {
return
}
const existing = this.mg.players().find(p => p.id() == this.playerInfo.id)
if (existing) {
existing.tiles().forEach(t => existing.relinquish(t))
getSpawnTiles(this.mg, this.tile).forEach(t => {
existing.conquer(t)
})
return
}
const player = this.mg.addPlayer(this.playerInfo, this.mg.config().startManpower(this.playerInfo))
getSpawnTiles(this.mg, this.tile).forEach(t => {
player.conquer(t)
})
this.mg.addExecution(new PlayerExecution(player.id()))
if (player.type() == PlayerType.Bot) {
this.mg.addExecution(new BotExecution(player))
}
const existing = this.mg
.players()
.find((p) => p.id() == this.playerInfo.id);
if (existing) {
existing.tiles().forEach((t) => existing.relinquish(t));
getSpawnTiles(this.mg, this.tile).forEach((t) => {
existing.conquer(t);
});
return;
}
owner(): Player {
return null
}
isActive(): boolean {
return this.active
const player = this.mg.addPlayer(
this.playerInfo,
this.mg.config().startManpower(this.playerInfo),
);
getSpawnTiles(this.mg, this.tile).forEach((t) => {
player.conquer(t);
});
this.mg.addExecution(new PlayerExecution(player.id()));
if (player.type() == PlayerType.Bot) {
this.mg.addExecution(new BotExecution(player));
}
}
activeDuringSpawnPhase(): boolean {
return true
}
owner(): Player {
return null;
}
isActive(): boolean {
return this.active;
}
}
activeDuringSpawnPhase(): boolean {
return true;
}
}