|
|
@@ -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);
|