Currently, when casting Spell Ward, the AI does the following :
1. Find the next owned city not yet checked
2. If city has lower value than the already selected target, go to 1.
3. If the city is not warded against the Human Player's Primary realm, select as target city with that realm as the chosen type and go to 1.
4. If the city is not warded against the Human Player's Secondary realm, select as target city with that realm as the chosen type and go to 1.
5. If the city is already warded from both realms, there is a 96% chance to go to 1
6. Select the city as the the target and the realm is random
This is wrong on so many levels I don't know where to begin.
First, it will always look at the human player. The AI won't bother to protect itself from other AI, not even if they are at war! I believe protecting from the human player in all cases is fine, since they can, and usually will attack without a warning, so casting the wards afterwards is too late. However, the AI should, at least cast wards against players at war with him, or players that aren't at war but might - either low relation or lack of wizard's pact can be the condition here.
Second, it looks at "primary realm" and "secondary realm". If the player has books of 3 or more realms, those are pretty much ignored, furthermore, if they had only one (or zero) realm and found books, those will be ignored as well. (It's unlikely but entirely possible to find even 5-6 books of a realm in a game, possibly outweighting the starting realms)
Third, the random part. For starters there is a 40% chance to select a realm already warded against, resulting in the spell doing nothing. Then there is the problem of casting wards against realms possibly no one is playing...
And Fourth, it does not consider the wizard's own realms. While that was fine with the original effects, it definitely is not now, but I don't know how exactly the condition should be set up. Countering own combat spells is bad enough, but it might be helpful if the enemy uses their spells better, or simply has better spells to use. However the risk of casting the Ward on a city possibly being defended by units of that realm, which would then suffer a major penalty in combat - especially this being the most likely on the capital - sounds far too much. Checking the already existing creatures in the city should be doable, but they might get replaced by stronger creatures of another realm AFTER the ward was added to the city. So either the AI needs to simultaneously learn to kick out creatures of the wrong realm from their cities, or not cast wards of realms they have - at the very least not if their most expensive summoning spell (which is the unit that stays in the city) is of that realm. Again this poses the problem, what if the AI learns that summoning spell after casting the ward. The easiest would be to just say "no ward if books>=3" but then we'll never ever see a Sorcery Ward cast.
Fortunately there is plenty of space to code almost anything possible, the hard part is, how exactly should the AI judge which realm is safe to ward against without committing suicide? How paranoid should the AI be, which players should it consider as threats?
1. Find the next owned city not yet checked
2. If city has lower value than the already selected target, go to 1.
3. If the city is not warded against the Human Player's Primary realm, select as target city with that realm as the chosen type and go to 1.
4. If the city is not warded against the Human Player's Secondary realm, select as target city with that realm as the chosen type and go to 1.
5. If the city is already warded from both realms, there is a 96% chance to go to 1
6. Select the city as the the target and the realm is random
This is wrong on so many levels I don't know where to begin.
First, it will always look at the human player. The AI won't bother to protect itself from other AI, not even if they are at war! I believe protecting from the human player in all cases is fine, since they can, and usually will attack without a warning, so casting the wards afterwards is too late. However, the AI should, at least cast wards against players at war with him, or players that aren't at war but might - either low relation or lack of wizard's pact can be the condition here.
Second, it looks at "primary realm" and "secondary realm". If the player has books of 3 or more realms, those are pretty much ignored, furthermore, if they had only one (or zero) realm and found books, those will be ignored as well. (It's unlikely but entirely possible to find even 5-6 books of a realm in a game, possibly outweighting the starting realms)
Third, the random part. For starters there is a 40% chance to select a realm already warded against, resulting in the spell doing nothing. Then there is the problem of casting wards against realms possibly no one is playing...
And Fourth, it does not consider the wizard's own realms. While that was fine with the original effects, it definitely is not now, but I don't know how exactly the condition should be set up. Countering own combat spells is bad enough, but it might be helpful if the enemy uses their spells better, or simply has better spells to use. However the risk of casting the Ward on a city possibly being defended by units of that realm, which would then suffer a major penalty in combat - especially this being the most likely on the capital - sounds far too much. Checking the already existing creatures in the city should be doable, but they might get replaced by stronger creatures of another realm AFTER the ward was added to the city. So either the AI needs to simultaneously learn to kick out creatures of the wrong realm from their cities, or not cast wards of realms they have - at the very least not if their most expensive summoning spell (which is the unit that stays in the city) is of that realm. Again this poses the problem, what if the AI learns that summoning spell after casting the ward. The easiest would be to just say "no ward if books>=3" but then we'll never ever see a Sorcery Ward cast.
Fortunately there is plenty of space to code almost anything possible, the hard part is, how exactly should the AI judge which realm is safe to ward against without committing suicide? How paranoid should the AI be, which players should it consider as threats?