break alliance creates log

This commit is contained in:
evanpelle
2024-09-21 11:56:25 -07:00
parent 98bdf94bf6
commit dd5c357734
3 changed files with 31 additions and 3 deletions
+4
View File
@@ -210,3 +210,7 @@ export class AllianceRequestEvent implements GameEvent {
export class AllianceRequestReplyEvent implements GameEvent {
constructor(public readonly allianceRequest: AllianceRequest, public readonly accepted: boolean) { }
}
export class BrokeAllianceEvent implements GameEvent {
constructor(public readonly traitor: Player, public readonly betrayed: Player) { }
}
+2 -2
View File
@@ -1,7 +1,7 @@
import {info} from "console";
import {Config} from "../configuration/Config";
import {EventBus} from "../EventBus";
import {Cell, Execution, MutableGame, Game, MutablePlayer, PlayerEvent, PlayerID, PlayerInfo, Player, TerraNullius, Tile, TileEvent, Boat, BoatEvent, PlayerType, MutableAllianceRequest, AllianceRequestReplyEvent, AllianceRequestEvent} from "./Game";
import {Cell, Execution, MutableGame, Game, MutablePlayer, PlayerEvent, PlayerID, PlayerInfo, Player, TerraNullius, Tile, TileEvent, Boat, BoatEvent, PlayerType, MutableAllianceRequest, AllianceRequestReplyEvent, AllianceRequestEvent, BrokeAllianceEvent} from "./Game";
import {TerrainMap} from "./TerrainMapLoader";
import {PlayerImpl} from "./PlayerImpl";
import {TerraNulliusImpl} from "./TerraNulliusImpl";
@@ -335,7 +335,7 @@ export class GameImpl implements MutableGame {
throw new Error('must have exactly one alliance')
}
this.alliances_ = this.alliances_.filter(a => a != alliances[0])
// TODO emit event.
this.eventBus.emit(new BrokeAllianceEvent(breaker, other))
}
}