Revert "have MIRV target all non allied players, increase price to 25… (#181)

… million"

This reverts commit 226112beb5.
This commit is contained in:
evanpelle
2025-03-08 10:58:46 -08:00
committed by GitHub
parent e1ed8dbe36
commit 09132495c0
4 changed files with 25 additions and 15 deletions
+2 -2
View File
@@ -190,8 +190,8 @@ export class DefaultConfig implements Config {
return {
cost: (p: Player) =>
p.type() == PlayerType.Human && this.infiniteGold()
? 25
: 25_000_000,
? 0
: 15_000_000,
territoryBound: false,
};
case UnitType.MIRVWarhead:
+19 -12
View File
@@ -9,7 +9,6 @@ import {
UnitType,
TerraNullius,
MessageType,
AllPlayers,
} from "../game/Game";
import { PathFinder } from "../pathfinding/PathFinding";
import { PathFindResultType } from "../pathfinding/AStar";
@@ -28,6 +27,7 @@ export class MirvExecution implements Execution {
private nuke: Unit;
private mirvRange = 1500;
private warheadCount = 350;
private random: PseudoRandom;
@@ -74,14 +74,16 @@ export class MirvExecution implements Execution {
return;
}
this.nuke = this.player.buildUnit(UnitType.MIRV, 0, spawn);
const x = Math.floor(Math.floor(this.mg.width() / 2));
const y = Math.min(this.mg.height(), 50);
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;
this.separateDst = this.mg.ref(x, y);
this.mg.displayMessage(
`⚠️⚠️⚠️ ${this.player.name()} - MIRV LAUNCH DETECTED ⚠️⚠️⚠️`,
`⚠️⚠️⚠️ ${this.player.name()} - MIRV INBOUND ⚠️⚠️⚠️`,
MessageType.ERROR,
null,
this.targetPlayer.id(),
);
}
@@ -116,7 +118,7 @@ export class MirvExecution implements Execution {
let attempts = 1000;
while (attempts > 0 && dsts.length < this.warheadCount) {
attempts--;
const potential = this.randomLand(dsts);
const potential = this.randomLand(this.dst, dsts);
if (potential == null) {
continue;
}
@@ -154,12 +156,18 @@ export class MirvExecution implements Execution {
this.nuke.delete(false);
}
randomLand(taken: TileRef[]): TileRef | null {
randomLand(ref: TileRef, taken: TileRef[]): TileRef | null {
let tries = 0;
while (tries < 100) {
tries++;
const x = this.random.nextInt(0, this.mg.width());
const y = this.random.nextInt(0, this.mg.height());
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,
);
if (!this.mg.isValidCoord(x, y)) {
continue;
}
@@ -168,11 +176,10 @@ export class MirvExecution implements Execution {
if (!this.mg.isLand(tile)) {
continue;
}
const owner = this.mg.owner(tile);
if (!owner.isPlayer()) {
if (this.mg.euclideanDist(tile, ref) > this.mirvRange) {
continue;
}
if (owner == this.player || this.player.allianceWith(owner)) {
if (this.mg.owner(tile) != this.targetPlayer) {
continue;
}
for (const t of taken) {
+1 -1
View File
@@ -134,7 +134,7 @@ export class NukeExecution implements Execution {
let magnitude;
switch (this.type) {
case UnitType.MIRVWarhead:
magnitude = { inner: 30, outer: 35 };
magnitude = { inner: 25, outer: 30 };
break;
case UnitType.AtomBomb:
magnitude = { inner: 12, outer: 30 };
+3
View File
@@ -675,6 +675,9 @@ 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: