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