mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Make sure that there is no unwanted stack affect by spells.
This commit is contained in:
parent
39c2c6cde7
commit
1e32c71e47
@ -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;
|
||||
|
@ -578,7 +578,7 @@ std::vector<BattleHex> DefaultSpellMechanics::rangeInHexes(BattleHex centralHex,
|
||||
std::vector<BattleHex> 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<const CStack *> SpecialSpellMechanics::calculateAffectedStacks(const CBattleInfoCallback * cb, const SpellTargetingContext & ctx) const
|
||||
{
|
||||
return std::vector<const CStack *>();
|
||||
}
|
||||
|
@ -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<const CStack *> calculateAffectedStacks(const CBattleInfoCallback * cb, const SpellTargetingContext & ctx) const override;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user