Ejemplo n.º 1
0
    def test_armour_is_used(self):
        """
        Test that armoud used by target is used
        """
        character = CharacterBuilder().build()

        armour = ItemBuilder().build()
        armour.armour_data = mock()
        armour.armour_data.damage_reduction = 1
        character.inventory.armour = armour

        damage = new_damage([(5, "crushing")])

        damage_inflicted = damage(target=character)

        assert_that(damage_inflicted[0], is_(equal_to(4)))
    def test_armour_is_used(self):
        """
        Test that armoud used by target is used
        """
        character = CharacterBuilder().build()

        armour = ItemBuilder().build()
        armour.armour_data = mock()
        armour.armour_data.damage_reduction = 1
        character.inventory.armour = armour

        damage = new_damage([(5, 'crushing')])

        damage_inflicted = damage(target=character)

        assert_that(damage_inflicted[0], is_(equal_to(4)))
Ejemplo n.º 3
0
    def test_less_than_double_protection_is_not_negated(self):
        """
        Damage that is less than protection, but higher than
        half of the protection should deal 1 point of damage
        """
        character = CharacterBuilder().build()

        armour = ItemBuilder().build()
        armour.armour_data = mock()
        armour.armour_data.damage_reduction = 3
        character.inventory.armour = armour

        damage = new_damage([(2, "crushing")])

        damage_inflicted = damage(target=character)

        assert_that(damage_inflicted[0], is_(equal_to(1)))
    def test_less_than_double_protection_is_not_negated(self):
        """
        Damage that is less than protection, but higher than
        half of the protection should deal 1 point of damage
        """
        character = CharacterBuilder().build()

        armour = ItemBuilder().build()
        armour.armour_data = mock()
        armour.armour_data.damage_reduction = 3
        character.inventory.armour = armour

        damage = new_damage([(2, 'crushing')])

        damage_inflicted = damage(target=character)

        assert_that(damage_inflicted[0], is_(equal_to(1)))