From 54358d0185bff64ba29a1179d0ca7774fcf7d74b Mon Sep 17 00:00:00 2001
From: Malin Freeborn <malinfreeborn@posteo.net>
Date: Sat, 11 Mar 2023 17:18:34 +0100
Subject: [PATCH] distinguish between example and ally statblocks

---
 stats.sty | 14 +++++++++++---
 test.tex  |  8 ++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/stats.sty b/stats.sty
index c9d27414..569ef594 100644
--- a/stats.sty
+++ b/stats.sty
@@ -4,6 +4,9 @@
 \newtoggle{bestiarychapter}
 \settoggle{bestiarychapter}{false}
 
+\newtoggle{allyCharacter}
+\settoggle{allyCharacter}{false}
+
 %      _        _   
 %  ___| |_ __ _| |_ 
 % / __| __/ _` | __|
@@ -431,7 +434,10 @@ You don't need to fall unconscious when making a Vitality check)%
 	\iftoggle{debug}{str: \arabic{str}, strb: \arabic{strb}, dex: \arabic{dex}, dexb: \arabic{dexb}, spd: \arabic{spd}, spdb: \arabic{spdb},att: \arabic{att}, damage: \arabic{damage}, Attack total: \arabic{attackXPtotal}, Def Total: \arabic{defenceXPtotal}}{}
 	
 
-\addtocounter{att}{7}
+% Stats for allies don't need to show Combat +1 as 'TN 8 to hit', they just need to show '+1'.
+\iftoggle{allyCharacter}{}{
+  \addtocounter{att}{7}
+}
 \addtocounter{att}{\value{dex}}
 \addtocounter{spd}{3}
 \ifnum\value{weight}>\value{str}% now to compute encumbrance
@@ -443,7 +449,9 @@ You don't need to fall unconscious when making a Vitality check)%
   \addtocounter{weight}{-5}
 \fi
 \begin{center}
-  \scshape Att \arabic{att}\ifnumcomp{\value{dexb}}{>}{0}{\addtocounter{att}{\value{dexb}} (\arabic{att})}{},
+  \scshape Att \iftoggle{examplecharacter}{$2D6$}{}%
+  \iftoggle{allyCharacter}{\ifnum\value{att}>0 +\fi}{}%
+  \arabic{att}\ifnumcomp{\value{dexb}}{>}{0}{\addtocounter{att}{\value{dexb}} (\arabic{att})}{},
   AP \arabic{spd}\ifnumcomp{\value{spdb}}{>}{0}%
   {\addtocounter{spd}{\value{spdb}} (\arabic{spd})}{}\ifnumcomp{\value{heft}}{>}{1}{: \arabic{heft}}{},
   \addtocounter{damage}{\value{str}}
@@ -481,7 +489,7 @@ You don't need to fall unconscious when making a Vitality check)%
 	{}%
 
 
-	\iftoggle{examplecharacter}{}{
+	\iftoggle{allyCharacter}{}{
 		\calculateXP
 	}
 \end{center}%
diff --git a/test.tex b/test.tex
index 094cc75a..935f183d 100644
--- a/test.tex
+++ b/test.tex
@@ -451,12 +451,18 @@ When using a bestiary chapter, the stats appear as dice rolls, rather than fixed
 
 \subsection{Test subsection}
 
+\settoggle{allyCharacter}{true}
+
 \elf
 
+\settoggle{examplecharacter}{true}
+
 \lipsum[3]
 
 \elf
 
+\settoggle{allyCharacter}{false}
+
 \subsubsection{Test sub-sub-section}
 
 \lipsum[10]
@@ -470,6 +476,8 @@ When using a bestiary chapter, the stats appear as dice rolls, rather than fixed
 
 \elf
 
+\settoggle{examplecharacter}{false}
+
 \lipsum[10]
 
 \section{Last Section}
-- 
GitLab