mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-24 04:02:37 +00:00
format codebase with prettier
This commit is contained in:
@@ -1,47 +1,55 @@
|
||||
import { consolex } from "../Consolex";
|
||||
import { Execution, Game, Player, Unit, PlayerID, UnitType } from "../game/Game";
|
||||
import {
|
||||
Execution,
|
||||
Game,
|
||||
Player,
|
||||
Unit,
|
||||
PlayerID,
|
||||
UnitType,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
|
||||
export class CityExecution implements Execution {
|
||||
private player: Player;
|
||||
private mg: Game;
|
||||
private city: Unit;
|
||||
private active: boolean = true;
|
||||
|
||||
private player: Player
|
||||
private mg: Game
|
||||
private city: Unit
|
||||
private active: boolean = true
|
||||
constructor(
|
||||
private ownerId: PlayerID,
|
||||
private tile: TileRef,
|
||||
) {}
|
||||
|
||||
constructor(private ownerId: PlayerID, private tile: TileRef) { }
|
||||
init(mg: Game, ticks: number): void {
|
||||
this.mg = mg;
|
||||
this.player = mg.player(this.ownerId);
|
||||
}
|
||||
|
||||
init(mg: Game, ticks: number): void {
|
||||
this.mg = mg
|
||||
this.player = mg.player(this.ownerId)
|
||||
tick(ticks: number): void {
|
||||
if (this.city == null) {
|
||||
const spawnTile = this.player.canBuild(UnitType.City, this.tile);
|
||||
if (spawnTile == false) {
|
||||
consolex.warn("cannot build city");
|
||||
this.active = false;
|
||||
return;
|
||||
}
|
||||
this.city = this.player.buildUnit(UnitType.City, 0, spawnTile);
|
||||
}
|
||||
|
||||
tick(ticks: number): void {
|
||||
if (this.city == null) {
|
||||
const spawnTile = this.player.canBuild(UnitType.City, this.tile)
|
||||
if (spawnTile == false) {
|
||||
consolex.warn('cannot build city')
|
||||
this.active = false
|
||||
return
|
||||
}
|
||||
this.city = this.player.buildUnit(UnitType.City, 0, spawnTile)
|
||||
}
|
||||
if (!this.city.isActive()) {
|
||||
this.active = false
|
||||
return
|
||||
}
|
||||
if (!this.city.isActive()) {
|
||||
this.active = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user