mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 10:10:55 +00:00
boats have limit distance
This commit is contained in:
@@ -55,7 +55,8 @@
|
||||
* make bot spawn better DONE 8/28/2024
|
||||
* make UX for attacking TerraNullius by boat better DONE 8/29/2024
|
||||
* make bot territory less funky (more likely attack neighbors with larger border) DONE 8/29/2024
|
||||
* give boats limit for how far they can go
|
||||
* REFACTOR: remove player config DONE 8/29/2024
|
||||
* give boats limit for how far they can go DONE 8/29/2024
|
||||
* PERF: precompute spawns
|
||||
* PERF: load terrain map async
|
||||
* PERF: enable CDN
|
||||
@@ -66,5 +67,4 @@
|
||||
* use better favicon
|
||||
* REFACTOR: give terranullius an ID, game.player() returns terranullius
|
||||
* REFACTOR: ocean is considered TerraNullius ?
|
||||
* REFACTOR: remove player config?
|
||||
* Make fake humans
|
||||
|
||||
@@ -39,7 +39,6 @@ export class ClientGame {
|
||||
|
||||
private currTurn = 0
|
||||
|
||||
private spawned = false
|
||||
|
||||
private intervalID: NodeJS.Timeout
|
||||
|
||||
@@ -191,7 +190,6 @@ export class ClientGame {
|
||||
const tile = this.gs.tile(cell)
|
||||
if (tile.isLand() && !tile.hasOwner() && this.gs.inSpawnPhase()) {
|
||||
this.sendSpawnIntent(cell)
|
||||
this.spawned = true
|
||||
return
|
||||
}
|
||||
if (this.gs.inSpawnPhase()) {
|
||||
|
||||
@@ -32,6 +32,7 @@ export interface Config {
|
||||
}
|
||||
attackAmount(attacker: Player, defender: Player | TerraNullius): number
|
||||
boatAttackAmount(attacker: Player, defender: Player | TerraNullius): number
|
||||
boatMaxDistance(): number
|
||||
}
|
||||
|
||||
export interface Theme {
|
||||
|
||||
@@ -2,11 +2,13 @@ import {Player, PlayerInfo, TerraNullius, Tile} from "../Game";
|
||||
import {within} from "../Util";
|
||||
import {Config, Theme} from "./Config";
|
||||
import {pastelTheme} from "./PastelTheme";
|
||||
import {vintageTheme} from "./VintageTheme";
|
||||
|
||||
|
||||
|
||||
export class DefaultConfig implements Config {
|
||||
boatMaxDistance(): number {
|
||||
return 500
|
||||
}
|
||||
numSpawnPhaseTurns(): number {
|
||||
return 100
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import {PriorityQueue} from "@datastructures-js/priority-queue";
|
||||
import {Boat, Cell, Execution, MutableBoat, MutableGame, MutablePlayer, Player, PlayerID, TerraNullius, Tile, TileEvent} from "../Game";
|
||||
import {manhattanDist} from "../Util";
|
||||
import {AttackExecution} from "./AttackExecution";
|
||||
import {Config} from "../configuration/Config";
|
||||
|
||||
export class BoatAttackExecution implements Execution {
|
||||
|
||||
@@ -66,8 +67,14 @@ export class BoatAttackExecution implements Execution {
|
||||
this.active = false
|
||||
return
|
||||
}
|
||||
if (manhattanDist(this.src.cell(), this.dst.cell()) > mg.config().boatMaxDistance()) {
|
||||
console.log(`boat attack distance too large, dist ${manhattanDist(this.src.cell(), this.dst.cell())} max: ${mg.config().boatMaxDistance()}`)
|
||||
this.active = false
|
||||
return
|
||||
}
|
||||
|
||||
this.aStarPre = new AStar(this.src, this.dst)
|
||||
this.aStarPre.compute(30)
|
||||
this.aStarPre.compute(5)
|
||||
this.path = this.aStarPre.reconstructPath()
|
||||
if (this.path != null) {
|
||||
console.log(`got path ${this.path.map(t => t.cell().toString())}`)
|
||||
|
||||
Reference in New Issue
Block a user