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

\newcommand\makeRule[5]{
  \subsubsection[#2: \roll{#3}{#4}, \glsentrytext{tn} #5]{#2}
  \label{#1}%
  \textit{\roll{#3}{#4}, \glsentrytext{tn}~#5.}%
}

\newcommand\makeAutoRule[3]{
  \subsubsection[#2: #3]{#2}
  \label{#1}%
}

\newcommand\bigSkillsTable{
  \begin{figure*}[t!]
  \small
  \begin{nametable}[L||L|L|L|L|L|L]{Skill Table}
  \label{skillChart}

  & \textbf{Strength} & \textbf{Dexterity} & \textbf{Speed} & \textbf{Intelligence} & \textbf{Wits} & \textbf{Charisma} \\\hline\hline
  \textbf{Academics} & Orating to a massive crowd & Forgery & Courier Runs & Recalling facts & Resisting an enchantment spell & Storytelling \\\hline
  \textbf{Athletics} & Lifting heavy loads & Climbing & Sprinting & Finding the easiest route to climb & Identifying optimal climbing conditions & Stage acrobatics \\\hline
  \textbf{Deceit} & Intimidation & Feigning an injury & Spreading a rumour across an entire town & Crafting a plausible lie & Making a quick excuse & Implausible lies \\\hline
  \textbf{Stealth} & Hiding in a hay bail & Moving quietly & Escaping into a crowd & Identifying the best hiding spot & Quickly hiding & Slipping into a party uninvited \\\hline
  \textbf{Vigilance} & Keeping watch all night & Feeling for an exit in the dark & Searching a full forest for a particular tree & Investigating a crime scene & Spotting an illusion spell & Finding the best con target at a banquet \\
  \textbf{Wyldcrafting} & Wrestling a~boar & Untying a~horse's bridle & Fleeing a stampede & Planning a new, hidden trail & Foraging for a quick meal & Selling vegetables \\\hline

  \end{nametable}
  \end{figure*}
}

\newcommand\craftingReqList{
  \begin{nametable}[l|X]{Craft Requirements}

    Academics & Books, scrolls, and bookcases. \\

    Caving & Rope, carts, pulleys, and alcohol lanterns. \\
    
    Combat & Making swords, armour, scabbards, maces, and polearms. \\

    Empathy & Jewellery, fancy clothing, and paints. \\

    Deceit & Disguises. \\

    Medicine & Bandages, casts, and fake eyes. \\

    Performance & Instruments, auditoriums, and theatres. \\

    Projectiles & Bows, crossbows, arrows, quivers, and bolts. \\

    Seafaring & Boats, sails, rope, and anchors. \\

    Wyldcrafting & Fences, rope, houses, blankets, practical clothing and saddles. \\

  \end{nametable}
}

\newcommand{\initiativechart}{

  \begin{nametable}[Xc]{\Gls{ap} Costs}

  \textbf{Standard Actions} & \textbf{\Gls{ap}} \\
  \hline

  Attacking      & by weapon \\

  Drawing weapon & 1 \\

  Guard Someone & 1 \\

  Ram & 3 \\

  \hline
  \hspace{3em}\textbf{Projectiles} & \\
  \hline

  Crossbow & 1 \\

  Improvised projectile & 2 \\

  Longbow   & 4 \\

  Reloading & 1 \\

  Shortbow & 2 \\

  Thrown weapon & 4 \\
  \hline

  \hline
  \textbf{Other Actions} & \\\hline

  Cast a spell & $1 + Lv - Wts$ \\

  Moving & 1 \\

  Speaking & 1 \\

  \end{nametable}

}

\newcommand\improvisedWeaponsChart{

  \begin{boxtable}[XXXXX]

  \textbf{Improvised Weapon} & \textbf{Attack Bonus} & \textbf{Damage Bonus} & \textbf{\Glsfmtshort{ap} Cost} & \textbf{\Gls{weight}} \\\hline

  \showWeapon{\boulder} \\

  \showWeapon{\chair} \\

  \showWeapon{\club} \\

  \showWeapon{\cudgel} \\

  \showWeapon{\firepoker} \\

  \showWeapon{\skillet} \\

  \showWeapon{\knife} \\

  \showWeapon{\Log} \\

  \showWeapon{\stick} \\

  \showWeapon{\woodaxe} \\

  \end{boxtable}

}

\newcommand{\weaponsChart}{
  \begin{boxtable}[lYYYY]

  \textbf{Weapon} & \textbf{\small Attack Bonus} & \textbf{\small Damage Bonus} & \textbf{\Glsfmtshort{ap} \small Cost} & \textbf{\small \Gls{weight}} \\\hline

  \showWeapon{\Dagger} \\

  \showWeapon{\glaive} \\

  \showWeapon{\greataxe} \\

  \showWeapon{\greatsword} \\

  \showWeapon{\javelin} \\

  \showWeapon{\longsword} \\

  \showWeapon{\maul} \\

  \showWeapon{\poleaxe} \\

  \showWeapon{\quarterstaff} \\

  \showWeapon{\shortsword} \\

  \showWeapon{\spear} \\

  \end{boxtable}
}

\newcommand\esotericWeaponsChart{
  \begin{boxtable}[XYYYY]

  \textbf{Esoteric Weapons} & \textbf{Attack Bonus} & \textbf{Damage Bonus} & \textbf{\Glsfmtshort{ap} Cost} & \textbf{\Gls{weight}} \\\hline

  \showWeapon{\greatclub} \\

  \showWeapon{\giantsword} \\

  \showWeapon{\rapier} \\

  \showWeapon{\warhammer} \\

  \showWeapon{\whip} \\

  \end{boxtable}
}

\newcommand{\shieldchart}{
  \begin{boxtable}[XYYYY]

  \textbf{Shield} & \textbf{Defence Bonus} & \textbf{Damage Bonus} & \textbf{\Glsfmtshort{ap} Cost} & \textbf{\Gls{weight}} \\\hline

  \showWeapon{\buckler} \\
  \showWeapon{\roundshield} \\
  \showWeapon{\kiteshield} \\

  \end{boxtable}
}

\newcommand{\coveringchart}{
  \begin{boxtable}[lLL]

    \textbf{Roll} & \textbf{Result} & \textbf{Damage} \\\hline

    $\leq$ \gls{tn} - your Covering & Opponent scores \gls{vitalShot}! & You take full Damage \\

    < \gls{tn} but > \gls{tn} - your Covering & Opponent hits you & Your \gls{dr} reduces Damage \\

    > \gls{tn} but < \gls{tn} + opponent's Covering & You hit the opponent & Opponent's \gls{dr} reduces Damage \\

    $\geq$ \gls{tn} + opponent's Covering & You score \gls{vitalShot}! & Opponent takes full Damage \\

  \end{boxtable}
}

\newcommand{\armourchart}{

  \begin{boxtable}[Xccc]

  \textbf{Armour} & \textbf{\Glsentrytext{dr}} & \textbf{\glsentrytext{covering}} & \textbf{Weight} \\\hline

  \ifnum\value{r4}=3
    \showArmour{\armour[\addtocounter{weight}{-1}]{Elvish Ceramic}{2}{2}} \\
  \fi

  \showArmour{\armour[\addtocounter{weight}{1}]{Padded Armour}{2}{2}} \\

  \showArmour{\armour{Partial Leather}{3}{2}} \\

  \showArmour{\armour{Complete Leather}{3}{4}} \\

  \showArmour{\armour{Partial Chain}{4}{2}}  \\

  \showArmour{\armour{Complete Chain}{4}{4}} \\

  \showArmour{\armour{Partial Plate}{5}{2}} \\

  \showArmour{\armour{Complete Plate}{5}{4}} \\

  \end{boxtable}

}

\newcommand{\chasechart}{

  \begin{wideTable}{Chase Chart}

  Total & Result \\\hline

  {\textgreater}10 & The characters escape their pursuers after travelling through \pgls{area}. \\

  9 & Both run through 1 \gls{area}, then the characters select a new Skill, and both roll again. \\


  8 & Both run through 2 \glspl{area}, then the characters select a new Skill, and both roll again. \\

  7 & Both run through 3 \glspl{area} then roll again. \\

  6 & Both run through 2 \glspl{area}, then the pursuers select a new Skill, and both roll again. \\

  5 & Both run through 1 \gls{area}, then the pursuers select a new Skill, and both roll again. \\

  {\textless}4 & The characters escape their pursuers after running through \pgls{area}. \\

  \end{wideTable}

}

\newcommand{\huntchart}{

  \begin{wideTable}{Hunt Chart}

  Total & Result \\\hline

  {\textgreater}10 & The characters capture their quarry after travelling through \pgls{area}. \\

  9 & Both run through 1 \gls{area}, then the characters select a new Skill, and both roll again. \\

  8 & Both run through 2 \glspl{area}, then the characters select a new Skill, and both roll again. \\

  7 & Both run through 3 \glspl{area} then roll again. \\

  6 & Both run through 2 \glspl{area}, then the quarry selects a new Skill, and both roll again. \\

  5 & Both run through 1 \gls{area}, then the quarry selects a new Skill, and both roll again. \\

  {\textless}4 & The quarry escapes the characters after running through \pgls{area}. \\

  \end{wideTable}
}

\newcommand{\projectilesChart}{
\begin{boxtable}[XXXXX]

  \textbf{Projectile} & \textbf{\Gls{ap}} & \textbf{Damage} & \textbf{Weight}  & \textbf{Reload Time} \\\hline

  Crossbow &  1 & $2D6$ & 3 & 5 - Str \glspl{round}  \\

  Longbow &  4 & varies & 1 & 4 - extra Str \glspl{ap} \\

  Shortbow &  1 & $1D6-1$ & 1 & 1 \gls{ap} \\

  Throwing knives & 2 & $1D6$ & 0 & 1 \gls{ap} \\

\end{boxtable}
}

\newcommand\larcenyChart{
  \begin{nametable}[cccL]{Larceny Roll}
    \textbf{\Gls{village}} & \textbf{Town} & \textbf{City} & \textbf{Result} \\
    \hline
     17 & 15 & 14 & $2D6 \times 20$ \gls{cp} from a noble's servant. \\
     16 & 14 & 13 & $2D6 \times 15$ \gls{cp} from a traveller. \\
     15 & 13 & 12 & $2D6 \times 10$ \gls{cp} from a trader. \\
     14 & 12 & 11 & $2D6 \times 5$ \gls{cp} from an old lady. \\
     13 & 11 & 10 & No good targets found \\
     12 & 10 & 9 & Caught red handed! -- roll a `snatch and run'. \\
     11 & 9 & 8 & Caught red handed and surrounded! \\
  \end{nametable}
}

\newcommand\gatheringChart{
  \begin{nametable}[ccX]{Gathering Table}
    \textbf{Tundra} & \textbf{Forest} & \textbf{Result} \\\hline
    11  & 10+ & Food for $1D6$ days. \\
    10  & 9 & Nothing found. \\
    8-9 & 8 & Lost: make a navigation roll (below), or wander in the wrong direction. \\
    7   & 6-7 & Screechmoss! \roll{Wits}{Wyldcrafting} (\tn[10]) or test for an encounter (1 in $1D6$). \\
    6   & 5 & Creature encounter -- the \gls{gm} rolls $2D6 + 6$ on the local encounter table. \\
    5   & & Snake bite: gain $1D6+4$ \glspl{ep}. \\
    4   & 4 & Wrong mushroom: gain 3 \glspl{ep} at the end of the interval. \\
        & 3 & Snake bite: gain $1D6+2$ \glspl{ep}. \\
    < 4 & < 3 & Dirge fruit: after $1D6$ \glspl{interval}, the eater hears a distant screeching sound in their head, and will no longer be able to sleep.
    Only an Air \gls{ingredient} provides a cure (one dose cures 10 people).
    \index{Dirge Fruit \gls{plant}}
    \\
  \end{nametable}
}

\newcommand\marchingChart{
  \begin{boxtable}[Xc]
    \textbf{Terrain} & \textbf{Miles} \\
    \hline
       Good Road     &       5        \\
       Rough Road    &       4        \\
       Forest Path   &       3        \\
       Lost City     &       2        \\
       Dense Forest  &       1        \\
  \end{boxtable}
}

\newcommand\caveTravelChart{
  \sidebox{
    \begin{boxtable}[YYY]

      \textbf{Miles} & \textbf{\gls{tn}} & \textbf{\Glspl{ep}} \\\hline

      0  & 8 & 0/ 3 \\

      1  & 10 & 2/ 5 \\

      2  & 12 & 4/ 7 \\

      3  & 14 & 6/ 9 \\

    \end{boxtable}
  }%
}


\newcommand\calcFallingDamage[2]{%
  \setcounter{Strength}{#1}%
  \setcounter{enc}{#2}%
  \setcounter{damage}{\value{enc}}%
  \roundUp{damage}
  \addtocounter{damage}{\value{Strength}}%
  \setcounter{tn}{\value{damage}}%
  \addtocounter{tn}{7}%
  \setcounter{track}{\value{tn}}%
  \addtocounter{track}{\value{enc}}%
  \arabic{Strength} & \arabic{enc}~\ifnum\value{enc}>1\glspl{step}\else\gls{step}\fi & \dmg{damage} & \arabic{tn} / \arabic{track} \\
}