diff --git a/lib/spells/BattleSpellMechanics.h b/lib/spells/BattleSpellMechanics.h index f2812d988..dadfa36b4 100644 --- a/lib/spells/BattleSpellMechanics.h +++ b/lib/spells/BattleSpellMechanics.h @@ -78,10 +78,10 @@ protected: void applyBattleEffects(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override; }; -class DLL_LINKAGE EarthquakeMechanics : public DefaultSpellMechanics +class DLL_LINKAGE EarthquakeMechanics : public SpecialSpellMechanics { public: - EarthquakeMechanics(CSpell * s): DefaultSpellMechanics(s){}; + EarthquakeMechanics(CSpell * s): SpecialSpellMechanics(s){}; ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const ISpellCaster * caster) const override; bool requiresCreatureTarget() const override; protected: @@ -95,10 +95,10 @@ public: ESpellCastProblem::ESpellCastProblem isImmuneByStack(const ISpellCaster * caster, const CStack * obj) const override; }; -class DLL_LINKAGE ObstacleMechanics : public DefaultSpellMechanics +class DLL_LINKAGE ObstacleMechanics : public SpecialSpellMechanics { public: - ObstacleMechanics(CSpell * s): DefaultSpellMechanics(s){}; + ObstacleMechanics(CSpell * s): SpecialSpellMechanics(s){}; ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const SpellTargetingContext & ctx) const override; protected: void placeObstacle(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, const BattleHex & pos) const; @@ -158,10 +158,10 @@ protected: void setupObstacle(SpellCreatedObstacle * obstacle) const override; }; -class DLL_LINKAGE RemoveObstacleMechanics : public DefaultSpellMechanics +class DLL_LINKAGE RemoveObstacleMechanics : public SpecialSpellMechanics { public: - RemoveObstacleMechanics(CSpell * s): DefaultSpellMechanics(s){}; + RemoveObstacleMechanics(CSpell * s): SpecialSpellMechanics(s){}; ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const ISpellCaster * caster) const override; ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const SpellTargetingContext & ctx) const override; bool requiresCreatureTarget() const override; @@ -201,10 +201,10 @@ public: ESpellCastProblem::ESpellCastProblem isImmuneByStack(const ISpellCaster * caster, const CStack * obj) const override; }; -class DLL_LINKAGE SummonMechanics : public DefaultSpellMechanics +class DLL_LINKAGE SummonMechanics : public SpecialSpellMechanics { public: - SummonMechanics(CSpell * s, CreatureID cre): DefaultSpellMechanics(s), creatureToSummon(cre){}; + SummonMechanics(CSpell * s, CreatureID cre): SpecialSpellMechanics(s), creatureToSummon(cre){}; ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const ISpellCaster * caster) const override; bool requiresCreatureTarget() const override; diff --git a/lib/spells/CDefaultSpellMechanics.cpp b/lib/spells/CDefaultSpellMechanics.cpp index 37229855d..4105e0151 100644 --- a/lib/spells/CDefaultSpellMechanics.cpp +++ b/lib/spells/CDefaultSpellMechanics.cpp @@ -578,7 +578,7 @@ std::vector DefaultSpellMechanics::rangeInHexes(BattleHex centralHex, std::vector ret; std::string rng = owner->getLevelInfo(schoolLvl).range + ','; //copy + artificial comma for easier handling - if(rng.size() >= 2 && rng[0] != 'X') //there is at lest one hex in range (+artificial comma) + if(rng.size() >= 2 && rng[0] != 'X') //there is at least one hex in range (+artificial comma) { std::string number1, number2; int beg, end; @@ -810,3 +810,9 @@ bool DefaultSpellMechanics::requiresCreatureTarget() const //for few exceptions see overrides return true; } + + +std::vector SpecialSpellMechanics::calculateAffectedStacks(const CBattleInfoCallback * cb, const SpellTargetingContext & ctx) const +{ + return std::vector(); +} diff --git a/lib/spells/CDefaultSpellMechanics.h b/lib/spells/CDefaultSpellMechanics.h index 1e5b0ee09..ad9a5f1b1 100644 --- a/lib/spells/CDefaultSpellMechanics.h +++ b/lib/spells/CDefaultSpellMechanics.h @@ -15,7 +15,7 @@ class DefaultSpellMechanics; -class SpellCastContext +class DLL_LINKAGE SpellCastContext { public: const DefaultSpellMechanics * mechanics; @@ -72,3 +72,12 @@ private: friend class SpellCastContext; }; + +///not affecting creatures directly +class DLL_LINKAGE SpecialSpellMechanics : public DefaultSpellMechanics +{ +public: + SpecialSpellMechanics(CSpell * s): DefaultSpellMechanics(s){}; +protected: + std::vector calculateAffectedStacks(const CBattleInfoCallback * cb, const SpellTargetingContext & ctx) const override; +};