From 40ad0550df785f5beaf8984d35d435545977d833 Mon Sep 17 00:00:00 2001
From: Malin Freeborn <malinfreeborn@posteo.net>
Date: Fri, 1 Sep 2023 21:41:14 +0200
Subject: [PATCH] show TN to resist spell

---
 docs.tex         | 28 +++++++++++++++-------
 magic.sty        | 62 +++++++++++++++++++++++++++++++++++-------------
 monsters.sty     | 34 +++++++++++---------------
 spells/air2.tex  |  2 +-
 spells/fire1.tex |  4 ++--
 5 files changed, 83 insertions(+), 47 deletions(-)

diff --git a/docs.tex b/docs.tex
index 89e1993d..e9dd3e42 100644
--- a/docs.tex
+++ b/docs.tex
@@ -3,6 +3,8 @@
 
 \date{\today}
 
+\externalReferent{judgement}
+
 \begin{document}
 
 \frontpage%
@@ -150,7 +152,7 @@ title={Spell Summaries},columns=2]
   {Earth}% Spheres
   {Wane}% Action
   {\distant, \duplicated}% Enhancements
-  {Caving}% Skill
+  {the rock's density}% Skill
   {Ground shakes}% Short Description
   {Brrrrrr}% Long Description
 
@@ -159,19 +161,29 @@ title={Spell Summaries},columns=2]
 
 After inputting that, you can get the spell, and the `printindex' command will create a spell-list by using a special index, just for spells.
 
-In non-verbose mode, the same spell presents differently, and belong in the \verb"description" environment.
+\spell{Quake}% Name
+  {Earth}% Spheres
+  {Wane}% Action
+  {\distant, \duplicated}% Enhancements
+  {the rock's density}% Skill
+  {Ground shakes}% Short Description
+  {Brrrrrr}% Long Description
+
+Alternatively, pull in a bunch of spells from a sphere at a particular level with:
+
+\verb"\showSpells{fate1,air2}"
 
-\settoggle{genExamples}{true}
+\showSpells{fate1,air2}
 
-\showSpells{mind2}
+\ldots which shows Air spells of level 2, and Fate at level 1.
 
-Alternatively, pull in a bunch of spells from a sphere at a particular level with:
+Alternatively, input the spells after a creature, with:
 
-\verb"\shortSpells{air2}"
+\verb"\creatureSpells{fate1,air2}"
 
-\ldots which shows Air spells of level 2.
+\demilich
 
-\settoggle{verbose}{true}
+\creatureSpells{fate1,air2}
 
 \subsubsection{Magical Items}
 
diff --git a/magic.sty b/magic.sty
index 1f2ad5fc..b6df5459 100644
--- a/magic.sty
+++ b/magic.sty
@@ -6,15 +6,47 @@
 % |_|  |_|\__,_|\__, |_|\___|
 %               |___/        
 
-\newcommand\mFate{Fate\global\settoggle{insubstantial}{true}}
-\newcommand\mEarth{Earth}
-\newcommand\mAir{Air\global\settoggle{insubstantial}{true}}
-\newcommand\mFire{Fire}
-\newcommand\mWater{Water}
 
 % We use spellPotency to track spell effects which are typically larger than the spell's level.
 \newcounter{spellPotency}
 
+% spellResTN is the TN to resist spells, used only in specified spells beneath creatures. For example, if someone had Air 2, resisting their spells would be TN (7 + 2) 9.
+\newcounter{spellResTN}
+
+
+\newcommand\mFate{%
+  Fate%
+  \global\settoggle{insubstantial}{true}%
+  \ifnum\value{spellResTN}<8%
+    \addtocounter{spellResTN}{\value{Fate}}%
+  \fi%
+}
+\newcommand\mEarth{%
+  Earth%
+  \ifnum\value{spellResTN}<8%
+    \addtocounter{spellResTN}{\value{Earth}}
+  \fi%
+}
+\newcommand\mAir{%
+  Air%
+  \global\settoggle{insubstantial}{true}%
+  \ifnum\value{spellResTN}<8%
+    \addtocounter{spellResTN}{\value{Air}}
+  \fi%
+}
+\newcommand\mFire{%
+  Fire%
+  \ifnum\value{spellResTN}<8%
+    \addtocounter{spellResTN}{\value{Fire}}
+  \fi%
+}
+\newcommand\mWater{%
+  Water%
+  \ifnum\value{spellResTN}<8%
+    \addtocounter{spellResTN}{\value{Water}}
+  \fi%
+}
+
 % 1 = Name
 % 2 = Spheres
 % 3 = Action
@@ -26,13 +58,14 @@
 \newcommand{\spell}[7]{
   \global\settoggle{distant}{false}%
   \global\settoggle{duplicated}{false}%
-  \global\settoggle{insubstantial}{false}
+  \global\settoggle{insubstantial}{false}%
   \setcounter{spelllevel}{1}%
   \foreach \s in {#4}{%
     \stepcounter{spelllevel}%
   }%
   \setcounter{spellPotency}{\value{spelllevel}}%
-  \addtocounter{spellPotency}{2}%
+    \addtocounter{spellPotency}{2}%
+  \setcounter{spellResTN}{7}%
   \iftoggle{genExamples}{
     \subsubsection{#1}%
     \label{#1}%
@@ -47,8 +80,6 @@
     \iftoggle{duplicated}{%
       Targets:~\spellArea, %
     }{}%
-    Resistance:~#5
-    \par
     \afterparnoindent
 
     #7
@@ -59,19 +90,18 @@
       The \glsentrytext{tn} equals 7, with modifiers for #5.
     }
 
-    %\ifcsmacro{#5}{
-    %  The \glsentrytext{tn} equals 7 plus the opponent's #5.
-    %}{
-    %  The \glsentrytext{tn} depends upon #5.
-    %}
   }{
     \item[\textbf{#1}]
     \hphantom{#4}%
     \setArea%
     \setRange%
-    (Cost:~\arabic{spelllevel}, Spheres:~#2, Range: \spellRange\iftoggle{duplicated}{, Targets: \spellArea}{}, \tn[\arabic{age}])
+    (Cost:~\arabic{spelllevel}, Spheres:~#2, Range: \spellRange\iftoggle{duplicated}{, Targets: \spellArea}{})
 
-    \MakeUppercase#6.
+    \ifdefparam{#5}{
+      Roll #5, \tn, or #6.
+    }{
+      \MakeUppercase#6.
+    }
   }
 }
 
diff --git a/monsters.sty b/monsters.sty
index 7d7aa848..7108fdf6 100644
--- a/monsters.sty
+++ b/monsters.sty
@@ -213,22 +213,17 @@
     Brawl~\arabic{enc}, Projectiles~\arabic{r3b}, Academics~\arabic{r3}, Athletics~\arabic{r2b}, Deceit~\arabic{r2c}, Tactics~2, Vigilance~3\ifnum\value{r3}<3,
     \setcounter{gold}{3}\addtocounter{gold}{-\value{r3}}%
     Xenomology~\arabic{gold}\fi
-      \Path{
-        \ifodd\value{r4}
-          Air \arabic{r3b},
-        \fi
-        Fire~\arabic{r2d},
-        \ifodd\value{r2}
-          Fate~2
-          \ifodd\value{r2c},
-            Water 1
-          \fi
-        \fi
-    }
   }{}%
 	{
     \knacks{\ifodd\value{page}\chosenEnemy{Dwarves}\else\charge\fi, \ifnumcomp{\value{r3}}{>}{2}{\laststand}{\adrenalinesurge}}
     \hide{\value{gold}}
+    \ifodd\value{r4}%
+      \setcounter{Air}{\value{r3b}}%
+    \fi%
+      \setcounter{Fire}{\value{r2d}}%
+      \ifodd\value{r2}%
+        \setcounter{Fate}{\value{r2c}}%
+      \fi%
   }
 	}
 
@@ -1505,13 +1500,6 @@ mana stone holding \arabic{track} MP, \ifodd\thechapter\lootJewellery\fi}% EQUIP
 {2}% DR
 {\arabic{r2}}% AGGRESSION
 {Brawl 2, Projectiles~\arabic{r2}, Academics~\arabic{r3}, Deceit~1, Medicine~\arabic{r3c}, Vigilance~\arabic{r2}
-  \Path{
-    Air~\arabic{r3}, Fate~\arabic{r3b}, Water~\arabic{r3c}, %
-    Fire~\arabic{r2d}, %
-    \ifodd\value{r4}%
-      Earth~1
-    \fi%
-  }
 }% SKILLS
 {\ifodd\thechapter%
 	\Dagger, %
@@ -1527,7 +1515,13 @@ mana stone holding \arabic{track} MP, \ifodd\thechapter\lootJewellery\fi}% EQUIP
 , mana stone with \arabic{track} mana, \lootJewellery, \randomtwo\lootJewellery, \lootMagic}% EQUIPMENT
 {%
   \lockedmana{\value{r4}}
-  \renewcommand\abilities{\undead}
+  \setcounter{Air}{\value{r3}}%
+  \setcounter{Fate}{\value{r3b}}%
+  \setcounter{Water}{\value{r3c}}%
+  \ifodd\value{r4}%
+    \setcounter{Earth}{1}%
+  \fi%
+  \undead
 }
 }
 
diff --git a/spells/air2.tex b/spells/air2.tex
index 52451425..3c818d6e 100644
--- a/spells/air2.tex
+++ b/spells/air2.tex
@@ -3,7 +3,7 @@
   {\mAir}% Spheres
   {Wax}% Action
   {\duplicated}% Enhancements
-  {Seafaring}% Skill
+  {\roll{Strength}{Athletics}}% Skill
   {targets lose \arabic{spelllevel} \glspl{ap} and get pushed back \arabic{spelllevel}~\glspl{ap} minus Strength}% Description
   {
     \spellArea\ targets within \spellRange\ receive a blast of wind, and lose \arabic{spelllevel}~\glspl{ap}.
diff --git a/spells/fire1.tex b/spells/fire1.tex
index 3b33cf50..6e31171b 100644
--- a/spells/fire1.tex
+++ b/spells/fire1.tex
@@ -2,8 +2,8 @@
   {\mFire}% Spheres
   {Wax}% Action
   {}% Enhancements
-  {Wyldcrafting}% Skill
-  {target fire flares, inflicting \arabic{spelllevel} Damage plus size bonus}% Description
+  {\roll{Wits}{Athletics}}% Skill
+  {target fire flares, inflicting \arabic{spellPotency} Damage on all around}% Description
   {
     A fire-source roars, growing loud, aggressive, and large enough to damage anyone next to it.
 
-- 
GitLab