namespace Mr.BrickAdventures.Progression; /// /// How far a Skill has been upgraded. Starts at one; there is no zero, because a Playthrough /// records only the Skills it owns and absence from that record is what "unowned" means. /// public readonly struct SkillLevel : IEquatable { public int Value { get; } private SkillLevel(int value) => Value = value; /// The level a Skill is at the moment it is first bought. public static readonly SkillLevel First = new(1); public SkillLevel Next() => new(Value + 1); public bool Equals(SkillLevel other) => Value == other.Value; public override bool Equals(object? obj) => obj is SkillLevel other && Equals(other); public override int GetHashCode() => Value; public override string ToString() => Value.ToString(); public static SkillLevel Of(int value) => value < 1 ? throw new ArgumentOutOfRangeException(nameof(value), value, "A skill level starts at 1; unowned is absence, not level 0.") : new SkillLevel(value); }