using ReactorMaintenance.Simulation;

namespace ReactorMaintenance.Simulation.Hazards;

public sealed class IgnitionHazard : Hazard
{
    public override IEnumerable<Forecast> Predict(LevelState level, int turns)
    {
        for (var y = Balancing.Current.FirstGridCoordinate; y < level.Height; y++)
        {
            for (var x = Balancing.Current.FirstGridCoordinate; x < level.Width; x++)
            {
                var position = new GridPosition(x, y);
                var cell = level.GetCell(position);
                if (cell.Hazards.Fire)
                    yield return new(EFailureKind.Ignition, position, turns, turns == Balancing.Current.TurnIncrement ? $"FUEL IGNITION PREDICTED AT {x},{y} NEXT TURN" : $"FUEL IGNITION PREDICTED AT {x},{y} IN {turns} TURNS");
            }
        }
    }
}