AI to AI diplomacy is fundamentally different from how the AI interacts with the human player. In general, when two AI players interact, only one will make the decisions, for example if they want a Wizard's Pact, the other wizard's opinion on the matter is ignored, and the pact is formed immediately. The other wizard might break it afterwards, but they can't prevent the forming of it.
At end of every turn, the following process is executed :
- First of all, check if the wizard has been banished. If yes, end the process immediately.
- Check if there is an AI ally who is at war with another AI wizard. If yes, declare War on that other wizard immediately. In the 1.50 unofficial patch, this feature is removed, instead the AI will consider helping allies when checking for the Need for War. The primary difference is the latter respects the Peace Counter, and isn't necessarily immediate : The chance of War is less than 100%. The secondary difference is, the latter can be used to help the human player if they are an ally, or declare War on them if they are an ally's enemy.
Afterwards, towards each other AI wizard in the game, do the following :
- Calculate 15-(2*Difficulty Level). If a random number between 1 and that amount is 1, continue with 2. Otherwise end the procedure. Note that ending the procedure here is poor design, because it means the AI will not check for the Need for War even though that procedure was designed to be used every turn. Instead, it'll only be called once every ~10 turns, significantly reducing the chances of AI players Breaking Treaty or Declaring War on each other. Due to bugs that cause them to Declare War on uninvolved players for no reason at all, this bug isn't noticeable. In the 1.50 unofficial patch, do no end the procedure, but skip to the check for the Need for War instead.
- If there is no Diplomatic Contact between the two wizards, end the procedure.
- Calculate X = Hidden Relation + Visible Relation + Personality Modifier + random(1-100) + random(4-9)* Difficulty Level + Treaty Interest + 10*Wizard's Pact + 20*Alliance, for the first wizard towards the second wizard. In the 1.50 unofficial patch, instead calculate X = Hidden Relation + Visible Relation + Personality Modifier + random(1-50) + random(3-9)* Difficulty Level + Treaty Interest /4 + 10*Wizard's Pact + 20*Alliance instead.
- In 1.50 only, jump to step 11. if there is a War between the two wizards.
- (1.40 and earlier) If X>150 and there is no Alliance present, form an Alliance.
- (1.40 and earlier) If X>150 and there is an Alliance present, form a Wizard's Pact, replacing the Alliance.
- (1.40 and earlier) If Trade Interest+80 < X - Treaty Interest , and there is a pair of spells available for trade, trade those spells. Note that the higher Trade Interest is, the less likely it is for this formula to result in a trade.
- In 1.50, If X>170 and there is no Alliance present, form an Alliance.
- In 1.50, if X>112 and there is no Alliance nor Wizard's Pact present, form a Wizard's Pact.
- In 1.50, if X+Trade Interest >=150, and there is a pair of spells available for trade, trade those spells. However, this contains a bug in all versions of the game - including the 1.50 patch -, the wizards receiving the spells are those who offered it for trade, so nothing actually happens!
- At a 5% chance, execute a +5 strength Diplomatic Reaction.
- If there is a War, and Peace Interest + a totally unrelated variable containing -1 to 3 >100, form a Peace Treaty. This is most certainly a buggy formula, as it uses a variable used to select text lines during Player to AI Diplomacy. In the unofficial 1.50 patch, this is fixed to check X+ Peace Interest >0 instead. However, it will use the other wizard's Peace Interest variable, not the proposing party's, to simulate the mutual agreement needed to sign the treaty.
- Reduce Treaty Interest, Peace Interest and Trade Interest by 30. In the unofficial patch, Peace Interest is not reduced.
- Check the Need for War.
- Check if there are any units standing in a location violating the Wizard's Pact or Alliance the same way as in AI to Player Diplomacy. This check is removed in the 1.50 unofficial patch because the AI is unable to keep their troops away from cities to avoid penalties.