This is slightly wrong. For actors with the levitation effect active we have canFly=false and isFlying=true.

Make that:

|| (MWBase::Environment::get().getWorld()->isFlying(actor)))

(isFlying already accounts for canFly, too)