1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Support for configuring minimal cost for moving between tiles

- Added `movementCostBase` parameter to game config that defines minimal
amount of movement points that will be spent when moving from one tile
on another while offroad (and cost of Fly / Town Portal spells)
- Added `BASE_TILE_MOVEMENT_COST` bonus type that allows modifying
`movementCostBase` on per-hero basis

Example usage for hota-like pathfinding skill
```json
"tileCostReduction" : {
	"type" : "BASE_TILE_MOVEMENT_COST",
	"val" : -15
}
```
This commit is contained in:
Ivan Savenko
2025-01-24 17:46:18 +00:00
parent b36f5e4026
commit ec970c7b22
18 changed files with 80 additions and 37 deletions

View File

@@ -17,6 +17,7 @@
#include "../../../lib/pathfinder/CPathfinder.h"
#include "../../../lib/pathfinder/PathfinderOptions.h"
#include "../../../lib/pathfinder/PathfinderUtil.h"
#include "../../../lib/IGameSettings.h"
#include "../../../lib/CPlayerState.h"
AINodeStorage::AINodeStorage(const int3 & Sizes)
@@ -246,7 +247,8 @@ void AINodeStorage::calculateTownPortalTeleportations(
// TODO: Copy/Paste from TownPortalMechanics
auto skillLevel = hero->getSpellSchoolLevel(townPortal);
auto movementCost = GameConstants::BASE_MOVEMENT_COST * (skillLevel >= 3 ? 2 : 3);
int baseCost = hero->cb->getSettings().getInteger(EGameSettings::HEROES_MOVEMENT_COST_BASE);
auto movementCost = baseCost * (skillLevel >= 3 ? 2 : 3);
if(hero->movementPointsRemaining() < movementCost)
{