1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Fix penalties for FLYING_MOVEMENT and WATER_WALKING

This commit is contained in:
ArseniyShestakov 2015-10-23 20:50:52 +03:00
parent fc6f62e633
commit 6ebe2abc1a
4 changed files with 22 additions and 19 deletions

View File

@ -1058,7 +1058,7 @@
{
"bonuses" : [
{
"subtype" : 1,
"subtype" : 3,
"type" : "FLYING_MOVEMENT",
"val" : 0,
"valueType" : "BASE_NUMBER"
@ -1276,7 +1276,7 @@
{
"bonuses" : [
{
"subtype" : 1,
"subtype" : 3,
"type" : "WATER_WALKING",
"val" : 0,
"valueType" : "BASE_NUMBER"

View File

@ -176,7 +176,7 @@
"effects" : {
"fly" : {
"type" : "FLYING_MOVEMENT",
"subtype" : 2,
"subtype" : 1,
"duration" : "ONE_DAY",
"val" : 0 //in fact unused
}
@ -185,14 +185,14 @@
"advanced":{
"effects" : {
"fly" : {
"subtype" : 1
"subtype" : 2
}
}
},
"expert":{
"effects" : {
"fly" : {
"subtype" : 1
"subtype" : 3
}
}
}
@ -214,7 +214,7 @@
"effects" : {
"waterWalk" : {
"type" : "WATER_WALKING",
"subtype" : 2,
"subtype" : 1,
"duration" : "ONE_DAY",
"val" : 0 //in fact unused
}
@ -223,14 +223,14 @@
"advanced":{
"effects" : {
"waterWalk" : {
"subtype" : 1
"subtype" : 2
}
}
},
"expert":{
"effects" : {
"waterWalk" : {
"subtype" : 1
"subtype" : 3
}
}
}

View File

@ -2112,19 +2112,22 @@ int CGameState::getMovementCost(const CGHeroInstance *h, const int3 &src, const
if(d.blocked && h->canFly())
{
bool freeFlying = h->getBonusesCount(Selector::typeSubtype(Bonus::FLYING_MOVEMENT, 1)) > 0;
if(!freeFlying)
{
if(h->hasBonusOfType(Bonus::FLYING_MOVEMENT, 1)) // base flying
ret *= 1.4; //40% penalty for movement over blocked tile
}
else if(h->hasBonusOfType(Bonus::FLYING_MOVEMENT, 2)) // advanced flying
ret *= 1.2;
}
else if (d.terType == ETerrainType::WATER)
else if(d.terType == ETerrainType::WATER)
{
if(h->boat && s.hasFavourableWinds() && d.hasFavourableWinds()) //Favourable Winds
ret *= 0.666;
else if (!h->boat && h->getBonusesCount(Selector::typeSubtype(Bonus::WATER_WALKING, 1)) > 0)
ret *= 1.4; //40% penalty for water walking
else if(!h->boat && h->canWalkOnSea())
{
if(h->hasBonusOfType(Bonus::WATER_WALKING, 1)) // base
ret *= 1.4; //40% penalty for water walking
else if(h->hasBonusOfType(Bonus::WATER_WALKING, 2)) // advanced
ret *= 1.2;
}
}
if(src.x != dest.x && src.y != dest.y) //it's diagonal move
@ -2144,7 +2147,7 @@ int CGameState::getMovementCost(const CGHeroInstance *h, const int3 &src, const
{
std::vector<int3> vec;
vec.reserve(8); //optimization
getNeighbours(d, dest, vec, s.terType != ETerrainType::WATER, true);
getNeighbours(d, dest, vec, s.terType != ETerrainType::WATER, true);
for(auto & elem : vec)
{
int fcost = getMovementCost(h, dest, elem, left, false);

View File

@ -86,13 +86,13 @@ public:
BONUS_NAME(SECONDARY_SKILL_PREMY) /*%*/ \
BONUS_NAME(SURRENDER_DISCOUNT) /*%*/ \
BONUS_NAME(STACKS_SPEED) /*additional info - percent of speed bonus applied after direct bonuses; >0 - added, <0 - subtracted to this part*/ \
BONUS_NAME(FLYING_MOVEMENT) /*subtype 1 - without penalty, 2 - with penalty*/ \
BONUS_NAME(FLYING_MOVEMENT) /*subtype 1 - 40% penalty, 2 - 20% penalty, 3 - without penalty*/ \
BONUS_NAME(SPELL_DURATION) \
BONUS_NAME(AIR_SPELL_DMG_PREMY) \
BONUS_NAME(EARTH_SPELL_DMG_PREMY) \
BONUS_NAME(FIRE_SPELL_DMG_PREMY) \
BONUS_NAME(WATER_SPELL_DMG_PREMY) \
BONUS_NAME(WATER_WALKING) /*subtype 1 - without penalty, 2 - with penalty*/ \
BONUS_NAME(WATER_WALKING) /*subtype 1 - 40% penalty, 2 - 20% penalty, 3 - without penalty*/ \
BONUS_NAME(NEGATE_ALL_NATURAL_IMMUNITIES) \
BONUS_NAME(STACK_HEALTH) \
BONUS_NAME(BLOCK_MORALE) \