Disable critical hits during tests
This commit is contained in:
		@@ -444,7 +444,7 @@ class FightingEntity(Entity):
 | 
			
		||||
        """
 | 
			
		||||
        Deals damage to the opponent, based on the stats
 | 
			
		||||
        """
 | 
			
		||||
        diceroll = randint(0, 100)
 | 
			
		||||
        diceroll = randint(1, 100)
 | 
			
		||||
        damage = self.strength
 | 
			
		||||
        string = " "
 | 
			
		||||
        if diceroll <= self.critical:  # It is a critical hit
 | 
			
		||||
 
 | 
			
		||||
@@ -77,6 +77,7 @@ class TestEntities(unittest.TestCase):
 | 
			
		||||
{self.player.name.capitalize()} takes {entity.strength} damage.")
 | 
			
		||||
 | 
			
		||||
        # Fight the rabbit
 | 
			
		||||
        self.player.critical = 0
 | 
			
		||||
        old_health = entity.health
 | 
			
		||||
        self.player.move_down()
 | 
			
		||||
        self.assertEqual(entity.health, old_health - self.player.strength)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user