Adding vibe mana curve
This commit is contained in:
@@ -38,6 +38,22 @@
|
||||
<small class="text-danger ms-2 d-block d-md-inline">@deck.ValidationMessage</small>
|
||||
}
|
||||
</div>
|
||||
|
||||
@{
|
||||
var distribution = GetManaDistribution();
|
||||
var maxCount = distribution.Max(x => x.Count);
|
||||
}
|
||||
<div class="mana-curve">
|
||||
@foreach (var entry in distribution)
|
||||
{
|
||||
var height = maxCount > 0 ? (entry.Count * 100 / maxCount) : 0;
|
||||
<div class="mana-bar-container">
|
||||
<div class="mana-bar-label">@entry.Count</div>
|
||||
<div class="mana-bar" style="height: @($"{Math.Max(height, 5)}%")"></div>
|
||||
<div class="mana-cost">@(entry.Cost >= 10 ? "10+" : entry.Cost.ToString())</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@if (deck.Keycards.Count > 0)
|
||||
@@ -274,6 +290,26 @@
|
||||
selectedCard = null;
|
||||
}
|
||||
|
||||
private List<(int Cost, int Count)> GetManaDistribution()
|
||||
{
|
||||
if (deck == null) return [];
|
||||
var counts = new Dictionary<int, int>();
|
||||
for (int i = 0; i <= 10; i++) counts[i] = 0;
|
||||
|
||||
foreach (var cardName in deck.Cards)
|
||||
{
|
||||
var card = LookupCard(cardName);
|
||||
if (card?.Cost != null)
|
||||
{
|
||||
var cost = card.Cost.Value;
|
||||
if (cost >= 10) cost = 10;
|
||||
counts[cost]++;
|
||||
}
|
||||
}
|
||||
|
||||
return counts.OrderBy(x => x.Key).Select(x => (x.Key, x.Value)).ToList();
|
||||
}
|
||||
|
||||
private RenderFragment RenderDescription(string description)
|
||||
{
|
||||
return builder =>
|
||||
|
||||
@@ -59,7 +59,51 @@
|
||||
.deck-card-count {
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-muted);
|
||||
margin: 0;
|
||||
margin: 0 0 1.5rem;
|
||||
}
|
||||
|
||||
.mana-curve {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: 0.5rem;
|
||||
height: 80px;
|
||||
margin-top: 1rem;
|
||||
padding: 0 0.5rem;
|
||||
}
|
||||
|
||||
.mana-bar-container {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.mana-bar-label {
|
||||
font-size: 0.7rem;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 0.2rem;
|
||||
}
|
||||
|
||||
.mana-bar {
|
||||
width: 100%;
|
||||
background: var(--accent);
|
||||
border-radius: 4px 4px 0 0;
|
||||
min-height: 4px;
|
||||
transition: height 0.3s ease;
|
||||
}
|
||||
|
||||
.mana-cost {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
margin-top: 0.4rem;
|
||||
background: var(--bg-elevated);
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
border-radius: 4px;
|
||||
padding: 0.1rem 0;
|
||||
}
|
||||
|
||||
.deck-section {
|
||||
|
||||
Reference in New Issue
Block a user