% COMMANDS ZUM ZUSAMMENBAUEN DER KARTEN % --------------------------------------- % TikZ/PGF Settings für die Karten \pgfmathsetmacro{\cardwidth}{6} \pgfmathsetmacro{\cardheight}{9} \pgfmathsetmacro{\imagewidth}{\cardwidth} \pgfmathsetmacro{\imageheight}{0.75*\cardheight} \pgfmathsetmacro{\stripwidth}{0.7} \pgfmathsetmacro{\strippadding}{0.2} \pgfmathsetmacro{\textpadding}{0.1} \pgfmathsetmacro{\titley}{\cardheight-\strippadding-1.5*\textpadding-0.5*\stripwidth} \pgfmathsetmacro{\contentTextWidth}{(\cardwidth-2*\strippadding-\stripwidth-2*\textpadding-0.3)*1cm} \pgfmathsetmacro{\contentLeft}{2*\strippadding + \stripwidth + \textpadding} \pgfmathsetmacro{\contentBottom}{1 + \textpadding} % Formen der einzelnen Kartenelemente/-bestandteile \def\shapeCard{(0,0) rectangle (\cardwidth,\cardheight)} \def\shapeLeftStripLong{(\strippadding,-\strippadding) rectangle (\strippadding+\stripwidth,\cardheight-\strippadding-\strippadding-1)} \def\shapeLeftStripShort{(\strippadding,\cardheight-\strippadding-1) rectangle (\strippadding+\stripwidth,\cardheight+\strippadding)} \def\shapeRightStripShortHigh{(\cardwidth-\stripwidth-\strippadding,\cardheight-\strippadding-1) rectangle (\cardwidth-\strippadding,\cardheight+\strippadding)} \def\shapeRightStripShortLow{(\cardwidth-\stripwidth-\strippadding,-\strippadding) rectangle (\cardwidth-\strippadding,1)} \def\shapeTitleArea{(2*\strippadding+\stripwidth,\cardheight-\strippadding) rectangle (\cardwidth-2*\strippadding-\stripwidth,\cardheight-2*\stripwidth)} % macro to get the height of an node % https://tex.stackexchange.com/questions/554237/how-can-i-get-the-height-of-a-tikz-node-and-store-it-in-a-length \makeatletter % allow use of @ \NewDocumentCommand {\getnodedimen} {O{\nodewidth} O{\nodeheight} m} { \begin{pgfinterruptboundingbox} \begin{scope}[local bounding box=bb@temp] \node[inner sep=0pt, fit=(#3)] {}; \end{scope} \path ($(bb@temp.north east)-(bb@temp.south west)$); \end{pgfinterruptboundingbox} \pgfgetlastxy{#1}{#2} } \makeatother % end use of @ % Stylings für die Elemente definieren \tikzset{ % runde Ecken für die Karten cardcorners/.style={rounded corners=0.2cm},% % runde Ecken für die "Fähnchen" elementcorners/.style={rounded corners=0.1cm},% % Schlagschatten für die "Fähnchen" % stripshadow/.style={drop shadow={opacity=.5, shadow xshift=0, color=black}},% % stripshadow/.style={drop shadow},% % Style für die "Fähnchen" % strip/.style={elementcorners, stripshadow},% strip/.style={elementcorners},% % Bild für das Kartenmotiv cardimage/.style={% path picture={% \node[below=-1.5mm] at (0.5*\cardwidth,\cardheight) {% \includegraphics[width=\imagewidth cm]{#1}% }; }% },% } % TikZ-Raster \newcommand{\carddebug}{ \draw [step=1,help lines] (0,0) grid (\cardwidth,\cardheight); } % Rahmen der Karte \newcommand{\cardborder}{ \draw[lightgray,cardcorners] \shapeCard; } % Hintergrund der Karte \newcommand{\cardbackground}[1]{ \draw[cardcorners, cardimage=#1] \shapeCard; } % Kategorie der Karte % arg1: Background % arg2: Type % arg3: TypeIcon % arg4: Text for left stripe % arg5: Title \newcommand{\cardtype}[5]{ % First we fill the intersecting area % The \clip command does not allow options, therefore % we have to use a scope to set the even odd rule. \begin{scope}[even odd rule] % Define a clipping path. All paths outside shapeCard will % be cut because the even odd rule is set. \clip[cardcorners] \shapeCard; % Fill shapeLeftStripLong and shapeLeftStripShort. % Since the even odd rule is set, only the card will be filled. \fill[strip,#1] \shapeLeftStripLong node[rotate=90,above left=0.9mm,font=\normalsize] { \color{white}\uppercase{#4 - #2} }; \fill[strip,#1] \shapeLeftStripShort; \end{scope} \node at (\strippadding+0.5*\stripwidth,\cardheight-\strippadding-\strippadding-0.37) {\color{white}#3}; \cardtitle{#5} } \newcommand{\cardtypeUnitToken}[1]{\cardtype{tokenbg}{Unit}{\LARGE\sympawn}{TOKEN}{{\Large TOKEN} \\ #1}} \newcommand{\cardtypeUnit}[1]{\cardtype{unitbg}{Unit}{\LARGE\sympawn}{#1}{#1}} \newcommand{\cardtypeSpellToken}[1]{\cardtype{tokenbg}{Spell}{\Large\faBolt}{TOKEN}{{\Large TOKEN} \\ #1}} \newcommand{\cardtypeSpell}[1]{\cardtype{spellbg}{Spell}{\Large\faBolt}{#1}{#1}} \newcommand{\cardtypeArtifactToken}[1]{\cardtype{tokenbg}{Artifact}{\LARGE\decoone}{TOKEN}{{\Large TOKEN} \\ #1}} \newcommand{\cardtypeArtifact}[1]{\cardtype{artifactbg}{Artifact}{\LARGE\decoone}{#1}{#1}} \newcommand{\cardtypeEquipmentToken}[1]{\cardtype{tokenbg}{Equipment}{\huge\dag}{TOKEN}{{\Large TOKEN} \\ #1}} \newcommand{\cardtypeEquipment}[1]{\cardtype{equipmentbg}{Equipment}{\huge\dag}{#1}{#1}} % Titel der Karte \newcommand{\cardtitle}[1]{ %\draw[pattern=soft crosshatch,rounded corners=0.1cm] \shapeTitleArea; \fill[elementcorners,titlebg,opacity=.85] \shapeTitleArea; \node[text width=3.75cm] at (0.5*\cardwidth,\titley) { \begin{center} \color{white}\uppercase{\normalsize #1} \end{center} }; } % Inhalt der Karte \newcommand{\cardsplitcontent}[2]{ % \begin{scope}[even odd rule] % \clip[cardcorners] \shapeCard; % \end{scope} % draw content node just to get its dimensions \node(content)[above right, minimum width=\cardwidth, text width=\contentTextWidth] at (\contentLeft, \contentBottom) { \textit{\normalsize #1} \vrule width \textwidth height 2pt \\[-2pt] \vspace{0.2cm} {\normalsize #2} }; % draw content background using dimensions of the content node \getnodedimen{content} \node[fill=contentbg, above right, elementcorners, minimum height=\nodeheight, minimum width=\nodewidth + 1] at (\contentLeft - \textpadding, \contentBottom) {}; % redraw content so it is on top of the background \node()[above right, minimum width=\cardwidth, text width=\contentTextWidth] at (\contentLeft, \contentBottom) { \textit{\normalsize #1} \vrule width \textwidth height 2pt \\[-2pt] \vspace{0.2cm} {\normalsize #2} }; } % Inhalt der Karte \newcommand{\cardcontent}[1]{ % \begin{scope}[even odd rule] % \clip[cardcorners] \shapeCard; % \end{scope} \node(content)[above right, text width=\contentTextWidth] at (\contentLeft, \contentBottom) { \textit{\normalsize #1} }; % draw content background using dimensions of the content node \getnodedimen{content} \node[fill=contentbg, above right, elementcorners, minimum height=\nodeheight, minimum width=\nodewidth + 1] at (\contentLeft - \textpadding, \contentBottom) {}; % redraw content so it is on top of the background \node[above right, text width=\contentTextWidth] at (\contentLeft, \contentBottom) { \textit{\normalsize #1} }; } % Buying cost \newcommand{\cardbuycost}[1]{ \begin{scope}[even odd rule] \clip[cardcorners] \shapeCard; \fill[strip,pricebg] \shapeRightStripShortHigh; \end{scope} \node at (\cardwidth-0.5*\stripwidth-\strippadding,\titley-\textpadding) {\color{black}#1}; } % Playing cost \newcommand{\cardplaycost}[1]{ \begin{scope}[even odd rule] \clip[cardcorners] \shapeCard; \fill[strip,playbg] \shapeRightStripShortLow; \end{scope} \node at (\cardwidth-0.5*\stripwidth-\strippadding, \strippadding+\strippadding) {\color{black}#1}; } % Module containing the card \newcommand{\cardmodule}[1]{ \node[rotate=90, right] at (\strippadding+0.5*\stripwidth, \strippadding+\strippadding) {\color{black}#1}; }