using RobotAndDonkey.Game.Execution; using RobotAndDonkey.Game.Execution.Results; using RobotAndDonkey.Game.GameState; namespace RobotAndDonkey.Game.Intents; public class NextPhase(ERunPhase phase) : Intent() { public override void Run(Guid requestId, CoreLoop coreLoop, List newIntents, List results) { coreLoop.RunPhase = Phase; results.Add(new RunPhaseResult(requestId, coreLoop.RunPhase)); base.Run(requestId, coreLoop, newIntents, results); } public override bool IsValid(CoreLoop coreLoop) { if (!base.IsValid(coreLoop)) return false; if (coreLoop.RunPhase == Phase) return false; return true; } public override bool Immune => true; public ERunPhase Phase { get; } = phase; public override string ToString() => $"Next phase: {Phase}, " + base.ToString(); }