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

759 Commits

Author SHA1 Message Date
Xilmi
5ff834aac2 Remove debug-outputs
Debug-outputs removed
2024-12-13 22:13:27 +01:00
Xilmi
33f5b473b3 Defender should not run off for troop-delivery
Fixed a rare case in which a town-defender could become an indirect part of a troop-delivery-task by doing a sub-task like capturing a shipyard that takes less than 1 turn but leaves him out in the open.
2024-12-13 21:50:45 +01:00
Xilmi
79fb5faa2e Fixed a freeze
It was happening when all slots were full but no unit even needed disbanding because the unit to be bought is part of the units that are inside of the existing slots.

(This commit contains excessive debugging but I don't want to remove it just yet incase another issue pops up.)
2024-12-13 12:23:13 +01:00
Xilmi
fac18d953e Fixed and improved disband-logic
The score for buying army now scales with the cost of that army.
The cost of the units that need to be disbanded in order to hire the new units is subtracted from the army-hiring-score so the AI will prefer hiring armies where the amount of troops to disband is low or non-existent.
Fixed a bug that also disbanded troops when there still were free slots available.
2024-12-13 00:09:10 +01:00
Xilmi
2ad9038709 AI can now disband units that block slots for buying better units
When the AI cannot buy units in a city because all slots are blocked and the units in the slot are cheaper than the units it wants to buy, the AI will now get rid of the units that block that slot in order to be able to buy the better units.
2024-12-12 20:06:33 +01:00
Xilmi
6536c9a18e Satisfy SonarCube 2024-12-12 14:58:29 +01:00
Xilmi
59497db428 Fixed isEnemy becoming true for things it shouldn't
Not sure whether it actually impacts behavior but better fix it either way.
2024-12-12 13:40:50 +01:00
Xilmi
32d85ce6ff Fix for retreating-behavior generally not working
Fixed that armyInvolvement was only filled in when the action involved a target to interact with rather than just a tile.
Since armyInvolvement was used for scoring actions such as retreating towards the closest town, this caused the AI to never retreat to their towns when they were supposed to.
2024-12-12 11:07:56 +01:00
Xilmi
347efa98a0 Introduced new priority-tiers for handling attacking and gathering near enemies that are really far away
So that the AI won't become too passive on giant maps.
2024-12-11 14:47:08 +01:00
Xilmi
650db73300 Ignore all ExceuteHeroChain-tasks with 0 movement-cost
These can happen when an enemy spawns ontop of an AI-hero. If the action would win, it wouldn't be executed anyways. So now AI does the next best thing instead, which likely what it wanted to do anyways.
2024-12-11 13:05:51 +01:00
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
df069bf14f Merge remote-tracking branch 'upstream/develop' into develop 2024-12-07 13:32:19 +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
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