A town will no longer communitcate that it doesn't need defenses, when it currently has a garrisioned hero. Because otherwise the garrisoned hero would just leave and let the town undefended.
Fixed a bug that caused tasks that are generated with an initial priority not being executed.
Fixed an error-message wrongfully claiming a hero was locked by STARTUP, when infact the hero was locked by something else (usually a hero-chain).
Recruiting-heros is now handled alongside buying army and buildings.
Delivering troops to mains is now considered a priority 0 task that should immediately be fulfilled.
Defending nearby towns against nearby enemies is now also considered a priority 0 task.
Priority 0 tasks are now exclusively scored by distance and armyloss has only a cut-off-point instead of lowering the score.
Building-cost now has more impact on their score.
Reworked recruit-behavior to be a bit more conservative and avoid recruiting-sprees. Stuff like buying several heros in a row because the next one is always slightly better than the last but using up the whole starting-bank for that.
All text processing code is now located in lib/texts.
No changes other than code being moved around and adjustment of includes
Moved without changes:
Languages.h -> texts/Languages.h
MetaString.* -> texts/MetaString.*
TextOperations.* -> texts/TextOperations.*
Split into parts:
CGeneralTextHandler.* -> texts/CGeneralTextHandler.*
-> texts/CLegacyConfigParser.*
-> texts/TextLocalizationContainer.*
-> texts/TextIdentifier.h
Added building-cost including all resoruces as evaluation-context for more sophisticated building-selection and also as a countermeasure to softlocking a build-order by having no ways to obtain certain resources.
For example, if the AI would drop below 5 wood, while having no market-place and no wood-income it will avoid building any buildings that neither allow trading nor produce wood.
Added trading-logic to Nullkiller-AI.
The AI can now identify which resources it is lacking the most and buy them to fix softlocks in their build-order. It can also sell excess resources that it doesn't have a need for.
Before marketplaces could only be built as part of a requirement for other buildings but not on their own when that other building already existed like it is the case in certain campaign-missions.
There's 3 new evaluation-contexts that are now taken into account:
Whether an action is building, whether an action involves sailing and the newly introduced threat.
The value-evaluation of creatures now also takes special resources into account.
No longer treating other AIs differently than players when it comes to how afraid we shall be of them.
The cost of buildings for decision-making now determines missing resources. Available resources are ignored when it comes to how they impact the cost. But missing-resources will heftily impact the assumed price by calculating their market-value. This shall encourage the AI to rather build what it currently can build instead of saving up for something that it lacking the special resources for.
AI is no longer willing to sacrifice more than 25% of their army for any attack except when it has no towns left.
Revamped the priority-tiers of AI decision-making.
Higest priority is conquering enemy towns and killing enemy heroes. However, the AI will no longer try to do so when the target is more than one turn away and protected by a nearby enemy-hero that could kill the one tasked with dealing with the target. Except when they have no towns left. Then they get desperate and try everything.
As a general rule of thumb one could say the AI will prioritize conquest over collecting freebies over investing army to get something that isn't a city. It's a bit more complex than that but this is roughly what can be expected. It will also highly value their own heroes safety during all this.
Startup-behavior was messing with my intended logic. Mostly by getting excess heroes for no real purpose other than that it could.
This wasted a lot of money that could be better invested on subsequent turns.
I removed it and playing-strength actually went up.
The magic-strength of a hero now checks if the hero has a spellbook and at least one combat-spell.
The impact of knowledge and spellpower to the hero's magic-strength is now also depending on it's current and max mana-pool-size as an empty mana-pool does not exactly contribute well to fights.
Replaced every call of getFightingStrength() with getHeroStrength() which uses both the fightingStrength and the (reworked) magicStrength to guess how much stronger a hero-lead army is.
Fixed that army loss was taken into account both for the path and the target-object. In certain cases, like a hero defending a town, this could lead to armyloss being twice as high as it should be.