diff --git a/client/battle/CBattleInterface.cpp b/client/battle/CBattleInterface.cpp index 7571da324..3c3630139 100644 --- a/client/battle/CBattleInterface.cpp +++ b/client/battle/CBattleInterface.cpp @@ -1553,8 +1553,12 @@ void CBattleInterface::castThisSpell(int spellID) const CSpell::TargetInfo ti = sp->getTargetInfo(castingHero->getSpellSchoolLevel(sp)); - if(ti.massive) + if(ti.massive || ti.type == CSpell::NO_TARGET) spellSelMode = NO_LOCATION; + else if(ti.type == CSpell::LOCATION && ti.clearAffected) + { + spellSelMode = FREE_LOCATION; + } else if(ti.type == CSpell::CREATURE) { if(ti.smart) @@ -1566,11 +1570,6 @@ void CBattleInterface::castThisSpell(int spellID) { spellSelMode = OBSTACLE; } - //todo: move to JSON config - if(spellID == SpellID::FIRE_WALL || spellID == SpellID::FORCE_FIELD) - { - spellSelMode = FREE_LOCATION; - } if (spellSelMode == NO_LOCATION) //user does not have to select location { diff --git a/lib/CSpellHandler.cpp b/lib/CSpellHandler.cpp index 571925c4b..42180e655 100644 --- a/lib/CSpellHandler.cpp +++ b/lib/CSpellHandler.cpp @@ -503,7 +503,9 @@ void CSpell::TargetInfo::init(const CSpell * spell, const int level) smart = levelInfo.smartTarget; massive = levelInfo.range == "X"; onlyAlive = !spell->isRisingSpell(); - alwaysHitDirectly = false; + alwaysHitDirectly = false; + clearAffected = levelInfo.clearAffected; + clearTarget = levelInfo.clearTarget; } diff --git a/lib/CSpellHandler.h b/lib/CSpellHandler.h index 32a499c8b..eb74f29dc 100644 --- a/lib/CSpellHandler.h +++ b/lib/CSpellHandler.h @@ -139,6 +139,9 @@ public: ///no immunity on primary target (mostly spell-like attack) bool alwaysHitDirectly; + bool clearTarget; + bool clearAffected; + TargetInfo(const CSpell * spell, const int level); TargetInfo(const CSpell * spell, const int level, ECastingMode::ECastingMode mode);