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

2010 Commits

Author SHA1 Message Date
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
Xilmi
f7a961793a Update PriorityEvaluator.cpp
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.
2024-09-29 01:23:13 +02:00
Xilmi
4a5ecdf25e Update Nullkiller.h
Removed pointless default-parameter.
2024-09-29 01:15:53 +02:00
Xilmi
769268cfe3 Eternal Garrison
Fixed an issue that caused heroes to stay garrisoned for ever when hero-cap was reached.
2024-09-29 01:15:09 +02:00
Xilmi
8d93c0c9c9 Update PriorityEvaluator.cpp
Removed workaround that was likely necessitated by other issues.
2024-09-27 23:03:35 +02:00
Xilmi
ea535b211a Update Nullkiller.h
Fixed issues caused by running buildPlan with wrong default-priority-tier.
2024-09-27 23:03:09 +02:00
Xilmi
0b016b9b14 Update RecruitHeroBehavior.cpp
If the AI is very rich it will buy more heroes even if it doesn't have a capitol.
2024-09-27 23:02:40 +02:00
Xilmi
3b7834495d Update PriorityEvaluator.cpp
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.
2024-09-27 19:38:07 +02:00
Xilmi
e4ef95f8dd Revert dynamic maxWillingToLose
Out maxWillingToLose back to a static 25%.
Dynamic could become too suicidal or too passive. 25% is a good sweetspot.
2024-09-25 16:12:53 +02:00
Xilmi
1d831022e8 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-25 14:08:34 +02:00
Xilmi
433c58f8b1 Workaround for previously masked issue
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.
2024-09-23 18:42:31 +02:00
Xilmi
d87f195bc7 Update AINodeStorage.cpp
Nodes along the path are now also considered for how dangerous it is.
2024-09-23 18:39:18 +02:00
Xilmi
71504a3140 Hire despite hero present
Only if both the garrison and the outside of a town are blocked are hires of heros being blocked.
2024-09-23 17:25:17 +02:00
Ivan Savenko
92c5fd4156
Merge pull request #4655 from IvanSavenko/bugfixing
Bugfixing
2024-09-23 18:01:27 +03:00
Xilmi
20f7751e16 Weekend-decisions
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.
2024-09-23 01:25:58 +02:00
Xilmi
9ef2c6f8a0 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-22 23:43:29 +02:00
Ivan Savenko
76e3ca4afe Fix potential access to destroyed variable on stack 2024-09-22 20:32:20 +00:00
Andrii Danylchenko
894c88defc
Merge pull request #4612 from vcmi/nkai-treat-pandora-as-blocker
NKAI: pandora as blocker object
2024-09-22 15:30:17 +03:00
Xilmi
90d72a4458 Chase & FFA-changes
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.
2024-09-22 13:06:07 +02:00