@Kopywrite: by parsing a creature.bif file and checking the .cre files stored there.
@Pe Ell: A weapon can have more than one attack. For example the Flail of Ages has 4 attacks: physical, fire, acid and cold. Each time you strike with the weapon, the attacks are considered separately. For example, hitting a Greater Mummy with the flail will result in "weapon ineffective" (physical attack - Greater Mummy needs +4 weapon), "hit by 1 HP" (the fire attack) and two "weapon ineffective" (the mummy is immune to acid and cold). Similarly, the use of the Mace of Disruption +2 will result in "weapon ineffective" but the death attack may pass.