worldbox-observer-mod/IdleSpectator/HarnessScenarios.cs
2026-07-14 14:37:34 -05:00

82 lines
2.4 KiB
C#

using System.Collections.Generic;
namespace IdleSpectator;
/// <summary>
/// Built-in agent playtest scenarios expanded by <c>action=scenario</c>.
/// </summary>
internal static class HarnessScenarios
{
public static List<HarnessCommand> Build(string name)
{
switch ((name ?? "").Trim().ToLowerInvariant())
{
case "smoke":
return Smoke();
case "tip_match":
return TipMatch();
default:
return null;
}
}
private static List<HarnessCommand> Smoke()
{
return new List<HarnessCommand>
{
Step("s0", "dismiss_windows"),
Step("s1", "wait_world"),
Step("s2", "reset_counters"),
Step("s3", "spectator", value: "off"),
Step("s4", "assert", expect: "idle", value: "false"),
Step("s5", "spectator", value: "on"),
Step("s6", "wait", wait: 0.75f),
Step("s7", "assert", expect: "health"),
Step("s8", "snapshot"),
};
}
private static List<HarnessCommand> TipMatch()
{
return new List<HarnessCommand>
{
Step("t0", "dismiss_windows"),
Step("t1", "wait_world"),
Step("t2", "reset_counters"),
Step("t3", "spectator", value: "on"),
Step("t4", "spawn", asset: "crab", count: 2),
Step("t5", "wait", wait: 0.5f),
Step("t6", "watch", asset: "crab", label: "New species: crab", tier: "Curiosity"),
Step("t7", "wait", wait: 0.35f),
Step("t8", "assert", expect: "tip_matches_unit"),
Step("t9", "assert", expect: "unit_asset", asset: "crab"),
Step("t10", "assert", expect: "power_bar", value: "false"),
Step("t11", "snapshot"),
};
}
private static HarnessCommand Step(
string id,
string action,
string value = "",
string asset = "",
string label = "",
string tier = "",
string expect = "",
int count = 1,
float wait = 0f)
{
return new HarnessCommand
{
id = id,
action = action,
value = value,
asset = asset,
label = label,
tier = tier,
expect = expect,
count = count,
wait = wait
};
}
}