This commit is contained in:
Michal Vrba
2026-09-16 22:20:44 +02:00
commit 121d013d14
53 changed files with 10410 additions and 0 deletions
+174
View File
@@ -0,0 +1,174 @@
@page "/"
@using SlaySharp.Core.Combat
@using SlaySharp.Core.Models
@using SlaySharp.Core.Catalogs
@using SlaySharp.Core.Relics
@using SlaySharp.Web.Components
<PageTitle>SlaySharp - Visual Studio Code Edition</PageTitle>
@if (_engine == null || !_gameStarted)
{
<!-- VS Code Welcome / Get Started Dashboard -->
<div class="container-fluid h-100 p-4 d-flex flex-column overflow-y-auto font-mono" style="background-color: var(--vscode-bg-editor);">
<!-- Welcome Header -->
<div class="mb-4 pb-3 border-bottom border-secondary">
<div class="d-flex align-items-center gap-3 mb-1">
<span style="font-size: 3rem; color: #007acc;">⚔️</span>
<div>
<h1 class="text-white fw-bolder mb-0" style="font-size: 2.4rem; letter-spacing: -1px;">
SlaySharp <span style="color: #61afef; font-size: 1.4rem;">v1.0</span>
</h1>
<span class="text-muted" style="font-size: 1rem; font-weight: 800;">
C# & .NET Roguelike Deckbuilder
</span>
</div>
</div>
</div>
<div class="row g-4">
<!-- Left Column: Start Debugging Incidents -->
<div class="col-lg-7">
<h4 class="text-white mb-3 d-flex align-items-center gap-2 fw-bold">
<span style="color: #61afef; font-size: 1.5rem;">🐞</span>
<span>Start Incident Session</span>
</h4>
<div class="d-flex flex-column gap-3">
<!-- Config 1 -->
<div class="card p-4 shadow-sm" style="background-color: #21252b; border: 2px solid #383e4a; border-radius: 12px; cursor: pointer; transition: all 0.2s ease;"
@onclick="() => StartEncounter(EncounterType.Standard)">
<div class="d-flex justify-content-between align-items-center mb-2">
<span class="text-danger fw-bolder fs-5">💥 [SEV-1] NullReference & Off-By-One</span>
<span class="badge bg-danger text-white fs-6 px-3 py-2">Launch (F5) ➔</span>
</div>
<p class="text-white mb-0" style="font-size: 0.92rem; font-weight: 700;">
Patch NullReferenceException (45 HP) and Off-By-One Bug (22 HP). Keep SLA at 100%.
</p>
</div>
<!-- Config 2 -->
<div class="card p-4 shadow-sm" style="background-color: #21252b; border: 2px solid #383e4a; border-radius: 12px; cursor: pointer; transition: all 0.2s ease;"
@onclick="() => StartEncounter(EncounterType.MemoryLeak)">
<div class="d-flex justify-content-between align-items-center mb-2">
<span class="text-warning fw-bolder fs-5">👻 [SEV-2] Memory Leak Spectre</span>
<span class="badge bg-warning text-dark fs-6 px-3 py-2">Launch (F5) ➔</span>
</div>
<p class="text-white mb-0" style="font-size: 0.92rem; font-weight: 700;">
Dispose dangling unmanaged event handlers from Memory Leak Spectre (34 HP).
</p>
</div>
<!-- Config 3 -->
<div class="card p-4 shadow-sm" style="background-color: #21252b; border: 2px solid #383e4a; border-radius: 12px; cursor: pointer; transition: all 0.2s ease;"
@onclick="() => StartEncounter(EncounterType.Chaos)">
<div class="d-flex justify-content-between align-items-center mb-2">
<span class="text-info fw-bolder fs-5">🔥 [SEV-0] Friday 5 PM Outage</span>
<span class="badge bg-primary text-white fs-6 px-3 py-2">Launch (F5) ➔</span>
</div>
<p class="text-white mb-0" style="font-size: 0.92rem; font-weight: 700;">
Critical Outage: Face NullReferenceException and Memory Leak Spectre simultaneously.
</p>
</div>
</div>
</div>
<!-- Right Column: Workspace & Diagnostics Configuration -->
<div class="col-lg-5">
<h4 class="text-white mb-3 d-flex align-items-center gap-2 fw-bold">
<span style="color: #56b6c2; font-size: 1.5rem;">⚙️</span>
<span>Active Profile</span>
</h4>
<div class="card p-4 mb-3" style="background-color: #21252b; border: 2px solid #383e4a; border-radius: 12px;">
<div class="d-flex align-items-center gap-2 mb-3">
<span style="font-size: 2.2rem;">👨‍💻</span>
<div>
<div class="text-info fw-bolder fs-5">Principal .NET Architect</div>
<div class="text-white" style="font-size: 0.85rem; font-weight: 800;">3 CPU Cycles / 70 SLA HP</div>
</div>
</div>
<div class="text-muted fw-bold mb-1" style="font-size: 0.78rem;">INSTALLED NUGETS:</div>
<div class="d-flex flex-column gap-2 mb-2">
<div class="badge bg-dark border border-secondary text-white p-2 d-flex align-items-center justify-content-between" style="font-size: 0.85rem; font-weight: 800;">
<span>📜 Newtonsoft.Json</span>
<span class="text-info">+1 Card T1</span>
</div>
<div class="badge bg-dark border border-secondary text-white p-2 d-flex align-items-center justify-content-between" style="font-size: 0.85rem; font-weight: 800;">
<span>⚡ BenchmarkDotNet</span>
<span class="text-warning">+1 CPU / 2T</span>
</div>
<div class="badge bg-dark border border-secondary text-white p-2 d-flex align-items-center justify-content-between" style="font-size: 0.85rem; font-weight: 800;">
<span>📊 Serilog</span>
<span class="text-success">+2 Shield on Attack</span>
</div>
</div>
</div>
<div class="card p-3" style="background-color: #21252b; border: 2px solid #383e4a; border-radius: 12px;">
<div class="text-white fw-bolder mb-2" style="font-size: 0.88rem;">CONTROLS</div>
<div class="d-flex justify-content-between text-white" style="font-size: 0.85rem; font-weight: 800;">
<span>Play Card</span>
<span class="badge bg-dark border border-secondary text-light">Click Card</span>
</div>
<div class="d-flex justify-content-between text-white mt-1" style="font-size: 0.85rem; font-weight: 800;">
<span>Target Bug</span>
<span class="badge bg-dark border border-secondary text-light">Click Bug</span>
</div>
<div class="d-flex justify-content-between text-white mt-1" style="font-size: 0.85rem; font-weight: 800;">
<span>End Turn</span>
<span class="badge bg-success text-white">F5 / Click Button</span>
</div>
</div>
</div>
</div>
</div>
}
else
{
<!-- Live VS Code Combat Workspace -->
<CombatArena Engine="@_engine" OnRestartRequested="HandleRestartRequested" />
}
@code {
private CombatEngine? _engine;
private bool _gameStarted = false;
private EncounterType _lastEncounterType = EncounterType.Standard;
private enum EncounterType
{
Standard,
MemoryLeak,
Chaos
}
private void StartEncounter(EncounterType type)
{
_lastEncounterType = type;
var player = new Player("Senior Dev", 70, maxEnergy: 3);
player.MasterDeck.AddRange(StarterDecks.CreateCsharpArchitectDeck());
// Add starter NuGets (Relics)
player.Relics.Add(new NewtonsoftJsonRelic());
player.Relics.Add(new BenchmarkDotNetRelic());
player.Relics.Add(new SerilogRelic());
var enemies = type switch
{
EncounterType.Standard => new List<Enemy> { new NullReferenceExceptionEnemy(), new OffByOneBugEnemy() },
EncounterType.MemoryLeak => new List<Enemy> { new MemoryLeakSpectreEnemy(), new OffByOneBugEnemy() },
EncounterType.Chaos => new List<Enemy> { new NullReferenceExceptionEnemy(), new MemoryLeakSpectreEnemy() },
_ => new List<Enemy> { new NullReferenceExceptionEnemy() }
};
_engine = new CombatEngine();
_engine.StartCombat(player, enemies);
_gameStarted = true;
}
private void HandleRestartRequested()
{
_gameStarted = false;
}
}