Implement more QoL features and rebalances

This commit is contained in:
2026-10-25 02:16:30 +02:00
parent 0578913451
commit 53f831d91e
220 changed files with 14700 additions and 420 deletions
@@ -10,6 +10,8 @@ namespace KernelPanic.Combat
public string Advice { get; }
public IReadOnlyList<string> Enemies { get; }
public int UptimeBonus { get; }
public int EscortShield { get; internal set; }
public int EscortUptime { get; internal set; }
public EncounterPlan(string title, string advice, int uptimeBonus, params string[] enemies)
{ Title = title; Advice = advice; UptimeBonus = uptimeBonus; Enemies = Array.AsReadOnly(enemies); }
}
@@ -17,6 +19,64 @@ namespace KernelPanic.Combat
/// <summary>Authored encounter composition. Reads no random state; spawning owns stat rolls.</summary>
public static class EncounterDirector
{
// A stable integer mixer, independent of both gameplay random streams and runtime hash codes.
public static EncounterPlan Plan(int wave, WaveRoute route, int seed, int revision)
{
if (revision == 0) return Plan(wave, route);
uint hash = unchecked((uint)seed ^ ((uint)wave * 0x9E3779B9u));
hash ^= hash >> 16; hash = unchecked(hash * 0x7FEB352Du); hash ^= hash >> 15;
int variant = (int)(hash % 3);
var baseline = Plan(wave, WaveRoute.Repair);
string title = baseline.Title, advice = baseline.Advice;
string[] enemies = new List<string>(baseline.Enemies).ToArray();
if (variant > 0)
{
switch (wave)
{
case 1:
title = variant == 1 ? "Stale services" : "Scheduled startup";
enemies = variant == 1 ? new[] { "zombie_process", "zombie_process" } : new[] { "zombie_process", "cron_job" };
advice = variant == 1 ? "Both Zombies can revive once. Finish weakened zombies decisively."
: "The Zombie can revive once. Cron Job announces its heavy attack with a countdown.";
break;
case 2:
title = variant == 1 ? "Leaking firewall" : "Orphan cleanup";
enemies = variant == 1 ? new[] { "firewalld", "memory_leak" } : new[] { "zombie_process", "segfault" };
advice = variant == 1 ? "Memory Leak grows each round while firewalld shields its neighbour."
: "The Zombie can revive once. Segfault has a death payload; plan for the process it leaves behind.";
break;
case 3:
title = variant == 1 ? "Hidden dependencies" : "Scheduled replication";
enemies = variant == 1 ? new[] { "rootkit", "zombie_process", "memory_leak" } : new[] { "fork_bomb", "cron_job", "zombie_process" };
advice = variant == 1 ? "Rootkit resists damage while allies remain. Clear its support while containing the growing Memory Leak."
: "Fork Bomb copies itself after acting. Cron Job counts down to a heavy attack; stop their growth early.";
break;
case 4:
title = variant == 1 ? "Protected concurrency" : "Leaking concurrency";
enemies = new[] { "race_condition", "race_condition", variant == 1 ? "firewalld" : "memory_leak" };
advice = "Race partners act in uncertain order; defeating one enrages the survivor. Choose between support and paired threats.";
break;
case RunJourney.BossWave:
title = variant == 1 ? "Kernel Overseer / scheduled interrupt" : "Kernel Overseer / memory pressure";
enemies = new[] { "kernel_overseer", variant == 1 ? "cron_job" : "memory_leak" };
advice = baseline.Advice;
break;
}
}
var plan = new EncounterPlan(title, advice, baseline.UptimeBonus, enemies);
if (wave > 1 && route == WaveRoute.Challenge)
{
int modifier = (int)((hash >> 8) % 3);
var escort = new List<string>(enemies) { "daemon" };
string detail = modifier == 0 ? "Veiled escort: damage the extra Daemon to reveal its intent."
: modifier == 1 ? "Armored escort: the extra Daemon starts with 6 Shield; damage reveals its intent."
: "Hardened escort: the extra Daemon has +4 Uptime; damage reveals its intent.";
plan = new EncounterPlan(title + " / challenge", advice + " " + detail, baseline.UptimeBonus, escort.ToArray())
{ EscortShield = modifier == 1 ? 6 : 0, EscortUptime = modifier == 2 ? 4 : 0 };
}
return plan;
}
public static EncounterPlan Plan(int wave, WaveRoute route)
{
string title, advice;