mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +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;
|
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:
|
public:
|
||||||
EarthquakeMechanics(CSpell * s): DefaultSpellMechanics(s){};
|
EarthquakeMechanics(CSpell * s): SpecialSpellMechanics(s){};
|
||||||
ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const ISpellCaster * caster) const override;
|
ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const ISpellCaster * caster) const override;
|
||||||
bool requiresCreatureTarget() const override;
|
bool requiresCreatureTarget() const override;
|
||||||
protected:
|
protected:
|
||||||
@ -95,10 +95,10 @@ public:
|
|||||||
ESpellCastProblem::ESpellCastProblem isImmuneByStack(const ISpellCaster * caster, const CStack * obj) const override;
|
ESpellCastProblem::ESpellCastProblem isImmuneByStack(const ISpellCaster * caster, const CStack * obj) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DLL_LINKAGE ObstacleMechanics : public DefaultSpellMechanics
|
class DLL_LINKAGE ObstacleMechanics : public SpecialSpellMechanics
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObstacleMechanics(CSpell * s): DefaultSpellMechanics(s){};
|
ObstacleMechanics(CSpell * s): SpecialSpellMechanics(s){};
|
||||||
ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const SpellTargetingContext & ctx) const override;
|
ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const SpellTargetingContext & ctx) const override;
|
||||||
protected:
|
protected:
|
||||||
void placeObstacle(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, const BattleHex & pos) const;
|
void placeObstacle(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, const BattleHex & pos) const;
|
||||||
@ -158,10 +158,10 @@ protected:
|
|||||||
void setupObstacle(SpellCreatedObstacle * obstacle) const override;
|
void setupObstacle(SpellCreatedObstacle * obstacle) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DLL_LINKAGE RemoveObstacleMechanics : public DefaultSpellMechanics
|
class DLL_LINKAGE RemoveObstacleMechanics : public SpecialSpellMechanics
|
||||||
{
|
{
|
||||||
public:
|
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 ISpellCaster * caster) const override;
|
||||||
ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const SpellTargetingContext & ctx) const override;
|
ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const SpellTargetingContext & ctx) const override;
|
||||||
bool requiresCreatureTarget() const override;
|
bool requiresCreatureTarget() const override;
|
||||||
@ -201,10 +201,10 @@ public:
|
|||||||
ESpellCastProblem::ESpellCastProblem isImmuneByStack(const ISpellCaster * caster, const CStack * obj) const override;
|
ESpellCastProblem::ESpellCastProblem isImmuneByStack(const ISpellCaster * caster, const CStack * obj) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DLL_LINKAGE SummonMechanics : public DefaultSpellMechanics
|
class DLL_LINKAGE SummonMechanics : public SpecialSpellMechanics
|
||||||
{
|
{
|
||||||
public:
|
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;
|
ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, const ISpellCaster * caster) const override;
|
||||||
bool requiresCreatureTarget() const override;
|
bool requiresCreatureTarget() const override;
|
||||||
|
@ -578,7 +578,7 @@ std::vector<BattleHex> DefaultSpellMechanics::rangeInHexes(BattleHex centralHex,
|
|||||||
std::vector<BattleHex> ret;
|
std::vector<BattleHex> ret;
|
||||||
std::string rng = owner->getLevelInfo(schoolLvl).range + ','; //copy + artificial comma for easier handling
|
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;
|
std::string number1, number2;
|
||||||
int beg, end;
|
int beg, end;
|
||||||
@ -810,3 +810,9 @@ bool DefaultSpellMechanics::requiresCreatureTarget() const
|
|||||||
//for few exceptions see overrides
|
//for few exceptions see overrides
|
||||||
return true;
|
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 DefaultSpellMechanics;
|
||||||
|
|
||||||
class SpellCastContext
|
class DLL_LINKAGE SpellCastContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const DefaultSpellMechanics * mechanics;
|
const DefaultSpellMechanics * mechanics;
|
||||||
@ -72,3 +72,12 @@ private:
|
|||||||
|
|
||||||
friend class SpellCastContext;
|
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