Refactor alot of stuff

This commit is contained in:
2026-10-29 22:54:29 +01:00
parent c23b666ee4
commit 260abc2c98
138 changed files with 2835 additions and 466 deletions
+6 -6
View File
@@ -58,7 +58,7 @@ namespace KernelPanic.Run
string name = LanguageCatalog.Get(language).DisplayName;
string objective = language switch
{
Language.CPlusPlus => "Learn C's evolved cards: stronger hits, full overkill spill and combos without segfault recoil.",
Language.CPlusPlus => "Learn C's evolved cards: the same base damage, full overkill spill and combos without segfault recoil.",
Language.TypeScript => "Learn to plan reliable attacks using JavaScript's evolved cards, with fixed damage and no failed typeof rolls.",
Language.Python => "You'll learn to build a combo that attacks this turn and repeats on later turns. First, we'll draw the cards we need. Then we'll put them in order.",
Language.Haskell => "You'll learn to make a stronger attack by playing your cards in the right order. We'll build a stack together, then work through why it resolves backward.",
@@ -73,14 +73,14 @@ namespace KernelPanic.Run
switch (language)
{
case Language.CPlusPlus:
Read("evolution", "C without the segfault", "C++ keeps C's immediate attacks and elevated critical chance. Damage is stronger, all overkill spills, and playing C++ never causes segfault recoil.", "enemies");
Read("evolution", "C without the segfault", "C++ keeps C's immediate attacks and elevated critical chance. Base damage matches C, all overkill spills, and playing C++ never causes segfault recoil.", "enemies");
Play("burst", "lang_cpp_malloc", "Start with upgraded malloc", "Play malloc to begin your C++ chain. Your hand stays safe from segfault corruption.");
Read("combo", "Follow with pointer", "Pointer deals 20 base damage after a C++ card instead of 12. Use printf to repair corruption from other sources. Full excess damage spills to the next living enemy.", "enemies");
Read("combo", "Follow with pointer", "Pointer deals 15 base damage after a C++ card instead of 9. Use printf to repair corruption from other sources. Full excess damage spills to the next living enemy.", "enemies");
break;
case Language.TypeScript:
Read("evolution", "Plan around fixed values", "TypeScript upgrades JavaScript's cards. Damage has a fixed value and no critical roll. Buffs and enemy defenses still apply.", "enemies");
Play("fixed", "lang_ts_console_log", "Deal a reliable 9", "Play console.log(). Its base damage is always 9 instead of a random 3 to 9.");
Read("guarantee", "No failed typeof", "Fetch deals 13 base damage. Typeof always deals 16 instead of risking a failed roll. Check enemy defenses, then choose your follow-up.", "enemies");
Read("evolution", "Plan around fixed values", "TypeScript upgrades JavaScript's cards. Damage uses JavaScript's average base value, with halves rounded up, and cannot crit. Buffs and enemy defenses still apply.", "enemies");
Play("fixed", "lang_ts_console_log", "Deal a reliable 6", "Play console.log(). Its base damage is always 6, the average of JavaScript's random 3 to 9.");
Read("guarantee", "No failed typeof", "Fetch deals 9 base damage. Typeof always deals 11: its 75% chance of 14 averages to 10.5, rounded up. Check enemy defenses, then choose your follow-up.", "enemies");
break;
case Language.Go:
Read("go-slots", "Start a worker for future turns", "Go has 3 active slots, separate from hand RAM. A deployed worker leaves your hand and starts attacking next round. Its card returns to the discard pile when it stops.", "GoroutineScheduler");
+127 -12
View File
@@ -57,7 +57,7 @@ namespace KernelPanic.Run
DailyQuests.Record(fixture.dailyQuests, DailyQuestKind.Damage, 80, DateTime.UtcNow);
new SaveService().Save(fixture);
}
if (args.Contains("--kernel-panic-language-training-smoke") || args.Contains("--kernel-panic-nixos-go-smoke"))
if (args.Contains("--kernel-panic-language-training-smoke") || args.Contains("--kernel-panic-nixos-go-smoke") || args.Contains("--kernel-panic-next-improvements-smoke"))
{
var fixture = SaveData.CreateDefault();
fixture.starterChosen = true;
@@ -137,6 +137,12 @@ namespace KernelPanic.Run
yield return new WaitForSecondsRealtime(2);
var menu = FindFirstObjectByType<MainMenuController>();
Require(menu != null, "Main menu scene did not initialize.");
if (Environment.GetCommandLineArgs().Contains("--kernel-panic-next-improvements-smoke"))
{
var scenario = NextImprovementsScenario(menu);
while (scenario.MoveNext()) yield return scenario.Current;
yield break;
}
if (Environment.GetCommandLineArgs().Contains("--kernel-panic-nixos-go-smoke"))
{
var nixScenario = NixGoScenario(menu);
@@ -210,14 +216,14 @@ namespace KernelPanic.Run
string originalBuild = BuildSignature(combat.RunConfig);
var view = FindFirstObjectByType<CombatSceneController>();
var previewRoot = view.GetComponent<UIDocument>().rootVisualElement;
var executionPreview = previewRoot.Q<Foldout>("ExecutionPreview");
var executionPreview = previewRoot.Q<Button>("OpenExecutionPreview");
int drawsBeforePreview = RandomRoll.DrawCount;
executionPreview.value = true;
Submit(executionPreview);
yield return null;
var previewContents = previewRoot.Q("ExecutionPreviewPopup") ?? executionPreview;
Require(RandomRoll.DrawCount == drawsBeforePreview && previewContents.Q<Label>(className: "terminal-body") != null,
"Execution preview changed RNG or did not render its explanation.");
executionPreview.value = false;
Submit(previewRoot.Q<Button>("CloseExecutionPreview"));
if (Environment.GetCommandLineArgs().Contains("--kernel-panic-campaign-smoke"))
{
var campaign = CampaignScenario(combat, view);
@@ -463,6 +469,117 @@ namespace KernelPanic.Run
"Retry settlement duplicated rewards/history or resurrected the consumed checkpoint.");
}
private IEnumerator NextImprovementsScenario(MainMenuController menu)
{
_stage = "planning save fixture";
Call(menu, "CompleteBootIntro");
var nix = Field<DistroDatabase>(menu, "distroDatabase").FindById("nixos");
var database = Field<CardDatabase>(menu, "cardDatabase");
bool packageFixture = Environment.GetCommandLineArgs().Contains("--kernel-panic-package-layout-smoke");
var equipped = Array.Empty<PackageInstance>();
if (packageFixture)
{
nix = Field<DistroDatabase>(menu, "distroDatabase").FindById("mint");
var packages = Field<PackageDatabase>(menu, "packageDatabase");
equipped = new[] { "pkg_mint_timeshift", "pkg_mint_cinnamon", "pkg_auditd" }
.Select(id => new PackageInstance(packages.FindById(id), 5)).ToArray();
}
RunContext.Set(nix, nix.ExclusiveCards.Take(4).ToArray(), equipped, Language.Python, Language.Go, 5, 73129);
SceneLoader.LoadGame(menu.GetComponent<UIDocument>().rootVisualElement);
CombatManager combat = null;
while (combat == null || !combat.CanSaveCombat) { yield return null; combat = FindFirstObjectByType<CombatManager>(); }
var view = FindFirstObjectByType<CombatSceneController>(); var document = view.GetComponent<UIDocument>();
var run = combat.GetComponent<RunManager>();
if (packageFixture)
{
yield return new WaitForSecondsRealtime(1);
var packagePanel = document.rootVisualElement.Q("CombatPackages");
packagePanel.GetFirstAncestorOfType<ScrollView>().ScrollTo(packagePanel);
var packageCapture = CapturePanel(document, "package-readiness");
while (packageCapture.MoveNext()) yield return packageCapture.Current;
Call(view, "HandlePackageActivated", new PackageActivation("pkg_mint_timeshift", "Timeshift", "Full recovery notification with enough detail to overflow a narrow screen if it wraps"));
Call(view, "HandlePackageActivated", new PackageActivation("pkg_mint_cinnamon", "Cinnamon", "JavaScript damage increased for this round"));
yield return null;
packagePanel.GetFirstAncestorOfType<ScrollView>().ScrollTo(packagePanel);
packageCapture = CapturePanel(document, "package-notification");
while (packageCapture.MoveNext()) yield return packageCapture.Current;
}
// Isolated fixture gives the presentation time to display persistent state without ending the wave.
foreach (var enemy in combat.Enemies) { enemy.State.MaxUptime = 1000; enemy.State.CurrentUptime = 1000; }
var target = combat.Enemies[0].State;
var go = new CardInstance(database.AllCards.First(c => c != null && c.Language == Language.Go
&& CardCatalog.TryGet(c.Id, out var entry) && entry.Effects.Any(e => e.Kind == CardEffectKind.Go && e.SecondaryAmount == (int)GoOperation.Deploy)));
combat.Go.Deploy(go, 3, 3, 0, target);
var payload = new CardInstance(database.AllCards.First(c => c != null && PythonPipeline.IsPayload(c)));
var context = new CombatContext(payload, combat.PlayerState, new[] { target }, combat, combat.DamagePipeline,
new StatusEffectController(), combat.DeckController, combat.HandController, combat.Enemies);
combat.Python.Execute(context, PythonOperation.Async, 0);
combat.Python.Execute(context, PythonOperation.Print, 3);
payload.SetTargetSnapshot(new[] { target }); payload.MarkQueued(); combat.InterpreterQueue.Enqueue(payload);
Call(view, "Refresh");
string graph = JsonUtility.ToJson(combat.CaptureCombatSnapshot());
int draws = RandomRoll.DrawCount; string runId = run.RunId;
var progress = new SaveService().Load();
yield return new WaitForSecondsRealtime(1);
var saveControl = document.rootVisualElement.Q<Button>("SaveCombatButton");
Require(saveControl.worldBound.height > 0 && document.rootVisualElement.worldBound.Contains(saveControl.worldBound.min)
&& document.rootVisualElement.worldBound.Contains(saveControl.worldBound.max), "Planning save control is clipped.");
var capture = CapturePanel(document, "planning-save"); while (capture.MoveNext()) yield return capture.Current;
Submit(document.rootVisualElement.Q<Button>("OpenExecutionPreview"));
Require(document.rootVisualElement.Q("ExecutionPreviewPopup") != null, "Preview dialog did not open.");
capture = CapturePanel(document, "execution-preview"); while (capture.MoveNext()) yield return capture.Current;
Submit(document.rootVisualElement.Q<Button>("CloseExecutionPreview"));
Require(RandomRoll.DrawCount == draws, "Preview consumed randomness.");
Submit(document.rootVisualElement.Q<Button>("SaveCombatButton"));
menu = null;
while (menu == null) { yield return null; menu = FindFirstObjectByType<MainMenuController>(); }
var saved = new SaveService().Load();
Require(saved.activeRun?.fullCombat != null && saved.bandwidthBalance == progress.bandwidthBalance
&& saved.entropyBalance == progress.entropyBalance, "Planning save lost state or paid rewards.");
Call(menu, "ResumeSavedRun"); combat = null;
while (combat == null || !combat.CanSaveCombat) { yield return null; combat = FindFirstObjectByType<CombatManager>(); }
view = FindFirstObjectByType<CombatSceneController>(); document = view.GetComponent<UIDocument>(); run = combat.GetComponent<RunManager>();
Require(run.RunId == runId && !run.RepositoryVisitActive && JsonUtility.ToJson(combat.CaptureCombatSnapshot()) == graph
&& RandomRoll.DrawCount == draws, "Planning resume changed the combat graph or RNG cursor.");
Require(new SaveService().Load().activeRun == null, "Combat checkpoint was not consumed.");
int round = combat.RoundNumber;
combat.EndPlayerTurn();
while (!combat.CanSaveCombat || combat.RoundNumber == round) yield return null;
Require(combat.Go.Active.Count == 1 && combat.Go.Active[0].RemainingTicks == 2, "Resumed goroutine did not tick exactly once.");
Require(combat.InterpreterQueue.Count == 0, "Resumed FIFO did not drain.");
_stage = "damage explanation";
Submit(document.rootVisualElement.Q<Button>("OpenTurnResolution"));
var resolution = document.rootVisualElement.Q("TurnResolutionPopup");
Require(resolution != null, "Results dialog did not open.");
capture = CapturePanel(document, "turn-resolution"); while (capture.MoveNext()) yield return capture.Current;
var explanation = resolution.Query<Foldout>().ToList().FirstOrDefault(f => f.text == "Damage calculation / recent hits");
Require(explanation != null, "Damage calculation foldout is missing."); explanation.value = true;
yield return new WaitForSecondsRealtime(1);
Require(resolution.Q<ScrollView>("ResolutionActions").contentViewport.worldBound.height > 200, "Damage results viewport is too small.");
explanation.GetFirstAncestorOfType<ScrollView>()?.ScrollTo(explanation);
capture = CapturePanel(document, "damage-calculation"); while (capture.MoveNext()) yield return capture.Current;
Submit(document.rootVisualElement.Q<Button>("CloseTurnResolution"));
Require(document.rootVisualElement.Q("TurnResolutionPopup") == null, "Results dialog did not close.");
_stage = "deck analysis and upgrade comparison";
Field<System.Collections.Generic.List<EnemyInstance>>(combat, "_enemies").Clear(); Call(combat, "CheckWin");
while (!combat.AwaitingWaveContinue) yield return null;
run.AddBits(100);
var offers = Field<System.Collections.Generic.List<RepositoryOffer>>(run, "_repositoryOffers");
offers.Insert(0, RepositoryOffer.CardUpgrade(run.RunDeck[0], CardUpgradeKind.MagnitudeUp, 1));
Call(view, "Refresh");
document.rootVisualElement.Q<Foldout>("DeckAnalysis").value = true;
document.rootVisualElement.Q<Foldout>("UpgradeComparison").value = true;
capture = CapturePanel(document, "deck-analysis"); while (capture.MoveNext()) yield return capture.Current;
var upgrade = document.rootVisualElement.Q<Foldout>("UpgradeComparison");
upgrade.GetFirstAncestorOfType<ScrollView>()?.ScrollTo(upgrade);
capture = CapturePanel(document, "upgrade-comparison"); while (capture.MoveNext()) yield return capture.Current;
Submit(document.rootVisualElement.Q<Button>("BootNextWaveButton"));
var routeDetail = document.rootVisualElement.Q("RouteDetails");
routeDetail?.GetFirstAncestorOfType<ScrollView>()?.ScrollTo(routeDetail);
capture = CapturePanel(document, "encounter-route-preview"); while (capture.MoveNext()) yield return capture.Current;
_campaignSuccess = "PASS: exact mid-combat graph/RNG save-resume, unchanged currencies, consumed checkpoint, Go tick and FIFO resolution, damage breakdown, repository deck analysis and upgrade comparison, route preview.";
}
private IEnumerator NixGoScenario(MainMenuController menu)
{
_stage = "NixOS collection";
@@ -589,15 +706,14 @@ namespace KernelPanic.Run
capturedResolution = true;
var trace = Field<CombatExecutionTrace>(view, "_executionTrace");
Require(trace.Actions.Count > 0 && trace.Actions.Any(a => a.Complete), "Practice has no observed resolution results.");
var resolution = root.Q<Foldout>("TurnResolution");
var resolution = root.Q<Button>("OpenTurnResolution");
Require(resolution != null, "Turn-resolution view is missing.");
resolution.value = true;
var workspace = resolution.GetFirstAncestorOfType<ScrollView>();
Submit(resolution);
for (int frame = 0; frame < 4; frame++) yield return null;
workspace?.ScrollTo(resolution);
for (int frame = 0; frame < 4; frame++) yield return null;
var capture = CapturePanel(document, "training-" + language + "-resolution");
while (capture.MoveNext()) yield return capture.Current;
Submit(root.Q<Button>("CloseTurnResolution"));
}
if (combat.PendingGoroutineCard != null)
{
@@ -914,7 +1030,7 @@ namespace KernelPanic.Run
while (!combat.CanSurrenderRun) yield return null;
Require(run.CurrentWaveNumber == wave && !run.CampaignChoicePending, "Extended route ended before its final boss.");
if (wave == RunJourney.BossWave)
Require(combat.Enemies.Count(e => e.ArchetypeId == "kernel_overseer") == 1, "Final tier did not lead to the boss.");
Require(combat.Enemies.Count(e => e.Archetype.Tier == EnemyTier.Boss) == 1, "Final tier did not lead to the boss.");
Field<System.Collections.Generic.List<EnemyInstance>>(combat, "_enemies").Clear(); Call(combat, "CheckWin");
yield return null;
Submit(document.rootVisualElement.Q<Button>("BootNextWaveButton"));
@@ -1113,11 +1229,10 @@ namespace KernelPanic.Run
if (!capturedPreview && combat.InterpreterQueue.Count > 0)
{
capturedPreview = true;
var preview = document.rootVisualElement.Q<Foldout>("ExecutionPreview");
preview.value = true;
Submit(document.rootVisualElement.Q<Button>("OpenExecutionPreview"));
var capture = CapturePanel(document, "execution-preview");
while (capture.MoveNext()) yield return capture.Current;
preview.value = false;
Submit(document.rootVisualElement.Q<Button>("CloseExecutionPreview"));
}
if (run.CurrentWaveNumber == RunJourney.BossWave && !capturedBoss)
{
+36 -8
View File
@@ -10,7 +10,7 @@ using UnityEngine;
namespace KernelPanic.Run
{
/// <summary>A repository-boundary snapshot, never an in-flight combat serialization.</summary>
/// <summary>A repository or quiescent player-planning checkpoint.</summary>
[Serializable]
public sealed class RunCheckpoint
{
@@ -38,18 +38,45 @@ namespace KernelPanic.Run
public int rerolls;
public int shopRandomDraws;
public CheckpointCombat combat;
public CombatSnapshot fullCombat;
public bool inCombat;
public RunJourney journey;
public RunPerformanceSnapshot performance;
public ResolvedRunCheckpoint Resolve(DistroDatabase distros, CardDatabase cards,
LanguageDeckDatabase languages, PackageDatabase packageDatabase)
{
Require(version >= 1 && version <= 5, "This checkpoint needs a different game version.");
Require(version >= 1 && version <= 6, "This checkpoint needs a different game version.");
// JsonUtility can materialize empty nested objects for a serialized null. The explicit
// discriminator also keeps checkpoints written before combat saving unambiguous.
if (!inCombat) fullCombat = null;
Require(!inCombat || (version >= 6 && fullCombat != null), "Unsupported combat checkpoint.");
Require(version < 2 || journey != null, "Missing saved route decisions.");
journey?.Validate(wave);
journey?.ValidateMap(seed, wave);
if (fullCombat == null) { journey?.Validate(wave); journey?.ValidateMap(seed, wave); }
else
{
Require(journey != null && journey.pendingRewardWave == 0, "Missing combat route or unclaimed reward.");
var boundary = journey.Copy();
if (wave == 1)
{
Require(boundary.visits != null && boundary.visits.Count == 0 && boundary.selectedNodeId == 0, "Invalid initial route.");
boundary.mapRevision = 0;
boundary.Validate(wave);
}
else
{
if (boundary.mapRevision > 0)
{
var visit = boundary.visits?.LastOrDefault();
Require(visit != null && visit.wave == wave && !visit.cleared && visit.nodeId == boundary.selectedNodeId
&& visit.route == boundary.activeRoute && visit.route == boundary.selectedRoute, "Missing active route visit.");
boundary.visits.RemoveAt(boundary.visits.Count - 1);
}
boundary.Validate(wave); boundary.ValidateMap(seed, wave);
}
}
Require(Guid.TryParseExact(runId, "N", out _), "Invalid run identity.");
Require(wave >= 2 && wave <= 100000 && wavesCleared == wave - 1, "Invalid checkpoint wave.");
Require(wave >= (fullCombat == null ? 2 : 1) && wave <= 100000 && wavesCleared == wave - 1, "Invalid checkpoint wave.");
Require(bits >= 0 && bandwidth >= 0 && entropy >= 0 && rerolls >= 0, "Invalid checkpoint balances.");
Require(maxUptimeBonus >= 0 && maxCyclesBonus >= 0 && ramBonus >= 0, "Invalid run upgrades.");
Require(shopRandomDraws >= 0 && shopRandomDraws <= 10000000, "Invalid shop random cursor.");
@@ -84,9 +111,9 @@ namespace KernelPanic.Run
foreach (RunBuildPackageSaveEntry entry in packages)
{
PackageDefinition package = entry == null || packageDatabase == null ? null : packageDatabase.FindById(entry.packageId);
Require(package != null && package.Slot == entry.slot && slots.Add(entry.slot), "A checkpoint package is missing or invalid.");
Require(entry.upgradeLevel >= 0 && entry.upgradeLevel <= 5, "Invalid package level.");
equipped.Add(new PackageInstance(package, entry.upgradeLevel));
Require(package != null && package.AcceptsSavedSlot(entry.slot) && slots.Add(entry.slot), "A checkpoint package is missing or invalid.");
Require(entry.upgradeLevel >= 0 && entry.upgradeLevel <= PackageTuning.MaxPackageLevel, "Invalid package level.");
equipped.Add(new PackageInstance(package, entry.upgradeLevel) { SavedSlot = entry.slot });
}
var config = new RunConfig(distro, primaryLanguage, secondaryLanguage, startingCards.Select(FindCard).ToList(), equipped, seed, distroVersion);
List<CardInstance> restoredDeck = deck.Select(entry => RestoreCard(entry, FindCard)).ToList();
@@ -115,6 +142,7 @@ namespace KernelPanic.Run
if (entry.sold) offer.MarkSold();
restoredOffers.Add(offer);
}
fullCombat?.Prepare(FindCard, restoredDeck);
return new ResolvedRunCheckpoint(this, config, restoredDeck, restoredOffers);
}
+2 -2
View File
@@ -33,7 +33,7 @@ namespace KernelPanic.Run
public int FinalWave => encounterRevision >= 2 ? BossWave : LegacyBossWave;
public bool IsRewardWave(int wave) => encounterRevision > 0 && wave >= 2 && wave < FinalWave && wave % 2 == 0;
public bool AtMilestone(int wavesCleared) => campaign && !endless && wavesCleared >= FinalWave;
public static RunJourney NewCampaign() => new() { campaign = true, encounterRevision = 3, mapRevision = 2 };
public static RunJourney NewCampaign() => new() { campaign = true, encounterRevision = 4, mapRevision = 2 };
public RunJourney Copy()
{
var copy = (RunJourney)MemberwiseClone();
@@ -43,7 +43,7 @@ namespace KernelPanic.Run
public void Validate(int wave)
{
RunCheckpoint.Require(encounterRevision >= 0 && encounterRevision <= 3, "Unsupported encounter revision.");
RunCheckpoint.Require(encounterRevision >= 0 && encounterRevision <= 4, "Unsupported encounter revision.");
RunCheckpoint.Require((pendingRewardWave == 0 || IsRewardWave(pendingRewardWave))
&& (claimedRewardWave == 0 || IsRewardWave(claimedRewardWave))
&& claimedRewardWave < wave
+10 -8
View File
@@ -256,8 +256,8 @@ namespace KernelPanic.Run
public RunCheckpoint CaptureCheckpoint(CombatManager combat)
{
if (CurrentConfig?.IsLanguageTraining == true) throw new InvalidOperationException("Language practice cannot replace a saved campaign.");
RunCheckpoint.Require(isRunActive && !IsSuspended && !_rewardsSettled && _repositoryVisitActive
&& combat != null && combat.AwaitingWaveContinue && !combat.RunLost, "Runs can only be saved in the repository.");
RunCheckpoint.Require(isRunActive && !IsSuspended && !_rewardsSettled && combat != null && !combat.RunLost
&& ((_repositoryVisitActive && combat.AwaitingWaveContinue) || combat.CanSaveCombat), "Finish resolving actions before saving.");
RunCheckpoint snapshot = new()
{
runId = RunId, savedUtc = DateTime.UtcNow.ToString("O"), distroId = CurrentConfig.Distro.Id,
@@ -269,12 +269,14 @@ namespace KernelPanic.Run
bandwidth = _accruedBandwidth, entropy = _accruedEntropy,
maxUptimeBonus = _maxUptimeBonus, maxCyclesBonus = _maxCyclesBonus, ramBonus = _ramBonus,
rerolls = _rerollsThisVisit, shopRandomDraws = _repositoryRandom.Draws,
version = 5, journey = Journey.Copy(), performance = Performance.Copy(),
version = 6, journey = Journey.Copy(), performance = Performance.Copy(),
fullCombat = combat.AwaitingWaveContinue ? null : combat.CaptureCombatSnapshot(),
inCombat = !combat.AwaitingWaveContinue,
combat = combat.CaptureBoundaryState()
};
foreach (PackageInstance package in CurrentConfig.EquippedPackages)
snapshot.packages.Add(new Meta.RunBuildPackageSaveEntry
{ packageId = package.Definition.Id, slot = package.Definition.Slot, upgradeLevel = package.UpgradeLevel });
{ packageId = package.Definition.Id, slot = package.SavedSlot, upgradeLevel = package.UpgradeLevel });
foreach (RepositoryOffer offer in _repositoryOffers)
snapshot.offers.Add(new CheckpointOffer
{
@@ -317,16 +319,16 @@ namespace KernelPanic.Run
_repositoryOffers.AddRange(resume.Offers);
_soldOfferKeys.Clear();
foreach (string key in snapshot.soldKeys) _soldOfferKeys.Add(key);
_repositoryVisitActive = true;
_repositoryVisitActive = !snapshot.inCombat;
// Old saves begin a map here; do not invent decisions for earlier waves.
if (Journey.campaign && Journey.mapRevision == 0)
if (_repositoryVisitActive && Journey.campaign && Journey.mapRevision == 0)
{
Journey.mapRevision = 1;
Journey.mapStartWave = currentWaveNumber;
Journey.selectedNodeId = RunRouteMap.Row(CurrentConfig.RunSeed, currentWaveNumber, currentWaveNumber, 1)
.FirstOrDefault(n => n.Route == Journey.selectedRoute)?.Id ?? 0;
}
EnsureRouteSelection();
if (_repositoryVisitActive) EnsureRouteSelection();
}
public void AddBits(int amount)
@@ -447,7 +449,7 @@ namespace KernelPanic.Run
for (int i = 0; i < packages.Count; i++)
{
PackageInstance package = packages[i];
if (package?.Definition == null || package.Definition.Slot != PackageSlot.Kernel)
if (package?.Definition == null)
{
continue;
}
+1 -1
View File
@@ -126,7 +126,7 @@ namespace KernelPanic.Run
public static string Detail(WaveRoute route) => route switch
{
WaveRoute.Repair => "Restore up to 6 Uptime on departure.",
WaveRoute.Challenge => $"Fight an extra Daemon. On clear: +{RunJourney.ChallengeBits} Bits and a draw rider on the first eligible card; +{RunJourney.ChallengeBits} more Bits if none is eligible.",
WaveRoute.Challenge => $"Fight an extra elite; inspect the encounter for its mechanics. On clear: +{RunJourney.ChallengeBits} Bits and a draw rider on the first eligible card; +{RunJourney.ChallengeBits} more Bits if none is eligible.",
WaveRoute.Cache => "Recover 6 Bits on departure. No extra enemy.",
WaveRoute.Forge => "Choose a card to gain +2 effect magnitude for this run. You may pass.",
WaveRoute.Sacrifice => "Remove one card from this run's deck. Give a different card +4 effect magnitude for this run. You may pass.",