Fixed broken test and cleaned up with flake8/black.

This commit is contained in:
Mark Wolfman
2021-06-04 11:36:35 -05:00
parent 84453404b4
commit 3d8b9987db
34 changed files with 74 additions and 73 deletions
+2 -2
View File
@@ -22,8 +22,8 @@ script:
- pytest --cov=dungeonsheets tests/
- flake8 dungeonsheets/ --exit-zero
- cd examples/
- makesheets -d
- makesheets -dF
- makesheets --debug
- makesheets --debug --fancy
- cd ../
after_success:
- coveralls
+1 -2
View File
@@ -22,7 +22,6 @@ from dungeonsheets import (
)
from dungeonsheets.stats import findattr
from dungeonsheets.weapons import Weapon
from dungeonsheets.readers import read_sheet_file
from dungeonsheets.entity import Entity
@@ -901,7 +900,7 @@ class Character(Entity):
"""
# Parse the sheet type
char_props.pop('sheet_type', "")
char_props.pop("sheet_type", "")
# Load classes
classes = char_props.get("classes", [])
# backwards compatability
+13 -9
View File
@@ -115,10 +115,12 @@ def create_druid_shapes_tex(
return template.render(character=character, use_dnd_decorations=use_dnd_decorations)
def make_sheet(sheet_file: File,
def make_sheet(
sheet_file: File,
flatten: bool = False,
fancy_decorations: bool = False,
debug: bool = False):
debug: bool = False,
):
"""Make a character or GM sheet into a PDF.
Parameters
----------
@@ -140,16 +142,20 @@ def make_sheet(sheet_file: File,
sheet_props = readers.read_sheet_file(sheet_file)
# Create the sheet
if sheet_props.get("sheet_type", "") == "gm":
ret = make_gm_sheet(basename=base_name, gm_props=sheet_props,
ret = make_gm_sheet(
basename=base_name,
gm_props=sheet_props,
fancy_decorations=fancy_decorations,
debug=debug)
debug=debug,
)
else:
ret = make_character_sheet(
basename=base_name,
character_props=sheet_props,
flatten=flatten,
fancy_decorations=fancy_decorations,
debug=debug)
debug=debug,
)
return ret
@@ -177,7 +183,7 @@ def make_gm_sheet(
tex = [
jinja_env.get_template("preamble.tex").render(
use_dnd_decorations=fancy_decorations,
title=gm_props['session_title'],
title=gm_props["session_title"],
)
]
# Add the monsters
@@ -202,9 +208,7 @@ def make_gm_sheet(
use_dnd_decorations=fancy_decorations,
)
except exceptions.LatexNotFoundError:
log.warning(
f"``pdflatex`` not available. Skipping {basename}"
)
log.warning(f"``pdflatex`` not available. Skipping {basename}")
def make_character_sheet(
+4 -3
View File
@@ -4,7 +4,6 @@ shape forms.
"""
from dungeonsheets.stats import Ability
from dungeonsheets.entity import Entity
@@ -15,7 +14,10 @@ class Monster(Entity):
description = ""
challenge_rating = 0
skills = "Perception +3, Stealth +4"
swim_speed = 0 # TODO: Consider refactoring stats.Speed to consider all of these just like we do stats.Ability
# TODO: Consider refactoring stats.Speed to consider all of these
# just like we do stats.Ability
swim_speed = 0
fly_speed = 0
climb_speed = 0
hp_max = 10
@@ -28,4 +30,3 @@ class Monster(Entity):
def is_beast(self):
is_beast = "beast" in self.description.lower()
return is_beast
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Aboleth(Monster):
"""
**Amphibious**: The aboleth can breathe air and water.
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Baboon(Monster):
"""
**Pack Tactics**: The baboon has advantage on an attack roll against a creature if at least one of the baboon's allies is within 5 ft. of the creature and the ally isn't incapacitated.
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Camel(Monster):
"""
**Bite**: Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 2 (1d4) bludgeoning damage.
+3 -2
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Darkmantle(Monster):
"""
**Echolocation**: The darkmantle can't use its blindsight while deafened.
@@ -368,7 +367,9 @@ class Dretch(Monster):
armor_class = 11
skills = ""
senses = "Darkvision 60 ft., Passive Perception 9"
languages = "Abyssal, telepathy 60 ft. (works only with creatures that understand Abyssal)"
languages = (
"Abyssal, telepathy 60 ft. (works only with creatures that understand Abyssal)"
)
strength = Ability(11)
dexterity = Ability(11)
constitution = Ability(12)
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Eagle(Monster):
"""
**Keen Sight**: The eagle has advantage on Wisdom (Perception) checks that rely on sight.
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class FireElemental(Monster):
"""
**Fire Form**: The elemental can move through a space as narrow as 1 inch wide without squeezing. A creature that touches the elemental or hits it with a melee attack while within 5 ft. of it takes 5 (1d10) fire damage. In addition, the elemental can enter a hostile creature's space and stop there. The first time it enters a creature's space on a turn, that creature takes 5 (1d10) fire damage and catches fire; until someone takes an action to douse the fire, the creature takes 5 (1d10) fire damage at the start of each of its turns.
+22 -12
View File
@@ -8,16 +8,19 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Gargoyle(Monster):
"""
**False Appearance**: While the gargoyle remains motion less, it is indistinguishable from an inanimate statue.
"""**False Appearance**: While the gargoyle remains motion less, it is
indistinguishable from an inanimate statue.
**Multiattack**: The gargoyle makes two attacks: one with its bite and one with its claws.
**Multiattack**: The gargoyle makes two attacks: one with its bite
and one with its claws.
**Bite**: Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.
**Bite**: Melee Weapon Attack: +4 to hit, reach 5 ft., one
target. Hit: 5 (1d6 + 2) piercing damage.
**Claws**: Melee Weapon Attack: +4 to hit, reach 5 ft., one
target. Hit: 5 (1d6 + 2) slashing damage.
**Claws**: Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) slashing damage.
"""
name = "Gargoyle"
@@ -413,14 +416,18 @@ class GiantCrocodile(Monster):
class GiantEagle(Monster):
"""
**Keen Sight**: The eagle has advantage on Wisdom (Perception) checks that rely on sight.
"""**Keen Sight**: The eagle has advantage on Wisdom (Perception)
checks that rely on sight.
**Multiattack**: The eagle makes two attacks: one with its beak and one with its talons.
**Multiattack**: The eagle makes two attacks: one with its beak
and one with its talons.
**Beak**: Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) piercing damage.
**Beak**: Melee Weapon Attack: +5 to hit, reach 5 ft., one
target. Hit: 6 (1d6 + 3) piercing damage.
**Talons**: Melee Weapon Attack: +5 to hit, reach 5 ft., one
target. Hit: 10 (2d6 + 3) slashing damage.
**Talons**: Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.
"""
name = "Giant Eagle"
@@ -1491,7 +1498,10 @@ class Grimlock(Monster):
challenge_rating = 0.25
armor_class = 11
skills = "Athletics +5, Perception +3, Stealth +3"
senses = "Blindsight 30 ft. or 10 ft. while deafened (blind beyond this radius), Passive Perception 13"
senses = (
"Blindsight 30 ft. or 10 ft. while deafened (blind beyond this radius), Passive"
" Perception 13"
)
languages = "Undercommon"
strength = Ability(16)
dexterity = Ability(12)
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class HalfRedDragonVeteran(Monster):
"""
**Multiattack**: The veteran makes two longsword attacks. If it has a shortsword drawn, it can also make a shortsword attack.
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class IceDevil(Monster):
"""
**Devil's Sight**: Magical darkness doesn't impede the devil's darkvision.
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Jackal(Monster):
"""
**Keen Hearing and Smell**: The jackal has advantage on Wisdom (Perception) checks that rely on hearing or smell.
+4 -2
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class KillerWhale(Monster):
"""
**Echolocation**: The whale can't use its blindsight while deafened.
@@ -132,7 +131,10 @@ class Kraken(Monster):
armor_class = 18
skills = ""
senses = "Truesight 120 ft., Passive Perception 14"
languages = "understands Abyssal, Celestial, Infernal, and Primordial but can't speak, telepathy 120 ft."
languages = (
"understands Abyssal, Celestial, Infernal, and Primordial but can't speak,"
" telepathy 120 ft."
)
strength = Ability(30)
dexterity = Ability(11)
constitution = Ability(25)
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Lamia(Monster):
"""
**Innate Spellcasting**: The lamia's innate spellcasting ability is Charisma (spell save DC 13). It can innately cast the following spells, requiring no material components. At will: disguise self (any humanoid form), major image 3/day each: charm person, mirror image, scrying, suggestion 1/day: geas
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Mage(Monster):
"""
**Spellcasting**: The mage is a 9th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 14, +6 to hit with spell attacks). The mage has the following wizard spells prepared:
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Nalfeshnee(Monster):
"""
**Magic Resistance**: The nalfeshnee has advantage on saving throws against spells and other magical effects.
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class OchreJelly(Monster):
"""
**Amorphous**: The jelly can move through a space as narrow as 1 inch wide without squeezing.
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Panther(Monster):
"""
**Keen Smell**: The panther has advantage on Wisdom (Perception) checks that rely on smell.
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Quasit(Monster):
"""
**Shapechanger**: The quasit can use its action to polymorph into a beast form that resembles a bat (speed 10 ft. fly 40 ft.), a centipede (40 ft., climb 40 ft.), or a toad (40 ft., swim 40 ft.), or back into its true form . Its statistics are the same in each form, except for the speed changes noted. Any equipment it is wearing or carrying isn't transformed . It reverts to its true form if it dies.
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Rakshasa(Monster):
"""
**Limited Magic Immunity**: The rakshasa can't be affected or detected by spells of 6th level or lower unless it wishes to be. It has advantage on saving throws against all other spells and magical effects.
+4 -2
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class SaberToothedTiger(Monster):
"""
**Keen Smell**: The tiger has advantage on Wisdom (Perception) checks that rely on smell.
@@ -645,7 +644,10 @@ class Spy(Monster):
description = "Medium humanoid, any alignment"
challenge_rating = 1
armor_class = 12
skills = "Deception +5, Insight +4, Investigation +5, Perception +6, Persuasion +5, Stealth +4"
skills = (
"Deception +5, Insight +4, Investigation +5, Perception +6, Persuasion +5,"
" Stealth +4"
)
senses = "Passive Perception 16"
languages = "any two languages"
strength = Ability(10)
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Tarrasque(Monster):
"""
**Legendary Resistance**: If the tarrasque fails a saving throw, it can choose to succeed instead.
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Unicorn(Monster):
"""
**Charge**: If the unicorn moves at least 20 ft. straight toward a target and then hits it with a horn attack on the same turn, the target takes an extra 9 (2d8) piercing damage. If the target is a creature, it must succeed on a DC 15 Strength saving throw or be knocked prone.
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Vampire(Monster):
"""
**Shapechanger**: If the vampire isn't in sun light or running water, it can use its action to polymorph into a Tiny bat or a Medium cloud of mist, or back into its true form.
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Warhorse(Monster):
"""
**Trampling Charge**: If the horse moves at least 20 ft. straight toward a creature and then hits it with a hooves attack on the same turn, that target must succeed on a DC 14 Strength saving throw or be knocked prone. If the target is prone, the horse can make another attack with its hooves against it as a bonus action.
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Xorn(Monster):
"""
**Earth Glide**: The xorn can burrow through nonmagical, unworked earth and stone. While doing so, the xorn doesn't disturb the material it moves through.
-1
View File
@@ -8,7 +8,6 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class YoungBlackDragon(Monster):
"""
**Amphibious**: The dragon can breathe air and water.
+7 -4
View File
@@ -8,12 +8,15 @@ from dungeonsheets.monsters.monsters import Monster
from dungeonsheets.stats import Ability
class Zombie(Monster):
"""
**Undead Fortitude**: If damage reduces the zombie to 0 hit points, it must make a Constitution saving throw with a DC of 5+the damage taken, unless the damage is radiant or from a critical hit. On a success, the zombie drops to 1 hit point instead.
"""**Undead Fortitude**: If damage reduces the zombie to 0 hit points,
it must make a Constitution saving throw with a DC of 5+the damage
taken, unless the damage is radiant or from a critical hit. On a
success, the zombie drops to 1 hit point instead.
**Slam**: Melee Weapon Attack: +3 to hit, reach 5 ft., one
target. Hit: 4 (1d6 + 1) bludgeoning damage.
**Slam**: Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) bludgeoning damage.
"""
name = "Zombie"
+1 -1
View File
@@ -127,4 +127,4 @@ class TexCreatorTestCase(unittest.TestCase):
def test_create_monsters_tex(self):
monsters_ = [monsters.GiantEagle()]
tex = make_sheets.create_monsters_tex(monsters=monsters_)
self.assertIn(r"Giant eagle", tex)
self.assertIn(r"Giant Eagle", tex)