Ivan Savenko
8c293ce156
First attempt to make per-difficulty configurations for AI
2024-12-05 15:08:04 +00: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
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