mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-29 00:41:38 +02:00
First working prototype that mimics rangedFullDamageLimit code
Next step is to create more generic functions that can be shared between the 2.
This commit is contained in:
@ -609,6 +609,24 @@ uint8_t CUnitState::getRangedFullDamageDistance() const
|
||||
return rangedFullDamageDistance;
|
||||
}
|
||||
|
||||
uint8_t CUnitState::getSootingRangeDistance() const
|
||||
{
|
||||
if(!isShooter())
|
||||
return 0;
|
||||
|
||||
uint8_t shootingRangeDistance = GameConstants::BATTLE_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)))
|
||||
{
|
||||
auto bonus = this->getBonus(Selector::type()(BonusType::LIMITED_SHOOTING_RANGE));
|
||||
if(bonus != nullptr)
|
||||
shootingRangeDistance = bonus->val;
|
||||
}
|
||||
|
||||
return shootingRangeDistance;
|
||||
}
|
||||
|
||||
bool CUnitState::canMove(int turn) const
|
||||
{
|
||||
return alive() && !hasBonus(Selector::type()(BonusType::NOT_ACTIVE).And(Selector::turns(turn))); //eg. Ammo Cart or blinded creature
|
||||
|
Reference in New Issue
Block a user