1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-05 00:49:09 +02:00

Do not show full damage range limit for units without range penalty

This commit is contained in:
Ivan Savenko
2025-01-26 15:51:09 +00:00
parent d54d498d5f
commit 112de6324f
2 changed files with 9 additions and 4 deletions

View File

@ -48,6 +48,10 @@
{ {
"type" : "SHOOTER" "type" : "SHOOTER"
}, },
"noDistancePenalty" :
{
"type" : "NO_DISTANCE_PENALTY" // hide shooting range visualization
},
"siegeMachine" : "siegeMachine" :
{ {
"type" : "CATAPULT", "type" : "CATAPULT",

View File

@ -605,17 +605,18 @@ uint8_t CUnitState::getRangedFullDamageDistance() const
if(!isShooter()) if(!isShooter())
return 0; return 0;
uint8_t rangedFullDamageDistance = GameConstants::BATTLE_SHOOTING_PENALTY_DISTANCE;
// overwrite full ranged damage distance with the value set in Additional info field of LIMITED_SHOOTING_RANGE bonus // overwrite full ranged damage distance with the value set in Additional info field of LIMITED_SHOOTING_RANGE bonus
if(hasBonusOfType(BonusType::LIMITED_SHOOTING_RANGE)) if(hasBonusOfType(BonusType::LIMITED_SHOOTING_RANGE))
{ {
auto bonus = this->getBonus(Selector::type()(BonusType::LIMITED_SHOOTING_RANGE)); auto bonus = this->getBonus(Selector::type()(BonusType::LIMITED_SHOOTING_RANGE));
if(bonus != nullptr && bonus->additionalInfo != CAddInfo::NONE) if(bonus != nullptr && bonus->additionalInfo != CAddInfo::NONE)
rangedFullDamageDistance = bonus->additionalInfo[0]; return bonus->additionalInfo[0];
} }
return rangedFullDamageDistance; if (hasBonusOfType(BonusType::NO_DISTANCE_PENALTY))
return GameConstants::BATTLE_SHOOTING_RANGE_DISTANCE;
return GameConstants::BATTLE_SHOOTING_PENALTY_DISTANCE;
} }
uint8_t CUnitState::getShootingRangeDistance() const uint8_t CUnitState::getShootingRangeDistance() const