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

109 Commits

Author SHA1 Message Date
463c404a83 Use bonus only as shared_ptr to avoid memory corruption 2025-06-16 16:22:21 +03:00
464865f20d Fix possible crashes on attempt to parse bonus 2025-06-15 23:54:43 +03:00
c279da0798 Minimize hardcoded logic for campaigns. Support for hota h3c's 2025-06-15 17:01:29 +03:00
a842dfb3c4 Support for defining new campaign regions in mods, for hota h3c 2025-06-15 17:01:29 +03:00
87d5347e50 Implement if check for json schemas 2025-06-15 17:01:15 +03:00
2b43d415a9 Fix docs, update spell immunity usage of addinfo, fix sonar 2025-06-15 14:37:18 +03:00
f5c037137b Fix translations, fix Sonar 2025-06-15 14:37:17 +03:00
bc48337445 Implement async requests for bonus types 2025-06-15 14:36:29 +03:00
022b0f731c Fix configs, update docs, resolve discovered regressions 2025-06-15 14:36:29 +03:00
bbe6c415c2 Add TIMES_STACK_SIZE updater 2025-06-15 14:36:29 +03:00
d2178f8831 Simplify Necromancy code, update docs 2025-06-15 14:36:29 +03:00
e0de65d56c Reworked & fixed DARKNESS bonuses and lookout tower / skyship logic 2025-06-15 14:36:29 +03:00
51832c4fb9 Preparation for user-defined bonus types 2025-06-15 14:36:29 +03:00
342705921d remove old bonus conversion logic 2025-06-15 14:36:29 +03:00
43844e2371 Merge pull request #5770 from IvanSavenko/const_bonus
Make bonus limiters/updaters/propagators const
2025-06-04 21:12:06 +03:00
20f0b51912 Make bonus limiters/updaters/propagators const
All pointers held by bonus itself are now const.

To support OppositeSideLimiter (the only stateful limiter) bonuses now
hold their player owner instead.

No changes in functionality or mods
2025-06-03 19:39:28 +03:00
b28fc7c096 Fix false-positive conflicts with append/appendItems syntax
Should no longer result in false positives. True positives when entire
list is being replaced (1.6-style) or if same item is modified should
still be reported
2025-06-02 21:35:11 +03:00
75672587b2 Fix appendItems 2025-05-28 15:32:44 +02:00
0945654672 Give custom descriptions to unclear H3 abilities and artifacts 2025-05-25 11:56:54 +03:00
25e57542be Merge pull request #5725 from IvanSavenko/bonus_description
Custom descriptions and icons for creature abilities
2025-05-23 14:02:34 +03:00
6fe3666abb Fix validation of addInfo of bonuses
- Added missing docs on addInfo of some bonuses
- Unified naming in docs to match json keys
- Removed addInfo from bonuses that don't actually support it
- Added loading of addInfo to bonuses that support it
2025-05-22 19:00:18 +03:00
3f83ad1b40 Merge pull request #5726 from IvanSavenko/breath
Configurable multi-hex attacks
2025-05-21 17:10:59 +03:00
25655184d3 Add support for custom icons & descriptions for bonuses 2025-05-21 14:57:10 +03:00
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
95ac124dc9 Bonus-aware addInfo loading 2025-05-20 14:56:22 +03:00
cc274c4d34 GameRandomizer is now in lib, add implementation 2025-05-19 18:51:42 +03:00
54a46b77a9 Extract library entity randomization logic to separate class 2025-05-19 18:51:42 +03:00
4d4da0454f map objects hierarchy now uses IGameInfoCallback 2025-05-14 18:33:20 +03:00
6f20235d07 Merge CPrivilegedInfoCallback into CGameInfoCallback 2025-05-14 13:42:20 +03:00
716da918f8 Completely remove IGameCallback class
- CClient now inherits directly from CPrivilegedInfoCallback, like
IGameCallback did before. However CClient no longer needs dummy
implementation of IGameEventCallback
- CGObjectInstance hierarchy now uses CPrivilegedInfoCallback for
callback. Actual events can only be emitted in calls that receive
IGameEventCallback pointer, e.g. heroVisit
- CGameHandler now inherits directly from both CPrivilegedInfoCallback
and IGameEventCallback as it did before via IGameCallback
2025-05-14 13:39:41 +03:00
35644da2b7 Reogranize callback-related classes on 1 file = 1 class basis 2025-05-12 22:07:09 +03:00
4b30336d03 Fix issues detected by Sonar 2025-05-11 19:50:57 +03:00
0212b6e37d Remove artifact from slot as reward 2025-05-06 17:28:12 +03:00
283adc37d7 Unit stack rebalancing rework
- CStackInstance::count is now private with accessor methods
- CStackInstance::experience renamed to totalExperience and now stores
total stack experience (multiplied by stack size) to reduce rounding
errors
- CStackInstance::totalExperience is now private with accessors methods
- stack experience is now automatically reallocated on stack management
- Removed buggy BulkSmartRebalanceStacks pack, that mostly duplicates
BulkRebalanceStacks
- Renamed BulkSmartSplitStack to BulkSplitAndRebalanceStack to drop
unclear "smart" in name
- Reworked split-and-rebalance logic to correctly reallocate stack
experience
2025-05-01 18:18:30 +03:00
f70ad2c15b Reorganized artifact-related classes
- files now generally contain only 1 class (except for tightly coupled
classes)
- files are now located in lib/entities/artifact directory
- removed excessive includes

No changes to functionality
2025-04-29 13:29:08 +03:00
4d57a8ed36 Prefer to pass CGameState as reference instead of pointer 2025-04-27 14:57:31 +03:00
896a7ec88e Better support for Adela specialty (+new modding functionality for it)
Fixes Adela specialty that was apparently broken back in #1518 and
replaced with logic that was clearly not tested - it was neither
functional, nor it was following H3 behavior.

- `HAS_ANOTHER_BONUS_LIMITER` now accepts `null` in place of bonus type,
for cases when limiting is needed by bonus source or bonus subtype. This
allows Adela Bless specialty to always work, irregardless of which
bonuses are provided by Bless.
- Implemented `DIVIDE_STACK_LEVEL` updater that functions same as
`TIMES_STACK_LEVEL`, but it divides bonus value, instead of multiplying
it (to make Adela specialty weaker for high-tier units, as in H3)
- Implemented `TIMES_HERO_LEVEL_DIVIDE_STACK_LEVEL` updater that
combines two existing updaters, to implement `val * heroLevel /
unitLevel` formula needed for Adela specialty
- Removed deprecated `ARMY_MOVEMENT` updater. Its functionality has
already been removed in 1.6.X releases, and it was remaining only as a
placeholder
- Updated modding documentation to account for these changes & to remove
some TODO's

Fixed regression from #777 that could led to either duplicated bonuses
or to multiple application of updaters. It introduced double-recursion -
node parents were gathered recursively, and then bonuses were also
collected recursively within each parent. This created situation where
updater could be applied different number of times. For example, hero
bonus that is propagated to unit in combat could be selected directly,
or via hero->combat unit chain, or via hero->garrison unit->combat unit
chains, leading to different calls to updaters if updater handles
garrison unit node type
2025-04-13 16:24:51 +03:00
58a6aabd4c Switch list patching to more user-friendly 1-based indexing 2025-03-30 17:18:47 +03:00
aeb6c0be26 Support for replacement of individual entries in json lists
It is now possible for mods to modify json lists precisely, without full
replacement. Supported options:
- `append`: appends a single item to end of list
- `appendItems`: appends multiple items to end of list
- `insert@NUM`: inserts a single item *before* item NUM (item counting
is 0-based)
- `modify@NUM`: allows editing of a single item NUM (item counting is 0-
based)

Example - addition of a new item into town hall slots:
```json
"hallSlots":
{
	"modify@4" : {
		"append" : [ "dwellingLvl7B", "dwellingUpLvl7B" ]
	}
},
```
This would modify 4th element (last row) by appending new entry to the
end of last row

```json
{
	"modify@4" : {
		"insert@1" : [ "dwellingLvl5B", "dwellingUpLvl5B" ]
	}
},
```
This would add new slot not in the end of last row, but before 1st item
(between 5th and 6th dwellings)
2025-03-27 19:22:50 +00:00
7a3e1409d0 Remove old boost includes and defines 2025-03-19 08:03:56 +00:00
645b95ba02 Renamed LibClasses * VLC to GameLibrary * LIBRARY 2025-02-21 16:54:56 +00:00
0035b2346a optimized search input 2025-01-23 23:50:04 +01:00
ca4227ba9d Add debug information for crash on object randomization 2025-01-07 15:06:49 +00:00
fe51194e22 Merge pull request #5008 from Laserlicht/sprites_test
Tile animation for rivers with xbrz
2024-12-06 14:54:18 +02:00
4b103fd63b code review 2024-12-05 23:31:03 +01:00
e6cd3630e0 fix warning 2024-11-30 17:20:39 +01:00
4945370fe3 Implemented validation of preset - removal of non-existing mods,
addition of newly installed mods
2024-11-26 13:55:46 +00:00
e7bea6c3b8 Merge pull request #4852 from IvanSavenko/remove_vlc_entities_serialization
Remove remaining pointers to VLC entities from serializer
2024-11-06 22:01:11 +02:00
6056d385ed Always load json configs from mod that references it
This should fix rather common problem with mods, where two unrelated mods
accidentally use same file name for a config file, leading to very unclear
conflict since this result in a file override.

Now all config files referenced in mod.json are loaded specifically from
filesystem of mod that referenced it. In other words, it is no longer
possible for one mod to override config from another mod.

As a side effect, this allows mods to use shorter directory layout, e.g.
`config/modName/xxx.json` can now be safely replaced with `config/
xxx.json` without fear of broken mod if there is another mod with same
path to config. Similarly, now all mods can use `config/translation/
language.json` scheme for translation files

Since this is no longer a problem, I've also simplified directory layout
of our built-in 'vcmi' mod, by moving all files from `config/vcmi`
directory directly to `config` directory.

- Overrides for miscellaneous configs like mainmenu.json should works as
before
- Images / animations (png's or def's) work as before (and may still
result in confict)
- Rebalance mods work as before and can modify another mod via standard
`modName:objectName` syntax
2024-10-31 14:49:11 +00:00
d3af9f1c67 Removed pointer to VLC entity from CStackBasicDescriptor 2024-10-30 16:47:02 +00:00