using System; namespace DevilLink2.Gameplay { /// Immutable single-level configuration, using display columns/rows. public sealed class LevelDefinition { public GameMode Mode { get; } public int Level { get; } public int Columns { get; } public int Rows { get; } public bool HasTimer { get; } public int TimeLimitSeconds { get; } public int ClearCoinReward { get; } public int ClearTicketReward { get; } public LevelDefinition(GameMode mode, int level, int columns, int rows, int timeLimitSeconds, int clearCoinReward, int clearTicketReward) { GameModeGuard.Validate(mode); if (level < 1 || level > 20) throw new ArgumentOutOfRangeException(nameof(level)); if (columns <= 0) throw new ArgumentOutOfRangeException(nameof(columns)); if (rows <= 0) throw new ArgumentOutOfRangeException(nameof(rows)); long count = (long)columns * rows; if (count > int.MaxValue || count % 2 != 0) throw new ArgumentException("Board cell count must be even and representable."); bool hasTimer = mode != GameMode.Zen; if (hasTimer ? timeLimitSeconds <= 0 : timeLimitSeconds != 0) throw new ArgumentOutOfRangeException(nameof(timeLimitSeconds), "Zen has no timer; timed modes require positive seconds."); if (clearCoinReward < 0) throw new ArgumentOutOfRangeException(nameof(clearCoinReward)); if (clearTicketReward < 0) throw new ArgumentOutOfRangeException(nameof(clearTicketReward)); Mode = mode; Level = level; Columns = columns; Rows = rows; HasTimer = hasTimer; TimeLimitSeconds = timeLimitSeconds; ClearCoinReward = clearCoinReward; ClearTicketReward = clearTicketReward; } } }