How to use the dungeonsheets.weapons.Weapon 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_weapon.py View on Github external
def test_weapon_damage(self):
        weapon = Weapon()
        weapon.base_damage = '1d6'
        self.assertEqual(weapon.damage, '1d6')
        # Now add some bonus damage
        weapon.bonus_damage = 2
        self.assertEqual(weapon.damage, '1d6 +2')
github canismarko / dungeon-sheets / dungeonsheets / weapons.py View on Github external
weight = 2
    properties = "Ammunition (range 80/320), two-handed"
    ability = 'dexterity'


class Sling(Weapon):
    name = "Sling"
    cost = "1 sp"
    base_damage = "1d4"
    damage_type = "bludgeoning"
    weight = 0
    properties = "Ammunition (range 30/120)"
    ability = 'dexterity'


class Battleaxe(Weapon):
    name = "Battleaxe"
    cost = "10 gp"
    base_damage = "1d8"
    damage_type = "slashing"
    weight = 4
    properties = "Versatile (1d10)"
    ability = 'strength'


class Flail(Weapon):
    name = "Flail"
    cost = "10gp"
    base_damage = "1d8"
    damage_type = "bludgeoning"
    weight = 2
    properties = ""
github canismarko / dungeon-sheets / dungeonsheets / weapons.py View on Github external
properties = "Finesse, light, thrown (range 20/60)"
    is_finesse = True
    ability = 'strength'


class Greatclub(Weapon):
    name = "Greatclub"
    cost = "2 sp"
    base_damage = "1d8"
    damage_type = "bludgeoning"
    weight = 10
    properties = "Two-handed"
    ability = 'strength'


class Handaxe(Weapon):
    name = "Handaxe"
    cost = "5 gp"
    base_damage = "1d6"
    damage_type = "slashing"
    weight = 2
    properties = "Light, thrown (range 20/60)"
    ability = 'strength'


class Javelin(Weapon):
    name = "Javelin"
    cost = "5 sp"
    base_damage = "1d6"
    damage_type = "piercing"
    weight = 2
    properties = "Thrown (range 30/120)"
github canismarko / dungeon-sheets / dungeonsheets / weapons.py View on Github external
properties = "Light"
    ability = 'strength'


class Dagger(Weapon):
    name = "Dagger"
    cost = "2 gp"
    base_damage = "1d4"
    damage_type = "piercing"
    weight = 1
    properties = "Finesse, light, thrown (range 20/60)"
    is_finesse = True
    ability = 'strength'


class Greatclub(Weapon):
    name = "Greatclub"
    cost = "2 sp"
    base_damage = "1d8"
    damage_type = "bludgeoning"
    weight = 10
    properties = "Two-handed"
    ability = 'strength'


class Handaxe(Weapon):
    name = "Handaxe"
    cost = "5 gp"
    base_damage = "1d6"
    damage_type = "slashing"
    weight = 2
    properties = "Light, thrown (range 20/60)"
github canismarko / dungeon-sheets / dungeonsheets / weapons.py View on Github external
weight = 6
    properties = "Heavy, two-handed"
    ability = 'strength'


class Halberd(Weapon):
    name = "Halberd"
    cost = "20 gp"
    base_damage = "1d10"
    damage_type = "slashing"
    weight = 6
    properties = "Heavy, reach, two-handed"
    ability = 'strength'


class Lance(Weapon):
    name = "Lance"
    cost = "10gp"
    base_damage = "1d12"
    damage_type = "piercing"
    weight = 6
    properties = "Reach, special"
    ability = 'strength'


class Longsword(Weapon):
    name = "Longsword"
    cost = "15 gp"
    base_damage = "1d8"
    damage_type = "slashing"
    weight = 3
    properties = "Versatile (1d10)"
github canismarko / dungeon-sheets / dungeonsheets / weapons.py View on Github external
weight = 4
    properties = "Versatile (1d8)"
    ability = 'strength'


class Sickle(Weapon):
    name = "Sickle"
    cost = "1 gp"
    base_damage = "1d4"
    damage_type = "slashing"
    weight = 2
    properties = "Light"
    ability = 'strength'


class Spear(Weapon):
    name = "Spear"
    cost = "1 gp"
    base_damage = "1d6"
    damage_type = "piercing"
    weight = 3
    properties = "Thrown (range 20/60), versatile (1d8)"
    ability = 'strength'


class LightCrossbow(Weapon):
    name = "Light crossbow"
    cost = "25 gp"
    base_damage = "1d8"
    damage_type = "piercing"
    weight = 5
    properties = "Ammunition (range 80/320, loading, two-handed"
github canismarko / dungeon-sheets / dungeonsheets / character.py View on Github external
Parameters
        ----------
        weapon : str
          Case-insensitive string with a name of the weapon.

        """
        # Retrieve the weapon class from the weapons module
        if isinstance(weapon, weapons.Weapon):
            weapon_ = type(weapon)(wielder=self)
        elif isinstance(weapon, str):
            try:
                NewWeapon = findattr(weapons, weapon)
            except AttributeError:
                raise AttributeError(f'Weapon "{weapon}" is not defined')
            weapon_ = NewWeapon(wielder=self)
        elif issubclass(weapon, weapons.Weapon):
            weapon_ = weapon(wielder=self)
        else:
            raise AttributeError(f'Weapon "{weapon}" is not defined')
        # Save it to the array
        self.weapons.append(weapon_)
github canismarko / dungeon-sheets / dungeonsheets / weapons.py View on Github external
weight = 2
    properties = "Light"
    ability = 'strength'


class Spear(Weapon):
    name = "Spear"
    cost = "1 gp"
    base_damage = "1d6"
    damage_type = "piercing"
    weight = 3
    properties = "Thrown (range 20/60), versatile (1d8)"
    ability = 'strength'


class LightCrossbow(Weapon):
    name = "Light crossbow"
    cost = "25 gp"
    base_damage = "1d8"
    damage_type = "piercing"
    weight = 5
    properties = "Ammunition (range 80/320, loading, two-handed"
    ability = 'dexterity'


class Dart(Weapon):
    name = "Dart"
    cost = "5 cp"
    base_damage = "1d4"
    damage_type = "piercing"
    weight = 0.25
    properties = "Finesse, thrown (range 20/60)"
github canismarko / dungeon-sheets / dungeonsheets / weapons.py View on Github external
weight = 2
    properties = ""
    ability = 'strength'


class Warhammer(Weapon):
    name = "Warhammer"
    cost = "15 gp"
    base_damage = "1d8"
    damage_type = "bludgeoning"
    weight = 2
    properties = "Versatile (1d10)"
    ability = 'strength'


class Whip(Weapon):
    name = "Whip"
    cost = "2 gp"
    base_damage = "1d4"
    damage_type = "slashing"
    weight = 3
    properties = "Finesse, reach"
    is_finesse = True
    ability = 'strength'


class Blowgun(Weapon):
    name = "Blowgun"
    cost = "10 gp"
    base_damage = "1"
    damage_type = "piercing"
    weight = 1
github canismarko / dungeon-sheets / dungeonsheets / weapons.py View on Github external
damage_type = "piercing"
    attack_bonus = 0
    weight = 1 # In lbs
    properties = "Light"
    ability = 'strength'
    is_finesse = False
    
    @property
    def damage(self):
        dam_str = str(self.base_damage)
        if self.bonus_damage != 0:
            dam_str += ' ' + mod_str(self.bonus_damage)
        return dam_str


class Club(Weapon):
    name = "Club"
    cost = "1 sp"
    base_damage = "1d4"
    damage_type = "bludgeoning"
    weight = 2
    properties = "Light"
    ability = 'strength'


class Dagger(Weapon):
    name = "Dagger"
    cost = "2 gp"
    base_damage = "1d4"
    damage_type = "piercing"
    weight = 1
    properties = "Finesse, light, thrown (range 20/60)"