mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
vcmi: skill-agnostic pathfinding
For now, works exactly as in VCMI and H3. I think we should add some BONUS_TERRAIN_DISCOUNT_PERCENT bonus to discount by percent, like written in pathfinding description
This commit is contained in:
parent
9ffd18c914
commit
6e4372176a
@ -4,8 +4,7 @@
|
|||||||
"base" : {
|
"base" : {
|
||||||
"effects" : {
|
"effects" : {
|
||||||
"main" : {
|
"main" : {
|
||||||
"subtype" : "skill.pathfinding",
|
"type" : "ROUGH_TERRAIN_DISCOUNT",
|
||||||
"type" : "SECONDARY_SKILL_PREMY",
|
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1011,7 +1011,7 @@ TurnInfo::BonusCache::BonusCache(TConstBonusListPtr bl)
|
|||||||
flyingMovementVal = bl->valOfBonuses(Selector::type()(Bonus::FLYING_MOVEMENT));
|
flyingMovementVal = bl->valOfBonuses(Selector::type()(Bonus::FLYING_MOVEMENT));
|
||||||
waterWalking = static_cast<bool>(bl->getFirst(Selector::type()(Bonus::WATER_WALKING)));
|
waterWalking = static_cast<bool>(bl->getFirst(Selector::type()(Bonus::WATER_WALKING)));
|
||||||
waterWalkingVal = bl->valOfBonuses(Selector::type()(Bonus::WATER_WALKING));
|
waterWalkingVal = bl->valOfBonuses(Selector::type()(Bonus::WATER_WALKING));
|
||||||
pathfindingVal = bl->valOfBonuses(Selector::typeSubtype(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::PATHFINDING));
|
pathfindingVal = bl->valOfBonuses(Selector::type()(Bonus::ROUGH_TERRAIN_DISCOUNT));
|
||||||
}
|
}
|
||||||
|
|
||||||
TurnInfo::TurnInfo(const CGHeroInstance * Hero, const int turn)
|
TurnInfo::TurnInfo(const CGHeroInstance * Hero, const int turn)
|
||||||
@ -1068,8 +1068,7 @@ int TurnInfo::valOfBonuses(Bonus::BonusType type, int subtype) const
|
|||||||
return bonusCache->flyingMovementVal;
|
return bonusCache->flyingMovementVal;
|
||||||
case Bonus::WATER_WALKING:
|
case Bonus::WATER_WALKING:
|
||||||
return bonusCache->waterWalkingVal;
|
return bonusCache->waterWalkingVal;
|
||||||
case Bonus::SECONDARY_SKILL_PREMY:
|
case Bonus::ROUGH_TERRAIN_DISCOUNT:
|
||||||
if (subtype == SecondarySkill::PATHFINDING)
|
|
||||||
return bonusCache->pathfindingVal;
|
return bonusCache->pathfindingVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,6 +336,7 @@ public:
|
|||||||
BONUS_NAME(LEARN_BATTLE_SPELL_LEVEL_LIMIT) /*skill-agnostic eagle eye limit, subtype - school (-1 for all), others TODO*/\
|
BONUS_NAME(LEARN_BATTLE_SPELL_LEVEL_LIMIT) /*skill-agnostic eagle eye limit, subtype - school (-1 for all), others TODO*/\
|
||||||
BONUS_NAME(PERCENTAGE_DAMAGE_BOOST) /*skill-agnostic archery and offence, subtype is 0 for offence and 1 for archery*/\
|
BONUS_NAME(PERCENTAGE_DAMAGE_BOOST) /*skill-agnostic archery and offence, subtype is 0 for offence and 1 for archery*/\
|
||||||
BONUS_NAME(LEARN_MEETING_SPELL_LIMIT) /*skill-agnostic scholar, subtype is -1 for all, TODO for others (> 0)*/\
|
BONUS_NAME(LEARN_MEETING_SPELL_LIMIT) /*skill-agnostic scholar, subtype is -1 for all, TODO for others (> 0)*/\
|
||||||
|
BONUS_NAME(ROUGH_TERRAIN_DISCOUNT) /*skill-agnostic pathfinding*/\
|
||||||
/* end of list */
|
/* end of list */
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ ui32 CGHeroInstance::getTileCost(const TerrainTile & dest, const TerrainTile & f
|
|||||||
{
|
{
|
||||||
|
|
||||||
ret = VLC->heroh->terrCosts[from.terType->getId()];
|
ret = VLC->heroh->terrCosts[from.terType->getId()];
|
||||||
ret -= ti->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::PATHFINDING);
|
ret -= ti->valOfBonuses(Bonus::ROUGH_TERRAIN_DISCOUNT);
|
||||||
if(ret < GameConstants::BASE_MOVEMENT_COST)
|
if(ret < GameConstants::BASE_MOVEMENT_COST)
|
||||||
ret = GameConstants::BASE_MOVEMENT_COST;
|
ret = GameConstants::BASE_MOVEMENT_COST;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user