From b434950ebbee34228051eae6896b881c1a002673 Mon Sep 17 00:00:00 2001
From: Malin Freeborn <malinfreeborn@posteo.net>
Date: Sun, 13 Aug 2023 22:13:37 +0200
Subject: [PATCH] create basic armour macro

---
 arms.sty         | 33 +++++++++++++++++++++++++++++----
 rules/charts.tex | 10 +++++-----
 2 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/arms.sty b/arms.sty
index 2e78a7c8..f1ff4480 100644
--- a/arms.sty
+++ b/arms.sty
@@ -14,6 +14,9 @@
 % The Weight Rating = ( Att + Dam ) - 3
 
 \newcounter{weaponBonus}
+\newcounter{covering}
+\newcounter{armourDR}
+
 
 \newcommand\weapon[4][]{%
   \setcounter{weaponBonus}{#3}%
@@ -61,6 +64,27 @@
     }%
 }
 
+\newcommand\armour[4][]{
+  #2% Name
+  \setcounter{armourDR}{#3}%
+  \setcounter{covering}{#4}%
+  \setcounter{weight}{#4}%
+  \roundUp{weight}%
+  \addtocounter{weight}{\value{armourDR}}%
+  \addtocounter{weight}{-4}%
+  #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{\boulder}{\weapon[\addtocounter{weight}{3}]{Boulder}{-3}{5}}
 \newcommand{\chair}{\weapon[\addtocounter{weaponBonus}{-1}]{Chair}{2}{1}}
 \newcommand{\club}{\weapon[\addtocounter{damage}{-1}]{Club}{1}{1}}
@@ -98,6 +122,9 @@
 
 % ARMOUR
 
+
+%%%%%%%%% Old Armour, Delete Later
+
 %% For perfect armour, stick \perfect Armour in the additional notes category of a \person (#9).
 
 \newcommand{\perfectArmour}{\gdef\armourtype{(Perfect)}}
@@ -108,10 +135,8 @@
 	{\divide\value{dr} by 2 \addtocounter{dr}{2}}%
 }
 
-\newcommand{\partialleather}{partial leather armour%
-	\ifnumcomp{\value{dr}}{>}{3}%
-	{\addtocounter{dr}{2}}%
-	{\divide\value{dr} by 2 \addtocounter{dr}{3}}%
+\newcommand{\partialleather}{%
+  \armour{partial leather}{3}{2}%
 }
 
 \newcommand{\completeleather}{full leather armour\gdef\armourtype{C}%
diff --git a/rules/charts.tex b/rules/charts.tex
index 233f455a..9112f5aa 100644
--- a/rules/charts.tex
+++ b/rules/charts.tex
@@ -88,11 +88,11 @@
 
   \textbf{Armour} & \textbf{\Gls{dr}} & \textbf{Covering} & \textbf{Weight} \\\hline
 
-  Partial Leather         &                 3 &        2          &      0          \\
+  \armour{Partial Leather}{3}{2} & \arabic{armourDR} & \arabic{covering} & \arabic{weight} \\
+                                                                             
+  \armour{Partial Chain}{4}{2} & \arabic{armourDR} & \arabic{covering} & \arabic{weight} \\
+                                                                             
+  \armour{Complete Leather}{3}{4} & \arabic{armourDR} & \arabic{covering} & \arabic{weight} \\
                                                                              
-  Complete Leather        &                 3 &        4          &      1          \\
-
-  Partial Chain           &                 4 &        2          &      1          \\
-
   \end{boxtable}
 }
-- 
GitLab