Removed the usage of BonusModifiers because depending on the case the function was sometimes called with and sometimes without an actual hero as first parameter.
This lead to inconsistencies between planned and performed army-merge and got the AI stuck in a loop where it ordered an army-merge over and over that then would not conclude.
The inclusion of bonuses of the hero for determining which army is better on them is unnecessarily convoluted and just causes issues. It took me like 4 hours to figure out why the AI didn't act.
Even if the hero blocking a town is from the own faction, the town must not become a target if the city has stashed armies because in that case the hero ontop of it won't be able to go into garrison for the TP.
AI is more careful when gathering stuff near enemies.
The wasted movement-points are no longer considered when calculating which own city to fall back to when there's nothing better to do.
Fix an issue that caused AI to take their hero's attributes into consideration twice when calculating how much army they think they'll lose.
Fixed an issue where offensive defending didn't take into consideration whether the hero would actually be strong enough to beat the enemy hero it was trying to dispatch.
A recent fix made it so that towns that weren't supposed to be defended are now no longer defended.
This caused scouts with minimal army to also go after them in addition to the main-hero.
Problem is when two heroes go for the same town it's a massive waste of movement-points. So for the time being only main-heroes will go for faraway captures.
Better solution would be to memorize who was sent to attack what on the same turn and filter out tasks going for the same target.
When attacking non-neutral towns that are far away, the AI now considers whether their attack would arrive in the same week. If it wouldn't, it means there's a high risk that newly bought troops might flip around who is stronger. So they now refrain from sending a hero towards an enemy town that is too far away.
The AI should no longer chase enemy heroes that are not reachable in the same turn, when there's other options as this behavior was quite exploitable.
The AI should now take their overall strength into account when deciding whether to attack or not.
Previously it would attack as long as their assumed army-loss was at most 25%.
Now that is 50% times the ratio of their power compared to the total power of everyone.
Currently this may lead to a case where player have received a query
(such as levelup query from Battle Academy in Dungeon), but still
attempts to move
The node of a disembark-action can no longer be part of a hero-chain since sea-to-land-trade isn't possible and landing first eats up all movement-points.
Manarecoveryreward now uses float instead of unsigned int in order to avoid extremely high instead of negative scores when the hero has more mana than his mana-limit for example due to mana-vortex.
Moved upgrading armies to a lower priority tier as otherwise the AI would go back to their cities all the time even though there were plenty of other things to do.
Improved exploration logic by putting different kinds of exploration to different priority-tiers.
Looking at the other side of a portal has high priority, visiting an observatory has medium priority and scouting by visiting nearby tiles has low priority.
Modified how to score what hero to hire to make it more likely to rehire fled heroes with high levels when the army-gain from the hero would be rather insignificant.
Fixed crash caused by mistakenly assuming that "pos" is the position of a hero on the map and not its bottom-right-corner that can be outside of the map.
The StayAtTown-behavior now always creates tasks for all heroes to go and stay at a town. It will be treated differently than going to a town for mana in the sense that it is only considered at the lowest priority-tier. So it will only happen when the AI doesn't find anything else to do. It should resolve one of the two main-reasons for losing weak heros.
The hunter-gather-priority-tier now goes strictly by distance for all taks that are considered above 0 in value.
Modified goldPressure-formula to no longer use completely arbitrary part of lockedresources/5000.
Lockedresources is now just divided by a factor of the free gold like everything else.
No longer using FuzzyEngine just to create a log-message. It's now only used when isUseFuzzy is set.
Also:
Removed < operator and instead use already existing "canAfford"-Method.