{% set clist = tb.cards.get(t, []) %}
{% if clist %}
{% for c in clist %}
{# Compute overlaps with detected deck synergies when available #}
{% set overlaps = [] %}
{% if synergies_norm and c.tags %}
{% for tg in c.tags %}
{% set tag_trim = tg|trim %}
{% if tag_trim and (tag_trim|lower) in synergies_norm and tag_trim not in overlaps %}
{% set _ = overlaps.append(tag_trim) %}
{% endif %}
{% endfor %}
{% endif %}
{% 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 c.dfc_land %}
DFC land{% if c.dfc_adds_extra_land %} +1{% endif %}
{% endif %}
{% 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)) %}
{% set overlaps = [] %}
{% if synergies_norm and c.tags %}
{% for tg in c.tags %}
{% set tag_trim = tg|trim %}
{% if tag_trim and (tag_trim|lower) in synergies_norm and tag_trim not in overlaps %}
{% set _ = overlaps.append(tag_trim) %}
{% endif %}
{% endfor %}
{% endif %}
{{ cnt }}x
{% if owned %}✔{% else %}✖{% endif %}
{% if c.dfc_land %}
DFC{% if c.dfc_adds_extra_land %}+1{% endif %}
{% endif %}
{% endfor %}
{% else %}
No cards in this type.
{% endif %}
{% endfor %}
{% else %}
No type data available.
{% endif %}
{% set land = summary.land_summary if summary else None %}
{% if land %}
Land Summary
{{ land.headline or ('Lands: ' ~ (land.traditional or 0)) }}
Traditional land slots: {{ land.traditional or 0 }}
MDFC land additions: {{ land.dfc_lands or 0 }}
Total with MDFCs: {{ land.with_dfc or land.traditional or 0 }}
{% if land.dfc_cards %}
MDFC mana sources ({{ land.dfc_cards|length }})
{% for card in land.dfc_cards %}
{% set extra = card.adds_extra_land or card.counts_as_extra %}
{% set colors = card.colors or [] %}
{{ card.name }} ×{{ card.count or 1 }}Colors: {{ colors|join(', ') if colors else '–' }}
{% if extra %}
{{ card.note or 'Adds extra land slot' }}
{% else %}
{{ card.note or 'Counts as land slot' }}
{% endif %}
{% if card.faces %}
{% for face in card.faces %}
{% set face_name = face.get('face') or face.get('faceName') or 'Face' %}
{% set face_type = face.get('type') or '–' %}
{% set mana_cost = face.get('mana_cost') %}
{% set mana_value = face.get('mana_value') %}
{% set produces = face.get('produces_mana') %}
{{ face_name }}— {{ face_type }}
{% if mana_cost %}• Mana Cost: {{ mana_cost }}{% endif %}
{% if mana_value is not none %}• MV: {{ mana_value }}{% endif %}
{% if produces %}• Produces mana{% endif %}
{% 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 %}
{% set count_val = (pd.counts[color] if pd.counts and color in pd.counts else 0) %}
{% set pc = pd['cards'] if 'cards' in pd else None %}
{% set c_cards = (pc[color] if pc and (color in pc) else []) %}
{% set parts = [] %}
{% for c in c_cards %}
{% set label = c.name ~ ((" ×" ~ c.count) if c.count and c.count>1 else '') %}
{% if c.dfc %}
{% set label = label ~ ' (DFC)' %}
{% endif %}
{% set _ = parts.append(label) %}
{% endfor %}
{% set cards_line = parts|join(' • ') %}
{% set pct_f = (pd.weights[color] * 100) if pd.weights and color in pd.weights else 0 %}
{{ 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 %}
{% set pct_f = (100.0 * (val / (mg.total_sources or 1))) %}
{% set mgc = mg['cards'] if 'cards' in mg else None %}
{% set c_cards = (mgc[color] if mgc and (color in mgc) else []) %}
{% set parts = [] %}
{% for c in c_cards %}
{% set _ = parts.append(c.name ~ ((" ×" ~ c.count) if c.count and c.count>1 else '')) %}
{% endfor %}
{% set cards_line = parts|join(' • ') %}
{{ 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 %}
{% set cards = (mc.cards[label] if mc.cards and (label in mc.cards) else []) %}
{% set parts = [] %}
{% for c in cards %}
{% set _ = parts.append(c.name ~ ((" ×" ~ c.count) if c.count and c.count>1 else '')) %}
{% endfor %}
{% set cards_line = parts|join(' • ') %}
{% set pct_f = (100.0 * (val / denom)) %}
{{ label }}
{% endfor %}
Total spells: {{ mc.total_spells or 0 }}
{% else %}
No curve data.
{% endif %}
Test Hand(draw 7 random cards)
Test Hand
Draw 7 at random (no repeats except for basic lands).