-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsymbols.tex
246 lines (222 loc) · 7.84 KB
/
symbols.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
\input{palette.tex}
\tikzset{roll box/.style={inner ysep=0.5em, inner xsep=0.1em, fill=black!20}}
\tikzset{check roll box/.style={roll box, fill=box-blue!40}}
\tikzset{damage roll box/.style={roll box, fill=box-red!40, rounded corners=0.5em}}
\tikzset{healing roll box/.style={roll box, fill=box-green!40, rounded corners=0.5em}}
\tikzset{effect box/.style={roll box, fill=box-red!40, rounded corners=0.5em}}
\newcommand{\pfsymbol}[1]{%
\mbox{\pfsymbols\selectfont#1}
}
% \Action[<trait 1>, <trait 2>, …]{<source book>}{<page>}{<actions>}[<action range>]{<name>}
%
% Use \Action*{…} to render action traits on a new line.
\NewDocumentCommand{\Action}{ommmom}{
\subsection[#6]{#6\ActionSymbol{#4}\IfValueT{#5}{- \ActionSymbol{#5}} \IfValueT{#1}{\ActionTraits{#1}} \hfill \Reference{#2}{#3}}
}
% \Activity[<trait 1>, <trait 2>, …]{<source book>}{<page>}{<duration>}{<name>}
%
% Use \Activity*{…} to render activity traits on a new line.
\NewDocumentCommand{\Activity}{sommmm}{
\IfBooleanTF{#1}
{\subsection[#6]{#6 {\small\engschrift (#5)} \hfill \Reference{#3}{#4}\\\ActionTraits{#2}}}
{\subsection[#6]{#6 {\small\engschrift (#5)} \ActionTraits{#2} \hfill \Reference{#3}{#4}}}
}
% \Rule{<source book>}{<page>}{<name>}
\NewDocumentCommand{\Rule}{mmm}{
\subsection[#3]{#3 \hfill \Reference{#1}{#2}}
}
\newcommand{\Requirements}[1]{\paragraph{Requirements} #1.}
\newcommand{\Attribute}[2]{\smallskip\mbox{\engschrift {\color{gray} #1} #2}}
\newcommand{\WeaponDamage}[1]{\Attribute{Damage}{#1}}
\newcommand{\ItemHands}[1]{\Attribute{Hands}{#1}}
\newcommand{\ItemBulk}[1]{\Attribute{Bulk}{#1}}
\newcommand{\ItemPrice}[1]{\Attribute{Price}{#1}}
\newcommand{\ItemUsage}[1]{\Attribute{Usage}{#1}}
\newcommand{\WeaponType}[1]{\Attribute{Type}{#1}}
\newcommand{\WeaponCategory}[1]{\Attribute{Category}{#1}}
\newcommand{\WeaponGroup}[1]{\Attribute{Group}{#1}}
\newcommand{\EffectDuration}[1]{\Attribute{Duration}{#1}}
\newcommand{\Frequency}[1]{\Attribute{Frequency}{#1}}
\newcommand{\Flavor}[1]{\textit{#1}}
\newcommand{\Hardness}[1]{\Attribute{Hardness}{#1}}
\newcommand{\BrokenThreshold}[1]{\Attribute{BT}{#1}}
% \HitPoints
% renders the Attribute for hit points (HP).
% \HitPoints[<max>]
% renders the Attribute for hit points (HP) and
% a box to track [current] / <max>.
\NewDocumentCommand{\HitPoints}{o}{%
\Attribute{HP}{%
\IfNoValueTF{#1}
{}
{\(\FormulaVariable{current}{\phantom{100}}\) / #1}}%
}
% \Reference{<source book>}{<page>}
\newcommand{\Reference}[2]{{\small \color{gray} \engschrift #1 #2}}
\newcommand{\CardTraits}[1]{\strut\raisebox{1em}[0pt][0pt]{\ActionTraits{#1}}}
\newcommand{\ActionTraits}[1]{{%
\small \engschrift
\foreach[count=\index] \trait in {#1}{\ifnum \index > 1 ~~ \fi \DamageType{\trait}[]\trait}%
}}
% TODO fix distance between actions, maybe avoid draw in favor of more fill?
\newcommand{\ActionSymbol}[1]{
\ifnum #1 = -1
\pfsymbol{reaction}
\fi
\ifnum #1 = 0
\pfsymbol{free-action}
\fi
\ifnum #1 = 1
\pfsymbol{one-action}
\fi
\ifnum #1 = 2
\pfsymbol{two-actions}
\fi
\ifnum #1 = 3
\pfsymbol{three-actions}
\fi
}
% \FormulaVariable[<mod alignment>]{<mod desc>}{<content>}
\newcommand{\FormulaVariable}[3][c]{
\operatorname{
\tikz[baseline, trim right=(box.east)] \path
node[draw, shape=rectangle, anchor=base, fill=white] (box) { #3 }
\ifnum\pdfstrcmp{#1}{c}=0
(box.south) node[below=-0.5ex] {\makebox[0pt][#1]{\scriptsize \engschrift #2}}
\fi
\ifnum\pdfstrcmp{#1}{r}=0
(box.south east) +(0.5em, 0em) node[below=-0.5ex] {\makebox[0pt][#1]{\scriptsize \engschrift #2}}
\fi
;
}
}
% \CheckFormula[<mod alignment>]{<mod desc>}[<DC>]
\NewDocumentCommand{\CheckFormula}{O{c}mo}{
\(
\operatorname{1d20} + \FormulaVariable[#1]{
\foreach[count=\index] \summand in {#2}
{\ifnum \index > 1 ~+~ \fi \summand}
}{\phantom{100}}\IfValueT{#3}{\ge \operatorname{\mbox{#3}}}%
\)%
}
% \CheckRoll{<check type>}[<mod alignment>]{<mod desc>}[<DC>]
\NewDocumentCommand{\CheckRoll}{mO{c}mo}{
\tikz[baseline=(content.base)]{
\node (content) {%
\footnotesize
\strut\smash{%
% \parbox[t]{1.25em}{\CheckType{#1}[]}
\CheckFormula[#2]{#3}[#4]%
}%
};
\begin{pgfonlayer}{background}
\node [fit=(content), check roll box] (box) {};
\end{pgfonlayer}%
}%
}
% \DamageRoll{<damage type>}[<alternative damage type>]{<damage roll>}{<mod descr>}
\NewDocumentCommand{\DamageRoll}{momm}{
\tikz[baseline=(content.base)]{
\node (content) {%
\footnotesize
\strut\smash{
\IfValueTF{#2}
{%
\raisebox{0.4em}{\DamageType{#1}}%
\clap{\tikz[baseline] \draw (-0.6em, -0.4em) -- (0.6em, 1.2em);}%
\raisebox{-0.4em}{\DamageType{#2}}%
}
{\ifnum\pdfstrcmp{#1}{}=0 \else\DamageType{#1}\fi}
\(
\mbox{#3}
\foreach[count=\index] \part in {#4} {
\pgfmathparse{\index > 1 || \pdfstrcmp{#3}{} != 0}
\ifnum\pgfmathresult=1 + \fi
\FormulaVariable{\part}{\phantom{100}}
}
\)
}%
};
\begin{pgfonlayer}{background}
\node [fit=(content), damage roll box] (box) {};
\end{pgfonlayer}%
}%
}
% \HealingRoll{<healing roll>}{<mod descr>}
\NewDocumentCommand{\HealingRoll}{mm}{
\tikz[baseline=(content.base)]{
\node (content) {%
\footnotesize
\strut\smash{
\(
\mbox{#1}
\foreach[count=\index] \part in {#2} {
\pgfmathparse{\index > 1 || \pdfstrcmp{#1}{} != 0}
\ifnum\pgfmathresult=1 + \fi
\FormulaVariable{\part}{\phantom{1}}
}
\)
}
};
\begin{pgfonlayer}{background}
\node [fit=(content), healing roll box] (box) {};
\end{pgfonlayer}
}
}
% \Effect{success | failure}{<description>} - for regular success or failure
% \Effect*{success | failure}{<description>} - for critical success or critical failure
\NewDocumentCommand{\Effect}{smm}{
\pfsymbol{\IfBooleanT{#1}{critical-}#2} & #3 \\
}
% \EffectBox{%
% \Effect*{success}{…}
% \Effect{success}{…}
% \Effect{failure}{…}
% \Effect*{failure}{…}
% }
% TODO: adjust colored box based on number of rows in the table
\NewDocumentCommand{\EffectBox}{m}{
\tikz[baseline=(content.base)]{
\node (content) {\strut\smash{
{\setlength{\tabcolsep}{0pt}\begin{tabular}{ll}#1\end{tabular}}
}};
\begin{pgfonlayer}{background}
\node [fit=(content), effect box] (box) {};
\end{pgfonlayer}
}
}
\NewDocumentCommand{\CheckType}{mo}{
\ifcsname CheckType#1\endcsname
\csname CheckType#1\endcsname
\else
\IfValueTF{#2}{#2}{#1}
\fi
}
\NewDocumentCommand{\DamageType}{mo}{%
\ifcsname DamageType#1\endcsname
\csname DamageType#1\endcsname
\else
\IfValueTF{#2}{#2}{#1}
\fi
}
% Keep this for future reference when importing icons from game-icons.net
\tikzset{game-icons.net/.style={fill,scale=0.002em,yscale=-1}}
\newcommand{\DamageTypeFire}{\pfsymbol{fire}}
\newcommand{\DamageTypeCold}{\pfsymbol{cold}}
\newcommand{\DamageTypeSlashing}{\pfsymbol{slashing}}
\newcommand{\DamageTypeBludgeoning}{\pfsymbol{bludgeoning}}
\newcommand{\DamageTypePiercing}{\pfsymbol{piercing}}
\newcommand{\DamageTypeBleed}{\pfsymbol{bleeding}}
\newcommand{\DamageTypeMental}{\pfsymbol{mental}}
\newcommand{\DamageTypeForce}{\pfsymbol{force}}
\newcommand{\DamageTypeAcid}{\pfsymbol{acid}}
\newcommand{\DamageTypeElectricity}{\pfsymbol{electricity}}
\newcommand{\DamageTypeMagic}{\pfsymbol{magical}}
\newcommand{\DamageTypeSonic}{\pfsymbol{sonic}}
\newcommand{\DamageTypePoison}{\pfsymbol{poison}}
\newcommand{\DamageTypeGood}{\pfsymbol{good}}
\newcommand{\DamageTypeEvil}{\pfsymbol{evil}}
\newcommand{\DamageTypeChaotic}{\pfsymbol{chaotic}}
\newcommand{\DamageTypeLawful}{\pfsymbol{lawful}}
\newcommand{\DamageTypeNegative}{\pfsymbol{negative}}
\newcommand{\DamageTypePositive}{\pfsymbol{positive}}