When trying to defend from invaders the aof spells turn red and cannot be cast from the top of towers, BUT the invaders elemental and archers can cast spells and hit the defenders on the towers and walls.
Also, the spells are blocked from the top of the tower but not from the bottom to the top.
As an experiment a friend of mine tried to hit me from his ground position and he scored, but while i was being it i casted spells and it said “obstacle” or something like that.