mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
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 ...
This commit is contained in:
parent
f99bf099ca
commit
02c15085be
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user