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

78 Commits

Author SHA1 Message Date
645b95ba02 Renamed LibClasses * VLC to GameLibrary * LIBRARY 2025-02-21 16:54:56 +00:00
2362c6da21 Fixes for multiple new issues from Sonar 2025-02-21 15:57:39 +00:00
313fa1e80e Remove commented-out code 2025-01-30 11:31:54 +00:00
d8ec69bfaa Remove non-const iterators to BattleHexArray container
Replaced with several non-const methods to prevent modification of
internal storage without corresponding modification of internal flags
2025-01-29 23:02:51 +00:00
f858a6e04b Merge pull request #5266 from MichalZr6/battlefield
Minor fixes to BattleHexArray. BattleHex'es as const reference where possible.
2025-01-25 17:44:14 +02:00
ecdd394bb1 Use BattleHex as const ref wherever possible
Minor Fixes
Drop unused function from BattleHexArray
2025-01-21 13:23:17 +01:00
8f63a82d60 Minor changes with BattleHex and BattleHexArray 2025-01-21 13:23:17 +01:00
2d6ae7859b Fixes BattleAI not selecting best hex when approaching nearest enemy 2025-01-19 16:38:50 +00:00
3d1bf03a25 Fix potential concurrent access 2025-01-12 11:06:00 +00:00
dbe82b94f6 Changes following review:
- shared_ptr for destructibleEnemyTurns instead of raw pointer
- drop implicit int conversion for BattleHex class
  and implement toInt() instead
- implement necessary operators in BattleHex
- adjust code to work properly with JSON serializer
2025-01-08 07:24:43 +01:00
dad6437661 Refactor BattleHex, remake the use of precomputed neighbouring tiles containers.
- Moved short, frequently used functions to the BattleHex header for inlining
- Made BattleHex a class with a private hex value
- Moved getClosestTile implementation back to BattleHex
- Enabled access to static precomputed data in BattleHexArray via BattleHex
(note: circular dependency prevented static precomputed containers being directly placed in BattleHex)
2025-01-06 23:28:46 +01:00
ac8104d56d SonarCloud recomendations.
Code review follow-up:
- Replace std::vector with boost::small_vector
- Rename function merge to insert
2025-01-06 23:28:45 +01:00
44a645b5e0 use bitset for presenceFlags and steady_clock for measurments 2025-01-06 23:28:45 +01:00
fb9a3da651 Unit.cpp refactor and some other minor changes 2025-01-06 23:28:44 +01:00
a99274d72e BattleHexArray - new container for BattleHexes 2025-01-06 23:18:18 +01:00
9f4e92b5f6 Fix computation of spell value when attacker can't reach enemies behind
walls in siege combat
2025-01-04 14:01:40 +00:00
c4623aad0f Backported fix for BattleAI not casting spells that would kill entire
unit
2025-01-04 12:23:36 +00:00
bb7cf3ffbf Use existing callback method instead of custom one in AI 2024-12-14 14:53:34 +00:00
df21a77857 Battle-AI-improvements
When defending the AI is now much smarter to use their defensive-structures like walls, towers and the moat to their advantage instead of allowing them to be lured out and killed in the open.

A penalty-multiplier is now applied when deciding which units to walk towards. If an ally is closer than us to the enemy unit in question, we reduce our score for walking towards that unit too. This shall help against baiting a whole flock of AI-stacks to overcommit on chasing an inferior stack of the enemy.
2024-12-05 21:09:24 +01:00
5332ad59a4 Remove copy-pasted code 2024-11-26 19:13:10 +00:00
c838f5d0c2 Update BattleEvaluator.cpp
Restored spell-damage-calculations for units that would die from spells.
2024-10-11 20:27:18 +02:00
9a40577994 Merge remote-tracking branch 'upstream/develop' into develop 2024-10-08 16:15:22 +02:00
259fcedc85 Fix flying units move into damaging obstacles 2024-10-03 23:03:36 +02:00
d679ee72b9 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-22 12:21:20 +02:00
a1384bf47f defending, when not possible to attack invincible 2024-09-19 20:54:50 +02:00
d4fd4ed670 Update BattleEvaluator.cpp
Make sure trace-message doesn't crash from accessing invalid element.
2024-09-11 16:05:53 +02:00
5999c6d891 Update BattleEvaluator.cpp
Removed now unnecessary additional check for dead units.
2024-09-09 19:54:20 +02:00
9361278f81 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-03 21:16:01 +02:00
dfa992951b Revert "Merge branch 'fix-battle-ai' into develop"
This reverts commit b489816d29, reversing
changes made to 5ee7061ab7.
2024-09-03 20:57:05 +02:00
f9442208da BattleAI: avoid standing in moat 2024-09-03 13:02:58 +03:00
b489816d29 Merge branch 'fix-battle-ai' into develop 2024-09-02 17:28:11 +02:00
5ee7061ab7 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-02 17:27:08 +02:00
3f916ab543 BattleAI: avoid standing in moat 2024-09-02 15:31:36 +03:00
39e5ba32f6 Merge pull request #4530 from IvanSavenko/town_fortifications
Support for configurable town fortifications
2024-08-31 13:59:40 +03:00
987a51cccb Merge remote-tracking branch 'upstream/develop' into develop 2024-08-30 16:45:06 +02:00
36c1ed670f Support for configurable town fortifications
Removed most of hardcoded checks for fort level or for presence of fort/
citadel/castle buildings.

It is now possible to define which parts of town fortifications are
provided by town buildings

Configuration for H3-like fortifications is provided in
buildingsLibrary.json and will be used automatically by mods as long as
mods have buidings named "fort", "citadel" and "castle".

Alternatively, mods can separately define:
- hitpoints of walls (shared value for all sections)
- hitpoints of central, upper and lower towers (separate values)
- presence of moat
- shooters for each tower (separate values)
2024-08-28 19:42:14 +00:00
ed36b1a882 Battle AI: fix casting Implosion when it kills target stack, fix casting summon elementals 2024-08-26 16:58:27 +03:00
d55996cc46 Battle AI: fix firewall, fix haste spellcast evaluation for waits and movements, allow location spells 2024-08-26 11:31:00 +03:00
69dc32a128 Don't cast spells with below 0 score.
The AI will no longer cast spells if the best spell's value is still below 0.
2024-08-24 17:15:15 +02:00
bfd6ee2b09 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-24 12:25:03 +02:00
ff8a745a50 BattleAI: optional simulation depth 2024-08-21 23:27:42 +03:00
bc80532f29 BattleAI: improve movement towards unreachable 2024-08-21 22:18:40 +03:00
26609d7a4f BattleAI refactoring 2024-08-21 22:18:40 +03:00
8cdfa26fb5 BattleAI: fix bait for archers when need to go long way 2024-08-21 22:18:40 +03:00
e6d907af55 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-18 09:52:59 +02:00
2a05fbdd50 Unified handling of battle sides ID's
- Replaced BattleSide namespace-enum with enum class
- Merged two different BattleSide enum's into one
- Merged BattlePerspective enum into BattleSide enum
- Changed all places that use integers to represent battle side to use
BattleSide enum
- Added BattleSideArray convenience wrapper for std::array that is
always 2-elements in size and allows access to its elements using
BattleSide enum
2024-08-11 20:54:44 +00:00
a454ecfe38 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-10 11:05:28 +02:00
33e0eeaa8a BattleAI: fix dragon breath 2024-07-22 20:39:32 +03:00
6f9309696d Merge remote-tracking branch 'upstream/develop' into develop 2024-07-21 19:06:14 +02:00
1c522c49b6 Fix possible crash on trying to move to invalid battlefield hexes 2024-07-20 18:28:13 +00:00