I'm doing what this thread is doing except that it's not very satisfactory. What this does is finding the "closest" attacking position. But typically you want the attacker to attack from as furthest as possible to utilize his long range weapon.
To solve this I'm trying to modify the cost calculation of A*. When considering a tile that is close enough to the target (aka within weapon range), if the line of fire is blocked, then multiply the cost by a factor like 2.114514...
However this is very intuitive that it simply makes the attacker try to avoid to walk a path containing tiles where line of fire is blocked. There is no strict mathematical or logical proof whether this finds the furthest attacking position.