Specifically, the AI CANNOT target the city with curses (or if the curse targets a tile then the tiles around the city) if it's not scouted. For every other purpose, AI scouting is not implemented, so the AI can do anything else. Curses that do not target a city or tile, but target units, use no scouting either, so Fire Storm can still target your garrison.
Nightshade can only counter spells if they target the tile the city is on. So yes, it can counter Raise Volcano, or Fire Storm, but only if they are targeted at the city tile itself.
As for how they ended up there, it's simple - Diagonals are equal cost to horizontal movement so the "shortest" path from the yellow and green continents to each other leads through there.
The units did move though - they are not on the exact same tile in the files. The first file worried me a little because they were around the 0,0 tile but in the other they seem to mostly gather 2 tiles to the east from it so that seems unrelated.
I see a very good chance the AI can't pick a main action continent, and without one, intercontinental stacks can't do anything, except attacking nearby (range of 10) targets and building up into a doomstack.
On this map, most continents belong to at least one of these, which cannot be chosen :
-The AI's own continent(s)
-An allied continent (I'm unsure if that's an actual thing but probably)
-A continent already marked no targets : your own has only strong lairs left, and the green one is cut to 3 separate parts blocked by units or a volcano so there is a high chance the AI already marked it no targets
-The single tile island with the neutral has no ship landing position.
Ask green to declare war on red and they'll start heading towards red territory. This shows they simply had no valid continents to invade.
Short answer, none of the AI's currently have an enemy to attack with those stacks.
Thanks, I wonder whether something could be done for this kind of situation. Splitting up stacks forcedly when they have nothing to do perhaps? Then there would be a chance to form better ones with the heroes, no?
Have you considered extending nightshade to protect city territory as well for curses like volcanoes and corruption?
Is the AI's 'where's the best place to settle?' algorithm easy to modify? I think the AI could do better if it was optimized for its strengths, rather than trying to emulate a human. For example, mithril is really valuable for human players, but the AI seems to prefer summoned units rather than regular, so mithril is less valuable. I see the AI sending settlers quite a long way for a location that seems only slightly better, and harder to assist in defending. They might do better if minimum travel time was given higher priority. Given how COM's buildings tend to have high fixed returns (magic market = 6 mana), cities 4 spaces apart generally provides more resources than fewer cities with higher pop caps. Instead of just changing a multiplier, maybe a more complex formula can be used, with distance^2 or some such thing to make longer distances less desirable.
Maybe restart an old game with these new settings and see if their production is significantly higher at turn whatever.
I also see the AI settling islands with only one city where I'd place two or three less-ideal cities. However, I doubt that the AI can be modded to solve that.
push ax
mov ax, [bp-12h] ; Shore available +40
mov dx, 28h ; '('
imul dx
mov dx, ax
pop ax
add ax, dx
cwd
idiv word ptr [bp-10h]
[20*MaxPop+Production%+Gold%+UnitCost%+4*gold+6*power+5*Nightshades+120 if adamant+80 if mithril+40 if shore]/(8+Distance)
Mithril and Adamantium is valuable for the AI : they prioritize building units in cities that have those significantly higher. Mithril and Adamantium units have a much better chance to conquer lairs and get the AI new spells or resources as well as being more expensive to kill in combat for the human player.
Arranging cities in a way that uses the available area in a way that results in the highest number of cities is much more complex than simply looking at the distance, and isn't not possible for the AI currently or probably ever : it would require looking at all possible arrangement of cities on the map and finding the set with the highest overall value AND would require all AI's to follow this exact same plan. Simply building the closest isn't always guaranteed to give you the highest number of cities.
AIs wasting city spots isn't necessary detrimental to their efficiency either : building more cities takes more time so such optimizing opens up more chances for enemy players to steal the spots from them. Unless the AI already has multiple settlers ready to send which they don't (there is a limit how many they build at the same time), leaving more spots open means a high chance other players will get there first.