ported from perforce
This commit is contained in:
32
RobotAndDonkey.Game/Intents/EnterGamble.cs
Normal file
32
RobotAndDonkey.Game/Intents/EnterGamble.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using RobotAndDonkey.Game.Data;
|
||||
using RobotAndDonkey.Game.Execution;
|
||||
using RobotAndDonkey.Game.Execution.Results;
|
||||
using RobotAndDonkey.Game.GameState;
|
||||
using System.Numerics;
|
||||
|
||||
namespace RobotAndDonkey.Game.Intents;
|
||||
|
||||
public class EnterGamble(int energyCost) : Intent(energyCost)
|
||||
{
|
||||
public override void Run(Guid requestId, CoreLoop coreLoop, List<Intent> newIntents, List<Result> results)
|
||||
{
|
||||
coreLoop.CanGamble = false;
|
||||
coreLoop.BoosterPack = [..CoreLoop.CreatePatchDeck(ref coreLoop.Random, coreLoop.Difficulty, Balancing.Instance.GambleBoosterSize, true)];
|
||||
coreLoop.RunPhase = ERunPhase.Gamble;
|
||||
results.Add(new NoMoreGamblingResult(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 { CanGamble: true, RunPhase: ERunPhase.Improve };
|
||||
}
|
||||
|
||||
public override bool Immune => true;
|
||||
|
||||
public override string ToString() => "Enter gamble, " + base.ToString();
|
||||
}
|
||||
Reference in New Issue
Block a user