diff --git a/src/core/GameView.ts b/src/core/GameView.ts index 18d5f061a..91fcdb769 100644 --- a/src/core/GameView.ts +++ b/src/core/GameView.ts @@ -70,6 +70,10 @@ export class PlayerView { return this.game.worker.playerInteraction(this.id(), this.game.x(tile), this.game.y(tile)) } + units(): UnitView[] { + return this.game.units().filter(u => u.owner().smallID() == this.smallID()) + } + nameLocation(): NameViewData { return this.nameData } diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index ff016623e..33917e1c6 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -1,5 +1,6 @@ import { Difficulty, GameType, Gold, Player, PlayerInfo, PlayerType, TerrainType, TerraNullius, Tick, UnitInfo, UnitType } from "../game/Game"; import { GameMap, TileRef } from "../game/GameMap"; +import { PlayerView } from "../GameView"; import { GameConfig } from "../Schemas"; import { assertNever, within } from "../Util"; import { Config, ServerConfig, Theme } from "./Config"; @@ -276,7 +277,7 @@ export class DefaultConfig implements Config { return 25000 } - maxPopulation(player: Player): number { + maxPopulation(player: Player | PlayerView): number { let maxPop = Math.pow(player.numTilesOwned(), .6) * 1000 + 50000 if (player.type() == PlayerType.Bot) { return maxPop