1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-17 20:58:07 +02:00

80 Commits

Author SHA1 Message Date
Ivan Savenko
797b62fd46 Try to implement lazy evaluation for reachability map 2025-01-10 17:43:45 +00:00
Ivan Savenko
2d5b5d94e7 Optimize computation of reachability map 2025-01-10 15:38:28 +00:00
MichalZr6
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
MichalZr6
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
MichalZr6
fb9a3da651 Unit.cpp refactor and some other minor changes 2025-01-06 23:28:44 +01:00
MichalZr6
5f799d41b3 Use cached neighbouring tiles where possible 2025-01-06 23:18:19 +01:00
MichalZr6
a99274d72e BattleHexArray - new container for BattleHexes 2025-01-06 23:18:18 +01:00
Ivan Savenko
78fc6d0e41 Remove unused code 2025-01-04 15:09:50 +00:00
Ivan Savenko
bb7cf3ffbf Use existing callback method instead of custom one in AI 2024-12-14 14:53:34 +00:00
Xilmi
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
Xilmi
a1a03d4b74 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-12 14:54:39 +02:00
Ivan Savenko
48b0a222a0
Merge pull request #4570 from kdmcser/crash_fix
fix Ballista Bank Mod auto combat crash
2024-09-12 14:16:41 +03:00
kdmcser
312403962b
Update BattleExchangeVariant.cpp
fix.compile error
2024-09-11 11:39:03 +08:00
kdmcser
bb759dc2b8 fix compile error 2024-09-11 01:43:30 +08:00
kdmcser
58cdbccf21
Update AI/BattleAI/BattleExchangeVariant.cpp
Co-authored-by: Ivan Savenko <saven.ivan@gmail.com>
2024-09-10 15:29:11 +08:00
kdmcser
c5b598b277 fix Ballista Bank Mod auto combat crash 2024-09-08 01:05:03 +08:00
Xilmi
9361278f81 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-03 21:16:01 +02:00
Xilmi
dfa992951b Revert "Merge branch 'fix-battle-ai' into develop"
This reverts commit b489816d29f15a6d0a0abc5827887294bc08db03, reversing
changes made to 5ee7061ab76bff92ab7f579c137dd19c2710908e.
2024-09-03 20:57:05 +02:00
Xilmi
64fad53532 Revert "Merge branch 'pr/4528' into develop"
This reverts commit f4578c6d3ab9449a0b571857b1736515f0339670, reversing
changes made to ac8e5b3711b2fd17968cd06868d1058c4eb4b6fd.
2024-09-03 20:51:13 +02:00
Andrii Danylchenko
f9442208da BattleAI: avoid standing in moat 2024-09-03 13:02:58 +03:00
Xilmi
b489816d29 Merge branch 'fix-battle-ai' into develop 2024-09-02 17:28:11 +02:00
Andrii Danylchenko
3f916ab543 BattleAI: avoid standing in moat 2024-09-02 15:31:36 +03:00
Xilmi
f4578c6d3a Merge branch 'pr/4528' into develop 2024-08-30 22:09:43 +02:00
Xilmi
987a51cccb Merge remote-tracking branch 'upstream/develop' into develop 2024-08-30 16:45:06 +02:00
Ivan Savenko
c3e76f19e1 Add workaround for very common crash in BattleAI 2024-08-30 12:25:55 +00:00
Ivan Savenko
644d6f4529
Merge pull request #4507 from vcmi/fix-battle-ai
Battle AI: fix firewall, fix haste spellcast evaluation for waits and…
2024-08-30 14:36:05 +03:00
Xilmi
aea05b3fb8 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-29 14:42:37 +02:00
MichalZr6
7ae7c13964 drop setting reachability for turrets 2024-08-28 15:22:00 +02:00
Ivan Savenko
3d39963a1c Merge branch 'master' into 'develop' 2024-08-26 14:01:00 +00:00
Andrii Danylchenko
d55996cc46 Battle AI: fix firewall, fix haste spellcast evaluation for waits and movements, allow location spells 2024-08-26 11:31:00 +03:00
Xilmi
bfd6ee2b09 Merge remote-tracking branch 'upstream/develop' into develop 2024-08-24 12:25:03 +02:00
Andrii Danylchenko
ff8a745a50 BattleAI: optional simulation depth 2024-08-21 23:27:42 +03:00
Andrii Danylchenko
22de88ad68 BattleAI: count wait correctly for fast creatures 2024-08-21 22:18:41 +03:00
Andrii Danylchenko
337f99942b BattleAI: remove boost for archers while moving as actual stack may be small 2024-08-21 22:18:41 +03:00
Andrii Danylchenko
bc80532f29 BattleAI: improve movement towards unreachable 2024-08-21 22:18:40 +03:00
Andrii Danylchenko
8cdfa26fb5 BattleAI: fix bait for archers when need to go long way 2024-08-21 22:18:40 +03:00
Andrii Danylchenko
b3fc6743d9 BattleAI: better retaliation calculation 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
Ivan Savenko
d09fb07362 Use throwing ::at to prevent undefined behavior 2024-08-15 13:14:51 +00:00
Xilmi
068e3bdc59 Fix endless loop
Fixed an endless-loop caused by someone removing this ", turn++".
2024-08-12 19:47:15 +02:00
Ivan Savenko
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
Andrii Danylchenko
51b8bc9fc3 BattleAI: fix shhoters waiting and reduce strength of our loss affecting decissions 2024-08-04 17:50:19 +03:00
Andrii Danylchenko
801e919e7e BattleAI: fix ap calculation in exchange variant 2024-08-03 20:35:20 +03:00
Andrii Danylchenko
4e83deca92 BattleAI: fix waited attack calculation 2024-07-22 20:39:33 +03:00
Alexander Wilms
02e429e973 Fix typos using https://github.com/crate-ci/typos
Changes were reviewed manually
2024-06-24 03:47:19 +02:00
Ivan Savenko
0e4be8c776 Fix crash on sieging Citadel or Castle 2024-06-19 19:59:06 +00:00
Ivan Savenko
b7efa6c8cc Fixed potential thread races in Battle AI 2024-06-17 16:15:19 +00:00
Ivan Savenko
7359b66f99 Do not use floating point equality checks 2024-02-14 12:07:07 +02:00
Andrii Danylchenko
c66de29550 #3550 - fix case when unit is in reachability map but only next turn 2024-02-03 17:48:52 +02:00
Ivan Savenko
a582cb554e
Merge pull request #3500 from IvanSavenko/fix_dendroid_bind
[1.4.3] Fix handling of Dendroid's Bind ability
2024-01-15 12:02:06 +02:00