Browse Source

Remove (aready disabled in prev. commit) active stack change in sacrifice mechanics
* stack removing is evil, but changing active stack by spells is more evil ...

AlexVinS 10 years ago
parent
commit
02c15085be
1 changed files with 1 additions and 28 deletions
  1. 1 28
      lib/spells/BattleSpellMechanics.cpp

+ 1 - 28
lib/spells/BattleSpellMechanics.cpp

@@ -583,34 +583,7 @@ void SacrificeMechanics::applyBattleEffects(const SpellCastEnvironment * env, co
 	}
 	//resurrect target after basic checks
 	RisingSpellMechanics::applyBattleEffects(env, parameters, ctx);
-
-	if(victim == parameters.cb->battleActiveStack())
-	//set another active stack than the one removed, or bad things will happen
-	//TODO: make that part of BattleStacksRemoved? what about client update?
-	{
-		std::vector<const CStack *> stackQueue;
-		parameters.cb->battleGetStackQueue(stackQueue, 100, -1); //FIXME: magic values detected, there should be a way to get stack queue for one full turn
-		const CStack * stackToActivate = nullptr;		
-		for(const CStack * iter : stackQueue)
-		{
-			//we need to find first stack distinct from victim
-			//stack may appear in queue multiple times even in a row
-			if(iter != victim)
-			{
-				assert(iter->ID != victim->ID);//yes it is paranoid
-				stackToActivate = iter;
-				break;
-			}
-		}
-		if(nullptr == stackToActivate)
-		{
-			env->complain("No new stack to activate! Cast aborted");
-			return; //do not sacrifice stack if there is no new stack. should now ever happen, but just in case
-		}
-		BattleSetActiveStack sas;
-		sas.stack = stackToActivate->ID;
-		//env->sendAndApply(&sas);
-	}
+	//it is safe to remove even active stack
 	BattleStacksRemoved bsr;
 	bsr.stackIDs.insert(victim->ID);
 	env->sendAndApply(&bsr);