Welcome to Smogon! Take a moment to read the Introduction to Smogon for a run-down on everything Smogon, and make sure you take some time to read the global rules.
Looks like it was designed for an old version of the server code - it seems to be using SugarJS functions and the old type system. On ROM I use onAfterMega to reset the types after a mega evo. (TI added it for Type Reflectors.)