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.
Earthquake > Rock Slide > Earthquake
IF [Magmortar uses a damaging Fighting-type combination] AND [You do not have a Substitute up THEN [Use Substitute (15) that action].
[ONCE] IF [Magmortar uses Barrier] THEN [Use Dragon Rage that action].