From 6a019b6a6e88a2c841e9bf062e53b2d80205a629 Mon Sep 17 00:00:00 2001
From: Malin Freeborn <malinfreeborn@posteo.net>
Date: Sat, 11 Nov 2023 01:03:18 +0100
Subject: [PATCH] reformat talismans

---
 loot.sty      | 60 +++++++++++++++++++++------------------------------
 magic.sty     | 38 ++++++++++++++++++++++----------
 talismans.sty | 42 ++++++++++++++++++++++++++++++++++++
 3 files changed, 94 insertions(+), 46 deletions(-)

diff --git a/loot.sty b/loot.sty
index da4bccaa..76d9fc50 100644
--- a/loot.sty
+++ b/loot.sty
@@ -81,43 +81,33 @@
 }
 
 \newcommand{\lootMagic}{%
-  \ifnum\value{noAppearing}>1%
-  Mana stone holding 2 MP%
-  \else%
-  \iftoggle{genExamples}{}%
-    {%
-      \stepcounter{treasure}%
-      \ifnum\value{treasure}>10\setcounter{treasure}{0}\fi%
-      \ifcase\value{treasure}\relax%
-        Sorcerer's Eye\index{Magical Item!Sorcerer's Eye}%
-      \or%1
-        quiver with \arabic{r12} Spider Arrows\index{Magical Item!Spider Arrows}%
-      \or%2
-        pouch of Wild Seeds\index{Magical Item!Wild Seeds}%
-      \or%3
-        Bag of Holding\index{Magical Item!Bag of Holding}%
-      \or%4
-        Defensive Heart\index{Magical Item!Defensive Heart}%
-      \or%5
-        Portal Scroll\index{Magical Item!Portal Scroll}%
-      \or%6
-        Sleeping Dust\index{Magical Item!Sleeping Dust}%
-      \or%7
-        Ring of Asphyxiation\index{Magical Item!Ring of Asphyxiation}%
-      \or%8
-        Ghost Shield\index{Magical Item!Ghost Shield}%
-      \or%9
-        Bag of Tricks\index{Magical Item!Bag of Tricks}%
-      \or%10
-        Taming Flute\index{Magical Item!Taming Flute}%
-      \else%11
-        Mana Stone with 4 \glspl{mp}%
-      \fi%
-    }%
-  \fi%
+  \iftoggle{verbose}{
+    \ifnum\value{noAppearing}>1%
+    Mana stone holding 2 MP%
+    \else%
+    \iftoggle{genExamples}{}%
+      {%
+        \ifnum\value{treasure}>10\setcounter{treasure}{0}\fi%
+        \ifcase\value{treasure}\relax%
+          \scrollOfFriendship%
+        \or%1
+          \bloodCandle%
+        \or%2
+          \minersWeed%
+        \or%3
+          \oceanPhial%
+        \or%4
+          \hagFinger%
+        \else%11
+          \homeScroll%
+        \fi%
+        \setcounter{track}{\value{treasure}}%
+        \stepcounter{treasure}%
+      }%
+    \fi%
+  }{}
 }
 
-
 \newcommand{\lootJewellery}{%
 \iftoggle{genExamples}{jewellery worth \ifodd\value{r2}$3D6$sp\else$1D6+2$\glspl{gp}\fi}%
 	{%
diff --git a/magic.sty b/magic.sty
index 9543f0a2..aec9ce97 100644
--- a/magic.sty
+++ b/magic.sty
@@ -68,7 +68,8 @@
   \settoggle{distant}{false}
 \newtoggle{duplicated}
   \settoggle{duplicated}{false}
-
+\newtoggle{opposedSpell}
+  \settoggle{opposedSpell}{false}
 
 
 \newcommand\calcSpell[7]{%
@@ -99,9 +100,10 @@
   }{%
     \addtocounter{castingBonus}{\value{Charisma}}%
   }%
-  \renewcommand\spellResistance{#5}
-  \renewcommand\spellSum{#6}
-  \renewcommand\spellNotes{#7}
+  \renewcommand\spellResistance{#5}%
+  \ifdefmacro{#5}{\toggletrue{opposedSpell}}{\togglefalse{opposedSpell}}%
+  \renewcommand\spellSum{#6}%
+  \renewcommand\spellNotes{#7}%
   \setRange%
     \multiply\value{spellTargets} by \value{spellCost}%
     \multiply\value{spellTargets} by \value{spellCost}%
@@ -185,20 +187,34 @@
 }
 
 \newcommand\showTalisman{
-  \addtocounter{castingBonus}{7}%
-  \paragraph{\spellName}
-  \spellSum
+  \iftoggle{creatureBox}{%
+    \spellName\ talisman%
+    \setcounter{track}{\value{treasure}}%
+  }{%
+    \paragraph{\spellName}%
+    \spellSum
 
-  Resisted by: \spellResistance\ (\tn[\arabic{castingBonus}])
+    \spellNotes
+    \iftoggle{opposedSpell}{
+      \addtocounter{castingBonus}{7}
+      Resisted by: \spellResistance\ (\tn[\arabic{castingBonus}])
+    }{
 
-  \spellNotes
+      Roll: \absNum{castingBonus}, \gls{tn} set by \spellResistance.
+    }%
+  }%
 }
 
 \newcommand\talisman[7]{%
-  \toggletrue{talisman}
+  \setcounter{Charisma}{0}%
   \calcSpell{#1}{#2}{#3}{#4}{#5}{#6}{#7}%
-  \index{Talismans!#1}
+  \index{Talismans!#1}%
+  \setcounter{castingBonus}{\value{spellCost}}%
   \showTalisman
   \togglefalse{talisman}
 }
 
+\newcommand\explainTalisman{%
+  \setcounter{treasure}{\value{track}}%
+  \lootMagic%
+}
diff --git a/talismans.sty b/talismans.sty
index b4e12c5d..c4700336 100644
--- a/talismans.sty
+++ b/talismans.sty
@@ -33,3 +33,45 @@
     }% Details
 }
 
+\newcommand\oceanPhial{
+  \talisman{Ocean's Phial}% Name
+    {duplicated,distant}% Enhancements
+    {Wax}% Action
+    {Water}% Spheres
+    {stagnant water}% Resistance
+    {
+      Drop it in any large body of water, and watch the water whirl!
+      Anyone in or near the water gets dragged down or thrown back, unless they pass a \roll{Strength}{Athletics} check,
+      \setcounter{tn}{7}\addtocounter{tn}{\value{spellCost}}%
+      \tn.
+    }% Summary
+    {
+    The phial will take a -3 penalty for use next to small bodies of water, such as puddles, or a +3 Bonus when used on people \emph{inside} a raging river.
+    }% Details
+}
+
+\newcommand\hagFinger{
+  \talisman{Hag's Finger}% Name
+    {detailed}% Enhancements
+    {Wane}% Action
+    {Water}% Spheres
+    {\roll{Charisma}{Stealth}}% Resistance
+    {
+      Point the mummified finger at a cretin, then crack the finger's knuckle till it breaks.
+      The cretin will suffer \arabic{spellPlusTwo} encounters before the next day's light.
+    }% Summary
+    {}% Details
+}
+
+\newcommand\homeScroll{
+  \talisman{Home Scroll}% Name
+    {detailed,distant,duplicated}% Enhancements
+    {Warp}% Action
+    {Earth,Fire}% Spheres
+    {movement, such as wind}% Resistance
+    {
+      This scroll searches for somewhere windless and calm, around a day's walk, and then opens a rift in space to that location.
+    }% Summary
+    {}% Details
+}
+
-- 
GitLab