Files
zfxaction25/RobotAndDonkey.Game/Intents/Rest.cs
2026-04-19 00:43:27 +02:00

24 lines
824 B
C#

using RobotAndDonkey.Game.Board;
using RobotAndDonkey.Game.Data;
using RobotAndDonkey.Game.Execution.Results;
using RobotAndDonkey.Game.GameState;
namespace RobotAndDonkey.Game.Intents;
public class Rest(Cell cell, int restoreEnergyAmount) : Intent(-restoreEnergyAmount)
{
public override void Run(Guid requestId, CoreLoop coreLoop, List<Intent> newIntents, List<Result> results)
{
if (cell.Type == ECellType.Fertile)
{
EnergyCost -= Balancing.Instance.FertileRestEnergyReplenish;
}
else if (cell.Type == ECellType.Dry)
{
EnergyCost = Math.Min(0, EnergyCost + Balancing.Instance.DryRestEnergyMalus);
}
base.Run(requestId, coreLoop, newIntents, results);
}
public override string ToString() => "Rest, " + base.ToString();
}