[SUPPORT] Advanced Turn Based Tile Toolkit

Not sure if someone asked it already but what is the best way to block unit’s attack range if there’s another unit between the current unit and current unit’s target?
I need for units to be able to block attack range of each other but I’ve encountered 2 problems here.
The first problem is when AI picks as a valid target the unit it shouldn’t be able to attack in a case another unit stands between the current AI unit and its target.
The second problem is that AI picks the tile it it shouldn’t be able to attack the target from (in a case another unit stands between the current AI unit and its target) as a valid tile from which it can attack its target.
Tried to add range trace blocking to the pawns (deactivated on current unit activation to prevent self-blocking of traces) but that does not help much because:

  1. If the trace is blocked by a friendly unit the current AI unit does not pick enemy unit as a target even if it is able to reach it by taking a detour.
  2. I cannot see red attack tiles under enemy pawns if I want to use the skill of my own unit on them.

I was able to make a workaround for AI picking valid targets by pathfinding check. But I still do not know how to find correct tiles with actual sight to target (not blocked by another pawn).

upd: it is pretty **** hard to figure with current setup. Range trace check for the tile with sight to target starts from target pawn (which is not current pawn) so I have to block-deblock range trace for all potential targets during the check for all tiles with sight to target.