I think monsters that are in melee range will choose melee over ranged attacks - making Elbereth a protection against ranged attacks, too.
An example of this effect: Say you are in Sokoban, standing on a permanent Elbereth. Assume the 8 adjacent squares are not protected, and the 16 next-to-neighboring squares each feature an Elbereth and an object on top. You can then safely reverse-genocide dragons (any color). Because they will always be next to you, they will choose melee over ranged attacks, but flee because your are on Elbereth. So they cannot harm you at all. Tjr 15:44, 20 March 2009 (UTC)