Might have been asked before, but does Illusion work against AIs?

I caught Delta Liepard with Eevee on my team with Eevite and wanted to try tricking Leader Diana into using a useless move and getting blown up. I put Liepard in my 2nd slot and sent it out when she sent out Gengar, appearing as Eevee. My logic was this: her Gengar’s most effective move against an Eevee wouldn’t harm Liepard, and her Gengar’s most effective move against Liepard wouldn’t hard Eevee, so she’d have no reason to use it. Lo and behold, 4 tests in and she shadow-balled illusion Liepard every time, KOing it.