edit: ninja'd

but ye thanks for the confirmation.
After some testing I think the speculation that I mentioned might be true.
After 10 tests the results were that every single one of them the ID ordering I assumed was true.
The tests were: Nation 1 with Awake Cyclops with earth 9.buys some commanders but that is all.
Nation 2 summons several debug sensei(unit with 9 in all magic paths)(I use debug mod for most of my tests)
Couple of turns later (and wishing for gems)
Nation 1 summons 1 last debug sensei
Then the casting begins: Nation 1 orders Cyclops and debug sensei to cast: riches from beneath. Same turn Nation 2 uses 1 debug sensei to cast riches from beneath but with some extra gems to ensure override.
Result: Nation 1 is always casts riches 1st either with Cyclops(presumably one of the first ID numbers) or with debug sensei (presumably one of the last ID numbers)
Then nation 2 casts riches with its own debug sensei(presumably some middle ID number)
It overrides the current riches.
Then nation 1 casts riches again with the commander or the cyclops depending on who cast the spell at the first time.
This means that you can almost ensure casitng of a global/forging as long as you have awake pretender with the required magic and a you can buy/summon mage with the magic.