What I'd recommend doing for the XD Mod is using PHP to do the work for you. If you have a database with all the moves already you can do everything much faster.
To follow up on your thread: an emulator is not a 'simulator' - it is an exact copy of the game system. ROMs are direct dumps of the game cartridges themselves. There is nothing being simulated, it is being emulated. Anyway, we appreciate your input. Thanks!
Ah, well good luck. I hope you get it sorted. Feel free to post in the Mods forum for any problems. Let me know if you have trouble getting replies after 24/48 hours and I'll try to prod people to answer.
I'm not sure the answer to your question about Sandstorm but I wanted to point out that Hail+Sandstorm damages every type. I don't know if that helps though.