1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Added constant for BATTLE_SHOOTING_RANGE_DISTANCE

This commit is contained in:
krs 2023-06-18 01:22:34 +03:00
parent e668ea3a03
commit 756dd398c2
3 changed files with 6 additions and 5 deletions

View File

@ -56,7 +56,8 @@ namespace GameConstants
constexpr int HERO_GOLD_COST = 2500;
constexpr int SPELLBOOK_GOLD_COST = 500;
constexpr int SKILL_GOLD_COST = 2000;
constexpr int BATTLE_PENALTY_DISTANCE = 10; //if the distance is > than this, then shooting stack has distance penalty
constexpr int BATTLE_SHOOTING_PENALTY_DISTANCE = 10; //if the distance is > than this, then shooting stack has distance penalty
constexpr int BATTLE_SHOOTING_RANGE_DISTANCE = std::numeric_limits<uint8_t>::max(); // used when shooting stack has no shooting range limit
constexpr int ARMY_SIZE = 7;
constexpr int SKILL_PER_HERO = 8;
constexpr ui32 HERO_HIGH_LEVEL = 10; // affects primary skill upgrade order

View File

@ -1456,7 +1456,7 @@ bool CBattleInfoCallback::battleHasDistancePenalty(const IBonusBearer * shooter,
if(const auto * target = battleGetUnitByPos(destHex, true))
{
//If any hex of target creature is within range, there is no penalty
int range = GameConstants::BATTLE_PENALTY_DISTANCE;
int range = GameConstants::BATTLE_SHOOTING_PENALTY_DISTANCE;
auto bonus = shooter->getBonus(Selector::type()(BonusType::LIMITED_SHOOTING_RANGE));
if(bonus != nullptr && bonus->additionalInfo != CAddInfo::NONE)
@ -1467,7 +1467,7 @@ bool CBattleInfoCallback::battleHasDistancePenalty(const IBonusBearer * shooter,
}
else
{
if(BattleHex::getDistance(shooterPosition, destHex) <= GameConstants::BATTLE_PENALTY_DISTANCE)
if(BattleHex::getDistance(shooterPosition, destHex) <= GameConstants::BATTLE_SHOOTING_PENALTY_DISTANCE)
return false;
}

View File

@ -596,7 +596,7 @@ uint8_t CUnitState::getRangedFullDamageDistance() const
if(!isShooter())
return 0;
uint8_t rangedFullDamageDistance = GameConstants::BATTLE_PENALTY_DISTANCE;
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(this->hasBonus(Selector::type()(BonusType::LIMITED_SHOOTING_RANGE)))
@ -614,7 +614,7 @@ uint8_t CUnitState::getSootingRangeDistance() const
if(!isShooter())
return 0;
uint8_t shootingRangeDistance = 255; // no range limit for shooters
uint8_t shootingRangeDistance = GameConstants::BATTLE_SHOOTING_RANGE_DISTANCE;
// overwrite full ranged damage distance with the value set in Additional info field of LIMITED_SHOOTING_RANGE bonus
if(this->hasBonus(Selector::type()(BonusType::LIMITED_SHOOTING_RANGE)))