From 44f0f7bc429bacbdc1c183183e166bd0d2f6ac61 Mon Sep 17 00:00:00 2001
From: Malin Freeborn <malinfreeborn@posteo.net>
Date: Thu, 12 Jan 2023 23:25:44 +0100
Subject: [PATCH] adjust weapons for mono-roll system

---
 arms.sty     | 142 +++++++++++++++++++++++++++++++++++++++++++++++++++
 bind.sty     |   1 +
 docs.tex     |  38 ++++++++++++++
 layout.sty   |   4 +-
 monsters.sty |   6 +--
 stats.sty    |  92 +++------------------------------
 6 files changed, 194 insertions(+), 89 deletions(-)
 create mode 100644 arms.sty

diff --git a/arms.sty b/arms.sty
new file mode 100644
index 00000000..d572c0fa
--- /dev/null
+++ b/arms.sty
@@ -0,0 +1,142 @@
+\ProvidesPackage{config/arms}
+%%%%% Weapons
+
+\newtoggle{chart}
+\settoggle{chart}{false}
+\newcounter{initiative}
+\newcounter{damage}
+\newcounter{cost}
+\newcounter{heft}% used to see how many Init points to swing a weapon
+
+% Weapon entries do two things.
+% When used in creatures, they raise stats.
+% When used in the  weapons chart, they display stats.
+
+\newcommand\weapon[6][]{
+  \setcounter{initiative}{#5}
+  \addtocounter{initiative}{3}
+  % If the weight is better than the Damage, use the Weight *as* the Damage, then add 1.
+  \setcounter{heft}{4}
+  \ifnum#5>#3
+    \addtocounter{heft}{#5}
+  \else
+    \addtocounter{heft}{#3}
+  \fi
+  \ifnum#4>#5
+    \setcounter{damage}{#4}
+  \else
+    \setcounter{damage}{#5}
+  \fi
+  \setcounter{cost}{#6}
+
+  #1
+  \iftoggle{bling}{
+    \addtocounter{att}{#3}
+    #2
+  }{
+    #2 &
+    \ifnum#3>0 +\fi
+    #3 &
+    \ifnum\value{damage}>0 +\fi\arabic{damage}
+    & \arabic{initiative} &
+    #5 &
+    \ifnum#6<1\else
+      \ifnum#6>200
+        \divide\value{cost} by 100
+        \arabic{cost} sp
+      \else
+        \arabic{cost} sp
+      \fi
+    \fi
+    \\
+  }
+}
+
+% Use this 'weapon entry' command to place items in the weapons table, like this:
+%\weapon{Name}%
+%{Bonus}
+%{Dam}
+%{Wt.} + Init
+%{Cost}
+%{Knacks}
+
+\newcommand{\boulder}{\weapon{Boulder}{-2}{0}{6}{0}}
+\newcommand{\chair}{\weapon{Chair}{1}{0}{1}{100}}
+\newcommand{\club}{\weapon{Club}{1}{0}{2}{8}}
+\newcommand{\cudgel}{\weapon{Cudgel}{0}{0}{1}{6}}
+\newcommand{\Dagger}{\weapon{Dagger}{0}{2}{-5}{0}}
+\newcommand{\firepoker}{\weapon{Firepoker}{1}{0}{1}{90}}
+\newcommand{\giantsword}{\weapon{Giant Sword}{3}{1}{4}{3200}}
+\newcommand{\greataxe}{\weapon{Great Axe}{2}{1}{4}{1600}}
+\newcommand{\greatsword}{\weapon{Great Sword}{2}{2}{3}{2200}}
+\newcommand{\greatclub}{\weapon[\addtocounter{damage}{-1}]{Great Club}{3}{0}{5}{10}}
+\newcommand{\javelin}{\weapon{Javelin}{2}{1}{0}{880}}
+\newcommand{\knife}{\weapon{Knife}{0}{1}{-2}{50}}
+\newcommand{\Log}{\weapon{Log}{-1}{0}{0}{1}}
+\newcommand{\rapier}{\weapon{Rapier}{2}{2}{-1}{2500}}
+\newcommand{\largerock}{\weapon{Rock (large)}{0}{0}{3}{0}}
+\newcommand{\longsword}{\weapon{Long Sword}{2}{2}{2}{2200}}
+\newcommand{\maul}{\weapon{Maul}{1}{0}{4}{2200}}
+\newcommand{\poleaxe}{\weapon{Pole Axe}{4}{1}{4}{2400}}
+\newcommand{\quarterstaff}{\weapon[\addtocounter{damage}{-1}]{Quarterstaff}{3}{0}{2}{30}}
+\newcommand{\rock}{\weapon{Rock}{-1}{0}{1}{0}}
+\newcommand{\shortsword}{\weapon{Short Sword}{1}{2}{0}{1500}}
+\newcommand{\skillet}{\weapon{Cast Iron Skillet}{1}{0}{1}{80}}
+\newcommand{\spear}{\weapon{Spear}{3}{1}{1}{300}}
+\newcommand{\stick}{\weapon{Stick}{1}{0}{-1}{1}}
+\newcommand{\whip}{\weapon{Whip}{1}{0}{0}{30}}
+\newcommand{\warhammer}{\weapon{Warhammer}{2}{0}{3}{30}}
+\newcommand{\woodaxe}{\weapon{Wood Axe}{2}{1}{2}{300}}
+
+% SHIELDS
+\newcommand{\longbow}{Longbow}
+\newcommand{\shield}{\addtocounter{dex}{1}shield}
+\newcommand{\bucklar}{\addtocounter{dex}{1}bucklar shield}
+
+% ARMOUR
+
+%% For perfect armour, stick \perfect Armour in the additional notes category of a \person (#9).
+
+\newcommand{\perfectArmour}{\gdef\armourtype{(Perfect)}}
+
+\newcommand{\partialelvish}{partial leather armour%
+	\ifnumcomp{\value{dr}}{>}{2}%
+	{\addtocounter{dr}{1}}%
+	{\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{\completeleather}{full leather armour\gdef\armourtype{C}%
+	\ifnumcomp{\value{dr}}{>}{3}%
+	{\addtocounter{dr}{2}}%
+	{\divide\value{dr} by 2 \addtocounter{dr}{3}}%
+}
+
+\newcommand{\partialchain}{partial chainmail%
+	\ifnumcomp{\value{dr}}{>}{4}%
+	{\addtocounter{dr}{2}}%
+	{\divide\value{dr} by 2 \addtocounter{dr}{4}}%
+}
+
+\newcommand{\completechain}{complete chain armour\gdef\armourtype{C}%
+	\ifnumcomp{\value{dr}}{>}{4}%
+	{\addtocounter{dr}{2}}%
+	{\divide\value{dr} by 2 \addtocounter{dr}{4}}%
+}
+
+\newcommand{\partialplate}{partial plate armour%
+	\ifnumcomp{\value{dr}}{>}{5}%
+	{\addtocounter{dr}{3}}%
+	{\divide\value{dr} by 2 \addtocounter{dr}{5}}%
+}
+
+\newcommand{\completeplate}{complete plate armour\gdef\armourtype{C}%
+	\ifnumcomp{\value{dr}}{>}{5}%
+	{\addtocounter{dr}{3}}%
+	{\divide\value{dr} by 2 \addtocounter{dr}{5}}%
+}
diff --git a/bind.sty b/bind.sty
index c494329f..83d82f85 100644
--- a/bind.sty
+++ b/bind.sty
@@ -1,4 +1,5 @@
 \RequirePackage{config/layout}
 \RequirePackage{config/loot}
+\RequirePackage{config/arms}
 \RequirePackage{config/stats}
 \RequirePackage{config/monsters}
diff --git a/docs.tex b/docs.tex
index 44d51442..b2080784 100644
--- a/docs.tex
+++ b/docs.tex
@@ -170,4 +170,42 @@ And charts about roll successes like this:
 
 \end{multicols}
 
+\section{Weapon Commands}
+
+The {\tt\textbackslash weapon{Name}{1}{2}{3}{80}} command works in 2 ways.
+When defining a weapon, it adjusts the current creature's stats.
+When used in a weapons chart, it shows the weapon's stats.
+
+Stats are derives from the weapon's 3 properties: length, sharpness, and weight.
+
+\begin{verbatim}
+  \weapon{Sword}% NAME
+    {2}% LENGTH
+    {1}% SHARPNESS
+    {1}% WEIGHT
+    {400}% COST
+\end{verbatim}
+
+The attack bonus comes from the weapon's length.
+The damage comes from the weapon's sharpness or weight (whichever is higher).
+The initiative cost to swing the weapon comes from its weight as well.
+Finally, the weight is the same as the minimum Strength bonus required to wield the weapon properly.
+
+When that weapon command appears in a table, it shows the Attack, Damage, and Minimum Strength required to lift it.
+When when a creature wields the weapon, those stats raise the creature's stats.
+
+  \begin{nametable}[XXXXXX]{M\^{e}l\'{e}e Weapons}
+
+  \textbf{Standard Weapons} & \textbf{Bonus} & \textbf{Dam.} & \textbf{Initiative} & \textbf{Min. Str.} & Cost \\\hline
+
+  \Dagger
+
+  \greataxe
+
+  \spear
+
+  \quarterstaff
+
+  \end{nametable}
+
 \end{document}
diff --git a/layout.sty b/layout.sty
index 40ffafd6..1747ee72 100644
--- a/layout.sty
+++ b/layout.sty
@@ -299,8 +299,8 @@ bookmarks=true]%
       \includesvg[angle=-20,width=\themp pt]{config/config/images/b1}
       \hspace{-20pt}
     \fi
-    \ifnum\value{attb}>8
-      \addtocounter{attb}{-7}
+    \ifnum\value{attb}>10
+      \addtocounter{attb}{-9}
       \includesvg[angle=55,width=\theattb ex]{config/images/s1}
       \hspace{-30pt}
     \fi
diff --git a/monsters.sty b/monsters.sty
index aec140a9..97675b76 100644
--- a/monsters.sty
+++ b/monsters.sty
@@ -75,7 +75,7 @@
 {\arabic{r4}}% WITS
 {\arabic{r2}}% DR
 {\ifodd\value{r3} 3\else 4\fi}% AGGRESSION
-{Athletics~\arabic{r3b}, \ifodd\value{r4} Vigilance~\arabic{r3b}\fi, Wyldcrafting~\arabic{r3}}% SKILLS
+{Athletics~\arabic{r3b}, \ifodd\value{r4} Vigilance~\arabic{r3b}, \fi Wyldcrafting~\arabic{r3}}% SKILLS
 {\web}% ABILITIES
 {}
 }
@@ -190,7 +190,7 @@
 	{4}%DR
 	{\arabic{age}}% COMBAT
 	{Aggression~\arabic{enc}, Projectiles~\arabic{r3b}, Academics~\arabic{r3}, Athletics~\arabic{r2b}, Deceit~\arabic{r2c}, Tactics~2, Vigilance~3
-	\knacks{\bloodCaster\ifodd\value{page}\combatcaster\else\backtothewall\fi, \ifnumcomp{\value{r3}}{>}{2}{\laststand}{\adrenalinesurge}}
+	\knacks{\bloodCaster, \ifodd\value{page}\combatcaster\else\backtothewall\fi, \ifnumcomp{\value{r3}}{>}{2}{\laststand}{\adrenalinesurge}}
 	\Path{\ifodd\value{r4}\aldaron\else \enchantment\fi~\arabic{r4}, \invocation~\arabic{enc}, \ifodd\value{r2}\force~\arabic{r3b}\else \polymorph~\arabic{r3}\fi }}{%
 	\iftoggle{bestiarychapter}{$3D6\times 100$gp, sitting in a lair.}{%
 		{\setcounter{gold}{\thepage}\addtocounter{gold}{-50}\multiply\value{gold} by \value{list}\multiply\value{gold} by \thechapter \ifnumcomp{\value{gold}}{>}{0}{\arabic{gold}gp in lair in assorted change}{None}}}}%
@@ -235,7 +235,7 @@
 	{2}% COMBAT
 	{Caving \arabic{r2}, Crafts~1, Tactics~1}% SKILLS
 	{\ifodd\value{r2}\woodaxe, \partialchain\else\shortsword, \partialplate\fi, \lootMedium}% EQUIPMENT
-	{\knacks{Chosen Enemy: Goblinoids}\ifodd\value{r2b}, \defender\fi}% SKILLS
+	{\knacks{Chosen Enemy: Goblinoids\ifodd\value{r2b}, \defender\fi}}% SKILLS
 }
 
 \newcommand{\dwarvenrunemaster}[1][\npc{\M}{Dwarven Runemaster}]{
diff --git a/stats.sty b/stats.sty
index e90577a4..f82028c2 100644
--- a/stats.sty
+++ b/stats.sty
@@ -125,7 +125,7 @@
 \newcounter{xp}
 \newcounter{xpbonus}
 \newcounter{attackXPtotal}
-\newcounter{defenceXPtotal}
+\newcounter{defenceXPtotal} %rem
 
 %                                                _
 %   ___ ___  _ __ ___  _ __ ___   __ _ _ __   __| |___
@@ -189,72 +189,6 @@
 \newcommand{\songCaster}{Song Caster\addtocounter{knacks}{1}\renewcommand{\magicPath}{Song}}
 \newcommand{\combatcaster}{Combat Caster\addtocounter{knacks}{1}}
 
-%%%%% Weapons
-
-\newcommand{\javelin}{Javelin\addtocounter{str}{1}\addtocounter{spd}{2}}
-\newcommand{\Dagger}{Dagger\addtocounter{str}{1}}
-\newcommand{\shortsword}{Shortsword\addtocounter{str}{1}\addtocounter{spd}{1}\addtocounter{dex}{2}}
-\newcommand{\club}{Club\addtocounter{str}{2}\addtocounter{spd}{1}\addtocounter{dex}{1}}
-\newcommand{\rapier}{Rapier\addtocounter{str}{1}\addtocounter{spd}{2}\addtocounter{dex}{1}}
-\newcommand{\longsword}{Longsword\addtocounter{str}{1}\addtocounter{spd}{1}\addtocounter{dex}{3}}
-\newcommand{\greatsword}{Greatsword\addtocounter{str}{2}\addtocounter{spd}{1}\addtocounter{dex}{2}}
-\newcommand{\spear}{Spear\addtocounter{str}{1}\addtocounter{spd}{1}\addtocounter{dex}{2}\addtocounter{spdb}{2}}
-\newcommand{\quarterstaff}{Quarterstaff\addtocounter{spd}{1}\addtocounter{dex}{2}\addtocounter{spdb}{2}}
-\newcommand{\greataxe}{Greataxe\addtocounter{str}{3}\addtocounter{spd}{1}\addtocounter{dex}{1}}
-\newcommand{\woodaxe}{Wood axe\addtocounter{str}{2}\addtocounter{dex}{1}}
-\newcommand{\greatclub}{Greatclub\addtocounter{str}{4}\addtocounter{spd}{1}\addtocounter{dex}{1}}
-\newcommand{\longbow}{Longbow}
-\newcommand{\shield}{\addtocounter{dex}{1}shield}
-\newcommand{\bucklar}{\addtocounter{dex}{1}bucklar shield}
-
-% ARMOUR
-
-%% For perfect armour, stick \perfectArmour in the additional notes category of a \person (#9).
-
-\newcommand{\perfectArmour}{\gdef\armourtype{(Perfect)}}
-
-\newcommand{\partialelvish}{partial leather armour%
-	\ifnumcomp{\value{dr}}{>}{2}%
-	{\addtocounter{dr}{1}}%
-	{\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{\completeleather}{full leather armour\gdef\armourtype{C}%
-	\ifnumcomp{\value{dr}}{>}{3}%
-	{\addtocounter{dr}{2}}%
-	{\divide\value{dr} by 2 \addtocounter{dr}{3}}%
-}
-
-\newcommand{\partialchain}{partial chainmail%
-	\ifnumcomp{\value{dr}}{>}{4}%
-	{\addtocounter{dr}{2}}%
-	{\divide\value{dr} by 2 \addtocounter{dr}{4}}%
-}
-
-\newcommand{\completechain}{complete chain armour\gdef\armourtype{C}%
-	\ifnumcomp{\value{dr}}{>}{4}%
-	{\addtocounter{dr}{2}}%
-	{\divide\value{dr} by 2 \addtocounter{dr}{4}}%
-}
-
-\newcommand{\partialplate}{partial plate armour%
-	\ifnumcomp{\value{dr}}{>}{5}%
-	{\addtocounter{dr}{3}}%
-	{\divide\value{dr} by 2 \addtocounter{dr}{5}}%
-}
-
-\newcommand{\completeplate}{complete plate armour\gdef\armourtype{C}%
-	\ifnumcomp{\value{dr}}{>}{5}%
-	{\addtocounter{dr}{3}}%
-	{\divide\value{dr} by 2 \addtocounter{dr}{5}}%
-}
-
 % 
 % _ __   ___ _ __ ___  ___  _ __  
 %| '_ \ / _ \ '__/ __|/ _ \| '_ \ 
@@ -375,6 +309,8 @@
 \newcommand{\clean}{
 	\setcounter{fp}{5}
 	\setcounter{sp}{0}
+	\setcounter{heft}{4}
+	\setcounter{damage}{0}
 	\setcounter{knacks}{0}
 	\renewcommand{\armourtype}{N}
 	\renewcommand{\weaponknackone}{}
@@ -430,9 +366,6 @@
 
 	\addtocounter{hp}{6}
 
-	\iftoggle{examplecharacter}{}{
-		\addtocounter{dex}{7}
-}
 \vspace{.1cm}
 \raggedright
 \noindent
@@ -486,20 +419,13 @@
 
 	\vspace{.1cm}
 
+\addtocounter{att}{\value{dex}}
+\addtocounter{attb}{\value{dexb}}
 \noindent Attack \arabic{att}\ifnumcomp{\value{att}}{=}{\value{attb}}{}{ (\arabic{attb})},
 	Initiative \arabic{spd}\ifnumcomp{\value{spd}}{=}{\value{spdb}}{}{ (\arabic{spdb})},
-	Damage \calculatedamage{\value{str}}\ifnumcomp{\value{str}}{=}{\value{strb}}{}{ (\calculatedamage{\value{strb}})}, 
-	\iftoggle{examplecharacter}{\mbox{Defence \arabic{dex},} }{%
-	TN \arabic{dex}%
-	\ifnumcomp{\value{dr}}{>}{0}{
-		\ifnum\pdfstrcmp{\armourtype}{P}=0%
-			\addtocounter{dexb}{3} (\arabic{dexb})%
-		\fi
-		\ifnum\pdfstrcmp{\armourtype}{C}=0%
-			\addtocounter{dexb}{5}~(\arabic{dexb})%
-		\fi%
-	}{}, 
-	}%
+  Heft \arabic{heft}, 
+  \addtocounter{damage}{\value{str}}
+	\mbox{Damage \calculatedamage{\value{damage}}\ifnumcomp{\value{str}}{=}{\value{strb}}{}{\addtocounter{damage}{\value{strb}}\addtocounter{damage}{-\value{str}} (\calculatedamage{\value{damage}})},} 
 	\ifnumcomp{\value{dr}}{>}{0}{DR \arabic{dr}~\armourtype, }{}%
 	\ifnum\value{mp}>0%
 		\addtocounter{mp}{\value{wts}}%
@@ -571,8 +497,6 @@
 	\multiply\value{defenceXPtotal} by \value{dr}
 	\multiply\value{defenceXPtotal} by \value{hp}
 
-\iftoggle{debug}{Defence total: \arabic{defenceXPtotal}}{}
-
 % XP = attackXPtotal + defenceXPtotal
 	\setcounter{xp}{\value{attackXPtotal}}
 	\addtocounter{xp}{\value{defenceXPtotal}}
-- 
GitLab