From b519d854f4f40a89b4a3e2b92872bb2cb7aeca81 Mon Sep 17 00:00:00 2001 From: VariableVince <24507472+VariableVince@users.noreply.github.com> Date: Sat, 14 Feb 2026 06:59:52 +0100 Subject: [PATCH] Replace last code that used isTerritoryBound with existing isStructureType too --- src/core/configuration/DefaultConfig.ts | 16 ---------------- src/core/execution/PlayerExecution.ts | 11 +++++++++-- src/core/game/Game.ts | 2 -- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index c4d1fd49b..cc52b48de 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -347,7 +347,6 @@ export class DefaultConfig implements Config { case UnitType.TransportShip: return { cost: () => 0n, - territoryBound: false, }; case UnitType.Warship: return { @@ -355,19 +354,16 @@ export class DefaultConfig implements Config { (numUnits: number) => Math.min(1_000_000, (numUnits + 1) * 250_000), UnitType.Warship, ), - territoryBound: false, maxHealth: 1000, }; case UnitType.Shell: return { cost: () => 0n, - territoryBound: false, damage: 250, }; case UnitType.SAMMissile: return { cost: () => 0n, - territoryBound: false, }; case UnitType.Port: return { @@ -377,19 +373,16 @@ export class DefaultConfig implements Config { UnitType.Port, UnitType.Factory, ), - territoryBound: true, constructionDuration: this.instantBuild() ? 0 : 2 * 10, upgradable: true, }; case UnitType.AtomBomb: return { cost: this.costWrapper(() => 750_000, UnitType.AtomBomb), - territoryBound: false, }; case UnitType.HydrogenBomb: return { cost: this.costWrapper(() => 5_000_000, UnitType.HydrogenBomb), - territoryBound: false, }; case UnitType.MIRV: return { @@ -399,22 +392,18 @@ export class DefaultConfig implements Config { } return 25_000_000n + game.stats().numMirvsLaunched() * 15_000_000n; }, - territoryBound: false, }; case UnitType.MIRVWarhead: return { cost: () => 0n, - territoryBound: false, }; case UnitType.TradeShip: return { cost: () => 0n, - territoryBound: false, }; case UnitType.MissileSilo: return { cost: this.costWrapper(() => 1_000_000, UnitType.MissileSilo), - territoryBound: true, constructionDuration: this.instantBuild() ? 0 : 10 * 10, upgradable: true, }; @@ -424,7 +413,6 @@ export class DefaultConfig implements Config { (numUnits: number) => Math.min(250_000, (numUnits + 1) * 50_000), UnitType.DefensePost, ), - territoryBound: true, constructionDuration: this.instantBuild() ? 0 : 5 * 10, }; case UnitType.SAMLauncher: @@ -434,7 +422,6 @@ export class DefaultConfig implements Config { Math.min(3_000_000, (numUnits + 1) * 1_500_000), UnitType.SAMLauncher, ), - territoryBound: true, constructionDuration: this.instantBuild() ? 0 : 30 * 10, upgradable: true, }; @@ -445,7 +432,6 @@ export class DefaultConfig implements Config { Math.min(1_000_000, Math.pow(2, numUnits) * 125_000), UnitType.City, ), - territoryBound: true, constructionDuration: this.instantBuild() ? 0 : 2 * 10, upgradable: true, }; @@ -457,14 +443,12 @@ export class DefaultConfig implements Config { UnitType.Factory, UnitType.Port, ), - territoryBound: true, constructionDuration: this.instantBuild() ? 0 : 2 * 10, upgradable: true, }; case UnitType.Train: return { cost: () => 0n, - territoryBound: false, }; default: assertNever(type); diff --git a/src/core/execution/PlayerExecution.ts b/src/core/execution/PlayerExecution.ts index 1e9ae4a10..35799a781 100644 --- a/src/core/execution/PlayerExecution.ts +++ b/src/core/execution/PlayerExecution.ts @@ -1,5 +1,12 @@ import { Config } from "../configuration/Config"; -import { Cell, Execution, Game, Player, UnitType } from "../game/Game"; +import { + Cell, + Execution, + Game, + isStructureType, + Player, + UnitType, +} from "../game/Game"; import { TileRef } from "../game/GameMap"; import { calculateBoundingBox, getMode, inscribed, simpleHash } from "../Util"; @@ -35,7 +42,7 @@ export class PlayerExecution implements Execution { tick(ticks: number) { this.player.decayRelations(); for (const u of this.player.units()) { - if (!u.info().territoryBound) { + if (!isStructureType(u.type())) { continue; } diff --git a/src/core/game/Game.ts b/src/core/game/Game.ts index 1a3ed75a0..2b2f2e7aa 100644 --- a/src/core/game/Game.ts +++ b/src/core/game/Game.ts @@ -223,8 +223,6 @@ export interface PublicGameModifiers { export interface UnitInfo { cost: (game: Game, player: Player) => Gold; - // Determines if its owner changes when its tile is conquered. - territoryBound: boolean; maxHealth?: number; damage?: number; constructionDuration?: number;