mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Add support for overwriting default range via additional info
This commit is contained in:
parent
01ce01d8f9
commit
f64d6bc1bc
@ -1609,7 +1609,13 @@ bool CBattleInfoCallback::battleHasDistancePenalty(const IBonusBearer * shooter,
|
|||||||
if(auto target = battleGetUnitByPos(destHex, true))
|
if(auto target = battleGetUnitByPos(destHex, true))
|
||||||
{
|
{
|
||||||
//If any hex of target creature is within range, there is no penalty
|
//If any hex of target creature is within range, there is no penalty
|
||||||
if(isEnemyUnitWithinSpecifiedRange(shooterPosition, target, GameConstants::BATTLE_PENALTY_DISTANCE))
|
int range = GameConstants::BATTLE_PENALTY_DISTANCE;
|
||||||
|
|
||||||
|
auto bonus = shooter->getBonus(Selector::type()(Bonus::LIMITED_SHOOTING_RANGE));
|
||||||
|
if(bonus != nullptr && bonus->additionalInfo != CAddInfo::NONE)
|
||||||
|
range = bonus->additionalInfo[0];
|
||||||
|
|
||||||
|
if(isEnemyUnitWithinSpecifiedRange(shooterPosition, target, range))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user