diff --git a/.idea/.idea.linuxdistrosbuttheyarebreedable/.idea/workspace.xml b/.idea/.idea.linuxdistrosbuttheyarebreedable/.idea/workspace.xml index 4254192..e020485 100644 --- a/.idea/.idea.linuxdistrosbuttheyarebreedable/.idea/workspace.xml +++ b/.idea/.idea.linuxdistrosbuttheyarebreedable/.idea/workspace.xml @@ -11,27 +11,73 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + - - - @@ -76,6 +121,7 @@ + @@ -107,6 +153,7 @@ + {} { @@ -119,23 +166,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -147,33 +194,33 @@ - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + { @@ -557,7 +604,6 @@ diff --git a/Assets/Data/Cards/CardDatabase.asset b/Assets/Data/Cards/CardDatabase.asset index e8ab053..58414a8 100644 --- a/Assets/Data/Cards/CardDatabase.asset +++ b/Assets/Data/Cards/CardDatabase.asset @@ -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} diff --git a/Assets/Data/Cards/Languages/GoDeck.asset b/Assets/Data/Cards/Languages/GoDeck.asset new file mode 100644 index 0000000..ba15ce8 --- /dev/null +++ b/Assets/Data/Cards/Languages/GoDeck.asset @@ -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 diff --git a/Assets/Data/Cards/Languages/GoDeck.asset.meta b/Assets/Data/Cards/Languages/GoDeck.asset.meta new file mode 100644 index 0000000..0665ae0 --- /dev/null +++ b/Assets/Data/Cards/Languages/GoDeck.asset.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 295ea82e590f4338aa7a8e30c2132f68 diff --git a/Assets/Data/Cards/Languages/HaskellFoldr.asset.meta b/Assets/Data/Cards/Languages/HaskellFoldr.asset.meta deleted file mode 100644 index e4e9ebb..0000000 --- a/Assets/Data/Cards/Languages/HaskellFoldr.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b821fa56a5034b9bbd3a000000000007 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Data/Cards/Languages/HaskellMap.asset.meta b/Assets/Data/Cards/Languages/HaskellMap.asset.meta deleted file mode 100644 index 953b4af..0000000 --- a/Assets/Data/Cards/Languages/HaskellMap.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b821fa56a5034b9bbd3a000000000006 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Data/Cards/Languages/HaskellThunk.asset.meta b/Assets/Data/Cards/Languages/HaskellThunk.asset.meta deleted file mode 100644 index a2aa3d9..0000000 --- a/Assets/Data/Cards/Languages/HaskellThunk.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b821fa56a5034b9bbd3a000000000008 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Data/Cards/Languages/LanguageDeckDatabase.asset b/Assets/Data/Cards/Languages/LanguageDeckDatabase.asset index be873f2..adbfae5 100644 --- a/Assets/Data/Cards/Languages/LanguageDeckDatabase.asset +++ b/Assets/Data/Cards/Languages/LanguageDeckDatabase.asset @@ -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} diff --git a/Assets/Data/Cards/NixOS.meta b/Assets/Data/Cards/NixOS.meta new file mode 100644 index 0000000..169d770 --- /dev/null +++ b/Assets/Data/Cards/NixOS.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 34b8afda4d2d4a06b79f2a1dd42d49d0 +folderAsset: yes diff --git a/Assets/Data/Cards/Languages/HaskellMap.asset b/Assets/Data/Cards/NixOS/nixos_flake_update.asset similarity index 68% rename from Assets/Data/Cards/Languages/HaskellMap.asset rename to Assets/Data/Cards/NixOS/nixos_flake_update.asset index 40367b2..f3df937 100644 --- a/Assets/Data/Cards/Languages/HaskellMap.asset +++ b/Assets/Data/Cards/NixOS/nixos_flake_update.asset @@ -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: [] diff --git a/Assets/Data/Cards/NixOS/nixos_flake_update.asset.meta b/Assets/Data/Cards/NixOS/nixos_flake_update.asset.meta new file mode 100644 index 0000000..2a94d2b --- /dev/null +++ b/Assets/Data/Cards/NixOS/nixos_flake_update.asset.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 80750fabd5a64788941008ab5a971846 diff --git a/Assets/Data/Cards/NixOS/nixos_nix_shell.asset b/Assets/Data/Cards/NixOS/nixos_nix_shell.asset new file mode 100644 index 0000000..2708862 --- /dev/null +++ b/Assets/Data/Cards/NixOS/nixos_nix_shell.asset @@ -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: [] diff --git a/Assets/Data/Cards/NixOS/nixos_nix_shell.asset.meta b/Assets/Data/Cards/NixOS/nixos_nix_shell.asset.meta new file mode 100644 index 0000000..61584be --- /dev/null +++ b/Assets/Data/Cards/NixOS/nixos_nix_shell.asset.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: ee0a8100d13b4b9b83d886693d2382a4 diff --git a/Assets/Data/Cards/Languages/HaskellThunk.asset b/Assets/Data/Cards/NixOS/nixos_rebuild_switch_card.asset similarity index 63% rename from Assets/Data/Cards/Languages/HaskellThunk.asset rename to Assets/Data/Cards/NixOS/nixos_rebuild_switch_card.asset index b61b23b..f1cc496 100644 --- a/Assets/Data/Cards/Languages/HaskellThunk.asset +++ b/Assets/Data/Cards/NixOS/nixos_rebuild_switch_card.asset @@ -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: [] diff --git a/Assets/Data/Cards/NixOS/nixos_rebuild_switch_card.asset.meta b/Assets/Data/Cards/NixOS/nixos_rebuild_switch_card.asset.meta new file mode 100644 index 0000000..0c702e5 --- /dev/null +++ b/Assets/Data/Cards/NixOS/nixos_rebuild_switch_card.asset.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0429ceda41be4c8fb66a7b32b2a9f4af diff --git a/Assets/Data/Cards/NixOS/nixos_rollback.asset b/Assets/Data/Cards/NixOS/nixos_rollback.asset new file mode 100644 index 0000000..5426647 --- /dev/null +++ b/Assets/Data/Cards/NixOS/nixos_rollback.asset @@ -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: [] diff --git a/Assets/Data/Cards/NixOS/nixos_rollback.asset.meta b/Assets/Data/Cards/NixOS/nixos_rollback.asset.meta new file mode 100644 index 0000000..03678df --- /dev/null +++ b/Assets/Data/Cards/NixOS/nixos_rollback.asset.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b28c0877ca3a4268a1dd023bc42f9b0d diff --git a/Assets/Data/Cards/Languages/HaskellFoldr.asset b/Assets/Data/Cards/NixOS/nixos_store_gc.asset similarity index 66% rename from Assets/Data/Cards/Languages/HaskellFoldr.asset rename to Assets/Data/Cards/NixOS/nixos_store_gc.asset index e49647c..20c09e3 100644 --- a/Assets/Data/Cards/Languages/HaskellFoldr.asset +++ b/Assets/Data/Cards/NixOS/nixos_store_gc.asset @@ -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: [] diff --git a/Assets/Data/Cards/NixOS/nixos_store_gc.asset.meta b/Assets/Data/Cards/NixOS/nixos_store_gc.asset.meta new file mode 100644 index 0000000..e8858f2 --- /dev/null +++ b/Assets/Data/Cards/NixOS/nixos_store_gc.asset.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9d5da88a689a452e80f6de49b759d370 diff --git a/Assets/Data/Distros/Art/nixos.txt b/Assets/Data/Distros/Art/nixos.txt new file mode 100644 index 0000000..d24512f --- /dev/null +++ b/Assets/Data/Distros/Art/nixos.txt @@ -0,0 +1,11 @@ + \\ \\ // + \\ \\ // + =======\\==\\=// + // \\ \\ // + // \\ \\ // + //========\\==\\=// + // \\ // // + // \\ // // + \\=//==//======= + // // + // // diff --git a/Assets/Data/Distros/Art/nixos.txt.meta b/Assets/Data/Distros/Art/nixos.txt.meta new file mode 100644 index 0000000..66f4c92 --- /dev/null +++ b/Assets/Data/Distros/Art/nixos.txt.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 461d8381113c4e68873cc61938e6cd57 diff --git a/Assets/Data/Distros/DistroDatabase.asset b/Assets/Data/Distros/DistroDatabase.asset index a8040f2..12ae569 100644 --- a/Assets/Data/Distros/DistroDatabase.asset +++ b/Assets/Data/Distros/DistroDatabase.asset @@ -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} diff --git a/Assets/Data/Distros/NixOS.asset b/Assets/Data/Distros/NixOS.asset new file mode 100644 index 0000000..7a58346 --- /dev/null +++ b/Assets/Data/Distros/NixOS.asset @@ -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} diff --git a/Assets/Data/Distros/NixOS.asset.meta b/Assets/Data/Distros/NixOS.asset.meta new file mode 100644 index 0000000..93eb3b5 --- /dev/null +++ b/Assets/Data/Distros/NixOS.asset.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 443f930bf2e448bc863a6b462a2d60fd diff --git a/Assets/Data/Passives/NixRebuildSwitch.asset b/Assets/Data/Passives/NixRebuildSwitch.asset new file mode 100644 index 0000000..ceee309 --- /dev/null +++ b/Assets/Data/Passives/NixRebuildSwitch.asset @@ -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." diff --git a/Assets/Data/Passives/NixRebuildSwitch.asset.meta b/Assets/Data/Passives/NixRebuildSwitch.asset.meta new file mode 100644 index 0000000..dcd45dd --- /dev/null +++ b/Assets/Data/Passives/NixRebuildSwitch.asset.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b7fb0d7714cd44af9554d3fe8df88081 diff --git a/Assets/Editor/BalanceComparison.cs b/Assets/Editor/BalanceComparison.cs index bd6a8df..db51585 100644 --- a/Assets/Editor/BalanceComparison.cs +++ b/Assets/Editor/BalanceComparison.cs @@ -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++; diff --git a/Assets/Editor/Tests/BalanceComparisonTests.cs b/Assets/Editor/Tests/BalanceComparisonTests.cs index 0b554a7..6c0e0f9 100644 --- a/Assets/Editor/Tests/BalanceComparisonTests.cs +++ b/Assets/Editor/Tests/BalanceComparisonTests.cs @@ -41,7 +41,7 @@ public class BalanceComparisonTests var languages = AssetDatabase.LoadAssetAtPath("Assets/Data/Cards/Languages/LanguageDeckDatabase.asset"); var packages = AssetDatabase.LoadAssetAtPath("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("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] diff --git a/Assets/Resources/KernelTheme.uss b/Assets/Resources/KernelTheme.uss index 796d6ba..0b09da7 100644 --- a/Assets/Resources/KernelTheme.uss +++ b/Assets/Resources/KernelTheme.uss @@ -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); } diff --git a/Assets/Scripts/Combat/CardCatalog.cs b/Assets/Scripts/Combat/CardCatalog.cs index b95ceac..b73e76a 100644 --- a/Assets/Scripts/Combat/CardCatalog.cs +++ b/Assets/Scripts/Combat/CardCatalog.cs @@ -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 } /// @@ -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(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); diff --git a/Assets/Scripts/Combat/CardPreviewService.cs b/Assets/Scripts/Combat/CardPreviewService.cs index e955a3e..72c2d49 100644 --- a/Assets/Scripts/Combat/CardPreviewService.cs +++ b/Assets/Scripts/Combat/CardPreviewService.cs @@ -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(); - 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}"; diff --git a/Assets/Scripts/Combat/CombatContext.cs b/Assets/Scripts/Combat/CombatContext.cs index 8f16470..e3fe716 100644 --- a/Assets/Scripts/Combat/CombatContext.cs +++ b/Assets/Scripts/Combat/CombatContext.cs @@ -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); } } diff --git a/Assets/Scripts/Combat/CombatManager.cs b/Assets/Scripts/Combat/CombatManager.cs index 1a0b289..054da54 100644 --- a/Assets/Scripts/Combat/CombatManager.cs +++ b/Assets/Scripts/Combat/CombatManager.cs @@ -14,7 +14,7 @@ namespace KernelPanic.Combat /// /// Owns the combat turn phase state machine and coordinates combat lifecycle transitions. /// - 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(); _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[] 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) diff --git a/Assets/Scripts/Combat/CombatantState.cs b/Assets/Scripts/Combat/CombatantState.cs index 88ea256..c94e16b 100644 --- a/Assets/Scripts/Combat/CombatantState.cs +++ b/Assets/Scripts/Combat/CombatantState.cs @@ -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; diff --git a/Assets/Scripts/Combat/DamagePipeline.cs b/Assets/Scripts/Combat/DamagePipeline.cs index db1986b..8409586 100644 --- a/Assets/Scripts/Combat/DamagePipeline.cs +++ b/Assets/Scripts/Combat/DamagePipeline.cs @@ -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)); } diff --git a/Assets/Scripts/Combat/DeckController.cs b/Assets/Scripts/Combat/DeckController.cs index 733a3db..8aac0cf 100644 --- a/Assets/Scripts/Combat/DeckController.cs +++ b/Assets/Scripts/Combat/DeckController.cs @@ -70,6 +70,12 @@ namespace KernelPanic.Combat return drawn; } + public void InitializeInDrawOrder(IEnumerable cards) + { + _drawPile.Clear(); _discardPile.Clear(); _exhaustPile.Clear(); + if (cards != null) _drawPile.AddRange(cards.Where(card => card != null).Reverse()); + } + /// /// 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. diff --git a/Assets/Scripts/Combat/ExecutionPreview.cs b/Assets/Scripts/Combat/ExecutionPreview.cs index 88a9618..90b74eb 100644 --- a/Assets/Scripts/Combat/ExecutionPreview.cs +++ b/Assets/Scripts/Combat/ExecutionPreview.cs @@ -10,7 +10,10 @@ namespace KernelPanic.Combat { var lines = new List(); 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; diff --git a/Assets/Scripts/Core/ResolutionTrack.cs b/Assets/Scripts/Core/ResolutionTrack.cs index fdd750d..5a59997 100644 --- a/Assets/Scripts/Core/ResolutionTrack.cs +++ b/Assets/Scripts/Core/ResolutionTrack.cs @@ -7,6 +7,7 @@ namespace KernelPanic.Core { Native, InterpreterQueue, - LazyStack + LazyStack, + Goroutine } } diff --git a/Assets/Scripts/Data/DistroRarity.cs b/Assets/Scripts/Data/DistroRarity.cs index 7acbdfd..3135631 100644 --- a/Assets/Scripts/Data/DistroRarity.cs +++ b/Assets/Scripts/Data/DistroRarity.cs @@ -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; } } diff --git a/Assets/Scripts/Data/LanguageCatalog.cs b/Assets/Scripts/Data/LanguageCatalog.cs index 8f7d278..85ef0cb 100644 --- a/Assets/Scripts/Data/LanguageCatalog.cs +++ b/Assets/Scripts/Data/LanguageCatalog.cs @@ -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")), }; diff --git a/Assets/Scripts/Meta/DistroVersionCatalog.cs b/Assets/Scripts/Meta/DistroVersionCatalog.cs index 27151f9..56affcb 100644 --- a/Assets/Scripts/Meta/DistroVersionCatalog.cs +++ b/Assets/Scripts/Meta/DistroVersionCatalog.cs @@ -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%", diff --git a/Assets/Scripts/Run/PlayerSmokeRunner.cs b/Assets/Scripts/Run/PlayerSmokeRunner.cs index 85ce4f9..d22ec59 100644 --- a/Assets/Scripts/Run/PlayerSmokeRunner.cs +++ b/Assets/Scripts/Run/PlayerSmokeRunner.cs @@ -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(); 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(menu, "distroDatabase").FindById("nixos"); + Field(menu, "collectionScreen").ShowUnitDetail(nix, true); + var capture = CapturePanel(menu.GetComponent(), "nixos-collection"); + while (capture.MoveNext()) yield return capture.Current; + RunContext.Set(nix, nix.ExclusiveCards.Take(4).ToArray(), Array.Empty(), Language.Haskell, Language.Go, 5, 73129); + SceneLoader.LoadGame(menu.GetComponent().rootVisualElement); + CombatManager combat = null; + while (combat == null || !combat.CanSurrenderRun) { yield return null; combat = FindFirstObjectByType(); } + var view = FindFirstObjectByType(); var document = view.GetComponent(); var root = document.rootVisualElement; + Require(combat.GetComponent().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