Files
2026-04-19 00:43:27 +02:00

32 lines
897 B
C#

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<Intent> newIntents, List<Result> 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();
}