use mini a star for all pathfinding

This commit is contained in:
evanpelle
2024-12-03 15:06:55 -08:00
parent 4edd66dc1f
commit e6fa108eaa
7 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import { Cell, Execution, MutableGame, MutablePlayer, MutableUnit, PlayerID, Tile, UnitType } from "../game/Game";
import { Cell, Execution, MutableGame, MutablePlayer, MutableUnit, PlayerID, TerrainType, Tile, UnitType } from "../game/Game";
import { PathFinder } from "../pathfinding/PathFinding";
import { PathFindResultType } from "../pathfinding/AStar";
import { SerialAStar } from "../pathfinding/SerialAStar";
@@ -31,7 +31,7 @@ export class BattleshipExecution implements Execution {
init(mg: MutableGame, ticks: number): void {
this.pathfinder = PathFinder.Serial(mg, 5000, t => t.isWater())
this.pathfinder = PathFinder.Mini(mg, 5000, t => t.terrainType() == TerrainType.Ocean)
this._owner = mg.player(this.playerID)
this.mg = mg
this.patrolCenterTile = mg.tile(this.cell)
+1 -1
View File
@@ -29,7 +29,7 @@ export class DestroyerExecution implements Execution {
init(mg: MutableGame, ticks: number): void {
this.pathfinder = PathFinder.Serial(mg, 5000, t => t.terrainType() == TerrainType.Ocean)
this.pathfinder = PathFinder.Mini(mg, 5000, t => t.terrainType() == TerrainType.Ocean)
this._owner = mg.player(this.playerID)
this.mg = mg
this.patrolCenterTile = mg.tile(this.cell)
+1 -1
View File
@@ -26,7 +26,7 @@ export class NukeExecution implements Execution {
init(mg: MutableGame, ticks: number): void {
this.mg = mg
this.pathFinder = PathFinder.Serial(mg, 10_000, () => true)
this.pathFinder = PathFinder.Mini(mg, 10_000, () => true)
this.player = mg.player(this.senderID)
this.dst = this.mg.tile(this.cell)
}
+1 -1
View File
@@ -13,7 +13,7 @@ export class ShellExecution implements Execution {
}
init(mg: MutableGame, ticks: number): void {
this.pathFinder = PathFinder.Serial(mg, 2000, () => true, 10)
this.pathFinder = PathFinder.Mini(mg, 2000, () => true, 10)
}
tick(ticks: number): void {
+2 -2
View File
@@ -1,4 +1,4 @@
import { Unit, Cell, Execution, MutableUnit, MutableGame, MutablePlayer, Player, PlayerID, TerraNullius, Tile, TileEvent, UnitType } from "../game/Game";
import { Unit, Cell, Execution, MutableUnit, MutableGame, MutablePlayer, Player, PlayerID, TerraNullius, Tile, TileEvent, UnitType, TerrainType } from "../game/Game";
import { and, bfs, manhattanDistWrapped, sourceDstOceanShore, targetTransportTile } from "../Util";
import { AttackExecution } from "./AttackExecution";
import { DisplayMessageEvent, MessageType } from "../../client/graphics/layers/EventsDisplay";
@@ -43,7 +43,7 @@ export class TransportShipExecution implements Execution {
init(mg: MutableGame, ticks: number) {
this.lastMove = ticks
this.mg = mg
this.pathFinder = PathFinder.Serial(mg, 10_000, t => t.isWater(), 2)
this.pathFinder = PathFinder.Mini(mg, 10_000, t => t.terrainType() == TerrainType.Ocean, 2)
this.attacker = mg.player(this.attackerID)