ported from perforce
This commit is contained in:
33
RobotAndDonkey.Game/Intents/EnterBufferOverflow.cs
Normal file
33
RobotAndDonkey.Game/Intents/EnterBufferOverflow.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using RobotAndDonkey.Game.Cards;
|
||||
using RobotAndDonkey.Game.Execution;
|
||||
using RobotAndDonkey.Game.Execution.Results;
|
||||
using RobotAndDonkey.Game.GameState;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace RobotAndDonkey.Game.Intents;
|
||||
|
||||
public class EnterBufferOverflow(int energyCost) : Intent(energyCost)
|
||||
{
|
||||
public override void Run(Guid requestId, CoreLoop coreLoop, List<Intent> newIntents, List<Result> results)
|
||||
{
|
||||
coreLoop.CanBufferOverflow = false;
|
||||
coreLoop.RunPhase = ERunPhase.BufferOverflow;
|
||||
results.Add(new NoMoreBufferOverflowResult(requestId));
|
||||
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;
|
||||
|
||||
return coreLoop is { CanBufferOverflow: true, RunPhase: ERunPhase.Improve };
|
||||
}
|
||||
|
||||
public override bool Immune => true;
|
||||
|
||||
public override string ToString() => "Enter buffer overflow, " + base.ToString();
|
||||
}
|
||||
Reference in New Issue
Block a user