|
@@ -27,7 +27,7 @@ bool INativeTerrainProvider::isNativeTerrain(TerrainId terrain) const
|
|
|
return native == terrain || native == ETerrainId::ANY_TERRAIN;
|
|
|
}
|
|
|
|
|
|
-TerrainId IFactionMember::getNativeTerrain() const
|
|
|
+TerrainId AFactionMember::getNativeTerrain() const
|
|
|
{
|
|
|
constexpr auto any = TerrainId(ETerrainId::ANY_TERRAIN);
|
|
|
const std::string cachingStringNoTerrainPenalty = "type_NO_TERRAIN_PENALTY_sANY";
|
|
@@ -39,14 +39,14 @@ TerrainId IFactionMember::getNativeTerrain() const
|
|
|
? any : VLC->factions()->getById(getFaction())->getNativeTerrain();
|
|
|
}
|
|
|
|
|
|
-int32_t IFactionMember::magicResistance() const
|
|
|
+int32_t AFactionMember::magicResistance() const
|
|
|
{
|
|
|
si32 val = getBonusBearer()->valOfBonuses(Selector::type()(Bonus::MAGIC_RESISTANCE));
|
|
|
vstd::amin (val, 100);
|
|
|
return val;
|
|
|
}
|
|
|
|
|
|
-int IFactionMember::getAttack(bool ranged) const
|
|
|
+int AFactionMember::getAttack(bool ranged) const
|
|
|
{
|
|
|
const std::string cachingStr = "type_PRIMARY_SKILLs_ATTACK";
|
|
|
|
|
@@ -55,7 +55,7 @@ int IFactionMember::getAttack(bool ranged) const
|
|
|
return getBonusBearer()->valOfBonuses(selector, cachingStr);
|
|
|
}
|
|
|
|
|
|
-int IFactionMember::getDefense(bool ranged) const
|
|
|
+int AFactionMember::getDefense(bool ranged) const
|
|
|
{
|
|
|
const std::string cachingStr = "type_PRIMARY_SKILLs_DEFENSE";
|
|
|
|
|
@@ -64,21 +64,21 @@ int IFactionMember::getDefense(bool ranged) const
|
|
|
return getBonusBearer()->valOfBonuses(selector, cachingStr);
|
|
|
}
|
|
|
|
|
|
-int IFactionMember::getMinDamage(bool ranged) const
|
|
|
+int AFactionMember::getMinDamage(bool ranged) const
|
|
|
{
|
|
|
const std::string cachingStr = "type_CREATURE_DAMAGEs_0Otype_CREATURE_DAMAGEs_1";
|
|
|
static const auto selector = Selector::typeSubtype(Bonus::CREATURE_DAMAGE, 0).Or(Selector::typeSubtype(Bonus::CREATURE_DAMAGE, 1));
|
|
|
return getBonusBearer()->valOfBonuses(selector, cachingStr);
|
|
|
}
|
|
|
|
|
|
-int IFactionMember::getMaxDamage(bool ranged) const
|
|
|
+int AFactionMember::getMaxDamage(bool ranged) const
|
|
|
{
|
|
|
const std::string cachingStr = "type_CREATURE_DAMAGEs_0Otype_CREATURE_DAMAGEs_2";
|
|
|
static const auto selector = Selector::typeSubtype(Bonus::CREATURE_DAMAGE, 0).Or(Selector::typeSubtype(Bonus::CREATURE_DAMAGE, 2));
|
|
|
return getBonusBearer()->valOfBonuses(selector, cachingStr);
|
|
|
}
|
|
|
|
|
|
-int IFactionMember::getPrimSkillLevel(PrimarySkill::PrimarySkill id) const
|
|
|
+int AFactionMember::getPrimSkillLevel(PrimarySkill::PrimarySkill id) const
|
|
|
{
|
|
|
static const CSelector selectorAllSkills = Selector::type()(Bonus::PRIMARY_SKILL);
|
|
|
static const std::string keyAllSkills = "type_PRIMARY_SKILL";
|
|
@@ -88,12 +88,12 @@ int IFactionMember::getPrimSkillLevel(PrimarySkill::PrimarySkill id) const
|
|
|
return std::max(ret, minSkillValue); //otherwise, some artifacts may cause negative skill value effect, sp=0 works in old saves
|
|
|
}
|
|
|
|
|
|
-int IFactionMember::MoraleValAndBonusList(TConstBonusListPtr & bonusList) const
|
|
|
+int AFactionMember::MoraleValAndBonusList(TConstBonusListPtr & bonusList) const
|
|
|
{
|
|
|
static const auto unaffectedByMoraleSelector = Selector::type()(Bonus::NON_LIVING).Or(Selector::type()(Bonus::UNDEAD))
|
|
|
.Or(Selector::type()(Bonus::SIEGE_WEAPON)).Or(Selector::type()(Bonus::NO_MORALE));
|
|
|
|
|
|
- static const std::string cachingStrUn = "IFactionMember::unaffectedByMoraleSelector";
|
|
|
+ static const std::string cachingStrUn = "AFactionMember::unaffectedByMoraleSelector";
|
|
|
auto unaffected = getBonusBearer()->hasBonus(unaffectedByMoraleSelector, cachingStrUn);
|
|
|
if(unaffected)
|
|
|
{
|
|
@@ -109,7 +109,7 @@ int IFactionMember::MoraleValAndBonusList(TConstBonusListPtr & bonusList) const
|
|
|
return std::clamp(bonusList->totalValue(), -3, +3);
|
|
|
}
|
|
|
|
|
|
-int IFactionMember::LuckValAndBonusList(TConstBonusListPtr & bonusList) const
|
|
|
+int AFactionMember::LuckValAndBonusList(TConstBonusListPtr & bonusList) const
|
|
|
{
|
|
|
if(getBonusBearer()->hasBonusOfType(Bonus::NO_LUCK))
|
|
|
{
|
|
@@ -125,19 +125,19 @@ int IFactionMember::LuckValAndBonusList(TConstBonusListPtr & bonusList) const
|
|
|
return std::clamp(bonusList->totalValue(), -3, +3);
|
|
|
}
|
|
|
|
|
|
-int IFactionMember::MoraleVal() const
|
|
|
+int AFactionMember::MoraleVal() const
|
|
|
{
|
|
|
TConstBonusListPtr tmp = nullptr;
|
|
|
return MoraleValAndBonusList(tmp);
|
|
|
}
|
|
|
|
|
|
-int IFactionMember::LuckVal() const
|
|
|
+int AFactionMember::LuckVal() const
|
|
|
{
|
|
|
TConstBonusListPtr tmp = nullptr;
|
|
|
return LuckValAndBonusList(tmp);
|
|
|
}
|
|
|
|
|
|
-ui32 ICreature::MaxHealth() const
|
|
|
+ui32 ACreature::MaxHealth() const
|
|
|
{
|
|
|
const std::string cachingStr = "type_STACK_HEALTH";
|
|
|
static const auto selector = Selector::type()(Bonus::STACK_HEALTH);
|
|
@@ -145,7 +145,7 @@ ui32 ICreature::MaxHealth() const
|
|
|
return std::max(1, value); //never 0
|
|
|
}
|
|
|
|
|
|
-ui32 ICreature::Speed(int turn, bool useBind) const
|
|
|
+ui32 ACreature::Speed(int turn, bool useBind) const
|
|
|
{
|
|
|
//war machines cannot move
|
|
|
if(getBonusBearer()->hasBonus(Selector::type()(Bonus::SIEGE_WEAPON).And(Selector::turns(turn))))
|
|
@@ -161,9 +161,9 @@ ui32 ICreature::Speed(int turn, bool useBind) const
|
|
|
return getBonusBearer()->valOfBonuses(Selector::type()(Bonus::STACKS_SPEED).And(Selector::turns(turn)));
|
|
|
}
|
|
|
|
|
|
-bool ICreature::isLiving() const //TODO: theoreticaly there exists "LIVING" bonus in stack experience documentation
|
|
|
+bool ACreature::isLiving() const //TODO: theoreticaly there exists "LIVING" bonus in stack experience documentation
|
|
|
{
|
|
|
- static const std::string cachingStr = "ICreature::isLiving";
|
|
|
+ static const std::string cachingStr = "ACreature::isLiving";
|
|
|
static const CSelector selector = Selector::type()(Bonus::UNDEAD)
|
|
|
.Or(Selector::type()(Bonus::NON_LIVING))
|
|
|
.Or(Selector::type()(Bonus::GARGOYLE))
|