1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-05 15:05:40 +02:00

expert DISPELL also removes spell-created obstacles

This commit is contained in:
AlexVinS 2015-04-03 03:01:05 +03:00
parent 2bf63b0ebd
commit 9d0b29b973
2 changed files with 26 additions and 1 deletions

View File

@ -185,6 +185,29 @@ ESpellCastProblem::ESpellCastProblem DispellMechanics::isImmuneByStack(const CGH
return ESpellCastProblem::WRONG_SPELL_TARGET;
}
void DispellMechanics::applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const
{
DefaultSpellMechanics::applyBattleEffects(env, parameters, ctx);
if(parameters.spellLvl > 2)
{
//expert DISPELL also removes spell-created obstacles
ObstaclesRemoved packet;
for(const auto obstacle : parameters.cb->obstacles)
{
if(obstacle->obstacleType == CObstacleInstance::FIRE_WALL
|| obstacle->obstacleType == CObstacleInstance::FORCE_FIELD
|| obstacle->obstacleType == CObstacleInstance::LAND_MINE)
packet.obstacles.insert(obstacle->uniqueID);
}
if(!packet.obstacles.empty())
env->sendAndApply(&packet);
}
}
///EarthquakeMechanics
void EarthquakeMechanics::applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const
{

View File

@ -43,7 +43,9 @@ public:
ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const override;
void applyBattle(BattleInfo * battle, const BattleSpellCast * packet) const override final;
ESpellCastProblem::ESpellCastProblem canBeCasted(const CBattleInfoCallback * cb, PlayerColor player) const override;
ESpellCastProblem::ESpellCastProblem canBeCasted(const CBattleInfoCallback * cb, PlayerColor player) const override;
protected:
void applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override;
};
class DLL_LINKAGE EarthquakeMechanics : public DefaultSpellMechanics