From 226112beb5ac55b2d85cb876c2371e88d6928ca3 Mon Sep 17 00:00:00 2001 From: Evan Date: Mon, 3 Mar 2025 20:46:28 -0800 Subject: [PATCH] have MIRV target all non allied players, increase price to 25 million --- src/core/configuration/DefaultConfig.ts | 2 +- src/core/execution/MIRVExecution.ts | 31 ++++++++++--------------- src/core/execution/NukeExecution.ts | 2 +- src/core/game/PlayerImpl.ts | 3 --- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 763c6ec50..7e551ef47 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -184,7 +184,7 @@ export class DefaultConfig implements Config { cost: (p: Player) => p.type() == PlayerType.Human && this.infiniteGold() ? 0 - : 15_000_000, + : 25_000_000, territoryBound: false, }; case UnitType.MIRVWarhead: diff --git a/src/core/execution/MIRVExecution.ts b/src/core/execution/MIRVExecution.ts index a263ed466..7e198d86b 100644 --- a/src/core/execution/MIRVExecution.ts +++ b/src/core/execution/MIRVExecution.ts @@ -9,6 +9,7 @@ import { UnitType, TerraNullius, MessageType, + AllPlayers, } from "../game/Game"; import { PathFinder } from "../pathfinding/PathFinding"; import { PathFindResultType } from "../pathfinding/AStar"; @@ -27,7 +28,6 @@ export class MirvExecution implements Execution { private nuke: Unit; - private mirvRange = 1500; private warheadCount = 350; private random: PseudoRandom; @@ -74,16 +74,14 @@ export class MirvExecution implements Execution { return; } this.nuke = this.player.buildUnit(UnitType.MIRV, 0, spawn); - const x = Math.floor( - (this.mg.x(this.dst) + this.mg.x(this.mg.x(this.nuke.tile()))) / 2, - ); - const y = Math.max(0, this.mg.y(this.dst) - 500) + 50; + const x = Math.floor(Math.floor(this.mg.width() / 2)); + const y = Math.min(this.mg.height(), 50); this.separateDst = this.mg.ref(x, y); this.mg.displayMessage( - `⚠️⚠️⚠️ ${this.player.name()} - MIRV INBOUND ⚠️⚠️⚠️`, + `⚠️⚠️⚠️ ${this.player.name()} - MIRV LAUNCH DETECTED ⚠️⚠️⚠️`, MessageType.ERROR, - this.targetPlayer.id(), + null, ); } @@ -118,7 +116,7 @@ export class MirvExecution implements Execution { let attempts = 1000; while (attempts > 0 && dsts.length < this.warheadCount) { attempts--; - const potential = this.randomLand(this.dst, dsts); + const potential = this.randomLand(dsts); if (potential == null) { continue; } @@ -156,18 +154,12 @@ export class MirvExecution implements Execution { this.nuke.delete(false); } - randomLand(ref: TileRef, taken: TileRef[]): TileRef | null { + randomLand(taken: TileRef[]): TileRef | null { let tries = 0; while (tries < 100) { tries++; - const x = this.random.nextInt( - this.mg.x(ref) - this.mirvRange, - this.mg.x(ref) + this.mirvRange, - ); - const y = this.random.nextInt( - this.mg.y(ref) - this.mirvRange, - this.mg.y(ref) + this.mirvRange, - ); + const x = this.random.nextInt(0, this.mg.width()); + const y = this.random.nextInt(0, this.mg.height()); if (!this.mg.isValidCoord(x, y)) { continue; } @@ -176,10 +168,11 @@ export class MirvExecution implements Execution { if (!this.mg.isLand(tile)) { continue; } - if (this.mg.euclideanDist(tile, ref) > this.mirvRange) { + const owner = this.mg.owner(tile); + if (!owner.isPlayer()) { continue; } - if (this.mg.owner(tile) != this.targetPlayer) { + if (owner == this.player || this.player.allianceWith(owner)) { continue; } for (const t of taken) { diff --git a/src/core/execution/NukeExecution.ts b/src/core/execution/NukeExecution.ts index a752a7eaa..efa530d16 100644 --- a/src/core/execution/NukeExecution.ts +++ b/src/core/execution/NukeExecution.ts @@ -134,7 +134,7 @@ export class NukeExecution implements Execution { let magnitude; switch (this.type) { case UnitType.MIRVWarhead: - magnitude = { inner: 25, outer: 30 }; + magnitude = { inner: 30, outer: 35 }; break; case UnitType.AtomBomb: magnitude = { inner: 12, outer: 30 }; diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index 1085f6527..9f99f294a 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -650,9 +650,6 @@ export class PlayerImpl implements Player { } switch (unitType) { case UnitType.MIRV: - if (!this.mg.hasOwner(targetTile)) { - return false; - } return this.nukeSpawn(targetTile); case UnitType.AtomBomb: case UnitType.HydrogenBomb: