Added passive insight and investigation for GM notes.

This commit is contained in:
Mark Wolfman
2022-01-13 15:28:56 -06:00
parent 51419bd3d7
commit a30dc28100
4 changed files with 92 additions and 8 deletions
+14 -1
View File
@@ -84,7 +84,7 @@ class Content(ABC):
Mechanic = mechanic
elif SuperClass is not None and isinstance(mechanic, SuperClass):
# Has been instantiated for some reason
Mechanic = type(Mechanic)
Mechanic = type(mechanic)
else:
try:
# Retrieve pre-defined mechanic
@@ -187,6 +187,19 @@ class Creature(Content):
def passive_wisdom(self):
return self.perception.modifier + 10
@property
def passive_perception(self):
"""Just a wrapper around passive wisdom."""
return self.passive_wisdom
@property
def passive_insight(self):
return self.insight.modifier + 10
@property
def passive_investigation(self):
return self.investigation.modifier + 10
@property
def abilities(self):
return [self.strength, self.dexterity, self.constitution,
@@ -38,13 +38,17 @@
<th>&nbsp;</th>
<th>AC</th>
<th>Pass. Per.</th>
<th>Pass. Ins.</th>
<th>Pass. Inv.</th>
<th>Spell DC</th>
</tr>
[% for member in party %]
<tr>
<td>[[ member.name[:28] ]]</td>
<td>[[ member.armor_class ]]</td>
<td>[[ member.perception.modifier + 10 ]]</td>
<td class="passive-perception">[[ member.passive_perception ]]</td>
<td class="passive-insight">[[ member.passive_insight ]]</td>
<td class="passive-investigation">[[ member.passive_investigation ]]</td>
<td>[% for class in member.class_list %]
[% if class.spellcasting_ability %] [[ member.spell_save_dc(class) ]], [% endif %]
[% endfor %]
+29 -6
View File
@@ -24,19 +24,29 @@
\\
[% endfor %]
\end{DndTable}
\begin{DndTable}{r c c c c}
& AC & Pas.\ Per. & Max HP & Spl.\ DC \\
\begin{DndTable}{r c c c}
& AC & Max HP & Spl.\ DC \\
[% for member in party %]
[[ member.name[:28] ]]
& [[ member.armor_class ]]
& [[ member.perception.modifier + 10 ]]
& [[ member.max_hp ]]
& [[ member.hp_max ]]
& [% for class in member.class_list %]
[% if class.spellcasting_ability %] [[ member.spell_save_dc(class) ]], [% endif %]
[% endfor %]
\\
[% endfor %]
\end{DndTable}
% Passive stats
\begin{DndTable}{r c c c}
& Pas. Per.\ & Pas. Ins.\ & Pas. Inv.\ \\
[% for member in party %]
[[ member.name[:28] ]]
& [[ member.passive_perception ]] % Passive perception
& [[ member.passive_insight ]] % Passive insight
& [[ member.passive_investigation ]] % Passive investigation
\\
[% endfor %]
\end{DndTable}
%% XP thresholds for the party
\begin{DndTable}{r c c c c}
& Easy & Medium & Hard & Deadly \\
@@ -60,19 +70,32 @@
\\
[% endfor %]
\end{tabular}
% Additional combat stats
\begin{tabular}{r | c c c}
& AC & Pas.\ Per. & Spl.\ DC \\
& AC & Max HP & Spl.\ DC \\
\hline\hline
[% for member in party %]
[[ member.name[:28] ]]
& [[ member.armor_class ]]
& [[ member.perception.modifier + 10 ]]
& [[ member.hp_max ]] % Maximum HP
& [% for class in member.class_list %]
[% if class.spellcasting_ability %] [[ member.spell_save_dc(class) ]], [% endif %]
[% endfor %]
\\
[% endfor %]
\end{tabular}
% Passive stats
\begin{tabular}{r | c c c}
& Pas.\ Per. & Pas.\ Ins. & Pas.\ Inv.\ \\
\hline\hline
[% for member in party %]
[[ member.name[:28] ]]
& [[ member.passive_perception ]] % Passive perception
& [[ member.passive_insight ]] % Passive insight
& [[ member.passive_investigation ]] % Passive investigation
\\
[% endfor %]
\end{tabular}
%% XP thresholds for the party
\begin{tabular}{r c c c c}
& Easy & Medium & Hard & Deadly \\
+44
View File
@@ -140,6 +140,19 @@ class VashtaNerada(monsters.Monster):
class HtmlCreatorTestCase(unittest.TestCase):
def new_character(self):
char = character.Character(
name="Dr. Who",
classes=["Monk", "Druid", "Artificer"],
levels=[1, 1, 1],
subclasses=["way of the open hand", None, None],
magic_items=["cloak of protection"],
spells=["invisibility"],
wild_shapes=["crocodile"],
infusions=["boots of the winding path"]
)
return char
def test_create_monsters_html(self):
monsters_ = [monsters.Priest()]
html = make_sheets.create_monsters_content(monsters=monsters_, suffix="html")
@@ -172,6 +185,19 @@ class HtmlCreatorTestCase(unittest.TestCase):
suffix="html",
use_dnd_decorations=True)
def test_create_party_summary_html(self):
char = self.new_character()
html = make_sheets.create_party_summary_content(party=[char], suffix="html", summary_rst="")
self.assertIn('<h1 id="gm-party">Party</h1>', html)
self.assertIn(char.name, html)
# Check for passive perception/insight/investigation
self.assertIn('<th>Pass. Per.</th>', html)
self.assertIn(f'<td class="passive-perception">{10+char.perception.modifier}</td>', html)
self.assertIn('<th>Pass. Ins.</th>', html)
self.assertIn(f'<td class="passive-insight">{10+char.insight.modifier}</td>', html)
self.assertIn('<th>Pass. Inv.</th>', html)
self.assertIn(f'<td class="passive-investigation">{10+char.investigation.modifier}</td>', html)
def test_create_extra_gm_content(self):
class MySection():
name = "My D&D Homebrew Content"
@@ -273,6 +299,24 @@ class TexCreatorTestCase(unittest.TestCase):
tex = make_sheets.create_party_summary_content(party=[char], suffix="tex", summary_rst="")
self.assertIn(r"\section*{Party}", tex)
self.assertIn(char.name, tex)
# Check for passive perception/insight/investigation
print(char.passive_insight, char.passive_perception, char.passive_investigation)
self.assertIn(f'& {char.passive_insight} % Passive insight', tex)
self.assertIn(f'& {char.passive_perception} % Passive perception', tex)
self.assertIn(f'& {char.passive_investigation} % Passive investigation', tex)
def test_create_party_summary_tex_fancy(self):
char = self.new_character()
tex = make_sheets.create_party_summary_content(party=[char],
suffix="tex",
summary_rst="",
use_dnd_decorations=True)
self.assertIn(r"\section*{Party}", tex)
self.assertIn(char.name, tex)
# Check for passive perception/insight/investigation
self.assertIn(f'& {char.passive_insight} % Passive insight', tex)
self.assertIn(f'& {char.passive_perception} % Passive perception', tex)
self.assertIn(f'& {char.passive_investigation} % Passive investigation', tex)
def test_create_summary_tex(self):
rst = "The party's create *adventure*."