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
This commit is contained in:
16
progression/LevelTime.cs
Normal file
16
progression/LevelTime.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Mr.BrickAdventures.Progression;
|
||||
|
||||
/// <summary>
|
||||
/// A completion time for one Level. Strictly positive — a zero time means the clock was never
|
||||
/// running, which is a defect rather than a fast run.
|
||||
/// </summary>
|
||||
public readonly struct LevelTime
|
||||
{
|
||||
public double Seconds { get; }
|
||||
|
||||
private LevelTime(double seconds) => Seconds = seconds;
|
||||
|
||||
public static LevelTime Of(double seconds) => seconds <= 0
|
||||
? throw new ArgumentOutOfRangeException(nameof(seconds), seconds, "A completion time must be positive.")
|
||||
: new LevelTime(seconds);
|
||||
}
|
||||
Reference in New Issue
Block a user