This script prevents your heroes or your enemies from choosing a target that is still afflicted by a Blocked Target alias Untargetable State.
Set the value of the TARGET_STATE Constant found in the KBlockStates module to your list of Untargetable State IDs.
Other Notes
This scriptlet seems to work with the default battle system so feel free to try it in your game project.
I have not tested it while using any other battle system.
The only reason why I came up with this idea was because Hime's script had a weird bug that has remained untouched ever since 2015...