From 0ffc440b5382c5ea2d2c39cad8424b1f2d9c0a22 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Tue, 21 Mar 2023 17:56:15 +0300 Subject: [PATCH] vcmi: fix target condition regression --- lib/spells/TargetCondition.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/spells/TargetCondition.cpp b/lib/spells/TargetCondition.cpp index 8ab31af60..ff3b5e9c0 100644 --- a/lib/spells/TargetCondition.cpp +++ b/lib/spells/TargetCondition.cpp @@ -118,10 +118,7 @@ protected: cachingStr << "type_" << Bonus::LEVEL_SPELL_IMMUNITY << "addInfo_1"; TConstBonusListPtr levelImmunities = target->getBonuses(Selector::type()(Bonus::LEVEL_SPELL_IMMUNITY).And(Selector::info()(1)), cachingStr.str()); - - return levelImmunities->size() == 0 || - levelImmunities->totalValue() < m->getSpellLevel() || - m->getSpellLevel() <= 0; + return (levelImmunities->size() == 0 || levelImmunities->totalValue() < m->getSpellLevel() || m->getSpellLevel() <= 0); } }; @@ -331,7 +328,7 @@ public: auto it = bonusNameMap.find(identifier); if(it != bonusNameMap.end()) return std::make_shared(Selector::type()(it->second)); - + auto params = BonusParams(identifier, "", -1); if(params.isConverted) { @@ -373,7 +370,7 @@ public: } Object createFromJsonStruct(const JsonNode & jsonStruct) const override - { + { auto type = jsonStruct["type"].String(); auto parameters = jsonStruct["parameters"]; if(type == "selector") @@ -519,7 +516,7 @@ void TargetCondition::loadConditions(const JsonNode & source, bool exclusive, bo CModHandler::parseIdentifier(keyValue.first, scope, type, identifier); - std::shared_ptr item = itemFactory->createConfigurable(scope, type, identifier); + item = itemFactory->createConfigurable(scope, type, identifier); } if(item)