Files
przygody-pana-cegly/progression/SkillLevel.cs
Gabriel Kaszewski 313a5315b1 feat(progression): Coins, LevelTime, SkillLevel core invariants (slice 1)
three bug-encoding invariants, one red/green cycle each:
- Coins.TrySubtract fails instead of clamping
- LevelTime rejects zero (continued-run zero best-times)
- SkillLevel has no zero (unowned is absence, not Level=1)

plan: drop signed NetCoins; add Attempt outcome as idempotency guard
2026-07-28 18:22:46 +02:00

17 lines
600 B
C#

namespace Mr.BrickAdventures.Progression;
/// <summary>
/// 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.
/// </summary>
public readonly struct SkillLevel
{
public int Value { get; }
private SkillLevel(int value) => Value = value;
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);
}