Implement more QoL features and rebalances
This commit is contained in:
@@ -38,6 +38,18 @@ namespace KernelPanic.Run
|
||||
}
|
||||
// Install before the menu's OnEnable can schedule the animated boot sequence.
|
||||
UIPreferences.ReducedMotion = true; // Session only; never writes preferences.
|
||||
if (args.Contains("--kernel-panic-quest-ui-smoke"))
|
||||
{
|
||||
// The unused, isolated save-path guard above also applies to this UI fixture.
|
||||
var fixture = SaveData.CreateDefault();
|
||||
fixture.starterChosen = true;
|
||||
fixture.ownedUnits.Add(new OwnedUnitSaveEntry { id = "ubuntu", version = 1 });
|
||||
fixture.dailyQuests.refreshAtUtcTicks = DateTime.UtcNow.AddDays(1).Ticks;
|
||||
DailyQuests.Record(fixture.dailyQuests, DailyQuestKind.Waves, 3, DateTime.UtcNow);
|
||||
DailyQuests.Record(fixture.dailyQuests, DailyQuestKind.Cards, 12, DateTime.UtcNow);
|
||||
DailyQuests.Record(fixture.dailyQuests, DailyQuestKind.Damage, 80, DateTime.UtcNow);
|
||||
new SaveService().Save(fixture);
|
||||
}
|
||||
var owner = new GameObject("Player smoke verification");
|
||||
Application.runInBackground = true;
|
||||
DontDestroyOnLoad(owner);
|
||||
@@ -95,6 +107,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-quest-ui-smoke"))
|
||||
{
|
||||
var questScenario = QuestUiScenario(menu);
|
||||
while (questScenario.MoveNext()) yield return questScenario.Current;
|
||||
yield break;
|
||||
}
|
||||
var starter = Field<StarterSelectionController>(menu, "starterSelection");
|
||||
if (!starter.IsActive)
|
||||
{
|
||||
@@ -120,7 +138,7 @@ namespace KernelPanic.Run
|
||||
while (training.MoveNext()) yield return training.Current;
|
||||
if (Environment.GetCommandLineArgs().Contains("--kernel-panic-tutorial-smoke"))
|
||||
{
|
||||
_campaignSuccess = "PASS: two-wave guided tutorial, real targeting/revival/queue/stack, full clears, shop purchase, same-run resume, one-time 1000 Bandwidth + 1000 Entropy, clean normal-run workspace.";
|
||||
_campaignSuccess = "PASS: three-wave guided tutorial, real targeting/revival/queue/stack/countdown/Daemon reveal, full clears, shop purchase, wave-two and wave-three resume, one-time 1000 Bandwidth + 1000 Entropy, clean normal-run workspace.";
|
||||
yield break;
|
||||
}
|
||||
menu = FindFirstObjectByType<MainMenuController>();
|
||||
@@ -184,8 +202,10 @@ namespace KernelPanic.Run
|
||||
_stage = "repository";
|
||||
var run = combat.GetComponent<RunManager>();
|
||||
Require(run.WavesCleared == 1 && run.RepositoryVisitActive, "Wave completion did not open repository.");
|
||||
Submit(view.GetComponent<UIDocument>().rootVisualElement.Q<Button>("BootNextWaveButton"));
|
||||
Submit(view.GetComponent<UIDocument>().rootVisualElement.Q<Button>("RouteChallenge"));
|
||||
Require(run.Journey.selectedRoute == WaveRoute.Challenge, "Elite route selection did not reach the run model.");
|
||||
Submit(view.GetComponent<UIDocument>().rootVisualElement.Q<Button>("BackToRepositoryButton"));
|
||||
var offer = run.RepositoryOffers.FirstOrDefault(item => item.Price <= run.Bits);
|
||||
Require(offer != null, "No affordable repository offer.");
|
||||
int bits = run.Bits;
|
||||
@@ -265,6 +285,13 @@ namespace KernelPanic.Run
|
||||
"Run archive command is not between Settings and Quit.");
|
||||
capture = CapturePanel(menu.GetComponent<UIDocument>(), "home-menu");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
Submit(menuRoot.Q<Button>("DailyQuestWidget"));
|
||||
Require(menuRoot.Q("DailyQuestOverlay") != null, "Daily quest widget did not open its overlay.");
|
||||
capture = CapturePanel(menu.GetComponent<UIDocument>(), "daily-quest-details");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
Submit(menuRoot.Q<Button>("CloseDailyQuests"));
|
||||
Require(menuRoot.Q("DailyQuestOverlay") == null && homePanel.enabledInHierarchy,
|
||||
"Closing daily quests did not restore the main menu.");
|
||||
OpenRunArchive(menuRoot);
|
||||
yield return null;
|
||||
RequireArchiveVisible(menuRoot);
|
||||
@@ -397,7 +424,7 @@ namespace KernelPanic.Run
|
||||
var capture = CapturePanel(document, "tutorial-intro");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
int actions = 0;
|
||||
bool resumed = false;
|
||||
int resumedLesson = 1;
|
||||
var capturedSteps = new System.Collections.Generic.HashSet<string>();
|
||||
while (TutorialCampaign.Required(save.Load()))
|
||||
{
|
||||
@@ -407,12 +434,25 @@ namespace KernelPanic.Run
|
||||
{
|
||||
if (!combat.TutorialInputReady) { yield return null; continue; }
|
||||
var step = flow.Guide.Step;
|
||||
if (capturedSteps.Add(flow.Lesson + step.Id) && step.Id is "select-attack" or "target-zombie" or "pending-revival" or "revived" or "queued-haskell")
|
||||
if (capturedSteps.Add(flow.Lesson + step.Id) && step.Id is "select-attack" or "target-zombie" or "pending-revival" or "revived" or "queued-haskell" or "daemon" or "revealed-daemon" or "cron-ticking" or "cron-armed" or "shield-cron")
|
||||
{
|
||||
capture = CapturePanel(document, "tutorial-" + step.Id);
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
}
|
||||
var root = document.rootVisualElement;
|
||||
if (flow.Lesson == 3)
|
||||
{
|
||||
var cron = combat.Enemies.Single(enemy => enemy.ArchetypeId == "cron_job");
|
||||
var daemon = combat.Enemies.Single(enemy => enemy.ArchetypeId == "daemon");
|
||||
if (step.Id == "daemon") Require(!daemon.IntentRevealed, "Daemon starts hidden.");
|
||||
if (step.Id == "revealed-daemon") Require(daemon.IntentRevealed && !daemon.State.IsDefeated, "Damage must reveal the live miniboss.");
|
||||
if (step.Id == "cron-ticking")
|
||||
{
|
||||
Require(cron.CountdownRemaining == 1, "Cron did not count down after an enemy turn.");
|
||||
Require(!daemon.IntentRevealed && daemon.DisplayIntent.ValueText == "?", "Daemon did not hide its new action.");
|
||||
}
|
||||
if (step.Id == "cron-armed") Require(cron.CountdownRemaining == 0 && cron.CurrentIntent.Kind == EnemyIntentKind.Attack, "Cron did not ready its heavy attack.");
|
||||
}
|
||||
if (flow.Reading)
|
||||
{
|
||||
var before = combat.CurrentPhase; combat.EndPlayerTurn();
|
||||
@@ -456,10 +496,10 @@ namespace KernelPanic.Run
|
||||
var next = root.Q<Button>("TutorialContinue");
|
||||
Require(next != null && next.enabledSelf, "Tutorial progression blocked.");
|
||||
Submit(next);
|
||||
if (!resumed && save.Load().tutorialCheckpoint != null)
|
||||
if (save.Load().tutorialCheckpoint is { } checkpoint && checkpoint.wave > resumedLesson)
|
||||
{
|
||||
resumed = true;
|
||||
Require(save.Load().tutorialCheckpoint.offers.Any(offer => offer.sold), "Shop purchase was not saved.");
|
||||
resumedLesson = checkpoint.wave;
|
||||
Require(checkpoint.deck.Any(card => card.magnitude > 0), "Shop purchase was not saved.");
|
||||
SceneLoader.LoadMainMenu(document.rootVisualElement);
|
||||
while (FindFirstObjectByType<MainMenuController>() == null) yield return null;
|
||||
combat = null;
|
||||
@@ -467,9 +507,10 @@ namespace KernelPanic.Run
|
||||
{ yield return null; combat = FindFirstObjectByType<CombatManager>(); }
|
||||
view = FindFirstObjectByType<CombatSceneController>();
|
||||
document = view.GetComponent<UIDocument>(); flow = Field<TutorialFlow>(view, "_tutorial");
|
||||
Require(flow.Lesson == 2 && flow.Reading && FindFirstObjectByType<RunManager>().RunId == runId,
|
||||
"Restart did not resume the same run at wave two.");
|
||||
Require(combat.PlayerState.CurrentUptime == uptime, "Resume reset remaining Uptime.");
|
||||
Require(flow.Lesson == resumedLesson && flow.Reading && FindFirstObjectByType<RunManager>().RunId == runId,
|
||||
"Restart did not resume the same run at wave " + resumedLesson);
|
||||
Require(combat.PlayerState.CurrentUptime == (resumedLesson == 3 ? combat.PlayerState.MaxUptime : uptime),
|
||||
"Resume did not preserve Uptime or apply the final practice repair.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -510,6 +551,16 @@ namespace KernelPanic.Run
|
||||
&& !Field<FirstBattleGuide>(view, "_firstBattleGuide").Visible, "Normal run still has automatic instructional text.");
|
||||
capture = CapturePanel(document, "normal-run-clean");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
Submit(document.rootVisualElement.Q<Button>("ReplayBattleGuide"));
|
||||
var quickGuide = Field<FirstBattleGuide>(view, "_firstBattleGuide");
|
||||
Require(quickGuide.Visible, "Quick guide did not open.");
|
||||
capture = CapturePanel(document, "quick-guide");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
quickGuide.Element.Q<Foldout>().value = true;
|
||||
capture = CapturePanel(document, "quick-guide-tracks");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
// Keep smoke validation from changing the user's remembered guide preference.
|
||||
quickGuide.Element.style.display = DisplayStyle.None;
|
||||
Require(save.Load().bandwidthBalance == final.bandwidthBalance && save.Load().entropyBalance == final.entropyBalance,
|
||||
"Scene change paid the tutorial reward again.");
|
||||
}
|
||||
@@ -525,6 +576,75 @@ namespace KernelPanic.Run
|
||||
commandInput.SendEvent(enter);
|
||||
}
|
||||
|
||||
private IEnumerator QuestUiScenario(MainMenuController menu)
|
||||
{
|
||||
_stage = "daily quest widget";
|
||||
var document = menu.GetComponent<UIDocument>();
|
||||
var root = document.rootVisualElement;
|
||||
Call(menu, "CompleteBootIntro");
|
||||
var capture = CapturePanel(document, "quest-home");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
var widget = root.Q<Button>("DailyQuestWidget");
|
||||
var homeScroll = root.Q<ScrollView>(className: "home-scroll");
|
||||
if (Screen.width >= 1280)
|
||||
Require(widget.worldBound.yMax <= homeScroll.contentViewport.worldBound.yMax + 1,
|
||||
"Quest widget must fit below neofetch without scrolling at 1280x720.");
|
||||
else
|
||||
{
|
||||
homeScroll.ScrollTo(widget);
|
||||
capture = CapturePanel(document, "quest-widget");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
}
|
||||
Require(root.Q<Label>("DailyQuestCompleted").text == "1/3 completed", "Quest fixture progress is wrong.");
|
||||
Require(root.Q<Label>("DailyQuestRewardReady").text == "1 reward ready"
|
||||
&& root.Q<Label>("DailyQuestInspect").text == "> claim available rewards", "Claimable widget feedback is wrong.");
|
||||
var widgetPosition = widget.worldBound.center;
|
||||
using (var down = PointerDownEvent.GetPooled(new Event { type = EventType.MouseDown, button = 0, mousePosition = widgetPosition }))
|
||||
{ down.target = widget; widget.SendEvent(down); }
|
||||
using (var up = PointerUpEvent.GetPooled(new Event { type = EventType.MouseUp, button = 0, mousePosition = widgetPosition }))
|
||||
{ up.target = widget; widget.SendEvent(up); }
|
||||
Require(root.Q("DailyQuestOverlay") != null, "Mouse click did not open quest details.");
|
||||
capture = CapturePanel(document, "quest-details");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
Submit(root.Q<Button>("ClaimDailyQuestWaves"));
|
||||
var saved = new SaveService().Load();
|
||||
var reward = DailyQuests.Reward(DailyQuestKind.Waves);
|
||||
Require(saved.bandwidthBalance == reward.Bandwidth && saved.entropyBalance == reward.Entropy
|
||||
&& !root.Q<Button>("ClaimDailyQuestWaves").enabledSelf, "Quest claim did not commit exactly once.");
|
||||
Require(root.Q<Button>("ClaimDailyQuestWaves").text == "[ CLAIMED ]"
|
||||
&& root.Q<Label>("DailyQuestFeedback").text.Contains($"+{reward.Bandwidth} Bandwidth, +{reward.Entropy} Entropy deposited."),
|
||||
"Successful claim feedback is missing.");
|
||||
using (var repeatedSubmit = NavigationSubmitEvent.GetPooled())
|
||||
{
|
||||
var claimedButton = root.Q<Button>("ClaimDailyQuestWaves");
|
||||
repeatedSubmit.target = claimedButton;
|
||||
claimedButton.SendEvent(repeatedSubmit);
|
||||
}
|
||||
Require(new SaveService().Load().bandwidthBalance == reward.Bandwidth, "Repeated submit paid a duplicate reward.");
|
||||
capture = CapturePanel(document, "quest-claimed");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
Submit(root.Q<Button>("CloseDailyQuests"));
|
||||
Require(root.Q("DailyQuestOverlay") == null && root.Q("ShellRoot").enabledSelf, "Quest overlay did not close.");
|
||||
Require(root.Q("DailyQuestRewardReady").style.display.value == DisplayStyle.None, "Widget did not update after claim.");
|
||||
widget = root.Q<Button>("DailyQuestWidget");
|
||||
Require(root.focusController.focusedElement != widget, "Mouse dismissal left a sticky widget focus highlight.");
|
||||
using (var move = PointerMoveEvent.GetPooled(new Event { type = EventType.MouseMove, mousePosition = new Vector2(4, 4) }))
|
||||
{ move.target = root; root.SendEvent(move); }
|
||||
capture = CapturePanel(document, "quest-dismissed");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
widget.Focus();
|
||||
Submit(widget);
|
||||
using (var escape = KeyDownEvent.GetPooled('\0', KeyCode.Escape, EventModifiers.None))
|
||||
{
|
||||
var close = root.Q<Button>("CloseDailyQuests");
|
||||
escape.target = close;
|
||||
close.SendEvent(escape);
|
||||
}
|
||||
Require(root.Q("DailyQuestOverlay") == null && root.focusController.focusedElement == widget,
|
||||
"Keyboard dismissal must restore widget focus.");
|
||||
_campaignSuccess = "PASS: daily quest widget, mouse/keyboard focus restoration, overlay, individual reward claim, immediate widget update, close.";
|
||||
}
|
||||
|
||||
private IEnumerator CampaignScenario(CombatManager combat, CombatSceneController view)
|
||||
{
|
||||
var run = combat.GetComponent<RunManager>();
|
||||
@@ -537,14 +657,30 @@ namespace KernelPanic.Run
|
||||
_stage = "campaign wave " + run.CurrentWaveNumber;
|
||||
if (combat.AwaitingWaveContinue)
|
||||
{
|
||||
Require(document.rootVisualElement.Q("RunRouteChoices") == null, "Shop must not contain route choices.");
|
||||
Submit(document.rootVisualElement.Q<Button>("BootNextWaveButton"));
|
||||
Require(combat.AwaitingWaveContinue && document.rootVisualElement.Q("RouteSelectionScreen") != null,
|
||||
"Boot must open route selection before starting combat.");
|
||||
if (run.BuildRewardPending)
|
||||
{
|
||||
var rewardCapture = CapturePanel(document, "build-reward-" + run.WavesCleared);
|
||||
while (rewardCapture.MoveNext()) yield return rewardCapture.Current;
|
||||
int bitsBefore = run.Bits;
|
||||
Submit(document.rootVisualElement.Q<Button>("RewardBits"));
|
||||
Require(!run.BuildRewardPending && run.Bits == bitsBefore + RunManager.BuildRewardBits,
|
||||
"Build reward button must pay once and permit departure.");
|
||||
Require(!run.ClaimBuildReward(null, CardUpgradeKind.MagnitudeUp, true), "Build reward cannot pay twice.");
|
||||
}
|
||||
Submit(document.rootVisualElement.Q<Button>("BackToRepositoryButton"));
|
||||
foreach (var offer in run.RepositoryOffers.Where(offer => !offer.Sold)
|
||||
.OrderByDescending(offer => offer.Kind == RepositoryOfferKind.StatUpgrade && offer.StatUpgradeKind == RunStatUpgradeKind.Heal
|
||||
&& combat.PlayerState.CurrentUptime < combat.PlayerState.MaxUptime / 2 ? 100
|
||||
: offer.Kind == RepositoryOfferKind.CardUpgrade && offer.CardUpgradeKind == CardUpgradeKind.DrawRider ? 90
|
||||
: offer.Kind == RepositoryOfferKind.CardUpgrade ? 80 : 10).ToArray())
|
||||
if (offer.Price <= run.Bits) run.BuyOffer(offer, combat.PlayerState);
|
||||
Submit(document.rootVisualElement.Q<Button>("BootNextWaveButton"));
|
||||
Submit(document.rootVisualElement.Q<Button>("RouteRepair"));
|
||||
combat.ContinueToNextWave();
|
||||
Submit(document.rootVisualElement.Q<Button>("ConfirmRouteButton"));
|
||||
}
|
||||
else if (combat.CanSurrenderRun)
|
||||
{
|
||||
@@ -582,6 +718,7 @@ namespace KernelPanic.Run
|
||||
}
|
||||
Require(!combat.RunLost && run.WavesCleared == 5 && capturedBoss, "Seeded campaign bot did not clear the boss.");
|
||||
_stage = "campaign milestone";
|
||||
Submit(document.rootVisualElement.Q<Button>("BootNextWaveButton"));
|
||||
var milestone = CapturePanel(document, "campaign-milestone");
|
||||
while (milestone.MoveNext()) yield return milestone.Current;
|
||||
int expectedBandwidth = run.AccruedBandwidth + TutorialCampaign.BandwidthReward;
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace KernelPanic.Run
|
||||
public ResolvedRunCheckpoint Resolve(DistroDatabase distros, CardDatabase cards,
|
||||
LanguageDeckDatabase languages, PackageDatabase packageDatabase)
|
||||
{
|
||||
Require(version == 1 || version == 2, "This checkpoint needs a different game version.");
|
||||
Require(version >= 1 && version <= 3, "This checkpoint needs a different game version.");
|
||||
Require(version < 2 || journey != null, "Missing saved route decisions.");
|
||||
journey?.Validate(wave);
|
||||
Require(Guid.TryParseExact(runId, "N", out _), "Invalid run identity.");
|
||||
|
||||
@@ -16,13 +16,22 @@ namespace KernelPanic.Run
|
||||
public WaveRoute selectedRoute;
|
||||
public WaveRoute activeRoute;
|
||||
public string lastReward;
|
||||
public int encounterRevision;
|
||||
public int pendingRewardWave;
|
||||
public int claimedRewardWave;
|
||||
|
||||
public bool AtMilestone(int wavesCleared) => campaign && !endless && wavesCleared >= BossWave;
|
||||
public static RunJourney NewCampaign() => new() { campaign = true };
|
||||
public static RunJourney NewCampaign() => new() { campaign = true, encounterRevision = 1 };
|
||||
public RunJourney Copy() => (RunJourney)MemberwiseClone();
|
||||
|
||||
public void Validate(int wave)
|
||||
{
|
||||
RunCheckpoint.Require(encounterRevision >= 0 && encounterRevision <= 1, "Unsupported encounter revision.");
|
||||
RunCheckpoint.Require((pendingRewardWave == 0 || pendingRewardWave == 2 || pendingRewardWave == 4)
|
||||
&& (claimedRewardWave == 0 || claimedRewardWave == 2 || claimedRewardWave == 4)
|
||||
&& claimedRewardWave < wave
|
||||
&& (pendingRewardWave == 0 || (campaign && encounterRevision == 1
|
||||
&& pendingRewardWave == wave - 1 && pendingRewardWave > claimedRewardWave)), "Invalid saved reward choice.");
|
||||
RunCheckpoint.Require(Enum.IsDefined(typeof(WaveRoute), selectedRoute)
|
||||
&& Enum.IsDefined(typeof(WaveRoute), activeRoute), "Invalid saved route.");
|
||||
RunCheckpoint.Require(!endless || (campaign && wave > BossWave), "Invalid endless-mode checkpoint.");
|
||||
|
||||
@@ -57,6 +57,26 @@ namespace KernelPanic.Run
|
||||
public bool IsSuspended { get; private set; }
|
||||
public RunJourney Journey { get; private set; } = new();
|
||||
public bool CampaignChoicePending => Journey.AtMilestone(_wavesCleared);
|
||||
public bool BuildRewardPending => Journey.pendingRewardWave > 0;
|
||||
public const int BuildRewardBits = 8;
|
||||
|
||||
public bool ClaimBuildReward(CardInstance card, CardUpgradeKind kind, bool takeBits = false)
|
||||
{
|
||||
if (!isRunActive || IsSuspended || !_repositoryVisitActive || !BuildRewardPending) return false;
|
||||
if (!takeBits && (card?.Definition == null || !_runDeck.Contains(card)
|
||||
|| card.Definition.IsToken || card.Definition.IsJunk
|
||||
|| (kind != CardUpgradeKind.MagnitudeUp && kind != CardUpgradeKind.DrawRider)
|
||||
|| (kind == CardUpgradeKind.DrawRider && card.DrawRider > 0))) return false;
|
||||
if (!takeBits && !ApplyCardUpgrade(card, kind)) return false;
|
||||
if (takeBits) _bits += BuildRewardBits;
|
||||
Journey.claimedRewardWave = Journey.pendingRewardWave;
|
||||
Journey.pendingRewardWave = 0;
|
||||
Journey.lastReward = takeBits ? $"Build reward: +{BuildRewardBits} Bits."
|
||||
: $"Build reward: {card.Definition.DisplayName} gained " +
|
||||
(kind == CardUpgradeKind.DrawRider ? "+1 draw on resolution." : $"+{CombatTuning.UpgradeMagnitudeBonus} effect magnitude.");
|
||||
RepositoryChanged?.Invoke();
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool SelectRoute(WaveRoute route)
|
||||
{
|
||||
@@ -78,7 +98,7 @@ namespace KernelPanic.Run
|
||||
// Called exactly once by the guarded combat transition, never by UI callbacks.
|
||||
public void PrepareNextEncounter(CombatantState player)
|
||||
{
|
||||
if (!_repositoryVisitActive || !isRunActive || IsSuspended || CampaignChoicePending) return;
|
||||
if (!_repositoryVisitActive || !isRunActive || IsSuspended || CampaignChoicePending || BuildRewardPending) return;
|
||||
Journey.activeRoute = Journey.selectedRoute;
|
||||
if (Journey.campaign && Journey.activeRoute == WaveRoute.Repair && player != null)
|
||||
player.CurrentUptime = Mathf.Min(player.MaxUptime, player.CurrentUptime + RunJourney.RepairUptime);
|
||||
@@ -150,7 +170,7 @@ namespace KernelPanic.Run
|
||||
bandwidth = _accruedBandwidth, entropy = _accruedEntropy,
|
||||
maxUptimeBonus = _maxUptimeBonus, maxCyclesBonus = _maxCyclesBonus, ramBonus = _ramBonus,
|
||||
rerolls = _rerollsThisVisit, shopRandomDraws = _repositoryRandom.Draws,
|
||||
version = 2, journey = Journey.Copy(),
|
||||
version = 3, journey = Journey.Copy(),
|
||||
combat = combat.CaptureBoundaryState()
|
||||
};
|
||||
foreach (PackageInstance package in CurrentConfig.EquippedPackages)
|
||||
@@ -387,6 +407,8 @@ namespace KernelPanic.Run
|
||||
}
|
||||
}
|
||||
Journey.selectedRoute = WaveRoute.Repair;
|
||||
if (Journey.campaign && Journey.encounterRevision > 0 && (clearedWave == 2 || clearedWave == 4))
|
||||
Journey.pendingRewardWave = clearedWave;
|
||||
_wavesCleared = Mathf.Max(_wavesCleared, clearedWave);
|
||||
if (CurrentConfig?.IsTutorial != true)
|
||||
{
|
||||
|
||||
@@ -8,11 +8,11 @@ namespace KernelPanic.Run
|
||||
{
|
||||
public static class TutorialCampaign
|
||||
{
|
||||
public const int LessonCount = 2;
|
||||
public const int LessonCount = 3;
|
||||
public const int BandwidthReward = 1000;
|
||||
public const int EntropyReward = GachaService.StandardTenPullCost * GachaService.EntropyPerCommit;
|
||||
public static bool Required(SaveData save) => save != null && save.starterChosen && save.tutorialRequired;
|
||||
public static int Lesson(SaveData save) => save?.tutorialCheckpoint != null ? 2 : 1;
|
||||
public static int Lesson(SaveData save) => save?.tutorialCheckpoint?.wave ?? 1;
|
||||
|
||||
public static void Enroll(SaveData save, string distroId)
|
||||
{
|
||||
@@ -23,8 +23,8 @@ namespace KernelPanic.Run
|
||||
// Commit balances and the claimed flag together. Re-enrollment never grants a second payout.
|
||||
public static void Complete(SaveData save)
|
||||
{
|
||||
if (!Required(save) || save.tutorialLesson != 2)
|
||||
throw new InvalidOperationException("Complete both training waves before claiming the reward.");
|
||||
if (!Required(save) || save.tutorialLesson != LessonCount)
|
||||
throw new InvalidOperationException("Complete all three training waves before claiming the reward.");
|
||||
if (!save.tutorialRewardClaimed)
|
||||
{
|
||||
save.bandwidthBalance = checked(Math.Max(0, save.bandwidthBalance) + BandwidthReward);
|
||||
@@ -37,7 +37,8 @@ namespace KernelPanic.Run
|
||||
public static EncounterPlan Plan(int wave) => wave switch
|
||||
{
|
||||
1 => new("Targeting and revival", "", 0, "zombie_process", "orphan_process"),
|
||||
2 => new("Queue, stack and finish", "", 0, "memory_leak", "firewalld"),
|
||||
2 => new("Queue and stack", "", 0, "memory_leak", "firewalld"),
|
||||
3 => new("Countdown and miniboss", "", 0, "cron_job", "daemon"),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(wave))
|
||||
};
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace KernelPanic.Run
|
||||
public CardInstance Card { get; private set; }
|
||||
public EnemyInstance Enemy { get; private set; }
|
||||
public bool CanEndTurn => !Active || Step.Action == TutorialAction.EndTurn;
|
||||
private ResolutionTrack ExpectedTrack => _lesson == 1 ? ResolutionTrack.Native
|
||||
private ResolutionTrack ExpectedTrack => _lesson != 2 ? ResolutionTrack.Native
|
||||
: Step?.Id.Contains("haskell") == true ? ResolutionTrack.LazyStack : ResolutionTrack.InterpreterQueue;
|
||||
|
||||
public TutorialGuide(int lesson) { _lesson = lesson; _steps = Build(lesson); }
|
||||
@@ -68,6 +68,8 @@ namespace KernelPanic.Run
|
||||
if (Step.Id == "target-zombie" && Enemy?.PendingRevive == true) Advance(combat);
|
||||
else if (Step.Id == "finish-zombie" && Enemy?.HasRevived == true && Enemy.State.IsDefeated) Advance(combat);
|
||||
}
|
||||
else if (_lesson == 3)
|
||||
{ if (_resolved && Enemy?.IntentRevealed == true) Advance(combat); }
|
||||
else if (_played && (Queued(combat) || _resolved)) Advance(combat);
|
||||
break;
|
||||
case TutorialAction.PlayShield:
|
||||
@@ -101,10 +103,12 @@ namespace KernelPanic.Run
|
||||
{
|
||||
if (!Active) return;
|
||||
if (Enemy == null)
|
||||
Enemy = combat.Enemies.FirstOrDefault(enemy => _lesson != 1 || enemy.ArchetypeId == "zombie_process");
|
||||
Enemy = combat.Enemies.FirstOrDefault(enemy => _lesson == 1 ? enemy.ArchetypeId == "zombie_process"
|
||||
: _lesson == 3 ? enemy.ArchetypeId == "daemon" : true);
|
||||
if (Card != null || combat.HandController == null) return;
|
||||
string id = _lesson == 1 ? Step.Id is "shield-card" or "shield-result" ? "lang_rs_borrow"
|
||||
: Index >= 13 ? "lang_rs_fn_main" : "lang_rs_unwrap" : null;
|
||||
: Index >= 13 ? "lang_rs_fn_main" : "lang_rs_unwrap"
|
||||
: _lesson == 3 ? Step.Action == TutorialAction.PlayShield ? "lang_rs_borrow" : "lang_rs_fn_main" : null;
|
||||
Card = combat.HandController.Cards.FirstOrDefault(card => !card.IsBroken && !card.IsLocked
|
||||
&& (id != null ? card.Definition.Id == id : card.Definition.ResolutionTrack == ExpectedTrack)
|
||||
&& combat.GetDisplayedPlayCost(card) <= combat.PlayerState.Cycles);
|
||||
@@ -112,39 +116,53 @@ namespace KernelPanic.Run
|
||||
|
||||
public static IReadOnlyList<TutorialStep> Build(int lesson)
|
||||
{
|
||||
if (lesson == 3) return new[] {
|
||||
new TutorialStep("cron", "Cron Job / scheduled damage", "Countdown 2 means two enemy turns before its heavy attack is ready. Use that time to prepare.", "enemy:cron_job"),
|
||||
new TutorialStep("daemon", "Miniboss / Daemon", "Surge: 8-10 damage. Harden: 6-8 Shield. Bypass: 3-4 through Shield. Hit it to reveal which action is coming.", "enemy:daemon"),
|
||||
new TutorialStep("select-reveal", "Expose the miniboss", "Select fn main(). This Native attack deals damage immediately.", "card", TutorialAction.SelectCard),
|
||||
new TutorialStep("target-daemon", "Hit the Daemon", "Click the Daemon to reveal what it plans to do.", "enemy", TutorialAction.TargetEnemy),
|
||||
new TutorialStep("revealed-daemon", "Exposed for this round", "Shield stops Surge, not Bypass. Harden deals no damage. Its next action will be hidden again; hit it each round to reveal.", "enemy:daemon"),
|
||||
new TutorialStep("countdown-turn", "Watch the timer", "End turn. Daemon carries out its revealed action; Cron Job counts down.", "TutorialEndTurn", TutorialAction.EndTurn),
|
||||
new TutorialStep("cron-ticking", "One turn left", "Cron Job shows countdown 1. Daemon has hidden its new action again.", "enemy:cron_job"),
|
||||
new TutorialStep("countdown-ready", "Let the timer expire", "End turn once more. Watch Cron Job's countdown become an attack intent.", "TutorialEndTurn", TutorialAction.EndTurn),
|
||||
new TutorialStep("cron-armed", "Heavy attack ready", "Cron Job will hit on the next End turn. Defeat it first, or prepare Shield for the displayed damage.", "enemy:cron_job"),
|
||||
new TutorialStep("shield-cron", "Prepare a defense", "Play borrow() to help absorb Cron Job's hit. Remember: Daemon's Bypass ignores Shield.", "card", TutorialAction.PlayShield),
|
||||
new TutorialStep("practice", "Clear the final wave", "Finish both enemies. Cron Job resets to countdown 2 after attacking. Clear this wave to claim your training rewards.", "enemies")
|
||||
};
|
||||
if (lesson < 1 || lesson > TutorialCampaign.LessonCount) throw new ArgumentOutOfRangeException(nameof(lesson));
|
||||
if (lesson == 1) return new[] {
|
||||
new TutorialStep("uptime", "This is your Uptime", "Uptime is your health. At 0, a normal run ends. This practice uses loan cards, full health and no distro passive procs; your collection is safe.", "TutorialUptime"),
|
||||
new TutorialStep("shield", "Shield protects Uptime", "Shield absorbs ordinary incoming damage first. This number shows how much protection you currently have.", "TutorialShield"),
|
||||
new TutorialStep("cycles", "Cycles pay for cards", "This is your remaining card budget. The cost in a card's upper-right corner is paid when you play it. Cycles refresh each round.", "TutorialCycles"),
|
||||
new TutorialStep("ram", "RAM is hand capacity", "This shows used RAM / capacity. Most cards use 1 RAM; Java uses 2. More Cycles do not let extra cards fit in a full hand.", "TutorialRam"),
|
||||
new TutorialStep("attack-card", "Read your attack card", "unwrap() costs Cycles and deals damage immediately: it is Native. Its rules and current estimate are printed here. Rust overkill can also grant Shield.", "card"),
|
||||
new TutorialStep("intent", "Read the enemy's intent", "This is what Zombie Process plans to do when enemies act. Check the attack range before ending your turn.", "zombie-intent"),
|
||||
new TutorialStep("select-attack", "1 / Select the attack", "Click the highlighted unwrap() card first. Selecting a targeted card asks for an enemy; it does not spend Cycles yet.", "card", TutorialAction.SelectCard),
|
||||
new TutorialStep("target-zombie", "2 / Choose the zombie", "Now click Zombie Process to dispatch your selected card. Other targets and End turn are locked for this demonstration.", "zombie", TutorialAction.TargetEnemy),
|
||||
new TutorialStep("pending-revival", "Zero Uptime, but not gone", "Your attack reduced the zombie to 0. RESTART PENDING means it will revive next round. A fresh zombie can do this once; finishing it from 30% Uptime or less reaps it instead.", "zombie"),
|
||||
new TutorialStep("end-turn", "3 / End your turn", "Click End turn (or press E). The remaining enemy acts, then the next round begins and the zombie revives. Watch its Uptime.", "TutorialEndTurn", TutorialAction.EndTurn),
|
||||
new TutorialStep("revived", "The zombie has respawned", "It has returned at half Uptime. RESTART USED means it cannot revive again. Your Cycles also refreshed for this round.", "zombie"),
|
||||
new TutorialStep("shield-card", "4 / Add protection", "Click borrow() to gain Shield now. It needs no enemy target. Any Shield you already have from Rust overkill is kept.", "card", TutorialAction.PlayShield),
|
||||
new TutorialStep("shield-result", "Your Shield increased", "That card added protection to this number. Shield is not healing: it absorbs damage before your Uptime is reduced.", "TutorialShield"),
|
||||
new TutorialStep("select-finisher", "5 / Select a finisher", "Select the highlighted fn main() card. Then you will choose the revived zombie as its target.", "card", TutorialAction.SelectCard),
|
||||
new TutorialStep("finish-zombie", "6 / Finish the revived zombie", "Click the zombie again. Its revival is already spent, so this attack can terminate it permanently.", "zombie", TutorialAction.TargetEnemy),
|
||||
new TutorialStep("piles", "Track your cards", "Played cards go to discard; an empty draw pile reshuffles discard. Exhausted cards stay out for this wave. These counters open pile inspectors.", "TutorialPiles"),
|
||||
new TutorialStep("practice", "Finish the encounter", "You have practiced targeting, revival and Shield. Clear the remaining orphan processes on your own. Use card → enemy, and End turn when needed. A zombie can leave an orphan when permanently defeated.", "enemies")
|
||||
new TutorialStep("uptime", "This is your Uptime", "Uptime is your health. At 0, the run ends. These loan cards keep your collection safe.", "TutorialUptime"),
|
||||
new TutorialStep("shield", "Shield protects Uptime", "Shield absorbs ordinary damage before Uptime. This number is your current protection.", "TutorialShield"),
|
||||
new TutorialStep("cycles", "Cycles pay for cards", "Cycles pay card costs. Your budget refreshes each round.", "TutorialCycles"),
|
||||
new TutorialStep("ram", "RAM is hand capacity", "Used RAM / capacity. Most cards use 1 RAM; Java uses 2. Free RAM lets you hold more cards.", "TutorialRam"),
|
||||
new TutorialStep("attack-card", "Read your attack card", "unwrap() deals damage immediately: it is Native. Read its cost and effect here.", "card"),
|
||||
new TutorialStep("intent", "Read the enemy's intent", "This is Zombie Process's next action. Check the attack range before ending your turn.", "zombie-intent"),
|
||||
new TutorialStep("select-attack", "1 / Select the attack", "Click unwrap(). Selecting a targeted card does not spend Cycles yet.", "card", TutorialAction.SelectCard),
|
||||
new TutorialStep("target-zombie", "2 / Choose the zombie", "Click Zombie Process to dispatch your selected attack.", "zombie", TutorialAction.TargetEnemy),
|
||||
new TutorialStep("pending-revival", "Zero Uptime, but not gone", "RESTART PENDING: this zombie will revive once. A killing hit from 30% Uptime or less prevents revival.", "zombie"),
|
||||
new TutorialStep("end-turn", "3 / End your turn", "Press End turn (or E). Watch the zombie return when the next round begins.", "TutorialEndTurn", TutorialAction.EndTurn),
|
||||
new TutorialStep("revived", "The zombie has respawned", "RESTART USED: it returned at half Uptime and cannot revive again. Your Cycles have refreshed.", "zombie"),
|
||||
new TutorialStep("shield-card", "4 / Add protection", "Click borrow() to gain Shield. No target needed; existing Shield is kept.", "card", TutorialAction.PlayShield),
|
||||
new TutorialStep("shield-result", "Your Shield increased", "Your Shield increased. It absorbs damage, but does not heal Uptime.", "TutorialShield"),
|
||||
new TutorialStep("select-finisher", "5 / Select a finisher", "Select fn main(), then choose the revived zombie.", "card", TutorialAction.SelectCard),
|
||||
new TutorialStep("finish-zombie", "6 / Finish the revived zombie", "Click the zombie. Its revival is spent, so this hit can terminate it permanently.", "zombie", TutorialAction.TargetEnemy),
|
||||
new TutorialStep("piles", "Track your cards", "Played cards go to discard; an empty draw pile reshuffles it. Exhausted cards stay out for this wave.", "TutorialPiles"),
|
||||
new TutorialStep("practice", "Finish the encounter", "Finish the orphan processes. Use card → enemy, then End turn as needed. A defeated zombie can leave an orphan.", "enemies")
|
||||
};
|
||||
return new[] {
|
||||
new TutorialStep("leak", "A new threat: Memory Leak", "This enemy grows stronger each round and applies damage-over-time stacks. Your health and purchased upgrade carried over from wave one.", "enemy:memory_leak"),
|
||||
new TutorialStep("firewall", "A protector: firewalld", "firewalld shields itself and adjacent processes. Read its intent before choosing which enemy to remove first.", "enemy:firewalld"),
|
||||
new TutorialStep("queue-intro", "Python uses the queue", "Python waits until End turn. Its cards resolve oldest first (FIFO). Let's put a real card into this queue.", "TutorialQueue"),
|
||||
new TutorialStep("select-python", "Select the Python card", "Click the highlighted Python card. print() chooses its target when it resolves, so it does not ask you to click an enemy.", "card", TutorialAction.SelectCard),
|
||||
new TutorialStep("leak", "A new threat: Memory Leak", "Memory Leak grows stronger each round and applies damage over time. Your purchased patch carried over.", "enemy:memory_leak"),
|
||||
new TutorialStep("firewall", "A protector: firewalld", "firewalld shields itself and its neighbors. Check its intent before choosing a target.", "enemy:firewalld"),
|
||||
new TutorialStep("queue-intro", "Python uses the queue", "Python waits until End turn. Oldest queued card resolves first (FIFO).", "TutorialQueue"),
|
||||
new TutorialStep("select-python", "Select the Python card", "Click print(). It chooses a target when it resolves, so no enemy click is needed.", "card", TutorialAction.SelectCard),
|
||||
new TutorialStep("target-python", "Select a target", "Click the highlighted enemy to complete this play.", "enemy", TutorialAction.TargetEnemy),
|
||||
new TutorialStep("queued-python", "Python is waiting here", "Your card is now queued, not resolved. With multiple entries, the oldest would execute first.", "TutorialQueue"),
|
||||
new TutorialStep("stack-intro", "Haskell uses the stack", "Haskell waits until after Python and resolves newest first (LIFO). Each entry captures a multiplier for damage and explicit Shield.", "TutorialStack"),
|
||||
new TutorialStep("select-haskell", "Select the Haskell card", "Click the highlighted thunk() card, then select the highlighted enemy.", "card", TutorialAction.SelectCard),
|
||||
new TutorialStep("target-haskell", "Choose its target", "Click this enemy. The attack will wait on the stack rather than dealing damage immediately.", "enemy", TutorialAction.TargetEnemy),
|
||||
new TutorialStep("queued-haskell", "Both tracks are ready", "Python will resolve first, then Haskell, then surviving enemies. A defeated target can cause deferred damage to retarget.", "TutorialStack"),
|
||||
new TutorialStep("end-round", "Run the queued actions", "Click End turn (or press E). Watch the queue resolve before the stack. We will continue when the exchange finishes.", "TutorialEndTurn", TutorialAction.EndTurn),
|
||||
new TutorialStep("resolved", "The waiting cards resolved", "The scheduler has executed the deferred cards. Check enemy Uptime, Shield and intents before choosing your next move.", "enemies"),
|
||||
new TutorialStep("practice", "Clear wave two", "Finish every remaining enemy on your own. Clearing this wave completes training and unlocks 1,000 Bandwidth plus 1,000 Entropy: enough for a standard 10-pull.", "enemies")
|
||||
new TutorialStep("queued-python", "Python is waiting here", "The card is queued, not resolved. With multiple entries, the oldest executes first.", "TutorialQueue"),
|
||||
new TutorialStep("stack-intro", "Haskell uses the stack", "Haskell resolves after Python, newest first (LIFO). Its entry multiplier scales damage and Shield.", "TutorialStack"),
|
||||
new TutorialStep("select-haskell", "Select the Haskell card", "Click thunk(), then choose the highlighted enemy.", "card", TutorialAction.SelectCard),
|
||||
new TutorialStep("target-haskell", "Choose its target", "Click this enemy. Your attack will wait on the stack.", "enemy", TutorialAction.TargetEnemy),
|
||||
new TutorialStep("queued-haskell", "Both tracks are ready", "Order: Python queue → Haskell stack → surviving enemies. Deferred attacks can retarget defeated enemies.", "TutorialStack"),
|
||||
new TutorialStep("end-round", "Run the queued actions", "Press End turn (or E). Watch Python resolve before Haskell.", "TutorialEndTurn", TutorialAction.EndTurn),
|
||||
new TutorialStep("resolved", "The waiting cards resolved", "The waiting cards resolved. Check enemy Uptime, Shield and intents.", "enemies"),
|
||||
new TutorialStep("practice", "Clear wave two", "Finish the remaining enemies. Next: Cron Job's countdown and a Daemon miniboss.", "enemies")
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user