diff --git a/config/creatures/special.json b/config/creatures/special.json index 4e528117a..6031034c1 100644 --- a/config/creatures/special.json +++ b/config/creatures/special.json @@ -48,6 +48,10 @@ { "type" : "SHOOTER" }, + "noDistancePenalty" : + { + "type" : "NO_DISTANCE_PENALTY" // hide shooting range visualization + }, "siegeMachine" : { "type" : "CATAPULT", diff --git a/lib/battle/CUnitState.cpp b/lib/battle/CUnitState.cpp index f9a2a44d3..1113705c3 100644 --- a/lib/battle/CUnitState.cpp +++ b/lib/battle/CUnitState.cpp @@ -605,17 +605,18 @@ uint8_t CUnitState::getRangedFullDamageDistance() const if(!isShooter()) 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 if(hasBonusOfType(BonusType::LIMITED_SHOOTING_RANGE)) { auto bonus = this->getBonus(Selector::type()(BonusType::LIMITED_SHOOTING_RANGE)); 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