From e6965675781d38c505ffc26b5dac24b8d99ca0cf Mon Sep 17 00:00:00 2001
From: Malin Freeborn <malinfreeborn@posteo.net>
Date: Fri, 19 Apr 2024 14:19:50 +0200
Subject: [PATCH] refactor weapons

---
 arms.sty  | 10 ----------
 main.tex  | 36 ++++++++++++++++++++----------------
 stats.sty | 21 ++++++++++-----------
 3 files changed, 30 insertions(+), 37 deletions(-)

diff --git a/arms.sty b/arms.sty
index 73956863..7d9024b6 100644
--- a/arms.sty
+++ b/arms.sty
@@ -90,16 +90,6 @@
   \divide\value{armourWeight} by 3%
   \addtocounter{armourWeight}{0}%
   #1% <- for adjustments.
-  \iftoggle{creatureBox}{%
-    \ifnumcomp{\value{dr}}{>}{\value{armourDR}}%
-    {%
-      \divide\value{armourDR} by 2%
-      \addtocounter{dr}{\value{armourDR}}%
-    }{%
-      \divide\value{dr} by 2%
-      \addtocounter{dr}{\value{armourDR}}%
-    }%
-  }{}%
 }
 
 \newcommand\showArmour[1]{%
diff --git a/main.tex b/main.tex
index 750ecc66..78ec44e7 100644
--- a/main.tex
+++ b/main.tex
@@ -23,17 +23,16 @@
 
 \humanthief
 
-\newcommand\statblock[6]{
+\newcommand\statblock[4]{
+  \begin{exampletext}
   \clean
-  \setcounter{Strength}{#1}
-  \setcounter{Dexterity}{#2}
-  \setcounter{Speed}{#3}
-  \mind#4
-  #5
-  \foreach \k in {#6}{%
+  \body#1
+  \mind#2
+  #3
+  \foreach \k in {#4}{%
     \stepcounter{knacks}%
   }
-  \renewcommand\showKnacks{#6}
+  \renewcommand\showKnacks{#4}
   %
   \computeStats
 
@@ -72,23 +71,20 @@
       \glsentrytext{dr} \arabic{dr} (\arabic{covering})
     \fi%
   }
-  \par
-  \hrulefill
-  \par
-  \hrulefill
-
+  \end{exampletext}
 }
 
+
 \npc{\F\Hu}{Alice}
-\statblock{1}{2}{3}%
+\statblock{{1}{2}{3}}%
   {{-3}{-2}{-1}}%
   {
     \setcounter{Wyldcrafting}{1}
-  }
+  }% SKILLS
   {\adrenalinesurge, \mightydraw}
 
 \npc{\M\Hu}{Bob}
-\statblock{1}{2}{3}%
+\statblock{{1}{2}{3}}%
   {{-3}{-2}{-1}}%
   {
     \setcounter{Academics}{1}
@@ -97,6 +93,14 @@
   }
   {\adrenalinesurge, \mightydraw}
 
+\npc{\F\Hu}{Charlie}
+\statblock{{1}{2}{3}}%
+  {{-3}{-2}{-1}}%
+  {
+    \setcounter{Xenomology}{1}
+  }% SKILLS
+  {\adrenalinesurge, \mightydraw}
+
 \end{multicols}
 
 \end{document}
diff --git a/stats.sty b/stats.sty
index 39fc07be..ab80f539 100644
--- a/stats.sty
+++ b/stats.sty
@@ -588,17 +588,8 @@
   \foreach \s in {Air,Earth,Fate,Fire,Water,Projectiles,Combat,Brawl,Academics,Alchemy,Athletics,Caving,Crafts,Deceit,Empathy,Flight,Medicine,Performance,Larceny,Seafaring,Stealth,Tactics,Vigilance,Wyldcrafting}%
     {\setcounter{\s}{0}}
   \setcounter{noAppearing}{1}
-  \setcounter{dr}{0}
-  \setcounter{fp}{0}
-  \setcounter{sp}{0}
-  \setcounter{heft}{1}
-  \setcounter{weight}{0}
-  \setcounter{encumbrance}{0}
-  \setcounter{damage}{0}
-  \setcounter{weaponDamage}{0}
-  \setcounter{knacks}{0}
-  \setcounter{mp}{0}
-  \setcounter{xpbonus}{0}
+  \foreach \s in {dr,weaponDamage,weaponBonus,armourDR,armourWeight,fp,sp,heft,weight,damage,knacks,mp,xpbonus}%
+    {\setcounter{\s}{0}}
 }
 
 %%       _   _        _ _           _            
@@ -711,6 +702,14 @@
   \addtocounter{damage}{4}%
   \addtocounter{damage}{\value{weaponDamage}}%
   \addtocounter{covering}{\value{att}}
+  \ifnumcomp{\value{dr}}{>}{\value{armourDR}}%
+  {%
+    \divide\value{armourDR} by 2%
+    \addtocounter{dr}{\value{armourDR}}%
+  }{%
+    \divide\value{dr} by 2%
+    \addtocounter{dr}{\value{armourDR}}%
+  }%
 }
 
 %%     _               _        _
-- 
GitLab