Mud Shot inflicts damage and then lowers the target's Speed stat by one stage.
Accuracy 95%
A few explanations:
i. Mud Shot might have the same effect as Sand-Attack. While Sand-Attack is a ground move, it still hits Pokemon with flying & levitate.
ii. did it say that Gilgar avoided the attack, or did it say that the attack had no effect? Mud Shot has an accuracy of 95%.
iii. if your Gilgar used Roost before Quagsire used Mud Shot, it will be affected by ground moves (since Roost causes the loss of the flying type for one round). After that turn, Gilgar regains its flying type, and Mud Shot is now x0.
Mud Shot