1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00
Files
vcmi/docs/modders/Bonus/Bonus_Updaters.md
2025-05-10 19:16:51 +03:00

81 lines
2.1 KiB
Markdown

# Bonus Updaters
Updaters come in two forms: simple and complex. Simple updaters take no
parameters and are specified as strings. Complex updaters do take
parameters (sometimes optional), and are specified as structs.
Check the files in `config/heroes/` for additional usage examples.
## GROWS_WITH_LEVEL
- Type: Complex
- Parameters: valPer20, stepSize=1
- Effect: Updates val to `ceil(valPer20 * floor(heroLevel / stepSize) / 20)`
Example: The following updater will cause a bonus to grow by 6 for every 40 levels. At first level, rounding will cause the bonus to be 0.
```json
"updater" : {
"parameters" : [ 6, 2 ],
"type" : "GROWS_WITH_LEVEL"
}
```
Example: The following updater will cause a bonus to grow by 3 for every 20 levels. At first level, rounding will cause the bonus to be 1.
```json
"updater" : {
"parameters" : [ 3 ],
"type" : "GROWS_WITH_LEVEL"
}
```
Remarks:
- The rounding rules are designed to match the attack/defense bonus progression for heroes with creature specialties in HMM3.
- There is no point in specifying val for a bonus with a GROWS_WITH_LEVEL updater.
## TIMES_HERO_LEVEL
- Type: Simple
- Effect: Updates val to `val * heroLevel`
Usage: `"updater" : "TIMES_HERO_LEVEL"`
## TIMES_STACK_LEVEL
- Type: Simple
- Effect: Updates val to `val * stackLevel`, where `stackLevel` is level of stack (Pikeman is level 1, Angel is level 7)
Usage:
`"updater" : "TIMES_STACK_LEVEL"`
Remark: The stack level for war machines is 0.
## DIVIDE_STACK_LEVEL
- Type: Simple
- Effect: Updates val to `val / stackLevel`, where `stackLevel` is level of stack (Pikeman is level 1, Angel is level 7)
Usage:
`"updater" : "DIVIDE_STACK_LEVEL"`
Remark: The stack level for war machines is 0.
## TIMES_HERO_LEVEL_DIVIDE_STACK_LEVEL
- Type: Simple
- Effect: Same effect as `TIMES_HERO_LEVEL` combined with `DIVIDE_STACK_LEVEL`: `val * heroLevel / stackLevel`
Intended to be used as hero bonus (such as specialty, skill, or artifact), for bonuses that affect units (Example: Adela Bless specialty)
Usage:
`"updater" : "TIMES_HERO_LEVEL_DIVIDE_STACK_LEVEL"`
## BONUS_OWNER_UPDATER
Helper updater for proper functionality of `OPPOSITE_SIDE` limiter