1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Move isMeleeAttacker to Unit

This commit is contained in:
Andrej Dudenhefner
2025-11-07 12:13:16 +01:00
parent 31c093baae
commit 7c4b7aa3f0
4 changed files with 17 additions and 18 deletions

View File

@@ -38,6 +38,22 @@ bool Unit::isTurret() const
return creatureIndex() == CreatureID::ARROW_TOWERS;
}
bool Unit::isMeleeAttacker() const
{
//exclude non melee attackers
static const std::set<CreatureID> nonMeleeAttackers{
CreatureID::FIRST_AID_TENT,
CreatureID::CATAPULT,
CreatureID::BALLISTA,
CreatureID::AMMO_CART,
CreatureID::ARROW_TOWERS
};
if (vstd::contains(nonMeleeAttackers, creatureId()))
return false;
return true;
}
std::string Unit::getDescription() const
{
boost::format fmt("Unit %d of side %d");