Browse Source

Fix check for Demon Summon targets

Ivan Savenko 2 years ago
parent
commit
9d31830c74
1 changed files with 9 additions and 9 deletions
  1. 9 9
      lib/spells/effects/DemonSummon.cpp

+ 9 - 9
lib/spells/effects/DemonSummon.cpp

@@ -92,18 +92,18 @@ void DemonSummon::apply(ServerCallback * server, const Mechanics * m, const Effe
 bool DemonSummon::isValidTarget(const Mechanics * m, const battle::Unit * unit) const
 {
 	if(!unit->isDead())
+		return false;
+
+	//check if alive unit blocks rising
+	for(const BattleHex & hex : battle::Unit::getHexes(unit->getPosition(), unit->doubleWide(), unit->unitSide()))
 	{
-		//check if alive unit blocks rising
-		for(const BattleHex & hex : battle::Unit::getHexes(unit->getPosition(), unit->doubleWide(), unit->unitSide()))
+		auto blocking = m->battle()->battleGetUnitsIf([hex, unit](const battle::Unit * other)
 		{
-			auto blocking = m->battle()->battleGetUnitsIf([hex, unit](const battle::Unit * other)
-			{
-				return other->isValidTarget(false) && other->coversPos(hex) && other != unit;
-			});
+			return other->isValidTarget(false) && other->coversPos(hex) && other != unit;
+		});
 
-			if(!blocking.empty())
-				return false;
-		}
+		if(!blocking.empty())
+			return false;
 	}
 
 	if (unit->isGhost())