\documentclass[a4paper,openany]{book}
\usepackage{bind}
\usepackage{lipsum}

\date{\today}
\makeindex[name=spells,title={Spell Summaries},columns=2]

\settoggle{debug}{true}

\begin{document}

\frontmatter

\chapter{Random Stuff}

\section{Introduction}

\begin{multicols}{2}

\subsection{This Document}

This is a test document, to make sure new code works before sticking it in a project.
Current day should equal \arabic{r4b}.

\npc{\M}{Random Guy}
\person{1}% STRENGTH
{1}% DEXTERITY 
{1}% SPEED
{{-2}% INTELLIGENCE
{-1}% WITS
{0}}% CHARISMA
{0}% DR
{1}% COMBAT
{Academics 1, Wyldcrafting 1
}% SKILLS
{\Dagger, pieces of string}% EQUIPMENT
{
  \setcounter{Fate}{2}
}

\input{spells/Air1.tex}

\begin{speechtext}

  ``Would you tell me, please, which way I ought to go from here?''

  ``That depends a good deal on where you want to get to.''

\end{speechtext}

\subsection{And now for something completely different}


\subsection{Encounters}

\begin{encounters}{Wonderland}

  Fields & Gardens & Results \\\hline

  \li & Doormouse \\
  \li & Dodo \\
  \li \lii Unicorn \\
  \li \lii Red Queen \\
  & \lii Black Queen \\
  & \lii Green Queen \\

\end{encounters}

\begin{rollchart}

Roll & Result \\\hline

12 & Success \\

11 & Failure \\

\end{rollchart}

\subsection{Random Text}

\lipsum[7]

\subsection{And further more\ldots}

\lipsum[10]

\begin{boxtext}
  \lipsum[4]
\end{boxtext}

\end{multicols}

\mainmatter

\chapter{Stat Blocks}

\section{Humanoids}

\begin{multicols}{2}

\subsection{Humans}

\humanfarmer

\humanmaid

\humansoldier

\humanarcher

\royalguard

\humansoldier

\humandiplomat[\NPC{\Hu\F}{Bob}{Erratic}{Snaps fingers}{Paladin}]

This section is non-verbose, so only basic stats are shown.
\settoggle{verbose}{false}
\settoggle{debug}{false}

\basilisk

\humanbard[\NPC{\Hu\M}{Chris}{Despondent}{Sighs}{Jester}]

\humanbard

\humanthief

\humanalchemist

\necromancer

\subsection{Dwarves}

\settoggle{verbose}{true}

\dwarvensoldier

\dwarventrader

\dwarvenrunemaster

\subsection{Elves}

\elf

\elf

\elvenenchanter

\subsection{Gnomes}

\gnome

\gnomishsoldier

\gnomishsoldier

\gnomishillusionist

\subsection{Gnolls}

\gnollhunter

\gnollshaman

\showStdSpells

\gnollshaman

\showStdSpells

\showStdSpells

\end{multicols}

\section{Forest Critters}

\begin{multicols}{2}

\bear

\boar

\chitincrawler

\basilisk

\wolf

\woodspy

\end{multicols}

\section{Undead}

\begin{multicols}{2}

\ghoul

\ghast

\demilich

\lich

\end{multicols}

\chapter{Nura}

\begin{multicols}{2}

\subsection{Humanoids}

\goblin[\npc{\N}{Random Goblin}]

\goblin

\goblin

\goblinnuramancer

\hobgoblin

\ogre

\deepogre

\subsection{Animals}

\nurarat

\nurahorse

\nuracrab

\nuracat

\nuraslug

\nuraspider

\nurawolf

\end{multicols}

\chapter{Outsiders}

\section{Weird Ones}

\begin{multicols}{2}

\archmage

\archmage

\boxPair[t]{
  \subsubsection{Box Pairs}
  This is the \texttt{\textbackslash boxPair} command.
  It lets a pair of anything sit at the bottom of the page.
  The first argument sits in the left column, and the next in the right.

  The command works well if you have a creature box, like this lava-man.
}{
    \lavaman
}

\dragon

\rockman

\lavaman

\end{multicols}

\section{Same}

\begin{multicols}{2}

\rockman

\archmage

\dragon

\archmage

\lavaman

\end{multicols}

\section{Talismans}

\begin{multicols}{2}

\scrollOfFriendship

\bloodCandle

\minersWeed

\end{multicols}

%%%%% Test Character Sheet

\setcounter{Strength}{0}
\setcounter{Dexterity}{-1}
\setcounter{Speed}{0}
\setcounter{Intelligence}{1}
\setcounter{Wits}{0}
\setcounter{Charisma}{1}

\renewcommand\concept{Loner}
\renewcommand\race{Human}
\renewcommand\rank{Novice}
\renewcommand\name{Proskuff}
\renewcommand\code{Conqueror}

\setcounter{Academics}{2}
\setcounter{Athletics}{0}
\setcounter{Caving}{0}
\setcounter{Crafts}{0}
\setcounter{Deceit}{0}
\setcounter{Empathy}{0}
\setcounter{Medicine}{0}
\setcounter{Performance}{0}
\setcounter{Larceny}{0}
\setcounter{Seafaring}{0}
\setcounter{Stealth}{0}
\setcounter{Tactics}{1}
\setcounter{Vigilance}{0}
\setcounter{Wyldcrafting}{0}

\setcounter{Air}{2}
\setcounter{Combat}{0}
\setcounter{Projectiles}{0}

\setcounter{fp}{5}

\renewcommand\characterWeapon{\shortsword}
\renewcommand\characterArmour{}
\renewcommand\characterEquipment{Bag of flour, bag of chalk, dagger, unopened letter}
\setcounter{gold}{0}

\settoggle{examplecharacter}{true}
\input{config/CS.tex}
\settoggle{examplecharacter}{false}
\renewcommand\csComments{}
\clearpage


\chapter{Bestiary Chapters}

\begin{multicols}{2}

\settoggle{genExamples}{true}

When using a bestiary chapter, the stats appear as dice rolls, rather than fixed amounts.

\subsection{Humans}

\humanfarmer

\humansoldier

\royalguard

\humandiplomat

\humanbard

\humanthief

\humanalchemist

\humanalchemist

\necromancer

\subsection{Dwarves}

\dwarvensoldier

\dwarventrader

\dwarvenrunemaster

\subsection{Elves}

\elf

\elf

\elvenenchanter

\subsection{Gnomes}

\gnome

\gnomishillusionist

\subsection{Gnolls}

\gnollhunter

\gnollshaman

\gnollshaman

\end{multicols}

\section{Forest Critters}

\begin{multicols}{2}

\bear

\boar

\huntingdog

\cat

\chitincrawler

\basilisk

\end{multicols}

\section{Underground}

\begin{multicols}{2}

\umberhulk

\watcher

\jelly

\jelly

\jelly

\jelly

\end{multicols}

\section{Undead}

\begin{multicols}{2}

\ghoul

\ghast

\demilich

\lich

\end{multicols}

\section{Nura}

\begin{multicols}{2}

\subsection{Animals}

\nurahorse

\nuracrab

\nuracat

\nuraslug

\nuraspider

\nurawolf

\subsection{Humanoids}

\goblin

\goblinnuramancer

\hobgoblin

\ogre

\end{multicols}

\settoggle{genExamples}{false}

\chapter{Lots of Text}

\begin{multicols}{2}

\noindent
\lipsum

\end{multicols}

\newcommand{\tests}{

\chapter{Another Test}

\section{Test Section}

\begin{multicols}{2}

\randomdozen
\setcounter{track}{\value{r12}}

\swarm[\flight]{Stirges}{\value{r12}}{1}{3}{1}

\lipsum[\arabic{r4}]

\humanbard

\lipsum[2]

\boxPair[t]{
  \subsubsection{Box Pairs}
  This is the \texttt{\textbackslash boxPair} command.
  It lets a pair of anything sit at the bottom of the page.
  The first argument sits in the left column, and the next in the right.

  The command works well if you have a creature box, like this griffin.
}{
    \griffin
}

\subsection{Test subsection}

\dragon

\settoggle{allyCharacter}{true}

\elf

\settoggle{examplecharacter}{true}

\lipsum[3]

\elf

\settoggle{allyCharacter}{false}

\subsubsection{Test sub-sub-section}

\lipsum[10]

\subsubsection{Test sub-sub-section again}

\subsection{Test subsection}

\lipsum[2]

\elf

\settoggle{examplecharacter}{false}

\lipsum[10]

\section{Last Section}

\lipsum[3]

\end{multicols}

}

\tableofcontents

\Repeat{2}{\tests}

\settoggle{verbose}{false}

\Repeat{2}{\tests}



\end{document}
