Skip to content
Snippets Groups Projects
stats.sty 18.2 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}, or
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    % \Path{Blood}{\invocation{2}}, which gives your
    % wizzard 'invocation 2'.
    % 
    % 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}{}
    \newcommand{\printknacks}{}
    \newcommand{\weaponknackone}{}
    \newcommand{\weaponknacktwo}{}
    
    
    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.
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\calculatedamage}[1]{%
    
    		\setcounter{damagebonus}{\value{#1}}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    		\setcounter{numberofdice}{1}%
    	\whileboolexpr{test {\ifnumcomp{\value{damagebonus}}{>}{3}}}{%
    		\addtocounter{damagebonus}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    		{-4}\addtocounter{numberofdice}{1}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	}%
    
    	{\arabic{numberofdice}D6%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\ifnumcomp{\value{damagebonus}}{>}{0}%
    
    		{+\arabic{damagebonus}}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    		{%
    		\ifnumcomp{\value{damagebonus}}{<}{0}{%
    
    		\arabic{damagebonus}}%
    		{}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    		}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	}%
    }
    
    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}
    
    
    \newcounter{strb}
    \newcounter{dexb}
    \newcounter{spdb}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    % Extras: MP hp fp
    % Derived: dicenumber, dicebonus,
    \newcounter{mp}
    \newcounter{mpb}
    \newcounter{sp}
    \newcounter{hp}
    \newcounter{fp}
    \newcounter{numberofdice}
    \newcounter{damagebonus}
    \newcounter{xp}
    \newcounter{xpbonus}
    \newcounter{attackXPtotal}
    
    \newcounter{defenceXPtotal} %rem
    
    \newcounter{initiative}
    \newcounter{weight}
    \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}
    
    
    
    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}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\lockedmana}[1]{\setcounter{mpb}{-#1}}
    \newcommand{\armourtype}{N}
    
    \newcommand{\knacks}[1]{ \\
    	\ent{Knacks:} & #1 
    }
    
    %%%%%%%%%%%%%%%%%%%%% Knacks
    %
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\adrenalinesurge}{Adrenaline Surge\addtocounter{strb}{1}\addtocounter{knacks}{1}%
    \iftoggle{examplecharacter}{ (+1 Str. once per \ifnum\value{knacks}>2 combat\else round, \arabic{knacks} uses per combat\fi)}{}}
    
    \newcommand{\berserker}{Berserker\addtocounter{spdb}{1}\addtocounter{strb}{1}\addtocounter{knacks}{1}%
    \iftoggle{examplecharacter}{ (+1 Str. on round 2 of combat, +1 Spd. on round 3)}{}}
    
    \newcommand{\brawler}{Brawler\addtocounter{dexb}{2}\addtocounter{knacks}{1}%
    \iftoggle{examplecharacter}{ (+2 to unarmed attacks)}{}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\charge}{\addtocounter{knacks}{1}\setcounter{track}{\value{knacks}}\addtocounter{track}{1}\divide\value{track} by 2\addtocounter{dexb}{\value{track}}\addtocounter{strb}{\value{track}}\addtocounter{spdb}{\value{track}}Extreme Charge%
    \iftoggle{examplecharacter}{\setcounter{enc}{\value{knacks}\roundUp{enc} (+\arabic{enc} to all body Attributes for 1 attack after charging 6 squares)}{}}}
    
    \newcommand{\disarm}{Disarm\addtocounter{knacks}{1}\addtocounter{xpbonus}{1}%
    \iftoggle{examplecharacter}{ (when attacking with more AP than opponent, take a -1 penalty to disarm opponent)}{}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\dodger}{Dodger\addtocounter{knacks}{1}}
    \newcommand{\finishingblow}{Finishing Blow\addtocounter{knacks}{1}}
    
    \newcommand{\guardian}{Guardian\addtocounter{knacks}{1}%
    \iftoggle{examplecharacter}{ (spend only 0 AP to guard someone, and gain +1 while guarding)}{}}
    
    \newcommand{\laststand}{Last Stand\addtocounter{knacks}{1}%
    \iftoggle{examplecharacter}{ (when losing HP, the character gains \setcounter{enc}{2}\addtocounter{enc}{\value{knacks}}\arabic{enc} AP)}{}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\perfectsneakattack}{Perfect Sneak Attack\addtocounter{knacks}{1}\addtocounter{strb}{\value{knacks}}\addtocounter{strb}{2}%
    \iftoggle{examplecharacter}{ (+\arabic{knacks} Damage for sneak attacks)}{}}
    
    \newcommand{\precisestrike}{Precise Strike\addtocounter{knacks}{1}%
    \iftoggle{examplecharacter}{ (you need 1 less to acheive a Vitals shot)}{}}
    \newcommand{\specialist}[1]{Specialist \addtocounter{knacks}{1}
    \iftoggle{examplecharacter}{ (+2 when using any #1)}{(#1)}}
    \newcommand{\stunningstrike}{Stunning Strike\addtocounter{knacks}{1}\addtocounter{xpbonus}{1}%
    \iftoggle{examplecharacter}{ (take -1 penalty, and opponent's AP reduces by half Damage)}{}}
    \newcommand{\snapshot}{Snap Shot\addtocounter{knacks}{1}\addtocounter{strb}{2}%
    \iftoggle{examplecharacter}{ (Pay 0 AP to reload arrow or draw weapon)}{}}
    \newcommand{\mightydraw}{Mighty Draw\addtocounter{knacks}{1}%
    \iftoggle{examplecharacter}{\setcounter{enc}{knacks}\roundUp{enc} (reduce cost to draw longbow by \arabic{enc} AP)}{}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\unstoppable}{Unstoppable\addtocounter{hp}{2}\addtocounter{knacks}{1}%
    \iftoggle{examplecharacter}{%
    \setcounter{enc}{\value{knacks}}\roundUp{enc}%
    (Gain +2 HP permanently.
    Gain +\arabic{enc} on Vitality check.
    You don't need to fall unconscious when making a Vitality check)%
    }{}}
    
    \newcommand{\vengeful}{Vengeful\addtocounter{knacks}{1}%
    \iftoggle{examplecharacter}{ (+2 Intelligence after losing HP)}{}}
    
    \newcommand{\weaponmaster}[1]{Weapon Master \addtocounter{att}{1}\addtocounter{knacks}{1}%
    \iftoggle{examplecharacter}{(+1 Bonus to {#1}s)}{(#1)}}
    
    \newcommand{\snapcaster}{Snap Caster\addtocounter{knacks}{1}%
    \iftoggle{examplecharacter}{ (spells cost 1 AP less)}{}}
    \newcommand{\extremefocus}{Extreme Focus\addtocounter{knacks}{1}%
    \iftoggle{examplecharacter}{\setcounter{enc}{knacks}\roundUp{enc} (with time to focus, gain +\arabic{enc} to spells)}{}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\alchemist}{Alchemist\addtocounter{knacks}{1}\renewcommand{\magicPath}{Alchemist}}
    
    \newcommand{\bloodCaster}{Blood Caster\addtocounter{knacks}{1}\renewcommand{\magicPath}{Blood}\iftoggle{examplecharacter}{ (allows the character to learn magic spheres)}{}}
    
    \newcommand{\divineCaster}{Divine Caster\addtocounter{knacks}{1}\renewcommand{\magicPath}{Divinity}
    \iftoggle{examplecharacter}{ (allows the caster to cast spells through devotion to a god)}{}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\nuraCaster}{Nura Caster\addtocounter{knacks}{1}\renewcommand{\magicPath}{Nura}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand{\runeCaster}{Rune Caster\addtocounter{knacks}{1}\renewcommand{\magicPath}{Runes}%
    \iftoggle{examplecharacter}{ (allows the caster to cast spells by slowly painting or carving runes)}{}}
    
    \newcommand{\songCaster}{Song Caster\addtocounter{knacks}{1}\renewcommand{\magicPath}{Song}%
    \iftoggle{examplecharacter}{ (allows the caster to cast spells by slowly, through song)}{}}
    \newcommand{\combatcaster}{Combat Caster\addtocounter{knacks}{1}}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    \newcommand\chosenEnemy[1]{Chosen Enemy (#1)\addtocounter{knacks}{1}}
    
    
    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}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\settoggle{mind}{true}
    	\setcounter{str}{#1}
    	\setcounter{dex}{#2}
    	\setcounter{spd}{#3}
    	\mind#4
    	\setcounter{dr}{#5}
    	\setcounter{att}{#6}
    	\renewcommand{\skills}{#7}
    	\renewcommand{\equipment}{#8}
    	\renewcommand{\mods}{#9}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\clean
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\renewcommand{\armourtype}{P}
    	\gdef\armourtype{P}
    
    	\begin{tcolorbox}[
        title={\name},
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    		before upper={\parindent0pt},
    		halign=flush left,
    		left=10pt,
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    		right=15pt,
    
    	\creaturestats
    
    	\derivedstats
    	\end{tcolorbox}
    
    	\iftoggle{personality}{
    
        \textbf{Archetype:} \archetype, 
        \textbf{Personality:} \personality
    
        \textbf{Mannerism:} \mannerism
    
        \vspace{1em}
    
        \settoggle{personality}{false}}%
    	{}
    
      \settoggle{creatureBox}{false}
    
      \settoggle{team}{false}
    
      \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{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}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\clean
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\renewcommand{\armourtype}{C}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\begin{tcolorbox}[title={\name},
    		before upper={\parindent0pt},
    		halign=flush left,
    		left=10pt,
    		right=15pt,
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\iftoggle{personality}{
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\textbf{Personality:} \personality
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\textbf{Mannerism:} \mannerism
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\vspace{1em}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\settoggle{personality}{false}}%
    	{}
    	\creaturestats
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\derivedstats
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\end{tcolorbox}
    
      \settoggle{creatureBox}{false}
    
      \afterparnoindent
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    }
    
    \newcommand{\clean}{
    	\setcounter{fp}{5}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\setcounter{strb}{0}
    	\setcounter{dexb}{0}
    	\setcounter{spdb}{0}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\setcounter{sp}{0}
    
    	\setcounter{heft}{1}
    
    	\setcounter{damage}{0}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\setcounter{knacks}{0}
    	\renewcommand{\armourtype}{N}
    	\renewcommand{\weaponknackone}{}
    	\renewcommand{\weaponknacktwo}{}
    	\setcounter{mp}{0}
    	\setcounter{mpb}{0}
    	\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.
    
    
    \iftoggle{verbose}{
    	\begin{small}%
    }{%
    
    	\begin{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
    
    
    	\iftoggle{verbose}{Strength}{STR} & \arabic{str} & \iftoggle{verbose}{Dexterity}{DEX} & \arabic{dex} & \iftoggle{verbose}{Speed}{SPD} & \arabic{spd} \\
    \iftoggle{mind}{
    	\iftoggle{verbose}{Intelligence}{INT} & \arabic{int}  & \iftoggle{verbose}{Wits}{WTS} & \arabic{wts} & \iftoggle{verbose}{Charisma}{CHA} & \arabic{cha}  \\}{%
    
    	&& \iftoggle{verbose}{Wits}{WTS} & \arabic{wts} \\
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	}
    	\setcounter{hp}{\value{str}}
    \end{tabularx}
    
    \begin{tabularx}{\linewidth}{p{.20\textwidth}>{\raggedright\arraybackslash}p{.70\textwidth}}
    
    	\ent{Skills} & \ifnumcomp{\value{att}}{=}{0}{}{\iftoggle{mind}{Combat \arabic{att}, }{Aggression \arabic{att}, }} \skills \\
    	\iftoggle{mind}{\ent{Equipment} & \equipment \\}{\ent{Abilities} & \abilities \\}
    
    \end{tabularx}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    	\weaponknackone
    	\weaponknacktwo
    
    
    
    \iftoggle{verbose}{%
    	\end{small}%
    }{%
    	\end{footnotesize}%
    }%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    }
    
    %%     _               _        _
    %%  __| | ___ _ __ ___| |_ __ _| |_ ___ 
    %% / _` |/ _ \ '__/ __| __/ _` | __/ __|
    %%| (_| |  __/ |  \__ \ || (_| | |_\__ \
    %% \__,_|\___|_|  |___/\__\__,_|\__|___/
    %% 
    %% 
    %% dice instead of Damage
    %% print out att, spd, DAM, dex, dr (type), str
    %%
    %
    \newcommand{\derivedstats}{
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      \hrulefill
    
      \setlength\topsep{0pt}
      \setlength\parskip{0pt}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\iftoggle{debug}{str: \arabic{str}, strb: \arabic{strb}, dex: \arabic{dex}, dexb: \arabic{dexb}, spd: \arabic{spd}, spdb: \arabic{spdb},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}}
    
    \addtocounter{spd}{3}
    \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 str and weight to the original values
      \addtocounter{weight}{-5}
    
    \begin{center}
    
      \scshape Att %
      \iftoggle{allyCharacter}{$2D6$\ifnum\value{att}>-1 +\fi}{}%
    
      \arabic{att}\ifnumcomp{\value{dexb}}{>}{0}{\addtocounter{att}{\value{dexb}} (\arabic{att})}{},
    
    Malin Freeborn's avatar
    Malin Freeborn committed
      AP \arabic{spd}\ifnumcomp{\value{spdb}}{>}{0}%
      {\addtocounter{spd}{\value{spdb}} (\arabic{spd})}{}\ifnumcomp{\value{heft}}{>}{1}{: \arabic{heft}}{},
    
      \addtocounter{damage}{\value{str}}
    
      \mbox{Dam \calculatedamage{damage}%
    
      \ifnumcomp{\value{strb}}{>}{0}%
        {
    
          \addtocounter{damage}{\value{strb}} (\calculatedamage{damage})}{},
    
        \ifnumcomp{\value{dr}}{>}{0}{DR \arabic{dr}~\armourtype, }{}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\ifnum\value{mp}>0%
    
    		\addtocounter{mp}{\value{int}}%
    
    		\noindent\mbox{
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    		\ifnum\value{mpb}=0%
    			\arabic{mp}~MP%
    		\else%
    			\addtocounter{mpb}{\value{mp}}%
    			\arabic{mpb} / \arabic{mp} MP%
    		\fi
    		\iftoggle{bestiarychapter}%
    			{, }%
    			{ \Repeat{\value{mp}}{\ding{111}}, }%
    		}
    	\fi
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	\addtocounter{hp}{6}
    
      \addtocounter{damage}{4}
    
    	\noindent\mbox{\arabic{hp} HP \iftoggle{bestiarychapter}{}{%
    
    	\ {\large\Repeat{\value{hp}}{\sqn}}%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    		}%
    	}%
    	\ifnumcomp{\value{sp}}{>}{0}%
    		{, \mbox{%
    			\arabic{sp} SP %
    			\iftoggle{bestiarychapter}{}{\Repeat{\value{sp}}{\ding{111}}}%
    		}%
    		}%
    	{}%
    
    
    
    	\iftoggle{allyCharacter}{}{
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    		\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}, strb: \arabic{strb}, dex: \arabic{dex}, dexb: \arabic{dexb}, spd: \arabic{spd}, spdb: \arabic{spdb}, att: \arabic{att}, damage: \arabic{damage}, XP Bonus: \arabic{xpbonus}, Attack total: \arabic{attackXPtotal}, Def Total: \arabic{defenceXPtotal}, mp: \arabic{mp} Grand Total: \arabic{xp}}{\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}%
              {}%
              {\Repeat{\value{fp}}{\ding{111}}}%
            \fi
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    }
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    %
    %%%%%%%%%%%%%%%%%%%% Creature Abilities
    
    \newcommand{\abilities}[1]{ \\
    	\ent{Abilities:} & #1 
    	}
    
    
    \newcommand{\acidSpray}{
    	\addtocounter{str}{-2}Acidic spray (spray for \calculatedamage{str} Damage per turn)%
      \addtocounter{str}{2}%
    }
    
    \newcommand{\acidBody}{%
    	Acidic Body (inflict \calculatedamage{str} Damage each turn)%
    }
    
    \newcommand{\gelRegen}{%
    	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}{
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	claws (grapple inflicts standard damage)%
    }
    
    \newcommand{\flight}{%
    
    	Flight%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    \newcommand{\quadraped}{%
    
    	Quadraped (double movement)%
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    }
    
    \newcommand{\teeth}{%
    
    	Teeth (grapple inflicts standard damage)%
    
    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}}%
    
      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