I would try to redirect them into studying. You can still have a good time and study. If they just wanted to play, I would wish them a good night and go home and study.
If they were really my friends they would understand how important my grades were to me.
I know that isn't an option on your question but that is what I would do.
I'd say stop the madness!!! Do you guys do realize this test counts for our entire years grade??? If that doesn't get them motivated... Then i would politely excuse myself and wish them all the best!!!