Skip to content
Snippets Groups Projects
stats.sty 20.8 KiB
Newer Older
  • Learn to ignore specific revisions
  • \ProvidesPackage{config/stats}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    %%%%%%%%%%%%%%%%%%%% Introduction
    
    \newtoggle{bestiarychapter}
    \settoggle{bestiarychapter}{false}
    
    
    \newtoggle{allyCharacter}
    \settoggle{allyCharacter}{false}
    
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    %      _        _   
    %  ___| |_ __ _| |_ 
    % / __| __/ _` | __|
    % \__ \ || (_| | |_ 
    % |___/\__\__,_|\__|
    %                   
    % 
    %  _     _            _        
    % | |__ | | ___   ___| | _____ 
    % | '_ \| |/ _ \ / __| |/ / __|
    % | |_) | | (_) | (__|   <\__ \
    % |_.__/|_|\___/ \___|_|\_\___/
    %                              
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    %
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    % This file makes stat blocks for monsters.
    % 
    % The writer feeds in something like this:
    % 
    % \npc{\M}{Patrick the Pyromanacer}
    % 
    % \person{0}% STRENGTH
    % {0}% DEXTERITY 
    % {0}% SPEED
    % {{0}% INTELLIGENCE
    % {0}% WITS
    % {0}}% CHARISMA
    % {0}% DR
    % {0}% COMBAT
    % {}% SKILLS
    % {Nothing}% EQUIPMENT
    % {}
    % 
    % The \person command takes various stats, and
    % inside that 'SKILLS' variable (variable no. 8),
    % we can add additional things, like
    
    % \knacks{\adrenalinesurge}.
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    % 
    % Most of the rest of the commands deal with
    % properly calculating derived stats, like the TN
    % to hit the creature.
    
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    \newtoggle{mind}
    
    \newtoggle{creatureBox}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newtoggle{examplecharacter}
    \settoggle{examplecharacter}{false}
    \newtoggle{debug}\settoggle{debug}{false}
    \newcommand{\ent}[1]{\textbf{#1}}
    \newcommand{\test}{}
    \newcommand{\skills}{}
    \newcommand{\equipment}{}
    \newcommand{\mods}{}
    
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    % we calculate damage here because we can't display 1d6+6 damage - it has to turn into 2d6+2 damage.
    
    \newcommand{\dmg}[1]{%
    
      \ifnum\value{#1}<1 0\else%
        \setcounter{damagebonus}{\value{#1}}%
        \setcounter{numberofdice}{1}%
        \addtocounter{damagebonus}{-4}%
        \whileboolexpr{%
          test {\ifnumcomp{\value{damagebonus}}{>}{3}}%
        }{%
          \addtocounter{damagebonus}{-4}%
          \addtocounter{numberofdice}{1}%
        }%
        {\arabic{numberofdice}D6%
        \ifnumcomp{\value{damagebonus}}{>}{0}%
          {+\arabic{damagebonus}}%
          {%
          \ifnumcomp{\value{damagebonus}}{<}{0}{%
            \arabic{damagebonus}%
          }{}%
          }%
        }%
      \fi%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    }
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    
    \newcommand\showBoxes{
      \ifnum\value{mp}<1
    
        \ifnum\value{hp}>11
    
          \HPboxes
        \else
    
          \ifnum\value{hp}>6
    
            \HPHPboxes
          \else
            \HPHPHPboxes
          \fi
        \fi
      \else
        \ifnum\value{sp}<1
          \HPMPboxes
        \else
          \HPMPSPboxes
        \fi
      \fi
    
    }
    
    
    \newcommand\boxStat[2][0]{%
      \addtocounter{#2}{-#1}%
      \Repeat{#1}{\sqr}%
      \Repeat{\value{#2}}{\sqn}%
    }
    
    
    \newcommand\HPboxes{
      \begin{tabular}{r}
    
      \hiderowcolors
    
        HP \arabic{hp}
        \Repeat{\value{noAppearing}}{
        \boxStat{hp} \\
        }
      \end{tabular}
    }
    
    \newcommand\HPHPboxes{
      \begin{tabular}{rr}
    
      \hiderowcolors
    
        HP \arabic{hp}
        \whileboolexpr{test {\ifnumcomp{\value{noAppearing}}{>}{0}}}{%
          \ifnumodd{\value{noAppearing}}{ & \boxStat{hp} \\}{\boxStat{hp}}%
          \addtocounter{noAppearing}{-1}
        }
      \end{tabular}
    }
    
    \newcommand\HPHPHPboxes{
      \begin{tabular}{rrr}
    
        \hiderowcolors
    
        HP \arabic{hp}
        \whileboolexpr{test {\ifnumcomp{\value{noAppearing}}{>}{0}}}{%
          \boxStat{hp}
          \addtocounter{noAppearing}{-1}
          &
          \ifnum\value{noAppearing}>0\boxStat{hp}\fi
    
          \addtocounter{noAppearing}{-1}
    
          &
          \ifnum\value{noAppearing}>0\boxStat{hp}\fi
    
          \addtocounter{noAppearing}{-1}
    
          \\
        }
      \end{tabular}
    }
    
    \newcommand\HPMPboxes{
      \setcounter{enc}{\value{hp}}
      \addtocounter{enc}{\value{mp}}
      \ifnum\value{enc}<20
        \begin{tabular}{rr}
    
          \hiderowcolors
    
          \Repeat{\value{noAppearing}}{
          HP \arabic{hp}
          \boxStat{hp}
          &
          MP \arabic{mp}
          \boxStat{mp}
          \\
          }
        \end{tabular}
      \else
        \begin{tabular}{r}
    
          \hiderowcolors
    
          \Repeat{\value{noAppearing}}{
          HP \arabic{hp} \boxStat{hp} \\
          MP \arabic{mp} \boxStat{mp} \\
          }
        \end{tabular}
      \fi
    }
    
    \newcommand\HPMPSPboxes{
      \setcounter{enc}{\value{hp}}
      \addtocounter{enc}{\value{mp}}
      \addtocounter{enc}{\value{sp}}
      \ifnum\value{enc}<20
        \begin{tabular}{rrr}
    
          \hiderowcolors
    
          \Repeat{\value{noAppearing}}{
          HP \arabic{hp}
          \boxStat{hp}
          &
          MP \arabic{mp}
          \boxStat{mp}
          &
          SP \arabic{sp}
          \boxStat{sp}
          \\
          }
        \end{tabular}
      \else
        \ifnum\value{enc}<10
          \begin{tabular}{rr}
    
            \hiderowcolors
    
            \Repeat{\value{noAppearing}}{
              HP \arabic{hp} \boxStat{hp} &
              MP \arabic{mp} \boxStat{mp} \\
              & SP \arabic{sp} \boxStat{sp} \\
            }
          \end{tabular}
        \else
          \begin{tabular}{r}
    
            \hiderowcolors
    
            \Repeat{\value{noAppearing}}{
    
    Malin Freeborn's avatar
    Malin Freeborn committed
              HP \arabic{hp} \boxStat{hp} \\
    
              MP \arabic{mp} \boxStat{mp} \\
              SP \arabic{sp} \boxStat{sp} \\
            }
          \end{tabular}
        \fi
      \fi
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    %%%%%%%%%%%%%%%%%%%% Character Generation %%%%%%%%%%%%%%%%%%%%
    %
    %                       _                
    %  ___ ___  _   _ _ __ | |_ ___ _ __ ___ 
    % / __/ _ \| | | | '_ \| __/ _ \ '__/ __|
    %| (_| (_) | |_| | | | | ||  __/ |  \__ \
    % \___\___/ \__,_|_| |_|\__\___|_|  |___/
    %                                        
    %
    % Attributes: str, dex, spd, int, wts, cha
    % secondary str, dex and spd
    \newcounter{str}
    \newcounter{dex}
    \newcounter{spd}
    \newcounter{int}
    \newcounter{wts}
    \newcounter{cha}
    \newcounter{att}
    \newcounter{dr}
    \newcounter{knacks}
    
    
    % Extras: MP hp fp
    % Derived: dicenumber, dicebonus,
    \newcounter{mp}
    
    \newcounter{mpLocked}
    \newcounter{mpFree}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcounter{sp}
    \newcounter{hp}
    \newcounter{fp}
    \newcounter{numberofdice}
    \newcounter{damagebonus}
    \newcounter{xp}
    \newcounter{xpbonus}
    \newcounter{attackXPtotal}
    
    \newcounter{defenceXPtotal} %rem
    
    \newcounter{initiative}
    \newcounter{weight}
    
    \newcounter{ap}
    
    \newcounter{damage}
    \newcounter{shieldBonus}
    \newcounter{shieldWeight}
    \newcounter{shieldInit}
    \newcounter{cost}
    \newcounter{heft}% used to see how many AP points to swing a weapon
    \newcounter{encumbrance}
      \setcounter{encumbrance}{0}
    
    
    \newcounter{boxCols}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    %                                                _
    %   ___ ___  _ __ ___  _ __ ___   __ _ _ __   __| |___
    %  / __/ _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` / __|
    % | (_| (_) | | | | | | | | | | | (_| | | | | (_| \__ \
    %  \___\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|___/
    % 
    
    
    
    % magic
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\magicPath}{}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\mana}[1]{\setcounter{mp}{#1}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\aldaron}{\addtocounter{mp}{3}Aldaron}
    \newcommand{\conjuration}{\addtocounter{mp}{3}Conjuration}
    \newcommand{\enchantment}{\addtocounter{mp}{3}Enchantment}
    \newcommand{\fate}{\addtocounter{mp}{3}Fate}
    \newcommand{\force}{\addtocounter{mp}{3}Force}
    \newcommand{\invocation}{\addtocounter{mp}{3}Invocation}
    \newcommand{\illusion}{\addtocounter{mp}{3}Illusion}
    \newcommand{\necromancy}{\addtocounter{mp}{3}Necromancy}
    \newcommand{\polymorph}{\addtocounter{mp}{3}Polymorph}
    \newcommand{\saurecanta}{\addtocounter{mp}{3}Saurecanta}
    
    \newcommand{\lockedmana}[1]{\setcounter{mpLocked}{#1}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    \newcommand{\knacks}[1]{ \\
    	\ent{Knacks:} & #1 
    }
    
    
    \newcommand{\showAbilities}[1]{ \\
    
    	\ent{Abilities:} & \abilities
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    %%%%%%%%%%%%%%%%%%%%% Knacks
    %
    
    \newcommand{\adrenalinesurge}{%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \addtocounter{knacks}{1}%
    
      Adrenaline Surge (+1 Damage, once per \ifnum\value{knacks}<2 combat\else round, \arabic{knacks} uses per combat\fi)%
    
    }
    \newcommand{\berserker}{%
    
      Berserker (+1 \glsentrytext{ap}. on round 2 of combat, +1 Damage. on round 3)%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \addtocounter{knacks}{1}%
    
    }
    \newcommand{\brawler}{Brawler\addtocounter{knacks}{1}%
    
    \iftoggle{examplecharacter}{ (+2 to unarmed attacks)}{}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\charge}{%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      Fast Charge
    
      (+1 \glsentrytext{ap}, Attack, and Damage after charging 6 steps)%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \addtocounter{knacks}{1}%
    }
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\cuttingswing}{%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      Cutting Swing
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      (when an opponent hits 0 \glspl{hp}, damage transfers to the next opponent)%
      \addtocounter{knacks}{1}%
    }
    \newcommand{\dodger}{%
      \addtocounter{knacks}{1}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      Dodger
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      (+\arabic{knacks} to dodge projectiles)%
    }
    \newcommand{\guardian}{%
      \addtocounter{knacks}{1}%
      Guardian
      (spend 0 AP to guard someone, and gain +1 to guarding against attacks)%
    }
    \newcommand{\laststand}{%
      \addtocounter{knacks}{1}%
      Last Stand
      (when losing \glspl{hp}, the character gains \setcounter{enc}{2}\addtocounter{enc}{\value{knacks}}\arabic{enc} AP)%
    }
    \newcommand{\lucky}{%
      \addtocounter{knacks}{1}%
      \addtocounter{fp}{4}%
    
      Lucky (add 4 \glsentryshortpl{fp})
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    }
    
    \newcommand{\mightydraw}{%
      \addtocounter{knacks}{1}%
      Mighty Draw
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \setcounter{enc}{\value{knacks}}\roundUp{enc} (reduce cost to draw longbow by \arabic{enc} AP)
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    }
    \newcommand{\perfectsneakattack}{%
      \addtocounter{knacks}{1}%
      Perfect Sneak Attack
      (+\arabic{knacks} Damage for sneak attacks)
    }
    \newcommand{\precisestrike}{%
      \addtocounter{knacks}{1}%
      Precise Strike
      (+1 Attack when calculating Vitals shot)
    }
    
    \newcommand{\specialist}[1]{Specialist \addtocounter{knacks}{1}
    \iftoggle{examplecharacter}{ (+2 when using any #1)}{(#1)}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\stunningstrike}{%
      \addtocounter{knacks}{1}%
      Stunning Strike
      (take -1 penalty, and opponent's AP reduces by half Damage)%
    }
    \newcommand{\snapshot}{%
      \addtocounter{knacks}{1}%
      Snap Shot
      (Pay 0 AP to reload arrow or draw weapon)%
    }
    \newcommand{\unstoppable}{%
      \addtocounter{knacks}{1}%
      \addtocounter{hp}{2}%
      Unstoppable
    
      (+2 \glsentryshortpl{hp}, and +\arabic{knacks} to any Medicine rolls to save them when dying)
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    }
    
    \newcommand{\vengeful}{Vengeful\addtocounter{knacks}{1}%
    \iftoggle{examplecharacter}{ (+2 Intelligence after losing HP)}{}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \newcommand{\weaponmaster}[1]{%
      \addtocounter{att}{1}%
      \addtocounter{knacks}{1}%
      Weapon Master
      (+1 Attack when using a {#1})
    }
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\autophage}{%
      \addtocounter{knacks}{1}%
      Autophage
      (cast with \glspl{fatigue} instead of \glspl{mp})
    }
    
    
    \newcommand{\snapcaster}{%
      \addtocounter{knacks}{1}%
      Snap Caster
    
      (spells use Wits and cost 1 less \glsentrytext{ap})
    
    \newcommand{\ritualcaster}{%
      \addtocounter{knacks}{1}%
      Ritual Caster
      (spells use Intelligence, caster may spend 1 extra \gls{mp})
    }
    
    
    \newcommand{\fasthealer}{%
      \addtocounter{knacks}{1}%
      Fast Healer
      (resting heals 2 additional \glspl{fatigue} and 1 \gls{mp})
    }
    
    
    \newcommand{\combatcaster}{Combat Caster\addtocounter{knacks}{1}}
    
    \newcommand\chosenEnemy[1]{Chosen Enemy (+1 against #1, -2 when trying to be friendly)\addtocounter{knacks}{1}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    % _ __   ___ _ __ ___  ___  _ __  
    %| '_ \ / _ \ '__/ __|/ _ \| '_ \ 
    %| |_) |  __/ |  \__ \ (_) | | | |
    %| .__/ \___|_|  |___/\___/|_| |_|
    %|_|                              
    % 
    %
    %       _                          _            
    %%  ___| |__   __ _ _ __ __ _  ___| |_ ___ _ __ 
    %% / __| '_ \ / _` | '__/ _` |/ __| __/ _ \ '__|
    %%| (__| | | | (_| | | | (_| | (__| ||  __/ |   
    %% \___|_| |_|\__,_|_|  \__,_|\___|\__\___|_|   
    %%                                              
    %%  optional counters, such as mana, are cleaned
    %%  clear: weaponsknack1 and 2, 
    %% 
    %
    \newcommand{\mind}[3]{
    \setcounter{int}{#1}\setcounter{wts}{#2}\setcounter{cha}{#3}
    }
    %
    
    %%%%%%%%%%% Person
    %
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\person}[9]{
    
      \settoggle{creatureBox}{true}
    
      \settoggle{mind}{true}
      \setcounter{str}{#1}
    
    	\setcounter{hp}{#1}
    
      \setcounter{dex}{#2}
      \setcounter{spd}{#3}
      \mind#4
      \setcounter{dr}{#5}
      \setcounter{att}{#6}
      \renewcommand{\skills}{#7}
      \renewcommand{\equipment}{#8}
      \renewcommand{\mods}{#9}
    
      \clean
    
    
      \iftoggle{verbose}{
    
        \begin{tcolorbox}[
    
          title={\npcsymbol\ \name},
    
          before upper={\parindent0pt},
          ornamented,
          fontupper=\small,
          halign=flush left,
          left=10pt,
          right=15pt,
          top=0pt,
          ]
    
    
        \creaturestats
    
    
        \derivedstats
    
        \end{tcolorbox}
    
    
        \vspace{2em}
        \noindent
        \begin{minipage}{\linewidth}
    
        \hrulefill\hspace{-0.15em}\raisebox{-0.2em}{\npcsymbol}
    
    
        \begin{center}\textbf{\large\name}\end{center}
        \mods
        \hphantom{\equipment}
        \derivedstats
    
    
        \ifdefempty{\abilities}{}{
          Abilities: \abilities
        }
    
    
        Equipment: \equipment
    
        \hrulefill
        \end{minipage}
    
      \iftoggle{personality}{
    
        \textbf{Archetype:} \archetype, 
    
        \textbf{Description:} \NPCdescription
    
        \textbf{Mannerism:} \mannerism
    
        \vspace{1em}
    
        \settoggle{personality}{false}}%
    	{}
    
      \settoggle{creatureBox}{false}
    
      \setcounter{noAppearing}{1}
    
      \renewcommand\abilities{}
    
      \afterparnoindent
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\animal}[9]{
    
      \settoggle{creatureBox}{true}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\settoggle{mind}{false}
    	\setcounter{str}{#1}
    
    	\setcounter{hp}{#1}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\setcounter{dex}{#2}
    	\setcounter{spd}{#3}
    	\setcounter{wts}{#4}
    	\setcounter{dr}{#5}
    	\setcounter{att}{#6}
    
      \setcounter{encumbrance}{0}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\renewcommand{\skills}{#7}
    	\renewcommand{\abilities}{#8}
    	\renewcommand{\mods}{#9}
    
      \setcounter{covering}{4}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\clean
    
      \iftoggle{verbose}{
    
        \begin{tcolorbox}[title={\npcsymbol\ \name},
    
          before upper={\parindent0pt},
          ornamented,
          halign=flush left,
          left=10pt,
          right=15pt,
          ]
    
        \iftoggle{personality}{
    
        \begin{minipage}{\linewidth}
    
        \textbf{Description:} \NPCdescription
    
        \textbf{Mannerism:} \mannerism
    
        \end{minipage}
    
        \vspace{1em}
    
        \settoggle{personality}{false}}%
        
    
        \creaturestats
    
    
        \derivedstats
    
        \end{tcolorbox}
    
    
        \vspace{2em}
        \noindent
        \begin{minipage}[c]{\linewidth}
        \hrulefill
    
        \begin{center}\textbf{\large\name}\end{center}
        \hphantom{\abilities}
        \derivedstats
    
        Abilities: \abilities
    
        \hrulefill
        \end{minipage}
    
      \settoggle{creatureBox}{false}
    
      \setcounter{noAppearing}{1}
    
      \afterparnoindent
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    }
    
    \newcommand{\clean}{
    
    	\setcounter{fp}{0}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\setcounter{sp}{0}
    
    	\setcounter{heft}{1}
    
    	\setcounter{weight}{-5}
    
    	\setcounter{damage}{0}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\setcounter{knacks}{0}
    	\setcounter{mp}{0}
    
    	\setcounter{mpLocked}{0}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\setcounter{xpbonus}{0}
    }
    
    %%       _   _        _ _           _            
    %%  __ _| |_| |_ _ __(_) |__  _   _| |_ ___  ___ 
    %% / _` | __| __| '__| | '_ \| | | | __/ _ \/ __|
    %%| (_| | |_| |_| |  | | |_) | |_| | ||  __/\__ \
    %% \__,_|\__|\__|_|  |_|_.__/ \__,_|\__\___||___/
    %% 
    %% Print the line,
    %% print the attributes.
    %% print the skills
    %% print the knacks
    %% print the equipment
    %
    \newcommand{\creaturestats}{
    
    
    % Reference versions (which always are non-verbose) don't
    % have the space for full-sized stats.
    
    
    \footnotesize
    
    \begin{tabularx}{\textwidth}{lr|lr|lr}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    % the tcolorbox has coloured rows (xcolor package)
    % but that doesn't work with creature stats, so we suppress it here
    \hiderowcolors
    
    
    	Strength & \arabic{str} & Dexterity & \arabic{dex} & Speed & \arabic{spd} \\
    
    \iftoggle{mind}{
    
    	Intelligence & \arabic{int}  & Wits & \arabic{wts} & Charisma & \arabic{cha}  \\}{%
    	&& Wits & \arabic{wts} \\
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \end{tabularx}
    
    \begin{tabularx}{\linewidth}{p{.20\textwidth}>{\raggedright\arraybackslash}p{.70\textwidth}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\ent{Skills} & \ifnumcomp{\value{att}}{=}{0}{}{\iftoggle{mind}{Combat \arabic{att}, }{Brawl \arabic{att}, }} \skills \\
    
    	\iftoggle{mind}{\ent{Equipment} & \equipment \\}{\ent{Abilities} & \abilities \\}
    
    \end{tabularx}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    }
    
    %%     _               _        _
    %%  __| | ___ _ __ ___| |_ __ _| |_ ___ 
    %% / _` |/ _ \ '__/ __| __/ _` | __/ __|
    %%| (_| |  __/ |  \__ \ || (_| | |_\__ \
    %% \__,_|\___|_|  |___/\__\__,_|\__|___/
    %% 
    %% 
    %% dice instead of Damage
    %% print out att, spd, DAM, dex, dr (type), str
    %%
    %
    \newcommand{\derivedstats}{
    
      \iftoggle{verbose}{\hrulefill}{}
    
      \setlength\topsep{0pt}
      \setlength\parskip{0pt}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \iftoggle{debug}{str: \arabic{str}, dex: \arabic{dex}, spd: \arabic{spd}, att: \arabic{att}, damage: \arabic{damage}, Attack total: \arabic{attackXPtotal}, Def Total: \arabic{defenceXPtotal}}{}
    
    % Stats for allies don't need to show Combat +1 as 'TN 8 to hit', they just need to show '+1'.
    \iftoggle{allyCharacter}{}{
      \addtocounter{att}{7}
    }
    
    \addtocounter{att}{\value{dex}}
    
    \ifnum\value{weight}>\value{str}% now to compute encumbrance
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \addtocounter{str}{5}% we can't have negative values affecting results
      \addtocounter{weight}{5}
      \addtocounter{spd}{-\value{weight}}
      \addtocounter{spd}{\value{str}}
    
      \addtocounter{str}{-5}% now we return strand weight to the original values
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \addtocounter{weight}{-5}
    
    \begin{center}
    
      \iftoggle{verbose}{\normalsize}{\large}%
    
      \setcounter{ap}{\value{spd}}
      \addtocounter{ap}{3}
      \scshape AP \ifnum\value{ap}<1 $\frac{1}{2}$ \else \arabic{ap}\fi%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \ifnumcomp{\value{heft}}{>}{1}{ (AP Cost: \arabic{heft})}{},
    
      Att %
    
      \iftoggle{allyCharacter}{$2D6$\ifnum\value{att}>-1 +\fi}{}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \arabic{att}%
    
      \setcounter{enc}{\value{att}},%
    
      \addtocounter{damage}{\value{str}}
    
      \addtocounter{damage}{4}%
    
      \mbox{Dam \dmg{damage}, }%
    
        \ifnumcomp{\value{dr}}{>}{0}{%
          \setcounter{enc}{\value{att}}%
          \addtocounter{enc}{\value{covering}}%
          \stepcounter{enc}%
    
          \mbox{DR \arabic{dr} (\arabic{enc}!)}, %
    
      \addtocounter{hp}{6}%
      \ifnum\value{mp}>0%
        \addtocounter{mp}{\value{int}}%
    
        \setcounter{mpFree}{\value{mp}}
        \addtocounter{mpFree}{-\value{mpLocked}}%
    
      \fi%
      \iftoggle{bestiarychapter}{%
    
        \ifnum\value{mp}>0%
    
          MP
          \ifnum\value{mpLocked}>0%
            \arabic{mpFree} / \arabic{mp},
          \else%
            \arabic{mp},
          \fi%
    
        \fi%
        \ifnum\value{sp}>0%
        SP \arabic{sp},
        \fi%
    
        \showBoxes
    
      \iftoggle{allyCharacter}{}{
    
        \calculateXP%
    
    \end{center}%
    }
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    %
    %
    %% __  ______  
    %% \ \/ /  _ \ 
    %%  \  /| |_) |
    %%  /  \|  __/ 
    %% /_/\_\_|    
    %%  
    
    \newcommand{\calculateXP}{
      \vspace{.1cm}
    
    
      %%% Now to get the XP value of the creature's attack ability.
      %%% = Attack (TN) * Dam + max((spd-hef),mp)^2
      \setcounter{attackXPtotal}{\value{att}}%
      \multiply\value{attackXPtotal} by \value{damage}%
      \addtocounter{spd}{-\value{heft}}%
      \ifnum\value{spd}>\value{mp}%
        \setcounter{enc}{\value{spd}}
      \else%
        \setcounter{enc}{\value{mp}}
      \fi%
        \multiply\value{enc} by\value{enc}%
        \addtocounter{attackXPtotal}{\value{enc}}%
        %%% And now the XP defence total.
        %%% = (att - 7 + dr) x hp
        \ifnum\value{att}>7%
          \setcounter{defenceXPtotal}{\value{att}}%
          \addtocounter{defenceXPtotal}{-7}
        \else
          \setcounter{defenceXPtotal}{0}
        \fi
        \addtocounter{defenceXPtotal}{\value{dr}}%
        \multiply\value{defenceXPtotal} by\value{hp}\addtocounter{defenceXPtotal}{0}%
    
    
      % XP = attackXPtotal + defenceXPtotal
    
        \setcounter{xp}{\value{attackXPtotal}}%
        \addtocounter{xp}{\value{defenceXPtotal}}%
    
    
      \iftoggle{debug}{str: \arabic{str}, dex: \arabic{dex}, spd: \arabic{spd}, att: \arabic{att}, damage: \arabic{damage}, weight: \arabic{weight}, XP Bonus: \arabic{xpbonus}, Attack total: \arabic{attackXPtotal}, Def Total: \arabic{defenceXPtotal}, mp: \arabic{mp} Grand Total: \arabic{xp}}{\iftoggle{verbose}{\hrulefill}}
    
      \iftoggle{examplecharacter}%
      {}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \ifnumcomp{\value{xp}}{<}{73}%
          {\ifnumcomp{\value{xp}}{<}{40}%
            {\arabic{xpbonus} XP}{$\frac{1}{2}$ XP}}%
    
                \addtocounter{xp}{-60}%
                \divide\value{xp} by 13%
                \addtocounter{xp}{\value{xpbonus}}%
                \arabic{xp} XP%
    
        % if the creature has a mind, print fate points (if any).
    
    Malin Freeborn's avatar
    Malin Freeborn committed
        \iftoggle{mind}%
          {\addtocounter{fp}{\value{cha}}%
            \ifnum\value{fp}>2\ignorespaces, \arabic{fp}~FP %
            \iftoggle{bestiarychapter}%
              {}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
              {\Repeat{\value{fp}}{\sqn}}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
            \fi
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    }
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    %
    %%%%%%%%%%%%%%%%%%%% Creature Abilities
    
    
    \newcommand{\abilities}{}
    
    \newcommand{\acidSpray}{%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      acidic spray
    
      \setcounter{track}{4}%
      \addtocounter{track}{\value{spd}}%
    
      (\dmg{track} Damage,
    
      \setcounter{track}{\value{dex}}%
    
      \addtocounter{track}{8}%
    
      \glsentrytext{tn} \arabic{track} to dodge)%
    
    }
    
    \newcommand{\acidBody}{%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	acidic body (inflict
    
      \setcounter{track}{3}%
      \addtocounter{track}{\value{str}}%
    
      \dmg{track} Damage each turn of grappling)%
    
    }
    
    \newcommand{\gelRegen}{%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	regeneration (1 HP/ round, max. \setcounter{hp}{\value{str}}\addtocounter{hp}{6}\roundUp{hp} \arabic{hp})%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\amphibious}{
    	amphibious%
    }
    
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\claws}{
    
    % To fly, creatures should have Speed
    % + Dexterity greater than Strength +
    % DR.
    
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\flight}{%
    
      flight %
      \setcounter{enc}{\value{dr}}%
      \addtocounter{enc}{\value{str}}%
      \setcounter{track}{\value{dex}}%
      \addtocounter{track}{\value{spd}}%
      \ifnum\value{enc}>\value{track}%
        (can glide, but not fly)
    
        \ifnum\value{enc}=\value{track}%
          (moves at x8 speed, must run before takeoff)%
    
          \ignorespaces(moves at x8 speed)%
    
        \fi%
      \fi%
    }
    
    \newcommand{\stench}{%
    
    	stench (breathing in demands Str + Wyldcrafting check, \glsentrytext{tn}%
    
      \setcounter{track}{10}%
      \addtocounter{track}{-\value{spd}}%
      \arabic{track}%
      )
    }
    
    \newcommand{\crazyGas}{%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      gas (hallucinations and
    
      \setcounter{track}{4}%
      \addtocounter{track}{\value{str}}%
      \arabic{track} \glspl{fatigue} per round)%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    \newcommand{\quadraped}{%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      quadraped (double movement)%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    }
    
    \newcommand{\teeth}{%
    
      teeth%
    }
    
    \newcommand{\tentacles}{%
      \addtocounter{track}{3}%
      \divide\value{track} by 2%
      tentacles \ifnum\value{track}>2%
        (grapple up to \arabic{track} opponents without becoming prone)%
      \fi%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\venom}{%
    
      venom (grappling inflicts 1D6 Fatigue)%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    }
    
    \newcommand{\web}{%
      \setcounter{track}{6}\addtocounter{track}{\value{str}}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      web (Strength + Athletics, TN \arabic{track} to break free as a movement action)%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    
    %%%%%%%%%%%%%%%%%%%%% Magic Path
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\Path}[1]{ \\
    	\raggedright \ent{Spheres:} & #1