Rebalance most languages and revamp main game loop

This commit is contained in:
2026-10-25 23:50:04 +01:00
parent 53f831d91e
commit a4109f5be0
76 changed files with 4198 additions and 573 deletions
+21 -4
View File
@@ -54,6 +54,7 @@ public class RunCheckpointTests
var config = new RunConfig(distro, Language.Python, Language.JavaScript, starting,
new[] { new PackageInstance(_packages.FindById("pkg_fedora_dnf"), 3) }, -7712, 2);
_run.StartRun(config); // No bound CombatManager: do not start Play-mode coroutines.
_run.Journey.mapRevision = 0; // This fixture jumps directly to an older repository boundary.
Set(_combat, "_runManager", _run);
Set(_combat, "_runConfig", config);
Set(_combat, "_playerState", new CombatantState(_run.EffectiveMaxUptime(), _run.EffectiveRam(), _run.EffectiveMaxCycles())
@@ -141,7 +142,7 @@ public class RunCheckpointTests
var resume = Prepare();
_run.RestoreCheckpoint(resume);
Assert.That(_run.BuildRewardPending, Is.True);
Assert.That(_run.Journey.encounterRevision, Is.EqualTo(1));
Assert.That(_run.Journey.encounterRevision, Is.EqualTo(2));
int bits = _run.Bits;
Assert.That(_run.ClaimBuildReward(null, CardUpgradeKind.MagnitudeUp, true), Is.True);
RunCheckpointService.SaveAndSuspend(_saves, _run, _combat);
@@ -200,6 +201,22 @@ public class RunCheckpointTests
Assert.That(_combat.RunConfig.RunSeed, Is.EqualTo(-7712));
}
[TestCase(0, 0, 0)]
[TestCase(1, 1, 0)]
[TestCase(3, 3, 1)]
[TestCase(5, 5, 3)]
[TestCase(6, 6, 4)]
[TestCase(int.MaxValue, 6, 4)]
public void JavaWarmupRestoresPartialProgressClampsLegacyExcessAndCools(int saved, int restored, int cooled)
{
var snapshot = _combat.CaptureBoundaryState();
snapshot.javaCardsPlayed = saved;
_combat.RestoreBoundaryState(_combat.RunConfig, snapshot);
Assert.That(_combat.CaptureBoundaryState().javaCardsPlayed, Is.EqualTo(restored));
typeof(CombatManager).GetMethod("DecayJavaWarmupForNextWave", Private).Invoke(_combat, null);
Assert.That(_combat.CaptureBoundaryState().javaCardsPlayed, Is.EqualTo(cooled));
}
[Test]
public void FailedCheckpointWriteKeepsRunActiveAndExistingSaveUnchanged()
{
@@ -306,7 +323,7 @@ public class RunCheckpointTests
Assert.That(_run.SelectRoute(WaveRoute.Challenge), Is.True);
RunCheckpointService.SaveAndSuspend(_saves, _run, _combat);
var restored = Prepare();
Assert.That(restored.Snapshot.version, Is.EqualTo(3));
Assert.That(restored.Snapshot.version, Is.EqualTo(4));
_run.RestoreCheckpoint(restored);
_combat.RestoreBoundaryState(restored.Config, restored.Snapshot.combat);
Assert.That(_run.Journey.campaign, Is.True);
@@ -331,8 +348,8 @@ public class RunCheckpointTests
[Test]
public void BossMilestoneSurvivesSaveAndResumeWithoutStartingEndless()
{
Set(_run, "currentWaveNumber", 6);
Set(_run, "_wavesCleared", 5);
Set(_run, "currentWaveNumber", RunJourney.BossWave + 1);
Set(_run, "_wavesCleared", RunJourney.BossWave);
RunCheckpointService.SaveAndSuspend(_saves, _run, _combat);
var restored = Prepare();
_run.RestoreCheckpoint(restored);