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

371 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
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
MichalZr6
44a645b5e0 use bitset for presenceFlags and steady_clock for measurments 2025-01-06 23:28:45 +01:00
MichalZr6
fb9a3da651 Unit.cpp refactor and some other minor changes 2025-01-06 23:28:44 +01:00
MichalZr6
8c3a417527 Cleanup 2025-01-06 23:18:20 +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
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
Ivan Savenko
c4623aad0f Backported fix for BattleAI not casting spells that would kill entire
unit
2025-01-04 12:23:36 +00:00
Ivan Savenko
bb7cf3ffbf Use existing callback method instead of custom one in AI 2024-12-14 14:53:34 +00:00
Xilmi
f56681d521 Removed weird logic that prevented AI from casting spells.
What was the rationale? AI loses fights with full Mana that it could easily have won otherwise. I just removed that weird logic and now it uses it's mana and wins.
2024-12-08 21:43:17 +01: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
Ivan Savenko
5332ad59a4 Remove copy-pasted code 2024-11-26 19:13:10 +00:00
Xilmi
5d6877e06d Merge remote-tracking branch 'upstream/develop' into develop 2024-10-20 00:49:17 +02: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
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
1d831022e8 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-25 14:08:34 +02:00
Ivan Savenko
76e3ca4afe Fix potential access to destroyed variable on stack 2024-09-22 20:32:20 +00:00
Xilmi
d679ee72b9 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-22 12:21:20 +02:00
Ivan Savenko
6832a5c4be
Merge pull request #4599 from MichalZr6/fix_hero_access_check
Fix error "hero access check" flooding console during quick-battle
2024-09-20 13:01:49 +03:00
Laserlicht
a1384bf47f defending, when not possible to attack invincible 2024-09-19 20:54:50 +02:00
MichalZr6
cb9070fb5b Fix unnecesarry error log in console from CBattleInfoEssentials::battleGetFightingHero 2024-09-15 08:51:05 +02:00
Xilmi
a1a03d4b74 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-12 14:54:39 +02:00
Ivan Savenko
39a2c29c97 Removed creatureBank flag from battle, battles now receive BattleLayout
struct that defines how units are placed in combat
2024-09-12 12:11:18 +00: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
Xilmi
d4fd4ed670 Update BattleEvaluator.cpp
Make sure trace-message doesn't crash from accessing invalid element.
2024-09-11 16:05:53 +02: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
Xilmi
5999c6d891 Update BattleEvaluator.cpp
Removed now unnecessary additional check for dead units.
2024-09-09 19:54:20 +02: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
Xilmi
5ee7061ab7 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-02 17:27:08 +02:00
Andrii Danylchenko
3f916ab543 BattleAI: avoid standing in moat 2024-09-02 15:31:36 +03:00
Ivan Savenko
39e5ba32f6
Merge pull request #4530 from IvanSavenko/town_fortifications
Support for configurable town fortifications
2024-08-31 13:59:40 +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