1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Merge pull request #4530 from IvanSavenko/town_fortifications

Support for configurable town fortifications
This commit is contained in:
Ivan Savenko
2024-08-31 13:59:40 +03:00
committed by GitHub
33 changed files with 284 additions and 98 deletions

View File

@@ -248,6 +248,19 @@ bool CGTownInstance::hasCapitol() const
return hasBuilt(BuildingID::CAPITOL);
}
TownFortifications CGTownInstance::fortificationsLevel() const
{
auto result = town->fortifications;
for (auto const & buildingID : builtBuildings)
result += town->buildings.at(buildingID)->fortifications;
if (result.wallsHealth == 0)
return TownFortifications();
return result;
}
CGTownInstance::CGTownInstance(IGameCallback *cb):
CGDwelling(cb),
town(nullptr),
@@ -387,8 +400,6 @@ void CGTownInstance::initializeConfigurableBuildings(vstd::RNG & rand)
DamageRange CGTownInstance::getTowerDamageRange() const
{
assert(hasBuilt(BuildingID::CASTLE));
// http://heroes.thelazy.net/wiki/Arrow_tower
// base damage, irregardless of town level
static constexpr int baseDamage = 6;
@@ -405,8 +416,6 @@ DamageRange CGTownInstance::getTowerDamageRange() const
DamageRange CGTownInstance::getKeepDamageRange() const
{
assert(hasBuilt(BuildingID::CITADEL));
// http://heroes.thelazy.net/wiki/Arrow_tower
// base damage, irregardless of town level
static constexpr int baseDamage = 10;