Browse Source

Allow different subtypes of SOUL_STEAL work concurrently

dydzio 8 years ago
parent
commit
b5bfb763fd
1 changed files with 29 additions and 7 deletions
  1. 29 7
      server/CGameHandler.cpp

+ 29 - 7
server/CGameHandler.cpp

@@ -983,6 +983,7 @@ void CGameHandler::applyBattleEffects(BattleAttack &bat, const CStack *att, cons
 	//soul steal handling
 	if (att->hasBonusOfType(Bonus::SOUL_STEAL) && def->isLiving())
 	{
+		
 		StacksHealedOrResurrected shi;
 		shi.lifeDrain = true;
 		shi.tentHealing = false;
@@ -990,15 +991,36 @@ void CGameHandler::applyBattleEffects(BattleAttack &bat, const CStack *att, cons
 		shi.canOverheal = true;
 		shi.drainedFrom = def->ID;
 
-		StacksHealedOrResurrected::HealInfo hi;
-		hi.stackID = att->ID;
-		hi.healedHP = bsa.killedAmount * att->valOfBonuses(Bonus::SOUL_STEAL) * att->MaxHealth(); //TODO: Should unit be additionally healed after life drain?
-		hi.lowLevelResurrection = att->hasBonusOfType(Bonus::SOUL_STEAL, 1);
-		shi.healedStacks.push_back(hi);
+		if (att->hasBonusOfType(Bonus::SOUL_STEAL, 0) && att->hasBonusOfType(Bonus::SOUL_STEAL, 1))
+		{
+			StacksHealedOrResurrected::HealInfo hi0;
+			hi0.stackID = att->ID;
+			hi0.healedHP = bsa.killedAmount * att->valOfBonuses(Bonus::SOUL_STEAL, 0) * att->MaxHealth();
+			hi0.lowLevelResurrection = false;
 
-		if (hi.healedHP > 0)
+			StacksHealedOrResurrected::HealInfo hi1;
+			hi1.stackID = att->ID;
+			hi1.healedHP = bsa.killedAmount * att->valOfBonuses(Bonus::SOUL_STEAL, 1) * att->MaxHealth();
+			hi1.lowLevelResurrection = true;
+
+			shi.healedStacks.push_back(hi0);
+			shi.healedStacks.push_back(hi1);
+
+			if (hi0.healedHP > 0 || hi1.healedHP > 0)
+				bsa.healedStacks.push_back(shi);
+		}
+		else
 		{
-			bsa.healedStacks.push_back(shi);
+			StacksHealedOrResurrected::HealInfo hi;
+			hi.stackID = att->ID;
+			hi.healedHP = bsa.killedAmount * att->valOfBonuses(Bonus::SOUL_STEAL) * att->MaxHealth(); //TODO: Should unit be additionally healed after life drain?
+			hi.lowLevelResurrection = att->hasBonusOfType(Bonus::SOUL_STEAL, 1);
+			shi.healedStacks.push_back(hi);
+
+			if (hi.healedHP > 0)
+			{
+				bsa.healedStacks.push_back(shi);
+			}
 		}
 	}
 	bat.bsa.push_back(bsa); //add this stack to the list of victims after drain life has been calculated