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)
def test_attack_cooldown_is_1_soldier_not_active(self): s1 = Soldier() s2 = Soldier() s1.attack(s2) self.assertFalse(s1.is_active)
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)
def test_attack_xp_raise(self): s1 = Soldier() s2 = Soldier() s1.attack(s2) self.assertEqual(s1.xp, 1)