mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-26 19:54:36 +00:00
defense post
This commit is contained in:
@@ -202,6 +202,8 @@
|
||||
* add info view on top right DONE 11/30/2024
|
||||
* add info view for units DONE 11/30/2024
|
||||
* add defense post
|
||||
* bugfix: destroyers can't find path to dest and freeze
|
||||
* bugfix: when trade ships captured don't render
|
||||
* use mini A* for all pathfinding
|
||||
* record single player game stats
|
||||
* add radiation from nuke
|
||||
|
||||
@@ -120,7 +120,14 @@ export class TerritoryLayer implements Layer {
|
||||
|
||||
unitEvent(event: UnitEvent) {
|
||||
if (event.unit.type() == UnitType.DefensePost) {
|
||||
bfs(event.unit.tile(), dist(event.unit.tile(), this.game.config().defensePostRange())).forEach(t => this.enqueue(t))
|
||||
bfs(
|
||||
event.unit.tile(),
|
||||
dist(event.unit.tile(), this.game.config().defensePostRange())
|
||||
).forEach(t => {
|
||||
if (t.isBorder()) {
|
||||
this.enqueue(t)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,14 +68,14 @@ export class GameImpl implements MutableGame {
|
||||
addTileDefenseBonus(tile: Tile, unit: Unit, amount: number): DefenseBonus {
|
||||
const df = { unit: unit, tile: tile, amount: amount };
|
||||
(tile as TileImpl)._defenseBonuses.push(df)
|
||||
this.eventBus.emit(new TileEvent(tile))
|
||||
// this.eventBus.emit(new TileEvent(tile))
|
||||
return df
|
||||
}
|
||||
|
||||
removeTileDefenseBonus(bonus: DefenseBonus): void {
|
||||
const t = bonus.tile as TileImpl
|
||||
t._defenseBonuses = t._defenseBonuses.filter(db => db != bonus)
|
||||
this.eventBus.emit(new TileEvent(bonus.tile))
|
||||
// this.eventBus.emit(new TileEvent(bonus.tile))
|
||||
}
|
||||
|
||||
units(...types: UnitType[]): UnitImpl[] {
|
||||
|
||||
Reference in New Issue
Block a user