Does anyone know what the formula is for the chances of a ranged weapon getting knocked aside in melee? Sometimes when you come around a corner and find an enemy, you can shoot them successfully, and the second shot will go wide. I've also seen shotguns successfully take out all of the gals surrounding an enemy (which should probably be either the highest stat gal or multiple attempts to wrestle the gun away?).
From what I found out, chance for attack to go off correctly (for melee it is chance to hit ) with hostiles next to you seems to be calculated like this:
Weapon.Sucess_chance = Weapon.Modified_Hit_Chance * Weapon.CQC - Armor.Dodge_Bonus * Flanking_Modifier
Weapon.Modified_Hit_Chance is hit percentil of a weapon, already modified by applicable skills.
Weapon.CQC is modifier for accuracy with enemies next to you. It can be found in Anal for weapon in question. Melee weapons do not use it, so in their case substitute 1 (100%).
Armor.Dodge_Bonus is either a formula depending on defender's reactions and melee, or a flat value. It depends on armor worn. It can be found in Anal for any armor.
Flanking_Modifier depends on how defender is turned (and their armor). Attacks from behind usually have Flanking_Modifier 0.5 (50%), attack from the side 0.75 (75%). Some armors have better flanking modifiers.
Also, every sucessful CQC defence costs 8 Energy. Unsucessful costs nothing (other than potentialy your life).
I do not know whether CQC is calculated separately for every defender, if best defender is taken, or if random defender is taken. I assume that in case of melee attacks the defender is always the attacked one.