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
@@ -6,7 +6,18 @@ namespace NightclubArcadia.Skills
{
/// <summary>
/// Static Yarn adapter. No MonoBehaviour, no check math — translation only.
/// Call sites: &lt;&lt;check persuasion standard&gt;&gt; / &lt;&lt;check intimidation hard -1&gt;&gt;
///
/// Commands:
/// &lt;&lt;check skillId band-or-int [situationalMod]&gt;&gt;
/// &lt;&lt;skill_mod sourceKey skillId delta&gt;&gt; — set a state/situational mod
/// &lt;&lt;clear_skill_mods sourceKey&gt;&gt; — clear one source key
/// Function (kept as skill_rank; skeleton's "rank" would collide with future helpers):
/// skill_rank("skillId")
///
/// Modifier convention: source key "scene" is the situational bucket and must be
/// cleared on scene exit; any other key (drunk, injured, …) is a state bucket.
/// Both feed SkillStateModifiers — three modifier sources total (rank / check arg /
/// state), not a fourth dictionary.
/// </summary>
public static class YarnSkillCommands
{
@@ -28,8 +39,8 @@ namespace NightclubArcadia.Skills
if (!DcBands.TryParse(difficulty, out var dc))
{
Debug.LogError($"[YarnSkillCommands] <<check {skillId} {difficulty}>>: unknown difficulty; treating as Standard (11).");
dc = (int)DcBand.Standard;
Debug.LogError($"[YarnSkillCommands] <<check {skillId} {difficulty}>>: unknown difficulty; treating as Routine (11).");
dc = (int)DcBand.Routine;
}
if (runtime.Database == null || !runtime.Database.TryGet(skillId, out _))
@@ -49,6 +60,44 @@ namespace NightclubArcadia.Skills
yield return runtime.StartCoroutine(runtime.ResultView.Show(result));
}
[YarnCommand("skill_mod")]
public static void SkillMod(string sourceKey, string skillId, int delta)
{
var runtime = SkillRuntime.Instance;
if (runtime == null || runtime.States == null)
{
Debug.LogError("[YarnSkillCommands] <<skill_mod>> called but SkillRuntime is not ready.");
return;
}
if (string.IsNullOrEmpty(sourceKey) || string.IsNullOrEmpty(skillId))
{
Debug.LogError("[YarnSkillCommands] <<skill_mod>> requires sourceKey and skillId.");
return;
}
runtime.States.Set(sourceKey, skillId, delta);
}
[YarnCommand("clear_skill_mods")]
public static void ClearSkillMods(string sourceKey)
{
var runtime = SkillRuntime.Instance;
if (runtime == null || runtime.States == null)
{
Debug.LogError("[YarnSkillCommands] <<clear_skill_mods>> called but SkillRuntime is not ready.");
return;
}
if (string.IsNullOrEmpty(sourceKey))
{
Debug.LogError("[YarnSkillCommands] <<clear_skill_mods>> requires a sourceKey.");
return;
}
runtime.States.Clear(sourceKey);
}
[YarnFunction("skill_rank")]
public static float SkillRank(string skillId)
{
@@ -87,7 +136,7 @@ namespace NightclubArcadia.Skills
DcBands.TryParse(difficulty, out var dc);
if (dc == 0)
{
dc = (int)DcBand.Standard;
dc = (int)DcBand.Routine;
}
var storage = runner.VariableStorage;