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

194 Commits

Author SHA1 Message Date
Xilmi
5ff834aac2 Remove debug-outputs
Debug-outputs removed
2024-12-13 22:13:27 +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
df069bf14f Merge remote-tracking branch 'upstream/develop' into develop 2024-12-07 13:32:19 +01: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
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
Ivan Savenko
d9f82c22f4 Recalculate tile owners on hitmap update 2024-12-01 21:30:44 +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
Xilmi
a70f5de8c6 Merge remote-tracking branch 'upstream/develop' into develop 2024-11-07 14:35:13 +01:00
Ivan Savenko
d3af9f1c67 Removed pointer to VLC entity from CStackBasicDescriptor 2024-10-30 16:47:02 +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
5d6877e06d Merge remote-tracking branch 'upstream/develop' into develop 2024-10-20 00:49:17 +02: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
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
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
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
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
9ef2c6f8a0 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-22 23:43:29 +02:00
Andrii Danylchenko
ce0f51672a NKAI: replace hardcoded pandora with more flexible solution 2024-09-20 16:05:57 +03:00
Andrii Danylchenko
ec6c84b0e0 NKAI: pandora as blocker object 2024-09-17 15:25:13 +03:00
Xilmi
065125e770 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-10 14:57:27 +02:00
Xilmi
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
Ivan Savenko
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
Xilmi
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
Xilmi
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
Xilmi
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
Xilmi
0c488145b9 Update BuildAnalyzer.cpp
Revert unintentionally commited changes
2024-09-01 00:02:47 +02:00
Xilmi
72597b549b hero spread
Prefer hiring heroes at towns that don't have heroes nearby.
2024-08-31 23:00:27 +02:00
Xilmi
f4578c6d3a Merge branch 'pr/4528' into develop 2024-08-30 22:09:43 +02:00
MichalZ
e769e0a856
Merge branch 'vcmi:develop' into bug_fixes 2024-08-29 23:59:54 +02:00
Xilmi
aea05b3fb8 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-29 14:42:37 +02:00
MichalZr6
ca3d81f047 fix crash on heroRoles.clear() 2024-08-28 15:22:00 +02:00
Ivan Savenko
0fd9dbf240 Unified income handling, added IOwnableObject interface 2024-08-28 12:40:44 +00:00
Xilmi
bfd6ee2b09 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-24 12:25:03 +02:00
Andrii Danylchenko
bc80532f29 BattleAI: improve movement towards unreachable 2024-08-21 22:18:40 +03:00
Xilmi
e6d907af55 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-18 09:52:59 +02:00
Xilmi
f0ca1c6112 Update BuildAnalyzer.cpp
Removed the restrictions of the greedy-playstyle.
Only count forts as gold-producing prerequisites when no same- or higher-level fort exists somewhere else in the empire.
2024-08-15 18:13:44 +02:00
Xilmi
c10c04779f Adaptive Build-order
When not threatened by nearby enemies the AI adds missing gold-income-buildings towards gold-pressure. This impacts the build-order in a way that they try to rush these more and get up a good economy more quickly.
2024-08-14 22:52:19 +02:00
Ivan Savenko
38311244a4
Merge pull request #4402 from Laserlicht/8th_creature
support for 8th creature (Factory)
2024-08-14 17:04:32 +03:00
Xilmi
730e574bef Fixed AI ignoring garrisioned heroes when it comes to danger-analysis.
AI now considers garrisoned heros a potential threat for their heroes too.
2024-08-11 12:44:07 +02:00
Xilmi
99e4052dc0 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-11 11:37:10 +02:00
Andrii Danylchenko
78dea24017 Visual logger colored text 2024-08-10 19:13:09 +03:00
Andrii Danylchenko
47c77826c3 Visual logger map texts 2024-08-10 13:04:35 +03:00