1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-27 00:41:08 +02:00
Commit Graph

203 Commits

Author SHA1 Message Date
ec9dbfd667 Remove excessive recomputations of tile owners 2025-01-08 20:07:42 +00:00
82e8db3037 Do not compute threats that are too far away to be useful 2025-01-08 20:07:42 +00:00
3d3dd70a11 Simplify code, fix AI not building dwelling upgrades 2025-01-06 18:59:37 +00:00
8468469976 Fixes for AI town building logic
- Fixes AI not considering non-built dwellings
- AI will now skip evaluation of towns in which construction today is no
longer possible
2025-01-06 16:20:53 +00:00
4e9f052e98 Fix creature upgrades in Fort and town's dwellings 2024-12-30 01:14:57 +01:00
95a07ee5cb Use bonus system cache whenever possible 2024-12-21 18:47:11 +00:00
0e1f8f99bc Reduce excessive logging 2024-12-21 14:43:08 +00:00
99fcf136ec Nullkiller AI is now also capable of upgrading dwellings a second time if that's possible 2024-12-16 23:45:21 +01:00
9012560e38 Fix for AI not recognizing 2nd T7-building of Factory as dwelling
This lead to it being built dead-last in the build-order instead of the AI trying to go for it quite early.
2024-12-16 17:19:07 +01:00
5ff834aac2 Remove debug-outputs
Debug-outputs removed
2024-12-13 22:13:27 +01:00
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
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
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
df069bf14f Merge remote-tracking branch 'upstream/develop' into develop 2024-12-07 13:32:19 +01:00
7da5c08f74 Update ObjectClusterizer.cpp
Actually fix the warning now.
2024-12-04 15:07:13 +01:00
66bc6c0d52 Update ObjectClusterizer.cpp
Fixed warning that prevents compilation on GitHub.
2024-12-04 14:57:46 +01:00
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
d9f82c22f4 Recalculate tile owners on hitmap update 2024-12-01 21:30:44 +00:00
90536a5fbe Remove hardcoded morale chance constant 2024-11-28 12:11:32 +00:00
be2327d000 Removed no longer used or redundant constants 2024-11-28 12:11:13 +00:00
b25702f15e expose safeAttackRatio to AI config 2024-11-28 11:53:51 +00:00
a70f5de8c6 Merge remote-tracking branch 'upstream/develop' into develop 2024-11-07 14:35:13 +01:00
d3af9f1c67 Removed pointer to VLC entity from CStackBasicDescriptor 2024-10-30 16:47:02 +00:00
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
5d6877e06d Merge remote-tracking branch 'upstream/develop' into develop 2024-10-20 00:49:17 +02:00
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
61fba1fedd Merge remote-tracking branch 'upstream/develop' into develop 2024-10-10 17:23:39 +02:00
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
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
2d783211ce Fixed a crash
Fixed a crash from trying to access nonexisting map-element.
2024-10-01 01:11:17 +02:00
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
a01e84214f Fixed errors
AI no longer tries to access tiles it cannot see while clusterizing objects.
2024-09-30 21:00:50 +02:00
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
9ef2c6f8a0 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-22 23:43:29 +02:00
ce0f51672a NKAI: replace hardcoded pandora with more flexible solution 2024-09-20 16:05:57 +03:00
ec6c84b0e0 NKAI: pandora as blocker object 2024-09-17 15:25:13 +03:00
065125e770 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-10 14:57:27 +02:00
06f894140c Update BuildAnalyzer.cpp
Modified goldPressure-formula to no longer use completely arbitrary part of lockedresources/5000.
Lockedresources is now just divided by a factor of the free gold like everything else.
2024-09-06 21:42:15 +02:00
8225eb454e Added GameSettings to gamestate, potentially allowing to define game
settings per map (or in random map template)
2024-09-05 15:16:27 +00:00
64fad53532 Revert "Merge branch 'pr/4528' into develop"
This reverts commit f4578c6d3a, reversing
changes made to ac8e5b3711.
2024-09-03 20:51:13 +02:00
09badeb5be Enum for PriorityTiers
In order to not confuse PriorityTiers, especially after adding new ones, now using an enum to identify them.
2024-09-02 00:16:19 +02:00
c667ca46d1 Using correct priorityTier for Clusterization
Clusterizer now uses PriorityTier = 5 for evaluation, which is used to generate priority for guarded objects
2024-09-02 00:00:36 +02:00
0c488145b9 Update BuildAnalyzer.cpp
Revert unintentionally commited changes
2024-09-01 00:02:47 +02:00
72597b549b hero spread
Prefer hiring heroes at towns that don't have heroes nearby.
2024-08-31 23:00:27 +02:00
f4578c6d3a Merge branch 'pr/4528' into develop 2024-08-30 22:09:43 +02:00
e769e0a856 Merge branch 'vcmi:develop' into bug_fixes 2024-08-29 23:59:54 +02:00
aea05b3fb8 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-29 14:42:37 +02:00
ca3d81f047 fix crash on heroRoles.clear() 2024-08-28 15:22:00 +02:00
0fd9dbf240 Unified income handling, added IOwnableObject interface 2024-08-28 12:40:44 +00:00
bfd6ee2b09 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-24 12:25:03 +02:00