From aa5ff1b3755940242f41e8dd69be1b4a462b6326 Mon Sep 17 00:00:00 2001
From: Malin Freeborn <malinfreeborn@posteo.net>
Date: Sun, 5 Nov 2023 03:27:47 +0100
Subject: [PATCH] create swarm command

---
 docs.tex  |  4 ++++
 stats.sty | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
 test.tex  |  5 +++++
 3 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/docs.tex b/docs.tex
index dbb2b847..aea44b6e 100644
--- a/docs.tex
+++ b/docs.tex
@@ -102,6 +102,10 @@ Then the \verb"\humansoldier" command turns from this:
 
 This second soldier is still random, but note the loot they carry has changed into a roll.
 
+And finally, we have swarms:
+
+\swarm[\flight]{Stirges}{5}{1}{3}{1}
+
 \subsection{Boxes}
 
 You can add things for these people to say with a \verb"\begin{speechtext}" command:
diff --git a/stats.sty b/stats.sty
index 61a2d89f..b05c7a75 100644
--- a/stats.sty
+++ b/stats.sty
@@ -786,7 +786,52 @@
     }{}%
   }
 }
-%
+
+\newcommand\swarm[6][]%
+  {
+    \begin{tcolorbox}[
+      title={\A\ Swarm: #2},
+      before upper={\parindent0pt},
+      ornamented,
+      fontupper=\small,
+      halign=flush left,
+      left=10pt,
+      right=15pt,
+      top=0pt,
+      bottom=0pt,
+      ]
+    \clean
+    \setcounter{hp}{#3}
+    \setcounter{Dexterity}{#4}
+    \setcounter{att}{#4}
+    \addtocounter{att}{10}
+    \setcounter{Speed}{#5}
+    \setcounter{ap}{#5}
+    \addtocounter{ap}{3}
+    \setcounter{Wits}{#6}
+    \renewcommand\abilities{#1}
+
+    \scshape
+    \begin{tabularx}{\textwidth}{cYcc}
+    \hiderowcolors
+
+    \Gls{ap}: \arabic{ap} & Att: $\arabic{att} - HP$ 
+    \iftoggle{verbose}{
+      & Speed: \arabic{Speed}
+      & Wits: \arabic{Wits}
+    }{
+      & Dam: 1
+    }
+    \\
+    & \showBoxes & \\
+    \end{tabularx}
+    \ifdefempty{\abilities}{}{%
+      \textbf{Abilities}: \abilities
+    }%
+    \end{tcolorbox}
+  }
+
+
 %%%%%%%%%%%%%%%%%%%% Creature Abilities
 
 \newcommand{\abilities}{}
diff --git a/test.tex b/test.tex
index 50a6294a..04d9d99c 100644
--- a/test.tex
+++ b/test.tex
@@ -502,6 +502,11 @@ When using a bestiary chapter, the stats appear as dice rolls, rather than fixed
 
 \begin{multicols}{2}
 
+\randomdozen
+\setcounter{track}{\value{r12}}
+
+\swarm[\flight]{Stirges}{\value{r12}}{1}{3}{1}
+
 \lipsum[\arabic{r4}]
 
 \humanbard
-- 
GitLab