1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-14 10:12:59 +02:00
Commit Graph

2028 Commits

Author SHA1 Message Date
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
Ivan Savenko
3dd4fa2528 Reduce usage of pointers to VLC entities
Final goal (of multiple PR's) is to remove all remaining pointers from
serializeable game state, and replace them with either identifiers or
with shared/unique pointers.

CGTownInstance::town and CGHeroInstance::type members have been removed.
Now this data is computed dynamically using subID member.

VLC entity of a town can now be accessed via following methods:
- getFactionID() returns ID of a faction
- getFaction() returns pointer to a faction
- getTown() returns pointer to a town

VLC entity of a hero can now be accessed via following methods:
- getHeroTypeID() returns ID of a hero
- getHeroClassID() returns ID of a hero class
- getHeroType() returns pointer to a hero
- getHeroClass() returns pointer to a hero class
2024-10-10 12:28:08 +00:00
Ivan Savenko
a8f8c3f4b1 Replaced most of accesses to CGObjectInstance::pos with anchorPoint() 2024-10-09 15:43:46 +00:00
Xilmi
9a40577994 Merge remote-tracking branch 'upstream/develop' into develop 2024-10-08 16:15:22 +02:00
Ivan Savenko
c0f5c7c0ea Replace pointer with reference in pack apply functions 2024-10-07 14:59:46 +00:00
MichalZr6
259fcedc85 Fix flying units move into damaging obstacles 2024-10-03 23:03:36 +02:00
Xilmi
68e264d990 Prune paths involving enemy heroes
Capture objects and gather army will now skip paths that involve foreign heroes.
2024-10-03 15:06:34 +02:00
Xilmi
5e6fefdc50 Reverted fix for not trying to moving foreign heroes
While it fixed the bug it was supposed to fix it caused another severe bug: AI wasn't generating a thread-map anymore.
Original bug needs to find another fix.
2024-10-02 23:40:51 +02:00
Xilmi
0143a52755 Update PriorityEvaluator.cpp
Scores for all sorts of visitable and pickable objects are now unified in order to prevent AI from ignoring nearby valuables.
2024-10-02 20:12:47 +02:00
Xilmi
f0802c0b3c Move foreign hero fix
Fixed an issue that caused the AI to try and move heroes of other players.
2024-10-02 20:11:20 +02:00
Xilmi
f2b8b40925 Being less dismissive
Reduced the amount of circumstances under which the AI dismisses heroes. Among others to prevent a loop through all passes where it repeatedly hires and dismisses heroes.
2024-10-01 17:20:54 +02:00
Xilmi
3d9892f6b3 Merge remote-tracking branch 'upstream/develop' into develop 2024-10-01 16:08:57 +02:00
DjWarmonger
ffed9480e0
Merge pull request #4483 from vcmi/custom_objects_per_zone
Customizable objects in RMG zones
2024-10-01 14:58:35 +02:00
Xilmi
2d783211ce Fixed a crash
Fixed a crash from trying to access nonexisting map-element.
2024-10-01 01:11:17 +02:00
Xilmi
9c52e3a0b2 Fix for inconsistency in planned and performed army-merge.
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.
2024-10-01 00:42:01 +02:00
Xilmi
a01e84214f Fixed errors
AI no longer tries to access tiles it cannot see while clusterizing objects.
2024-09-30 21:00:50 +02:00
Xilmi
73e7d3f5bb Another reason not to try to town-portal
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.
2024-09-30 19:41:39 +02:00
Xilmi
74f3aedcc9 TP onto friend attempt
Fixed an issue that caused the AI to think it can townportal onto heroes of other factions, for example their allies.
2024-09-30 19:32:27 +02:00
Xilmi
d59a1fe9e9 Fix case of "Got false in applying struct CastAdvSpell"
Heroes now leave the garrison before trying (and failing) to cast adventure-map-spells.
2024-09-30 17:57:41 +02:00
Xilmi
cfe4d7592a Update DefenceBehavior.cpp
Heroes will no longer rush to defend towns that have a standing garrison that they can't merge their armies with.
2024-09-29 03:13:21 +02:00
Xilmi
a2904584d3 Update Nullkiller.cpp
Build and hire-tasks no longer eat into the pass-depth.
2024-09-29 02:01:09 +02:00