mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 14:00:54 +00:00
remove max boat distance
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user