{% set clist = tb.cards.get(t, []) %}
{% if clist %}
{% for c in clist %}
{% set cnt = c.count if c.count else 1 %}
{% set owned = (owned_set is defined and c.name and (c.name|lower in owned_set)) %}
{{ cnt }}x{{ c.name }}{% if owned %}✔{% else %}✖{% endif %}
{% set clist = tb.cards.get(t, []) %}
{% if clist %}
{% for c in clist %}
{% set cnt = c.count if c.count else 1 %}
{% set owned = (owned_set is defined and c.name and (c.name|lower in owned_set)) %}
{{ cnt }}x
{% if owned %}✔{% else %}✖{% endif %}
{% endfor %}
{% else %}
No cards in this type.
{% endif %}
{% endfor %}
{% else %}
No type data available.
{% endif %}
Mana Overview
{% set deck_colors = summary.colors or [] %}
Mana Pips (non-lands)
{% set pd = summary.pip_distribution %}
{% if pd %}
{% set colors = deck_colors if deck_colors else ['W','U','B','R','G'] %}
{% for color in colors %}
{% set w = (pd.weights[color] if pd.weights and color in pd.weights else 0) %}
{% set pct = (w * 100) | int %}
{{ color }}
{% endfor %}
{% else %}
No pip data.
{% endif %}
Mana Sources
{% set mg = summary.mana_generation %}
{% if mg %}
{% set colors = deck_colors if deck_colors else ['W','U','B','R','G'] %}
{# If colorless sources exist, append 'C' to colors for display #}
{% if 'C' in mg and (mg.get('C', 0) > 0) and ('C' not in colors) %}
{% set colors = colors + ['C'] %}
{% endif %}
{% set ns = namespace(max_src=0) %}
{% for color in colors %}
{% set val = mg.get(color, 0) %}
{% if val > ns.max_src %}{% set ns.max_src = val %}{% endif %}
{% endfor %}
{% set denom = (ns.max_src if ns.max_src and ns.max_src > 0 else 1) %}
{% for color in colors %}
{% set val = mg.get(color, 0) %}
{% set pct = (val * 100 / denom) | int %}
{{ color }}
{% endfor %}
Total sources: {{ mg.total_sources or 0 }}
{% else %}
No mana source data.
{% endif %}
Mana Curve (non-lands)
{% set mc = summary.mana_curve %}
{% if mc %}
{% set ts = mc.total_spells or 0 %}
{% set denom = (ts if ts and ts > 0 else 1) %}
{% for label in ['0','1','2','3','4','5','6+'] %}
{% set val = mc.get(label, 0) %}
{% set pct = (val * 100 / denom) | int %}
{{ label }}
{% endfor %}
Total spells: {{ mc.total_spells or 0 }}
{% else %}
No curve data.
{% endif %}
Test Hand
Draw 7 at random (no repeats except for basic lands).