mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-09 00:03:35 +00:00
36 lines
806 B
TypeScript
36 lines
806 B
TypeScript
import {MutableAlliance, Game, Player, Tick} from "./Game";
|
|
import {GameImpl} from "./GameImpl";
|
|
import {PlayerImpl} from "./PlayerImpl";
|
|
|
|
export class AllianceImpl implements MutableAlliance {
|
|
constructor(
|
|
private readonly mg: GameImpl,
|
|
readonly requestor_: PlayerImpl,
|
|
readonly recipient_: PlayerImpl,
|
|
readonly createdAtTick_: Tick,
|
|
) { }
|
|
|
|
other(player: Player): PlayerImpl {
|
|
if (this.requestor_ == player) {
|
|
return this.recipient_
|
|
}
|
|
return this.requestor_
|
|
}
|
|
|
|
requestor(): Player {
|
|
return this.requestor_
|
|
}
|
|
|
|
recipient(): Player {
|
|
return this.recipient_
|
|
}
|
|
|
|
createdAt(): Tick {
|
|
return this.createdAtTick_
|
|
}
|
|
|
|
expire(): void {
|
|
this.mg.expireAlliance(this)
|
|
}
|
|
|
|
} |