mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 10:00:44 +00:00
fix some bugs; added boat delete
This commit is contained in:
@@ -39,7 +39,8 @@
|
||||
* make coasts look better DONE 8/22/2024
|
||||
* only put imageDataOnce, draw territories on top DONE 8/23/2024
|
||||
* have boats not get close to shore DONE 8/23/2024
|
||||
* improve terrain colors
|
||||
* improve terrain colors DONE 8/23/2024
|
||||
* BUG: boat doesn't work if on lake if other player not on same lake
|
||||
* try vintage theme
|
||||
* BUG: boat doesn't work if on lake if other player not on same lake
|
||||
* Allow boats to attack TerraNullius
|
||||
|
||||
@@ -147,9 +147,11 @@ export class GameRenderer {
|
||||
|
||||
boatEvent(event: BoatEvent) {
|
||||
this.bfs(event.oldTile, 2).forEach(t => this.paintTerritory(t))
|
||||
if (event.boat.isActive()) {
|
||||
this.bfs(event.boat.tile(), 2).forEach(t => this.paintCell(t.cell(), this.theme.borderColor(event.boat.owner().id())))
|
||||
this.bfs(event.boat.tile(), 1).forEach(t => this.paintCell(t.cell(), this.theme.territoryColor(event.boat.owner().id())))
|
||||
|
||||
this.bfs(event.boat.tile(), 2).forEach(t => this.paintCell(t.cell(), this.theme.borderColor(event.boat.owner().id())))
|
||||
this.bfs(event.boat.tile(), 1).forEach(t => this.paintCell(t.cell(), this.theme.territoryColor(event.boat.owner().id())))
|
||||
}
|
||||
}
|
||||
|
||||
private bfs(tile: Tile, dist: number): Set<Tile> {
|
||||
|
||||
@@ -93,7 +93,7 @@ export class NameRenderer {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (render.boundingBox.max.x < min.x || render.boundingBox.max.y < min.y || render.boundingBox.min.x > max.x || render.boundingBox.max.y > max.y) {
|
||||
if (render.boundingBox.max.x < min.x || render.boundingBox.max.y < min.y || render.boundingBox.min.x > max.x || render.boundingBox.min.y > max.y) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -59,6 +59,7 @@ export interface Boat {
|
||||
tile(): Tile
|
||||
owner(): Player
|
||||
target(): Player | TerraNullius
|
||||
isActive(): boolean
|
||||
}
|
||||
|
||||
export interface MutableBoat extends Boat {
|
||||
@@ -66,6 +67,7 @@ export interface MutableBoat extends Boat {
|
||||
owner(): MutablePlayer
|
||||
target(): MutablePlayer | TerraNullius
|
||||
setTroops(troops: number): void
|
||||
delete(): void
|
||||
}
|
||||
|
||||
export interface TerraNullius {
|
||||
|
||||
@@ -67,6 +67,7 @@ class TileImpl implements Tile {
|
||||
}
|
||||
|
||||
export class BoatImpl implements MutableBoat {
|
||||
private _active = true
|
||||
|
||||
constructor(
|
||||
private g: GameImpl,
|
||||
@@ -96,6 +97,14 @@ export class BoatImpl implements MutableBoat {
|
||||
target(): PlayerImpl | TerraNullius {
|
||||
return this._target
|
||||
}
|
||||
delete(): void {
|
||||
this._owner._boats = this._owner._boats.filter(b => b != this)
|
||||
this._active = false
|
||||
this.g.fireBoatUpdateEvent(this, this._tile)
|
||||
}
|
||||
isActive(): boolean {
|
||||
return this._active
|
||||
}
|
||||
}
|
||||
|
||||
export class PlayerImpl implements MutablePlayer {
|
||||
|
||||
@@ -9,7 +9,7 @@ export const pastelTheme = new class implements Theme {
|
||||
|
||||
private background = colord({r: 100, g: 100, b: 100});
|
||||
private land = colord({r: 244, g: 243, b: 198});
|
||||
private shore = colord({r: 234, g: 343, b: 188});
|
||||
private shore = colord({r: 254, g: 253, b: 208});
|
||||
|
||||
private water = colord({r: 160, g: 203, b: 231});
|
||||
private shorelineWater = colord({r: 150, g: 193, b: 221});
|
||||
|
||||
@@ -92,11 +92,13 @@ export class BoatAttackExecution implements Execution {
|
||||
}
|
||||
if (this.dst.owner() == this.attacker) {
|
||||
this.attacker.addTroops(this.troops)
|
||||
this.boat.delete()
|
||||
this.active = false
|
||||
return
|
||||
}
|
||||
this.attacker.conquer(this.dst)
|
||||
this.mg.addExecution(new AttackExecution(this.troops, this.attacker.id(), this.targetID, null, this.config))
|
||||
this.boat.delete()
|
||||
this.active = false
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user