sandstorm modifies the defender's defense before anything happens. pretty much this is applied directly.
pure/huge modifies whatever attacking stat is allowed by the ability's description, to the attack stat.
stat modifiers like attack/defense go before anything.
wonder room: makes all special moves do physical damage, and vice versa. "It replaces the identifier of the base special defense stat with the one for defense." Bad wording on this one to not include the opposite case.
to maintain linking compatibility with BW, nothing of the damage formula has changed.