mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-28 17:17:58 +00:00
fix some bugs; added boat delete
This commit is contained in:
@@ -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