mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
AI will now devalue the usefulness of non-flying units when attacking defensive structures in order to prevent suiciding against castles
This commit is contained in:
@@ -353,11 +353,23 @@ bool CCreatureSet::needsLastStack() const
|
||||
return false;
|
||||
}
|
||||
|
||||
ui64 CCreatureSet::getArmyStrength() const
|
||||
ui64 CCreatureSet::getArmyStrength(int fortLevel) const
|
||||
{
|
||||
ui64 ret = 0;
|
||||
for(const auto & elem : stacks)
|
||||
ret += elem.second->getPower();
|
||||
for (const auto& elem : stacks)
|
||||
{
|
||||
ui64 powerToAdd = elem.second->getPower();
|
||||
if (fortLevel > 0)
|
||||
{
|
||||
if (!elem.second->hasBonusOfType(BonusType::FLYING))
|
||||
{
|
||||
powerToAdd /= fortLevel;
|
||||
if (!elem.second->hasBonusOfType(BonusType::SHOOTER))
|
||||
powerToAdd /= fortLevel;
|
||||
}
|
||||
}
|
||||
ret += powerToAdd;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user