When someone attacks you, you are reacting to something that is already happening. So of course, without any experience one might revert to panicked pointing and shooting. But with experience and training, you can become fast, accurate, and mindful of the elements like [ firepower, terrain, time, strengths, weaknesses, and leverage ] which MAY help you overcome a time and/or luck deficit. Panic doesn't have to be a forgone conclusion.
USPSA, and even more so, IDPA competition can help you prepare for some of these aspects. Quick and panicked is that guy I was talking about, no formal experience, at best just shooting garbage out in the desert, at worst just bought a gun and tried it once at an indoor range. Practical shooting isn't about pinpoint accuracy, it is about balancing speed, accuracy, and power to achieve the most damage in the least amount of time. And going to local matches on a regular basis provides the repetition necessary for a conditioned-response-style drilled training (read On Killing, Col. Grossman).
Watch some videos of people like Jerry Miculek.