Add NixOS and Go
This commit is contained in:
@@ -78,3 +78,19 @@ MonoBehaviour:
|
||||
- {fileID: 11400000, guid: b821fa56a5034b9bbd3a000000000012, type: 2}
|
||||
- {fileID: 11400000, guid: c48296d194f842df821d924c23000001, type: 2}
|
||||
- {fileID: 11400000, guid: c48296d194f842df821d924c23000002, type: 2}
|
||||
- {fileID: 11400000, guid: 0429ceda41be4c8fb66a7b32b2a9f4af, type: 2}
|
||||
- {fileID: 11400000, guid: ee0a8100d13b4b9b83d886693d2382a4, type: 2}
|
||||
- {fileID: 11400000, guid: 80750fabd5a64788941008ab5a971846, type: 2}
|
||||
- {fileID: 11400000, guid: 9d5da88a689a452e80f6de49b759d370, type: 2}
|
||||
- {fileID: 11400000, guid: b28c0877ca3a4268a1dd023bc42f9b0d, type: 2}
|
||||
- {fileID: 11400000, guid: bf1b32d165dd4fd0bc6017ff88ba5890, type: 2}
|
||||
- {fileID: 11400000, guid: 984681d5cc5645589ce7410b8a1d6860, type: 2}
|
||||
- {fileID: 11400000, guid: c7ede13bb76f47029fe0f6239f8e8693, type: 2}
|
||||
- {fileID: 11400000, guid: 12fc6cb24d1e458fa1886036d2b84e18, type: 2}
|
||||
- {fileID: 11400000, guid: ce99c4defa4a45fcab5cb02f37ffeb39, type: 2}
|
||||
- {fileID: 11400000, guid: 31487390188b44009fdad0a0d357d00b, type: 2}
|
||||
- {fileID: 11400000, guid: 5147423071924e7db56f6458b0ad61af, type: 2}
|
||||
- {fileID: 11400000, guid: 1783855769134679ab72822a1c4e6fc7, type: 2}
|
||||
- {fileID: 11400000, guid: 5c42b3d2cf7e42e893addeaed3350169, type: 2}
|
||||
- {fileID: 11400000, guid: 6468a18a5d8a40989614b753646d9ab3, type: 2}
|
||||
- {fileID: 11400000, guid: 672eb2e5a5ea48f5913e169400d2abe3, type: 2}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a7d10000000000000000000000000001, type: 3}
|
||||
m_Name: GoDeck
|
||||
m_EditorClassIdentifier:
|
||||
language: 9
|
||||
entries:
|
||||
- card: {fileID: 11400000, guid: bf1b32d165dd4fd0bc6017ff88ba5890, type: 2}
|
||||
count: 2
|
||||
- card: {fileID: 11400000, guid: 984681d5cc5645589ce7410b8a1d6860, type: 2}
|
||||
count: 1
|
||||
- card: {fileID: 11400000, guid: c7ede13bb76f47029fe0f6239f8e8693, type: 2}
|
||||
count: 1
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 295ea82e590f4338aa7a8e30c2132f68
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b821fa56a5034b9bbd3a000000000007
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b821fa56a5034b9bbd3a000000000006
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b821fa56a5034b9bbd3a000000000008
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -19,3 +19,4 @@ MonoBehaviour:
|
||||
- {fileID: 11400000, guid: a7d70000000000000000000000000002, type: 2}
|
||||
- {fileID: 11400000, guid: aa130000000000000000000000000001, type: 2}
|
||||
- {fileID: 11400000, guid: b821fa56a5034b9bbd3a000000000103, type: 2}
|
||||
- {fileID: 11400000, guid: 295ea82e590f4338aa7a8e30c2132f68, type: 2}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34b8afda4d2d4a06b79f2a1dd42d49d0
|
||||
folderAsset: yes
|
||||
+8
-7
@@ -10,20 +10,21 @@ MonoBehaviour:
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5178747fac4dbfc448ff15d8a687e03c, type: 3}
|
||||
m_Name: HaskellMap
|
||||
m_Name: nixos_flake_update
|
||||
m_EditorClassIdentifier:
|
||||
id: lang_hs_map
|
||||
displayName: "map"
|
||||
description: "Deal 2 damage."
|
||||
flavorText:
|
||||
id: "nixos_flake_update"
|
||||
displayName: "nix flake update"
|
||||
description: "Deal 3 damage."
|
||||
flavorText: ""
|
||||
language: 6
|
||||
rarity: 0
|
||||
cycleCost: 0
|
||||
resolutionTrack: 2
|
||||
distroExclusive: 0
|
||||
distroExclusive: 1
|
||||
isToken: 0
|
||||
isJunk: 0
|
||||
isRunOnly: 0
|
||||
designNotes: "Deal 2 damage."
|
||||
designNotes: "Go durations are fixed; magnitude never extends lifetime."
|
||||
requiresSystem: []
|
||||
upgradeTarget: {fileID: 0}
|
||||
effects: []
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80750fabd5a64788941008ab5a971846
|
||||
@@ -0,0 +1,30 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5178747fac4dbfc448ff15d8a687e03c, type: 3}
|
||||
m_Name: nixos_nix_shell
|
||||
m_EditorClassIdentifier:
|
||||
id: "nixos_nix_shell"
|
||||
displayName: "nix-shell"
|
||||
description: "Deploy 2 damage per tick for 3 ticks, starting next round."
|
||||
flavorText: ""
|
||||
language: 9
|
||||
rarity: 0
|
||||
cycleCost: 1
|
||||
resolutionTrack: 3
|
||||
distroExclusive: 1
|
||||
isToken: 0
|
||||
isJunk: 0
|
||||
isRunOnly: 0
|
||||
designNotes: "Go durations are fixed; magnitude never extends lifetime."
|
||||
requiresSystem: []
|
||||
upgradeTarget: {fileID: 0}
|
||||
effects: []
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee0a8100d13b4b9b83d886693d2382a4
|
||||
+8
-7
@@ -10,20 +10,21 @@ MonoBehaviour:
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5178747fac4dbfc448ff15d8a687e03c, type: 3}
|
||||
m_Name: HaskellThunk
|
||||
m_Name: nixos_rebuild_switch_card
|
||||
m_EditorClassIdentifier:
|
||||
id: lang_hs_thunk
|
||||
displayName: "thunk"
|
||||
description: "Deal 4 damage."
|
||||
flavorText:
|
||||
id: "nixos_rebuild_switch_card"
|
||||
displayName: "nixos-rebuild switch"
|
||||
description: "Gain 4 Shield. Draw 1. Does not switch governor."
|
||||
flavorText: ""
|
||||
language: 6
|
||||
rarity: 0
|
||||
cycleCost: 1
|
||||
resolutionTrack: 2
|
||||
distroExclusive: 0
|
||||
distroExclusive: 1
|
||||
isToken: 0
|
||||
isJunk: 0
|
||||
isRunOnly: 0
|
||||
designNotes: "Deal 4 damage."
|
||||
designNotes: "Go durations are fixed; magnitude never extends lifetime."
|
||||
requiresSystem: []
|
||||
upgradeTarget: {fileID: 0}
|
||||
effects: []
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0429ceda41be4c8fb66a7b32b2a9f4af
|
||||
@@ -0,0 +1,30 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5178747fac4dbfc448ff15d8a687e03c, type: 3}
|
||||
m_Name: nixos_rollback
|
||||
m_EditorClassIdentifier:
|
||||
id: "nixos_rollback"
|
||||
displayName: "rollback"
|
||||
description: "Restore 4 Uptime. Extend one selected goroutine by 1 tick if possible."
|
||||
flavorText: ""
|
||||
language: 9
|
||||
rarity: 1
|
||||
cycleCost: 1
|
||||
resolutionTrack: 0
|
||||
distroExclusive: 1
|
||||
isToken: 0
|
||||
isJunk: 0
|
||||
isRunOnly: 0
|
||||
designNotes: "Go durations are fixed; magnitude never extends lifetime."
|
||||
requiresSystem: []
|
||||
upgradeTarget: {fileID: 0}
|
||||
effects: []
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b28c0877ca3a4268a1dd023bc42f9b0d
|
||||
+9
-8
@@ -10,20 +10,21 @@ MonoBehaviour:
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5178747fac4dbfc448ff15d8a687e03c, type: 3}
|
||||
m_Name: HaskellFoldr
|
||||
m_Name: nixos_store_gc
|
||||
m_EditorClassIdentifier:
|
||||
id: lang_hs_foldr
|
||||
displayName: "foldr"
|
||||
description: "Gain 3 Shield. Draw 1 card."
|
||||
flavorText:
|
||||
id: "nixos_store_gc"
|
||||
displayName: "nix-store --gc"
|
||||
description: "Gain 5 Shield. Draw 1."
|
||||
flavorText: ""
|
||||
language: 6
|
||||
rarity: 0
|
||||
rarity: 1
|
||||
cycleCost: 1
|
||||
resolutionTrack: 2
|
||||
distroExclusive: 0
|
||||
distroExclusive: 1
|
||||
isToken: 0
|
||||
isJunk: 0
|
||||
isRunOnly: 0
|
||||
designNotes: "Gain 3 Shield. Draw 1 card."
|
||||
designNotes: "Go durations are fixed; magnitude never extends lifetime."
|
||||
requiresSystem: []
|
||||
upgradeTarget: {fileID: 0}
|
||||
effects: []
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d5da88a689a452e80f6de49b759d370
|
||||
@@ -0,0 +1,11 @@
|
||||
\\ \\ //
|
||||
\\ \\ //
|
||||
=======\\==\\=//
|
||||
// \\ \\ //
|
||||
// \\ \\ //
|
||||
//========\\==\\=//
|
||||
// \\ // //
|
||||
// \\ // //
|
||||
\\=//==//=======
|
||||
// //
|
||||
// //
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 461d8381113c4e68873cc61938e6cd57
|
||||
@@ -18,3 +18,4 @@ MonoBehaviour:
|
||||
- {fileID: 11400000, guid: 366e71361387449abcfaa1a50c9af87b, type: 2}
|
||||
- {fileID: 11400000, guid: aa101000000000000000000000000001, type: 2}
|
||||
- {fileID: 11400000, guid: b821fa56a5034b9bbd3a000000000101, type: 2}
|
||||
- {fileID: 11400000, guid: 443f930bf2e448bc863a6b462a2d60fd, type: 2}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bd550368fd0c75d43a53aa4fb3b6541e, type: 3}
|
||||
m_Name: NixOS
|
||||
m_EditorClassIdentifier:
|
||||
id: nixos
|
||||
displayName: NixOS
|
||||
primaryLanguage: 6
|
||||
secondaryLanguage: 9
|
||||
passive: {fileID: 11400000, guid: b7fb0d7714cd44af9554d3fe8df88081, type: 2}
|
||||
description: "The entire system is reproducible. Your mistakes included."
|
||||
playstyleSummary: "Switch CPU governors tactically. Stage Haskell effects or maintain Go goroutines; apply the right policy at resolution."
|
||||
languageBlurbs:
|
||||
- lang: 6
|
||||
blurb: "Snapshot stack depth, then switch governor before the effects resolve."
|
||||
- lang: 9
|
||||
blurb: "Persistent goroutines read your active governor on every tick."
|
||||
asciiArt: {fileID: 4900000, guid: 461d8381113c4e68873cc61938e6cd57, type: 3}
|
||||
accentColor: {r: 0.49, g: 0.78, b: 0.96, a: 1}
|
||||
baseUptime: 60
|
||||
baseRam: 6
|
||||
baseCyclesPerTurn: 3
|
||||
exclusiveCards:
|
||||
- {fileID: 11400000, guid: 0429ceda41be4c8fb66a7b32b2a9f4af, type: 2}
|
||||
- {fileID: 11400000, guid: ee0a8100d13b4b9b83d886693d2382a4, type: 2}
|
||||
- {fileID: 11400000, guid: 80750fabd5a64788941008ab5a971846, type: 2}
|
||||
- {fileID: 11400000, guid: 9d5da88a689a452e80f6de49b759d370, type: 2}
|
||||
- {fileID: 11400000, guid: b28c0877ca3a4268a1dd023bc42f9b0d, type: 2}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 443f930bf2e448bc863a6b462a2d60fd
|
||||
@@ -0,0 +1,19 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9b1f51fb7c354203a2f93ad22fbeb101, type: 3}
|
||||
m_Name: NixRebuildSwitch
|
||||
m_EditorClassIdentifier:
|
||||
id: nixos_rebuild_switch
|
||||
displayName: nixos-rebuild switch
|
||||
rulesText: "Once per turn, pay 1 Cycle to switch governor. performance: +20% card damage, -25% card Shield. powersave: -20% card damage, +30% card Shield. schedutil: +5% both. Start each wave in schedutil. Live modifiers apply when effects resolve."
|
||||
flavorText: "The entire system is reproducible. Your mistakes included."
|
||||
designNotes: "CPU governor names are used as gameplay metaphors. V2-V5 upgrades are cumulative."
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7fb0d7714cd44af9554d3fe8df88081
|
||||
@@ -507,6 +507,13 @@ namespace KernelPanic.Editor
|
||||
return false;
|
||||
}
|
||||
if (!_combat.CanSurrenderRun) return false;
|
||||
if (_combat.PendingGoroutineCard != null)
|
||||
{
|
||||
var work = _combat.Go.Active.FirstOrDefault(g => _combat.IsEligibleGoSelection(g, _combat.PendingGoroutineCard));
|
||||
if (work != null) _combat.SelectGoroutine(work.Id);
|
||||
else _combat.CancelGoroutineSelection();
|
||||
Progress(); return false;
|
||||
}
|
||||
int targetIndex = FindTarget();
|
||||
if (targetIndex >= 0) _combat.SelectEnemy(targetIndex);
|
||||
CardInstance chosen = null;
|
||||
@@ -515,6 +522,7 @@ namespace KernelPanic.Editor
|
||||
foreach (var card in _combat.HandController.Cards)
|
||||
{
|
||||
if (card.Definition == null || card.Definition.IsToken || card.IsBroken || card.IsLocked
|
||||
|| _combat.GoPlayBlockReason(card) != null
|
||||
|| _combat.GetDisplayedPlayCost(card) > _combat.PlayerState.Cycles) continue;
|
||||
var preview = CardPreviewService.Build(_combat, card, target);
|
||||
double damage = (preview.MinimumDamage + (double)preview.MaximumDamage) / 2;
|
||||
@@ -524,6 +532,7 @@ namespace KernelPanic.Editor
|
||||
chosen = card;
|
||||
}
|
||||
if (chosen != null && _combat.CardsPlayedThisRound < 64 && _combat.PlayCard(chosen)) { Progress(); return false; }
|
||||
if (_combat.PendingGoroutineCard != null) { Progress(); return false; }
|
||||
if (_report.options.prefetch && _combat.CardsPlayedThisRound < 64 && _combat.TryPrefetch())
|
||||
{
|
||||
_current.prefetches++;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class BalanceComparisonTests
|
||||
var languages = AssetDatabase.LoadAssetAtPath<LanguageDeckDatabase>("Assets/Data/Cards/Languages/LanguageDeckDatabase.asset");
|
||||
var packages = AssetDatabase.LoadAssetAtPath<PackageDatabase>("Assets/Data/Packages/PackageDatabase.asset");
|
||||
var scenarios = BalanceComparison.CreateScenarios(distros);
|
||||
Assert.That(scenarios.Count, Is.EqualTo(56));
|
||||
Assert.That(scenarios.Count, Is.EqualTo(62));
|
||||
Assert.That(scenarios.Select(s => s.Label).Distinct().Count(), Is.EqualTo(scenarios.Count));
|
||||
foreach (var scenario in scenarios)
|
||||
{
|
||||
@@ -104,7 +104,7 @@ public class BalanceComparisonTests
|
||||
Assert.That(shortRun.packageLevels, Is.EqualTo(new[] { 5 }));
|
||||
Assert.That(shortRun.shoppingPolicies, Is.EqualTo(new[] { false }));
|
||||
var distros = AssetDatabase.LoadAssetAtPath<DistroDatabase>("Assets/Data/Distros/DistroDatabase.asset");
|
||||
Assert.That(BalanceComparison.CreateScenarios(distros, shortRun).Count, Is.EqualTo(18));
|
||||
Assert.That(BalanceComparison.CreateScenarios(distros, shortRun).Count, Is.EqualTo(20));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -494,6 +494,18 @@
|
||||
.kernel-ui .package-readiness-state { font-size: var(--type-meta); color: var(--kp-cyan); white-space: normal; }
|
||||
.kernel-ui .package-activation { font-size: var(--type-meta); color: var(--kp-success); white-space: normal; min-height: 18px; }
|
||||
.kernel-ui .software-live-preview { margin-top: 8px; padding-top: 6px; border-top-width: 1px; border-top-color: var(--kp-border-subtle); color: var(--kp-cyan); font-size: var(--type-meta); white-space: normal; flex-shrink: 0; }
|
||||
.kernel-ui .software-live-crit { margin-top: 2px; color: var(--kp-muted); font-size: var(--type-meta); white-space: normal; flex-shrink: 0; }
|
||||
.distro-nixos { --kp-distro: #7dc7f5; }
|
||||
.kernel-ui .nix-governor-panel { margin-top: 8px; border-top-width: 1px; border-top-color: var(--kp-border-subtle); padding-top: 6px; flex-shrink: 0; }
|
||||
.kernel-ui .nix-heading, .kernel-ui .go-heading { color: var(--kp-cyan); font-size: var(--type-meta); white-space: normal; }
|
||||
.kernel-ui .nix-governor-choice { background-color: transparent; border-width: 0 0 0 2px; border-left-color: transparent; margin: 1px 0; padding: 3px 5px; min-height: 34px; font-size: var(--type-meta); white-space: normal; -unity-text-align: middle-left; flex-shrink: 0; }
|
||||
.kernel-ui .nix-governor-active { border-left-color: var(--kp-cyan); color: var(--kp-cyan); background-color: var(--kp-panel); opacity: 1; }
|
||||
.kernel-ui .nix-switch-cost { font-size: var(--type-meta); white-space: normal; margin-top: 4px; }
|
||||
.kernel-ui .nix-governor-shortcut { background-color: transparent; border-width: 0; margin: 0 0 4px; padding: 2px 0; color: var(--kp-cyan); font-size: var(--type-meta); white-space: normal; -unity-text-align: middle-left; flex-shrink: 0; }
|
||||
.kernel-ui .goroutine-scheduler { width: 100%; flex-shrink: 0; border-bottom-width: 1px; border-bottom-color: var(--kp-border-subtle); padding: 4px 0; }
|
||||
.kernel-ui .goroutine-rows { max-height: 124px; min-width: 0; }
|
||||
.kernel-ui .goroutine-row { white-space: normal; -unity-text-align: middle-left; font-size: var(--type-meta); margin: 2px 0; padding: 4px 6px; min-height: 34px; flex-shrink: 0; background-color: var(--kp-panel); border-width: 0 0 0 2px; border-left-color: var(--kp-cyan); }
|
||||
.kernel-ui .goroutine-running, .kernel-ui .goroutine-selected { border-left-color: var(--kp-amber); color: var(--kp-amber); }
|
||||
.kernel-ui .software-card {
|
||||
--software-ink: var(--kp-muted);
|
||||
width: 252px; min-height: 210px; flex-shrink: 0;
|
||||
@@ -528,6 +540,26 @@
|
||||
.kernel-ui .software-rarity-rare .software-rarity { color: var(--kp-cyan); }
|
||||
.kernel-ui .software-rarity-epic .software-rarity { color: var(--kp-lang-haskell); }
|
||||
.kernel-ui .software-rarity-legendary .software-rarity { color: var(--kp-amber); }
|
||||
/* Python manifests: distinguish the operation, its effect and its follow-up rules. */
|
||||
/* Extra reading width belongs to the hand; embedded previews fit their parent. */
|
||||
.kernel-ui .hand-row .software-python { width: 292px; }
|
||||
.kernel-ui .software-python .software-header { padding: 8px 12px 2px; flex-shrink: 0; }
|
||||
.kernel-ui .software-python .software-language { -unity-font-style: bold; }
|
||||
.kernel-ui .software-python .software-cost { font-size: var(--type-section); padding: 2px 6px; background-color: var(--kp-bg-deep); }
|
||||
.kernel-ui .software-python .software-name { padding-bottom: 6px; flex-shrink: 0; }
|
||||
.kernel-ui .software-python-metadata { flex-direction: row; flex-wrap: wrap; align-items: center; margin: 0 12px; padding-bottom: 6px; border-bottom-width: 1px; border-bottom-color: var(--kp-border); flex-shrink: 0; }
|
||||
.kernel-ui .software-python-role { color: var(--kp-bg-deep); background-color: var(--kp-lang-python); font-size: var(--type-meta); -unity-font-style: bold; padding: 2px 6px; margin: 0 8px 4px 0; flex-shrink: 0; white-space: nowrap; }
|
||||
.kernel-ui .software-python-automation .software-python-role { background-color: var(--kp-amber); }
|
||||
.kernel-ui .software-python-modifier .software-python-role { background-color: var(--kp-lang-haskell); }
|
||||
.kernel-ui .software-python-preparation .software-python-role { background-color: var(--kp-success); }
|
||||
.kernel-ui .software-python-metadata .software-track { margin: 0 0 4px; padding: 0; border-bottom-width: 0; white-space: nowrap; flex-shrink: 0; }
|
||||
.kernel-ui .software-python .software-body { padding: 8px 12px 10px; flex-shrink: 0; }
|
||||
.kernel-ui .software-python .software-effect { font-size: var(--type-body); -unity-font-style: bold; margin: 0; flex-shrink: 0; }
|
||||
.kernel-ui .software-python-rule { margin-top: 10px; padding-left: 8px; border-left-width: 2px; border-left-color: var(--kp-border); flex-shrink: 0; }
|
||||
.kernel-ui .software-python .software-conditions { color: var(--kp-text); font-size: var(--type-body); margin: 0 2px 0 0; flex-shrink: 0; }
|
||||
.kernel-ui .software-python .software-live-preview { font-size: var(--type-body); -unity-font-style: bold; margin: 8px 0 0; padding: 6px 8px; background-color: var(--kp-bg-deep); border-width: 0 0 0 2px; border-left-color: var(--kp-lang-python); }
|
||||
.kernel-ui .software-python .software-footer { border-top-width: 1px; border-top-color: var(--kp-border-subtle); margin: 0 12px; padding: 6px 0 8px; flex-wrap: wrap; flex-shrink: 0; }
|
||||
.kernel-ui .software-python .software-state { white-space: normal; margin-right: 8px; flex-grow: 1; flex-shrink: 0; }
|
||||
.kernel-ui .hand-card:hover,
|
||||
.kernel-ui .hand-card:focus { background-color: var(--kp-hover); border-color: var(--software-ink); }
|
||||
.kernel-ui .hand-card-selected { background-color: var(--kp-action-hover); border-color: var(--kp-amber); }
|
||||
@@ -645,7 +677,7 @@
|
||||
.kernel-ui .repository-description { font-size: var(--type-body); margin-bottom: 14px; }
|
||||
.kernel-ui .repository-stat-content { flex-grow: 1; justify-content: flex-start; }
|
||||
.kernel-ui .repository-card-preview,
|
||||
.kernel-ui .repository-upgrade-card { width: 100%; min-height: 0; height: auto; }
|
||||
.kernel-ui .repository-upgrade-card { width: 100%; min-width: 0; min-height: 0; height: auto; margin: 0; }
|
||||
.kernel-ui .repository-card-preview .software-body,
|
||||
.kernel-ui .repository-upgrade-card .software-body { min-height: 100px; }
|
||||
.kernel-ui .repository-name,
|
||||
@@ -828,6 +860,7 @@
|
||||
.kernel-ui .combat-journal .unity-foldout__text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.kernel-ui .peek-card { min-height: 0; }
|
||||
.kernel-ui .peek-card .software-language,
|
||||
.kernel-ui .peek-card .software-python-metadata,
|
||||
.kernel-ui .peek-card .software-track,
|
||||
.kernel-ui .peek-card .software-body,
|
||||
.kernel-ui .peek-card .software-footer { display: none; }
|
||||
@@ -864,9 +897,12 @@
|
||||
.kernel-ui .scheduler-idle .track-header { width: auto; padding-right: 12px; }
|
||||
.kernel-ui .scheduler-idle .track-scroll { flex-shrink: 1; }
|
||||
.kernel-ui.narrow .scheduler .track-zone { width: 100%; flex-direction: row; }
|
||||
.kernel-ui.narrow .scheduler .track-zone-stack { flex-direction: column; align-items: stretch; }
|
||||
.kernel-ui.narrow .scheduler .track-zone-stack .track-header { width: 100%; }
|
||||
.kernel-ui.narrow .scheduler .track-zone-stack .track-scroll { width: 100%; }
|
||||
.kernel-ui.narrow .scheduler .track-zone-stack,
|
||||
.kernel-ui.narrow .scheduler .track-zone-queue { flex-direction: column; align-items: stretch; }
|
||||
.kernel-ui.narrow .scheduler .track-zone-stack .track-header,
|
||||
.kernel-ui.narrow .scheduler .track-zone-queue .track-header { width: 100%; }
|
||||
.kernel-ui.narrow .scheduler .track-zone-stack .track-scroll,
|
||||
.kernel-ui.narrow .scheduler .track-zone-queue .track-scroll { width: 100%; }
|
||||
.kernel-ui.short-screen .scheduler .track-zone-token .track-scroll { max-height: 48px; }
|
||||
.kernel-ui .scheduler .stack-contents .card-chip-name { flex-shrink: 1; min-width: 0; }
|
||||
.kernel-ui .process-restarting { border-bottom-color: var(--kp-lang-haskell); }
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace KernelPanic.Combat
|
||||
Cleanse, ShuffleToken, UpgradeHandCards, GenerateCard, NoOp, UpdateManager,
|
||||
ShieldRepeatDamage, Timeshift, DnfAutoremove, FirstToPackage, Rawhide,
|
||||
IncomingAttackHalve, ConsultWiki, RandomCommonLanguageCard, MinimalInstall, SizeofDamage,
|
||||
RepairCorruptedCards, AskUbuntu, FixedDraw, Python
|
||||
RepairCorruptedCards, AskUbuntu, FixedDraw, Python, Go
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -60,6 +60,7 @@ namespace KernelPanic.Combat
|
||||
CardEffectKind.Draw => new DrawEffect(Amount),
|
||||
CardEffectKind.FixedDraw => new FixedDrawEffect(Amount),
|
||||
CardEffectKind.Python => new PythonEffect((PythonOperation)SecondaryAmount, Amount),
|
||||
CardEffectKind.Go => new GoEffect((GoOperation)SecondaryAmount, Amount, MaxAmount),
|
||||
CardEffectKind.AskUbuntu => new AskUbuntuEffect(),
|
||||
CardEffectKind.ChanceDamage => new ChanceDamageEffect(Amount, SecondaryAmount, Language),
|
||||
CardEffectKind.PreviousLanguageDamage => new PreviousLanguageDamageEffect(Amount, SecondaryAmount, Language),
|
||||
@@ -269,6 +270,23 @@ namespace KernelPanic.Combat
|
||||
Add("shop_c_valgrind", None, false, "repair up to {amount:0} corrupted cards in your active deck. gain {shield:1} Shield.",
|
||||
Fx(CardEffectKind.RepairCorruptedCards, 3), Shield(6));
|
||||
|
||||
Add("nixos_rebuild_switch_card", None, false, "gain {shield:0} Shield. draw 1. does not switch governor.", Shield(4), Fx(CardEffectKind.FixedDraw, 1));
|
||||
Add("nixos_nix_shell", Single, false, "deploy {amount:0} damage/tick for 3 ticks, starting next round.", Go(GoOperation.Deploy, 2, 3));
|
||||
Add("nixos_flake_update", Single, false, "deal {amount:0}.", Damage(3, Language.Haskell));
|
||||
Add("nixos_store_gc", None, false, "gain {shield:0} Shield. draw 1.", Shield(5), Fx(CardEffectKind.FixedDraw, 1));
|
||||
Add("nixos_rollback", None, false, "restore {amount:0} Uptime. extend a selected goroutine by 1 tick if possible (cap 5).", Go(GoOperation.Rollback, 4));
|
||||
Add("lang_go_worker", Single, false, "deploy {amount:0} damage/tick for 3 ticks, starting next round.", Go(GoOperation.Deploy, 3, 3));
|
||||
Add("lang_go_func", Single, false, "deploy {amount:0} damage/tick for 2 ticks, starting next round.", Go(GoOperation.Deploy, 1, 2));
|
||||
Add("lang_go_context_timeout", None, false, "extend a selected active goroutine by 2 ticks (cap 5).", Go(GoOperation.Extend, 2));
|
||||
Add("shop_go_time_ticker", Single, false, "deploy {amount:0} damage/tick for 3 ticks, starting next round.", Go(GoOperation.Deploy, 2, 3));
|
||||
Add("shop_go_waitgroup", None, false, "gain 3 Shield per active goroutine (base cap 9).", Go(GoOperation.WaitGroup));
|
||||
Add("shop_go_gosched", None, false, "draw 1. if a goroutine is active, gain {shield:0} Shield.", Go(GoOperation.Gosched, 1));
|
||||
Add("shop_go_context_cancel", None, false, "terminate a selected active goroutine. gain {shield:0} Shield.", Go(GoOperation.Cancel, 4));
|
||||
Add("shop_go_build", Single, false, "deal {amount:0} immediately.", Damage(7, Language.Go));
|
||||
Add("shop_go_channel_send", None, false, "extend all active goroutines by 1 tick (cap 5). requires extension capacity.", Go(GoOperation.ExtendAll, 1));
|
||||
Add("shop_go_select", Single, false, "deal 3 damage per active goroutine as one hit (base cap 9).", Go(GoOperation.Select));
|
||||
Add("shop_go_num_goroutines", None, false, "draw 1 per active goroutine (fixed cap 3; limited by free RAM).", Go(GoOperation.NumGoroutines));
|
||||
|
||||
var byId = new Dictionary<string, CardCatalogEntry>(StringComparer.Ordinal);
|
||||
foreach (CardCatalogEntry entry in entries) byId.Add(entry.Id, entry);
|
||||
Entries = entries.AsReadOnly();
|
||||
@@ -284,6 +302,8 @@ namespace KernelPanic.Combat
|
||||
private static CardEffectSpec Damage(int amount, Language language, int max = -1, bool all = false, bool trueDamage = false)
|
||||
=> new(CardEffectKind.Damage, amount, max, language: language, allEnemies: all, trueDamage: trueDamage);
|
||||
private static CardEffectSpec Shield(int amount) => new(CardEffectKind.Shield, amount);
|
||||
private static CardEffectSpec Go(GoOperation operation, int amount = 0, int ticks = 0) =>
|
||||
new(CardEffectKind.Go, amount, ticks, (int)operation, Language.Go);
|
||||
private static CardEffectSpec Draw(int amount) => new(CardEffectKind.Draw, amount);
|
||||
private static CardEffectSpec Py(PythonOperation operation, int amount = 0, bool all = false) =>
|
||||
new(CardEffectKind.Python, amount, secondaryAmount: (int)operation, language: Language.Python, allEnemies: all);
|
||||
|
||||
@@ -9,9 +9,11 @@ namespace KernelPanic.Combat
|
||||
public sealed class CardPreview
|
||||
{
|
||||
public string Summary { get; internal set; } = string.Empty;
|
||||
public string CriticalSummary { get; internal set; } = string.Empty;
|
||||
public string Details { get; internal set; } = string.Empty;
|
||||
public int MinimumDamage { get; internal set; }
|
||||
public int MaximumDamage { get; internal set; }
|
||||
public int NormalMaximumDamage { get; internal set; }
|
||||
public int Shield { get; internal set; }
|
||||
public int Heal { get; internal set; }
|
||||
public int RepairCapacity { get; internal set; }
|
||||
@@ -104,12 +106,13 @@ namespace KernelPanic.Combat
|
||||
}
|
||||
|
||||
int minAcrossTargets = int.MaxValue, maxAcrossTargets = 0;
|
||||
int normalMaxAcrossTargets = 0, criticalMinAcrossTargets = int.MaxValue;
|
||||
int explicitShield = 0, heal = 0, repairCapacity = 0;
|
||||
bool hasShield = false, hasDamage = false, rust = false, critical = false, random = false, trueDamage = false;
|
||||
int hitCount = 0;
|
||||
foreach (var previewTarget in targets)
|
||||
{
|
||||
int targetMin = 0, targetMax = 0;
|
||||
int targetMin = 0, targetMax = 0, targetNormalMax = 0, targetCriticalMin = 0;
|
||||
int targetShield = 0, targetHeal = 0, targetHits = 0, targetRepairCapacity = 0;
|
||||
foreach (var effect in entry.Effects)
|
||||
{
|
||||
@@ -118,6 +121,31 @@ namespace KernelPanic.Combat
|
||||
int repeats = 1;
|
||||
switch (effect.Kind)
|
||||
{
|
||||
case CardEffectKind.Go:
|
||||
var goOperation = (GoOperation)effect.SecondaryAmount;
|
||||
switch (goOperation)
|
||||
{
|
||||
case GoOperation.Deploy:
|
||||
damage = true; low = high = effect.Amount;
|
||||
AddNote(notes, $"Per tick; {effect.MaxAmount} ticks starting next round. Three active slots. Damage uses live modifiers each tick.");
|
||||
break;
|
||||
case GoOperation.Select: damage = true; low = high = 3 * combat.Go.Count; break;
|
||||
case GoOperation.WaitGroup:
|
||||
hasShield = true; targetShield = ScaledShield(Math.Min(9, 3 * combat.Go.Count), sourceFlat, magnitude, lazy, combat); break;
|
||||
case GoOperation.Cancel:
|
||||
if (combat.Go.Count > 0) { hasShield = true; targetShield = ScaledShield(effect.Amount, sourceFlat, magnitude, lazy, combat); }
|
||||
break;
|
||||
case GoOperation.Gosched:
|
||||
if (combat.Go.Count > 0) { hasShield = true; targetShield = ScaledShield(1, sourceFlat, magnitude, lazy, combat); }
|
||||
AddNote(notes, "Draw 1 (fixed), limited by free RAM."); break;
|
||||
case GoOperation.NumGoroutines: AddNote(notes, $"Draw {Math.Min(3, combat.Go.Count)} (fixed), limited by free RAM."); break;
|
||||
case GoOperation.Rollback:
|
||||
if (combat.CanPlayerReceiveCardHeal(card)) targetHeal = Math.Min(source.MaxUptime - source.CurrentUptime, ScaledBase(effect.Amount, sourceFlat, magnitude));
|
||||
break;
|
||||
}
|
||||
AddNote(notes, CardEffectFactory.GetRulesText(card, combat.RunConfig));
|
||||
if (combat.GoPlayBlockReason(card) is string blocked) AddNote(notes, blocked);
|
||||
break;
|
||||
case CardEffectKind.Python:
|
||||
var operation = (PythonOperation)effect.SecondaryAmount;
|
||||
AddNote(notes, CardEffectFactory.GetRulesText(card, combat.RunConfig));
|
||||
@@ -226,7 +254,7 @@ namespace KernelPanic.Combat
|
||||
case CardEffectKind.MinimalInstall:
|
||||
hasShield = true;
|
||||
int exhausted = Math.Min(effect.Amount, HandAfterPlay(combat, card).Count());
|
||||
targetShield = CardScaling.Add(targetShield, CardScaling.Scale(exhausted * effect.SecondaryAmount, lazy, combat.Compilation.ShieldPercent));
|
||||
targetShield = CardScaling.Add(targetShield, CardScaling.Scale(exhausted * effect.SecondaryAmount, lazy, combat.Compilation.ShieldPercent, source.GovernorShieldPercent));
|
||||
AddNote(notes, $"Exhausts {exhausted} cards with the current hand; grants {exhausted * effect.MaxAmount} Cycles. Exhaust package hooks may add benefits.");
|
||||
break;
|
||||
case CardEffectKind.Timeshift:
|
||||
@@ -254,14 +282,20 @@ namespace KernelPanic.Combat
|
||||
var maximum = DamageRequest.PreviewCard(source, previewTarget, high, effect.Language, effect.TrueDamage, effect.CanCrit, lazy, combat.Compilation.DamagePercent);
|
||||
int minHit = combat.DamagePipeline.PreviewIncomingDamage(minimum, false, archStacks, damageMultiplier, cardMultiplier);
|
||||
int maxHit = combat.DamagePipeline.PreviewIncomingDamage(maximum, true, archStacks, damageMultiplier, cardMultiplier);
|
||||
int normalMaxHit = combat.DamagePipeline.PreviewIncomingDamage(maximum, false, archStacks, damageMultiplier, cardMultiplier);
|
||||
int criticalMinHit = combat.DamagePipeline.PreviewIncomingDamage(minimum, true, archStacks, damageMultiplier, cardMultiplier);
|
||||
for (int hit = 0; hit < repeats; hit++)
|
||||
{
|
||||
targetMin = CardScaling.Add(targetMin, minHit);
|
||||
targetMax = CardScaling.Add(targetMax, maxHit);
|
||||
targetNormalMax = CardScaling.Add(targetNormalMax, normalMaxHit);
|
||||
targetCriticalMin = CardScaling.Add(targetCriticalMin, criticalMinHit);
|
||||
}
|
||||
}
|
||||
minAcrossTargets = Math.Min(minAcrossTargets, targetMin);
|
||||
maxAcrossTargets = Math.Max(maxAcrossTargets, targetMax);
|
||||
normalMaxAcrossTargets = Math.Max(normalMaxAcrossTargets, targetNormalMax);
|
||||
criticalMinAcrossTargets = Math.Min(criticalMinAcrossTargets, targetCriticalMin);
|
||||
explicitShield = Math.Max(explicitShield, targetShield);
|
||||
heal = Math.Max(heal, targetHeal);
|
||||
repairCapacity = Math.Max(repairCapacity, targetRepairCapacity);
|
||||
@@ -289,10 +323,11 @@ namespace KernelPanic.Combat
|
||||
notes.Add($"Repair up to {repairCapacity} corrupted {(repairCapacity == 1 ? "card" : "cards")} across your run deck; {combat.CorruptedCardCount} currently corrupted. Repairs prioritize your hand. Repair count scales with card magnitude only.");
|
||||
result.MinimumDamage = hasDamage ? minAcrossTargets : 0;
|
||||
result.MaximumDamage = hasDamage ? maxAcrossTargets : 0;
|
||||
result.NormalMaximumDamage = hasDamage ? normalMaxAcrossTargets : 0;
|
||||
result.HasDamage = hasDamage;
|
||||
if (hasDamage)
|
||||
{
|
||||
notes.Add("Damage is incoming damage before target Shield and remaining Uptime; critical hits are included in the range.");
|
||||
notes.Add("Damage is incoming damage before target Shield and remaining Uptime. Critical damage is shown separately.");
|
||||
if (!hasSelectedTarget && !allEnemies && entry.RequiresSingleTarget)
|
||||
notes.Add("Select a target; the range currently covers living targets.");
|
||||
if (allEnemies) notes.Add("Damage shown per target; defenses can differ between enemies.");
|
||||
@@ -313,13 +348,22 @@ namespace KernelPanic.Combat
|
||||
}
|
||||
}
|
||||
var parts = new List<string>();
|
||||
if (hasDamage) parts.Add($"{Range(result.MinimumDamage, result.MaximumDamage)} damage" + (allEnemies ? "/target" : string.Empty));
|
||||
if (hasDamage)
|
||||
{
|
||||
parts.Add($"{Range(result.MinimumDamage, result.NormalMaximumDamage)} damage" + (allEnemies ? "/target" : string.Empty)
|
||||
+ (card.Definition.ResolutionTrack == ResolutionTrack.Goroutine ? "/tick" : string.Empty)
|
||||
+ (!random && result.MinimumDamage != result.NormalMaximumDamage ? " (varies by target)" : string.Empty));
|
||||
if (critical && (criticalMinAcrossTargets != minAcrossTargets || maxAcrossTargets != normalMaxAcrossTargets))
|
||||
result.CriticalSummary = (hitCount > 1 ? "All hits crit: " : "Crit: ")
|
||||
+ Range(criticalMinAcrossTargets, maxAcrossTargets) + " damage" + (allEnemies ? "/target" : string.Empty);
|
||||
}
|
||||
if (hasShield || result.Shield > 0) parts.Add($"+{result.Shield} Shield");
|
||||
if (heal > 0) parts.Add($"+{heal} Uptime");
|
||||
if (repairCapacity > 0) parts.Add($"repair up to {repairCapacity}");
|
||||
if (parts.Count == 0) parts.Add("Utility · see rules");
|
||||
result.Summary = string.Join(" · ", parts);
|
||||
result.Details = result.Summary + "\n" + string.Join("\n", notes);
|
||||
result.Details = result.Summary + (result.CriticalSummary.Length > 0 ? "\n" + result.CriticalSummary : string.Empty)
|
||||
+ "\n" + string.Join("\n", notes);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -335,7 +379,7 @@ namespace KernelPanic.Combat
|
||||
CardScaling.Add(CardScaling.Add(amount, sourceFlat), magnitude);
|
||||
|
||||
private static int ScaledShield(int amount, int sourceFlat, int magnitude, int lazy, CombatManager combat) =>
|
||||
CardScaling.Scale(ScaledBase(amount, sourceFlat, magnitude), lazy, combat.Compilation.ShieldPercent);
|
||||
CardScaling.Scale(ScaledBase(amount, sourceFlat, magnitude), lazy, combat.Compilation.ShieldPercent, combat.PlayerState.GovernorShieldPercent);
|
||||
|
||||
private static string Range(int minimum, int maximum) => minimum == maximum ? minimum.ToString() : $"{minimum}–{maximum}";
|
||||
|
||||
|
||||
@@ -43,6 +43,6 @@ namespace KernelPanic.Combat
|
||||
public int LazyMultiplierPercent { get; internal set; } = 100;
|
||||
|
||||
public int ScaleExplicitShield(int amount) => CardScaling.Scale(amount,
|
||||
LazyMultiplierPercent, CombatManager?.Compilation.ShieldPercent ?? 100);
|
||||
LazyMultiplierPercent, CombatManager?.Compilation.ShieldPercent ?? 100, Source?.GovernorShieldPercent ?? 100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace KernelPanic.Combat
|
||||
/// <summary>
|
||||
/// Owns the combat turn phase state machine and coordinates combat lifecycle transitions.
|
||||
/// </summary>
|
||||
public sealed class CombatManager : MonoBehaviour
|
||||
public sealed partial class CombatManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private TurnPhase currentPhase = TurnPhase.Boot;
|
||||
|
||||
@@ -141,6 +141,8 @@ namespace KernelPanic.Combat
|
||||
private void Awake()
|
||||
{
|
||||
Python.Bind(this);
|
||||
Go.Terminated -= OnGoroutineTerminated;
|
||||
Go.Terminated += OnGoroutineTerminated;
|
||||
_runManager = GetComponent<RunManager>();
|
||||
_damagePipeline.ResistanceResolver = ResolveDamageResistance;
|
||||
_damagePipeline.PreviewResistanceResolver = ResolveDamageResistance;
|
||||
@@ -267,6 +269,7 @@ namespace KernelPanic.Combat
|
||||
{
|
||||
if (currentPhase == TurnPhase.Execute && !IsCombatPaused && !TutorialReading && TutorialGuide?.CanEndTurn != false)
|
||||
{
|
||||
_pendingGoroutineCard = null; SelectedGoroutine = null;
|
||||
_pendingTargetCard = null;
|
||||
_selectedEnemyIndex = -1;
|
||||
SetPhase(TurnPhase.Interpret);
|
||||
@@ -415,7 +418,11 @@ namespace KernelPanic.Combat
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_pendingGoroutineCard != null && _pendingGoroutineCard != card)
|
||||
{ _pendingGoroutineCard = null; SelectedGoroutine = null; }
|
||||
|
||||
bool fedoraBonus = CanApplyFedoraBonus(card);
|
||||
if (!ValidateGoPlay(card)) return false;
|
||||
int cost = GetEffectiveCardCost(card);
|
||||
if (fedoraBonus)
|
||||
{
|
||||
@@ -513,6 +520,13 @@ namespace KernelPanic.Combat
|
||||
|
||||
switch (track)
|
||||
{
|
||||
case ResolutionTrack.Goroutine:
|
||||
GameEvents.RaiseCardResolving(new CardResolvedEvent(card, track));
|
||||
ExecuteCardEffects(card, ResolveTargets(card));
|
||||
ResolveCardRiders(card);
|
||||
GameEvents.RaiseCardResolved(new CardResolvedEvent(card, track));
|
||||
_selectedEnemyIndex = -1;
|
||||
break;
|
||||
case ResolutionTrack.InterpreterQueue:
|
||||
card.MarkQueued();
|
||||
_interpreterQueue.Enqueue(card);
|
||||
@@ -827,7 +841,8 @@ namespace KernelPanic.Combat
|
||||
IEnumerable<CardInstance>[] groups =
|
||||
{
|
||||
_handController?.Cards, _deckController?.DrawPile, _deckController?.DiscardPile,
|
||||
_deckController?.ExhaustPile, _interpreterQueue?.Cards, _lazyStack?.Cards, _runManager?.RunDeck
|
||||
_deckController?.ExhaustPile, _interpreterQueue?.Cards, _lazyStack?.Cards,
|
||||
Go.Active.Select(work => work.SourceCard), _runManager?.RunDeck
|
||||
};
|
||||
foreach (var group in groups)
|
||||
{
|
||||
@@ -1216,6 +1231,8 @@ namespace KernelPanic.Combat
|
||||
}
|
||||
|
||||
_handController = new HandController(_playerState.Ram);
|
||||
Nix.BeginWave(IsDistro("nixos") ? _runConfig.DistroVersion : 0);
|
||||
ApplyGovernorModifiers();
|
||||
_selectedEnemyIndex = -1;
|
||||
_pendingTargetCard = null;
|
||||
_cardsPlayedThisWave = 0;
|
||||
@@ -1238,7 +1255,8 @@ namespace KernelPanic.Combat
|
||||
}
|
||||
}
|
||||
|
||||
_deckController.Initialize(startingCards);
|
||||
if (_runConfig.IsLanguageTraining) _deckController.InitializeInDrawOrder(startingCards);
|
||||
else _deckController.Initialize(startingCards);
|
||||
_interpreterQueue.Clear();
|
||||
_enemies.Clear();
|
||||
_enemiesPendingExit.Clear();
|
||||
@@ -1305,6 +1323,8 @@ namespace KernelPanic.Combat
|
||||
|
||||
private IEnumerator InterpretQueueSequenced()
|
||||
{
|
||||
yield return TickGoroutinesSequenced();
|
||||
if (CheckWinOrLoss()) yield break;
|
||||
Python.BeginPhase(_turnNumberThisWave);
|
||||
while (VisualResolutionPending && !_runLost && !_awaitingWaveContinue) yield return null;
|
||||
if (CheckWinOrLoss()) yield break;
|
||||
@@ -1393,6 +1413,8 @@ namespace KernelPanic.Combat
|
||||
|
||||
private void ClearDeferredCards()
|
||||
{
|
||||
Go.Clear();
|
||||
_pendingGoroutineCard = null; SelectedGoroutine = null;
|
||||
Python.Clear();
|
||||
foreach (var card in _lazyStack.Cards.Concat(_interpreterQueue.Cards).Distinct())
|
||||
{
|
||||
@@ -1493,6 +1515,7 @@ namespace KernelPanic.Combat
|
||||
{
|
||||
int openingDraw = Mathf.Min(CombatTuning.OpeningHandSize, _handController == null ? _playerState.Ram : _handController.RamCapacity);
|
||||
if (_runConfig?.IsTutorial == true) openingDraw = Mathf.Min(_runManager.RunDeck.Count, _handController.RamCapacity);
|
||||
if (_runConfig?.TrainingLanguage is Language trainingLanguage) openingDraw = LanguageTraining.OpeningDraw(trainingLanguage);
|
||||
yield return DrawCardsToHandSequenced(openingDraw, "opening hand");
|
||||
}
|
||||
|
||||
@@ -2773,6 +2796,14 @@ namespace KernelPanic.Combat
|
||||
|
||||
private void SpawnEncounter()
|
||||
{
|
||||
if (_runConfig?.TrainingLanguage is Language trainingLanguage)
|
||||
{
|
||||
CurrentEncounter = new EncounterPlan("Language practice", "Try the guided combo, then finish the fight.", 0,
|
||||
"orphan_process", "orphan_process");
|
||||
for (int slot = 0; slot < 2; slot++)
|
||||
_enemies.Add(new EnemyInstance(EnemyArchetypeCatalog.Get("orphan_process"), LanguageTraining.TargetUptime(trainingLanguage, slot)));
|
||||
return;
|
||||
}
|
||||
if (_runConfig?.IsTutorial == true || _runManager?.Journey.campaign == true)
|
||||
{
|
||||
CurrentEncounter = _runConfig.IsTutorial ? TutorialCampaign.Plan(_runConfig.TutorialLesson)
|
||||
|
||||
@@ -35,6 +35,8 @@ namespace KernelPanic.Combat
|
||||
public int JavaScriptFlatDamageBonus { get; set; }
|
||||
public int DamageMultiplierPercent { get; set; } = 100;
|
||||
public int CurrentCardDamageMultiplierPercent { get; set; } = 100;
|
||||
public int GovernorDamagePercent { get; set; } = 100;
|
||||
public int GovernorShieldPercent { get; set; } = 100;
|
||||
public int IncomingAttackHalfCharges { get; set; }
|
||||
public int ArchBtwStacks { get; set; }
|
||||
public int ArchBtwDamagePerStack { get; set; } = 1;
|
||||
|
||||
@@ -204,8 +204,8 @@ namespace KernelPanic.Combat
|
||||
|
||||
int multiplier = Mathf.Max(0, sourceMultiplierPercent ?? request.Source?.DamageMultiplierPercent ?? 100);
|
||||
int currentCardMultiplier = Mathf.Max(0, cardMultiplierPercent ?? request.Source?.CurrentCardDamageMultiplierPercent ?? 100);
|
||||
if (request.IsCardDamage && (request.LazyMultiplierPercent != 100 || request.CompilationPercent != 100))
|
||||
return CardScaling.Scale(amount, request.LazyMultiplierPercent, request.CompilationPercent, multiplier, currentCardMultiplier);
|
||||
if (request.IsCardDamage && (request.LazyMultiplierPercent != 100 || request.CompilationPercent != 100 || request.Source?.GovernorDamagePercent != 100))
|
||||
return CardScaling.Scale(amount, request.LazyMultiplierPercent, request.CompilationPercent, multiplier, currentCardMultiplier, request.Source?.GovernorDamagePercent ?? 100);
|
||||
return Mathf.RoundToInt(amount * (multiplier / 100f) * (currentCardMultiplier / 100f));
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,12 @@ namespace KernelPanic.Combat
|
||||
return drawn;
|
||||
}
|
||||
|
||||
public void InitializeInDrawOrder(IEnumerable<CardInstance> cards)
|
||||
{
|
||||
_drawPile.Clear(); _discardPile.Clear(); _exhaustPile.Clear();
|
||||
if (cards != null) _drawPile.AddRange(cards.Where(card => card != null).Reverse());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves the top card into the hand if its RAM cost fits. A blocked card remains on top,
|
||||
/// so callers should stop drawing on failure instead of skipping to cheaper cards.
|
||||
|
||||
@@ -10,7 +10,10 @@ namespace KernelPanic.Combat
|
||||
{
|
||||
var lines = new List<string>();
|
||||
if (combat?.PlayerState == null) return lines;
|
||||
lines.Add("Native cards and Python preparation already executed. End turn runs ready Python automation, then Python FIFO, Haskell LIFO, surviving enemies, and cleanup.");
|
||||
lines.Add("Native cards and Python preparation already executed. End turn runs eligible Go goroutines, ready Python automation, Python FIFO, Haskell LIFO, surviving enemies, and cleanup.");
|
||||
foreach (var work in combat.Go.Active)
|
||||
lines.Add($"GO / PID {work.Id:000} / {work.SourceCard.Definition.DisplayName} / {work.RemainingTicks} ticks remaining / "
|
||||
+ (work.DeploymentRound >= combat.RoundNumber ? "waiting until next round" : "ticks before Python; live damage modifiers apply"));
|
||||
if (combat.Python.AutomationCount > 0 || combat.Python.RepeatCount > 0 || combat.Python.AreaCount > 0)
|
||||
foreach (string script in combat.Python.Readout) lines.Add(script);
|
||||
int order = 0;
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace KernelPanic.Core
|
||||
{
|
||||
Native,
|
||||
InterpreterQueue,
|
||||
LazyStack
|
||||
LazyStack,
|
||||
Goroutine
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace KernelPanic.Data
|
||||
{
|
||||
public static int Stars(DistroDefinition distro) => distro != null &&
|
||||
(string.Equals(distro.Id, "arch", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(distro.Id, "gentoo", StringComparison.OrdinalIgnoreCase)) ? 5 : 4;
|
||||
|| string.Equals(distro.Id, "gentoo", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(distro.Id, "nixos", StringComparison.OrdinalIgnoreCase)) ? 5 : 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace KernelPanic.Data
|
||||
new(Language.Haskell, "Haskell", "lazy proofs", ResolutionTrack.LazyStack, "Lazy proofs. Build a stack of delayed operations. Later cards gain stronger effects when evaluated. Snapshot x1.5 / x1.75 / x2.0 / x2.5 at play; LIFO after Python. Only damage and explicit Shield multiply.", null, Distro("gentoo", "Gentoo"), Distro("nixos", "NixOS")),
|
||||
new(Language.Assembly, "Assembly", "raw opcodes", ResolutionTrack.Native, "Assembly is planned as the most direct Native language: low-level, high-commitment effects that should trade flexibility for extreme precision or shield-bypass pressure.", null, Distro("templeos", "TempleOS")),
|
||||
new(Language.Java, "Java", "warming vm", ResolutionTrack.Native, "Each Java card uses 2 RAM and spills overkill into other enemies. JIT gives -1 Cycle per 2 Java plays, capped at -3. Store at most 6 warmup plays; lose 2 after each wave, cooling the discount by 1.", null, Distro("debian", "Debian"), Distro("fedora", "Fedora")),
|
||||
new(Language.Go, "Go", "small services", ResolutionTrack.Native, "Go is planned as a straightforward Native language for small, dependable actions. Its identity should be simple scaling, services, and concurrency-style utility without much randomness.", null, Distro("cachyos", "CachyOS"), Distro("nixos", "NixOS")),
|
||||
new(Language.Go, "Go", "persistent goroutines", ResolutionTrack.Goroutine, "Deploy up to 3 goroutines. They start ticking next round, before Python, and keep running until their ticks expire. Extend remaining lifetime up to 5 ticks or cancel a process to free its slot. Native Go cards manage active work immediately.", null, Distro("cachyos", "CachyOS"), Distro("nixos", "NixOS")),
|
||||
new(Language.Ruby, "Ruby", "sharp scripts", ResolutionTrack.InterpreterQueue, "Ruby is planned as an interpreter-queue combo language: delayed scripting with expressive effects that should get better when sequenced with other queued cards.", null, Distro("kali", "Kali"), Distro("endeavouros", "EndeavourOS")),
|
||||
new(Language.Php, "PHP", "legacy glue", ResolutionTrack.InterpreterQueue, "PHP is planned as a queued utility language that benefits from messy boards and legacy leftovers: practical, delayed effects that turn clutter into value.", null, Distro("debian", "Debian"), Distro("cachyos", "CachyOS")),
|
||||
};
|
||||
|
||||
@@ -11,7 +11,8 @@ namespace KernelPanic.Meta
|
||||
["fedora"] = new[] { "38", "39", "40", "41", "42" },
|
||||
["mint"] = new[] { "21", "21.2", "21.3", "22", "22.1" },
|
||||
["arch"] = new[] { "2024.01", "2024.06", "2024.12", "2025.06", "2025.12" },
|
||||
["gentoo"] = new[] { "1.0", "1.1", "1.2", "2.0", "2.1" }
|
||||
["gentoo"] = new[] { "1.0", "1.1", "1.2", "2.0", "2.1" },
|
||||
["nixos"] = new[] { "24.05", "24.11", "25.05", "25.11", "26.05" }
|
||||
};
|
||||
|
||||
public static string GetReleaseLabel(string unitId, int version)
|
||||
@@ -30,6 +31,15 @@ namespace KernelPanic.Meta
|
||||
int safeVersion = Math.Max(1, Math.Min(GachaTuning.MaxVersion, version));
|
||||
return (unitId ?? string.Empty).ToLowerInvariant() switch
|
||||
{
|
||||
"nixos" => safeVersion switch
|
||||
{
|
||||
1 => "nixos-rebuild switch: once per turn, pay 1 Cycle to change governor. performance +20% damage / -25% card Shield; powersave -20% damage / +30% card Shield; schedutil +5% both. Reset to schedutil each wave.",
|
||||
2 => "schedutil: +10% card damage and +10% card Shield",
|
||||
3 => "first successful governor change each wave is free",
|
||||
4 => "performance: +30% damage; powersave: +40% card Shield; penalties remain",
|
||||
5 => "specialisation: successful switches grant performance 5 damage, powersave 6 Shield, or schedutil draw 1; no governor scaling",
|
||||
_ => "--"
|
||||
},
|
||||
"gentoo" => safeVersion switch
|
||||
{
|
||||
1 => "emerge --world: start each wave at Compilation 0/4; +1 per completed round. Card damage: -15%, normal, +10%, +20%, +30%",
|
||||
|
||||
@@ -57,6 +57,16 @@ 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"))
|
||||
{
|
||||
var fixture = SaveData.CreateDefault();
|
||||
fixture.starterChosen = true;
|
||||
fixture.tutorialRequired = false;
|
||||
fixture.tutorialRewardClaimed = true;
|
||||
foreach (string id in new[] { "ubuntu", "arch", "gentoo", "fedora", "nixos" })
|
||||
fixture.ownedUnits.Add(new OwnedUnitSaveEntry { id = id, version = id == "nixos" ? 5 : 1 });
|
||||
new SaveService().Save(fixture);
|
||||
}
|
||||
var owner = new GameObject("Player smoke verification");
|
||||
Application.runInBackground = true;
|
||||
DontDestroyOnLoad(owner);
|
||||
@@ -126,6 +136,18 @@ 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-nixos-go-smoke"))
|
||||
{
|
||||
var nixScenario = NixGoScenario(menu);
|
||||
while (nixScenario.MoveNext()) yield return nixScenario.Current;
|
||||
yield break;
|
||||
}
|
||||
if (Environment.GetCommandLineArgs().Contains("--kernel-panic-language-training-smoke"))
|
||||
{
|
||||
var languageScenario = LanguageTrainingScenario(menu);
|
||||
while (languageScenario.MoveNext()) yield return languageScenario.Current;
|
||||
yield break;
|
||||
}
|
||||
if (Environment.GetCommandLineArgs().Contains("--kernel-panic-route-ui-smoke"))
|
||||
{
|
||||
var routeScenario = RouteUiScenario(menu);
|
||||
@@ -440,6 +462,175 @@ namespace KernelPanic.Run
|
||||
"Retry settlement duplicated rewards/history or resurrected the consumed checkpoint.");
|
||||
}
|
||||
|
||||
private IEnumerator NixGoScenario(MainMenuController menu)
|
||||
{
|
||||
_stage = "NixOS collection";
|
||||
Call(menu, "CompleteBootIntro"); Call(menu, "ShowCollection");
|
||||
var nix = Field<DistroDatabase>(menu, "distroDatabase").FindById("nixos");
|
||||
Field<CollectionScreenController>(menu, "collectionScreen").ShowUnitDetail(nix, true);
|
||||
var capture = CapturePanel(menu.GetComponent<UIDocument>(), "nixos-collection");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
RunContext.Set(nix, nix.ExclusiveCards.Take(4).ToArray(), Array.Empty<PackageInstance>(), Language.Haskell, Language.Go, 5, 73129);
|
||||
SceneLoader.LoadGame(menu.GetComponent<UIDocument>().rootVisualElement);
|
||||
CombatManager combat = null;
|
||||
while (combat == null || !combat.CanSurrenderRun) { yield return null; combat = FindFirstObjectByType<CombatManager>(); }
|
||||
var view = FindFirstObjectByType<CombatSceneController>(); var document = view.GetComponent<UIDocument>(); var root = document.rootVisualElement;
|
||||
Require(combat.GetComponent<RunManager>().RunDeck.Count == 12, "NixOS run must start with 12 cards.");
|
||||
Require(combat.Nix.Governor == NixGovernor.Schedutil && combat.Nix.SwitchCost == 0, "V5 starts schedutil with a free first switch.");
|
||||
int cycles = combat.PlayerState.Cycles;
|
||||
Submit(root.Q<Button>("GovernorPerformance"));
|
||||
Require(combat.Nix.Governor == NixGovernor.Performance && combat.PlayerState.Cycles == cycles && combat.CardsPlayedThisRound == 0,
|
||||
"Governor input changed card counters or charged the first switch.");
|
||||
bool deployed = false, ticked = false, extended = false;
|
||||
var observedWork = new System.Collections.Generic.List<Goroutine>();
|
||||
capture = CapturePanel(document, "nixos-governors"); while (capture.MoveNext()) yield return capture.Current;
|
||||
Submit(root.Q<Button>("GovernorShortcut"));
|
||||
capture = CapturePanel(document, "nixos-governor-controls"); while (capture.MoveNext()) yield return capture.Current;
|
||||
int actions = 0;
|
||||
while (!combat.AwaitingWaveContinue && !combat.RunFinished)
|
||||
{
|
||||
_stage = "NixOS combat / round " + combat.RoundNumber;
|
||||
if (!combat.CanSurrenderRun) { yield return null; continue; }
|
||||
foreach (var work in combat.Go.Active) if (!observedWork.Contains(work)) observedWork.Add(work);
|
||||
if (combat.PendingGoroutineCard != null)
|
||||
{
|
||||
var work = combat.Go.Active.First(g => combat.IsEligibleGoSelection(g, combat.PendingGoroutineCard));
|
||||
Submit(root.Q<Button>("Goroutine" + work.Id)); extended = true; yield return null; continue;
|
||||
}
|
||||
if (combat.Go.Count > 0 && !deployed)
|
||||
{
|
||||
deployed = true;
|
||||
capture = CapturePanel(document, "nixos-go-deployed"); while (capture.MoveNext()) yield return capture.Current;
|
||||
Require(root.Q("GoroutineScheduler") != null, "Missing goroutine scheduler.");
|
||||
}
|
||||
if (combat.Go.Active.Any(g => g.LastTickRound > g.DeploymentRound) && !ticked)
|
||||
{
|
||||
ticked = true;
|
||||
capture = CapturePanel(document, "nixos-go-ticked"); while (capture.MoveNext()) yield return capture.Current;
|
||||
}
|
||||
if (combat.Nix.CanSwitch(NixGovernor.Powersave, combat.RoundNumber, combat.PlayerState.Cycles)
|
||||
&& combat.RoundNumber == 2) Submit(root.Q<Button>("GovernorPowersave"));
|
||||
var card = combat.HandController.Cards.Where(c => !c.IsBroken && !c.IsLocked && !c.Definition.IsToken
|
||||
&& combat.GetDisplayedPlayCost(c) <= combat.PlayerState.Cycles && combat.GoPlayBlockReason(c) == null)
|
||||
.OrderByDescending(c => c.Definition.ResolutionTrack == ResolutionTrack.Goroutine ? 3 : GoEffect.OperationFor(c) == GoOperation.Extend ? 2 : 0)
|
||||
.FirstOrDefault();
|
||||
if (card == null || combat.CardsPlayedThisRound >= 16) combat.EndPlayerTurn();
|
||||
else
|
||||
{
|
||||
var face = root.Query<Button>(className: "hand-card").ToList().First(b => b.userData == card);
|
||||
Submit(face);
|
||||
if (combat.PendingTargetCard != null)
|
||||
{
|
||||
var enemy = root.Query<Button>(className: "enemy-card").ToList().First(b => b.enabledInHierarchy
|
||||
&& b.userData is EnemyInstance e && e.State.CurrentUptime > 0 && !e.State.IsDefeated);
|
||||
Submit(enemy);
|
||||
}
|
||||
}
|
||||
Require(++actions < 400, "NixOS fight stalled."); yield return null;
|
||||
}
|
||||
ticked |= observedWork.Any(work => work.LastTickRound > work.DeploymentRound);
|
||||
Require(!combat.RunLost && deployed && ticked, $"NixOS must deploy, tick and win a real fight (lost={combat.RunLost}, deployed={deployed}, ticked={ticked}).");
|
||||
Require(combat.Go.Count == 0, "Wave completion leaked goroutines.");
|
||||
capture = CapturePanel(document, "nixos-wave-complete"); while (capture.MoveNext()) yield return capture.Current;
|
||||
_campaignSuccess = "PASS: NixOS V5 collection, 12-card Haskell/Go run, keyboard/mouse command handlers, free governor switch, real goroutine deployment/ticks, wave victory and cleanup; extension selection=" + extended;
|
||||
}
|
||||
|
||||
private IEnumerator LanguageTrainingScenario(MainMenuController menu)
|
||||
{
|
||||
Call(menu, "CompleteBootIntro");
|
||||
var save = new SaveService();
|
||||
var before = save.Load();
|
||||
foreach (var language in LanguageTraining.Supported)
|
||||
{
|
||||
_stage = "language training / launch " + language;
|
||||
Call(menu, "ShowCollection"); Call(menu, "ShowCollectionLanguages");
|
||||
Field<CollectionScreenController>(menu, "collectionScreen").ShowLanguage(language);
|
||||
Submit(menu.GetComponent<UIDocument>().rootVisualElement.Q<Button>("LearnLanguageButton"));
|
||||
CombatManager combat = null;
|
||||
while (combat == null || !combat.TutorialInputReady)
|
||||
{ yield return null; combat = FindFirstObjectByType<CombatManager>(); }
|
||||
var view = FindFirstObjectByType<CombatSceneController>();
|
||||
var document = view.GetComponent<UIDocument>();
|
||||
var root = document.rootVisualElement;
|
||||
var flow = Field<TutorialFlow>(view, "_tutorial");
|
||||
Require(combat.RunConfig.TrainingLanguage == language, "Collection launched the wrong lesson.");
|
||||
int actions = 0;
|
||||
while (!combat.AwaitingWaveContinue && !combat.RunLost)
|
||||
{
|
||||
if (!combat.TutorialInputReady) { yield return null; continue; }
|
||||
if (flow.Guide.Active)
|
||||
{
|
||||
var step = flow.Guide.Step;
|
||||
_stage = language + " / " + step.Id;
|
||||
if (step.Id == "welcome" || step.Id == "queued" || step.Id == "discount" || step.Id == "snapshot")
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(0.4f);
|
||||
var capture = CapturePanel(document, "training-" + language + "-" + step.Id);
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
}
|
||||
if (flow.Reading) Submit(root.Q<Button>("TutorialNext"));
|
||||
else if (step.Action == TutorialAction.SelectCard)
|
||||
{
|
||||
var button = root.Query<Button>(className: "hand-card").ToList().FirstOrDefault(b => b.userData == flow.Guide.Card);
|
||||
Require(button != null && button.enabledInHierarchy, "Guided card unavailable: " + _stage);
|
||||
Submit(button);
|
||||
}
|
||||
else if (step.Action == TutorialAction.TargetEnemy)
|
||||
Submit(root.Query<Button>(className: "enemy-card").ToList().First(b => b.userData == flow.Guide.Enemy));
|
||||
else if (step.Action == TutorialAction.EndTurn) Submit(root.Q<Button>("TutorialEndTurn"));
|
||||
}
|
||||
else if (combat.CanSurrenderRun)
|
||||
{
|
||||
_stage = language + " / free practice";
|
||||
if (combat.PendingGoroutineCard != null)
|
||||
{
|
||||
var work = combat.Go.Active.FirstOrDefault(g => combat.IsEligibleGoSelection(g, combat.PendingGoroutineCard));
|
||||
if (work != null) combat.SelectGoroutine(work.Id);
|
||||
else combat.CancelGoroutineSelection();
|
||||
yield return null; continue;
|
||||
}
|
||||
int target = Enumerable.Range(0, combat.Enemies.Count).FirstOrDefault(i => !combat.Enemies[i].State.IsDefeated);
|
||||
combat.SelectEnemy(target);
|
||||
var card = combat.HandController.Cards.Where(c => !c.IsBroken && !c.IsLocked && combat.GetDisplayedPlayCost(c) <= combat.PlayerState.Cycles)
|
||||
.OrderByDescending(c => CardPreviewService.Build(combat, c).MinimumDamage).FirstOrDefault();
|
||||
if (card == null || combat.CardsPlayedThisRound >= 16 || !combat.PlayCard(card) && combat.PendingGoroutineCard == null) combat.EndPlayerTurn();
|
||||
}
|
||||
Require(++actions < 350, "Training stalled: " + _stage);
|
||||
yield return null;
|
||||
}
|
||||
Require(!combat.RunLost, "Practice deck did not finish: " + language);
|
||||
for (int frame = 0; frame < 8; frame++) yield return null;
|
||||
Require(root.Q("LanguageTrainingResult") != null && root.Q("TutorialContinue") == null, "Training must end without a repository or reward claim.");
|
||||
if (language == Language.Java)
|
||||
{
|
||||
Submit(root.Q<Button>("RetryLanguageTraining"));
|
||||
while (!combat.TutorialInputReady) yield return null;
|
||||
Require(flow.Guide.Step?.Id == "welcome" && combat.RoundNumber == 1
|
||||
&& combat.HandController.Cards.Count == LanguageTraining.OpeningDraw(language),
|
||||
"Retry did not reset the practice fight and guide.");
|
||||
Submit(root.Q<Button>("ExitLanguageTraining"));
|
||||
}
|
||||
else Submit(root.Q<Button>("ReturnToLanguages"));
|
||||
menu = null;
|
||||
while (menu == null) { yield return null; menu = FindFirstObjectByType<MainMenuController>(); }
|
||||
Require(Field<CollectionScreenController>(menu, "collectionScreen").CurrentTitle == "$ ls ~/collection/languages", "Return did not restore the language tab.");
|
||||
var after = save.Load();
|
||||
Require(after.bandwidthBalance == before.bandwidthBalance && after.entropyBalance == before.entropyBalance
|
||||
&& after.recentRuns.Count == before.recentRuns.Count && after.activeRun == null
|
||||
&& after.tutorialRewardClaimed == before.tutorialRewardClaimed && !after.tutorialRequired,
|
||||
"Optional training changed campaign rewards or onboarding state.");
|
||||
}
|
||||
// Launch once more and exercise early exit from the first read step.
|
||||
Field<CollectionScreenController>(menu, "collectionScreen").ShowLanguage(Language.Python);
|
||||
Submit(menu.GetComponent<UIDocument>().rootVisualElement.Q<Button>("LearnLanguageButton"));
|
||||
CombatSceneController exitView = null;
|
||||
while (exitView == null || exitView.GetComponent<UIDocument>().rootVisualElement.Q<Button>("ExitLanguageTraining") == null)
|
||||
{ yield return null; exitView = FindFirstObjectByType<CombatSceneController>(); }
|
||||
Submit(exitView.GetComponent<UIDocument>().rootVisualElement.Q<Button>("ExitLanguageTraining"));
|
||||
while (FindFirstObjectByType<MainMenuController>() == null) yield return null;
|
||||
_campaignSuccess = "PASS: all playable language lessons launched from collection, guided real card plays, completed fights, returned to languages; retry, early exit and unchanged progression.";
|
||||
}
|
||||
|
||||
private IEnumerator TutorialScenario()
|
||||
{
|
||||
var save = new SaveService();
|
||||
|
||||
@@ -49,7 +49,9 @@ namespace KernelPanic.Run
|
||||
public int RunSeed { get; }
|
||||
public int DistroVersion { get; }
|
||||
public int TutorialLesson { get; internal set; }
|
||||
public bool IsTutorial => TutorialLesson > 0;
|
||||
public Language? TrainingLanguage { get; internal set; }
|
||||
public bool IsLanguageTraining => TrainingLanguage.HasValue;
|
||||
public bool IsTutorial => TutorialLesson > 0 || IsLanguageTraining;
|
||||
|
||||
public static RunConfig ForTutorial(DistroDefinition distro, IReadOnlyList<CardDefinition> deck, int lesson)
|
||||
=> new RunConfig(distro, Language.Python, Language.Haskell, deck, 94100 + lesson, 1) { TutorialLesson = lesson };
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace KernelPanic.Run
|
||||
private static PendingRun _pendingRun;
|
||||
private static ResolvedRunCheckpoint _pendingResume;
|
||||
private static RunConfig _pendingTutorial;
|
||||
private static Language? _returnLanguage;
|
||||
|
||||
public static bool HasPendingRun => _pendingRun != null || _pendingResume != null || _pendingTutorial != null;
|
||||
public static int? LastRunSeed { get; private set; }
|
||||
@@ -26,6 +27,16 @@ namespace KernelPanic.Run
|
||||
_pendingResume = null;
|
||||
LastRunSeed = null;
|
||||
_pendingTutorial = null;
|
||||
_returnLanguage = null;
|
||||
}
|
||||
|
||||
public static void ReturnToLanguage(Language language) => _returnLanguage = language;
|
||||
public static bool TryTakeLanguageReturn(out Language language)
|
||||
{
|
||||
language = _returnLanguage.GetValueOrDefault();
|
||||
bool returning = _returnLanguage.HasValue;
|
||||
_returnLanguage = null;
|
||||
return returning;
|
||||
}
|
||||
|
||||
public static void Set(DistroDefinition distro, IReadOnlyList<CardDefinition> equippedCards, Language primaryLanguage, Language secondaryLanguage)
|
||||
|
||||
@@ -251,6 +251,7 @@ 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 snapshot = new()
|
||||
@@ -407,18 +408,21 @@ namespace KernelPanic.Run
|
||||
|
||||
public int EffectiveMaxUptime()
|
||||
{
|
||||
if (CurrentConfig?.IsLanguageTraining == true) return 60;
|
||||
if (CurrentConfig?.IsTutorial == true) return Mathf.Max(60, CurrentConfig.Distro.BaseUptime) + _maxUptimeBonus;
|
||||
return Mathf.Max(1, (CurrentConfig?.Distro?.BaseUptime ?? 1) + _maxUptimeBonus + _packageMaxUptimeBonus);
|
||||
}
|
||||
|
||||
public int EffectiveRam()
|
||||
{
|
||||
if (CurrentConfig?.IsLanguageTraining == true) return 12;
|
||||
if (CurrentConfig?.IsTutorial == true) return Mathf.Max(6, CurrentConfig.Distro.BaseRam) + _ramBonus;
|
||||
return Mathf.Max(1, (CurrentConfig?.Distro?.BaseRam ?? 1) + _ramBonus + _packageRamBonus);
|
||||
}
|
||||
|
||||
public int EffectiveMaxCycles()
|
||||
{
|
||||
if (CurrentConfig?.IsLanguageTraining == true) return 6;
|
||||
if (CurrentConfig?.IsTutorial == true) return Mathf.Max(4, CurrentConfig.Distro.BaseCyclesPerTurn) + _maxCyclesBonus;
|
||||
return Mathf.Max(1, (CurrentConfig?.Distro?.BaseCyclesPerTurn ?? 1) + _maxCyclesBonus + _packageMaxCyclesBonus);
|
||||
}
|
||||
@@ -570,7 +574,7 @@ namespace KernelPanic.Run
|
||||
for (int i = 0; i < config.StartingDeck.Count; i++)
|
||||
{
|
||||
CardDefinition definition = config.StartingDeck[i];
|
||||
if (definition != null && !definition.IsRunOnly)
|
||||
if (definition != null && (!definition.IsRunOnly || config.IsLanguageTraining))
|
||||
{
|
||||
_runDeck.Add(new CardInstance(definition));
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ namespace KernelPanic.Run
|
||||
{
|
||||
public readonly string Id, Title, Copy, Anchor;
|
||||
public readonly TutorialAction Action;
|
||||
public string CardId { get; internal set; }
|
||||
public int TargetSlot { get; internal set; }
|
||||
public TutorialStep(string id, string title, string copy, string anchor, TutorialAction action = TutorialAction.Read)
|
||||
{ Id = id; Title = title; Copy = copy; Anchor = anchor; Action = action; }
|
||||
}
|
||||
@@ -20,6 +22,7 @@ namespace KernelPanic.Run
|
||||
public sealed class TutorialGuide
|
||||
{
|
||||
private readonly int _lesson;
|
||||
private readonly Language? _language;
|
||||
private readonly IReadOnlyList<TutorialStep> _steps;
|
||||
private bool _played, _resolved, _ended;
|
||||
public int Index { get; private set; }
|
||||
@@ -30,10 +33,12 @@ 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 != 2 ? ResolutionTrack.Native
|
||||
private ResolutionTrack ExpectedTrack => _language.HasValue ? Card?.Definition.ResolutionTrack ?? ResolutionTrack.Native
|
||||
: _lesson != 2 ? ResolutionTrack.Native
|
||||
: Step?.Id.Contains("haskell") == true ? ResolutionTrack.LazyStack : ResolutionTrack.InterpreterQueue;
|
||||
|
||||
public TutorialGuide(int lesson) { _lesson = lesson; _steps = Build(lesson); }
|
||||
public TutorialGuide(Language language) { _language = language; _steps = LanguageTraining.BuildSteps(language); }
|
||||
|
||||
public bool AllowsCard(CardInstance card) => !Active || !Reading && ReferenceEquals(card, Card)
|
||||
&& Step.Action is TutorialAction.SelectCard or TutorialAction.TargetEnemy or TutorialAction.PlayShield;
|
||||
@@ -102,6 +107,15 @@ namespace KernelPanic.Run
|
||||
private void PickReferences(CombatManager combat)
|
||||
{
|
||||
if (!Active) return;
|
||||
if (_language.HasValue)
|
||||
{
|
||||
Enemy = combat.Enemies.ElementAtOrDefault(Step.TargetSlot);
|
||||
if (Enemy == null || Enemy.State.IsDefeated)
|
||||
Enemy = combat.Enemies.FirstOrDefault(enemy => !enemy.State.IsDefeated);
|
||||
if (Card == null && Step.CardId != null && combat.HandController != null)
|
||||
Card = combat.HandController.Cards.FirstOrDefault(card => card.Definition.Id == Step.CardId);
|
||||
return;
|
||||
}
|
||||
if (Enemy == null)
|
||||
Enemy = combat.Enemies.FirstOrDefault(enemy => _lesson == 1 ? enemy.ArchetypeId == "zombie_process"
|
||||
: _lesson == 3 ? enemy.ArchetypeId == "daemon" : true);
|
||||
@@ -152,8 +166,8 @@ namespace KernelPanic.Run
|
||||
return new[] {
|
||||
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 builds a pipeline", "Preparation acts immediately. Payloads and modifiers wait until End turn, oldest first (FIFO). Scripts run before the queue.", "TutorialQueue"),
|
||||
new TutorialStep("select-python", "Select the Python card", "Click print(), then choose the highlighted enemy. This payload can later be repeated by for loop or spread by zip.", "card", TutorialAction.SelectCard),
|
||||
new TutorialStep("queue-intro", "Delayed cards / the queue", "Queued cards wait until End turn, then resolve oldest first (FIFO). Optional language fights teach combos from your collection.", "TutorialQueue"),
|
||||
new TutorialStep("select-python", "Try a payload / print()", "This training hand has print(). Select it, then choose the highlighted enemy to see how a payload enters the queue.", "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", "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"),
|
||||
|
||||
@@ -63,6 +63,13 @@ namespace KernelPanic.UI
|
||||
private PackageSlot? _packageInventoryFilter;
|
||||
|
||||
public event Action ViewChanged;
|
||||
public event Action<Language> LanguageTrainingRequested;
|
||||
|
||||
public void ShowLanguage(Language language)
|
||||
{
|
||||
_selectedLanguageIndex = _languages.ToList().FindIndex(entry => entry.Language == language);
|
||||
ShowLanguages();
|
||||
}
|
||||
|
||||
public void Bind(VisualElement root, FontAsset artFont, LanguageDeckDatabase deckDatabase, CardDatabase cardsDatabase, PlayerCollection collection, Func<DistroDefinition, int> getMergesBalance = null, Func<DistroDefinition, VersionUpgradeResult> tryUpgradeUnit = null, PackageDatabase packageDatabase = null, PackageLoadout packageLoadout = null, Action packageLoadoutChanged = null, Func<SaveData> getSaveData = null, Func<OwnedPackageInstance, PackageUpgradeResult> tryUpgradePackage = null, Func<OwnedPackageInstance, PackageScrapResult> tryScrapPackage = null)
|
||||
{
|
||||
@@ -1699,6 +1706,18 @@ namespace KernelPanic.UI
|
||||
}
|
||||
|
||||
_detail.Add(BuildSubviewCommand($"cat ~/lang/{GetLanguageId(language.Language)}/deck", "starter deck", true, () => OpenLanguageDeck(language), null));
|
||||
if (LanguageTraining.IsSupported(language.Language))
|
||||
{
|
||||
var learn = new Button(() =>
|
||||
{
|
||||
if (LanguageUnlock.IsUnlocked(language.Language, _playerCollection))
|
||||
LanguageTrainingRequested?.Invoke(language.Language);
|
||||
}) { name = "LearnLanguageButton", text = "Learn more / practice fight" };
|
||||
learn.AddToClassList("terminal-button");
|
||||
_detail.Add(learn);
|
||||
_detail.Add(TerminalLayout.BodyText("Learn the basics by playing a guided fight. You can retry or leave without changing your saved campaign."));
|
||||
}
|
||||
else _detail.Add(TerminalLayout.BodyText("Practice fight unavailable: this language's playable cards are still planned."));
|
||||
}
|
||||
|
||||
private void OpenUnitCards(DistroDefinition unit)
|
||||
@@ -1908,7 +1927,7 @@ namespace KernelPanic.UI
|
||||
return row;
|
||||
}
|
||||
|
||||
private static void AddPassiveDetails(VisualElement target, DistroDefinition unit)
|
||||
private void AddPassiveDetails(VisualElement target, DistroDefinition unit)
|
||||
{
|
||||
if (unit.Passive == null)
|
||||
{
|
||||
@@ -1918,6 +1937,17 @@ namespace KernelPanic.UI
|
||||
VisualElement passive = TerminalLayout.Section(unit.Passive.Name,
|
||||
sectionClass: "unit-info-section unit-passive-section", headingClass: "detail-section-title");
|
||||
Label passiveRules = TerminalLayout.BodyText(unit.Passive.RulesText, className: "collection-detail-description");
|
||||
if (unit.Id == "nixos")
|
||||
{
|
||||
var policy = new NixGovernorState(); policy.BeginWave(GetUnitVersion(unit));
|
||||
passiveRules.name = "NixCurrentPolicy";
|
||||
passiveRules.text = "Start each wave in schedutil. Switch once per player turn.\n"
|
||||
+ string.Join("\n", Enum.GetValues(typeof(NixGovernor)).Cast<NixGovernor>().Select(governor =>
|
||||
$"{governor.ToString().ToLowerInvariant()}: {policy.DamageFor(governor)-100:+0;-0;0}% card damage / {policy.ShieldFor(governor)-100:+0;-0;0}% card Shield"))
|
||||
+ (policy.Version >= 3 ? "\nFirst successful switch each wave is free; later switches cost 1 Cycle." : "\nSwitch cost: 1 Cycle.")
|
||||
+ "\nModifiers apply when card effects resolve."
|
||||
+ (policy.Version >= 5 ? "\nSpecialisation on switch: performance deals 5 damage, powersave grants 6 Shield, schedutil draws 1. These bonuses are unscaled." : "");
|
||||
}
|
||||
passive.Add(passiveRules);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(unit.Passive.FlavorText))
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace KernelPanic.UI
|
||||
[RequireComponent(typeof(UIDocument))]
|
||||
[RequireComponent(typeof(RunManager))]
|
||||
[RequireComponent(typeof(CombatManager))]
|
||||
public sealed class CombatSceneController : MonoBehaviour
|
||||
public sealed partial class CombatSceneController : MonoBehaviour
|
||||
{
|
||||
private const string StyleResourcePath = "CombatScene";
|
||||
private const string SharedScrollbarStyleResourcePath = "TerminalScrollbars";
|
||||
@@ -300,6 +300,10 @@ namespace KernelPanic.UI
|
||||
|
||||
private void HandleKeyDown(KeyDownEvent evt)
|
||||
{
|
||||
if (_tutorial?.IsLanguageTraining == true && evt.keyCode == KeyCode.Escape)
|
||||
{ _tutorial.ExitLanguageTraining(); evt.StopPropagation(); return; }
|
||||
if (evt.keyCode == KeyCode.Escape && _combatManager.PendingGoroutineCard != null)
|
||||
{ _combatManager.CancelGoroutineSelection(); evt.StopPropagation(); return; }
|
||||
if (_tutorial?.Guide.Active == true)
|
||||
{
|
||||
if (evt.keyCode == KeyCode.E && _tutorial.Guide.CanEndTurn) _combatManager.EndPlayerTurn();
|
||||
@@ -495,6 +499,7 @@ namespace KernelPanic.UI
|
||||
_schedulerActivity.AddToClassList("scheduler-activity");
|
||||
_schedulerActivity.text = "No operations dispatched.";
|
||||
scheduler.Add(schedulerHeader);
|
||||
BuildGoScheduler(scheduler);
|
||||
_interpreterStrip = AddTrackZone(scheduler, "queue / FIFO", "Interpreter: resolves in order during the interpret phase", "track-zone-queue");
|
||||
_lazyStackPile = AddTrackZone(scheduler, "stack / LIFO", "After FIFO: newest first. Captured multiplier scales damage and explicit Shield only.", "track-zone-stack");
|
||||
_interpreterStrip.name = "TutorialQueue";
|
||||
@@ -779,8 +784,10 @@ namespace KernelPanic.UI
|
||||
: "Endless mode";
|
||||
if (config?.IsTutorial == true)
|
||||
{
|
||||
_waveLabel.text = $"training {config.TutorialLesson}/{TutorialCampaign.LessonCount}";
|
||||
_waveLabel.tooltip = "Clear both training waves for a one-time Bandwidth and Entropy reward.";
|
||||
_waveLabel.text = config.IsLanguageTraining ? $"{config.TrainingLanguage} practice"
|
||||
: $"training {config.TutorialLesson}/{TutorialCampaign.LessonCount}";
|
||||
_waveLabel.tooltip = config.IsLanguageTraining ? "Optional practice with loan cards. Exit any time; campaign progress is unchanged."
|
||||
: "Clear all three training waves for a one-time Bandwidth and Entropy reward.";
|
||||
}
|
||||
_phaseLabel.text = PhaseText(_combatManager.CurrentPhase);
|
||||
_bitsLabel.text = _runManager.Bits.ToString();
|
||||
@@ -828,6 +835,7 @@ namespace KernelPanic.UI
|
||||
}
|
||||
|
||||
_playerPanel.Add(StatusBlock(state, true));
|
||||
RefreshGovernorPanel();
|
||||
|
||||
var compilation = _combatManager.Compilation;
|
||||
if (compilation.Active)
|
||||
@@ -880,6 +888,7 @@ namespace KernelPanic.UI
|
||||
|
||||
private void RefreshTracks()
|
||||
{
|
||||
RefreshGoScheduler();
|
||||
_queueView.Sync(_combatManager.InterpreterQueue.Cards);
|
||||
_stackView.Sync(_combatManager.LazyStack.Cards);
|
||||
_stackView.SyncMultipliers(_combatManager.LazyStack.Entries);
|
||||
@@ -903,7 +912,8 @@ namespace KernelPanic.UI
|
||||
((VisualElement)_tokenArea.userData).EnableInClassList("track-idle", _combatManager.Python.AutomationCount == 0);
|
||||
_root.Q(className: "scheduler").EnableInClassList("scheduler-idle",
|
||||
_combatManager.InterpreterQueue.Count == 0 && _combatManager.LazyStack.Count == 0
|
||||
&& _combatManager.Python.AutomationCount == 0 && _combatManager.Python.RepeatCount == 0 && _combatManager.Python.AreaCount == 0);
|
||||
&& _combatManager.Python.AutomationCount == 0 && _combatManager.Python.RepeatCount == 0 && _combatManager.Python.AreaCount == 0
|
||||
&& _combatManager.Go.Count == 0);
|
||||
((VisualElement)_interpreterStrip.userData).EnableInClassList("track-resolving", _combatManager.CurrentPhase == TurnPhase.Interpret);
|
||||
}
|
||||
|
||||
@@ -1150,9 +1160,11 @@ namespace KernelPanic.UI
|
||||
? $"[!] RECOVER {card.CorruptionRoundsRemaining} ROUNDS" : "[!] CORRUPTED") : card.IsLocked ? $"[L] UNLOCK {EnemyArchetypeCatalog.DrmUnlockCycleCost}c"
|
||||
: card.Definition.IsToken ? "TOKEN / NOT EXECUTABLE"
|
||||
: GetDisplayCardCost(card) > _combatManager.PlayerState.Cycles ? $"NEEDS {GetDisplayCardCost(card)} CYCLES"
|
||||
: _combatManager.PendingTargetCard == card ? "> SELECT TARGET" : "";
|
||||
: _combatManager.PendingGoroutineCard == card ? "> SELECT GOROUTINE"
|
||||
: _combatManager.GoPlayBlockReason(card) ?? (_combatManager.PendingTargetCard == card ? "> SELECT TARGET" : "");
|
||||
if (!string.IsNullOrEmpty(reason)) { stateLabel.text = reason; face.tooltip += "\n" + reason; }
|
||||
face.SetEnabled(!_combatManager.RunFinished && _combatManager.CurrentPhase == TurnPhase.Execute && !card.IsBroken
|
||||
&& _combatManager.GoPlayBlockReason(card) == null
|
||||
&& _combatManager.TutorialGuide?.AllowsCard(card) != false);
|
||||
_handCardElements[card] = face;
|
||||
if (added) PlayElementBeat(face, "hand-card-drawn", 180);
|
||||
@@ -1255,6 +1267,15 @@ namespace KernelPanic.UI
|
||||
|
||||
private void RefreshSurrenderCommand()
|
||||
{
|
||||
if (_tutorial?.IsLanguageTraining == true)
|
||||
{
|
||||
_surrenderConfirming = false;
|
||||
_surrenderButton.text = "[Esc] Exit training";
|
||||
_surrenderButton.SetEnabled(true);
|
||||
_surrenderConfirmLabel.AddToClassList("hidden");
|
||||
_surrenderCancelButton.AddToClassList("hidden");
|
||||
return;
|
||||
}
|
||||
bool canSurrender = _combatManager.CanSurrenderRun;
|
||||
if (!canSurrender)
|
||||
{
|
||||
@@ -1278,6 +1299,7 @@ namespace KernelPanic.UI
|
||||
|
||||
private void HandleSurrenderClicked()
|
||||
{
|
||||
if (_tutorial?.IsLanguageTraining == true) { _tutorial.ExitLanguageTraining(); return; }
|
||||
if (!_combatManager.CanSurrenderRun)
|
||||
{
|
||||
_surrenderConfirming = false;
|
||||
@@ -2012,14 +2034,23 @@ namespace KernelPanic.UI
|
||||
var preview = CardPreviewService.Build(_combatManager, card);
|
||||
if (!string.IsNullOrEmpty(preview.Summary) && !preview.Summary.StartsWith("Utility", StringComparison.Ordinal))
|
||||
{
|
||||
string timing = card.Definition.ResolutionTrack == ResolutionTrack.Native ? "now: " : "preview: ";
|
||||
var label = SoftwareCardView.Text(timing + preview.Summary + (preview.IsConditional ? " *" : ""), "software-live-preview");
|
||||
target.Q(className: "software-body")?.Add(label);
|
||||
bool python = card.Definition.Language == Language.Python;
|
||||
var label = SoftwareCardView.Text(preview.Summary, "software-live-preview");
|
||||
label.tooltip = preview.Details;
|
||||
var body = target.Q(className: "software-body");
|
||||
if (python) body?.Insert(1, label);
|
||||
else body?.Add(label);
|
||||
if (!string.IsNullOrEmpty(preview.CriticalSummary) && body != null)
|
||||
{
|
||||
var crit = SoftwareCardView.Text(preview.CriticalSummary, "software-live-crit");
|
||||
crit.tooltip = preview.Details;
|
||||
body.Insert(body.IndexOf(label) + 1, crit);
|
||||
}
|
||||
}
|
||||
// Rules are already printed on the card. Keep hover help contextual and brief.
|
||||
target.tooltip = card.IsBroken ? CardPreviewService.CorruptionDetails(card)
|
||||
: card.IsLocked ? "Unlock for 1 Cycle before playing."
|
||||
: preview.IsConditional ? "Current estimate; targets, defenses and later effects can change the result."
|
||||
: preview.IsConditional ? "Based on the current setup. Targets, defenses and later effects can change the result."
|
||||
: "";
|
||||
}
|
||||
|
||||
@@ -2425,6 +2456,7 @@ namespace KernelPanic.UI
|
||||
{
|
||||
ResolutionTrack.InterpreterQueue => _interpreterStrip,
|
||||
ResolutionTrack.LazyStack => _lazyStackPile,
|
||||
ResolutionTrack.Goroutine => _goScheduler,
|
||||
_ => FirstTargetElement(payload.Card)
|
||||
};
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ namespace KernelPanic.UI
|
||||
{
|
||||
ResolutionTrack.InterpreterQueue => name + " queued / oldest first.",
|
||||
ResolutionTrack.LazyStack => name + " stacked / newest first.",
|
||||
ResolutionTrack.Goroutine => name + " deployed / first tick next round.",
|
||||
_ => name + " / executes now."
|
||||
};
|
||||
_instruction.text = "Spend any remaining Cycles, then press [E] End turn. Shield absorbs incoming damage.";
|
||||
@@ -107,7 +108,8 @@ namespace KernelPanic.UI
|
||||
public void CardResolved(string name, ResolutionTrack track)
|
||||
{
|
||||
if (!Visible || _completed) return;
|
||||
_receipt.text = name + " resolved" + (track == ResolutionTrack.Native ? " immediately." : track == ResolutionTrack.InterpreterQueue ? " from the front of the queue." : " from the top of the stack.");
|
||||
_receipt.text = track == ResolutionTrack.Goroutine ? name + " deployed; ticking starts next round."
|
||||
: name + " resolved" + (track == ResolutionTrack.Native ? " immediately." : track == ResolutionTrack.InterpreterQueue ? " from the front of the queue." : " from the top of the stack.");
|
||||
}
|
||||
|
||||
public void PhaseChanged(TurnPhase phase)
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace KernelPanic.UI
|
||||
for (int i = 0; i < distros.Count; i++)
|
||||
{
|
||||
DistroDefinition distro = distros[i];
|
||||
if (GachaService.IsBeginnerInstallMediaDistro(distro))
|
||||
if (GachaService.IsBeginnerInstallMediaDistro(distro) || distro?.Id == "nixos")
|
||||
{
|
||||
gacha.AddToBannerPool(distro);
|
||||
}
|
||||
|
||||
@@ -216,6 +216,7 @@ namespace KernelPanic.UI
|
||||
FontAsset resolvedFont = ResolveMonospaceFont();
|
||||
featuredUnitPanel.Bind(_root, resolvedFont, GetBestWaveForUnit, OpenFeaturedUnitDetail);
|
||||
collectionScreen.Bind(_root, resolvedFont, languageDeckDatabase, cardDatabase, _playerCollection, GetMergesBalance, UpgradeCollectionUnit, packageDatabase, _packageLoadout, SaveCurrentState, () => _saveData, UpgradeCollectionPackage, ScrapCollectionPackage);
|
||||
collectionScreen.LanguageTrainingRequested += StartLanguageTraining;
|
||||
gachaScreen.Bind(_root, distroDatabase, packageDatabase, resolvedFont, _gachaService, _playerCollection, _wallet, ResolvePulledDistros, ClaimStandardFiveStarSelector, HandleMetaStateChanged, OpenRootCreditExchange, StartGachaPullCutscene);
|
||||
LoadMetaState();
|
||||
_playerCollection.Changed += HandleMetaStateChanged;
|
||||
@@ -309,6 +310,14 @@ namespace KernelPanic.UI
|
||||
PlayBootIntroIfNeeded();
|
||||
RefreshDailyQuestPanel();
|
||||
_dailyQuestSchedule = _root.schedule.Execute(TickDailyQuests).Every(1000);
|
||||
if (RunContext.TryTakeLanguageReturn(out var trainingLanguage))
|
||||
{
|
||||
CompleteBootIntro();
|
||||
ShowCollectionLanguages();
|
||||
collectionScreen.ShowLanguage(trainingLanguage);
|
||||
ShowScreen(MenuScreen.Collection);
|
||||
_root.Q<Button>("LearnLanguageButton")?.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
@@ -995,7 +1004,7 @@ namespace KernelPanic.UI
|
||||
for (int i = 0; i < distros.Count; i++)
|
||||
{
|
||||
DistroDefinition distro = distros[i];
|
||||
if (GachaService.IsBeginnerInstallMediaDistro(distro))
|
||||
if (GachaService.IsBeginnerInstallMediaDistro(distro) || distro?.Id == "nixos")
|
||||
{
|
||||
_gachaService.AddToBannerPool(distro);
|
||||
}
|
||||
@@ -1113,6 +1122,24 @@ namespace KernelPanic.UI
|
||||
return true;
|
||||
}
|
||||
|
||||
private void StartLanguageTraining(Language language)
|
||||
{
|
||||
if (_runLaunchPending || PersistenceBlocked || TutorialCampaign.Required(_saveData)
|
||||
|| !LanguageUnlock.IsUnlocked(language, _playerCollection) || !LanguageTraining.IsSupported(language)) return;
|
||||
try
|
||||
{
|
||||
var host = _playerCollection.OwnedUnits.Count > 0 ? _playerCollection.OwnedUnits[0] : null;
|
||||
RunContext.SetTutorial(LanguageTraining.CreateConfig(language, host, cardDatabase));
|
||||
_runLaunchPending = true;
|
||||
SceneLoader.LoadGame(_root);
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
var detail = _root.Q<ScrollView>("CollectionDetail");
|
||||
detail?.Add(TerminalLayout.BodyText("Training could not start: " + ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveCurrentState()
|
||||
{
|
||||
if (_saveLoadFailed || _loadingMetaState) return;
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace KernelPanic.UI
|
||||
{
|
||||
ResolutionTrack.InterpreterQueue => "QUEUE / FIFO",
|
||||
ResolutionTrack.LazyStack => "STACK / LIFO",
|
||||
ResolutionTrack.Goroutine => "GOROUTINE / NEXT ROUND",
|
||||
_ => "NATIVE / NOW"
|
||||
};
|
||||
|
||||
@@ -34,17 +35,62 @@ namespace KernelPanic.UI
|
||||
header.Add(Text($"{cost}c", "software-cost"));
|
||||
target.Add(header);
|
||||
target.Add(Text(string.IsNullOrWhiteSpace(definition.DisplayName) ? definition.name : definition.DisplayName, "software-name"));
|
||||
target.Add(Text(TrackName(definition.ResolutionTrack), "software-track"));
|
||||
bool python = definition.Language == Language.Python;
|
||||
string role = null;
|
||||
string displayRules = rules;
|
||||
if (python)
|
||||
{
|
||||
// Lift only known presentation prefixes out of the generated rules.
|
||||
// Amounts, upgrades, targets and conditions remain authoritative.
|
||||
foreach (string prefix in new[] { "payload", "automation", "modifier", "preparation" })
|
||||
{
|
||||
if (!rules.StartsWith(prefix + ": ", System.StringComparison.Ordinal)) continue;
|
||||
role = prefix;
|
||||
displayRules = rules.Substring(prefix.Length + 2);
|
||||
target.AddToClassList("software-python-" + role);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (role != null)
|
||||
{
|
||||
var metadata = new VisualElement();
|
||||
metadata.AddToClassList("software-python-metadata");
|
||||
metadata.Add(Text(role.ToUpperInvariant(), "software-python-role"));
|
||||
metadata.Add(Text(TrackName(definition.ResolutionTrack), "software-track"));
|
||||
target.Add(metadata);
|
||||
}
|
||||
else target.Add(Text(TrackName(definition.ResolutionTrack), "software-track"));
|
||||
|
||||
if (card.DrawRider > 0) rules += $" Draw {card.DrawRider}.";
|
||||
if (card.DrawRider > 0)
|
||||
{
|
||||
rules += $" Draw {card.DrawRider}.";
|
||||
displayRules += $" Draw {card.DrawRider}.";
|
||||
}
|
||||
target.tooltip = rules;
|
||||
if (card.IsBroken) target.tooltip += "\n\n" + CardPreviewService.CorruptionDetails(card);
|
||||
var body = new VisualElement();
|
||||
body.AddToClassList("software-body");
|
||||
// Break at a sentence boundary only. Never reinterpret effect amounts or conditions.
|
||||
int split = rules.IndexOf(". ", System.StringComparison.Ordinal);
|
||||
body.Add(Text(split < 0 ? rules : rules.Substring(0, split + 1), "software-effect"));
|
||||
if (split >= 0) body.Add(Text(rules.Substring(split + 2), "software-conditions"));
|
||||
int split = displayRules.IndexOf(". ", System.StringComparison.Ordinal);
|
||||
body.Add(Text(split < 0 ? displayRules : displayRules.Substring(0, split + 1), "software-effect"));
|
||||
if (split >= 0)
|
||||
{
|
||||
string details = displayRules.Substring(split + 2);
|
||||
if (python)
|
||||
{
|
||||
// Give each rule its own line without abbreviating or hiding restrictions.
|
||||
var sentences = details.Split(new[] { ". " }, System.StringSplitOptions.None);
|
||||
for (int i = 0; i < sentences.Length; i++)
|
||||
{
|
||||
string line = sentences[i] + (i < sentences.Length - 1 ? "." : "");
|
||||
var rule = new VisualElement();
|
||||
rule.AddToClassList("software-python-rule");
|
||||
rule.Add(Text(line, "software-conditions"));
|
||||
body.Add(rule);
|
||||
}
|
||||
}
|
||||
else body.Add(Text(details, "software-conditions"));
|
||||
}
|
||||
target.Add(body);
|
||||
|
||||
var footer = new VisualElement();
|
||||
|
||||
@@ -214,7 +214,7 @@ namespace KernelPanic.UI
|
||||
|
||||
public static void SetDistro(VisualElement root, DistroDefinition distro)
|
||||
{
|
||||
foreach (string id in new[] { "arch", "ubuntu", "fedora", "mint", "gentoo" })
|
||||
foreach (string id in new[] { "arch", "ubuntu", "fedora", "mint", "gentoo", "nixos" })
|
||||
root.EnableInClassList("distro-" + id, distro != null && distro.Id == id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace KernelPanic.UI
|
||||
private readonly LanguageDeckDatabase _languages;
|
||||
private readonly SaveService _save;
|
||||
private readonly Action _returnToMenu;
|
||||
private readonly Language? _language;
|
||||
private TutorialSpotlight _spotlight;
|
||||
private Action _refresh;
|
||||
private int _lesson, _shopStep;
|
||||
@@ -27,12 +28,14 @@ namespace KernelPanic.UI
|
||||
public TutorialGuide Guide { get; private set; }
|
||||
public bool Reading => Guide.Reading;
|
||||
public int Lesson => _lesson;
|
||||
public bool IsLanguageTraining => _language.HasValue;
|
||||
|
||||
public TutorialFlow(VisualElement overlay, RunManager run, CombatManager combat, CardDatabase cards,
|
||||
LanguageDeckDatabase languages, SaveService save, RunConfig config, Action returnToMenu)
|
||||
{
|
||||
_overlay = overlay; _run = run; _combat = combat; _cards = cards; _languages = languages;
|
||||
_save = save; _lesson = config.TutorialLesson; _returnToMenu = returnToMenu;
|
||||
_language = config.TrainingLanguage;
|
||||
_resuming = _lesson > 1;
|
||||
SetGuide(_lesson);
|
||||
}
|
||||
@@ -42,7 +45,7 @@ namespace KernelPanic.UI
|
||||
private void SetGuide(int lesson)
|
||||
{
|
||||
_spotlight?.Dispose(); _spotlight = null;
|
||||
Guide = new TutorialGuide(lesson); _combat.TutorialGuide = Guide;
|
||||
Guide = _language.HasValue ? new TutorialGuide(_language.Value) : new TutorialGuide(lesson); _combat.TutorialGuide = Guide;
|
||||
_combat.TutorialReading = true; _renderKey = null;
|
||||
}
|
||||
public void ObserveCard(ResolutionTrack track) => Guide.CardPlayed(track);
|
||||
@@ -52,6 +55,39 @@ namespace KernelPanic.UI
|
||||
public void Review() => Redraw();
|
||||
public void AdvancePage() { if (_leaving || _resuming) return; Guide.Acknowledge(_combat); Redraw(); }
|
||||
|
||||
public void ExitLanguageTraining()
|
||||
{
|
||||
if (!_language.HasValue || _leaving) return;
|
||||
_leaving = true;
|
||||
RunContext.ReturnToLanguage(_language.Value);
|
||||
_returnToMenu();
|
||||
}
|
||||
|
||||
private void RefreshLanguageResult()
|
||||
{
|
||||
_spotlight?.Dispose(); _spotlight = null;
|
||||
string key = "language-result:" + _combat.RunLost;
|
||||
if (_renderKey == key) return;
|
||||
_renderKey = key;
|
||||
_overlay.Clear(); _overlay.AddToClassList("tutorial-overlay"); _overlay.style.display = DisplayStyle.Flex;
|
||||
var panel = TerminalLayout.Section(_combat.RunLost ? "Practice ended" : "Practice complete", "LanguageTrainingResult");
|
||||
panel.AddToClassList("tutorial-dialog");
|
||||
var scroll = new ScrollView(ScrollViewMode.Vertical);
|
||||
scroll.style.flexShrink = 1; scroll.style.minHeight = 0;
|
||||
scroll.Add(TerminalLayout.BodyText("Return to your language collection, or try the same fight again. Your campaign and collection are unchanged."));
|
||||
panel.Add(scroll);
|
||||
var retry = new Button(() =>
|
||||
{
|
||||
var config = _run.CurrentConfig;
|
||||
_overlay.RemoveFromClassList("tutorial-overlay");
|
||||
SetGuide(0); _run.StartRun(config); Redraw();
|
||||
}) { text = "Try again", name = "RetryLanguageTraining" };
|
||||
retry.AddToClassList("primary-action"); panel.Add(retry);
|
||||
var back = new Button(ExitLanguageTraining) { text = "Back to languages", name = "ReturnToLanguages" };
|
||||
back.AddToClassList("primary-action"); panel.Add(back);
|
||||
TerminalTheme.ConstrainModalFocus(panel); _overlay.Add(panel); back.Focus();
|
||||
}
|
||||
|
||||
public void ResumeSecondWave()
|
||||
{
|
||||
if (!_resuming) return;
|
||||
@@ -63,10 +99,13 @@ namespace KernelPanic.UI
|
||||
{
|
||||
if (_leaving || _resuming) return;
|
||||
UpdateState();
|
||||
if (_language.HasValue && (_combat.AwaitingWaveContinue || _combat.RunFinished))
|
||||
{ RefreshLanguageResult(); return; }
|
||||
if (Guide.Active && !_combat.RunFinished)
|
||||
{
|
||||
_overlay.RemoveFromClassList("tutorial-overlay");
|
||||
_spotlight ??= new TutorialSpotlight(_overlay, AdvancePage);
|
||||
if (_language.HasValue) _spotlight.SetExit(ExitLanguageTraining);
|
||||
_spotlight.Show(Guide, _combat);
|
||||
return;
|
||||
}
|
||||
@@ -148,6 +187,7 @@ namespace KernelPanic.UI
|
||||
|
||||
public void Continue()
|
||||
{
|
||||
if (_language.HasValue) return;
|
||||
if (_leaving || Guide.Active || !_combat.AwaitingWaveContinue || _combat.RunFinished) return;
|
||||
if (_lesson == 1 && !_run.RepositoryOffers.Any(offer => offer.Sold)) return;
|
||||
if (_run.WavesCleared < _lesson) return;
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace KernelPanic.UI
|
||||
private readonly VisualElement[] _shades = new VisualElement[4];
|
||||
private readonly Label _title, _copy, _progress;
|
||||
private readonly Button _next;
|
||||
private Button _exit;
|
||||
private readonly IVisualElementScheduledItem _placement;
|
||||
private TutorialGuide _guide;
|
||||
private VisualElement _anchor;
|
||||
@@ -50,7 +51,9 @@ namespace KernelPanic.UI
|
||||
_guide = guide; _overlay.style.display = DisplayStyle.Flex;
|
||||
_root.EnableInClassList("tutorial-card-focus", guide.Step.Anchor == "card");
|
||||
_anchor = ResolveAnchor();
|
||||
_progress.text = $"Wave {combat.RunConfig.TutorialLesson}/{TutorialCampaign.LessonCount} / step {guide.Index + 1} of {guide.Count}";
|
||||
_progress.text = combat.RunConfig.TrainingLanguage.HasValue
|
||||
? $"{KernelPanic.Data.LanguageCatalog.Get(combat.RunConfig.TrainingLanguage.Value).DisplayName} practice / step {guide.Index + 1} of {guide.Count}"
|
||||
: $"Wave {combat.RunConfig.TutorialLesson}/{TutorialCampaign.LessonCount} / step {guide.Index + 1} of {guide.Count}";
|
||||
_title.text = guide.Step.Title; _copy.text = guide.Step.Copy;
|
||||
_next.style.display = guide.Reading ? DisplayStyle.Flex : DisplayStyle.None;
|
||||
_next.SetEnabled(combat.TutorialInputReady);
|
||||
@@ -70,6 +73,14 @@ namespace KernelPanic.UI
|
||||
Place();
|
||||
}
|
||||
|
||||
public void SetExit(Action exit)
|
||||
{
|
||||
if (_exit != null) return;
|
||||
_exit = new Button(exit) { name = "ExitLanguageTraining", text = "[Esc] Exit training" };
|
||||
_exit.AddToClassList("secondary-action");
|
||||
_panel.Add(_exit);
|
||||
}
|
||||
|
||||
private VisualElement ResolveAnchor()
|
||||
{
|
||||
if (_guide?.Step == null) return null;
|
||||
@@ -95,7 +106,9 @@ namespace KernelPanic.UI
|
||||
private void TrapFocus(NavigationMoveEvent evt)
|
||||
{
|
||||
if (_guide?.Active != true || evt.direction is not (NavigationMoveEvent.Direction.Next or NavigationMoveEvent.Direction.Previous)) return;
|
||||
_root.panel?.focusController.IgnoreEvent(evt); evt.StopImmediatePropagation(); FocusAction();
|
||||
_root.panel?.focusController.IgnoreEvent(evt); evt.StopImmediatePropagation();
|
||||
if (_exit != null && _root.panel?.focusController.focusedElement != _exit) _exit.Focus();
|
||||
else FocusAction();
|
||||
}
|
||||
|
||||
private void Place()
|
||||
|
||||
@@ -249,7 +249,7 @@ public class CardCatalogTests
|
||||
public void CatalogCoversEveryPersistedCardIncludingTokenAndReturnsFreshRuntimeEffects()
|
||||
{
|
||||
Assert.That(CardCatalog.Entries.Select(entry => entry.Id), Is.EquivalentTo(Database.AllCards.Select(card => card.Id)));
|
||||
Assert.That(CardCatalog.Entries.Select(entry => entry.Id).Distinct().Count(), Is.EqualTo(65));
|
||||
Assert.That(CardCatalog.Entries.Select(entry => entry.Id).Distinct().Count(), Is.EqualTo(81));
|
||||
foreach (var entry in CardCatalog.Entries)
|
||||
{
|
||||
var first = entry.CreateEffects();
|
||||
|
||||
@@ -90,6 +90,29 @@ public class CardPreviewTests
|
||||
Assert.That(combat.PlayCard(card), Is.True);
|
||||
}
|
||||
|
||||
[TestCase("lang_py_print", "4 damage", "Crit: 6 damage")]
|
||||
[TestCase("lang_c_malloc", "12 damage", "Crit: 18 damage")]
|
||||
[TestCase("lang_js_console_log", "3–9 damage", "Crit: 5–14 damage")]
|
||||
public void DamageSummarySeparatesNormalRollsFromCriticalHits(string id, string normal, string critical)
|
||||
{
|
||||
Configure("Ubuntu", 1);
|
||||
Player.ForceMaxRolls = false;
|
||||
var preview = CardPreviewService.Build(combat, Card(id), Target);
|
||||
Assert.That(preview.Summary, Is.EqualTo(normal));
|
||||
Assert.That(preview.CriticalSummary, Is.EqualTo(critical));
|
||||
Assert.That(preview.Details, Does.Contain(critical));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MaxRollModeShowsOneValueWithoutACritLine()
|
||||
{
|
||||
Configure("Mint", 1);
|
||||
var preview = CardPreviewService.Build(combat, Card("lang_js_console_log"), Target);
|
||||
Assert.That(preview.Summary, Is.EqualTo("9 damage"));
|
||||
Assert.That(preview.CriticalSummary, Is.Empty);
|
||||
Assert.That(preview.NormalMaximumDamage, Is.EqualTo(preview.MaximumDamage));
|
||||
}
|
||||
|
||||
private void ResolveEffects(CardInstance card, int lazy = 100)
|
||||
{
|
||||
var context = new CombatContext(card, Player, new[] { Target }, combat, combat.DamagePipeline,
|
||||
@@ -227,6 +250,8 @@ public class CardPreviewTests
|
||||
var preview = CardPreviewService.Build(combat, card, Target);
|
||||
Assert.That((preview.MinimumDamage, preview.MaximumDamage), Is.EqualTo((27, 69)));
|
||||
Assert.That(preview.Details, Does.Contain("3 hits"));
|
||||
Assert.That(preview.Summary, Is.EqualTo("27–45 damage"));
|
||||
Assert.That(preview.CriticalSummary, Is.EqualTo("All hits crit: 42–69 damage"));
|
||||
RandomRoll.Seed(73);
|
||||
int before = Target.CurrentUptime;
|
||||
Play(card);
|
||||
|
||||
@@ -75,7 +75,10 @@ public class CollectionLayoutTests
|
||||
var rules = passive.Q<Label>(className: "collection-detail-description");
|
||||
Assert.That(description.text, Is.EqualTo(unit.Description), context);
|
||||
Assert.That(passiveTitle.text, Is.EqualTo(unit.Passive.Name), context);
|
||||
Assert.That(rules.text, Is.EqualTo(unit.Passive.RulesText), context);
|
||||
if (unit.Id == "nixos")
|
||||
Assert.That(rules.text, Does.Contain("performance: +20% card damage").And.Contain("powersave: -20% card damage").And.Contain("schedutil: +5% card damage"), context);
|
||||
else
|
||||
Assert.That(rules.text, Is.EqualTo(unit.Passive.RulesText), context);
|
||||
float copyGap = density == UILayoutDensity.Comfortable ? 14 : 10;
|
||||
float sectionGap = density == UILayoutDensity.Comfortable ? 31.5f : 23.5f;
|
||||
AssertVerticalGap(identityTitle, languages, copyGap, context + ": identity heading");
|
||||
|
||||
@@ -112,6 +112,53 @@ public class CombatLayoutTests
|
||||
enemies.Add(new EnemyInstance(EnemyArchetypeCatalog.Get("memory_leak"), 4));
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator NixGovernorAndGoSchedulerStayReadableAndAcceptKeyboardActions()
|
||||
{
|
||||
var cards = AssetDatabase.LoadAssetAtPath<CardDatabase>("Assets/Data/Cards/CardDatabase.asset");
|
||||
var nix = AssetDatabase.LoadAssetAtPath<DistroDefinition>("Assets/Data/Distros/NixOS.asset");
|
||||
var config = new RunConfig(nix, Language.Haskell, Language.Go, nix.ExclusiveCards.Take(4).ToArray(), 73, 3);
|
||||
_run.StartRun(config); Set(_combat, "_runConfig", config);
|
||||
Set(_combat, "_playerState", new CombatantState(60, 6, 3));
|
||||
Set(_combat, "_handController", new HandController(6));
|
||||
_combat.Compilation.BeginWave(0);
|
||||
for (int i = 0; i < 3; i++) _combat.Go.Deploy(new CardInstance(cards.FindById("lang_go_worker")), 3, 3, 1, _combat.Enemies[0].State);
|
||||
foreach (var size in Viewports)
|
||||
foreach (var textSize in new[] { UITextSize.Standard, UITextSize.Large })
|
||||
{
|
||||
Resize(size); UIPreferences.TextSize = textSize; _combat.Nix.BeginWave(3);
|
||||
Call(_combat, "ApplyGovernorModifiers");
|
||||
Call(_view, "RefreshPlayer"); Call(_view, "RefreshTracks");
|
||||
for (int frame = 0; frame < 6; frame++) yield return null;
|
||||
string context = $"{size}/{textSize}";
|
||||
var panel = _root.Q("NixGovernorPanel");
|
||||
foreach (var button in panel.Query<Button>().ToList()) AssertContainedHorizontally(button, panel, context);
|
||||
Assert.That(_root.Q<Button>("GovernorSchedutil").text, Does.Contain("ACTIVE"));
|
||||
Assert.That(panel.Q<Label>(className: "nix-switch-cost").text, Does.Contain("FREE"));
|
||||
var performance = _root.Q<Button>("GovernorPerformance");
|
||||
var shortcut = _root.Q<Button>("GovernorShortcut");
|
||||
Assert.That(shortcut.text, Does.Contain("schedutil"));
|
||||
using (var submit = NavigationSubmitEvent.GetPooled()) { submit.target = shortcut; shortcut.SendEvent(submit); }
|
||||
for (int frame = 0; frame < 2; frame++) yield return null;
|
||||
Assert.That(_root.focusController.focusedElement, Is.SameAs(performance), context + ": configuration shortcut focuses an available policy");
|
||||
using (var submit = NavigationSubmitEvent.GetPooled()) { submit.target = performance; performance.SendEvent(submit); }
|
||||
Assert.That(_combat.Nix.Governor, Is.EqualTo(NixGovernor.Performance));
|
||||
Call(_view, "RefreshPlayer"); // This fixture drives refreshes without the scene's Start subscription.
|
||||
Assert.That(shortcut.text, Does.Contain("performance"));
|
||||
Assert.That(_combat.PlayerState.Cycles, Is.EqualTo(3));
|
||||
var scheduler = _root.Q("GoroutineScheduler");
|
||||
var rows = scheduler.Query<Button>(className: "goroutine-row").ToList();
|
||||
Assert.That(rows.Count, Is.EqualTo(3));
|
||||
foreach (var row in rows)
|
||||
{
|
||||
AssertContainedHorizontally(row, scheduler, context);
|
||||
Assert.That(row.text, Does.Contain("3 ticks")); Assert.That(row.text, Does.Contain("starts next round"));
|
||||
}
|
||||
using (var submit = NavigationSubmitEvent.GetPooled()) { submit.target = rows[1]; rows[1].SendEvent(submit); }
|
||||
Assert.That(_combat.SelectedGoroutine, Is.SameAs(_combat.Go.Active[1]));
|
||||
}
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator PythonChoicesFitViewportsAndResolveThroughAKeyboardSubmit()
|
||||
{
|
||||
@@ -177,44 +224,54 @@ public class CombatLayoutTests
|
||||
public IEnumerator HandFocusRevealsNameAndCostAndStillAllowsRulesScrolling()
|
||||
{
|
||||
bool testedOversizedCard = false;
|
||||
foreach (var size in Viewports)
|
||||
foreach (var textSize in new[] { UITextSize.Standard, UITextSize.Large })
|
||||
foreach (bool python in new[] { false, true })
|
||||
{
|
||||
UIPreferences.TextSize = textSize;
|
||||
Resize(size);
|
||||
Call(_view, "RefreshHand");
|
||||
for (int frame = 0; frame < 5; frame++) yield return null;
|
||||
var scroll = _root.Q<ScrollView>(className: "hand-scroll");
|
||||
var faces = scroll.Query<Button>(className: "hand-card").ToList();
|
||||
string context = $"{size}, {textSize}";
|
||||
testedOversizedCard |= faces.Any(face => face.worldBound.height > scroll.contentViewport.worldBound.height);
|
||||
scroll.scrollOffset = new Vector2(scroll.horizontalScroller.highValue, scroll.verticalScroller.highValue);
|
||||
// Moving focus twice before layout must not restore a stale card's position.
|
||||
faces[0].Focus();
|
||||
faces[faces.Count - 1].Focus();
|
||||
for (int frame = 0; frame < 3; frame++) yield return null;
|
||||
foreach (var face in new[] { faces[faces.Count - 1], faces[0] })
|
||||
if (python)
|
||||
{
|
||||
face.Focus();
|
||||
for (int frame = 0; frame < 3; frame++) yield return null;
|
||||
foreach (string className in new[] { "software-name", "software-cost" })
|
||||
{
|
||||
var label = face.Q<Label>(className: className);
|
||||
AssertContainedHorizontally(label, scroll.contentViewport, context);
|
||||
Assert.That(label.worldBound.yMin, Is.GreaterThanOrEqualTo(scroll.contentViewport.worldBound.yMin - 1),
|
||||
$"{context}; {className}; face={face.worldBound}; viewport={scroll.contentViewport.worldBound}; content={scroll.contentContainer.worldBound}; offset={scroll.scrollOffset}; focus={_root.focusController.focusedElement == face}");
|
||||
Assert.That(label.worldBound.yMax, Is.LessThanOrEqualTo(scroll.contentViewport.worldBound.yMax + 1), context);
|
||||
}
|
||||
var database = AssetDatabase.LoadAssetAtPath<CardDatabase>("Assets/Data/Cards/CardDatabase.asset");
|
||||
_combat.HandController.Clear();
|
||||
foreach (string id in new[] { "mint_timeshift", "lang_py_print", "mint_cinnamon" })
|
||||
_combat.HandController.Add(new CardInstance(database.FindById(id)));
|
||||
}
|
||||
foreach (var size in Viewports)
|
||||
foreach (var textSize in new[] { UITextSize.Standard, UITextSize.Large })
|
||||
{
|
||||
UIPreferences.TextSize = textSize;
|
||||
Resize(size);
|
||||
Call(_view, "RefreshHand");
|
||||
for (int frame = 0; frame < 5; frame++) yield return null;
|
||||
var scroll = _root.Q<ScrollView>(className: "hand-scroll");
|
||||
var faces = scroll.Query<Button>(className: "hand-card").ToList();
|
||||
string context = $"{size}, {textSize}, Python={python}";
|
||||
testedOversizedCard |= faces.Any(face => face.worldBound.height > scroll.contentViewport.worldBound.height);
|
||||
scroll.scrollOffset = new Vector2(scroll.horizontalScroller.highValue, scroll.verticalScroller.highValue);
|
||||
// Moving focus twice before layout must not restore a stale card's position.
|
||||
faces[0].Focus();
|
||||
faces[faces.Count - 1].Focus();
|
||||
for (int frame = 0; frame < 3; frame++) yield return null;
|
||||
foreach (var face in new[] { faces[faces.Count - 1], faces[0] })
|
||||
{
|
||||
face.Focus();
|
||||
for (int frame = 0; frame < 3; frame++) yield return null;
|
||||
foreach (string className in new[] { "software-name", "software-cost" })
|
||||
{
|
||||
var label = face.Q<Label>(className: className);
|
||||
AssertContainedHorizontally(label, scroll.contentViewport, context);
|
||||
Assert.That(label.worldBound.yMin, Is.GreaterThanOrEqualTo(scroll.contentViewport.worldBound.yMin - 1),
|
||||
$"{context}; {className}; face={face.worldBound}; viewport={scroll.contentViewport.worldBound}; content={scroll.contentContainer.worldBound}; offset={scroll.scrollOffset}; focus={_root.focusController.focusedElement == face}");
|
||||
Assert.That(label.worldBound.yMax, Is.LessThanOrEqualTo(scroll.contentViewport.worldBound.yMax + 1), context);
|
||||
}
|
||||
}
|
||||
Call(_view, "RefreshHand");
|
||||
for (int frame = 0; frame < 3; frame++) yield return null;
|
||||
Assert.That(_root.focusController.focusedElement, Is.SameAs(faces[0]), context);
|
||||
scroll.scrollOffset = new Vector2(scroll.scrollOffset.x, scroll.verticalScroller.highValue);
|
||||
float rulesOffset = scroll.scrollOffset.y;
|
||||
for (int frame = 0; frame < 3; frame++) yield return null;
|
||||
Assert.That(rulesOffset, Is.EqualTo(scroll.verticalScroller.highValue).Within(1), context);
|
||||
Assert.That(scroll.scrollOffset.y, Is.EqualTo(rulesOffset).Within(1), context + ": focus must not pin scrolling");
|
||||
faces[0].Blur();
|
||||
}
|
||||
Call(_view, "RefreshHand");
|
||||
for (int frame = 0; frame < 3; frame++) yield return null;
|
||||
Assert.That(_root.focusController.focusedElement, Is.SameAs(faces[0]), context);
|
||||
scroll.scrollOffset = new Vector2(scroll.scrollOffset.x, scroll.verticalScroller.highValue);
|
||||
float rulesOffset = scroll.scrollOffset.y;
|
||||
for (int frame = 0; frame < 3; frame++) yield return null;
|
||||
Assert.That(rulesOffset, Is.EqualTo(scroll.verticalScroller.highValue).Within(1), context);
|
||||
Assert.That(scroll.scrollOffset.y, Is.EqualTo(rulesOffset).Within(1), context + ": focus must not pin scrolling");
|
||||
faces[0].Blur();
|
||||
}
|
||||
Assert.That(testedOversizedCard, Is.True, "Exercise at least one card taller than the hand viewport.");
|
||||
}
|
||||
@@ -300,6 +357,113 @@ public class CombatLayoutTests
|
||||
((IDisposable)flow).Dispose(); Set(_view, "_tutorial", null);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator PythonIntroductionFitsAndLeadsToTheExistingPayloadPractice()
|
||||
{
|
||||
var cards = AssetDatabase.LoadAssetAtPath<CardDatabase>("Assets/Data/Cards/CardDatabase.asset");
|
||||
var config = TutorialCampaign.CreateConfig(_gentoo, cards, 2);
|
||||
_run.StartRun(config); Set(_combat, "_runConfig", config);
|
||||
Set(_combat, "_handController", new HandController(6));
|
||||
foreach (var card in _run.RunDeck) _combat.HandController.Add(card);
|
||||
var overlay = _root.Q(className: "overlay");
|
||||
var type = typeof(CombatSceneController).Assembly.GetType("KernelPanic.UI.TutorialFlow");
|
||||
var flow = Activator.CreateInstance(type, new object[] { overlay, _run, _combat, cards, null, null, config, (Action)(() => {}) });
|
||||
Set(_view, "_tutorial", flow);
|
||||
Set(flow, "_resuming", false);
|
||||
try
|
||||
{
|
||||
foreach (var size in Viewports)
|
||||
foreach (var textSize in new[] { UITextSize.Standard, UITextSize.Large })
|
||||
{
|
||||
UIPreferences.TextSize = textSize; Resize(size);
|
||||
Call(flow, "SetGuide", 2);
|
||||
Call(_view, "RefreshPlayer"); Call(_view, "RefreshTurnPanel");
|
||||
Call(_view, "RefreshHand"); Call(_view, "RefreshTracks"); Call(_view, "RefreshEnemies");
|
||||
var guide = _combat.TutorialGuide;
|
||||
int pages = 0;
|
||||
while (guide.Reading && pages++ < guide.Count)
|
||||
{
|
||||
type.GetMethod("Refresh").Invoke(flow, null);
|
||||
for (int frame = 0; frame < 5; frame++) yield return null;
|
||||
if (guide.Step.Id == "queue-intro" || guide.Step.Id.StartsWith("python-"))
|
||||
{
|
||||
string context = $"{guide.Step.Id}, {size}, {textSize}";
|
||||
var panel = overlay.Q("TutorialCallout");
|
||||
var next = panel.Q<Button>("TutorialNext");
|
||||
var copy = panel.Q<Label>("TutorialInstruction");
|
||||
Assert.That(copy.text, Is.EqualTo(guide.Step.Copy), context);
|
||||
AssertContainedHorizontally(panel, _root, context);
|
||||
AssertContainedHorizontally(copy, panel, context);
|
||||
AssertContainedHorizontally(next, panel, context);
|
||||
Assert.That(next.enabledInHierarchy, Is.True, context);
|
||||
Assert.That(next.worldBound.yMax, Is.LessThanOrEqualTo(_root.worldBound.yMax + 1), context);
|
||||
Assert.That(panel.Q<ScrollView>("TutorialStepScroll").contentViewport.worldBound.height, Is.GreaterThan(25), context);
|
||||
Assert.That(overlay.Q("TutorialHighlight").worldBound.width, Is.GreaterThan(20), context);
|
||||
Assert.That(panel.worldBound.Overlaps(overlay.Q("TutorialHighlight").worldBound), Is.False, context);
|
||||
}
|
||||
type.GetMethod("AdvancePage").Invoke(flow, null);
|
||||
}
|
||||
Assert.That(guide.Step.Id, Is.EqualTo("select-python"));
|
||||
Assert.That(guide.Card.Definition.Id, Is.EqualTo("lang_py_print"));
|
||||
Assert.That(guide.AllowsCard(guide.Card), Is.True);
|
||||
type.GetMethod("AdvancePage").Invoke(flow, null);
|
||||
Assert.That(guide.Step.Id, Is.EqualTo("select-python"), "Reading must lead to a real play, not skip it.");
|
||||
}
|
||||
}
|
||||
finally { ((IDisposable)flow).Dispose(); Set(_view, "_tutorial", null); }
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator OptionalLanguageStepsKeepInstructionsAndExitReachable()
|
||||
{
|
||||
var cards = AssetDatabase.LoadAssetAtPath<CardDatabase>("Assets/Data/Cards/CardDatabase.asset");
|
||||
var type = typeof(CombatSceneController).Assembly.GetType("KernelPanic.UI.TutorialFlow");
|
||||
var overlay = _root.Q(className: "overlay");
|
||||
foreach (var language in LanguageTraining.Supported)
|
||||
{
|
||||
var config = LanguageTraining.CreateConfig(language, _gentoo, cards);
|
||||
_run.StartRun(config); Set(_combat, "_runConfig", config);
|
||||
Set(_combat, "_handController", new HandController(12));
|
||||
Set(_combat, "_playerState", new CombatantState(60, 12, 6));
|
||||
foreach (var card in _run.RunDeck) _combat.HandController.Add(card);
|
||||
var enemies = (List<EnemyInstance>)_combat.Enemies;
|
||||
enemies.Clear();
|
||||
enemies.Add(new EnemyInstance(EnemyArchetypeCatalog.Get("orphan_process"), 30));
|
||||
enemies.Add(new EnemyInstance(EnemyArchetypeCatalog.Get("orphan_process"), 24));
|
||||
var flow = Activator.CreateInstance(type, new object[] { overlay, _run, _combat, cards, null, null, config, (Action)(() => {}) });
|
||||
Set(_view, "_tutorial", flow);
|
||||
try
|
||||
{
|
||||
foreach (var size in new[] { new Vector2(1280, 720), new Vector2(390, 844), new Vector2(960, 400) })
|
||||
foreach (var textSize in new[] { UITextSize.Standard, UITextSize.Large })
|
||||
{
|
||||
Resize(size); UIPreferences.TextSize = textSize;
|
||||
for (int index = 0; index < _combat.TutorialGuide.Count; index++)
|
||||
{
|
||||
var guide = _combat.TutorialGuide;
|
||||
Set(guide, "<Index>k__BackingField", index);
|
||||
Set(guide, "<Card>k__BackingField", null);
|
||||
guide.Update(_combat);
|
||||
Call(_view, "RefreshPlayer"); Call(_view, "RefreshTurnPanel");
|
||||
Call(_view, "RefreshHand"); Call(_view, "RefreshTracks"); Call(_view, "RefreshEnemies");
|
||||
type.GetMethod("Refresh").Invoke(flow, null);
|
||||
for (int frame = 0; frame < 4; frame++) yield return null;
|
||||
string context = $"{language}, {guide.Step.Id}, {size}, {textSize}";
|
||||
var panel = overlay.Q("TutorialCallout");
|
||||
var exit = panel.Q<Button>("ExitLanguageTraining");
|
||||
Assert.That(exit.enabledInHierarchy, Is.True, context);
|
||||
AssertContainedHorizontally(panel, _root, context);
|
||||
AssertContainedHorizontally(exit, panel, context);
|
||||
Assert.That(exit.worldBound.yMax, Is.LessThanOrEqualTo(panel.worldBound.yMax + 1), context);
|
||||
Assert.That(panel.Q<ScrollView>("TutorialStepScroll").contentViewport.worldBound.height, Is.GreaterThan(15), context);
|
||||
Assert.That(panel.Q<Label>("TutorialInstruction").text, Is.EqualTo(guide.Step.Copy), context);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally { ((IDisposable)flow).Dispose(); Set(_view, "_tutorial", null); }
|
||||
}
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator GuidedCardIsFullyVisibleOnNarrowScreensAndCannotBeSkipped()
|
||||
{
|
||||
@@ -330,6 +494,56 @@ public class CombatLayoutTests
|
||||
((IDisposable)flow).Dispose(); Set(_view, "_tutorial", null);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator RepositoryPreviewsStayInsideOffersWithLongPythonRules()
|
||||
{
|
||||
var database = AssetDatabase.LoadAssetAtPath<CardDatabase>("Assets/Data/Cards/CardDatabase.asset");
|
||||
var offers = (List<RepositoryOffer>)typeof(RunManager).GetField("_repositoryOffers", Private).GetValue(_run);
|
||||
offers.Clear();
|
||||
offers.Add(RepositoryOffer.NewCard(database.FindById("mint_timeshift"), 2));
|
||||
offers.Add(RepositoryOffer.CardUpgrade(new CardInstance(database.FindById("mint_cinnamon")), CardUpgradeKind.MagnitudeUp, 2));
|
||||
offers.Add(RepositoryOffer.StatUpgrade(RunStatUpgradeKind.MaxCycles, 3));
|
||||
offers.Add(RepositoryOffer.NewCard(database.FindById("lang_py_print"), 2));
|
||||
offers.Add(RepositoryOffer.NewCard(database.FindById("ubuntu_snap_install"), 2));
|
||||
foreach (var size in Viewports)
|
||||
foreach (var textSize in new[] { UITextSize.Standard, UITextSize.Large })
|
||||
{
|
||||
UIPreferences.TextSize = textSize;
|
||||
Resize(size);
|
||||
var overlay = _root.Q(className: "overlay");
|
||||
overlay.Clear(); overlay.style.display = DisplayStyle.Flex;
|
||||
overlay.Add((VisualElement)Call(_view, "BuildRepositoryView"));
|
||||
for (int frame = 0; frame < 6; frame++) yield return null;
|
||||
string context = $"{size}, {textSize}";
|
||||
var repository = overlay.Q(className: "repository");
|
||||
var scroll = repository.Q<ScrollView>(className: "repository-body");
|
||||
var tiles = repository.Query(className: "repository-tile").ToList();
|
||||
Assert.That(tiles.Count, Is.EqualTo(5));
|
||||
foreach (var tile in tiles)
|
||||
{
|
||||
AssertContainedHorizontally(tile, scroll.contentViewport, context);
|
||||
var face = tile.Q(className: "software-card");
|
||||
if (face != null)
|
||||
{
|
||||
AssertContainedHorizontally(face, face.parent, context + ": preview stays within its content column");
|
||||
Assert.That(face.resolvedStyle.marginRight, Is.Zero, context);
|
||||
foreach (var label in face.Query<Label>().ToList())
|
||||
AssertContainedHorizontally(label, face, context + ": " + label.text);
|
||||
}
|
||||
var action = tile.Q<Button>(className: "repository-action");
|
||||
var content = tile.ElementAt(1);
|
||||
Assert.That(action.worldBound.yMin, Is.GreaterThanOrEqualTo(content.worldBound.yMax - 1), context);
|
||||
AssertContainedHorizontally(action, tile, context);
|
||||
scroll.ScrollTo(action);
|
||||
for (int frame = 0; frame < 2; frame++) yield return null;
|
||||
Assert.That(action.worldBound.yMax, Is.LessThanOrEqualTo(scroll.contentViewport.worldBound.yMax + 1), context);
|
||||
}
|
||||
var footer = repository.Q(className: "repository-footer");
|
||||
Assert.That(footer.worldBound.yMax, Is.LessThanOrEqualTo(_root.worldBound.yMax + 1), context);
|
||||
LogAssert.NoUnexpectedReceived();
|
||||
}
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator VictoryUsesSuccessColourAndExplainsAnUnavailableResumedRecap()
|
||||
{
|
||||
@@ -898,6 +1112,26 @@ public class CombatLayoutTests
|
||||
Assert.That(textWidth, Is.LessThanOrEqualTo(label.contentRect.width + 2), context + ": " + label.text);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator PythonQueueKeepsVisibleCardsOnNarrowScreens()
|
||||
{
|
||||
var cards = AssetDatabase.LoadAssetAtPath<CardDatabase>("Assets/Data/Cards/CardDatabase.asset");
|
||||
foreach (string id in new[] { "shop_py_async_def", "lang_py_for_loop", "lang_py_print", "mint_cinnamon" })
|
||||
_combat.InterpreterQueue.Enqueue(new CardInstance(cards.FindById(id)));
|
||||
foreach (var textSize in new[] { UITextSize.Standard, UITextSize.Large })
|
||||
{
|
||||
Resize(new Vector2(390, 844)); UIPreferences.TextSize = textSize;
|
||||
Call(_view, "RefreshTracks");
|
||||
for (int frame = 0; frame < 6; frame++) yield return null;
|
||||
var queue = _root.Q("TutorialQueue");
|
||||
var scroll = queue.GetFirstAncestorOfType<ScrollView>();
|
||||
Assert.That(scroll.contentViewport.worldBound.width, Is.GreaterThan(200), textSize.ToString());
|
||||
AssertContainedHorizontally(scroll.contentViewport, _root, textSize.ToString());
|
||||
Assert.That(queue.Query(className: "card-chip").ToList().Any(chip =>
|
||||
chip.worldBound.Overlaps(scroll.contentViewport.worldBound)), Is.True, "Queued combo must be visible.");
|
||||
}
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator PendingStackTooltipsUseCapturedMultipliersAndCurrentCompilation()
|
||||
{
|
||||
@@ -962,8 +1196,16 @@ public class CombatLayoutTests
|
||||
var preview = face.Q<Label>(className: "software-live-preview");
|
||||
Assert.That(preview, Is.Not.Null, context);
|
||||
AssertContainedHorizontally(preview, face, context);
|
||||
Assert.That(preview.text, Does.StartWith("preview:"), context);
|
||||
Assert.That(face.tooltip, Is.EqualTo("Current estimate; targets, defenses and later effects can change the result."), context);
|
||||
var expected = CardPreviewService.Build(_combat, (CardInstance)face.userData);
|
||||
Assert.That(preview.text, Is.EqualTo(expected.Summary), context);
|
||||
var critical = face.Q<Label>(className: "software-live-crit");
|
||||
if (!string.IsNullOrEmpty(expected.CriticalSummary))
|
||||
{
|
||||
Assert.That(critical.text, Is.EqualTo(expected.CriticalSummary), context);
|
||||
AssertContainedHorizontally(critical, face, context);
|
||||
Assert.That(critical.worldBound.yMin, Is.GreaterThanOrEqualTo(preview.worldBound.yMax), context);
|
||||
}
|
||||
Assert.That(face.tooltip, Is.EqualTo("Based on the current setup. Targets, defenses and later effects can change the result."), context);
|
||||
Assert.That(face.tooltip.Length, Is.LessThan(160), "Hover help must not repeat the full calculation breakdown.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,9 +155,9 @@ public class GentooHaskellTests
|
||||
[Test]
|
||||
public void RegistriesContainOnlyRealDefinitionsIncludingTheTwoRepairedPythonCards()
|
||||
{
|
||||
Assert.That(_cards.AllCards, Has.Count.EqualTo(65));
|
||||
Assert.That(_cards.AllCards, Has.Count.EqualTo(81));
|
||||
Assert.That(_cards.AllCards.All(c => c != null), Is.True);
|
||||
Assert.That(_cards.AllCards.Select(c => c.Id).Distinct().Count(), Is.EqualTo(65));
|
||||
Assert.That(_cards.AllCards.Select(c => c.Id).Distinct().Count(), Is.EqualTo(81));
|
||||
Assert.That(Card("shop_py_list_append").Definition.DisplayName, Is.Not.Empty);
|
||||
Assert.That(Card("shop_py_async_def").Definition.DisplayName, Is.Not.Empty);
|
||||
var distros = Asset<DistroDatabase>("Assets/Data/Distros/DistroDatabase.asset");
|
||||
|
||||
@@ -89,14 +89,14 @@ public class GentooProgressionTests
|
||||
public void StandardPoolsRatesSelectorAndPaymentRemainCorrect()
|
||||
{
|
||||
var service=Service();
|
||||
CollectionAssert.AreEquivalent(new[]{"arch","gentoo"},service.GetStandardFiveStarCharacterChoices().Select(d=>d.Id));
|
||||
CollectionAssert.AreEquivalent(new[]{"arch","gentoo","nixos"},service.GetStandardFiveStarCharacterChoices().Select(d=>d.Id));
|
||||
Assert.That(GachaService.GetFiveStarChance(0),Is.EqualTo(.008d));
|
||||
Assert.That(GachaService.GetFiveStarChance(65),Is.EqualTo(.078d).Within(.000001));
|
||||
Assert.That(GachaService.GetFiveStarChance(79),Is.EqualTo(1d));
|
||||
var pull=service.PerformStandardPull(10,null,PullPaymentSource.Commits);
|
||||
Assert.That(pull.Rewards.Count,Is.EqualTo(10));
|
||||
Assert.That(service.Commits,Is.EqualTo(90));
|
||||
Assert.That(pull.Rewards.All(r=>r.Distro==Gentoo&&r.StarRating==5),Is.True);
|
||||
Assert.That(pull.Rewards.All(r=>r.Distro==service.GetStandardFiveStarCharacterChoices().Last()&&r.StarRating==5),Is.True);
|
||||
Assert.That(GachaService.IsBeginnerInstallMediaDistro(Gentoo),Is.True);
|
||||
Assert.That(GachaService.IsBeginnerStarterDistro(Gentoo),Is.False);
|
||||
Assert.That(DistroRarity.Stars(Asset<DistroDefinition>("Assets/Data/Distros/Ubuntu.asset")),Is.EqualTo(4));
|
||||
@@ -108,7 +108,7 @@ public class GentooProgressionTests
|
||||
var service=Service();
|
||||
GachaPullResult last=default;
|
||||
for(int i=0;i<5;i++) last=service.PerformBeginnerPull(10);
|
||||
Assert.That(last.Rewards[9].Distro,Is.SameAs(Gentoo));
|
||||
Assert.That(last.Rewards[9].Distro,Is.SameAs(service.GetStandardFiveStarCharacterChoices().Last()));
|
||||
Assert.That(last.Rewards[9].StarRating,Is.EqualTo(5));
|
||||
Assert.That(last.Rewards[9].Guaranteed,Is.True);
|
||||
Assert.That(service.Commits,Is.EqualTo(60));
|
||||
|
||||
@@ -82,6 +82,8 @@ public class RunInsightTests
|
||||
Assert.That(view.Q<ScrollView>("PileCards").contentContainer.Contains(grid), Is.True);
|
||||
Assert.That(grid.Query(className: "pile-card").ToList(), Has.Count.EqualTo(1));
|
||||
string inlineRules = string.Join(" ", grid.Q(className: "software-body").Query<Label>().ToList().Select(label => label.text));
|
||||
var role = grid.Q<Label>(className: "software-python-role");
|
||||
if (role != null) inlineRules = role.text.ToLowerInvariant() + ": " + inlineRules;
|
||||
Assert.That(inlineRules, Is.EqualTo(CardEffectFactory.GetRulesText(card) + " Draw 1."),
|
||||
"Reading full rules must not require hover or playing a card.");
|
||||
// TextField change callbacks are dispatched by an attached panel. The viewport/focus
|
||||
|
||||
@@ -460,8 +460,10 @@ public class TerminalUiTests
|
||||
var face = new VisualElement();
|
||||
populate.Invoke(null, new object[] { face, instance, CombatManager.GetCardCost(instance) });
|
||||
string rules = face.Q<Label>(className: "software-effect").text;
|
||||
var conditions = face.Q<Label>(className: "software-conditions");
|
||||
if (conditions != null) rules += " " + conditions.text;
|
||||
foreach (var conditions in face.Query<Label>(className: "software-conditions").ToList())
|
||||
rules += " " + conditions.text;
|
||||
var role = face.Q<Label>(className: "software-python-role");
|
||||
if (role != null) rules = role.text.ToLowerInvariant() + ": " + rules;
|
||||
Assert.That(rules, Is.EqualTo(CardEffectFactory.GetRulesText(instance)), definition.name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user