コード例 #1
0
ファイル: test_attack_action.py プロジェクト: tuturto/pyherc
    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)))
コード例 #2
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)))
コード例 #3
0
ファイル: test_attack_action.py プロジェクト: tuturto/pyherc
    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)))
コード例 #4
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)))