コード例 #1
0
 def test_calculate_aggravated_damage_with_superficial_and_agg(self):
     # test that agg/superficial don't interfere
     aggravated, superficial = DamageCalculator.calculate_aggravated_damage(
         max_value=5,
         aggravated_damage=1,
         superficial_damage=2,
         damage_taken=1)
     self.assertEquals(aggravated, 2)
     self.assertEquals(superficial, 2)
コード例 #2
0
    def add_willpower_aggravated_damage(self, damage):
        """
            Add aggravated damage to the willpower tracker
        """
        self.aggravated_willpower_damage, self.superficial_willpower_damage = DamageCalculator.calculate_aggravated_damage(
            self.max_willpower, self.aggravated_willpower_damage,
            self.superficial_willpower_damage, damage)

        self.update_willpower_state()
コード例 #3
0
 def test_calculate_aggravated_damage_agg_added(self):
     # Already taken a hit, take another
     aggravated, superficial = DamageCalculator.calculate_aggravated_damage(
         max_value=5,
         aggravated_damage=1,
         superficial_damage=0,
         damage_taken=1)
     self.assertEquals(aggravated, 2)
     self.assertEquals(superficial, 0)
コード例 #4
0
 def test_calculate_aggravated_damage_agg_taken(self):
     # some points of damage taken
     aggravated, superficial = DamageCalculator.calculate_aggravated_damage(
         max_value=5,
         aggravated_damage=0,
         superficial_damage=0,
         damage_taken=3)
     self.assertEquals(aggravated, 3)
     self.assertEquals(superficial, 0)
コード例 #5
0
 def test_calculate_aggravated_damage_no_change(self):
     # Base case, no change
     aggravated, superficial = DamageCalculator.calculate_aggravated_damage(
         max_value=5,
         aggravated_damage=0,
         superficial_damage=0,
         damage_taken=0)
     self.assertEquals(aggravated, 0)
     self.assertEquals(superficial, 0)
コード例 #6
0
 def test_calculate_aggravated_damage_with_superficial_overflow(self):
     # When the character has superficial damage already, and the tracker is overfilled with agg, superficial
     # gets converted to agg.
     aggravated, superficial = DamageCalculator.calculate_aggravated_damage(
         max_value=5,
         aggravated_damage=0,
         superficial_damage=5,
         damage_taken=1)
     self.assertEquals(aggravated, 1)
     self.assertEquals(superficial, 4)
コード例 #7
0
    def add_health_aggravated_damage(self, damage):
        """
            Add aggravated damage to the tracker.

            Updates the health state when done.
        """
        self.aggravated_health_damage, self.superficial_health_damage = DamageCalculator.calculate_aggravated_damage(
            self.max_health, self.aggravated_health_damage,
            self.superficial_health_damage, damage)

        self.update_health_state()