mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Use general dispell algorithm for CURE
This commit is contained in:
parent
32337102ac
commit
843a2a39bd
@ -127,26 +127,15 @@ ESpellCastProblem::ESpellCastProblem CloneMechanics::isImmuneByStack(const CGHer
|
||||
void CureMechanics::applyBattle(BattleInfo * battle, const BattleSpellCast * packet) const
|
||||
{
|
||||
DefaultSpellMechanics::applyBattle(battle, packet);
|
||||
|
||||
for(auto stackID : packet->affectedCres)
|
||||
doDispell(battle, packet, [](const Bonus * b) -> bool
|
||||
{
|
||||
if(vstd::contains(packet->resisted, stackID))
|
||||
if(b->source == Bonus::SPELL_EFFECT)
|
||||
{
|
||||
logGlobal->errorStream() << "Resistance to positive spell CURE";
|
||||
continue;
|
||||
CSpell * sp = SpellID(b->sid).toSpell();
|
||||
return sp->isNegative();
|
||||
}
|
||||
|
||||
CStack *s = battle->getStack(stackID);
|
||||
s->popBonuses([&](const Bonus *b) -> bool
|
||||
{
|
||||
if(b->source == Bonus::SPELL_EFFECT)
|
||||
{
|
||||
CSpell * sp = SpellID(b->sid).toSpell();
|
||||
return sp->isNegative();
|
||||
}
|
||||
return false; //not a spell effect
|
||||
});
|
||||
}
|
||||
return false; //not a spell effect
|
||||
});
|
||||
}
|
||||
|
||||
///DispellMechanics
|
||||
|
@ -834,8 +834,11 @@ void DefaultSpellMechanics::doDispell(BattleInfo * battle, const BattleSpellCast
|
||||
for(auto stackID : packet->affectedCres)
|
||||
{
|
||||
if(vstd::contains(packet->resisted, stackID))
|
||||
{
|
||||
if(owner->isPositive())
|
||||
logGlobal->errorStream() <<"Resistance to positive spell " << owner->name;
|
||||
continue;
|
||||
|
||||
}
|
||||
CStack *s = battle->getStack(stackID);
|
||||
s->popBonuses(selector);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user