Check it out, I can fix the weapon grouping AI but with only
FOUR weapon groups. They aren't real weapon groups but are rather AI directives to utilize the weapons in the way you expect them to be used.
Primary weapons
are the guns that the ship is expected to use in most engagements. They define the ideal "combat range" of the craft and the AI will attempt to utilize all its primary weapons, against a main target, as part of its main attack. Short range primary weapons will force the ship into melee. This is kind of like the "weapon group" system that you have now, with all the primary guns slaved to a single goal.
Secondary weapons
are situational weapons that excel in some situations but suffer in others. The default weapon AI is to hold fire until it "seems good" to use them. The conditions are fairly broad and generous, for example kinetic weapons fire "against shields" and anti armor weapons fire "when it's cheap or when enemy shields are stressed". Secondary weapons include things like limited missile racks, inefficient guns, aggressive PD, or extreme range artillery that might fare poorly up close. For a ship with limited frontal focus, secondary weapons would attempt to hit the "best targets" around them. For something like a Conquest using a kinetic broadside/anti armor broadside, both sides might be considered secondary and it'll attempt to attack with the best side. The downside of using too many secondary weapons is the ship won't focus fire and "alpha strike" all its weapons, when primary weapons would.
Tertiary weapons
are guns that get used in extremely rare conditions. It is fitting for 1-shots like reapers or antimatter blasters. They only shoot at a main target when a full aggression routine asks for it, such as against an overloaded ship, or for a jousting Phase ship. Generally the purpose of a tertiary weapon is to score a killing blow and is otherwise not useful in a direct slugging match. A ship with only tertiary weapons will not force itself to stay in combat range and only looks for lopsided opportunities to attack.
Defense weapons
are almost exhaustively not used to engage larger ships. This grouping is basically for PD and they only like to target missiles/fighters. Against larger targets they will only be used opportunistically. They will not attempt to stress their own ship's flux to deal damage, except on the most aggressive settings.