diff --git a/lib/HeroBonus.h b/lib/HeroBonus.h index d120f8df9..a94e21c95 100644 --- a/lib/HeroBonus.h +++ b/lib/HeroBonus.h @@ -330,7 +330,8 @@ public: BONUS_NAME(GARGOYLE) /* gargoyle is special than NON_LIVING, cannot be rised or healed */ \ BONUS_NAME(SPECIAL_ADD_VALUE_ENCHANT) /*specialty spell like Aenin has, increased effect of spell, additionalInfo = value to add*/\ BONUS_NAME(SPECIAL_FIXED_VALUE_ENCHANT) /*specialty spell like Melody has, constant spell effect (i.e. 3 luck), additionalInfo = value to fix.*/\ - BONUS_NAME(TOWN_MAGIC_WELL) /*one-time pseudo-bonus to implement Magic Well in the town*/ \ + BONUS_NAME(TOWN_MAGIC_WELL) /*one-time pseudo-bonus to implement Magic Well in the town*/\ + BONUS_NAME(LIMITED_SHOOTING_RANGE) /*limits range of shooting creatures, doesn't adjust any other mechanics (half vs full damage etc). val - range in hexes*/\ /* end of list */ diff --git a/lib/battle/CBattleInfoCallback.cpp b/lib/battle/CBattleInfoCallback.cpp index c4bae673b..a4caac6a2 100644 --- a/lib/battle/CBattleInfoCallback.cpp +++ b/lib/battle/CBattleInfoCallback.cpp @@ -702,13 +702,13 @@ bool CBattleInfoCallback::battleCanShoot(const battle::Unit * attacker, BattleHe { if(battleCanShoot(attacker)) { - auto shooterBonus = attacker->getBonus(Selector::type()(Bonus::SHOOTER)); - if(shooterBonus->additionalInfo == CAddInfo::NONE) + auto limitedRangeBonus = attacker->getBonus(Selector::type()(Bonus::LIMITED_SHOOTING_RANGE)); + if(limitedRangeBonus == nullptr) { return true; } - int shootingRange = shooterBonus->additionalInfo[0]; + int shootingRange = limitedRangeBonus->val; int distanceBetweenHexes = BattleHex::getDistance(attacker->getPosition(), dest); if(distanceBetweenHexes <= shootingRange)