How to use the dungeonsheets.stats.Ability function in dungeonsheets

To help you get started, we’ve selected a few dungeonsheets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github canismarko / dungeon-sheets / tests / test_stats.py View on Github external
def test_saving_throw(self):
        # Try it with an ST proficiency
        class MyClass(character.Character):
            saving_throw_proficiencies = ['strength']
            proficiency_bonus = 2
            strength = stats.Ability(14)
        my_class = MyClass()
        self.assertEqual(my_class.strength.saving_throw, 4)
github canismarko / dungeon-sheets / tests / test_stats.py View on Github external
def test_modifier(self):
        class MyCharacter(character.Character):
            saving_throw_proficiencies = ['strength']
            proficiency_bonus = 2
            strength = stats.Ability(14)
        my_char = MyCharacter()
        ranges = [
            ((1,), -5),
            ((2, 3), -4),
            ((4, 5), -3),
            ((6, 7), -2),
            ((8, 9), -1),
            ((10, 11), 0),
            ((12, 13), 1),
            ((14, 15), 2),
            ((16, 17), 3),
            ((18, 19), 4),
            ((20, 21), 5),
            ((22, 23), 6),
            ((24, 25), 7),
            ((26, 27), 8),
github canismarko / dungeon-sheets / tests / test_stats.py View on Github external
def test_skill(self):
        """Test for a skill, that depends on another ability."""
        class MyClass(character.Character):
            dexterity = stats.Ability(14)
            acrobatics = stats.Skill(ability='dexterity')
            skill_proficiencies = []
            proficiency_bonus = 2
        my_class = MyClass()
        self.assertEqual(my_class.acrobatics, 2)
        # Check for a proficiency
        my_class.skill_proficiencies = ['acrobatics']
        self.assertEqual(my_class.acrobatics, 4)
github canismarko / dungeon-sheets / dungeonsheets / character.py View on Github external
"""
    # General attirubtes
    name = ""
    player_name = ""
    alignment = "Neutral"
    dungeonsheets_version = __version__
    class_list = list()
    _race = None
    _background = None
    xp = 0
    # Hit points
    hp_max = None
    # Base stats (ability scores)
    strength = Ability()
    dexterity = Ability()
    constitution = Ability()
    intelligence = Ability()
    wisdom = Ability()
    charisma = Ability()
    armor_class = ArmorClass()
    initiative = Initiative()
    speed = Speed()
    inspiration = False
    _saving_throw_proficiencies = tuple()  # use to overwrite class proficiencies
    other_weapon_proficiencies = tuple()  # add to class/race proficiencies
    skill_proficiencies = list()
    skill_expertise = list()
    languages = ""
    # Skills
    acrobatics = Skill(ability='dexterity')
    animal_handling = Skill(ability='wisdom')
    arcana = Skill(ability='intelligence')
github canismarko / dungeon-sheets / dungeonsheets / monsters.py View on Github external
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.

    """
    name = "Giant eagle"
    description = "Large beast, neutral good"
    challenge_rating = 1
    armor_class = 13
    skills = "Perception +4"
    senses = "Passive perception 14"
    languages = "Giant Eagle, understands common and Auran but can't speak."
    strength = Ability(16)
    dexterity = Ability(17)
    constitution = Ability(13)
    intelligence = Ability(8)
    wisdom = Ability(14)
    charisma = Ability(10)
    speed = 10
    swim_speed = 0
    fly_speed = 80
    hp_max = 26
    hit_dice = '4d10+4'


class Spider(Monster):
    """**Spider Climb:** The spider can climb difficult surfaces,
    including upside down on ceilings, without needing to make an
    ability check.

    **Web Sense:** While in contact with a web, the spider knows the
github canismarko / dungeon-sheets / dungeonsheets / monsters.py View on Github external
ankylosaurus, which defends itself against predators with a
    knobbed tail that delivers a devastating strike.

    **Tail:** *Melee Weapon Attack:* +7 to hit, reach 10 ft., one
    target. *Hit:* 18 (4d6+4) bludgeoning damage. If the target is a
    creature, it must succeed on a DC 14 Strength saving throw or be
    knocked prone.

    """
    name = "Ankylosaurus"
    description = "Huge beast, unaligned"
    challenge_rating = 3
    armor_class = 15
    skills = ""
    senses = "Passive perception 11"
    strength = Ability(19)
    dexterity = Ability(11)
    constitution = Ability(15)
    intelligence = Ability(2)
    wisdom = Ability(12)
    charisma = Ability(5)
    speed = 30
    swim_speed = 0
    fly_speed = 0
    hp_max = 68
    hit_dice = '8d12+16'


class Ape(Monster):
    """**Multiattack:** The ape makes two fist attacks.

    **Fist:** *Melee Weapon Attack:* +5 to hit, reach 5 ft., one
github canismarko / dungeon-sheets / dungeonsheets / monsters.py View on Github external
from dungeonsheets.stats import Ability


class Monster():
    """A monster that may be encountered when adventuring."""
    name = "Generic Monster"
    description = ""
    challenge_rating = 0
    armor_class = 0
    skills = "Perception +3, Stealth +4"
    senses = ""
    languages = ""
    strength = Ability()
    dexterity = Ability()
    constitution = Ability()
    intelligence = Ability()
    wisdom = Ability()
    charisma = Ability()
    speed = 30
    swim_speed = 0
    fly_speed = 0
    hp_max = 10
    hit_dice = '1d6'

    @property
    def is_beast(self):
        is_beast = 'beast' in self.description.lower()
        return is_beast
github canismarko / dungeon-sheets / dungeonsheets / monsters.py View on Github external
"""**Multiattack:** The ape makes two fist attacks.

    **Fist:** *Melee Weapon Attack:* +5 to hit, reach 5 ft., one
    target. *Hit:* 6 (1d6+3) bludgeoning damage.

    **Rock:** *Ranged Weapon Attack:* +5 to hit, range 25/50 ft., one
    target. *Hit:* 6 (1d6+3) bludgeoning damage.

    """
    name = "Ape"
    description = "Medium beast, unaligned"
    challenge_rating = 1 / 2
    armor_class = 12
    skills = "Athletics +5, Perception +3"
    senses = "Passive perception 13"
    strength = Ability(16)
    dexterity = Ability(14)
    constitution = Ability(14)
    intelligence = Ability(6)
    wisdom = Ability(12)
    charisma = Ability(7)
    speed = 30
    swim_speed = 0
    fly_speed = 0
    hp_max = 19
    hit_dice = '3d8+6'


class Crocodile(Monster):
    """**Hold Breath:** The crocodile can hold its breath for 15 minutes.

    **Bite:** *Melee Weapon Attack:* +4 to hit, reach 5 ft., one
github canismarko / dungeon-sheets / dungeonsheets / monsters.py View on Github external
**Tail:** *Melee Weapon Attack:* +7 to hit, reach 10 ft., one
    target. *Hit:* 18 (4d6+4) bludgeoning damage. If the target is a
    creature, it must succeed on a DC 14 Strength saving throw or be
    knocked prone.

    """
    name = "Ankylosaurus"
    description = "Huge beast, unaligned"
    challenge_rating = 3
    armor_class = 15
    skills = ""
    senses = "Passive perception 11"
    strength = Ability(19)
    dexterity = Ability(11)
    constitution = Ability(15)
    intelligence = Ability(2)
    wisdom = Ability(12)
    charisma = Ability(5)
    speed = 30
    swim_speed = 0
    fly_speed = 0
    hp_max = 68
    hit_dice = '8d12+16'


class Ape(Monster):
    """**Multiattack:** The ape makes two fist attacks.

    **Fist:** *Melee Weapon Attack:* +5 to hit, reach 5 ft., one
    target. *Hit:* 6 (1d6+3) bludgeoning damage.
github canismarko / dungeon-sheets / dungeonsheets / monsters.py View on Github external
creature. Hit: 1 piercing damage, and the target must succeed on a
    DC 9 Constitution saving throw or take 2 (1d4) poison damage.

    """
    name = "Spider"
    description = "Tiny beast, unaligned"
    challenge_rating = 0
    armor_class = 12
    skills = "Stealth +4"
    senses = "Darkvision 30 Ft., passive Perception 12"
    strength = Ability(2)
    dexterity = Ability(14)
    constitution = Ability(8)
    intelligence = Ability(1)
    wisdom = Ability(10)
    charisma = Ability(2)
    speed = 20
    hp_max = 1
    hit_dice = '1d4-1'


class SwarmOfRats(Monster):
    """**Keen Smell:** The swarm has advantage on Wisdom (Perception)
    checks that rely on smell.

    **Swarm:** The swarm can occupy another creature's space and vice
      versa, and the swarm can move through any opening large enough
      for a Tiny rat. The swarm can't regain Hit Points or gain
      Temporary Hit Points.

    **Bites:** Melee Weapon Attack: +2 to hit, reach 0 ft., one target
      in the swarm's space. Hit: 7 (2d6) piercing damage, or 3 (1d6)