Although chain lightning looks like an "instant" cast (since lightning is an instantenous effect), if I recall correctly it actually uses a "fast" projectile, which means you'll need a damage detection engine to register when units get hit by the ability, and then check if they have a buff (does chain lightning even apply a buff?)
Since you're using GUI I recommend Bribe's Damage Detection system