ported from perforce

This commit is contained in:
2026-04-19 00:43:27 +02:00
commit 6c0c33f5d4
700 changed files with 19735 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using RobotAndDonkey.Game.Board;
using RobotAndDonkey.Game.Execution.Results;
using RobotAndDonkey.Game.GameState;
using RobotAndDonkey.Game.Intents;
namespace RobotAndDonkey.Game.Modifiers;
public record DroughtModifier(EModifierDuration Duration) : Modifier(EModifierKind.Cell, EModifierId.Drought, Duration)
{
protected override DroughtModifier CreateInstance() => new(Duration);
public override void OnAdded(Entity owner, List<Intent> newIntents)
{
if (owner is not Cell cell)
throw new NotSupportedException("Drought is only allowed in cells.");
cell.Type = cell.Type switch
{
ECellType.Fertile => ECellType.Grass,
ECellType.Grass => ECellType.Dry,
_ => throw new NotSupportedException("Drought only works on Fertile and Grass")
};
}
public override void OnRemoved(Entity owner, List<Intent> newIntents)
{
if (owner is not Cell cell)
throw new NotSupportedException("Drought is only allowed in cells.");
cell.Type = cell.Type switch
{
ECellType.Grass => ECellType.Fertile,
ECellType.Dry => ECellType.Grass,
_ => throw new NotSupportedException("Drought can only be removed from Dry and Grass")
};
}
public override string ToolTip => "Humidity was reduced from this land, reducing fertility and maybe drying out.";
}