1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-10-08 23:22:25 +02:00
Commit Graph

207 Commits

Author SHA1 Message Date
Simeon Manolov
91101d26fa Remove std::vector inheritance 2025-10-05 10:34:06 +03:00
Opuszek
6b97fc306d fix berserk 2025-07-22 23:28:53 +02:00
Opuszek
ac3991b899 Rename a misleading method 2025-07-22 21:33:46 +02:00
Ivan Savenko
1e3e2f665c Remove strange & unused double-selector logic 2025-06-24 12:06:23 +03:00
Ivan Savenko
1ac8080cbf Implemented new unit actions panel in combat
Alternative actions submod from extras is now deprecated and will have
no effect.

As long as screen width allows, game will now display additional panel
with all possible unit actions.

Panel will also display spells that can be cast by unit, allowing small
version of unit spellbook (total limit of actions is 12, but some are
used for creature actions, so unit spells are limited to 7-9)
2025-06-19 19:29:01 +03:00
Ivan Savenko
42317e7128 Block attempts to attack unit behind obstacle in UI 2025-05-29 11:24:24 +03:00
Ivan Savenko
5c4ce61d57 Fix handling of double-wide creatures by BattleAI
One of recently added sanity checks was causing crashes during BattleAI
decision-making.

Actual reason turned out to be due to invalid requests generated by
BattleAI when attempting to attack enemy unit from behind with double-
wide unit.

This change should make BattleAI correctly estimate such attacks
2025-05-23 14:00:47 +03:00
Ivan Savenko
e90d8c318d Configurable multi-hex attacks
- Added bonus type MULTIHEX_UNIT_ATTACK - configurable version of Dragon
Breath.
- Added bonus type MULTIHEX_ENEMY_ATTACK - configurable version of
Cerberi multi-headed attack that only hits enemies
- Added bonus type MULTIHEX_ANIMATION - optional bonus that does not
affects gameplay, but allows to define in which cases game should use
alternative attack animation.
- All existing multi-hex attack bonuses other than ATTACKS_ALL_ADJACENT
are presumable deprecated, but will be supported for now.
- It is now possible to precisely configure which hexes are targeted by
MULTIHEX_XXX bonuses. See docs for details.
- Unified logic of all multi-hex attacks, all existing bonuses are now
implemented as specific case of MULTIHEX_XXX bonus
- Added tests to cover Cerberi attack logic, and fixed incorrect edge
case of Dragon Breath
2025-05-20 15:08:59 +03:00
Ivan Savenko
700eeb6bd4 Implemented HERO_SPELL_CASTS_PER_COMBAT_TURN bonus 2025-05-08 00:25:07 +03:00
Ivan Savenko
63d00b080e Removed pointer to army from StackInstance 2025-04-27 14:57:30 +03:00
Ivan Savenko
439c9a7888 Merge pull request #5622 from IvanSavenko/hypno_fix
Fix hypnotize spell
2025-04-13 16:21:14 +03:00
Ivan Savenko
1f70f27b2d Fix hypnotize spell
- Fix testing for Hypnotized status
- Fix handling of three-headed & all-around attack (Cerberi / Hydras)
while hypnotized
2025-04-11 18:01:49 +03:00
Ivan Savenko
b6c341f7c0 Likely fix for inability to shoot if there was adjacent cloned unit 2025-04-11 00:35:11 +03:00
Ivan Savenko
a8a6be7ac1 Fix potential compatibility with C++20 / C++23 mode
This fixes several issues with compatibility with C++20. C++23 was also
tested, but apparently it does not have any additional breaking changes
compared to C++20 (or we don't have those).

VCMI still uses C++17 as before - goal is only to make potential
transition easier.

There were 2 cases that are deprecated in C++20 that we use:
- Floating point operations on enums are deprecated
- `this` can no longer be captured when using default capture by value
`[=]`

Both of those should now be replaced with code that works fine in both C+
+17 and in C++20 mode
2025-03-02 14:11:48 +00:00
Ivan Savenko
645b95ba02 Renamed LibClasses * VLC to GameLibrary * LIBRARY 2025-02-21 16:54:56 +00:00
Ivan Savenko
2362c6da21 Fixes for multiple new issues from Sonar 2025-02-21 15:57:39 +00:00
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