From f449a918588d8135ae7b0a783cfd54b2e04ec463 Mon Sep 17 00:00:00 2001
From: Malin Freeborn <malinfreeborn@posteo.net>
Date: Sun, 27 Aug 2023 12:09:03 +0200
Subject: [PATCH] automatically show short and long spells

---
 docs.tex  | 24 +++++++++++++++++++
 magic.sty | 70 ++++++++++++++++++++++++++++++++++++++-----------------
 2 files changed, 73 insertions(+), 21 deletions(-)

diff --git a/docs.tex b/docs.tex
index 31d88060..f2383135 100644
--- a/docs.tex
+++ b/docs.tex
@@ -165,6 +165,30 @@ After inputting that, you can get the spell, and the `printindex' command will c
   {Ground shakes}% Short Description
   {Brrrrrr}% Long Description
 
+In non-verbose mode, the same spell presents differently, and belong in the \verb"description" environment.
+
+\settoggle{verbose}{false}
+
+\begin{description}
+
+\spell{Quake}% Name
+  {Earth}% Spheres
+  {Wane}% Action
+  {\distant, \duplicated}% Enhancements
+  {Caving}% Skill
+  {Ground shakes}% Short Description
+  {Brrrrrr}% Long Description
+
+\end{description}
+
+Alternatively, pull in a bunch of spells from a sphere at a particular level with:
+
+\verb"\shortSpells{air2}"
+
+\ldots which shows Air spells of level 2.
+
+\settoggle{verbose}{true}
+
 \subsubsection{Magical Items}
 
 This is a magical item.
diff --git a/magic.sty b/magic.sty
index f9edea27..048d5110 100644
--- a/magic.sty
+++ b/magic.sty
@@ -29,27 +29,40 @@
   \foreach \s in {#4}{%
     \stepcounter{spelllevel}%
   }%
-  \setcounter{age}{\value{spelllevel}}%
-  \addtocounter{age}{6}%
-  \subsubsection[\textbf{#1}: #6. (Cost:~\arabic{spelllevel}, Spheres:~#2, \tn{\arabic{age}}, Skill:~#5, Range: \spellRange)]{#1}%
-  \label{#1}%
-
-  {\sffamily(#4
-  #3
-  #2)}
-  Cost:~\arabic{spelllevel},
-  \setRange%
-  Range:~\spellRange,
-  \setArea%
-  \iftoggle{duplicated}{%
-    Targets:~\spellArea, %
-  }{}%
-  \tn{\arabic{age}},
-  Skill:~\underline{#5}
-  \vspace{.5em}\afterparnoindent
-  \index[spells]{\textbf{#1}: #6. (Cost:~\arabic{spelllevel}, Spheres:~#2, Range: \spellRange\iftoggle{duplicated}{, Targets: \spellArea}{}, \tn{\arabic{age}}, Skill:~#5)}
-
-  #7
+  \iftoggle{verbose}{
+    \setcounter{age}{\value{spelllevel}}%
+    \addtocounter{age}{6}%
+    \subsubsection{#1}%
+    \label{#1}%
+
+    {\sffamily(#4
+    #3
+    #2)}
+    Cost:~\arabic{spelllevel},
+    \setRange%
+    Range:~\spellRange,
+    \setArea%
+    \iftoggle{duplicated}{%
+      Targets:~\spellArea, %
+    }{}%
+    \tn{\arabic{age}},
+    Skill:~\underline{#5}
+    \vspace{.5em}\afterparnoindent
+    \index[spells]{\textbf{#1}: #6. (Cost:~\arabic{spelllevel}, Spheres:~#2, Range: \spellRange\iftoggle{duplicated}{, Targets: \spellArea}{}, \tn{\arabic{age}}, Skill:~#5)}
+
+    #7
+  }{
+    \item[\textbf{#1}]
+    \hphantom{#4}%
+    \setArea%
+    \setRange%
+    \setcounter{age}{8}% to track TN
+    \addtocounter{age}{\value{#5}}%
+    (Cost:~\arabic{spelllevel}, Spheres:~#2, Range: \spellRange\iftoggle{duplicated}{, Targets: \spellArea}{}, \tn{\arabic{age}})
+
+    \item
+    \MakeUppercase#6.
+  }
 }
 
 \newcommand\spellRange{}
@@ -144,4 +157,19 @@
   \vspace{.3em}
 }
 
+\newcommand\shortSpells[1]{
+  \begin{description}
+    \settoggle{verbose}{false}
+    \foreach \s in {#1}{
+      \input{config/spells/\s.tex}
+    }
+  \end{description}
+}
+
+\newcommand\longSpells[1]{
+    \settoggle{verbose}{true}
+    \foreach \s in {#1}{
+      \input{config/spells/\s.tex}
+    }
+}
 
-- 
GitLab