OK, from one more proc so far, looks like Goetia +2 set bonus is before TMDA !
Code:
Me: BLM99/rdm49 -- cINT = 160 (101+59), MAB trait = +40, MAB gear = +26 (no Ice Potency merits)
Target: Ornamental Weapon -- tINT = 68, MDT = -32/256, EXP = 45, Level = 74 (These are at Ve'lugannon's palace, lv74-76 -- As level 99: lv74 exp=45 tINT=68, lv75 exp=48 tINT=69, lv76 exp=50 tINT=70)
Spell: Blizzard IV -- V = 506, M = 2, MP cost = 164
Day: Firesday
Weather: No weather.
BLM AF3+2 gear: 5/5 pieces + Neck + Back
MP before cast = 730
MP after cast = 597
MP used = 133 --> 13/16 (133/164)
MP conserved = 31 --> 3/16 (1 - 13/16)
Goetia +2 set bonus = 1.375 (1 + 3/16*2)
TMDA = 0.875 or 224/256 (1 - 32/256)
MAB = 1.66 (1 + 0.40 + 0.26)
Day & Weather = 0.9
dINT = 92 (cINT160 - tINT68)
D = 690 (92 * 2 + 506)
If: D > Day > MAB > TMDA > Goetia
Then: 690 * 0.9 * 1.66 * 0.875 * 1.375 = 1238
If: D > Day > MAB > Goetia > TMDA
Then: 690 * 0.9 * 1.66 * 1.375 * 0.875 = 1239
My cast did 1239 damage.
I want to make sure a bit first though...
The proc was with full 5 piece set (the m.crit hands proc'd more often than I liked)...
I decided to keep using the same spell, Blizzard IV, even though it was Firesday, for which I received the -10% penalty on the cast...
Edit:
OK, I managed to get another proc on Earthsday with no weather.
This one is simpler:
Blizzard IV again.
The only gear change I made was adding an extra INT by putting a Buggard Strap +1 in an empty slot.
I did this because this mob was lv75 (48 exp) with 69 INT, whereas that previous mob was lv74 (45 exp) with 68 INT.
So the dINT is the same, dINT=92.
There's no possible day/weather penalty this time.
The MP change was from 1328 MP to 1205 MP, so Conserve MP proc = 12/16.
Goetia +2 set bonus = 1.5 (1+4/16*2)
1501 dmg = D > MAB > TMDA > Goetia
1502 dmg = D > MAB > Goetia > TMDA
My cast did 1502 damage.
So the order of operations for calculating magic damage, as I understand it, is:
Code:
D > Cumulative magic bonus (Comet & -ja) > MTDR > Staff Bonus > Affinity > SDT - Resist > MB Bonus > MB Bonus Gear > Klimaform Bonus > Day + Weather + Twilight Cape > MAB(+ M.Crit) / MDB > Goetia +2 Set Bonus > TMDA > Ebullience > Hpemde double damage taken > Phalanx > (Stoneskin remaining HP) > DMG
The terms in red (MB Bonus Gear, Phalanx and Stoneskin) may not be in 100% the correct place, as I haven't done any proper tests on them against some of their nearby terms.
I just wanted to include them to give an idea of roughly where I think they go.
Phalanx > Stoneskin is correct, in that Phalanx is calculated somewhere before Stoneskin.
I'm not really too sure about MB Bonus Gear at all though, as I've barely touched the stuff.
The rest of the terms I have tested against the terms directly before and after, so in my opinion they are pretty much set in stone.