If you consider it 'lucky',I have had it happen MANY times as an LEO and as a citizen after retiring and as off duty LEO too.
I got to train at the academy [ as a teacher ] and had to show and explain THE answers to rookies as well as duty officers.
The answer I came up with is called IAD [ immediate action drill ] which is simply DO SOMETING DIFFERENTLY than you have already done.
If your in the open = GET TO REAL COVER,yes even if you have to retreat.
Cover stops bullets and that perp might be armed even if you have not seen a weapon.
Expect to hear "Go ahead and shoot" and or Shove that gun ----------- ".
You might be tempted to put 'hands on' at that point,especially IF you have some training.
IF your tempted to do so,try to remember the funny movie scene where the bad guy [ or good guy ] says "put down your gun and we will duke it out like men".
Then when one puts his gun down = the other shoots LOTS of holes in the dumb ass that actually did lay down his gun.
Do not keep saying "drop your gun" since its simple to see that if they are not about to do so,saying is putting in a BAD place by being too busy TALKING.
Either be shooting,moving,or loading = or all of them if your good at it.
Clint Smith has a few of these as his rules for a gun fight,made a great deal of sense to me and I had been following his 'rules' a long time ago.
Have a PLAN,then at least 2 more plans as the first 1 or even the first 2 might go to hell in a handbasket.
Hope you train till you fail,then try harder and then you will learn.
Doing the same thing over and over is mental ilness.Especially if you have an expectation of a different outcome.
train to fail,then learn and do it better.
Bless y'all.