mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-17 03:59:14 +00:00
use mini a star for all pathfinding
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user