32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
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();
|
|
} |