mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Merge pull request #123 from ArseniyShestakov/mantis-1230
Okay, now we shouldn't get broken savegames. Merging.
This commit is contained in:
commit
8c9f8f22d9
@ -369,6 +369,11 @@
|
||||
}
|
||||
},
|
||||
|
||||
"NO_TERRAIN_PENALTY":
|
||||
{
|
||||
"hidden": true
|
||||
},
|
||||
|
||||
"NON_LIVING":
|
||||
{
|
||||
"graphics":
|
||||
|
@ -475,6 +475,15 @@
|
||||
"index": 142,
|
||||
"level": 3,
|
||||
"faction": "neutral",
|
||||
"abilities":
|
||||
{
|
||||
"sandWalker" :
|
||||
{
|
||||
"type" : "NO_TERRAIN_PENALTY",
|
||||
"subtype" : 1,
|
||||
"propagator" : "HERO"
|
||||
}
|
||||
},
|
||||
"doubleWide" : true,
|
||||
"graphics" :
|
||||
{
|
||||
|
@ -51,6 +51,7 @@ namespace GameConstants
|
||||
const int SPELLS_QUANTITY=70;
|
||||
const int CREATURES_COUNT = 197;
|
||||
|
||||
const ui32 BASE_MOVEMENT_COST = 100; //default cost for non-diagonal movement
|
||||
}
|
||||
|
||||
class CArtifact;
|
||||
|
@ -216,7 +216,9 @@ public:
|
||||
BONUS_NAME(SPOILS_OF_WAR) /*val * 10^-6 * gained exp resources of subtype will be given to hero after battle*/\
|
||||
BONUS_NAME(BLOCK)\
|
||||
BONUS_NAME(DISGUISED) /* subtype - spell level */\
|
||||
BONUS_NAME(VISIONS) /* subtype - spell level */
|
||||
BONUS_NAME(VISIONS) /* subtype - spell level */\
|
||||
BONUS_NAME(NO_TERRAIN_PENALTY) /* subtype - terrain type */\
|
||||
/* end of list */
|
||||
|
||||
|
||||
#define BONUS_SOURCE_LIST \
|
||||
|
@ -58,8 +58,7 @@ static int lowestSpeed(const CGHeroInstance * chi)
|
||||
|
||||
ui32 CGHeroInstance::getTileCost(const TerrainTile &dest, const TerrainTile &from) const
|
||||
{
|
||||
//base move cost
|
||||
unsigned ret = 100;
|
||||
unsigned ret = GameConstants::BASE_MOVEMENT_COST;
|
||||
|
||||
//if there is road both on dest and src tiles - use road movement cost
|
||||
if(dest.roadType != ERoadType::NO_ROAD && from.roadType != ERoadType::NO_ROAD)
|
||||
@ -81,31 +80,25 @@ ui32 CGHeroInstance::getTileCost(const TerrainTile &dest, const TerrainTile &fro
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if(!hasBonusOfType(Bonus::NO_TERRAIN_PENALTY, from.terType))
|
||||
{
|
||||
//FIXME: in H3 presence of Nomad in army will remove terrain penalty for sand. Bonus not implemented in VCMI
|
||||
|
||||
// NOTE: in H3 neutral stacks will ignore terrain penalty only if placed as topmost stack(s) in hero army.
|
||||
// This is clearly bug in H3 however intended behaviour is not clear.
|
||||
// Current VCMI behaviour will ignore neutrals in calculations so army in VCMI
|
||||
// will always have best penalty without any influence from player-defined stacks order
|
||||
|
||||
bool nativeArmy = true;
|
||||
for(auto stack : stacks)
|
||||
{
|
||||
int nativeTerrain = VLC->townh->factions[stack.second->type->faction]->nativeTerrain;
|
||||
|
||||
if (nativeTerrain != -1 && nativeTerrain != from.terType)
|
||||
{
|
||||
nativeArmy = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!nativeArmy)
|
||||
if(nativeTerrain != -1 && nativeTerrain != from.terType)
|
||||
{
|
||||
ret = VLC->heroh->terrCosts[from.terType];
|
||||
ret-=getSecSkillLevel(SecondarySkill::PATHFINDING)*25;
|
||||
ret = ret < 100 ? 100 : ret;
|
||||
ret -= getSecSkillLevel(SecondarySkill::PATHFINDING) * 25;
|
||||
if(ret < GameConstants::BASE_MOVEMENT_COST)
|
||||
ret = GameConstants::BASE_MOVEMENT_COST;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user