Просмотр исходного кода

Fixed http://bugs.vcmi.eu/view.php?id=2529

AlexVinS 9 лет назад
Родитель
Сommit
8aa31f4073
1 измененных файлов с 11 добавлено и 2 удалено
  1. 11 2
      lib/spells/BattleSpellMechanics.cpp

+ 11 - 2
lib/spells/BattleSpellMechanics.cpp

@@ -53,10 +53,19 @@ void AntimagicMechanics::applyBattle(BattleInfo * battle, const BattleSpellCast
 
 	doDispell(battle, packet, [this](const Bonus *b) -> bool
 	{
-		if(b->source == Bonus::SPELL_EFFECT)
+		const CSpell * sourceSpell = b->sourceSpell();
+		if(sourceSpell != nullptr)
 		{
-			return b->sid != owner->id; //effect from this spell
+			//keep positive effects
+			if(sourceSpell->isPositive())
+				return false;
+			//keep own effects
+			if(sourceSpell == owner)
+				return false;
+			//remove all others
+			return true;
 		}
+
 		return false; //not a spell effect
 	});
 }