ported from perforce
This commit is contained in:
32
RobotAndDonkey.Game/Intents/NextPhase.cs
Normal file
32
RobotAndDonkey.Game/Intents/NextPhase.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user