瀏覽代碼

Simplified code a bit

M 1 年之前
父節點
當前提交
3a83de5e70
共有 1 個文件被更改,包括 10 次插入13 次删除
  1. 10 13
      server/battles/BattleActionProcessor.cpp

+ 10 - 13
server/battles/BattleActionProcessor.cpp

@@ -1220,21 +1220,18 @@ std::set<SpellID> BattleActionProcessor::getSpellsForAttackCasting(TConstBonusLi
 
 	for(auto item : spellsWithBackupLayers)
 	{
-		if(item.first < spellsWithBackupLayers.rbegin()->first)
-		{
-			bool areCurrentLayerSpellsApplied = std::all_of(item.second.begin(), item.second.end(),
-				[&](const std::shared_ptr<Bonus> spell)
-				{
-					std::vector<SpellID> activeSpells = defender->activeSpells();
-					return vstd::find(activeSpells, spell->subtype.as<SpellID>()) != activeSpells.end();
-				});
+		bool areCurrentLayerSpellsApplied = std::all_of(item.second.begin(), item.second.end(),
+			[&](const std::shared_ptr<Bonus> spell)
+			{
+				std::vector<SpellID> activeSpells = defender->activeSpells();
+				return vstd::find(activeSpells, spell->subtype.as<SpellID>()) != activeSpells.end();
+			});
 
-			if(areCurrentLayerSpellsApplied)
-				continue;
+		if(!areCurrentLayerSpellsApplied || item.first == spellsWithBackupLayers.rbegin()->first)
+		{
+			addSpellsFromLayer(item.first);
+			break;
 		}
-
-		addSpellsFromLayer(item.first);
-		break;
 	}
 
 	return spellsToCast;