1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Fixed 0002280

This commit is contained in:
AlexVinS 2015-10-06 01:26:50 +03:00
parent f1d9e15783
commit 4e60b4cf53
2 changed files with 18 additions and 13 deletions

View File

@ -1459,21 +1459,15 @@ DLL_LINKAGE void StacksHealedOrResurrected::applyGs( CGameState *gs )
}
}
vstd::amin(changedStack->firstHPleft, changedStack->MaxHealth());
//removal of negative effects
if(resurrected)
{
//removing all features from negative spells
const BonusList tmpFeatures = changedStack->getBonusList();
//changedStack->bonuses.clear();
for(Bonus *b : tmpFeatures)
//removing all effects from negative spells
auto selector = [](const Bonus * b)
{
const CSpell *s = b->sourceSpell();
if(s && s->isNegative())
{
changedStack->removeBonus(b);
}
}
return (s != nullptr) && s->isNegative() && (s->id != SpellID::DISRUPTING_RAY);
};
changedStack->popBonuses(selector);
}
}
}

View File

@ -742,7 +742,6 @@ ESpellCastProblem::ESpellCastProblem DefaultSpellMechanics::canBeCast(const CBat
return ESpellCastProblem::OK;
}
ESpellCastProblem::ESpellCastProblem DefaultSpellMechanics::isImmuneByStack(const ISpellCaster * caster, const CStack * obj) const
{
//by default use general algorithm
@ -751,10 +750,22 @@ ESpellCastProblem::ESpellCastProblem DefaultSpellMechanics::isImmuneByStack(cons
void DefaultSpellMechanics::doDispell(BattleInfo * battle, const BattleSpellCast * packet, const CSelector & selector) const
{
auto localSelector = [](const Bonus * bonus)
{
const CSpell * sourceSpell = bonus->sourceSpell();
if(sourceSpell != nullptr)
{
//Special case: DISRUPTING_RAY is "immune" to dispell
//Other even PERMANENT effects can be removed (f.e. BIND)
if(sourceSpell->id == SpellID::DISRUPTING_RAY)
return false;
}
return true;
};
for(auto stackID : packet->affectedCres)
{
CStack *s = battle->getStack(stackID);
s->popBonuses(selector);
s->popBonuses(CSelector(localSelector).And(selector));
}
}