def add_willpower_superficial_damage(self, damage):
        """
            Add superficial damage to the willpower tracker
        """
        self.aggravated_willpower_damage, self.superficial_willpower_damage = DamageCalculator.calculate_superficial_damage(
            self.max_willpower, self.aggravated_willpower_damage,
            self.superficial_willpower_damage, damage)

        self.update_willpower_state()
 def test_calculate_superficial_damage_overflow_diff_max(self):
     # Tests that max value doesn't impact the overflow
     aggravated, superficial = DamageCalculator.calculate_superficial_damage(
         max_value=7,
         aggravated_damage=0,
         superficial_damage=0,
         damage_taken=10)
     self.assertEquals(aggravated, 3)
     self.assertEquals(superficial, 4)
 def test_calculate_superficial_damage_overflow_from_full_hp(self):
     # Tests that from full HP/WP if a character takes a lot of superficial damage, it overflows
     aggravated, superficial = DamageCalculator.calculate_superficial_damage(
         max_value=5,
         aggravated_damage=0,
         superficial_damage=0,
         damage_taken=8)
     self.assertEquals(aggravated, 3)
     self.assertEquals(superficial, 2)
 def test_calculate_superficial_damage_overflows_to_aggravated(self):
     # Already taken superficial damage, further damage becomes aggravated
     aggravated, superficial = DamageCalculator.calculate_superficial_damage(
         max_value=5,
         aggravated_damage=0,
         superficial_damage=5,
         damage_taken=1)
     self.assertEquals(aggravated, 1)
     self.assertEquals(superficial, 4)
 def test_calculate_superficial_damage_superficial_added(self):
     # Take 2 superficial from max hp
     aggravated, superficial = DamageCalculator.calculate_superficial_damage(
         max_value=5,
         aggravated_damage=0,
         superficial_damage=2,
         damage_taken=2)
     self.assertEquals(aggravated, 0)
     self.assertEquals(superficial, 4)
 def test_calculate_superficial_damage_superficial_taken(self):
     # Take 2 superficial from already having 2
     aggravated, superficial = DamageCalculator.calculate_superficial_damage(
         max_value=5,
         aggravated_damage=0,
         superficial_damage=0,
         damage_taken=2)
     self.assertEquals(aggravated, 0)
     self.assertEquals(superficial, 2)
 def test_calculate_superficial_damage_no_change(self):
     # Base case, no change
     aggravated, superficial = DamageCalculator.calculate_superficial_damage(
         max_value=5,
         aggravated_damage=0,
         superficial_damage=0,
         damage_taken=0)
     self.assertEquals(aggravated, 0)
     self.assertEquals(superficial, 0)
    def add_health_superficial_damage(self, damage, raw=False):
        """
            Add superficial damage to the tracker, halfing it if the character is a vampire.

            If raw is set, the damage will not be halved for vampires. 

            Updates the health state when done.
        """
        if self.character.is_vampire and not raw:
            damage = math.floor(damage / 2)

        self.aggravated_health_damage, self.superficial_health_damage = DamageCalculator.calculate_superficial_damage(
            self.max_health, self.aggravated_health_damage,
            self.superficial_health_damage, damage)

        self.update_health_state()