refactor the skill system to adhere to the lore handbook

This commit is contained in:
2026-08-15 11:13:15 +02:00
parent 063e94f6eb
commit 9e5c3277bf
70 changed files with 2271 additions and 445 deletions
@@ -14,10 +14,30 @@ namespace NightclubArcadia.Skills.Tests
public int Roll(int sides) => _value;
}
static SkillBibleEntry Entry(string id, int startingRank)
{
return new SkillBibleEntry
{
id = id,
displayName = id.ToUpperInvariant(),
axis = "Self",
domain = string.Empty,
notes = string.Empty,
targetFiringsPerHour = 5f,
opposedTo = string.Empty,
alliedWith = System.Array.Empty<string>(),
primaryChannel = "Behavioural",
secondaryChannel = "None",
clueYield = "Low",
startingRank = startingRank,
accentColor = Color.white,
};
}
SkillDefinition Make(string id, int startingRank)
{
var def = ScriptableObject.CreateInstance<SkillDefinition>();
def.EditorSet(id, id, SkillDomain.Instinct, string.Empty, startingRank, Color.white);
def.EditorSet(Entry(id, startingRank));
return def;
}
@@ -37,7 +57,7 @@ namespace NightclubArcadia.Skills.Tests
[Test]
public void Pick_EmptyCandidates_ReturnsNull()
{
var skills = SkillsFor(("paranoia", 2));
var skills = SkillsFor(("house_pour", 2));
var result = CommentarySystem.Pick(
new List<SkillDefinition>(),
skills,
@@ -54,9 +74,9 @@ namespace NightclubArcadia.Skills.Tests
// ranks 1 and 3 → weights 1 and 3 → total 4
// roll 1 maps to pick index 0 of cumulative: only weight-1 skill
// roll 2..4 maps to higher-ranked skill
var low = Make("read_room", 1);
var high = Make("paranoia", 3);
var skills = SkillsFor(("read_room", 1), ("paranoia", 3));
var low = Make("facework", 1);
var high = Make("house_pour", 3);
var skills = SkillsFor(("facework", 1), ("house_pour", 3));
var highPick = CommentarySystem.Pick(
new List<SkillDefinition> { low, high },
@@ -65,7 +85,7 @@ namespace NightclubArcadia.Skills.Tests
3,
new FixedRollSource(2));
Assert.AreEqual("paranoia", highPick.Id);
Assert.AreEqual("house_pour", highPick.Id);
}
[Test]
@@ -86,5 +106,25 @@ namespace NightclubArcadia.Skills.Tests
Assert.AreEqual("b", pick.Id);
}
[Test]
public void IsOffCooldown_HighFirings_EligibleImmediately()
{
// 3600 firings/hour → 1 second interval
Assert.IsTrue(CommentarySystem.IsOffCooldown(10f, 11f, 3600f));
}
[Test]
public void IsOffCooldown_OnePerHour_NotEligibleAfterOneSecond()
{
Assert.IsFalse(CommentarySystem.IsOffCooldown(10f, 11f, 1f));
}
[Test]
public void IsOffCooldown_ZeroOrNegative_NeverFires()
{
Assert.IsFalse(CommentarySystem.IsOffCooldown(float.NegativeInfinity, 100f, 0f));
Assert.IsFalse(CommentarySystem.IsOffCooldown(float.NegativeInfinity, 100f, -1f));
}
}
}