\LoadClass{standalone}
% NOTE: Cloud colour is 76baff

\ProvidesClass{iditacard}[2017/05/12 Class for Iditacard cards]

\RequirePackage{fontspec}
\RequirePackage{xcolor}
\RequirePackage{xstring}
\RequirePackage{siunitx}
\DeclareSIPrefix\myria{my}{4}

\RequirePackage[none]{hyphenat}

\RequirePackage{tikz}
\usetikzlibrary{positioning,shapes,shadows,arrows,backgrounds,fit}
\RequirePackage{pgfplots}
\RequirePackage{shapepar}
\RequirePackage{microtype}
\RequirePackage{mathtools}
\let\mttext\text

\graphicspath{{images/}}

\newfontfamily\bebas{Bebas Neue Regular}
\newfontfamily\alegreya{Alegreya}

\definecolor{energy}{HTML}{003FFF}
\definecolor{health}{HTML}{FF0000}
\definecolor{risk}{HTML}{000000}

% Card Type
\definecolor{utility}{HTML}{FFFFFF}
\definecolor{attachment}{HTML}{5FAFCF}
\definecolor{dog}{HTML}{BF9F7F}
\definecolor{stretch}{HTML}{9F9F9F}
\definecolor{personal}{HTML}{AF5FCF}
\definecolor{movement}{HTML}{7F7FDF}
\definecolor{damage}{HTML}{FF6F6F}
\definecolor{sled}{HTML}{7FDF7F}
\definecolor{food}{HTML}{CFCF4F}

% Rarity
\definecolor{info}{HTML}{FFFFFF}
\definecolor{starting}{HTML}{777777}
\definecolor{common}{HTML}{000000}
\definecolor{rare}{HTML}{000077}
\definecolor{epic}{HTML}{007700}
\definecolor{legendary}{HTML}{770077}

\newcommand{\cardtype}[1]{\newcommand{\backgroundcolor}{#1}}
\newcommand{\rarity}[1]{\newcommand{\edgecolor}{#1}}
\newcommand{\deck}[1]{\newcommand{\whichdeck}{#1}}

\newcommand{\energy}[1]{%
\node [minimum width=0.5in, minimum height=0.5in, anchor=center, inner sep=0mm] at (125.0/300.0,825.0/300.0) {\includegraphics[width=0.5in,height=0.5in]{icons/hand.png}};
\StrLen{#1}[\arglen]
\ifnum\arglen>1%
    \node [text=black, minimum width=0.5in, minimum height=0.5in, text centered, text width=0.5in, anchor=center, inner sep=0mm] at (125.0/300.0,825.0/300.0) {\bf\fontsize{14}{14}\bebas #1};%
\else
    \node [text=black, minimum width=0.5in, minimum height=0.5in, text centered, text width=0.5in, anchor=center, inner sep=0mm] at (125.0/300.0,825.0/300.0) {\bf\fontsize{25}{30}\bebas #1};%
\fi
}

\newcommand{\health}[1]{%
\node [minimum width=0.5in, minimum height=0.5in, anchor=center, inner sep=0mm] at (125.0/300.0,700.0/300.0) {\includegraphics[width=0.5in, height=0.5in]{icons/deck.png}};
\StrLen{#1}[\arglen]
\ifnum\arglen>1%
    \node [text=black, minimum width=0.5in, minimum height=0.5in, text centered, text width=0.5in, anchor=center, inner sep=0mm] at (125.0/300.0, 700.0/300.0) {\bf\fontsize{14}{14}\bebas #1};%
\else
    \node [text=black, minimum width=0.5in, minimum height=0.5in, text centered, text width=0.5in, anchor=center, inner sep=0mm] at (125.0/300.0, 700.0/300.0) {\bf\fontsize{25}{30}\bebas #1};%
\fi
}

\newcommand{\risk}[1]{%
\node [minimum width=0.5in, minimum height=0.5in, anchor=center, inner sep=0mm] at (125.0/300.0, 538.0/300.0) {\includegraphics[width=0.5in, height=0.5in]{icons/risk.png}};
\StrLen{#1}[\arglen]
\ifnum\arglen>1%
    \node [text=white, minimum width=0.5in, minimum height=0.5in, text centered, text width=0.5in, anchor=center, inner sep=0mm] at (125.0/300.0, 538.0/300.0) {\bf\fontsize{14}{14}\bebas #1};%
\else
    \node [text=white, minimum width=0.5in, minimum height=0.5in, text centered, text width=0.5in, anchor=center, inner sep=0mm] at (125.0/300.0, 538.0/300.0) {\bf\fontsize{25}{30}\bebas #1};%
\fi
}

\newcommand{\name}[1]{%
\node [rectangle, anchor=north, minimum width=2.15in, minimum height=2.0/3.0in, text centered, text width=1.833333in, inner sep=0mm] at (375.0/300.0,975.0/300.0) {\bf\fontsize{20}{30}\bebas#1\par};
}

\renewcommand{\text}[1]{%
\node [rectangle, minimum width=1.833333in, minimum height=200.0/300.0, text centered, text width=1.833333in, inner sep=0mm, anchor=north] at (375.0/300.0,450.0/300) {\fontsize{16}{16}\bebas#1\par};
}

\newcommand{\helptext}[1]{%
\node [rectangle, minimum width=1.833333in, minimum height=200.0/300.0, text centered, text width=1.833333in, inner sep=0mm, anchor=north] at (375.0/300.0, 800.0/300.0) {\fontsize{16}{16}\bebas#1\par};
}

\newcommand{\flava}[1]{%
\node [rectangle, minimum width=1.833333in, minimum height=100.0/300.0, text centered, text width=1.833333in, inner sep=0mm, anchor=north] at (375.0/300.0,150.0/300.0) {\fontsize{6}{6}\alegreya"#1"\par};
}

\newcommand{\type}[1]{%
\node [rectangle, minimum width=1.833333in, minimum height=100.0/300.0, text centered, text width=1.833333in, inner sep=0mm, anchor=north] at (375.0/300.0,100.0/300.0) {\fontsize{12}{12}\bebas#1\par};
}

% Aspect ratio of about 3:2
\newcommand{\art}[1]{%
\node [rectangle, minimum width=649.8/300.0, minimum height=425.0/300.0, inner sep=0, anchor=north west] at (49.2/300.0, 888.0/300.0) {\noindent\includegraphics*[width=2.1664in, height=1.416667in]{#1}};
}

\newcommand{\useicon}[1]{\raisebox{-0.1em}{\includegraphics[height=1em]{icons/#1.png}}}

% Effects (%-- indicates should have icon)
\newcommand{\daydraw}[1]{Draw \ifnum 1=#1 an extra card \else #1 extra cards \fi when you take a new day} %--
\newcommand{\draw}[1]{Draw \ifnum 1=#1 a card\else #1 cards\fi} %--
\newcommand{\supply}[1]{Add \ifnum 1=#1 a card \else #1 cards \fi to the supply} %--
\newcommand{\take}[1]{\ifnum 0<#1 Take \ifnum 1=#1 a card \else #1 cards \fi from the supply\fi} %--
\newcommand{\see}[1]{Look at the top \ifnum 1=#1 card \else #1 cards \fi of your deck} % TODO: Eye icon %--
\newcommand{\destroy}[1]{\ifnum 0<#1 Destroy up to #1 of them\fi discard as many as you want and shuffle the rest back into your deck} % TODO: Trash icon %--
\newcommand{\speed}[1]{Speed #1} %--
\newcommand{\move}[1]{Move #1\,mym} % TODO: SIify mym %--
\newcommand{\discardonkill}{Discarded when killed}
\newcommand{\inplayatstart}{Play when the game starts}
\newcommand{\immortal}{Cannot Die}
\newcommand{\safepass}{Passing does not incur damage}
\newcommand{\passdie}{Dies when passing}
\newcommand{\nohold}{Cannot hold attachments}
\newcommand{\nostarvation}{Remove your \useicon{starve}}
\newcommand{\nohypothermia}{Remove your \useicon{hypo}}
\newcommand{\damage}[1]{Take #1 damage} %--?
\newcommand{\doubledistance}{Double the final distance}
\newcommand{\damagetext}{Destroy this card  \vskip 0.5em When you discard this card, end your turn immediately}

\newenvironment{card}
{% Begin
\noindent\begin{tikzpicture}[x=1in,y=1in]
\fill [\edgecolor] (0,0) rectangle (2.5,3.5);
\fill[rounded corners=10pt] [\backgroundcolor] (50.0/300.0,50.0/300.0) rectangle (700.0/300.0,1000.0/300.0);
\node at (645.0/300.0,95.0/300.0) {\includegraphics[width=0.25in, height=0.25in]{deck/\whichdeck.png}};
}
{% End
\end{tikzpicture}}

\newenvironment{board}
{% Begin
\noindent\begin{tikzpicture}[x=1cm,y=1cm]
%\fill [white] (0,0) rectangle (41.275,26.035);
}
{% End
\end{tikzpicture}}
