1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00
Commit Graph

2048 Commits

Author SHA1 Message Date
Xilmi
eab6de4686 Fixed an issue that could cause the AI to skip almost their entire turn
If the best Task is to recruit a hero this now triggers pathfinding again as the newly bought hero may impair other heroe's paths.
2024-12-10 19:21:23 +01:00
Xilmi
f56681d521 Removed weird logic that prevented AI from casting spells.
What was the rationale? AI loses fights with full Mana that it could easily have won otherwise. I just removed that weird logic and now it uses it's mana and wins.
2024-12-08 21:43:17 +01:00
Xilmi
df069bf14f Merge remote-tracking branch 'upstream/develop' into develop 2024-12-07 13:32:19 +01:00
Xilmi
df21a77857 Battle-AI-improvements
When defending the AI is now much smarter to use their defensive-structures like walls, towers and the moat to their advantage instead of allowing them to be lured out and killed in the open.

A penalty-multiplier is now applied when deciding which units to walk towards. If an ally is closer than us to the enemy unit in question, we reduce our score for walking towards that unit too. This shall help against baiting a whole flock of AI-stacks to overcommit on chasing an inferior stack of the enemy.
2024-12-05 21:09:24 +01:00
Ivan Savenko
8c293ce156 First attempt to make per-difficulty configurations for AI 2024-12-05 15:08:04 +00:00
Xilmi
7da5c08f74 Update ObjectClusterizer.cpp
Actually fix the warning now.
2024-12-04 15:07:13 +01:00
Xilmi
66bc6c0d52 Update ObjectClusterizer.cpp
Fixed warning that prevents compilation on GitHub.
2024-12-04 14:57:46 +01:00
Xilmi
c007bbbcd8 AI improvements
AI will no longer skip turns with heroes that are waiting for a delivery that takes more than one turn. Instead they will do something until their delivery is close enough to get it at the same turn.

Fixed an issue where a bunch of heroes all tried to do the same tasks:
Tasks that involve no fighting will now always be performed by the closest eligible hero while all other heroes look for something else to do.
2024-12-03 23:09:13 +01:00
Xilmi
34b8123fba Hero hiring adjustments
The AI is now a lot more likely to buy a hero early on when that hero's army is worth more than half the cost of the hero, regardless of other circumstances.
2024-12-02 15:11:39 +01:00
Xilmi
2df9861076 Update DefenceBehavior.cpp
Stop iterating over tasks when the curent hero has been found in one.
2024-12-01 23:05:56 +01:00
Xilmi
1d79946825 Fix for AI not defending in some cases
Instead of skipping the defense of other towns entirely when hiring a hero was considered as a way of defending, now only hiring the same hero twice will be avoided.
2024-12-01 23:00:35 +01:00
Ivan Savenko
01dd1858e4 Add option to recalculate hitmap on tile reveal 2024-12-01 21:50:28 +00:00
Ivan Savenko
d9f82c22f4 Recalculate tile owners on hitmap update 2024-12-01 21:30:44 +00:00
Ivan Savenko
7574842e93 Replace defines with constexpr 2024-11-28 15:08:15 +00:00
Ivan Savenko
40aa49acff Fix typo: Absoolute -> Absolute 2024-11-28 14:44:12 +00:00
Ivan Savenko
90536a5fbe Remove hardcoded morale chance constant 2024-11-28 12:11:32 +00:00
Ivan Savenko
be2327d000 Removed no longer used or redundant constants 2024-11-28 12:11:13 +00:00
Ivan Savenko
b25702f15e expose safeAttackRatio to AI config 2024-11-28 11:53:51 +00:00
Ivan Savenko
00492a60a7 Moved retreat decision-making constants to config 2024-11-28 11:39:36 +00:00
Ivan Savenko
71d9664295 Allow per-difficulty parameters for NKAI 2024-11-27 21:26:06 +00:00
Ivan Savenko
5332ad59a4 Remove copy-pasted code 2024-11-26 19:13:10 +00:00
Ivan Savenko
18f5d5bc70 Move pathfinder bucket parameters to nkai-settings 2024-11-26 18:58:34 +00:00
Xilmi
84571f1ae8 Update PriorityEvaluator.cpp
Just killing stuff even if there is no apparent reason now also is considered for the mere purpose of gaining XP.
This also helps the non-cheating AI to keep attacking enemies when they can't see anything worth exploring behind them.
2024-11-26 15:39:35 +01:00
Xilmi
cd65e69c91 Update GatherArmyBehavior.cpp
Fixed an issue that made AI consider unpurchased troops as reinforcements for their armies which caused AI to visit cities over and over without actually doing anything there.
Buying units is handled by BuyArmyBehavior.
2024-11-26 15:15:08 +01:00
Xilmi
65f2d0c44e Merge remote-tracking branch 'upstream/develop' into develop 2024-11-21 23:14:03 +01:00
Ivan Savenko
56ee307b3a Extend AI garrison troop removal logic to all RoE campaigns to emulate
H3 logic
2024-11-17 17:38:54 +00:00
Xilmi
2786797a4e Fixed incompatibility with latest merge
Incompatibility fix
2024-11-07 17:37:18 +01:00
Xilmi
a70f5de8c6 Merge remote-tracking branch 'upstream/develop' into develop 2024-11-07 14:35:13 +01:00
Xilmi
5979f53a26 Upgrade priority
New priority to upgrade existing armies to make it less likely to fight the AI with only part of its army.
2024-10-31 00:42:33 +01:00
Xilmi
9d2fc1b1c9 Update DefenceBehavior.cpp
Fixed an issue that caused the AI to try buying the same hero in two different towns.
2024-10-31 00:41:51 +01:00
Ivan Savenko
d3af9f1c67 Removed pointer to VLC entity from CStackBasicDescriptor 2024-10-30 16:47:02 +00:00
Ivan Savenko
c98ac01e7a Replaced public artType member of ArtifactInstance with getter 2024-10-30 16:47:01 +00:00
Ivan Savenko
08fbcd5239 TerrainTile now uses identifiers instead of pointers to VLC 2024-10-30 16:22:11 +00:00
Xilmi
2b99414793 Using hero's stats instead of level to determine their role.
Since there are custom maps/campaigns in which heroes have pretty high base-stats even at level 1.
2024-10-21 09:37:44 +02:00
Xilmi
60084243af Update PriorityEvaluator.cpp
Fixed losing heroes while exploring.
2024-10-21 09:21:00 +02:00
Xilmi
76f5d925e6 Update PriorityEvaluator.cpp
The army loss will no longer affect the score for defensive decisions.
2024-10-21 08:59:18 +02:00
Xilmi
d93c6211da Road exploration
The non-cheating-AI on 100% and below is now smarter about exploration and will explore alongside roads with higher priority.
2024-10-20 23:32:39 +02:00
Xilmi
3a8a67407b Update RecruitHeroBehavior.cpp
AI's willingness to hire hero now depends more on the availability of treasure again.
2024-10-20 16:37:03 +02:00
Xilmi
11980e0f97 Garrisoning behavior improvement
AI will now also garrison a hero as defender if the town to be defended has troops as long as the hero can merge their own troops with the town.

AI will no longer just dismiss existing troops in a town if a hero trying to garrison there can merge with it.
2024-10-20 15:49:23 +02:00
Xilmi
f04e110e2c Update RecruitHeroBehavior.cpp
Removed inclusion of no longer existing and also not needed header.
2024-10-20 12:59:08 +02:00
Xilmi
5d6877e06d Merge remote-tracking branch 'upstream/develop' into develop 2024-10-20 00:49:17 +02:00
Ivan Savenko
604e3b5c67
Merge pull request #4763 from IvanSavenko/herohandler_split
Split CHeroHandler.cpp/.h into 1 file per class
2024-10-14 19:05:48 +03:00
Ivan Savenko
cee3521f57
Merge pull request #4770 from IvanSavenko/prison_fix
Fix for loading hero types / identities
2024-10-14 18:16:53 +03:00
Ivan Savenko
10ad0fc760 Split CHeroHandler.cpp/.h into 1 file per class
All parts of CHeroHandler.cpp are now in lib/entities/hero
Adjusted includes to use new paths
No functionality changes
2024-10-13 14:01:09 +00:00
Ivan Savenko
31095248ab Removed typeName and subtypeName properties from CGObjectInstance 2024-10-13 13:05:50 +00:00
Xilmi
c838f5d0c2 Update BattleEvaluator.cpp
Restored spell-damage-calculations for units that would die from spells.
2024-10-11 20:27:18 +02:00
Ivan Savenko
a8e84c55f6 Fix some of the new warnings from sonarcloud 2024-10-11 10:45:29 +00:00
Xilmi
eb94c9f0be Update PriorityEvaluator.cpp
AI will be more aggressive when defending their territory. And more aggressive means more willing to take losses while fighting.
2024-10-10 18:53:28 +02:00
Xilmi
da32b8b58f Restore compatibility with removal of getFaction() 2024-10-10 17:33:54 +02:00
Xilmi
61fba1fedd Merge remote-tracking branch 'upstream/develop' into develop 2024-10-10 17:23:39 +02:00