Ejemplo n.º 1
0
 def test_if_attack_chance_more_than_05(self):
     s1 = Soldier()
     s2 = Soldier()
     exp = s1.xp
     s1.attack_chance = Mock(return_value=0.6)
     s1.damage = Mock(return_value=8.5)
     s1.attack(s2)
     self.assertEqual(s2.hp, 91.5)
     self.assertEqual(s1.xp, exp + 1)
     self.assertFalse(s1.is_active)
Ejemplo n.º 2
0
 def test_attack_cooldown_is_1_soldier_not_active(self):
     s1 = Soldier()
     s2 = Soldier()
     s1.attack(s2)
     self.assertFalse(s1.is_active)
Ejemplo n.º 3
0
 def test_if_attack_chance_less_than_05(self, mock):
     mock.return_value = 0.1
     s = Soldier()
     s2 = Soldier()
     s.attack(s2)
     self.assertEqual(s2.hp, 100)
Ejemplo n.º 4
0
 def test_attack_xp_raise(self):
     s1 = Soldier()
     s2 = Soldier()
     s1.attack(s2)
     self.assertEqual(s1.xp, 1)