Add tutorial and QoL improvements

This commit is contained in:
2026-10-24 00:52:14 +02:00
parent ac48c24a03
commit ec3e784683
53 changed files with 3526 additions and 939 deletions
+15 -1
View File
@@ -22,10 +22,22 @@ namespace KernelPanic.Combat
public static class RandomRoll
{
private static Random _random = new(0);
public static int CurrentSeed { get; private set; }
public static int DrawCount { get; private set; }
public static void Seed(int seed)
{
_random = new Random(seed);
CurrentSeed = seed;
DrawCount = 0;
}
public static void Restore(int seed, int draws)
{
if (draws < 0 || draws > 10000000) throw new ArgumentOutOfRangeException(nameof(draws));
Seed(seed);
for (int i = 0; i < draws; i++) _random.Next();
DrawCount = draws;
}
public static int RollRange(int min, int max, RollContext context)
@@ -41,7 +53,9 @@ namespace KernelPanic.Combat
return max;
}
return _random.Next(min, max + 1);
int value = _random.Next(min, max + 1);
DrawCount += (long)max + 1 - min > int.MaxValue ? 2 : 1;
return value;
}
}
}