145 lines
5.2 KiB
C#
145 lines
5.2 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();
|
|
case "critical":
|
|
case "critical_smoke":
|
|
return CriticalSmoke();
|
|
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", "pick_unit", asset: "auto"),
|
|
Step("s4", "spectator", value: "off"),
|
|
Step("s5", "assert", expect: "idle", value: "false"),
|
|
Step("s6", "spectator", value: "on"),
|
|
Step("s7", "focus", asset: "auto"),
|
|
Step("s8", "wait", wait: 0.35f),
|
|
Step("s9", "assert", expect: "health"),
|
|
Step("s10", "snapshot"),
|
|
};
|
|
}
|
|
|
|
private static List<HarnessCommand> TipMatch()
|
|
{
|
|
return new List<HarnessCommand>
|
|
{
|
|
Step("t0", "dismiss_windows"),
|
|
Step("t1", "wait_world"),
|
|
Step("t2", "reset_counters"),
|
|
Step("t3", "pick_unit", asset: "auto"),
|
|
Step("t4", "spectator", value: "on"),
|
|
Step("t5", "watch", asset: "auto", label: "New species: {asset}", tier: "Curiosity"),
|
|
Step("t6", "wait", wait: 0.3f),
|
|
Step("t7", "assert", expect: "tip_matches_unit"),
|
|
Step("t8", "assert", expect: "unit_asset", asset: "auto"),
|
|
Step("t9", "assert", expect: "power_bar", value: "false"),
|
|
Step("t10", "snapshot"),
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// Critical E2E against already-living map units (no fragile miracle spawns).
|
|
/// </summary>
|
|
private static List<HarnessCommand> CriticalSmoke()
|
|
{
|
|
return new List<HarnessCommand>
|
|
{
|
|
Step("c00", "dismiss_windows"),
|
|
Step("c01", "wait_world"),
|
|
Step("c02", "reset_counters"),
|
|
|
|
// Lock onto a living map unit for the rest of the scenario.
|
|
Step("c05", "pick_unit", asset: "auto"),
|
|
Step("c06", "wait", wait: 0.25f),
|
|
|
|
Step("c10", "set_setting", expect: "enabled", value: "false"),
|
|
Step("c11", "assert", expect: "enabled", value: "false"),
|
|
Step("c12", "spectator", value: "on", expect: "blocked"),
|
|
Step("c13", "assert", expect: "idle", value: "false"),
|
|
Step("c14", "set_setting", expect: "enabled", value: "true"),
|
|
Step("c15", "assert", expect: "enabled", value: "true"),
|
|
|
|
Step("c20", "spectator", value: "off"),
|
|
Step("c21", "assert", expect: "idle", value: "false"),
|
|
Step("c22", "spectator", value: "on"),
|
|
Step("c23", "focus", asset: "auto"),
|
|
Step("c24", "reset_counters"),
|
|
Step("c25", "wait", wait: 0.35f),
|
|
Step("c26", "assert", expect: "health"),
|
|
Step("c27", "assert", expect: "power_bar", value: "false"),
|
|
Step("c28", "assert", expect: "no_bad"),
|
|
|
|
Step("c30", "watch", asset: "auto", label: "New species: {asset}", tier: "Curiosity"),
|
|
Step("c31", "wait", wait: 0.3f),
|
|
Step("c32", "assert", expect: "tip_matches_unit"),
|
|
Step("c33", "assert", expect: "unit_asset", asset: "auto"),
|
|
Step("c34", "assert", expect: "tip_contains", value: "auto"),
|
|
Step("c35", "assert", expect: "power_bar", value: "false"),
|
|
Step("c36", "assert", expect: "no_bad"),
|
|
|
|
Step("c40", "watch", asset: "auto", label: "Retarget A: {asset}", tier: "Curiosity"),
|
|
Step("c41", "wait", wait: 0.25f),
|
|
Step("c42", "focus", asset: "auto"),
|
|
Step("c43", "wait", wait: 0.25f),
|
|
Step("c44", "watch", asset: "auto", label: "Retarget B: {asset}", tier: "Curiosity"),
|
|
Step("c45", "wait", wait: 0.35f),
|
|
Step("c46", "assert", expect: "health"),
|
|
Step("c47", "assert", expect: "no_bad"),
|
|
Step("c48", "assert", expect: "power_bar", value: "false"),
|
|
|
|
Step("c50", "simulate_input"),
|
|
Step("c51", "wait", wait: 0.25f),
|
|
Step("c52", "assert", expect: "idle", value: "false"),
|
|
Step("c53", "assert", expect: "no_bad"),
|
|
|
|
Step("c99", "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
|
|
};
|
|
}
|
|
}
|