1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00

191 Commits

Author SHA1 Message Date
Ivan Savenko
5c8c69e665 Smarter logic for determining whether hex is inside the walls 2025-01-29 23:01:42 +00:00
Ivan Savenko
abc7168ff6 Consider units on wall hexes as 'inside' town for tower target selection 2025-01-26 15:51:54 +00:00
Ivan Savenko
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
MichalZr6
30bd975f95 Use unit->getHexes()
instead of battle::Unit::getHexes(stack->getPosition(), stack->doubleWide(), stack->unitSide())
2025-01-21 13:23:18 +01:00
MichalZr6
ecdd394bb1 Use BattleHex as const ref wherever possible
Minor Fixes
Drop unused function from BattleHexArray
2025-01-21 13:23:17 +01:00
Ivan Savenko
b33b880482 Do not add dead units as 'adjacent', since all callers assume this 2025-01-18 19:48:59 +00:00
Ivan Savenko
5bfc837a8f Fix regressions from battlehex PR (mostly related to towers) 2025-01-12 11:07:50 +00:00
Ivan Savenko
48473b18f6 move checks for invincible bonus to UnitState & cache 2025-01-10 21:15:37 +00:00
Ivan Savenko
40bff74195 Use small vector for unit list 2025-01-10 18:58:46 +00:00
Ivan Savenko
5375d61d1b Optimize battleAdjacentUnits method 2025-01-10 14:27:12 +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
4031006317 Drop battle elapsed time measurement, restore avHexes.
Github validation report fixes.
2025-01-06 23:28:47 +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
7a8edff419 minor fixes 2025-01-06 23:28:44 +01:00
MichalZr6
fb9a3da651 Unit.cpp refactor and some other minor changes 2025-01-06 23:28:44 +01:00
MichalZr6
e3516120d8 Refactor destructibleEnemyTurns 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
157d6d30c8 Move rest of commonly-accessed UnitState queries to bonus cache 2025-01-04 15:09:50 +00:00
Ivan Savenko
95a07ee5cb Use bonus system cache whenever possible 2024-12-21 18:47:11 +00:00
Ivan Savenko
4f80ccd648 Small micro-optimizations for code that gets called A LOT 2024-12-21 14:43:09 +00:00
Laserlicht
3c4064e09d prism attack fix 2024-11-23 02:10:01 +01:00
Laserlicht
0991f02282 Bonus: prism breath 2024-10-20 22:02:56 +02:00
Ivan Savenko
c0f5c7c0ea Replace pointer with reference in pack apply functions 2024-10-07 14:59:46 +00:00
Ivan Savenko
19db016473
Merge pull request #4654 from dydzio0614/any-hex-shooting
Allow targeting empty hex by shooters with multi-tile SPELL_LIKE_ABILITY
2024-09-27 19:23:33 +03:00
Dydzio
5dda4aa0f0 Remove overly strict condition 2024-09-22 21:43:20 +02:00
Dydzio
bb69ab1a1a Fix assert and condition for counting spell hexes 2024-09-22 18:25:18 +02:00
Dydzio
bf9a9283a4 Make any hex shooting possibility configurable 2024-09-22 16:58:15 +02:00
Dydzio
1a2d349267 Initial unconditionally working version 2024-09-22 15:07:44 +02:00
Laserlicht
899d3a14a0 only blocking non positive spells; counterstrike 2024-09-21 23:50:35 +02:00
Laserlicht
b36c05df1d INVINCIBLE bonus 2024-09-19 03:14:45 +02:00
Ivan Savenko
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
Ivan Savenko
3d39963a1c Merge branch 'master' into 'develop' 2024-08-26 14:01:00 +00:00
Andrii Danylchenko
8cdfa26fb5 BattleAI: fix bait for archers when need to go long way 2024-08-21 22:18:40 +03:00
Ivan Savenko
d09fb07362 Use throwing ::at to prevent undefined behavior 2024-08-15 13:14:51 +00:00
Ivan Savenko
49c5f650f7
Merge pull request #4437 from IvanSavenko/battle_sides
Unified handling of battle sides ID's
2024-08-14 18:37:05 +03:00
Ivan Savenko
cd6d55fe75 Do not try to shoot at 2nd hex of wide creatures 2024-08-14 10:38:59 +00: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
8e79263b21
Merge pull request #4323 from vcmi/battle-ai-fixes
Battle ai fixes
2024-08-10 10:48:35 +03:00
Ivan Savenko
b7391f49f6 Merge branch 'vcmi/master' into 'vcmi/develop' 2024-08-05 10:36:10 +00:00
Andrii Danylchenko
3d856bfa9d Merge remote-tracking branch 'origin/develop' into battle-ai-fixes 2024-08-03 12:54:25 +03:00
Ivan Savenko
434a2fb0fb Explicitly specify to use ranged or melee attack for damage estimation 2024-07-29 17:13:31 +00:00
Andrii Danylchenko
9edb0afff8 BattleAI: fix dragonbreath retaliation 2024-07-28 14:41:32 +03:00
Ivan Savenko
6ac3752325
Merge pull request #4330 from Laserlicht/spellbook
check spellbook
2024-07-27 19:34:50 +03:00
Laserlicht
e46f5f705b
better approach 2024-07-26 20:34:47 +02:00
Andrii Danylchenko
33e0eeaa8a BattleAI: fix dragon breath 2024-07-22 20:39:32 +03:00
Ivan Savenko
5bd9a32d97 Implemented simple target selection logic for arrow towers 2024-07-21 13:16:33 +00:00
Ivan Savenko
63bcf7d83c Replaced most of usages of CRandomGenerator with vstd::RNG in library 2024-07-16 13:13:07 +00:00
Simeon Manolov
941cd6768f
Fix battle turn order for current turn 2024-07-12 11:39:57 +03:00