remove max boat distance

This commit is contained in:
Evan
2025-03-07 10:38:26 -08:00
parent 25224ed749
commit 3dd02ec4df
5 changed files with 15 additions and 36 deletions
-1
View File
@@ -142,7 +142,6 @@ export interface Config {
maxPopulation(player: Player | PlayerView): number;
cityPopulationIncrease(): number;
boatAttackAmount(attacker: Player, defender: Player | TerraNullius): number;
boatMaxDistance(): number;
boatMaxNumber(): number;
allianceDuration(): Tick;
allianceRequestCooldown(): Tick;
-3
View File
@@ -279,9 +279,6 @@ export class DefaultConfig implements Config {
boatMaxNumber(): number {
return 3;
}
boatMaxDistance(): number {
return 500;
}
numSpawnPhaseTurns(): number {
return this._gameConfig.gameType == GameType.Singleplayer ? 100 : 300;
}
+9 -20
View File
@@ -282,19 +282,14 @@ export class FakeHumanExecution implements Execution {
if (closest == null) {
return;
}
if (
this.mg.manhattanDist(closest.x, closest.y) <
this.mg.config().boatMaxDistance()
) {
this.mg.addExecution(
new TransportShipExecution(
this.player.id(),
other.id(),
closest.y,
this.player.troops() / 5,
),
);
}
this.mg.addExecution(
new TransportShipExecution(
this.player.id(),
other.id(),
closest.y,
this.player.troops() / 5,
),
);
}
private handleUnits() {
@@ -403,7 +398,7 @@ export class FakeHumanExecution implements Execution {
}
private warshipSpawnTile(portTile: TileRef): TileRef | null {
const radius = this.mg.config().boatMaxDistance() / 2;
const radius = 250;
for (let attempts = 0; attempts < 50; attempts++) {
const randX = this.random.nextInt(
this.mg.x(portTile) - radius,
@@ -418,12 +413,6 @@ export class FakeHumanExecution implements Execution {
}
const tile = this.mg.ref(randX, randY);
// Sanity check
if (
this.mg.manhattanDist(tile, portTile) >=
this.mg.config().boatMaxDistance()
) {
continue;
}
if (!this.mg.isOcean(tile)) {
continue;
}
+1 -1
View File
@@ -65,7 +65,7 @@ export class TransportShipExecution implements Execution {
this.lastMove = ticks;
this.mg = mg;
this.pathFinder = PathFinder.Mini(mg, 10_000, false, 2);
this.pathFinder = PathFinder.Mini(mg, 10_000, false, 10);
this.attacker = mg.player(this.attackerID);
+5 -11
View File
@@ -728,17 +728,11 @@ export class PlayerImpl implements Player {
if (!this.mg.isOcean(tile)) {
return false;
}
const spawns = this.units(UnitType.Port)
.filter(
(u) =>
this.mg.manhattanDist(u.tile(), tile) <
this.mg.config().boatMaxDistance(),
)
.sort(
(a, b) =>
this.mg.manhattanDist(a.tile(), tile) -
this.mg.manhattanDist(b.tile(), tile),
);
const spawns = this.units(UnitType.Port).sort(
(a, b) =>
this.mg.manhattanDist(a.tile(), tile) -
this.mg.manhattanDist(b.tile(), tile),
);
if (spawns.length == 0) {
return false;
}