The issue may be that the shadow "checks" the light condition so it sometimes may work when you are in darkness but your attack isn't.