The score for going to a tile inside the blast-radius of a grenade in order to attack is halved. That means if they have an option to attack from outside the blast-radius they'll go into the blast radius only if they think their damage will be twice as high or better if they do so.
This may or may not be foolish based on the exact situation. My thought-process was that on average it's best to try and maximize damage done to the player on the AI's turn instead of giving the initiative back to the player. So even if the melee-unit sacrifices itself in that maneuver, if they can kill or severely damage the player-unit, it is considered worth it.
But that's the problem, they deal no damage. They don't even try to attack the rear where they actually might do damage, even if they have plenty of TU:s. Hm, do they also consider tanks as cover too?
Please be a little more concrete about the details of the scenarios you describe. Who is "they"? A unit with or without melee-capabilities?
Well, I'm vague since it applies to so many units I'm not sure what to type. This is XCF so I guess most units have some sort of melee. This is so common I'm surprised it hasn't happened to you. Do you have a game that you play along with as you make the AI?
Does the tough unit have that close-quarter-combat-ability that is used in some mods that can make shots fired in melee-range of them miss or not?
No, tanks does not. I have not seen them do this to units that has melee.
What do you mean with "hybrids"? I need very exact information, ideally save-games so that feedback like that can properly be taken into consideration.
Hybrids, the race. The weakest aliens in XCF. I'm not sure how I can make a save since I don't know when this will happen.
But here's a save where it did happen the previous turn. This time it's cults and not hybrids, but the behavior is the same.
Notice the group around one of the tanks. The white dude has both melee and ranged, but he just walked up to the front and shot. The orange one is just ranged and he did the same. The black one is mostly melee and he just went up to the tank and took a few swings and threw some knifes. All from the front. They had plenty of TU:s to walk around before attacking.
It's XCF with Air Raids/Damage Facilities.