How to use the dungeonsheets.armor.Armor 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 / dungeonsheets / stats.py View on Github external
if (f'+{i}' in name) or (f'+ {i}' in name):
            bonus = i
            name = name.replace(f'+{i}', '').replace(f'+ {i}', '')
            break
    py_name = name.replace('-', '_').replace(' ', '_').replace("'", "")
    camel_case = "".join([s.capitalize() for s in py_name.split('_')])
    if hasattr(obj, py_name):
        # Direct lookup
        attr = getattr(obj, py_name)
    elif hasattr(obj, camel_case):
        # CamelCase lookup
        attr = getattr(obj, camel_case)
    else:
        raise AttributeError(f'{obj} has no attribute {name}')
    if bonus > 0:
        if issubclass(attr, Weapon) or issubclass(attr, Shield) or issubclass(attr, Armor):
            attr = attr.improved_version(bonus)
    return attr
github canismarko / dungeon-sheets / dungeonsheets / armor.py View on Github external
cost = "400 gp"
    base_armor_class = 14
    dexterity_mod_max = 2
    weight = 20


class MediumHalfPlateArmor(Armor):
    name = "Medium half plate armor"
    cost = "750 gp"
    base_armor_class = 15
    dexterity_mod_max = 2
    stealth_disadvantage = True
    weight = 40


class HeavyRingMailArmor(Armor):
    name = "Heavy ring mail armor"
    cost = "30 gp"
    base_armor_class = 14
    dexterity_mod_max = 0
    stealth_disadvantage = True
    weight = 40


class HeavyChainMailArmor(Armor):
    name = "Heavy chain mail armor"
    cost = "75 gp"
    base_armor_class = 16
    dexterity_mod_max = 0
    strength_required = 13
    stealth_disadvantage = True
    weight = 55
github canismarko / dungeon-sheets / dungeonsheets / armor.py View on Github external
dexterity_mod_max = 0
    stealth_disadvantage = True
    weight = 40


class HeavyChainMailArmor(Armor):
    name = "Heavy chain mail armor"
    cost = "75 gp"
    base_armor_class = 16
    dexterity_mod_max = 0
    strength_required = 13
    stealth_disadvantage = True
    weight = 55


class HeavySplintArmor(Armor):
    name = "Heavy splint armor"
    cost = "200 gp"
    base_armor_class = 17
    dexterity_mod_max = 0
    strength_required = 15
    stealth_disadvantage = True
    weight = 60


class HeavyPlateArmor(Armor):
    name = "Heavy splint armor"
    cost = "1,500 gp"
    base_armor_class = 18
    dexterity_mod_max = 0
    strength_required = 15
    stealth_disadvantage = True
github canismarko / dungeon-sheets / dungeonsheets / armor.py View on Github external
cost = "0 gp"
    base_armor_class = 10
    dexterity_mod_max = None
    strength_required = None
    stealth_disadvantage = False
    weight = 0 # In lbs
    
    def __str__(self):
        return self.name


class NoArmor(Armor):
    name = "No armor"


class LightPaddedArmor(Armor):
    name = "Light padded armor"
    cost = "5 gp"
    base_armor_class = 11
    weight = 8
    stealth_disadvantage = True


class LeatherArmor(Armor):
    name = "Leather armor"
    cost = "10 gp"
    base_armor_class = 11
    weight = 10


class StuddedArmor(Armor):
    name = "Studded armor"
github canismarko / dungeon-sheets / dungeonsheets / armor.py View on Github external
base_armor_class = 15
    dexterity_mod_max = 2
    stealth_disadvantage = True
    weight = 40


class HeavyRingMailArmor(Armor):
    name = "Heavy ring mail armor"
    cost = "30 gp"
    base_armor_class = 14
    dexterity_mod_max = 0
    stealth_disadvantage = True
    weight = 40


class HeavyChainMailArmor(Armor):
    name = "Heavy chain mail armor"
    cost = "75 gp"
    base_armor_class = 16
    dexterity_mod_max = 0
    strength_required = 13
    stealth_disadvantage = True
    weight = 55


class HeavySplintArmor(Armor):
    name = "Heavy splint armor"
    cost = "200 gp"
    base_armor_class = 17
    dexterity_mod_max = 0
    strength_required = 15
    stealth_disadvantage = True
github canismarko / dungeon-sheets / dungeonsheets / armor.py View on Github external
name = "Hide armor"
    cost = "10 gp"
    base_armor_class = 12
    dexterity_mod_max = 2
    weight = 12


class MediumChainShirtArmor(Armor):
    name = "Medium chain shirt armor"
    cost = "50 gp"
    base_armor_class = 13
    dexterity_mod_max = 2
    weight = 20


class MediumScaleMailArmor(Armor):
    name = "Medium scale mail armor"
    cost = "50 gp"
    base_armor_class = 14
    dexterity_mod_max = 2
    stealth_disadvantage = True
    weight = 45


class MediumBrassplateArmor(Armor):
    name = "Medium brassplate armor"
    cost = "400 gp"
    base_armor_class = 14
    dexterity_mod_max = 2
    weight = 20
github canismarko / dungeon-sheets / dungeonsheets / armor.py View on Github external
class LeatherArmor(Armor):
    name = "Leather armor"
    cost = "10 gp"
    base_armor_class = 11
    weight = 10


class StuddedArmor(Armor):
    name = "Studded armor"
    cost = "45 gp"
    base_armor_class = 12
    weight = 13


class HideArmor(Armor):
    name = "Hide armor"
    cost = "10 gp"
    base_armor_class = 12
    dexterity_mod_max = 2
    weight = 12


class MediumChainShirtArmor(Armor):
    name = "Medium chain shirt armor"
    cost = "50 gp"
    base_armor_class = 13
    dexterity_mod_max = 2
    weight = 20


class MediumScaleMailArmor(Armor):
github canismarko / dungeon-sheets / dungeonsheets / armor.py View on Github external
strength_required = 13
    stealth_disadvantage = True
    weight = 55


class HeavySplintArmor(Armor):
    name = "Heavy splint armor"
    cost = "200 gp"
    base_armor_class = 17
    dexterity_mod_max = 0
    strength_required = 15
    stealth_disadvantage = True
    weight = 60


class HeavyPlateArmor(Armor):
    name = "Heavy splint armor"
    cost = "1,500 gp"
    base_armor_class = 18
    dexterity_mod_max = 0
    strength_required = 15
    stealth_disadvantage = True
    weight = 65
github canismarko / dungeon-sheets / dungeonsheets / character.py View on Github external
def wear_armor(self, new_armor):
        """Accepts a string or Armor class and replaces the current armor.

        If a string is given, then a subclass of
        :py:class:`~dungeonsheets.armor.Armor` is retrived from the
        ``armor.py`` file. Otherwise, an subclass of
        :py:class:`~dungeonsheets.armor.Armor` can be provided
        directly.

        """
        if new_armor not in ('', 'None', None):
            if isinstance(new_armor, armor.Armor):
                new_armor = new_armor
            else:
                NewArmor = findattr(armor, new_armor)
                new_armor = NewArmor()
            self.armor = new_armor
github canismarko / dungeon-sheets / dungeonsheets / armor.py View on Github external
cost = "50 gp"
    base_armor_class = 13
    dexterity_mod_max = 2
    weight = 20


class MediumScaleMailArmor(Armor):
    name = "Medium scale mail armor"
    cost = "50 gp"
    base_armor_class = 14
    dexterity_mod_max = 2
    stealth_disadvantage = True
    weight = 45


class MediumBrassplateArmor(Armor):
    name = "Medium brassplate armor"
    cost = "400 gp"
    base_armor_class = 14
    dexterity_mod_max = 2
    weight = 20


class MediumHalfPlateArmor(Armor):
    name = "Medium half plate armor"
    cost = "750 gp"
    base_armor_class = 15
    dexterity_mod_max = 2
    stealth_disadvantage = True
    weight = 40