{% extends 'admin/layout.html.twig' %} {% block page_title %}Prévisualisation — {{ card.name }}{% endblock %} {% block breadcrumb %} /Cartes /{{ card.name }} {% endblock %} {% block header_action %} Modifier {% endblock %} {% block stylesheets %} {{ parent() }} {% endblock %} {% block content %} {# ── Couleur / gradient selon le type de carte ── #} {% if card.cardType == 'spell' %} {% set gradient = '#6a5fd4' %} {% elseif card.cardType == 'trap' %} {% set gradient = '#c8942f' %} {% else %} {% set elementIds = card.elementalTypes ?? [] %} {% set colorA = elementIds[0] is defined and elementsMap[elementIds[0]] is defined ? elementsMap[elementIds[0]].color : '#d4af6a' %} {% set colorB = elementIds[1] is defined and elementsMap[elementIds[1]] is defined ? elementsMap[elementIds[1]].color : colorA %} {% set gradient = elementIds|length > 1 ? 'linear-gradient(150deg, ' ~ colorA ~ ', ' ~ colorB ~ ')' : colorA %} {% endif %} {% set elementIds = elementIds ?? [] %} {% set statLabels = { pvMax: 'PV', egMax: 'EG', attaque: 'ATQ', defense: 'DEF', arcane: 'ARC', sagesse: 'SAG', } %}
{# ── Header portrait (commun à tous les types) ── #}
{% if portraitUrl %}
{% else %}
{% if card.cardType == 'spell' %}✦{% elseif card.cardType == 'trap' %}⚠{% else %}☠{% endif %}
{% endif %}
{% if card.cardType not in ['spell', 'trap'] and elementIds|length > 0 %}
{% for eid in elementIds|slice(0, 2) %} {% set elMeta = elementsMap[eid] ?? null %} {% if elMeta %}
{% if elMeta.iconUrl %}{% endif %}
{% endif %} {% endfor %}
{% endif %}
{{ card.name }}
{% if card.cardType not in ['spell', 'trap'] and card.classification %}
{{ card.classification }}
{% endif %}
{# ══════════════════════════════════════════════════════════════ SORT / BOTTE SECRÈTE — layout simplifié ══════════════════════════════════════════════════════════════ #} {% if card.cardType in ['spell', 'trap'] %}
{{ card.cardTypeLabel }} {% if card.classification %}{{ card.classification }}{% endif %}

{{ card.description ?? '' }}

{# Espace réservé pour que le cercle valeur ne chevauche pas la description #}
{# ══════════════════════════════════════════════════════════════ CRÉATURE / HÉROS / ÉQUIPEMENT — layout complet ══════════════════════════════════════════════════════════════ #} {% else %} {# ── Stats grid 3×2 ── #}
{% for key, label in statLabels %}
{{ attribute(card.stats, key) }} {{ label }}
{% endfor %}
{# ── Passifs ── #} {% if card.passives|length > 0 %}
Passifs
{% for p in card.passives %}
{{ p.name }}
{% if p.description ?? '' %}{{ p.description }}{% endif %}
{% endfor %}
{% endif %} {# ── Sorts ── #} {% if card.skills|length > 0 %}
Sorts
{% set typeIconFile = {physical: 'physique.png', magical: 'magique.png', status: 'statut.png'} %} {% for s in card.skills %} {% set sType = s.type ?? 'physical' %} {% set sCost = s.cost ?? 0 %} {% set sElemMeta = (s.elementId ?? null) ? (elementsMap[s.elementId] ?? null) : null %} {% set sClickable = (embed ?? false) and (attackable ?? false) %} {% set sDisabled = sClickable and currentEg is defined and currentEg >= 0 and sCost > currentEg %}
{{ sType }} {% if sElemMeta and sElemMeta.iconUrl %} {{ sElemMeta.name }} {% endif %} {{ s.name }} — {{ sCost }}EG {% if (s.damage ?? 0) > 0 %}{{ s.damage }}{% endif %}
{% if s.description ?? '' %}{{ s.description }}{% endif %}
{% endfor %}
{% endif %} {# ── Bas : Faiblesse | Valeur | Résistance (grille 3 col) ── #}
Faiblesse
{% for i in 0..1 %} {% set wid = (card.weaknesses ?? [])[i] ?? null %} {% set wMeta = wid ? (elementsMap[wid] ?? null) : null %}
{% if wMeta and wMeta.iconUrl %}{% endif %}
{% endfor %}
{{ card.cardValue }}
Résistance
{% for i in 0..1 %} {% set rid = (card.resistances ?? [])[i] ?? null %} {% set rMeta = rid ? (elementsMap[rid] ?? null) : null %}
{% if rMeta and rMeta.iconUrl %}{% endif %}
{% endfor %}
{% set rarityIcon = 'images/cards_rarities/' ~ card.rarity ~ '.svg' %} {{ '%03d'|format(card.number) }}/{{ '%03d'|format(totalCards) }}
{% endif %}
{# ── Coût d'invocation (coin haut-gauche) ── #}
{{ card.summonCost }}
{# ── Sorts / Bottes : valeur (centre bas) + rareté (coin bas-droit) ── #} {% if card.cardType in ['spell', 'trap'] %}
{{ card.cardValue }}
{% set rarityIcon = 'images/cards_rarities/' ~ card.rarity ~ '.svg' %}
Rareté {{ card.rarity }} {{ '%03d'|format(card.number) }}/{{ '%03d'|format(totalCards) }}
{% endif %}
← Retour à la liste
{% if not (embed ?? false) %} {% endif %} {% if (embed ?? false) and (attackable ?? false) %} {% endif %} {% endblock %} {# ══════════════════════════════════════════════════════════════════════ MACRO : chips récapitulant les effets structurés ══════════════════════════════════════════════════════════════════════ #} {% macro effectsChips(effects) %} {% set actionLabels = { damage_targets: '⚡ Dégâts zone', heal_targets: '❤ Soins', self_damage: '× Auto-dégâts', restore_eg_targets: '⚡ Restaure EG', modify_stat_targets: '↑ Mod. stat', set_stat_targets: '= Fixe stat', add_card_to_hand: '+ Piocher', modify_shield_break_count: '◈ Briseur', apply_status_targets: '⊘ Statut', destroy_targets: '☠ Détruit', return_to_hand_targets: '↩ Retour main', } %}
{% for e in effects %} {% set label = actionLabels[e.action] ?? e.action %} {% set amount = e.params.amount ?? e.params.delta ?? e.params.value ?? e.params.count ?? null %} {{ label }}{% if amount is not null %} {{ amount }}{% endif %} {% endfor %}
{% endmacro %}