import { Execution, Game, Player, PlayerID } from "../game/Game"; export class EmbargoExecution implements Execution { private active = true; private target: Player; constructor( private player: Player, private targetID: PlayerID, private readonly action: "start" | "stop", ) {} init(mg: Game, _: number): void { if (!mg.hasPlayer(this.targetID)) { console.warn(`EmbargoExecution recipient ${this.targetID} not found`); this.active = false; return; } this.target = mg.player(this.targetID); } tick(_: number): void { if (this.action === "start") this.player.addEmbargo(this.target, false); else this.player.stopEmbargo(this.target); this.active = false; } isActive(): boolean { return this.active; } activeDuringSpawnPhase(): boolean { return false; } }