From 52542baa636006faf0ee86016ec621287b83f325 Mon Sep 17 00:00:00 2001 From: Scott Anderson <662325+scottanderson@users.noreply.github.com> Date: Thu, 3 Apr 2025 01:35:29 -0400 Subject: [PATCH] Remove unnecessary casts --- src/core/execution/FakeHumanExecution.ts | 1 - src/core/game/PlayerImpl.ts | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core/execution/FakeHumanExecution.ts b/src/core/execution/FakeHumanExecution.ts index cb04d3bb4..fb2371909 100644 --- a/src/core/execution/FakeHumanExecution.ts +++ b/src/core/execution/FakeHumanExecution.ts @@ -177,7 +177,6 @@ export class FakeHumanExecution implements Execution { const enemies = enemiesWithTN .filter((o) => o.isPlayer()) - .map((o) => o as Player) .sort((a, b) => a.troops() - b.troops()); if (this.random.chance(20)) { diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index 9606e205b..85878ed77 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -447,12 +447,12 @@ export class PlayerImpl implements Player { this.mg.target(this, other); } - targets(): PlayerImpl[] { + targets(): Player[] { return this.targets_ .filter( (t) => this.mg.ticks() - t.tick < this.mg.config().targetDuration(), ) - .map((t) => t.target as PlayerImpl); + .map((t) => t.target); } transitiveTargets(): Player[] { @@ -759,7 +759,6 @@ export class PlayerImpl implements Player { nukeSpawn(tile: TileRef): TileRef | false { // only get missilesilos that are not on cooldown const spawns = this.units(UnitType.MissileSilo) - .map((u) => u as Unit) .filter((silo) => { return !silo.isCooldown(); })