refactor the skill system to adhere to the lore handbook
This commit is contained in:
@@ -6,7 +6,18 @@ namespace NightclubArcadia.Skills
|
||||
{
|
||||
/// <summary>
|
||||
/// Static Yarn adapter. No MonoBehaviour, no check math — translation only.
|
||||
/// Call sites: <<check persuasion standard>> / <<check intimidation hard -1>>
|
||||
///
|
||||
/// Commands:
|
||||
/// <<check skillId band-or-int [situationalMod]>>
|
||||
/// <<skill_mod sourceKey skillId delta>> — set a state/situational mod
|
||||
/// <<clear_skill_mods sourceKey>> — 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;
|
||||
|
||||
Reference in New Issue
Block a user