AllianceRequestExecution

This commit is contained in:
Scott Anderson
2025-04-14 21:09:45 -04:00
parent c563f2b66a
commit f22c20c8fb
@@ -3,8 +3,8 @@ import { Execution, Game, Player, PlayerID } from "../../game/Game";
export class AllianceRequestExecution implements Execution {
private active = true;
private requestor: Player;
private recipient: Player;
private requestor: Player | null = null;
private recipient: Player | null = null;
constructor(
private requestorID: PlayerID,
@@ -32,6 +32,9 @@ export class AllianceRequestExecution implements Execution {
}
tick(ticks: number): void {
if (this.requestor === null || this.recipient === null) {
throw new Error("Not initialized");
}
if (this.requestor.isFriendly(this.recipient)) {
consolex.warn("already allied");
} else if (!this.requestor.canSendAllianceRequest(this.recipient)) {