소스 검색

Creature is immune to dispell is it has no active effects

AlexVinS 10 년 전
부모
커밋
f30d5612ed
2개의 변경된 파일10개의 추가작업 그리고 3개의 파일을 삭제
  1. 10 2
      lib/spells/BattleSpellMechanics.cpp
  2. 0 1
      lib/spells/CDefaultSpellMechanics.cpp

+ 10 - 2
lib/spells/BattleSpellMechanics.cpp

@@ -172,8 +172,16 @@ ESpellCastProblem::ESpellCastProblem DispellMechanics::canBeCasted(const CBattle
 
 ESpellCastProblem::ESpellCastProblem DispellMechanics::isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const
 {
-	//DISPELL ignores all immunities
-	return ESpellCastProblem::OK;
+	//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::WRONG_SPELL_TARGET;
 }
 
 ///EarthquakeMechanics

+ 0 - 1
lib/spells/CDefaultSpellMechanics.cpp

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