1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-05 13:04:54 +02:00

Creature is immune to dispell is it has no active effects

This commit is contained in:
AlexVinS 2015-04-03 02:23:04 +03:00
parent 0a391cd367
commit f30d5612ed
2 changed files with 10 additions and 3 deletions

View File

@ -172,10 +172,18 @@ ESpellCastProblem::ESpellCastProblem DispellMechanics::canBeCasted(const CBattle
ESpellCastProblem::ESpellCastProblem DispellMechanics::isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const ESpellCastProblem::ESpellCastProblem DispellMechanics::isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const
{ {
//DISPELL ignores all immunities //DISPELL ignores all immunities, so do not call default
std::stringstream cachingStr;
cachingStr << "source_" << Bonus::SPELL_EFFECT;
if(obj->hasBonus(Selector::sourceType(Bonus::SPELL_EFFECT), cachingStr.str()))
{
return ESpellCastProblem::OK; return ESpellCastProblem::OK;
} }
return ESpellCastProblem::WRONG_SPELL_TARGET;
}
///EarthquakeMechanics ///EarthquakeMechanics
void EarthquakeMechanics::applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const void EarthquakeMechanics::applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const
{ {

View File

@ -216,7 +216,6 @@ bool DefaultSpellMechanics::applyAdventureEffects(const SpellCastEnvironment * e
} }
} }
void DefaultSpellMechanics::battleCast(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters) const void DefaultSpellMechanics::battleCast(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters) const
{ {
BattleSpellCast sc; BattleSpellCast sc;