Play after any viper is attacked to reroll the die. If the viper is piloted, subtract 2 from the new roll.
The wording seems to allow it. Thematically, it makes sense, I recall Starbuck getting P.O.d about the flak pattern suddenly appearing around them, and she jinks let hell to ensure she's safe.
The issue is that Main Batteries "affects" a sector rather than explicitly targeting a ship or ships - does being damaged count as being attacked?
I recall a semi-recent thread about using a CFB nuke against a sector containing a Basestar with Structural Damage where it was agreed that the nuke roll didn't get +2 since it was the sector not the Basestar getting nuked
Main Batteries targets a space sector, if the roll is 2-3 it damages one viper in that sector. You can no more use an EM on that viper being damaged than you could one a crisis that damages vipers in space.